@multiplier-labs/stepflow 0.3.4 → 0.3.8

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 (109) hide show
  1. package/README.md +9 -0
  2. package/dist/{chunk-5XJBAPXF.js → chunk-4IDPWWGS.js} +15 -4
  3. package/dist/chunk-4IDPWWGS.js.map +1 -0
  4. package/dist/{chunk-U3PCVK6O.js → chunk-T6GAZBTQ.js} +70 -38
  5. package/dist/chunk-T6GAZBTQ.js.map +1 -0
  6. package/dist/{chunk-FMPJBK2N.js → chunk-TVSADUYU.js} +3 -5
  7. package/dist/{chunk-FMPJBK2N.js.map → chunk-TVSADUYU.js.map} +1 -1
  8. package/dist/events/index.d.ts +43 -3
  9. package/dist/events/index.js +7 -3
  10. package/dist/{index-Cd0IZ40L.d.ts → index-CdXDv30T.d.ts} +10 -2
  11. package/dist/index.d.ts +5 -4
  12. package/dist/index.js +159 -46
  13. package/dist/index.js.map +1 -1
  14. package/dist/scheduler/index.d.ts +2 -2
  15. package/dist/scheduler/index.js +1 -1
  16. package/dist/storage/index.d.ts +6 -4
  17. package/dist/storage/index.js +1 -1
  18. package/dist/{types-DSEjiLMj.d.ts → types-BfWe5yP6.d.ts} +2 -0
  19. package/package.json +26 -14
  20. package/.codekin/reports/code-review/2026-04-11_code-review-daily.md +0 -146
  21. package/.codekin/reports/code-review/2026-04-13_code-review-daily.md +0 -74
  22. package/.codekin/reports/comments/2026-04-04_comment-assessment.md +0 -179
  23. package/.codekin/reports/comments/2026-04-11_comment-assessment.md +0 -161
  24. package/.codekin/reports/comments/2026-04-14_comment-assessment.md +0 -34
  25. package/.codekin/reports/complexity/2026-04-03_complexity-report.md +0 -152
  26. package/.codekin/reports/complexity/2026-04-11_complexity-report.md +0 -152
  27. package/.codekin/reports/complexity/2026-04-14_complexity-report.md +0 -34
  28. package/.codekin/reports/dependencies/2026-04-04_dependency-health.md +0 -94
  29. package/.codekin/reports/dependencies/2026-04-11_dependency-health.md +0 -93
  30. package/.codekin/reports/docs-audit/2026-04-04_docs-audit.md +0 -10
  31. package/.codekin/reports/docs-audit/2026-04-11_docs-audit.md +0 -138
  32. package/.codekin/reports/docs-audit/2026-04-13_docs-audit.md +0 -121
  33. package/.codekin/reports/security/2026-04-03_security-audit.md +0 -208
  34. package/.codekin/reports/security/2026-04-11_security-audit.md +0 -297
  35. package/.github/CODEOWNERS +0 -15
  36. package/.github/dependabot.yml +0 -23
  37. package/.github/workflows/ci.yml +0 -38
  38. package/.github/workflows/publish.yml +0 -42
  39. package/.github/workflows/security.yml +0 -29
  40. package/CHANGELOG.md +0 -34
  41. package/SECURITY.md +0 -40
  42. package/dist/chunk-5XJBAPXF.js.map +0 -1
  43. package/dist/chunk-U3PCVK6O.js.map +0 -1
  44. package/docs/github-packages-setup.md +0 -97
  45. package/docs/stepflow-api-reference.md +0 -1663
  46. package/src/core/engine/concurrency.ts +0 -229
  47. package/src/core/engine/lifecycle.ts +0 -176
  48. package/src/core/engine.test.ts +0 -1435
  49. package/src/core/engine.ts +0 -598
  50. package/src/core/index.ts +0 -7
  51. package/src/core/orchestrator/persistence.ts +0 -165
  52. package/src/core/orchestrator/plan-resolution.ts +0 -140
  53. package/src/core/orchestrator/state-transitions.ts +0 -109
  54. package/src/core/orchestrator/step-runner.ts +0 -427
  55. package/src/core/orchestrator.ts +0 -252
  56. package/src/core/types.ts +0 -220
  57. package/src/events/index.ts +0 -8
  58. package/src/events/memory.test.ts +0 -107
  59. package/src/events/memory.ts +0 -92
  60. package/src/events/socketio.test.ts +0 -378
  61. package/src/events/socketio.ts +0 -262
  62. package/src/events/types.ts +0 -118
  63. package/src/events/webhook.test.ts +0 -949
  64. package/src/events/webhook.ts +0 -807
  65. package/src/index.ts +0 -270
  66. package/src/planning/evaluate-condition.test.ts +0 -153
  67. package/src/planning/evaluate-condition.ts +0 -105
  68. package/src/planning/index.ts +0 -55
  69. package/src/planning/planner.ts +0 -494
  70. package/src/planning/planning.test.ts +0 -727
  71. package/src/planning/registry.test.ts +0 -398
  72. package/src/planning/registry.ts +0 -283
  73. package/src/planning/types.ts +0 -566
  74. package/src/scheduler/cron.test.ts +0 -479
  75. package/src/scheduler/cron.ts +0 -438
  76. package/src/scheduler/index.ts +0 -8
  77. package/src/scheduler/postgres-persistence.ts +0 -530
  78. package/src/scheduler/sqlite-persistence.test.ts +0 -235
  79. package/src/scheduler/sqlite-persistence.ts +0 -286
  80. package/src/scheduler/types.ts +0 -73
  81. package/src/storage/index.ts +0 -27
  82. package/src/storage/memory.test.ts +0 -349
  83. package/src/storage/memory.ts +0 -227
  84. package/src/storage/postgres-core.ts +0 -550
  85. package/src/storage/postgres-migration.test.ts +0 -69
  86. package/src/storage/postgres-transaction-pagination.test.ts +0 -107
  87. package/src/storage/postgres.ts +0 -835
  88. package/src/storage/sqlite-core.ts +0 -151
  89. package/src/storage/sqlite.test.ts +0 -642
  90. package/src/storage/sqlite.ts +0 -717
  91. package/src/storage/types.ts +0 -343
  92. package/src/utils/errors.test.ts +0 -150
  93. package/src/utils/errors.ts +0 -161
  94. package/src/utils/id.ts +0 -21
  95. package/src/utils/index.ts +0 -10
  96. package/src/utils/logger.test.ts +0 -121
  97. package/src/utils/logger.ts +0 -96
  98. package/src/utils/pinned-fetch.test.ts +0 -84
  99. package/src/utils/pinned-fetch.ts +0 -118
  100. package/src/utils/postgres-deps.ts +0 -79
  101. package/src/utils/retry.test.ts +0 -177
  102. package/src/utils/retry.ts +0 -121
  103. package/src/utils/safe-json.test.ts +0 -166
  104. package/src/utils/safe-json.ts +0 -107
  105. package/src/utils/webhook-signature.test.ts +0 -111
  106. package/src/utils/webhook-signature.ts +0 -74
  107. package/tsconfig.json +0 -21
  108. package/tsup.config.ts +0 -14
  109. package/vitest.config.ts +0 -9
@@ -1,107 +0,0 @@
1
- /**
2
- * Regression test for PostgresTransactionAdapter.listRuns pagination total.
3
- * See audit 2026-04-27 finding C2: when listRuns is called inside a
4
- * transaction, the returned `total` must reflect the rows visible to that
5
- * transaction (via COUNT(*) on the same connection), not the size of the
6
- * returned page.
7
- */
8
-
9
- import { describe, it, expect, beforeAll } from 'vitest';
10
- import { PostgresStorageAdapter, PostgresTransactionAdapter } from './postgres';
11
-
12
- beforeAll(async () => {
13
- // PostgresTransactionAdapter.listRuns uses the module-level `sql` template
14
- // tag from postgres.ts, which is only populated when a PostgresStorageAdapter
15
- // is initialized. Initialize one with a no-op fake pool so the module state
16
- // is ready for the direct unit test below.
17
- const noopPool = {
18
- connect: async () => ({
19
- query: async () => ({ command: 'SELECT', rowCount: 0, rows: [] }),
20
- release: () => {},
21
- }),
22
- end: async () => {},
23
- on: () => noopPool,
24
- off: () => noopPool,
25
- };
26
- const bootstrap = new PostgresStorageAdapter({
27
- pool: noopPool as unknown as import('pg').Pool,
28
- });
29
- await bootstrap.initialize();
30
- await bootstrap.close();
31
- });
32
-
33
- /**
34
- * Build a Kysely-transaction-shaped stub backed by an in-memory row list.
35
- * It distinguishes the COUNT(*) query (started with `selectFrom().select()`)
36
- * from the data query (started with `selectFrom().selectAll()`) and replies
37
- * with the right shape for each.
38
- */
39
- function buildFakeTrx<T extends Record<string, unknown>>(rows: T[]) {
40
- function buildCountChain() {
41
- const chain: any = {};
42
- chain.where = () => chain;
43
- chain.executeTakeFirst = async () => ({ count: rows.length });
44
- return chain;
45
- }
46
- function buildDataChain() {
47
- const chain: any = {};
48
- let limit: number | undefined;
49
- let offset = 0;
50
- chain.where = () => chain;
51
- chain.orderBy = () => chain;
52
- chain.limit = (n: number) => { limit = n; return chain; };
53
- chain.offset = (n: number) => { offset = n; return chain; };
54
- chain.execute = async () => {
55
- const sliced = rows.slice(offset, limit !== undefined ? offset + limit : undefined);
56
- return sliced;
57
- };
58
- return chain;
59
- }
60
- const qb = {
61
- selectFrom: () => ({
62
- select: () => buildCountChain(),
63
- selectAll: () => buildDataChain(),
64
- }),
65
- };
66
- return { withSchema: () => qb } as any;
67
- }
68
-
69
- describe('PostgresTransactionAdapter — listRuns pagination total', () => {
70
- it('reports total from COUNT(*) on the same transaction, not the page size', async () => {
71
- // Simulate 7 rows visible in the transaction; ask for a page of 3.
72
- const fakeRow = {
73
- id: 'r', kind: 'k', status: 'queued', parent_run_id: null,
74
- input_json: '{}', metadata_json: '{}', context_json: '{}',
75
- output_json: null, error_json: null, priority: 0, timeout_ms: null,
76
- created_at: new Date(), started_at: null, finished_at: null,
77
- };
78
- const rows = Array.from({ length: 7 }, (_, i) => ({ ...fakeRow, id: `r${i}` }));
79
- const trx = buildFakeTrx(rows);
80
-
81
- const adapter = new PostgresTransactionAdapter(trx, 'public');
82
- const result = await adapter.listRuns({ limit: 3 });
83
-
84
- // Page contains only 3 rows...
85
- expect(result.items).toHaveLength(3);
86
- // ...but total reflects all 7 rows visible in the transaction.
87
- // Pre-fix this returned 3 (rows.length).
88
- expect(result.total).toBe(7);
89
- });
90
-
91
- it('total reflects all created rows even when limit exceeds page size', async () => {
92
- const fakeRow = {
93
- id: 'r', kind: 'k', status: 'queued', parent_run_id: null,
94
- input_json: '{}', metadata_json: '{}', context_json: '{}',
95
- output_json: null, error_json: null, priority: 0, timeout_ms: null,
96
- created_at: new Date(), started_at: null, finished_at: null,
97
- };
98
- const rows = Array.from({ length: 5 }, (_, i) => ({ ...fakeRow, id: `r${i}` }));
99
- const trx = buildFakeTrx(rows);
100
-
101
- const adapter = new PostgresTransactionAdapter(trx, 'public');
102
- const result = await adapter.listRuns({ limit: 100 });
103
-
104
- expect(result.items).toHaveLength(5);
105
- expect(result.total).toBe(5);
106
- });
107
- });