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

@flarcos/arazzo-sdk

v0.1.0

Published

Parse Arazzo 1.0.1 workflow specifications and generate typed TypeScript SDKs for Open Payments API workflows

Readme

@flarcos/arazzo-sdk

Parse Arazzo 1.0.1 workflow specifications and generate typed TypeScript SDKs for the Open Payments API.

Turn 9 sequential API calls into one function call:

import { OpenPaymentsClient } from '@flarcos/arazzo-sdk/generated';

const client = new OpenPaymentsClient({
  serverUrls: {
    walletAddressServer: 'https://wallet.example.com',
    resourceServer: 'https://wallet.example.com',
    authServer: 'https://auth.wallet.example.com',
  },
  gnapConfig: {
    clientWalletAddress: 'https://wallet.example.com/me',
    privateKey: myPrivateKey,
    keyId: 'my-key-id',
  },
  interactionHandler: async ({ redirectUrl }) => {
    // Redirect user for consent, return the interact_ref
    return await redirectUserForConsent(redirectUrl);
  },
});

const payment = await client.oneTimePaymentFixedReceive({
  recipientWalletAddressUrl: 'https://wallet.example.com/alice',
  senderWalletAddressUrl: 'https://wallet.example.com/bob',
  amount: '2500',
  assetCode: 'USD',
  assetScale: 2,
  clientWalletAddress: 'https://wallet.example.com/me',
});

console.log(payment.outgoingPaymentId);  // fully typed
console.log(payment.debitAmount);        // { value, assetCode, assetScale }

Features

  • Code Generator — Parse Arazzo YAML → emit typed TypeScript SDK
  • Runtime Executor — Execute workflows dynamically without code generation
  • CLI Toolgenerate, validate, and inspect commands
  • Dynamic Token Passing — Automatically captures GNAP tokens from grant steps and injects them into subsequent resource server calls
  • Interactive Grant Handling — Pauses for user consent on interactive grants, then resumes automatically
  • Dynamic Server Discovery — Resolves authServer and resourceServer URLs from wallet address lookups
  • GNAP Integration — Wires up @flarcos/kiota-authentication-gnap for RFC 9635 auth

Installation

npm install @flarcos/arazzo-sdk

CLI Usage

Generate SDK

# Generate typed TypeScript SDK from Arazzo workflow files
arazzo-sdk generate -i "arazzo/*.arazzo.yaml" -o src/generated/

# Generate types only (no client class)
arazzo-sdk generate -i "arazzo/*.arazzo.yaml" -o src/generated/ --types-only

Validate

# Validate Arazzo files for spec compliance
arazzo-sdk validate -i "arazzo/*.arazzo.yaml"

Inspect

# Display workflow structure, inputs, steps, and outputs
arazzo-sdk inspect -i "arazzo/one-time-payment-fixed-receive.arazzo.yaml"

Output:

📄 Open Payments — One-Time Payment (Fixed Receive) (v1.0.0)
   Arazzo: 1.0.1
   Sources: walletAddressServer, resourceServer, authServer

   📋 Workflow: oneTimePaymentFixedReceive
      Inputs:
        - recipientWalletAddressUrl: string (required)
        - senderWalletAddressUrl: string (required)
        - amount: string (required)
        ...
      Steps:
        getRecipientWalletAddress → walletAddressServer.get-wallet-address
        requestIncomingPaymentGrant → authServer.post-request
        createIncomingPayment → resourceServer.create-incoming-payment
        ...
      Outputs:
        - outgoingPaymentId: $steps.createOutgoingPayment.outputs.outgoingPaymentId
        - debitAmount: $steps.createQuote.outputs.debitAmount

Generated Workflows

| Method | Description | Steps | |--------|-------------|-------| | oneTimePaymentFixedReceive() | Fixed receive amount payment | 9 | | oneTimePaymentFixedSend() | Fixed send amount payment | 9 | | setupRecurringPayment() | Recurring payment with interval limits | 9 | | listIncomingPayments() | Paginated incoming payment listing | 3 | | listOutgoingPayments() | Paginated outgoing payment listing | 3 | | getPaymentDetails() | Get specific payment details | 4 | | rotateAccessToken() | Rotate a GNAP access token | 1 | | revokeAccessToken() | Revoke a GNAP access token | 1 | | cancelGrant() | Cancel an active grant | 1 |

Programmatic API

Parser

import { parseArazzoFile, extractOperationIds } from '@flarcos/arazzo-sdk';

const parsed = parseArazzoFile('arazzo/one-time-payment-fixed-receive.arazzo.yaml');

console.log(parsed.document.workflows[0].workflowId);
// → 'oneTimePaymentFixedReceive'

const opIds = extractOperationIds(parsed.document);
// → ['walletAddressServer.get-wallet-address', 'authServer.post-request', ...]

Runtime Executor

import { executeWorkflow } from '@flarcos/arazzo-sdk';

const result = await executeWorkflow(workflow, {
  inputs: { recipientWalletAddressUrl: '...', amount: '2500' },
  serverUrls: {
    walletAddressServer: 'https://wallet.example.com',
    resourceServer: 'https://wallet.example.com',
    authServer: 'https://auth.wallet.example.com',
  },
  interactionHandler: async ({ redirectUrl }) => {
    return await getConsentFromUser(redirectUrl);
  },
  hooks: {
    beforeStep: (stepId, request) => {
      console.log(`→ ${stepId}: ${request.method} ${request.url}`);
    },
    afterStep: (stepId, result) => {
      console.log(`← ${stepId}: ${result.response.status}`);
    },
    onTokenAcquired: (stepId, token, type) => {
      console.log(`🔑 ${stepId}: acquired ${type}`);
    },
    onServerResolved: (stepId, servers) => {
      console.log(`🌐 ${stepId}: resolved`, servers);
    },
  },
});

Code Generator

import { parseArazzoFiles } from '@flarcos/arazzo-sdk';
import { generateSDK } from '@flarcos/arazzo-sdk';

const parsed = parseArazzoFiles(['workflow1.arazzo.yaml', 'workflow2.arazzo.yaml']);

generateSDK(parsed, {
  outputDir: 'src/generated',
  className: 'MyPaymentsClient',
});

How Token Passing Works

The executor automatically manages GNAP tokens across steps:

Step 2: requestIncomingPaymentGrant (authServer)
  → Response: { access_token: { value: "tok_abc" } }
  → Executor captures "tok_abc" as current token

Step 3: createIncomingPayment (resourceServer)
  → Executor injects: Authorization: GNAP tok_abc
  → Token used automatically, no manual wiring needed

Token capture triggers on any step output matching *AccessToken or accessToken.

How Interactive Grants Work

When a step returns interact.redirect, the executor pauses:

Step 7: requestOutgoingPaymentGrant (authServer)
  → Response: { interact: { redirect: "https://auth.example.com/consent/..." } }
  → Executor calls your interactionHandler(redirectUrl)
  → You redirect the user, collect consent, return interact_ref
  → Executor stores interact_ref and continues

Step 8: continueOutgoingPaymentGrant (authServer)
  → Executor injects interact_ref into the request body
  → Grant finalized, outgoing payment token acquired

How Dynamic Server Resolution Works

Wallet address resolution steps automatically update server URLs:

Step 1: getRecipientWalletAddress (walletAddressServer)
  → Response: { authServer: "https://auth.recipient.com", resourceServer: "https://rs.recipient.com" }
  → Executor updates serverUrls.authServer and serverUrls.resourceServer
  → All subsequent steps use the discovered URLs

Project Structure

arazzo-sdk/
├── src/
│   ├── index.ts                        # Public exports
│   ├── cli.ts                          # CLI entry point
│   ├── parser/
│   │   ├── types.ts                    # Arazzo 1.0.1 type definitions
│   │   └── arazzo-parser.ts            # YAML → typed AST
│   ├── generator/
│   │   ├── type-mapper.ts              # JSON Schema → TypeScript
│   │   ├── templates.ts               # Code generation templates
│   │   └── codegen.ts                  # AST → TypeScript source
│   ├── runtime/
│   │   ├── types.ts                    # Runtime types
│   │   ├── expression-resolver.ts      # $inputs, $steps, $response
│   │   ├── http-client.ts             # Fetch + GNAP auth
│   │   └── workflow-executor.ts        # Step execution engine
│   └── generated/
│       └── open-payments-client.ts     # Generated SDK
└── test/
    ├── parser.test.ts
    ├── expression-resolver.test.ts
    └── codegen.test.ts

License

Apache-2.0