@multiplier-labs/stepflow 0.3.3 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +9 -0
  2. package/dist/{chunk-GYPNJBDP.js → chunk-D5HW7VEG.js} +269 -48
  3. package/dist/chunk-D5HW7VEG.js.map +1 -0
  4. package/dist/{chunk-KHTUWLVZ.js → chunk-FMPJBK2N.js} +55 -10
  5. package/dist/chunk-FMPJBK2N.js.map +1 -0
  6. package/dist/{chunk-ML35PIHX.js → chunk-JPXPB7U5.js} +52 -2
  7. package/dist/chunk-JPXPB7U5.js.map +1 -0
  8. package/dist/{chunk-4VOKMGP6.js → chunk-JUPZEBR3.js} +519 -522
  9. package/dist/chunk-JUPZEBR3.js.map +1 -0
  10. package/dist/events/index.d.ts +58 -3
  11. package/dist/events/index.js +1 -1
  12. package/dist/{index-Dzr437iW.d.ts → index-Cd0IZ40L.d.ts} +50 -11
  13. package/dist/index.d.ts +2 -12
  14. package/dist/index.js +764 -485
  15. package/dist/index.js.map +1 -1
  16. package/dist/scheduler/index.d.ts +1 -1
  17. package/dist/scheduler/index.js +2 -2
  18. package/dist/storage/index.d.ts +313 -47
  19. package/dist/storage/index.js +4 -2
  20. package/package.json +27 -13
  21. package/.codekin/reports/comments/2026-04-04_comment-assessment.md +0 -179
  22. package/.codekin/reports/complexity/2026-04-03_complexity-report.md +0 -152
  23. package/.codekin/reports/dependencies/2026-04-04_dependency-health.md +0 -94
  24. package/.codekin/reports/docs-audit/2026-04-04_docs-audit.md +0 -10
  25. package/.codekin/reports/security/2026-04-03_security-audit.md +0 -208
  26. package/.github/CODEOWNERS +0 -15
  27. package/.github/dependabot.yml +0 -23
  28. package/.github/workflows/ci.yml +0 -38
  29. package/.github/workflows/publish.yml +0 -36
  30. package/.github/workflows/security.yml +0 -29
  31. package/CHANGELOG.md +0 -34
  32. package/SECURITY.md +0 -40
  33. package/dist/chunk-4VOKMGP6.js.map +0 -1
  34. package/dist/chunk-GYPNJBDP.js.map +0 -1
  35. package/dist/chunk-KHTUWLVZ.js.map +0 -1
  36. package/dist/chunk-ML35PIHX.js.map +0 -1
  37. package/docs/github-packages-setup.md +0 -97
  38. package/docs/stepflow-api-reference.md +0 -1661
  39. package/src/core/engine.test.ts +0 -1365
  40. package/src/core/engine.ts +0 -692
  41. package/src/core/index.ts +0 -7
  42. package/src/core/orchestrator.ts +0 -571
  43. package/src/core/types.ts +0 -220
  44. package/src/events/index.ts +0 -8
  45. package/src/events/memory.test.ts +0 -107
  46. package/src/events/memory.ts +0 -92
  47. package/src/events/socketio.test.ts +0 -378
  48. package/src/events/socketio.ts +0 -262
  49. package/src/events/types.ts +0 -118
  50. package/src/events/webhook.test.ts +0 -657
  51. package/src/events/webhook.ts +0 -564
  52. package/src/index.ts +0 -270
  53. package/src/planning/index.ts +0 -55
  54. package/src/planning/planner.ts +0 -576
  55. package/src/planning/planning.test.ts +0 -727
  56. package/src/planning/registry.test.ts +0 -398
  57. package/src/planning/registry.ts +0 -365
  58. package/src/planning/types.ts +0 -566
  59. package/src/scheduler/cron.test.ts +0 -471
  60. package/src/scheduler/cron.ts +0 -414
  61. package/src/scheduler/index.ts +0 -8
  62. package/src/scheduler/postgres-persistence.ts +0 -518
  63. package/src/scheduler/sqlite-persistence.test.ts +0 -235
  64. package/src/scheduler/sqlite-persistence.ts +0 -261
  65. package/src/scheduler/types.ts +0 -73
  66. package/src/storage/index.ts +0 -27
  67. package/src/storage/memory.test.ts +0 -349
  68. package/src/storage/memory.ts +0 -227
  69. package/src/storage/postgres.ts +0 -1354
  70. package/src/storage/sqlite.test.ts +0 -466
  71. package/src/storage/sqlite.ts +0 -627
  72. package/src/storage/types.ts +0 -343
  73. package/src/utils/errors.test.ts +0 -150
  74. package/src/utils/errors.ts +0 -161
  75. package/src/utils/id.ts +0 -21
  76. package/src/utils/index.ts +0 -8
  77. package/src/utils/logger.test.ts +0 -121
  78. package/src/utils/logger.ts +0 -96
  79. package/src/utils/postgres-deps.ts +0 -63
  80. package/src/utils/retry.test.ts +0 -177
  81. package/src/utils/retry.ts +0 -121
  82. package/tsconfig.json +0 -21
  83. package/tsup.config.ts +0 -14
  84. package/vitest.config.ts +0 -9
package/src/index.ts DELETED
@@ -1,270 +0,0 @@
1
- /**
2
- * Stepflow - Workflow Engine
3
- *
4
- * A framework-agnostic workflow engine that provides:
5
- * - Workflow Definition & Registration
6
- * - Async Execution Engine (non-blocking, fire-and-forget)
7
- * - State Management (run/step status tracking with checkpointing)
8
- * - Event System (real-time events for monitoring and UI updates)
9
- * - Pluggable Storage (bring your own database/persistence layer)
10
- * - Retry & Error Handling (configurable per-step error strategies)
11
- *
12
- * @example
13
- * ```typescript
14
- * import { WorkflowEngine, MemoryStorageAdapter } from 'stepflow';
15
- *
16
- * const engine = new WorkflowEngine({
17
- * storage: new MemoryStorageAdapter(),
18
- * });
19
- *
20
- * engine.registerWorkflow({
21
- * kind: 'email.send_campaign',
22
- * name: 'Send Email Campaign',
23
- * steps: [
24
- * {
25
- * key: 'load_recipients',
26
- * name: 'Load Recipients',
27
- * handler: async (ctx) => {
28
- * const recipients = await loadRecipients(ctx.input.campaignId);
29
- * return { recipients };
30
- * },
31
- * },
32
- * {
33
- * key: 'send_emails',
34
- * name: 'Send Emails',
35
- * handler: async (ctx) => {
36
- * const { recipients } = ctx.results.load_recipients;
37
- * // Send emails...
38
- * return { sent: recipients.length };
39
- * },
40
- * onError: 'retry',
41
- * maxRetries: 3,
42
- * },
43
- * ],
44
- * });
45
- *
46
- * const runId = await engine.startRun({
47
- * kind: 'email.send_campaign',
48
- * input: { campaignId: '123' },
49
- * });
50
- *
51
- * // Subscribe to events
52
- * engine.subscribeToRun(runId, (event) => {
53
- * console.log(`${event.eventType}: ${event.stepKey ?? 'run'}`);
54
- * });
55
- * ```
56
- */
57
-
58
- // ============================================================================
59
- // Core Types and Classes
60
- // ============================================================================
61
-
62
- export {
63
- // Types
64
- type WorkflowKind,
65
- type RunStatus,
66
- type StepStatus,
67
- type StepErrorStrategy,
68
- type WorkflowError,
69
- type RunResult,
70
- type Logger,
71
- type SpawnChildOptions,
72
- type WorkflowContext,
73
- type WorkflowStep,
74
- type WorkflowHooks,
75
- type WorkflowDefinition,
76
- } from './core/types';
77
-
78
- export {
79
- // Main Engine
80
- WorkflowEngine,
81
- type WorkflowEngineConfig,
82
- type StartRunOptions,
83
- } from './core/engine';
84
-
85
- // ============================================================================
86
- // Storage
87
- // ============================================================================
88
-
89
- export {
90
- // Types
91
- type StorageAdapter,
92
- type WorkflowStorage,
93
- type WorkflowRunRecord,
94
- type WorkflowRunStepRecord,
95
- type WorkflowEventRecord,
96
- type ListRunsOptions,
97
- type ListEventsOptions,
98
- type PaginatedResult,
99
- type CreateRunInput,
100
- type UpdateRunInput,
101
- type StepResult,
102
- type StepRecord,
103
- // Extended types for new WorkflowStorage implementations
104
- type ExtendedWorkflowRunRecord,
105
- type ExtendedRunStatus,
106
- type ExtendedStepStatus,
107
- type ExtendedListRunsOptions,
108
- type StepflowRunsTable,
109
- type StepflowStepResultsTable,
110
- type StepflowDatabase,
111
- } from './storage/types';
112
-
113
- export {
114
- // In-Memory Storage
115
- MemoryStorageAdapter,
116
- } from './storage/memory';
117
-
118
- export {
119
- // SQLite Storage
120
- SQLiteStorageAdapter,
121
- type SQLiteStorageConfig,
122
- } from './storage/sqlite';
123
-
124
- export {
125
- // PostgreSQL Storage
126
- PostgresStorageAdapter,
127
- PostgresStorageAdapter as PostgresStorage,
128
- type PostgresStorageConfig,
129
- } from './storage/postgres';
130
-
131
- // ============================================================================
132
- // Events
133
- // ============================================================================
134
-
135
- export {
136
- // Types
137
- type EventTransport,
138
- type WorkflowEvent,
139
- type WorkflowEventType,
140
- type BuiltInEventType,
141
- type EventCallback,
142
- type Unsubscribe,
143
- } from './events/types';
144
-
145
- export {
146
- // In-Memory Event Transport
147
- MemoryEventTransport,
148
- } from './events/memory';
149
-
150
- export {
151
- // Socket.IO Event Transport
152
- SocketIOEventTransport,
153
- type SocketIOEventTransportConfig,
154
- type SocketIOServer,
155
- type SocketIOSocket,
156
- type SocketIOAuthorizeFn,
157
- } from './events/socketio';
158
-
159
- export {
160
- // Webhook Event Transport
161
- WebhookEventTransport,
162
- type WebhookEventTransportConfig,
163
- type WebhookEndpoint,
164
- type WebhookPayload,
165
- } from './events/webhook';
166
-
167
- // ============================================================================
168
- // Scheduler
169
- // ============================================================================
170
-
171
- export {
172
- type TriggerType,
173
- type WorkflowSchedule,
174
- type Scheduler,
175
- } from './scheduler/types';
176
-
177
- export {
178
- CronScheduler,
179
- type CronSchedulerConfig,
180
- type SchedulePersistence,
181
- } from './scheduler/cron';
182
-
183
- export {
184
- SQLiteSchedulePersistence,
185
- type SQLiteSchedulePersistenceConfig,
186
- } from './scheduler/sqlite-persistence';
187
-
188
- export {
189
- PostgresSchedulePersistence,
190
- type PostgresSchedulePersistenceConfig,
191
- } from './scheduler/postgres-persistence';
192
-
193
- // ============================================================================
194
- // Utilities
195
- // ============================================================================
196
-
197
- export {
198
- // ID Generation
199
- generateId,
200
- } from './utils/id';
201
-
202
- export {
203
- // Errors
204
- WorkflowEngineError,
205
- WorkflowNotFoundError,
206
- WorkflowAlreadyRegisteredError,
207
- RunNotFoundError,
208
- StepError,
209
- StepTimeoutError,
210
- WaitForRunTimeoutError,
211
- WorkflowCanceledError,
212
- WorkflowTimeoutError,
213
- } from './utils/errors';
214
-
215
- export {
216
- // Logger
217
- ConsoleLogger,
218
- SilentLogger,
219
- createScopedLogger,
220
- sanitizeErrorForStorage,
221
- type LogLevel,
222
- } from './utils/logger';
223
-
224
- export {
225
- // Retry
226
- type RetryOptions,
227
- DEFAULT_RETRY_OPTIONS,
228
- sleep,
229
- withRetry,
230
- calculateRetryDelay,
231
- } from './utils/retry';
232
-
233
- // ============================================================================
234
- // Planning
235
- // ============================================================================
236
-
237
- export {
238
- // Types
239
- type ConditionOperator,
240
- type RecipeCondition,
241
- type RecipeDefaults,
242
- type StepHandlerRef,
243
- type RecipeStep,
244
- type Recipe,
245
- type PlanModificationType,
246
- type PlanModification,
247
- type PlannedStep,
248
- type ChildWorkflowPlan,
249
- type ResourceEstimate,
250
- type Plan,
251
- type PlanningPriority,
252
- type PlanningConstraints,
253
- type PlanningHints,
254
- type PlanningContext,
255
- type RecipeSelectionResult,
256
- type PlanValidationResult,
257
- type Planner,
258
- type RegisteredStepHandler,
259
- type StepHandlerRegistry,
260
- type RecipeQueryOptions,
261
- type RecipeRegistry,
262
-
263
- // Implementations
264
- MemoryStepHandlerRegistry,
265
- MemoryRecipeRegistry,
266
- createRegistry,
267
- type CombinedRegistry,
268
- RuleBasedPlanner,
269
- type RuleBasedPlannerConfig,
270
- } from './planning';
@@ -1,55 +0,0 @@
1
- /**
2
- * Planning module for the workflow engine.
3
- * Provides recipes, plans, and planners for dynamic workflow orchestration.
4
- */
5
-
6
- // Types
7
- export type {
8
- // Condition types
9
- ConditionOperator,
10
- RecipeCondition,
11
-
12
- // Recipe types
13
- RecipeDefaults,
14
- StepHandlerRef,
15
- RecipeStep,
16
- Recipe,
17
-
18
- // Plan types
19
- PlanModificationType,
20
- PlanModification,
21
- PlannedStep,
22
- ChildWorkflowPlan,
23
- ResourceEstimate,
24
- Plan,
25
-
26
- // Planning context types
27
- PlanningPriority,
28
- PlanningConstraints,
29
- PlanningHints,
30
- PlanningContext,
31
-
32
- // Planner types
33
- RecipeSelectionResult,
34
- PlanValidationResult,
35
- Planner,
36
-
37
- // Registry types
38
- RegisteredStepHandler,
39
- StepHandlerRegistry,
40
- RecipeQueryOptions,
41
- RecipeRegistry,
42
- } from './types';
43
-
44
- // Implementations
45
- export {
46
- MemoryStepHandlerRegistry,
47
- MemoryRecipeRegistry,
48
- createRegistry,
49
- type CombinedRegistry,
50
- } from './registry';
51
-
52
- export {
53
- RuleBasedPlanner,
54
- type RuleBasedPlannerConfig,
55
- } from './planner';