octaflow 0.20.1 → 0.22.0
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.
- package/dist/index.d.ts +1 -1
- package/dist/{observability-Bu-SXLcS.d.ts → observability-CR9dEdLW.d.ts} +2 -2
- package/dist/{dispatcher-pgboss → pg-boss}/index.d.ts +3 -3
- package/dist/{dispatcher-pgboss → pg-boss}/index.js +4 -4
- package/dist/{store-pg → postgres}/index.d.ts +6 -6
- package/dist/{store-pg → postgres}/index.js +5 -5
- package/package.json +16 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as computeReadiness, A as StepConditionHandler, B as StepStatus, C as defineWaitStep, D as StartOptions, E as RetryPolicy, F as StepHandlerNotFoundError, G as WorkflowNotFoundError, H as WorkflowCreatedResult, I as StepHandlerRegistry, J as WorkflowStatus, K as WorkflowNotRetryableError, L as StepId, M as StepError, N as StepExecutionContext, O as StepCompensateHandler, P as StepHandler, Q as ReadinessPlan, R as StepRecord, S as defineSubWorkflowStep, T as InvalidWorkflowDefinitionError, U as WorkflowDefinition, V as WaitTimeoutPolicy, W as WorkflowId, X as JoinRule, Y as WorkflowWithSteps, Z as PlannedSkip, _ as WorkflowOutput, a as STEP_DISPLAY_STATUS, b as defineSleepStep, c as WORKFLOW_STATUS_SCHEMA, d as toPublicWorkflow, et as isTerminalStepStatus, f as StepDeps, g as TypedWorkflow, h as TypedStepContext, i as PublicWorkflowStep, it as ok, j as StepDefinition, k as StepCompensationContext, l as toDisplayStepStatus, m as TypedStep, n as PUBLIC_WORKFLOW_STEP_SCHEMA, nt as Result, o as STEP_DISPLAY_STATUS_SCHEMA, p as StepOutput, q as WorkflowRecord, r as PublicWorkflow, rt as err, s as StepDisplayStatus, t as PUBLIC_WORKFLOW_SCHEMA, tt as FlowErrorShape, u as toPublicStep, v as buildWorkflow, w as FlowError, x as defineStep, y as defineMapStep, z as StepRegistration } from "./index-BURAYZui.js";
|
|
2
2
|
import { n as Logger, r as noopLogger, t as LogAttributes } from "./logger-BCus3AOa.js";
|
|
3
|
-
import { A as ListWorkflowsFilters, C as AddChildStep, D as CreatedWorkflow, E as CreateWorkflowStep, M as TransactionalScope, N as WorkflowStore, O as FailStepParams, S as createInMemoryStepGate, T as CreateWorkflowParams, _ as InMemoryStepGateConfig, a as FlowSpan, b as StepGateDecision, c as RecordingObserver, d as createMeterObserver, f as createRecordingObserver, g as ConcurrencyRule, h as noopTracer, i as FlowObserver, j as ReopenWorkflowParams, k as FinishWorkflowParams, l as RecordingTracer, m as noopObserver, n as FlowEventType, o as FlowTracer, p as createRecordingTracer, r as FlowMeter, s as RecordedSpan, t as FlowEvent, u as combineObservers, v as RateRule, w as CompleteStepParams, x as StepGateRequest, y as StepGate } from "./observability-
|
|
3
|
+
import { A as ListWorkflowsFilters, C as AddChildStep, D as CreatedWorkflow, E as CreateWorkflowStep, M as TransactionalScope, N as WorkflowStore, O as FailStepParams, S as createInMemoryStepGate, T as CreateWorkflowParams, _ as InMemoryStepGateConfig, a as FlowSpan, b as StepGateDecision, c as RecordingObserver, d as createMeterObserver, f as createRecordingObserver, g as ConcurrencyRule, h as noopTracer, i as FlowObserver, j as ReopenWorkflowParams, k as FinishWorkflowParams, l as RecordingTracer, m as noopObserver, n as FlowEventType, o as FlowTracer, p as createRecordingTracer, r as FlowMeter, s as RecordedSpan, t as FlowEvent, u as combineObservers, v as RateRule, w as CompleteStepParams, x as StepGateRequest, y as StepGate } from "./observability-CR9dEdLW.js";
|
|
4
4
|
import { i as EnqueueOptions, n as DispatchStepPayload, r as Dispatcher, t as DispatchKind } from "./dispatcher-g7Ct0J6w.js";
|
|
5
5
|
import { a as WorkflowCompletedArgs, i as BuildStepContextArgs, n as BeforeStartArgs, o as WorkflowHooks, r as BeforeStartResult, t as AfterStepArgs } from "./hooks-BdxIcc92.js";
|
|
6
6
|
//#region src/core/registry.d.ts
|
|
@@ -79,7 +79,7 @@ interface ListWorkflowsFilters {
|
|
|
79
79
|
* A store bound to an open transaction, plus an opaque handle a capable
|
|
80
80
|
* {@link Dispatcher} can join so a job and the state change that produced it
|
|
81
81
|
* commit together. Core never inspects `handle` — it belongs to the adapter
|
|
82
|
-
* pair (e.g.
|
|
82
|
+
* pair (e.g. `./postgres` hands `./pg-boss` its transaction-bound executor).
|
|
83
83
|
*/
|
|
84
84
|
interface TransactionalScope {
|
|
85
85
|
/** A store whose writes go through the open transaction. */
|
|
@@ -318,7 +318,7 @@ interface RecordingObserver extends FlowObserver {
|
|
|
318
318
|
declare function createRecordingObserver(): RecordingObserver;
|
|
319
319
|
/**
|
|
320
320
|
* The slice of a metrics API the engine's meter observer needs. Structural:
|
|
321
|
-
* `@octabits-io/
|
|
321
|
+
* `@octabits-io/telemetry`'s meter and an OpenTelemetry `Meter`
|
|
322
322
|
* both fit (the SDK's `createCounter`/`createHistogram` need a two-line
|
|
323
323
|
* adapter, the framework's meter none).
|
|
324
324
|
*/
|
|
@@ -3,7 +3,7 @@ import { n as Logger } from "../logger-BCus3AOa.js";
|
|
|
3
3
|
import { r as Dispatcher } from "../dispatcher-g7Ct0J6w.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { PgBoss } from "pg-boss";
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/pg-boss/payload.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The wire payload for a step job. It is the flow-core `DispatchStepPayload`
|
|
9
9
|
* plus the `partitionKey` — the worker needs the partition to reconstruct a
|
|
@@ -66,7 +66,7 @@ export interface StartJobContext extends WireStartPayload {
|
|
|
66
66
|
/** Resolve the per-delivery idempotency key. Explicit key wins over a prefix. */
|
|
67
67
|
export declare function resolveStartIdempotencyKey(payload: WireStartPayload, jobId: string): string | undefined;
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region src/
|
|
69
|
+
//#region src/pg-boss/queue.d.ts
|
|
70
70
|
/**
|
|
71
71
|
* Create the step queue and its dead-letter queue if they do not exist. Call
|
|
72
72
|
* once at startup; the dispatcher also runs it from `prepare` and lazily on a
|
|
@@ -148,7 +148,7 @@ export declare function createPgBossDlqWorker(deps: PgBossDlqWorkerDeps): {
|
|
|
148
148
|
stop: () => Promise<void>;
|
|
149
149
|
};
|
|
150
150
|
//#endregion
|
|
151
|
-
//#region src/
|
|
151
|
+
//#region src/pg-boss/scheduler.d.ts
|
|
152
152
|
/** Create the start queue (idempotent). */
|
|
153
153
|
export declare function ensureStartQueue(boss: PgBoss, queueName: string): Promise<void>;
|
|
154
154
|
export interface PgBossSchedulerDeps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/pg-boss/payload.ts
|
|
3
3
|
/**
|
|
4
4
|
* The wire payload for a step job. It is the flow-core `DispatchStepPayload`
|
|
5
5
|
* plus the `partitionKey` — the worker needs the partition to reconstruct a
|
|
@@ -52,7 +52,7 @@ function resolveStartIdempotencyKey(payload, jobId) {
|
|
|
52
52
|
if (payload.idempotencyKeyPrefix !== void 0) return `${payload.idempotencyKeyPrefix}:${jobId}`;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region src/
|
|
55
|
+
//#region src/pg-boss/queue.ts
|
|
56
56
|
function dlqName(queueName) {
|
|
57
57
|
return `${queueName}-dlq`;
|
|
58
58
|
}
|
|
@@ -166,7 +166,7 @@ function createPgBossDispatcher(deps) {
|
|
|
166
166
|
ok: false,
|
|
167
167
|
error: {
|
|
168
168
|
key: "queue_error",
|
|
169
|
-
message: "Transaction handle is not a SqlExecutor — is the store
|
|
169
|
+
message: "Transaction handle is not a SqlExecutor — is the store octaflow/postgres?"
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
if (!await boss.send(queueName, parsed.data, {
|
|
@@ -324,7 +324,7 @@ function createPgBossDlqWorker(deps) {
|
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
|
-
//#region src/
|
|
327
|
+
//#region src/pg-boss/scheduler.ts
|
|
328
328
|
/** Create the start queue (idempotent). */
|
|
329
329
|
async function ensureStartQueue(boss, queueName) {
|
|
330
330
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { W as WorkflowId } from "../index-BURAYZui.js";
|
|
2
|
-
import { N as WorkflowStore, g as ConcurrencyRule, i as FlowObserver, t as FlowEvent, v as RateRule, y as StepGate } from "../observability-
|
|
2
|
+
import { N as WorkflowStore, g as ConcurrencyRule, i as FlowObserver, t as FlowEvent, v as RateRule, y as StepGate } from "../observability-CR9dEdLW.js";
|
|
3
3
|
import { Pool } from "pg";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/postgres/ddl.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Schema for the Postgres WorkflowStore adapter. Two tables mirror flow-core's
|
|
7
7
|
* record shapes. Apply once at deploy time (or call `applySchema`).
|
|
@@ -15,7 +15,7 @@ export declare const FLOW_STORE_DDL: string;
|
|
|
15
15
|
/** `CREATE SCHEMA IF NOT EXISTS` line for non-default schemas; empty for 'public'. */
|
|
16
16
|
export declare function createSchemaDdl(schema: string): string;
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region src/
|
|
18
|
+
//#region src/postgres/executor.d.ts
|
|
19
19
|
/** Minimal query result shape the adapters consume (a structural subset of `pg`'s `QueryResult`). */
|
|
20
20
|
export interface SqlResult<R> {
|
|
21
21
|
rows: R[];
|
|
@@ -50,7 +50,7 @@ export declare function poolExecutor(pool: Pool): SqlExecutor;
|
|
|
50
50
|
*/
|
|
51
51
|
export declare function toExecutor(db: Pool | SqlExecutor): SqlExecutor;
|
|
52
52
|
//#endregion
|
|
53
|
-
//#region src/
|
|
53
|
+
//#region src/postgres/store.d.ts
|
|
54
54
|
export interface PgWorkflowStoreDeps {
|
|
55
55
|
pool: Pool;
|
|
56
56
|
/** Partition this store instance is bound to (e.g. a tenant id). */
|
|
@@ -88,7 +88,7 @@ export declare function createPgWorkflowStore(deps: PgWorkflowStoreDeps): Workfl
|
|
|
88
88
|
/** Convenience: apply the flow-store schema to a database. */
|
|
89
89
|
export declare function applySchema(pool: Pool, ddl: string): Promise<void>;
|
|
90
90
|
//#endregion
|
|
91
|
-
//#region src/
|
|
91
|
+
//#region src/postgres/gate.d.ts
|
|
92
92
|
/** DDL for the gate's two tables. Apply once at deploy time (or via `applySchema`). */
|
|
93
93
|
export declare function flowGateDdl(opts?: {
|
|
94
94
|
schema?: string;
|
|
@@ -136,7 +136,7 @@ export declare function createStepGate(config: StepGateConfig): StepGate;
|
|
|
136
136
|
*/
|
|
137
137
|
export declare function createPgStepGate(config: PgStepGateConfig): StepGate;
|
|
138
138
|
//#endregion
|
|
139
|
-
//#region src/
|
|
139
|
+
//#region src/postgres/event-sink.d.ts
|
|
140
140
|
/**
|
|
141
141
|
* DDL for the append-only run-history table. Apply once at deploy time (alongside
|
|
142
142
|
* `flowStoreDdl`), or call `applySchema(pool, flowEventDdl())`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/postgres/ddl.ts
|
|
2
2
|
/**
|
|
3
3
|
* Schema for the Postgres WorkflowStore adapter. Two tables mirror flow-core's
|
|
4
4
|
* record shapes. Apply once at deploy time (or call `applySchema`).
|
|
@@ -79,7 +79,7 @@ function createSchemaDdl(schema) {
|
|
|
79
79
|
return schema === "public" ? "" : `CREATE SCHEMA IF NOT EXISTS ${schema};\n\n`;
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
|
-
//#region src/
|
|
82
|
+
//#region src/postgres/executor.ts
|
|
83
83
|
/**
|
|
84
84
|
* Build a {@link SqlExecutor} over a `pg` {@link Pool}: top-level queries run on
|
|
85
85
|
* the pool (autocommit); `transaction` checks out a client and wraps `fn` in
|
|
@@ -133,7 +133,7 @@ function toExecutor(db) {
|
|
|
133
133
|
return "transaction" in db ? db : poolExecutor(db);
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
|
-
//#region src/
|
|
136
|
+
//#region src/postgres/store.ts
|
|
137
137
|
const iso = (v) => v == null ? null : v instanceof Date ? v.toISOString() : v;
|
|
138
138
|
function mapWorkflow(r) {
|
|
139
139
|
return {
|
|
@@ -505,7 +505,7 @@ async function applySchema(pool, ddl) {
|
|
|
505
505
|
await pool.query(ddl);
|
|
506
506
|
}
|
|
507
507
|
//#endregion
|
|
508
|
-
//#region src/
|
|
508
|
+
//#region src/postgres/gate.ts
|
|
509
509
|
const DEFAULT_RATE_TABLE = "flow_rate_bucket";
|
|
510
510
|
const DEFAULT_LEASE_TABLE = "flow_step_lease";
|
|
511
511
|
/** DDL for the gate's two tables. Apply once at deploy time (or via `applySchema`). */
|
|
@@ -645,7 +645,7 @@ function createPgStepGate(config) {
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
//#endregion
|
|
648
|
-
//#region src/
|
|
648
|
+
//#region src/postgres/event-sink.ts
|
|
649
649
|
/**
|
|
650
650
|
* DDL for the append-only run-history table. Apply once at deploy time (alongside
|
|
651
651
|
* `flowStoreDdl`), or call `applySchema(pool, flowEventDdl())`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octaflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Durable DAG workflow engine: Zod-typed steps over Postgres + pg-boss, with an optional AI add-on (token/cost/quota). Layered single package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"import": "./dist/ai/index.js",
|
|
16
16
|
"default": "./dist/ai/index.js"
|
|
17
17
|
},
|
|
18
|
-
"./
|
|
19
|
-
"types": "./dist/
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"default": "./dist/
|
|
18
|
+
"./postgres": {
|
|
19
|
+
"types": "./dist/postgres/index.d.ts",
|
|
20
|
+
"import": "./dist/postgres/index.js",
|
|
21
|
+
"default": "./dist/postgres/index.js"
|
|
22
22
|
},
|
|
23
|
-
"./
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"import": "./dist/
|
|
26
|
-
"default": "./dist/
|
|
23
|
+
"./pg-boss": {
|
|
24
|
+
"types": "./dist/pg-boss/index.d.ts",
|
|
25
|
+
"import": "./dist/pg-boss/index.js",
|
|
26
|
+
"default": "./dist/pg-boss/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./ai/providers": {
|
|
29
29
|
"types": "./dist/ai/providers/index.d.ts",
|
|
@@ -102,21 +102,21 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@ai-sdk/anthropic": "^4.0.
|
|
106
|
-
"@ai-sdk/mistral": "^4.0.
|
|
107
|
-
"@ai-sdk/openai": "^4.0.
|
|
108
|
-
"@ai-sdk/provider": "^4.0.
|
|
105
|
+
"@ai-sdk/anthropic": "^4.0.52",
|
|
106
|
+
"@ai-sdk/mistral": "^4.0.42",
|
|
107
|
+
"@ai-sdk/openai": "^4.0.65",
|
|
108
|
+
"@ai-sdk/provider": "^4.0.13",
|
|
109
109
|
"@testcontainers/postgresql": "^12.1.0",
|
|
110
|
-
"@types/node": "^26.
|
|
110
|
+
"@types/node": "^26.5.1",
|
|
111
111
|
"@types/pg": "^8.23.1",
|
|
112
|
-
"ai": "^7.0.
|
|
112
|
+
"ai": "^7.0.97",
|
|
113
113
|
"pg": "^8.23.0",
|
|
114
114
|
"pg-boss": "^12.30.0",
|
|
115
115
|
"testcontainers": "^12.1.0",
|
|
116
116
|
"tsdown": "^0.23.0",
|
|
117
117
|
"typescript": "^7.0.2",
|
|
118
118
|
"vitest": "^5.0.0",
|
|
119
|
-
"zod": "^4.
|
|
119
|
+
"zod": "^4.6.0"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"build": "tsdown",
|