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

@voidwalkers/void-functions

v0.1.10

Published

Functions for Void Walkers Void

Readme

@voidwalkers/void-functions

Runtime library for writing Void Walkers Void serverless functions. You use it inside the functions/ package that @voidwalkers/void-cli scaffolds; the CLI deploys that package and the Void runtime invokes the functions you register here.

# from your project root, functions live in ./functions
void-cli init
void-cli deploy -F            # deploy all functions
void-cli deploy -F echo       # deploy specific functions

Registering functions

import {registerHttpFunction, registerCallFunction} from '@voidwalkers/void-functions';

// HTTP function: reachable over HTTP, Express-like (req, res)
registerHttpFunction('hello-world', (req, res) => {
  res.send('Hello World!');
});

// Call function: invoked from the client SDK as voidClient.function('echo')(data)
registerCallFunction('echo', (data, context) => {
  // context.projectUser === {id} of the authenticated user, or null when anonymous
  return {context, data};
});

Whether a function is HTTP or call is decided by which register function you callFunctionType is not something you pass yourself.

Function options

Both registerHttpFunction and registerCallFunction take an optional third options argument. This is where the FunctionSystemRole / FunctionTrigger* enums are used:

import {
  registerCallFunction,
  FunctionSystemRole,
  FunctionTriggerEvent,
  FunctionTriggerSubject
} from '@voidwalkers/void-functions';

// The function that authenticates users (assigns a system role; becomes private)
registerCallFunction('auth', (credentials) => { /* … */ }, {
  systemRole: FunctionSystemRole.UserAuth
});

// Run automatically when a document is written, instead of being called directly
registerCallFunction('on-item-write', (event) => { /* … */ }, {
  trigger: {
    subject: FunctionTriggerSubject.MongoDocument,
    event: FunctionTriggerEvent.Write,
    data: {} // optional, subject-specific configuration
  }
});

// Internal helper that clients must not call directly
registerHttpFunction('internal-webhook', (req, res) => { /* … */ }, {
  isPrivate: true
});

| Option | Type | Effect | | ------------ | -------------------------------------- | ------------------------------------------------------------------------- | | isPrivate | boolean | Marks the function private — not directly callable by clients | | systemRole | FunctionSystemRole | Assigns a platform role (e.g. UserAuth = the user-auth handler); implies private | | trigger | {subject, event, data?} | Runs the function on a platform event instead of direct calls; implies private |

A function is treated as private if any of isPrivate, systemRole, or trigger is set (see how the CLI resolves this in void-cli's deploy step). Private functions are deployed but not exposed for direct client invocation.

The trigger object combines a subject (what to watch) with an event (when to fire), plus an optional subject-specific data payload:

| Enum | Values | | ----------------------- | -------------------------------------------------------------- | | FunctionTriggerSubject | AuthUser (auth_user), MongoDocument (mongo_document), Schedule (schedule) | | FunctionTriggerEvent | Create, Update, Delete, Write, Schedule |

On the client side a call function is invoked like this (see @voidwalkers/void-client):

const result = await voidClient.function('echo')({hello: 'world'});
// => {context: {projectUser: {id: 'UUID'}}, data: {hello: 'world'}}

Reading project config

Values set with void-cli config set <key> <value> are available at runtime:

import {getConfigValue} from '@voidwalkers/void-functions';

const maxItems = await getConfigValue('maxItems', 50); // second arg is the default
const apiKey = await getConfigValue('stripeKey');      // throws if missing and no default

API

| Export | Purpose | | -------------------------------------------- | ----------------------------------------------------------------------- | | registerHttpFunction(name, fn, options?) | Register an HTTP function (req, res) => … | | registerCallFunction(name, fn, options?) | Register a callable function (data, context) => result | | getConfigValue(key, defaultValue?) | Read a project config; throws if missing and no default is provided | | setRegisterHandler(fn) / setGetConfigValueHandler(fn) | Wiring hooks the Void runtime sets — not called by user code |

Enums

Exported for use in the options argument (above) and for typing:

  • FunctionSystemRoleUserAuth (the function that authenticates users)
  • FunctionTriggerEventCreate, Update, Delete, Write, Schedule
  • FunctionTriggerSubjectAuthUser, MongoDocument, Schedule
  • ProjectUserCredentialsTypeCustom, Email

(Call vs Http is selected by the register function you call, so the FunctionType enum is internal and not exported.)

Related