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

@onlineapps/cookbook-executor

v1.0.12

Published

Workflow execution engine for cookbook definitions - handles context and step processing

Readme

@onlineapps/cookbook-executor

Workflow execution engine for cookbook definitions - handles context management and step processing.

Overview

This package provides the execution engine for cookbook workflows. It manages context, processes different step types, and handles variable resolution throughout workflow execution.

Installation

npm install @onlineapps/cookbook-executor

Features

  • Complete step type support - All step types (task, foreach, fork_join, switch, steps, wait, dispatch)
  • Context management - Maintains workflow state and variables
  • Variable resolution - Supports $api_input, $steps, JSONPath
  • Retry logic - Built-in retry with exponential backoff
  • Execution tracing - Complete audit trail of execution

Usage

Basic workflow execution

const { CookbookExecutor } = require('@onlineapps/cookbook-executor');

const cookbook = {
  version: '1.0.0',
  steps: [
    {
      id: 'step1',
      type: 'task',
      service: 'hello-service',
      operation: 'greet',
      input: {
        name: '$api_input.name'
      }
    }
  ]
};

const executor = new CookbookExecutor(cookbook);
const result = await executor.execute({ name: 'World' });

Context management

const { ContextManager } = require('@onlineapps/cookbook-executor');

const context = new ContextManager();
context.setInput({ user: 'John' });
context.set('workflow_id', 'wf_123');

// Resolve variables
const value = context.resolve('$api_input.user'); // 'John'

Variable resolution

const { VariableResolver } = require('@onlineapps/cookbook-executor');

const resolver = new VariableResolver(context);

// Resolve different types
resolver.resolve('$api_input.name');
resolver.resolve('$steps.step1.output');
resolver.resolve('$.steps[?(@.status=="success")]');

Step Types

Task Step

Execute service operations:

{
  id: 'call-service',
  type: 'task',
  service: 'my-service',
  operation: 'process',
  input: { data: '$api_input.data' },
  output: { result: '$.response.result' }
}

Foreach Step

Iterate over arrays:

{
  id: 'process-items',
  type: 'foreach',
  iterator: '$api_input.items',
  body: [/* steps to execute for each item */]
}

Fork Join Step

Parallel execution:

{
  id: 'parallel-processing',
  type: 'fork_join',
  branches: [/* parallel steps */],
  join: {
    strategy: 'merge',
    output: { combined: '$.branches' }
  }
}

Switch Step

Conditional branching:

{
  id: 'conditional',
  type: 'switch',
  expression: '$api_input.type',
  cases: {
    'A': { /* step for case A */ },
    'B': { /* step for case B */ }
  },
  default: { /* default step */ }
}

API Reference

CookbookExecutor

  • constructor(cookbook, options) - Create executor instance
  • execute(input) - Execute workflow with input
  • executeStep(step) - Execute single step
  • getContext() - Get current context state
  • getTrace() - Get execution trace

ContextManager

  • setInput(input) - Set workflow input
  • set(key, value) - Set context variable
  • get(key) - Get context variable
  • setStepResult(stepId, result) - Store step result
  • resolve(reference) - Resolve variable reference

StepProcessor

  • process(step) - Process any step type
  • processTask(step) - Process task step
  • processForeach(step) - Process foreach step
  • processForkJoin(step) - Process fork_join step

Options

{
  maxRetries: 3,           // Maximum retry attempts
  defaultTimeout: 30000,   // Default timeout in ms
  logger: console         // Logger instance
}

Related Packages

  • @onlineapps/cookbook-core - Core parsing and validation
  • @onlineapps/cookbook-transformer - OpenAPI mapping
  • @onlineapps/cookbook-router - Message routing
  • @onlineapps/connector-cookbook - Full-featured wrapper

License

PROPRIETARY - All rights reserved