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

@zcatalyst/functions

v0.0.3

Published

JavaScript SDK for Catalyst Basic I/O Functions - Serverless Function Execution

Readme

@zcatalyst/functions

JavaScript SDK for Catalyst Basic I/O Functions - Serverless Function Execution

Overview

The @zcatalyst/functions package provides JavaScript/TypeScript methods to execute deployed Catalyst Basic I/O Functions by ID or name.

Operation Scope

Both the Node and browser entry points export the same class name (Functions) and the same method signature (execute(idOrName, payload, opts?)). What changes is how the request is authenticated and from where it can be invoked.

| Operation | Method | Available in | |---|---|---| | Invoke a function from a Catalyst function | Functions.execute(idOrName, payload, opts?) | Node + Browser (user) |

Prerequisites

Installation

To install this package, simply type add or install @zcatalyst/functions using your favorite package manager:

  • npm install @zcatalyst/functions
  • yarn add @zcatalyst/functions
  • pnpm add @zcatalyst/functions

Getting Started

Import

The Catalyst SDK is modularized by Components. To execute Catalyst functions, you only need to import the Functions:

// ES5 example
const { Functions } = require("@zcatalyst/functions");
// ES6+ example
import { Functions } from "@zcatalyst/functions";

Usage

Node.js Environment

For server-side function execution:

const functions = new Functions(app);

// Execute function with GET method
const result = await functions.execute('function-name', {
  args: {
    param1: 'value1',
    param2: 'value2'
  },
  method: 'GET'
});

// Execute function with POST method
const result = await functions.execute('function-id', {
  data: {
    name: 'John Doe',
    email: '[email protected]'
  },
  method: 'POST'
});

// Simple execution (defaults to GET)
const result = await functions.execute('my-function', {
  args: { query: 'search-term' }
});

Browser Environment

For client-side function execution:

const functions = new Functions();

// Execute function from browser
const result = await functions.execute('api-function', {
  args: {
    userId: '12345',
    action: 'get-profile'
  }
});

// POST request from browser
const result = await functions.execute('submit-data', {
  data: {
    formData: {
      name: 'Jane Doe',
      age: 30
    }
  },
  method: 'POST'
});

Environment Support

This package has separate Node.js and browser entry points:

  • Node.js: Uses server-side HTTP requests
  • Browser: Uses client-side HTTP requests

Async/await

We recommend using await operator to wait for the promise returned by function execution:

// async/await.
try {
  const result = await functions.execute('my-function');
  // process result.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Error Handling

try {
  const result = await functions.execute('my-function');
  // process result.
} catch (error) {
  const message = error.message;
  const status = error.statusCode;
  console.log({ message, status });
}

Method Details

Function Execution

The execute method provides flexible function invocation:

const result = await functions.execute(functionId, options);

Parameters:

  • functionId: Function ID or function name (string, required)
  • options: Configuration object (optional)
    • args: Query parameters for GET requests
    • data: Request body for POST requests
    • method: HTTP method ('GET' or 'POST', defaults to 'GET')

Execute Function

const result = await functions.execute('function-name', {
  args: {
    param1: 'value1',
    param2: 'value2',
    limit: '10',
    offset: '0'
  },
  method: 'GET'
});

console.log('Function result:', result);
const result = await functions.execute('function-id', {
  data: {
    name: 'John Doe',
    email: '[email protected]',
    preferences: {
      theme: 'dark',
      language: 'en'
    }
  },
  method: 'POST'
});

console.log('Function result:', result);
// Defaults to GET method
const result = await functions.execute('my-function', {
  args: { query: 'search-term' }
});

// Using data alias (same as args)
const result = await functions.execute('my-function', {
  data: { query: 'search-term' }
});
// Use function name instead of ID
const result = await functions.execute('getUserProfile', {
  args: { userId: '12345' }
});

Function Parameters

// For GET requests - parameters become query string
const result = await functions.execute('search-function', {
  args: {
    q: 'search term',
    category: 'books',
    limit: '20'
  }
});

// For POST requests - parameters become request body
const result = await functions.execute('create-function', {
  data: {
    title: 'New Book',
    author: 'Author Name',
    category: 'Fiction'
  },
  method: 'POST'
});

Response Handling

const result = await functions.execute('data-processor');

// Result is typically a string (JSON string for complex data)
try {
  const parsedResult = JSON.parse(result);
  console.log('Parsed result:', parsedResult);
} catch (parseError) {
  console.log('Raw result:', result);
}

Resources

Contributing

See CONTRIBUTING for more information on how to get started.

License

This SDK is distributed under the Apache License 2.0. See LICENSE file for more information.