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

@defuse-protocol/outlayer-sdk

v0.5.1

Published

TypeScript gRPC SDK for the Outlayer service

Readme

@defuse-protocol/outlayer-sdk

TypeScript gRPC SDK for the Outlayer service, built with Connect-ES. Node.js only — speaks gRPC over HTTP/2 to the worker, and ships the generated message types plus an execute helper.

Install

The SDK is published publicly to npm:

npm install @defuse-protocol/outlayer-sdk

Usage

import { createOutlayerClient } from "@defuse-protocol/outlayer-sdk";

const client = createOutlayerClient("http://localhost:50051");

const res = await client.execute({
  app: { appId: "app.near" },
  input: new TextEncoder().encode("{}"),
});

if (res.error) {
  console.error(res.error, res.fuelConsumed); // WASM run failed (returned as data)
} else {
  console.log(new TextDecoder().decode(res.output), res.fuelConsumed);
}

Apps can also be executed directly from a URL with either a hexadecimal or raw-byte SHA-256 hash:

const res = await client.execute({
  app: {
    codeUrl: "https://example.com/app.wasm",
    codeHash: "8f2466da...",
  },
  input: new TextEncoder().encode("{}"),
});

execute resolves to { output, logs, fuelConsumed, error? }; output/logs are raw Uint8Arrays. A populated error means the run reached the worker but the WASM failed — returned as data, not thrown. Transport failures reject with a ConnectError.

Authentication

A worker behind Google IAM wants a Google ID token. Create a Google token manager and inject it into the client. The manager mints, caches, and refreshes tokens. If the worker rejects a request as unauthenticated, the Google manager invalidates the cached token, generates a fresh one, and retries once:

import {
  createGoogleJwtTokenManager,
  createOutlayerClient,
  type JwtTokenManager,
} from "@defuse-protocol/outlayer-sdk";

const jwtTokenManager = createGoogleJwtTokenManager({
  impersonate: "[email protected]",
});

const client = createOutlayerClient({
  endpoint: "https://worker.example.com:443",
  auth: jwtTokenManager,
});

Omit auth for a worker with authentication disabled. With Google, omit impersonate to use Application Default Credentials directly:

createOutlayerClient("http://localhost:50051");
createGoogleJwtTokenManager();
createGoogleJwtTokenManager({ impersonate });

Google auth needs the optional peer dependency google-auth-library. Install it only when using createGoogleJwtTokenManager.

The audience defaults to outlayer, which is what the worker expects unless its deployment sets another one. Override it in the manager options:

createGoogleJwtTokenManager({ audience: "another-audience" });

Other identity providers can implement the provider-neutral interface:

const jwtTokenManager: JwtTokenManager = {
  generateToken: () => myTokenSource(),
  invalidateToken: async () => clearMyTokenCache(),
  handleAuthError: async (error) => {
    throw error;
  },
};

Call invalidateToken() at any time to force the next request to generate a fresh token:

jwtTokenManager.invalidateToken();

An authToken passed to execute overrides the configured manager for that request. The override can be a token or a synchronous or asynchronous function:

await client.execute({ app, input }, { authToken: idToken });
await client.execute({ app, input }, { authToken: () => getFreshToken() });

Override tokens are sent as given and bypass the manager's retry behavior.

The JWT-protected worker integration test is disabled unless its endpoint or token is configured. Provide both variables to run it:

OUTLAYER_ENDPOINT=https://worker.example.com:443 \
OUTLAYER_JWT_TOKEN="$(get-token)" \
pnpm test:jwt-live

For inline WASM, a fuel limit, or a custom transport, use the underlying Connect client at client.raw, or build your own from the re-exported OutlayerService.