npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vs-fas/finance-agent

v1.0.0

Published

TypeScript SDK for Finance Agent API

Downloads

63

Readme

Finance Agent SDK

TypeScript/JavaScript SDK for interacting with the Finance Agent API.

Installation

npm install @vs-fas/finance-agent

Usage

Initialize the SDK

import FinanceAgentSDK from "@vs-fas/finance-agent";

const client = new FinanceAgentSDK({
  baseUrl: "https://your-app.cfapps.eu10.hana.ondemand.com",
});

File Operations

Upload a File

// Browser
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];
const result = await client.files.uploadFile(file);
console.log("Uploaded:", result.file);

// Node.js
import fs from "fs";
const buffer = fs.readFileSync("./document.pdf");
const result = await client.files.uploadFile({
  buffer,
  filename: "document.pdf",
});

List All Files

const files = await client.files.getFiles();
console.log("Files:", files);

Delete a File

const message = await client.files.deleteFile("stored-filename.pdf");
console.log(message); // "File deleted successfully"

Chat Operations

Connect to Chat

await client.chat.connect({
  onConnected: (session) => {
    console.log("Connected to session:", session.sessionId);
  },
  onAgentMessage: (message) => {
    console.log("Agent says:", message.text);
  },
  onUserMessage: (message) => {
    console.log("User says:", message.text);
  },
  onTypingStart: () => {
    console.log("Agent is typing...");
  },
  onTypingStop: () => {
    console.log("Agent stopped typing");
  },
  onError: (error) => {
    console.error("Chat error:", error);
  },
});

Send a Message

client.chat.sendMessage("Hello, how can you help me?");

Get All Messages

client.chat.getMessages();

Start New Session

client.chat.startNewSession();

Disconnect

client.chat.disconnect();

Complete Example

import FinanceAgentSDK from "@vs-fas/finance-agent";

async function main() {
  // Initialize SDK
  const client = new FinanceAgentSDK({
    baseUrl: "https://your-app.cfapps.eu10.hana.ondemand.com",
  });

  // Connect to chat
  await client.chat.connect({
    onAgentMessage: (message) => {
      console.log("Agent:", message.text);
    },
  });

  // Send a message
  client.chat.sendMessage("What files do I have?");

  // List files
  const files = await client.files.getFiles();
  console.log("Available files:", files.length);

  // Disconnect when done
  setTimeout(() => {
    client.chat.disconnect();
  }, 30000);
}

main().catch(console.error);

API Reference

FinanceAgentSDK

Main SDK class that provides access to file and chat clients.

Constructor

new FinanceAgentSDK(config: FinanceAgentConfig)

Config options:

  • baseUrl (required): Base URL of the Finance Agent API
  • headers (optional): Custom headers

FileClient

Handles file operations.

Methods

  • uploadFile(file): Upload a file
  • getFiles(): Get list of all files
  • deleteFile(filename): Delete a file by stored name

ChatClient

Handles WebSocket-based chat communication.

Methods

  • connect(handlers): Connect to chat WebSocket
  • sendMessage(text): Send a chat message
  • getMessages(): Request all messages
  • getTypingStatus(): Get current typing status
  • startNewSession(): Start a new chat session
  • disconnect(): Disconnect from WebSocket
  • isConnected(): Check connection status

Types

See types.ts for complete type definitions.

Roadmap

Authentication (Coming Soon)

Future versions of this SDK will include built-in support for SAP Identity and Access Management (IAS) and XSUAA authentication flows:

  • Client Credentials Flow — for server-to-server integrations where the application authenticates directly using a client ID and secret, without user involvement.
  • Authorization Code Flow — for user-facing applications where end users authenticate via IAS/XSUAA and the SDK exchanges the authorization code for an access token automatically.

These additions will make it straightforward to integrate the SDK securely into SAP BTP environments without manually managing tokens.

License

MIT