@multiplier-labs/stepflow 0.3.4 → 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 (99) hide show
  1. package/README.md +9 -0
  2. package/dist/{chunk-U3PCVK6O.js → chunk-D5HW7VEG.js} +4 -2
  3. package/dist/chunk-D5HW7VEG.js.map +1 -0
  4. package/dist/{chunk-5XJBAPXF.js → chunk-JUPZEBR3.js} +3 -1
  5. package/dist/{chunk-5XJBAPXF.js.map → chunk-JUPZEBR3.js.map} +1 -1
  6. package/dist/events/index.d.ts +2 -0
  7. package/dist/events/index.js +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/storage/index.js +1 -1
  10. package/package.json +23 -12
  11. package/.codekin/reports/code-review/2026-04-11_code-review-daily.md +0 -146
  12. package/.codekin/reports/code-review/2026-04-13_code-review-daily.md +0 -74
  13. package/.codekin/reports/comments/2026-04-04_comment-assessment.md +0 -179
  14. package/.codekin/reports/comments/2026-04-11_comment-assessment.md +0 -161
  15. package/.codekin/reports/comments/2026-04-14_comment-assessment.md +0 -34
  16. package/.codekin/reports/complexity/2026-04-03_complexity-report.md +0 -152
  17. package/.codekin/reports/complexity/2026-04-11_complexity-report.md +0 -152
  18. package/.codekin/reports/complexity/2026-04-14_complexity-report.md +0 -34
  19. package/.codekin/reports/dependencies/2026-04-04_dependency-health.md +0 -94
  20. package/.codekin/reports/dependencies/2026-04-11_dependency-health.md +0 -93
  21. package/.codekin/reports/docs-audit/2026-04-04_docs-audit.md +0 -10
  22. package/.codekin/reports/docs-audit/2026-04-11_docs-audit.md +0 -138
  23. package/.codekin/reports/docs-audit/2026-04-13_docs-audit.md +0 -121
  24. package/.codekin/reports/security/2026-04-03_security-audit.md +0 -208
  25. package/.codekin/reports/security/2026-04-11_security-audit.md +0 -297
  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 -42
  30. package/.github/workflows/security.yml +0 -29
  31. package/CHANGELOG.md +0 -34
  32. package/SECURITY.md +0 -40
  33. package/dist/chunk-U3PCVK6O.js.map +0 -1
  34. package/docs/github-packages-setup.md +0 -97
  35. package/docs/stepflow-api-reference.md +0 -1663
  36. package/src/core/engine/concurrency.ts +0 -229
  37. package/src/core/engine/lifecycle.ts +0 -176
  38. package/src/core/engine.test.ts +0 -1435
  39. package/src/core/engine.ts +0 -598
  40. package/src/core/index.ts +0 -7
  41. package/src/core/orchestrator/persistence.ts +0 -165
  42. package/src/core/orchestrator/plan-resolution.ts +0 -140
  43. package/src/core/orchestrator/state-transitions.ts +0 -109
  44. package/src/core/orchestrator/step-runner.ts +0 -427
  45. package/src/core/orchestrator.ts +0 -252
  46. package/src/core/types.ts +0 -220
  47. package/src/events/index.ts +0 -8
  48. package/src/events/memory.test.ts +0 -107
  49. package/src/events/memory.ts +0 -92
  50. package/src/events/socketio.test.ts +0 -378
  51. package/src/events/socketio.ts +0 -262
  52. package/src/events/types.ts +0 -118
  53. package/src/events/webhook.test.ts +0 -949
  54. package/src/events/webhook.ts +0 -807
  55. package/src/index.ts +0 -270
  56. package/src/planning/evaluate-condition.test.ts +0 -153
  57. package/src/planning/evaluate-condition.ts +0 -105
  58. package/src/planning/index.ts +0 -55
  59. package/src/planning/planner.ts +0 -494
  60. package/src/planning/planning.test.ts +0 -727
  61. package/src/planning/registry.test.ts +0 -398
  62. package/src/planning/registry.ts +0 -283
  63. package/src/planning/types.ts +0 -566
  64. package/src/scheduler/cron.test.ts +0 -479
  65. package/src/scheduler/cron.ts +0 -438
  66. package/src/scheduler/index.ts +0 -8
  67. package/src/scheduler/postgres-persistence.ts +0 -530
  68. package/src/scheduler/sqlite-persistence.test.ts +0 -235
  69. package/src/scheduler/sqlite-persistence.ts +0 -286
  70. package/src/scheduler/types.ts +0 -73
  71. package/src/storage/index.ts +0 -27
  72. package/src/storage/memory.test.ts +0 -349
  73. package/src/storage/memory.ts +0 -227
  74. package/src/storage/postgres-core.ts +0 -550
  75. package/src/storage/postgres-migration.test.ts +0 -69
  76. package/src/storage/postgres-transaction-pagination.test.ts +0 -107
  77. package/src/storage/postgres.ts +0 -835
  78. package/src/storage/sqlite-core.ts +0 -151
  79. package/src/storage/sqlite.test.ts +0 -642
  80. package/src/storage/sqlite.ts +0 -717
  81. package/src/storage/types.ts +0 -343
  82. package/src/utils/errors.test.ts +0 -150
  83. package/src/utils/errors.ts +0 -161
  84. package/src/utils/id.ts +0 -21
  85. package/src/utils/index.ts +0 -10
  86. package/src/utils/logger.test.ts +0 -121
  87. package/src/utils/logger.ts +0 -96
  88. package/src/utils/pinned-fetch.test.ts +0 -84
  89. package/src/utils/pinned-fetch.ts +0 -118
  90. package/src/utils/postgres-deps.ts +0 -79
  91. package/src/utils/retry.test.ts +0 -177
  92. package/src/utils/retry.ts +0 -121
  93. package/src/utils/safe-json.test.ts +0 -166
  94. package/src/utils/safe-json.ts +0 -107
  95. package/src/utils/webhook-signature.test.ts +0 -111
  96. package/src/utils/webhook-signature.ts +0 -74
  97. package/tsconfig.json +0 -21
  98. package/tsup.config.ts +0 -14
  99. 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
- });