openworkflow 0.4.1 → 0.5.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/README.md +53 -48
- package/dist/backend-postgres/index.d.ts +44 -0
- package/dist/backend-postgres/index.d.ts.map +1 -0
- package/dist/backend-postgres/index.js +535 -0
- package/dist/backend-postgres/index.js.map +1 -0
- package/dist/backend-postgres/postgres.d.ts +42 -0
- package/dist/backend-postgres/postgres.d.ts.map +1 -0
- package/dist/backend-postgres/postgres.js +234 -0
- package/dist/backend-postgres/postgres.js.map +1 -0
- package/dist/backend-sqlite/index.d.ts +41 -1
- package/dist/backend-sqlite/index.d.ts.map +1 -1
- package/dist/backend-sqlite/index.js +654 -1
- package/dist/backend-sqlite/index.js.map +1 -1
- package/dist/backend-sqlite/sqlite.d.ts +18 -2
- package/dist/backend-sqlite/sqlite.d.ts.map +1 -1
- package/dist/backend-sqlite/sqlite.js +20 -2
- package/dist/backend-sqlite/sqlite.js.map +1 -1
- package/dist/{core/backend.d.ts → backend.d.ts} +7 -5
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js.map +1 -0
- package/dist/bin/openworkflow.d.ts +3 -0
- package/dist/bin/openworkflow.d.ts.map +1 -0
- package/dist/bin/openworkflow.js +44 -0
- package/dist/bin/openworkflow.js.map +1 -0
- package/dist/client.d.ts +141 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/{sdk/sdk.js → client.js} +44 -71
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +27 -21
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -36
- package/dist/config.js.map +1 -1
- package/dist/core/duration.d.ts +4 -2
- package/dist/core/duration.d.ts.map +1 -1
- package/dist/core/duration.js +3 -1
- package/dist/core/duration.js.map +1 -1
- package/dist/core/error.d.ts +14 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +18 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/result.d.ts +14 -4
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/result.js +10 -0
- package/dist/core/result.js.map +1 -1
- package/dist/core/retry.d.ts +0 -9
- package/dist/core/retry.d.ts.map +1 -1
- package/dist/core/retry.js +0 -14
- package/dist/core/retry.js.map +1 -1
- package/dist/core/step.d.ts +1 -32
- package/dist/core/step.d.ts.map +1 -1
- package/dist/core/step.js +0 -35
- package/dist/core/step.js.map +1 -1
- package/dist/core/workflow.d.ts +2 -47
- package/dist/core/workflow.d.ts.map +1 -1
- package/dist/core/workflow.js +0 -44
- package/dist/core/workflow.js.map +1 -1
- package/dist/{execution/execution.d.ts → execution.d.ts} +4 -26
- package/dist/execution.d.ts.map +1 -0
- package/dist/{execution/execution.js → execution.js} +4 -4
- package/dist/execution.js.map +1 -0
- package/dist/index.d.ts +6 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +8 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -0
- package/dist/internal.js.map +1 -0
- package/dist/pg/backend.d.ts +42 -0
- package/dist/pg/backend.d.ts.map +1 -0
- package/dist/pg/backend.js +534 -0
- package/dist/pg/backend.js.map +1 -0
- package/dist/pg/index.d.ts +3 -0
- package/dist/pg/index.d.ts.map +1 -0
- package/dist/pg/index.js +3 -0
- package/dist/pg/index.js.map +1 -0
- package/dist/pg/postgres.d.ts +42 -0
- package/dist/pg/postgres.d.ts.map +1 -0
- package/dist/pg/postgres.js +234 -0
- package/dist/pg/postgres.js.map +1 -0
- package/dist/pg/scripts/db-migrate.d.ts +2 -0
- package/dist/pg/scripts/db-migrate.d.ts.map +1 -0
- package/dist/pg/scripts/db-migrate.js +5 -0
- package/dist/pg/scripts/db-migrate.js.map +1 -0
- package/dist/pg/scripts/db-reset.d.ts +2 -0
- package/dist/pg/scripts/db-reset.d.ts.map +1 -0
- package/dist/pg/scripts/db-reset.js +6 -0
- package/dist/pg/scripts/db-reset.js.map +1 -0
- package/dist/pg/scripts/squawk.d.ts +2 -0
- package/dist/pg/scripts/squawk.d.ts.map +1 -0
- package/dist/pg/scripts/squawk.js +17 -0
- package/dist/pg/scripts/squawk.js.map +1 -0
- package/dist/pg/vitest.global-setup.d.ts +3 -0
- package/dist/pg/vitest.global-setup.d.ts.map +1 -0
- package/dist/pg/vitest.global-setup.js +8 -0
- package/dist/pg/vitest.global-setup.js.map +1 -0
- package/dist/registry.d.ts +27 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +49 -0
- package/dist/registry.js.map +1 -0
- package/dist/{backend-sqlite → sqlite}/backend.d.ts +6 -4
- package/dist/sqlite/backend.d.ts.map +1 -0
- package/dist/{backend-sqlite → sqlite}/backend.js +31 -5
- package/dist/sqlite/backend.js.map +1 -0
- package/dist/sqlite/index.d.ts +3 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/sqlite.d.ts +61 -0
- package/dist/sqlite/sqlite.d.ts.map +1 -0
- package/dist/sqlite/sqlite.js +247 -0
- package/dist/sqlite/sqlite.js.map +1 -0
- package/dist/testing/backend.testsuite.d.ts +20 -0
- package/dist/testing/backend.testsuite.d.ts.map +1 -0
- package/dist/{core → testing}/backend.testsuite.js +186 -53
- package/dist/testing/backend.testsuite.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{worker/worker.d.ts → worker.d.ts} +11 -4
- package/dist/worker.d.ts.map +1 -0
- package/dist/{worker/worker.js → worker.js} +20 -10
- package/dist/worker.js.map +1 -0
- package/dist/workflow.d.ts +60 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +49 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +13 -3
- package/dist/backend-sqlite/backend.d.ts.map +0 -1
- package/dist/backend-sqlite/backend.js.map +0 -1
- package/dist/config/config.d.ts +0 -102
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -29
- package/dist/config/config.js.map +0 -1
- package/dist/config/index.d.ts +0 -3
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -2
- package/dist/config/index.js.map +0 -1
- package/dist/core/backend-test-suite.d.ts +0 -22
- package/dist/core/backend-test-suite.d.ts.map +0 -1
- package/dist/core/backend-test-suite.js +0 -960
- package/dist/core/backend-test-suite.js.map +0 -1
- package/dist/core/backend.d.ts.map +0 -1
- package/dist/core/backend.js.map +0 -1
- package/dist/core/backend.testsuite.d.ts +0 -21
- package/dist/core/backend.testsuite.d.ts.map +0 -1
- package/dist/core/backend.testsuite.js.map +0 -1
- package/dist/core/duration.test.d.ts +0 -2
- package/dist/core/duration.test.d.ts.map +0 -1
- package/dist/core/duration.test.js +0 -264
- package/dist/core/duration.test.js.map +0 -1
- package/dist/core/result.test.d.ts +0 -2
- package/dist/core/result.test.d.ts.map +0 -1
- package/dist/core/result.test.js +0 -11
- package/dist/core/result.test.js.map +0 -1
- package/dist/core/retry.test.d.ts +0 -2
- package/dist/core/retry.test.d.ts.map +0 -1
- package/dist/core/retry.test.js +0 -36
- package/dist/core/retry.test.js.map +0 -1
- package/dist/core/step.test.d.ts +0 -2
- package/dist/core/step.test.d.ts.map +0 -1
- package/dist/core/step.test.js +0 -340
- package/dist/core/step.test.js.map +0 -1
- package/dist/core/workflow.test.d.ts +0 -2
- package/dist/core/workflow.test.d.ts.map +0 -1
- package/dist/core/workflow.test.js +0 -216
- package/dist/core/workflow.test.js.map +0 -1
- package/dist/execution/execution.d.ts.map +0 -1
- package/dist/execution/execution.js.map +0 -1
- package/dist/execution/execution.test.d.ts +0 -2
- package/dist/execution/execution.test.d.ts.map +0 -1
- package/dist/execution/execution.test.js +0 -382
- package/dist/execution/execution.test.js.map +0 -1
- package/dist/global.d.ts +0 -62
- package/dist/global.d.ts.map +0 -1
- package/dist/global.js +0 -78
- package/dist/global.js.map +0 -1
- package/dist/sdk/sdk.d.ts +0 -182
- package/dist/sdk/sdk.d.ts.map +0 -1
- package/dist/sdk/sdk.js.map +0 -1
- package/dist/sdk/sdk.test.d.ts +0 -2
- package/dist/sdk/sdk.test.d.ts.map +0 -1
- package/dist/sdk/sdk.test.js +0 -195
- package/dist/sdk/sdk.test.js.map +0 -1
- package/dist/worker/worker.d.ts.map +0 -1
- package/dist/worker/worker.js.map +0 -1
- package/dist/worker/worker.test.d.ts +0 -2
- package/dist/worker/worker.test.d.ts.map +0 -1
- package/dist/worker/worker.test.js +0 -786
- package/dist/worker/worker.test.js.map +0 -1
- /package/dist/{core/backend.js → backend.js} +0 -0
|
@@ -1,45 +1,61 @@
|
|
|
1
1
|
import { DatabaseSync } from "node:sqlite";
|
|
2
2
|
export type Database = DatabaseSync;
|
|
3
|
-
export declare const DEFAULT_DATABASE_PATH = ":memory:";
|
|
4
3
|
/**
|
|
5
4
|
* newDatabase creates a new SQLite database connection.
|
|
5
|
+
* @param path - Database file path (or ":memory:") for testing
|
|
6
|
+
* @returns SQLite database connection
|
|
6
7
|
*/
|
|
7
|
-
export declare function newDatabase(path
|
|
8
|
+
export declare function newDatabase(path: string): Database;
|
|
8
9
|
/**
|
|
9
10
|
* migrations returns the list of migration SQL statements.
|
|
11
|
+
* @returns Migration SQL statements
|
|
10
12
|
*/
|
|
11
13
|
export declare function migrations(): string[];
|
|
12
14
|
/**
|
|
13
15
|
* migrate applies pending migrations to the database. Does nothing if the
|
|
14
16
|
* database is already up to date.
|
|
17
|
+
* @param db - SQLite database
|
|
15
18
|
*/
|
|
16
19
|
export declare function migrate(db: Database): void;
|
|
17
20
|
/**
|
|
18
21
|
* Helper to generate UUIDs (SQLite doesn't have built-in UUID generation)
|
|
22
|
+
* @returns A UUID string
|
|
19
23
|
*/
|
|
20
24
|
export declare function generateUUID(): string;
|
|
21
25
|
/**
|
|
22
26
|
* Helper to get current timestamp in ISO8601 format
|
|
27
|
+
* @returns ISO8601 timestamp string
|
|
23
28
|
*/
|
|
24
29
|
export declare function now(): string;
|
|
25
30
|
/**
|
|
26
31
|
* Helper to add milliseconds to a date and return ISO8601 string
|
|
32
|
+
* @param date - ISO8601 date string
|
|
33
|
+
* @param ms - Milliseconds to add
|
|
34
|
+
* @returns Updated ISO8601 date string
|
|
27
35
|
*/
|
|
28
36
|
export declare function addMilliseconds(date: string, ms: number): string;
|
|
29
37
|
/**
|
|
30
38
|
* Helper to serialize JSON for SQLite storage
|
|
39
|
+
* @param value - Value to serialize
|
|
40
|
+
* @returns JSON string or null
|
|
31
41
|
*/
|
|
32
42
|
export declare function toJSON(value: unknown): string | null;
|
|
33
43
|
/**
|
|
34
44
|
* Helper to deserialize JSON from SQLite storage
|
|
45
|
+
* @param value - JSON string or null
|
|
46
|
+
* @returns Parsed value
|
|
35
47
|
*/
|
|
36
48
|
export declare function fromJSON(value: string | null): unknown;
|
|
37
49
|
/**
|
|
38
50
|
* Helper to convert Date to ISO8601 string for SQLite
|
|
51
|
+
* @param date - Date or null
|
|
52
|
+
* @returns ISO8601 date string or null
|
|
39
53
|
*/
|
|
40
54
|
export declare function toISO(date: Date | null): string | null;
|
|
41
55
|
/**
|
|
42
56
|
* Helper to convert ISO8601 string from SQLite to Date
|
|
57
|
+
* @param dateStr - ISO8601 date string or null
|
|
58
|
+
* @returns Date or null
|
|
43
59
|
*/
|
|
44
60
|
export declare function fromISO(dateStr: string | null): Date | null;
|
|
45
61
|
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../backend-sqlite/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/backend-sqlite/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAQlD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,EAAE,CA2IrC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAQ1C;AAyBD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAE3D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { DatabaseSync } from "node:sqlite";
|
|
3
|
-
export const DEFAULT_DATABASE_PATH = ":memory:";
|
|
4
3
|
/**
|
|
5
4
|
* newDatabase creates a new SQLite database connection.
|
|
5
|
+
* @param path - Database file path (or ":memory:") for testing
|
|
6
|
+
* @returns SQLite database connection
|
|
6
7
|
*/
|
|
7
|
-
export function newDatabase(path
|
|
8
|
+
export function newDatabase(path) {
|
|
8
9
|
const db = new DatabaseSync(path);
|
|
9
10
|
// Only enable WAL mode for file-based databases
|
|
10
11
|
if (path !== ":memory:") {
|
|
@@ -15,6 +16,7 @@ export function newDatabase(path = DEFAULT_DATABASE_PATH) {
|
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* migrations returns the list of migration SQL statements.
|
|
19
|
+
* @returns Migration SQL statements
|
|
18
20
|
*/
|
|
19
21
|
export function migrations() {
|
|
20
22
|
return [
|
|
@@ -155,6 +157,7 @@ export function migrations() {
|
|
|
155
157
|
/**
|
|
156
158
|
* migrate applies pending migrations to the database. Does nothing if the
|
|
157
159
|
* database is already up to date.
|
|
160
|
+
* @param db - SQLite database
|
|
158
161
|
*/
|
|
159
162
|
export function migrate(db) {
|
|
160
163
|
const currentMigrationVersion = getCurrentMigrationVersion(db);
|
|
@@ -166,6 +169,8 @@ export function migrate(db) {
|
|
|
166
169
|
}
|
|
167
170
|
/**
|
|
168
171
|
* getCurrentMigrationVersion returns the current migration version of the database.
|
|
172
|
+
* @param db - SQLite database
|
|
173
|
+
* @returns Current migration version
|
|
169
174
|
*/
|
|
170
175
|
function getCurrentMigrationVersion(db) {
|
|
171
176
|
// check if migrations table exists
|
|
@@ -184,18 +189,23 @@ function getCurrentMigrationVersion(db) {
|
|
|
184
189
|
}
|
|
185
190
|
/**
|
|
186
191
|
* Helper to generate UUIDs (SQLite doesn't have built-in UUID generation)
|
|
192
|
+
* @returns A UUID string
|
|
187
193
|
*/
|
|
188
194
|
export function generateUUID() {
|
|
189
195
|
return randomUUID();
|
|
190
196
|
}
|
|
191
197
|
/**
|
|
192
198
|
* Helper to get current timestamp in ISO8601 format
|
|
199
|
+
* @returns ISO8601 timestamp string
|
|
193
200
|
*/
|
|
194
201
|
export function now() {
|
|
195
202
|
return new Date().toISOString();
|
|
196
203
|
}
|
|
197
204
|
/**
|
|
198
205
|
* Helper to add milliseconds to a date and return ISO8601 string
|
|
206
|
+
* @param date - ISO8601 date string
|
|
207
|
+
* @param ms - Milliseconds to add
|
|
208
|
+
* @returns Updated ISO8601 date string
|
|
199
209
|
*/
|
|
200
210
|
export function addMilliseconds(date, ms) {
|
|
201
211
|
const d = new Date(date);
|
|
@@ -204,24 +214,32 @@ export function addMilliseconds(date, ms) {
|
|
|
204
214
|
}
|
|
205
215
|
/**
|
|
206
216
|
* Helper to serialize JSON for SQLite storage
|
|
217
|
+
* @param value - Value to serialize
|
|
218
|
+
* @returns JSON string or null
|
|
207
219
|
*/
|
|
208
220
|
export function toJSON(value) {
|
|
209
221
|
return value === null || value === undefined ? null : JSON.stringify(value);
|
|
210
222
|
}
|
|
211
223
|
/**
|
|
212
224
|
* Helper to deserialize JSON from SQLite storage
|
|
225
|
+
* @param value - JSON string or null
|
|
226
|
+
* @returns Parsed value
|
|
213
227
|
*/
|
|
214
228
|
export function fromJSON(value) {
|
|
215
229
|
return value === null ? null : JSON.parse(value);
|
|
216
230
|
}
|
|
217
231
|
/**
|
|
218
232
|
* Helper to convert Date to ISO8601 string for SQLite
|
|
233
|
+
* @param date - Date or null
|
|
234
|
+
* @returns ISO8601 date string or null
|
|
219
235
|
*/
|
|
220
236
|
export function toISO(date) {
|
|
221
237
|
return date ? date.toISOString() : null;
|
|
222
238
|
}
|
|
223
239
|
/**
|
|
224
240
|
* Helper to convert ISO8601 string from SQLite to Date
|
|
241
|
+
* @param dateStr - ISO8601 date string or null
|
|
242
|
+
* @returns Date or null
|
|
225
243
|
*/
|
|
226
244
|
export function fromISO(dateStr) {
|
|
227
245
|
return dateStr ? new Date(dateStr) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../backend-sqlite/sqlite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C
|
|
1
|
+
{"version":3,"file":"sqlite.js","source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M,UAAU,KAAK,CAAC,IAAiB;IACrC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAsB;IAC5C,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
1
|
+
import type { SerializedError } from "./core/error.js";
|
|
2
|
+
import { JsonValue } from "./core/json.js";
|
|
3
|
+
import type { StepAttempt, StepAttemptContext, StepKind } from "./core/step.js";
|
|
4
|
+
import type { WorkflowRun } from "./core/workflow.js";
|
|
4
5
|
export declare const DEFAULT_NAMESPACE_ID = "default";
|
|
5
6
|
/**
|
|
6
7
|
* Backend is the interface for backend providers to implement.
|
|
@@ -20,6 +21,7 @@ export interface Backend {
|
|
|
20
21
|
listStepAttempts(params: Readonly<ListStepAttemptsParams>): Promise<PaginatedResponse<StepAttempt>>;
|
|
21
22
|
completeStepAttempt(params: Readonly<CompleteStepAttemptParams>): Promise<StepAttempt>;
|
|
22
23
|
failStepAttempt(params: Readonly<FailStepAttemptParams>): Promise<StepAttempt>;
|
|
24
|
+
stop(): Promise<void>;
|
|
23
25
|
}
|
|
24
26
|
export interface CreateWorkflowRunParams {
|
|
25
27
|
workflowName: string;
|
|
@@ -57,7 +59,7 @@ export interface CompleteWorkflowRunParams {
|
|
|
57
59
|
export interface FailWorkflowRunParams {
|
|
58
60
|
workflowRunId: string;
|
|
59
61
|
workerId: string;
|
|
60
|
-
error:
|
|
62
|
+
error: SerializedError;
|
|
61
63
|
}
|
|
62
64
|
export interface CancelWorkflowRunParams {
|
|
63
65
|
workflowRunId: string;
|
|
@@ -86,7 +88,7 @@ export interface FailStepAttemptParams {
|
|
|
86
88
|
workflowRunId: string;
|
|
87
89
|
stepAttemptId: string;
|
|
88
90
|
workerId: string;
|
|
89
|
-
error:
|
|
91
|
+
error: SerializedError;
|
|
90
92
|
}
|
|
91
93
|
export interface PaginationOptions {
|
|
92
94
|
limit?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,OAAO;IAEtB,iBAAiB,CACf,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GACxC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,cAAc,CACZ,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GACrC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC/B,gBAAgB,CACd,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GACvC,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3C,gBAAgB,CACd,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GACvC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC/B,sBAAsB,CACpB,MAAM,EAAE,QAAQ,CAAC,4BAA4B,CAAC,GAC7C,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,gBAAgB,CACd,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GACvC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,mBAAmB,CACjB,MA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CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../backend.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openworkflow.d.ts","sourceRoot":"","sources":["../../bin/openworkflow.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* This script is a zero-dependency entrypoint for the OpenWorkflow CLI. It
|
|
4
|
+
* allows users to run `npx openworkflow <command>` without requiring the core
|
|
5
|
+
* 'openworkflow' package to have any production dependencies (like commander,
|
|
6
|
+
* consola, etc).
|
|
7
|
+
*
|
|
8
|
+
* Note: This file is transpiled to `./dist/bin/openworkflow.js`. Relative paths
|
|
9
|
+
* below are calculated based on that runtime location.
|
|
10
|
+
*/
|
|
11
|
+
import { spawnSync } from "node:child_process";
|
|
12
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
16
|
+
// get the version of the current package to ensure we call the matching CLI
|
|
17
|
+
const packageJsonPath = path.join(__dirname, "../../package.json");
|
|
18
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
19
|
+
const version = packageJson.version;
|
|
20
|
+
// capture all args passed to npx openworkflow (e.g., "init", "worker start")
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
// build the command, using tsx to run local TypeScript CLI if in dev and
|
|
23
|
+
// otherwise using npx to run the published CLI package
|
|
24
|
+
const cliScriptFilePath = path.resolve(__dirname, "../../../cli/cli.ts");
|
|
25
|
+
const isMonorepo = existsSync(cliScriptFilePath);
|
|
26
|
+
if (isMonorepo) {
|
|
27
|
+
console.log("⚠️ Running OpenWorkflow CLI from local source (monorepo development mode)\n");
|
|
28
|
+
}
|
|
29
|
+
const command = isMonorepo
|
|
30
|
+
? // `npx tsx ../../../cli/cli.ts ...args`
|
|
31
|
+
["tsx", cliScriptFilePath, ...args]
|
|
32
|
+
: // `npx -y @openworkflow/cli@<version> ...args`
|
|
33
|
+
// uses -y to skip the "Need to install @openworkflow/cli" prompt
|
|
34
|
+
["-y", `@openworkflow/cli@${version}`, ...args];
|
|
35
|
+
// spawn the CLI the command to run the actual CLI package
|
|
36
|
+
const result = spawnSync(
|
|
37
|
+
// eslint-disable-next-line sonarjs/no-os-command-from-path
|
|
38
|
+
"npx", command, {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
shell: true,
|
|
41
|
+
});
|
|
42
|
+
// exit with the same status code as the CLI
|
|
43
|
+
process.exit(result.status ?? 0);
|
|
44
|
+
//# sourceMappingURL=openworkflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openworkflow.js","sourceRoot":"","sources":["../../bin/openworkflow.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,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AEF,4CAA4C;AAC5C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { Backend } from "./backend.js";
|
|
2
|
+
import type { StandardSchemaV1 } from "./core/schema.js";
|
|
3
|
+
import type { SchemaInput, SchemaOutput, WorkflowRun } from "./core/workflow.js";
|
|
4
|
+
import type { WorkflowFunction } from "./execution.js";
|
|
5
|
+
import { Worker } from "./worker.js";
|
|
6
|
+
import { type Workflow, type WorkflowSpec } from "./workflow.js";
|
|
7
|
+
type WorkflowHandlerInput<TSchema, Input> = SchemaOutput<TSchema, Input>;
|
|
8
|
+
type WorkflowRunInput<TSchema, Input> = SchemaInput<TSchema, Input>;
|
|
9
|
+
/**
|
|
10
|
+
* Options for the OpenWorkflow client.
|
|
11
|
+
*/
|
|
12
|
+
export interface OpenWorkflowOptions {
|
|
13
|
+
backend: Backend;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Client used to register workflows and start runs.
|
|
17
|
+
*/
|
|
18
|
+
export declare class OpenWorkflow {
|
|
19
|
+
private backend;
|
|
20
|
+
private registry;
|
|
21
|
+
constructor(options: OpenWorkflowOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Create a new Worker with this client's backend and workflows.
|
|
24
|
+
* @param options - Worker options
|
|
25
|
+
* @param options.concurrency - Max concurrent workflow runs
|
|
26
|
+
* @returns Worker instance
|
|
27
|
+
*/
|
|
28
|
+
newWorker(options?: {
|
|
29
|
+
concurrency?: number | undefined;
|
|
30
|
+
}): Worker;
|
|
31
|
+
/**
|
|
32
|
+
* Provide the implementation for a declared workflow. This links the workflow
|
|
33
|
+
* specification to its execution logic and registers it with this
|
|
34
|
+
* OpenWorkflow instance for worker execution.
|
|
35
|
+
* @param spec - Workflow spec
|
|
36
|
+
* @param fn - Workflow implementation
|
|
37
|
+
*/
|
|
38
|
+
implementWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, fn: WorkflowFunction<Input, Output>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Run a workflow from its specification. This is the primary way to schedule
|
|
41
|
+
* a workflow using only its WorkflowSpec.
|
|
42
|
+
* @param spec - Workflow spec
|
|
43
|
+
* @param input - Workflow input
|
|
44
|
+
* @param options - Run options
|
|
45
|
+
* @returns Handle for awaiting the result
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const handle = await ow.runWorkflow(emailWorkflow, { to: 'user@example.com' });
|
|
49
|
+
* const result = await handle.result();
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
runWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
|
|
53
|
+
/**
|
|
54
|
+
* Define and register a new workflow.
|
|
55
|
+
* @param spec - Workflow spec
|
|
56
|
+
* @param fn - Workflow implementation
|
|
57
|
+
* @returns Runnable workflow
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const workflow = ow.defineWorkflow(
|
|
61
|
+
* { name: 'my-workflow' },
|
|
62
|
+
* async ({ input, step }) => {
|
|
63
|
+
* // workflow implementation
|
|
64
|
+
* },
|
|
65
|
+
* );
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
defineWorkflow<Input, Output, TSchema extends StandardSchemaV1 | undefined = undefined>(spec: WorkflowSpec<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>, fn: WorkflowFunction<WorkflowHandlerInput<TSchema, Input>, Output>): RunnableWorkflow<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A fully defined workflow with its implementation. This class is returned by
|
|
72
|
+
* `client.defineWorkflow` and provides the `.run()` method for scheduling
|
|
73
|
+
* workflow runs.
|
|
74
|
+
*/
|
|
75
|
+
export declare class RunnableWorkflow<Input, Output, RunInput = Input> {
|
|
76
|
+
private readonly ow;
|
|
77
|
+
readonly workflow: Workflow<Input, Output, RunInput>;
|
|
78
|
+
constructor(ow: OpenWorkflow, workflow: Workflow<Input, Output, RunInput>);
|
|
79
|
+
/**
|
|
80
|
+
* Starts a new workflow run.
|
|
81
|
+
* @param input - Workflow input
|
|
82
|
+
* @param options - Run options
|
|
83
|
+
* @returns Workflow run handle
|
|
84
|
+
*/
|
|
85
|
+
run(input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for creating a new workflow run from a runnable workflow when calling
|
|
89
|
+
* `workflowDef.run()`.
|
|
90
|
+
*/
|
|
91
|
+
export interface WorkflowRunOptions {
|
|
92
|
+
/**
|
|
93
|
+
* Set a deadline for the workflow run. If the workflow exceeds this deadline,
|
|
94
|
+
* it will be marked as failed.
|
|
95
|
+
*/
|
|
96
|
+
deadlineAt?: Date;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Options for WorkflowHandle.
|
|
100
|
+
*/
|
|
101
|
+
export interface WorkflowHandleOptions {
|
|
102
|
+
backend: Backend;
|
|
103
|
+
workflowRun: WorkflowRun;
|
|
104
|
+
resultPollIntervalMs: number;
|
|
105
|
+
resultTimeoutMs: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Options for result() on a WorkflowRunHandle.
|
|
109
|
+
*/
|
|
110
|
+
export interface WorkflowRunHandleResultOptions {
|
|
111
|
+
/**
|
|
112
|
+
* Time to wait for a workflow run to complete. Throws an error if the timeout
|
|
113
|
+
* is exceeded.
|
|
114
|
+
* @default 300000 (5 minutes)
|
|
115
|
+
*/
|
|
116
|
+
timeoutMs?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents a started workflow run and provides methods to await its result.
|
|
120
|
+
* Returned from `workflowDef.run()`.
|
|
121
|
+
*/
|
|
122
|
+
export declare class WorkflowRunHandle<Output> {
|
|
123
|
+
private backend;
|
|
124
|
+
readonly workflowRun: WorkflowRun;
|
|
125
|
+
private resultPollIntervalMs;
|
|
126
|
+
private resultTimeoutMs;
|
|
127
|
+
constructor(options: WorkflowHandleOptions);
|
|
128
|
+
/**
|
|
129
|
+
* Waits for the workflow run to complete and returns the result.
|
|
130
|
+
* @param options - Options for waiting for the result
|
|
131
|
+
* @returns Workflow output
|
|
132
|
+
*/
|
|
133
|
+
result(options?: WorkflowRunHandleResultOptions): Promise<Output>;
|
|
134
|
+
/**
|
|
135
|
+
* Cancels the workflow run. Only workflows in pending, running, or sleeping
|
|
136
|
+
* status can be canceled.
|
|
137
|
+
*/
|
|
138
|
+
cancel(): Promise<void>;
|
|
139
|
+
}
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAMvB,KAAK,oBAAoB,CAAC,OAAO,EAAE,KAAK,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAGzE,KAAK,gBAAgB,CAAC,OAAO,EAAE,KAAK,IAAI,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,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@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { validateInput } from "
|
|
2
|
-
import {
|
|
1
|
+
import { validateInput } from "./core/workflow.js";
|
|
2
|
+
import { WorkflowRegistry } from "./registry.js";
|
|
3
|
+
import { Worker } from "./worker.js";
|
|
4
|
+
import { defineWorkflow, } from "./workflow.js";
|
|
3
5
|
const DEFAULT_RESULT_POLL_INTERVAL_MS = 1000; // 1s
|
|
4
6
|
const DEFAULT_RESULT_TIMEOUT_MS = 5 * 60 * 1000; // 5m
|
|
5
7
|
/**
|
|
@@ -7,17 +9,20 @@ const DEFAULT_RESULT_TIMEOUT_MS = 5 * 60 * 1000; // 5m
|
|
|
7
9
|
*/
|
|
8
10
|
export class OpenWorkflow {
|
|
9
11
|
backend;
|
|
10
|
-
|
|
12
|
+
registry = new WorkflowRegistry();
|
|
11
13
|
constructor(options) {
|
|
12
14
|
this.backend = options.backend;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Create a new Worker with this client's backend and workflows.
|
|
18
|
+
* @param options - Worker options
|
|
19
|
+
* @param options.concurrency - Max concurrent workflow runs
|
|
20
|
+
* @returns Worker instance
|
|
16
21
|
*/
|
|
17
22
|
newWorker(options) {
|
|
18
23
|
return new Worker({
|
|
19
24
|
backend: this.backend,
|
|
20
|
-
workflows: this.
|
|
25
|
+
workflows: this.registry.getAll(),
|
|
21
26
|
concurrency: options?.concurrency,
|
|
22
27
|
});
|
|
23
28
|
}
|
|
@@ -25,20 +30,23 @@ export class OpenWorkflow {
|
|
|
25
30
|
* Provide the implementation for a declared workflow. This links the workflow
|
|
26
31
|
* specification to its execution logic and registers it with this
|
|
27
32
|
* OpenWorkflow instance for worker execution.
|
|
33
|
+
* @param spec - Workflow spec
|
|
34
|
+
* @param fn - Workflow implementation
|
|
28
35
|
*/
|
|
29
36
|
implementWorkflow(spec, fn) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const definition = new WorkflowDefinition(this, spec, fn);
|
|
36
|
-
this.registeredWorkflows.set(key, definition);
|
|
37
|
+
const workflow = {
|
|
38
|
+
spec,
|
|
39
|
+
fn,
|
|
40
|
+
};
|
|
41
|
+
this.registry.register(workflow);
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Run a workflow from its specification. This is the primary way to schedule
|
|
40
45
|
* a workflow using only its WorkflowSpec.
|
|
41
|
-
*
|
|
46
|
+
* @param spec - Workflow spec
|
|
47
|
+
* @param input - Workflow input
|
|
48
|
+
* @param options - Run options
|
|
49
|
+
* @returns Handle for awaiting the result
|
|
42
50
|
* @example
|
|
43
51
|
* ```ts
|
|
44
52
|
* const handle = await ow.runWorkflow(emailWorkflow, { to: 'user@example.com' });
|
|
@@ -53,7 +61,7 @@ export class OpenWorkflow {
|
|
|
53
61
|
const parsedInput = validationResult.value;
|
|
54
62
|
const workflowRun = await this.backend.createWorkflowRun({
|
|
55
63
|
workflowName: spec.name,
|
|
56
|
-
version: spec.version,
|
|
64
|
+
version: spec.version ?? null,
|
|
57
65
|
idempotencyKey: null,
|
|
58
66
|
config: {},
|
|
59
67
|
context: null,
|
|
@@ -70,12 +78,9 @@ export class OpenWorkflow {
|
|
|
70
78
|
}
|
|
71
79
|
/**
|
|
72
80
|
* Define and register a new workflow.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* separate declaration from implementation, consider using those methods
|
|
77
|
-
* separately.
|
|
78
|
-
*
|
|
81
|
+
* @param spec - Workflow spec
|
|
82
|
+
* @param fn - Workflow implementation
|
|
83
|
+
* @returns Runnable workflow
|
|
79
84
|
* @example
|
|
80
85
|
* ```ts
|
|
81
86
|
* const workflow = ow.defineWorkflow(
|
|
@@ -86,67 +91,32 @@ export class OpenWorkflow {
|
|
|
86
91
|
* );
|
|
87
92
|
* ```
|
|
88
93
|
*/
|
|
89
|
-
defineWorkflow(
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.registeredWorkflows.set(key, definition);
|
|
94
|
-
return definition;
|
|
94
|
+
defineWorkflow(spec, fn) {
|
|
95
|
+
const workflow = defineWorkflow(spec, fn);
|
|
96
|
+
this.registry.register(workflow);
|
|
97
|
+
return new RunnableWorkflow(this, workflow);
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Declare a workflow without providing its implementation (which is provided
|
|
99
|
-
* separately via `implementWorkflow`). Returns a lightweight WorkflowSpec
|
|
100
|
-
* that can be used to schedule workflow runs.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* export const emailWorkflow = declareWorkflow({
|
|
105
|
-
* name: 'send-email',
|
|
106
|
-
* schema: z.object({ to: z.string().email() }),
|
|
107
|
-
* });
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export function declareWorkflow(config) {
|
|
111
|
-
return {
|
|
112
|
-
name: config.name,
|
|
113
|
-
version: config.version ?? null,
|
|
114
|
-
schema: config.schema ?? null,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Generate a composite key for workflow registration that includes both name
|
|
119
|
-
* and version.
|
|
120
|
-
*
|
|
121
|
-
* @param name - The workflow name
|
|
122
|
-
* @param version - The workflow version (null for unversioned)
|
|
123
|
-
* @returns A composite key string
|
|
124
|
-
*/
|
|
125
|
-
export function getWorkflowKey(name, version) {
|
|
126
|
-
return version ? `${name}@${version}` : name;
|
|
127
|
-
}
|
|
128
|
-
//
|
|
129
|
-
// --- Workflow Definition
|
|
130
|
-
//
|
|
131
100
|
/**
|
|
132
101
|
* A fully defined workflow with its implementation. This class is returned by
|
|
133
|
-
* `defineWorkflow` and provides the `.run()` method for scheduling
|
|
134
|
-
* runs.
|
|
102
|
+
* `client.defineWorkflow` and provides the `.run()` method for scheduling
|
|
103
|
+
* workflow runs.
|
|
135
104
|
*/
|
|
136
|
-
export class
|
|
105
|
+
export class RunnableWorkflow {
|
|
137
106
|
ow;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
constructor(ow, spec, fn) {
|
|
107
|
+
workflow;
|
|
108
|
+
constructor(ow, workflow) {
|
|
141
109
|
this.ow = ow;
|
|
142
|
-
this.
|
|
143
|
-
this.fn = fn;
|
|
110
|
+
this.workflow = workflow;
|
|
144
111
|
}
|
|
145
112
|
/**
|
|
146
113
|
* Starts a new workflow run.
|
|
114
|
+
* @param input - Workflow input
|
|
115
|
+
* @param options - Run options
|
|
116
|
+
* @returns Workflow run handle
|
|
147
117
|
*/
|
|
148
118
|
async run(input, options) {
|
|
149
|
-
return this.ow.runWorkflow(this.spec, input, options);
|
|
119
|
+
return this.ow.runWorkflow(this.workflow.spec, input, options);
|
|
150
120
|
}
|
|
151
121
|
}
|
|
152
122
|
/**
|
|
@@ -166,9 +136,12 @@ export class WorkflowRunHandle {
|
|
|
166
136
|
}
|
|
167
137
|
/**
|
|
168
138
|
* Waits for the workflow run to complete and returns the result.
|
|
139
|
+
* @param options - Options for waiting for the result
|
|
140
|
+
* @returns Workflow output
|
|
169
141
|
*/
|
|
170
|
-
async result() {
|
|
142
|
+
async result(options) {
|
|
171
143
|
const start = Date.now();
|
|
144
|
+
const timeout = options?.timeoutMs ?? this.resultTimeoutMs;
|
|
172
145
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
173
146
|
while (true) {
|
|
174
147
|
const latest = await this.backend.getWorkflowRun({
|
|
@@ -187,7 +160,7 @@ export class WorkflowRunHandle {
|
|
|
187
160
|
if (latest.status === "canceled") {
|
|
188
161
|
throw new Error(`Workflow ${this.workflowRun.workflowName} was canceled`);
|
|
189
162
|
}
|
|
190
|
-
if (Date.now() - start >
|
|
163
|
+
if (Date.now() - start > timeout) {
|
|
191
164
|
throw new Error(`Timed out waiting for workflow run ${this.workflowRun.id} to finish`);
|
|
192
165
|
}
|
|
193
166
|
await new Promise((resolve) => {
|
|
@@ -205,4 +178,4 @@ export class WorkflowRunHandle {
|
|
|
205
178
|
});
|
|
206
179
|
}
|
|
207
180
|
}
|
|
208
|
-
//# sourceMappingURL=
|
|
181
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,cAAc,GAGf,MAAM,eAAe,CAAC;AAEvB,MAAM,+BAA+B,GAAG,IAAI,CAAC,CAAC,KAAK;AACnD,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,KAAK;AAetD;;GAEG;AACH,MAAM,OAAO,YAAY;IACf,OAAO,CAAU;IACjB,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAE1C,YAAY,OAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,OAA8C;QACtD,OAAO,IAAI,MAAM,CAAC;YAChB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACjC,WAAW,EAAE,OAAO,EAAE,WAAW;SAClC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,iBAAiB,CACf,IAA2C,EAC3C,EAAmC;QAEnC,MAAM,QAAQ,GAAsC;YAClD,IAAI;YACJ,EAAE;SACH,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAA+C,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,WAAW,CACf,IAA2C,EAC3C,KAAgB,EAChB,OAA4B;QAE5B,MAAM,gBAA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