{"_id":"@allternit/workflow-engine","_rev":"2-77c6a7d212ea731aa96148a3eae32928","name":"@allternit/workflow-engine","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@allternit/workflow-engine","version":"0.1.0","keywords":["a2r","workflow","dag","orchestration","automation"],"license":"MIT","_id":"@allternit/workflow-engine@0.1.0","maintainers":[{"name":"allternit","email":"allternitpbc@gmail.com"}],"dist":{"shasum":"1590b8a2e2042a8c771638fd5a77ad3b4f775426","tarball":"https://registry.npmjs.org/@allternit/workflow-engine/-/workflow-engine-0.1.0.tgz","fileCount":49,"integrity":"sha512-cFWbxBNV/VubE8sRkQR8pheQkQ1oVfCpnnXHuyvSizuNX4BniR2vOAYEzXQuCqOJ8C3KM68aNaeY8v0a9D8Mqg==","signatures":[{"sig":"MEUCIQDE/PUT415JjcoJyTGp7A3Vt4LF3kwVdeRZuUNxIgL4rwIgHcNCSjzPbKPsnxoPWMMjrQ7TGZ6qgJ3tJ9sxfbO7ST0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":322711},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./nodes":{"types":"./dist/nodes/index.d.ts","import":"./dist/nodes/index.js"},"./engine":{"types":"./dist/engine/index.d.ts","import":"./dist/engine/index.js"},"./executor":{"types":"./dist/executor/index.d.ts","import":"./dist/executor/index.js"},"./scheduler":{"types":"./dist/scheduler/index.d.ts","import":"./dist/scheduler/index.js"},"./visualizer":{"types":"./dist/visualizer/index.d.ts","import":"./dist/visualizer/index.js"}},"gitHead":"197c1497d02ffb94fe24fbdc6a6de34e98297159","scripts":{"test":"vitest run","build":"tsc","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"allternit","email":"allternitpbc@gmail.com"},"_npmVersion":"11.9.0","description":"A2R Workflow Engine - Visual workflow orchestration with DAG support","directories":{},"_nodeVersion":"25.6.1","dependencies":{"uuid":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/workflow-engine_0.1.0_1776018258398_0.44723451078057574","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"_id":"@allternit/workflow-engine@0.1.1","dist":{"shasum":"0e790a91e1837071318a662ada54831a95d4508f","tarball":"https://registry.npmjs.org/@allternit/workflow-engine/-/workflow-engine-0.1.1.tgz","fileCount":29,"integrity":"sha512-3HvI00ueAOcfJCZqh7N9ruFvIDidAInfJb2tBuA0StT/rPpU1gRJtC3P/oTA735iOmqiSauC39l/EE/tddA/og==","signatures":[{"sig":"MEUCIGmZpE/QRIzHLUzmg1M7wijwRHYExApRFma6A35h6xZ8AiEAw2X2sfEA3ODrVJKWh8bCr1Ch48plfkOoOHe33IHoEGM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDq3h429+mxAMXLhjo0ZtW7lR7KJVMKFkk56jRJIOoY6AIgd2ccz07G71TeOvHHQpxcIe+n0iLDqdyVv2zMQG2irig="}],"unpackedSize":176190},"main":"./dist/index.js","name":"@allternit/workflow-engine","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./scheduler":{"types":"./dist/scheduler/index.d.ts","import":"./dist/scheduler/index.js"},"./visualizer":{"types":"./dist/visualizer/index.d.ts","import":"./dist/visualizer/index.js"}},"gitHead":"bb998c3974d77020fbc887af2c6bdd961281b32e","license":"MIT","scripts":{"test":"vitest run --passWithNoTests","build":"tsc","typecheck":"tsc --noEmit","test:watch":"vitest"},"version":"0.1.1","_npmUser":{"name":"allternit","email":"allternitpbc@gmail.com"},"keywords":["allternit","workflow","dag","orchestration","automation"],"_npmVersion":"10.8.2","description":"Allternit Workflow Engine - Visual workflow orchestration with DAG support","directories":{},"maintainers":[{"name":"allternit","email":"allternitpbc@gmail.com"}],"_nodeVersion":"20.20.2","dependencies":{"uuid":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/workflow-engine_0.1.1_1788561351453_0.6183114777229435"}}},"time":{"created":"2026-04-12T18:24:18.310Z","modified":"2026-09-04T22:35:51.689Z","0.1.0":"2026-04-12T18:24:18.547Z","0.1.1":"2026-09-04T22:35:51.534Z"},"license":"MIT","keywords":["allternit","workflow","dag","orchestration","automation"],"description":"Allternit Workflow Engine - Visual workflow orchestration with DAG support","maintainers":[{"name":"allternit","email":"allternitpbc@gmail.com"}],"readme":"# @allternit/workflow-engine\n\nAllternit Workflow Engine - Visual workflow orchestration with DAG support.\n\n## Overview\n\nThe Workflow Engine enables visual definition and execution of complex multi-step processes using a directed acyclic graph (DAG) structure. It supports conditional branching, parallel execution, loops, and custom node types.\n\n## Features\n\n- **Visual Workflow Definition**: DAG-based workflow structure\n- **Built-in Node Types**: Triggers, transforms, conditions, loops, HTTP requests\n- **Parallel Execution**: Scheduler for concurrent task execution\n- **Conditional Branching**: Route execution based on conditions\n- **Error Handling**: Retry logic and error handlers\n- **Visualization**: Export to SVG, Mermaid, or Graphviz\n- **Extensible**: Custom node types and executors\n\n## Installation\n\n```bash\npnpm add @allternit/workflow-engine\n```\n\n## Quick Start\n\n```typescript\nimport { createWorkflowEngine } from '@allternit/workflow-engine';\n\nconst engine = createWorkflowEngine();\n\n// Define workflow\nengine.registerWorkflow({\n  id: 'data-pipeline',\n  name: 'Data Pipeline',\n  version: '1.0.0',\n  nodes: [\n    {\n      id: 'trigger',\n      type: 'trigger:webhook',\n      name: 'Webhook Trigger',\n    },\n    {\n      id: 'fetch',\n      type: 'http:request',\n      name: 'Fetch Data',\n      config: {\n        method: 'GET',\n        url: 'https://api.example.com/data',\n      },\n    },\n    {\n      id: 'filter',\n      type: 'transform:filter',\n      name: 'Filter Items',\n      config: {\n        condition: 'item.active === true',\n      },\n    },\n    {\n      id: 'output',\n      type: 'output:result',\n      name: 'Return Results',\n    },\n  ],\n  connections: [\n    { id: 'c1', source: 'trigger', target: 'fetch' },\n    { id: 'c2', source: 'fetch', target: 'filter' },\n    { id: 'c3', source: 'filter', target: 'output' },\n  ],\n});\n\n// Execute workflow\nconst execution = await engine.execute('data-pipeline', {\n  webhookData: { id: 123 },\n});\n\nconsole.log(execution.status); // 'completed'\nconsole.log(execution.outputs); // { response: [...] }\n```\n\n## Built-in Node Types\n\n### Triggers\n| Type | Description |\n|------|-------------|\n| `trigger:manual` | Manual or API trigger |\n| `trigger:schedule` | Scheduled execution |\n| `trigger:webhook` | HTTP webhook trigger |\n\n### Transforms\n| Type | Description |\n|------|-------------|\n| `transform:map` | Transform data using expression |\n| `transform:filter` | Filter array items |\n\n### Logic\n| Type | Description |\n|------|-------------|\n| `condition:if` | Conditional branching |\n| `loop:for-each` | Iterate over array |\n\n### Actions\n| Type | Description |\n|------|-------------|\n| `http:request` | HTTP request |\n| `delay:wait` | Pause execution |\n| `output:result` | Set workflow output |\n| `output:log` | Log message |\n\n## Visualization\n\n```typescript\nimport { createVisualizer } from '@allternit/workflow-engine';\n\nconst visualizer = createVisualizer();\n\n// Export to SVG\nconst svg = visualizer.toSVG(workflow);\n\n// Export to Mermaid\nconst mermaid = visualizer.toMermaid(workflow);\n// graph TD\n//   trigger[\"Start\"]\n//   trigger --> http\n\n// Export to Graphviz\nconst dot = visualizer.toDOT(workflow);\n```\n\n## Custom Node Types\n\n```typescript\nengine.registerNodeType({\n  type: 'custom:processor',\n  category: 'custom',\n  displayName: 'Data Processor',\n  description: 'Process data with custom logic',\n  inputs: [\n    { name: 'data', type: 'object', required: true },\n  ],\n  outputs: [\n    { name: 'result', type: 'object' },\n  ],\n  configSchema: [\n    { name: 'multiplier', type: 'number', default: 1 },\n  ],\n  executor: async (node, context, inputs) => {\n    const multiplier = node.config?.multiplier || 1;\n    const result = inputs.data.value * multiplier;\n    return { result: { value: result } };\n  },\n});\n```\n\n## Scheduler\n\n```typescript\nimport { createScheduler } from '@allternit/workflow-engine';\n\nconst scheduler = createScheduler({\n  maxConcurrency: 5,\n  defaultTimeout: 30000,\n});\n\n// Submit task\nawait scheduler.submit({\n  id: 'task-1',\n  node: workflowNode,\n  execution: workflowExecution,\n});\n\n// Check status\nconst status = scheduler.getStatus();\nconsole.log(status.running); // 1\nconsole.log(status.queued); // 0\n```\n\n## API Reference\n\n### WorkflowEngine\n\n```typescript\ninterface WorkflowEngine {\n  registerWorkflow(workflow: Workflow): void;\n  getWorkflow(id: string): Workflow | undefined;\n  execute(workflowId: string, inputs?: Record<string, unknown>): Promise<WorkflowExecution>;\n  getExecution(executionId: string): WorkflowExecution | undefined;\n  cancelExecution(executionId: string): boolean;\n  registerNodeType(nodeType: NodeType): void;\n}\n```\n\n### Workflow Types\n\n```typescript\ninterface Workflow {\n  id: string;\n  name: string;\n  version: string;\n  nodes: WorkflowNode[];\n  connections: Connection[];\n  inputs?: ParameterSchema[];\n  outputs?: ParameterSchema[];\n  errorHandling?: ErrorHandlingConfig;\n}\n\ninterface WorkflowNode {\n  id: string;\n  type: string;\n  name: string;\n  config?: Record<string, unknown>;\n  inputs?: InputMapping[];\n  outputs?: OutputMapping[];\n}\n\ninterface Connection {\n  id: string;\n  source: string;\n  target: string;\n  condition?: string;\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}