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

@wave-av/workflow-sdk

v1.0.6

Published

WAVE Workflow SDK — build and execute multi-phase workflows with real-time events, checkpoints, and retry logic

Readme

@wave-av/workflow-sdk

npm version npm downloads license

Official SDK for building and executing workflows on the WAVE platform.

Installation

npm install @wave-av/workflow-sdk
# or
yarn add @wave-av/workflow-sdk
# or
pnpm add @wave-av/workflow-sdk

Quick start

import { WaveWorkflowClient } from '@wave-av/workflow-sdk';

// Create a client
const client = new WaveWorkflowClient({
  apiKey: process.env.WAVE_API_KEY!,
  organizationId: 'org_123',
});

// Execute a workflow
const execution = await client.execute('my-workflow', {
  input_params: {
    environment: 'production',
  },
});

console.log('Execution started:', execution.id);

// Wait for completion
const result = await client.waitForCompletion(execution.id);
console.log('Result:', result.status);

Building workflows

Use the fluent builder API to create workflow definitions:

import { WorkflowBuilder } from '@wave-av/workflow-sdk';

const workflow = new WorkflowBuilder('data-pipeline')
  .name('Data Processing Pipeline')
  .description('ETL pipeline for processing analytics data')
  .category('data-processing')
  .version('1.0.0')
  .tags('etl', 'analytics')
  .phase('extract', (phase) =>
    phase
      .description('Extract data from source systems')
      .agent('data-extractor', { source: 'api', endpoint: '/data' })
  )
  .phase('transform', (phase) =>
    phase
      .description('Transform and validate data')
      .agent('data-transformer', { format: 'json' })
      .onFailure('retry')
  )
  .phase('load', (phase) =>
    phase
      .description('Load data to destination')
      .agent('data-loader', { destination: 'database' })
  )
  .timeout(3600)
  .enableCheckpoints()
  .maxRetries(3)
  .build();

// Export as JSON
console.log(JSON.stringify(workflow, null, 2));

API reference

WaveWorkflowClient

Constructor options

const client = new WaveWorkflowClient({
  apiKey: string;           // Required: API key for authentication
  organizationId: string;   // Required: Organization ID for tenant isolation
  baseUrl?: string;         // Optional: API base URL (default: https://api.wave.online)
  timeout?: number;         // Optional: Request timeout in ms (default: 30000)
  debug?: boolean;          // Optional: Enable debug logging
});

Methods

Workflow definitions
// Get a workflow by slug
const workflow = await client.getWorkflow('my-workflow');

// List all workflows
const { workflows, total } = await client.listWorkflows({
  category: 'devops',
  status: 'active',
  limit: 10,
});
Executions
// Execute a workflow
const execution = await client.execute('my-workflow', {
  input_params: { key: 'value' },
  idempotency_key: 'unique-key',
});

// Get execution status
const status = await client.getExecution(execution.id);

// List executions
const { executions } = await client.listExecutions({
  workflow_id: 'workflow-id',
  status: 'running',
  limit: 20,
});

// Cancel an execution
await client.cancelExecution(execution.id);

// Pause an execution
await client.pauseExecution(execution.id);

// Resume a paused execution
await client.resumeExecution(execution.id);

// Retry a failed execution
await client.retryExecution(execution.id, { from_checkpoint: true });
Convenience methods
// Wait for completion with progress callback
const result = await client.waitForCompletion(execution.id, {
  pollInterval: 2000,  // Poll every 2 seconds
  timeout: 3600000,    // 1 hour timeout
  onProgress: (exec) => {
    console.log(`Status: ${exec.status}, Phase: ${exec.current_phase}`);
  },
});

// Execute and wait in one call
const result = await client.executeAndWait('my-workflow', {
  input_params: { key: 'value' },
});
Logs
// Get execution logs
const { logs } = await client.getLogs(execution.id, {
  level: 'error',
  limit: 100,
});
Real-time events
// Subscribe to execution events
const unsubscribe = client.subscribeToExecution(execution.id);

client.on('execution.started', (event) => {
  console.log('Execution started:', event);
});

client.on('phase.completed', (event) => {
  console.log('Phase completed:', event.data.phase_name);
});

client.on('execution.completed', (event) => {
  console.log('Execution completed in', event.data.duration_ms, 'ms');
  unsubscribe();
});

client.on('error', (error) => {
  console.error('Error:', error);
});

Types

All TypeScript types are exported from the package:

import type {
  WorkflowDefinition,
  WorkflowPhase,
  WorkflowAgent,
  WorkflowConfig,
  WorkflowExecution,
  ExecutionStatus,
  ExecutionLog,
  AnyWorkflowEvent,
} from '@wave-av/workflow-sdk';

Validation

The SDK includes Zod schemas for runtime validation:

import { WorkflowDefinitionSchema } from '@wave-av/workflow-sdk/types';

const result = WorkflowDefinitionSchema.safeParse(workflowData);
if (!result.success) {
  console.error('Validation errors:', result.error.issues);
}

Error handling

try {
  const execution = await client.execute('my-workflow');
} catch (error) {
  if (error.message.includes('API error (404)')) {
    console.error('Workflow not found');
  } else if (error.message.includes('timeout')) {
    console.error('Request timed out');
  } else {
    console.error('Unknown error:', error);
  }
}

Environment variables

| Variable | Description | |----------|-------------| | WAVE_API_KEY | API key for authentication | | WAVE_ORGANIZATION_ID | Organization ID for tenant isolation | | WAVE_API_URL | Optional: Custom API base URL |

Related packages

License

MIT