openworkflow 0.4.0 → 0.4.1
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 +17 -11
- package/dist/backend-sqlite/backend.d.ts +38 -0
- package/dist/backend-sqlite/backend.d.ts.map +1 -0
- package/dist/backend-sqlite/backend.js +628 -0
- package/dist/backend-sqlite/backend.js.map +1 -0
- package/dist/backend-sqlite/index.d.ts +2 -0
- package/dist/backend-sqlite/index.d.ts.map +1 -0
- package/dist/backend-sqlite/index.js +2 -0
- package/dist/backend-sqlite/index.js.map +1 -0
- package/dist/backend-sqlite/sqlite.d.ts +45 -0
- package/dist/backend-sqlite/sqlite.d.ts.map +1 -0
- package/dist/backend-sqlite/sqlite.js +229 -0
- package/dist/backend-sqlite/sqlite.js.map +1 -0
- package/dist/config/config.d.ts +102 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +29 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/core/backend-test-suite.d.ts +22 -0
- package/dist/core/backend-test-suite.d.ts.map +1 -0
- package/dist/core/backend-test-suite.js +960 -0
- package/dist/core/backend-test-suite.js.map +1 -0
- package/dist/core/backend.d.ts +103 -0
- package/dist/core/backend.d.ts.map +1 -0
- package/dist/core/backend.js +2 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/backend.testsuite.d.ts +21 -0
- package/dist/core/backend.testsuite.d.ts.map +1 -0
- package/dist/core/backend.testsuite.js +958 -0
- package/dist/core/backend.testsuite.js.map +1 -0
- package/dist/{duration.d.ts → core/duration.d.ts} +2 -1
- package/dist/core/duration.d.ts.map +1 -0
- package/dist/{duration.js → core/duration.js} +6 -5
- package/dist/core/duration.js.map +1 -0
- package/dist/core/duration.test.d.ts +2 -0
- package/dist/core/duration.test.d.ts.map +1 -0
- package/dist/core/duration.test.js +264 -0
- package/dist/core/duration.test.js.map +1 -0
- package/dist/core/json.d.ts +5 -0
- package/dist/core/json.d.ts.map +1 -0
- package/dist/core/json.js +2 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/result.d.ts +12 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +7 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/result.test.d.ts +2 -0
- package/dist/core/result.test.d.ts.map +1 -0
- package/dist/core/result.test.js +11 -0
- package/dist/core/result.test.js.map +1 -0
- package/dist/core/retry.d.ts +16 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/{backend.js → core/retry.js} +1 -3
- package/dist/core/retry.js.map +1 -0
- package/dist/core/retry.test.d.ts +2 -0
- package/dist/core/retry.test.d.ts.map +1 -0
- package/dist/core/retry.test.js +36 -0
- package/dist/core/retry.test.js.map +1 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/core/step.d.ts +120 -0
- package/dist/core/step.d.ts.map +1 -0
- package/dist/core/step.js +101 -0
- package/dist/core/step.js.map +1 -0
- package/dist/core/step.test.d.ts +2 -0
- package/dist/core/step.test.d.ts.map +1 -0
- package/dist/core/step.test.js +340 -0
- package/dist/core/step.test.js.map +1 -0
- package/dist/core/workflow.d.ts +108 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js +79 -0
- package/dist/core/workflow.js.map +1 -0
- package/dist/core/workflow.test.d.ts +2 -0
- package/dist/core/workflow.test.d.ts.map +1 -0
- package/dist/core/workflow.test.js +216 -0
- package/dist/core/workflow.test.js.map +1 -0
- package/dist/execution/execution.d.ts +91 -0
- package/dist/execution/execution.d.ts.map +1 -0
- package/dist/execution/execution.js +188 -0
- package/dist/execution/execution.js.map +1 -0
- package/dist/execution/execution.test.d.ts +2 -0
- package/dist/execution/execution.test.d.ts.map +1 -0
- package/dist/execution/execution.test.js +382 -0
- package/dist/execution/execution.test.js.map +1 -0
- package/dist/global.d.ts +62 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/global.js +78 -0
- package/dist/global.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/sdk/sdk.d.ts +182 -0
- package/dist/sdk/sdk.d.ts.map +1 -0
- package/dist/sdk/sdk.js +208 -0
- package/dist/sdk/sdk.js.map +1 -0
- package/dist/sdk/sdk.test.d.ts +2 -0
- package/dist/sdk/sdk.test.d.ts.map +1 -0
- package/dist/sdk/sdk.test.js +195 -0
- package/dist/sdk/sdk.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{worker.d.ts → worker/worker.d.ts} +3 -3
- package/dist/worker/worker.d.ts.map +1 -0
- package/dist/worker/worker.js +208 -0
- package/dist/worker/worker.js.map +1 -0
- package/dist/worker/worker.test.d.ts +2 -0
- package/dist/worker/worker.test.d.ts.map +1 -0
- package/dist/worker/worker.test.js +786 -0
- package/dist/worker/worker.test.js.map +1 -0
- package/package.json +6 -6
- package/dist/backend.d.ts +0 -173
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js.map +0 -1
- package/dist/client.d.ts +0 -153
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -151
- package/dist/client.js.map +0 -1
- package/dist/duration.d.ts.map +0 -1
- package/dist/duration.js.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
- package/dist/worker.js +0 -384
- package/dist/worker.js.map +0 -1
- /package/dist/{schema.d.ts → core/schema.d.ts} +0 -0
- /package/dist/{schema.js → core/schema.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../core/schema.ts"],"names":[],"m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QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC,EAAE,GAAG,SAAS,CAAC;KACpE;IAED,+CAA+C;IAC/C,MAAM,WAAW,WAAW;QAC1B,2CAA2C;QAC3C,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;KAC3B;IAED,2CAA2C;IAC3C,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;QACpD,oCAAoC;QACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,qCAAqC;QACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;IAED,kDAAkD;IAClD,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACnE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,OAAO,CAAC,CAAC;IAEX,mDAAmD;IACnD,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACpE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,QAAQ,CAAC,CAAC;IAIZ,OAAO,EAAE,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../core/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { DurationString } from "./duration.js";
|
|
2
|
+
import type { JsonValue } from "./json.js";
|
|
3
|
+
import type { Result } from "./result.js";
|
|
4
|
+
/**
|
|
5
|
+
* The kind of step in a workflow.
|
|
6
|
+
*/
|
|
7
|
+
export type StepKind = "function" | "sleep";
|
|
8
|
+
/**
|
|
9
|
+
* Status of a step attempt through its lifecycle.
|
|
10
|
+
*/
|
|
11
|
+
export type StepAttemptStatus = "running" | "succeeded" | "completed" | "failed";
|
|
12
|
+
/**
|
|
13
|
+
* Context for a step attempt (currently only used for sleep steps).
|
|
14
|
+
*/
|
|
15
|
+
export interface StepAttemptContext {
|
|
16
|
+
kind: "sleep";
|
|
17
|
+
resumeAt: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* StepAttempt represents a single attempt of a step within a workflow.
|
|
21
|
+
*/
|
|
22
|
+
export interface StepAttempt {
|
|
23
|
+
namespaceId: string;
|
|
24
|
+
id: string;
|
|
25
|
+
workflowRunId: string;
|
|
26
|
+
stepName: string;
|
|
27
|
+
kind: StepKind;
|
|
28
|
+
status: StepAttemptStatus;
|
|
29
|
+
config: JsonValue;
|
|
30
|
+
context: StepAttemptContext | null;
|
|
31
|
+
output: JsonValue | null;
|
|
32
|
+
error: JsonValue | null;
|
|
33
|
+
childWorkflowRunNamespaceId: string | null;
|
|
34
|
+
childWorkflowRunId: string | null;
|
|
35
|
+
startedAt: Date | null;
|
|
36
|
+
finishedAt: Date | null;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Immutable cache for step attempts, keyed by step name.
|
|
42
|
+
*/
|
|
43
|
+
export type StepAttemptCache = ReadonlyMap<string, StepAttempt>;
|
|
44
|
+
/**
|
|
45
|
+
* Serialized error format for JSON compatibility.
|
|
46
|
+
*/
|
|
47
|
+
export interface SerializedError {
|
|
48
|
+
message: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
stack?: string | null;
|
|
51
|
+
[key: string]: JsonValue;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Serialize an error to a JSON-compatible format. Pure function that converts
|
|
55
|
+
* any error into a SerializedError object.
|
|
56
|
+
*
|
|
57
|
+
* @param error - The error to serialize (can be Error instance or any value)
|
|
58
|
+
* @returns A JSON-serializable error object
|
|
59
|
+
*/
|
|
60
|
+
export declare function serializeError(error: unknown): SerializedError;
|
|
61
|
+
/**
|
|
62
|
+
* Create a step attempt cache from an array of attempts. Only includes
|
|
63
|
+
* successful attempts (completed or succeeded status).
|
|
64
|
+
*
|
|
65
|
+
* @param attempts - Array of step attempts to cache
|
|
66
|
+
* @returns An immutable map of step name to successful attempt
|
|
67
|
+
*/
|
|
68
|
+
export declare function createStepAttemptCacheFromAttempts(attempts: readonly StepAttempt[]): StepAttemptCache;
|
|
69
|
+
/**
|
|
70
|
+
* Get a cached step attempt by name.
|
|
71
|
+
*
|
|
72
|
+
* @param cache - The step attempt cache
|
|
73
|
+
* @param stepName - The name of the step to look up
|
|
74
|
+
* @returns The cached attempt or undefined if not found
|
|
75
|
+
*/
|
|
76
|
+
export declare function getCachedStepAttempt(cache: StepAttemptCache, stepName: string): StepAttempt | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a step attempt is cached (has completed successfully).
|
|
79
|
+
*
|
|
80
|
+
* @param cache - The step attempt cache
|
|
81
|
+
* @param stepName - The name of the step to check
|
|
82
|
+
* @returns True if the step has a cached successful result
|
|
83
|
+
*/
|
|
84
|
+
export declare function hasCompletedStep(cache: StepAttemptCache, stepName: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Add a step attempt to the cache (returns new cache, original unchanged). This
|
|
87
|
+
* is an immutable operation.
|
|
88
|
+
*
|
|
89
|
+
* @param cache - The existing step attempt cache
|
|
90
|
+
* @param attempt - The attempt to add
|
|
91
|
+
* @returns A new cache with the attempt added
|
|
92
|
+
*/
|
|
93
|
+
export declare function addToStepAttemptCache(cache: StepAttemptCache, attempt: Readonly<StepAttempt>): StepAttemptCache;
|
|
94
|
+
/**
|
|
95
|
+
* Convert a step function result to a JSON-compatible value. Undefined values
|
|
96
|
+
* are converted to null for JSON serialization.
|
|
97
|
+
*
|
|
98
|
+
* @param result - The result from a step function
|
|
99
|
+
* @returns A JSON-serializable value
|
|
100
|
+
*/
|
|
101
|
+
export declare function normalizeStepOutput(result: unknown): JsonValue;
|
|
102
|
+
/**
|
|
103
|
+
* Calculate the resume time for a sleep step.
|
|
104
|
+
*
|
|
105
|
+
* @param duration - The duration string to sleep for
|
|
106
|
+
* @param now - The current timestamp (defaults to Date.now())
|
|
107
|
+
* @returns A Result containing the resume Date or an Error
|
|
108
|
+
*/
|
|
109
|
+
export declare function calculateSleepResumeAt(duration: DurationString, now?: number): Result<Date, Error>;
|
|
110
|
+
/**
|
|
111
|
+
* Create the context object for a sleep step attempt.
|
|
112
|
+
*
|
|
113
|
+
* @param resumeAt - The time when the sleep should resume
|
|
114
|
+
* @returns The context object for the sleep step
|
|
115
|
+
*/
|
|
116
|
+
export declare function createSleepContext(resumeAt: Readonly<Date>): {
|
|
117
|
+
kind: "sleep";
|
|
118
|
+
resumeAt: string;
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../core/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAA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,EAAE,OAAO,GAAG,SAAS,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,cAAc,EACxB,GAAG,GAAE,MAAmB,GACvB,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAQrB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAKA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { parseDuration } from "./duration.js";
|
|
2
|
+
import { err, ok } from "./result.js";
|
|
3
|
+
/**
|
|
4
|
+
* Serialize an error to a JSON-compatible format. Pure function that converts
|
|
5
|
+
* any error into a SerializedError object.
|
|
6
|
+
*
|
|
7
|
+
* @param error - The error to serialize (can be Error instance or any value)
|
|
8
|
+
* @returns A JSON-serializable error object
|
|
9
|
+
*/
|
|
10
|
+
export function serializeError(error) {
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
return {
|
|
13
|
+
name: error.name,
|
|
14
|
+
message: error.message,
|
|
15
|
+
stack: error.stack ?? null,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
message: String(error),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a step attempt cache from an array of attempts. Only includes
|
|
24
|
+
* successful attempts (completed or succeeded status).
|
|
25
|
+
*
|
|
26
|
+
* @param attempts - Array of step attempts to cache
|
|
27
|
+
* @returns An immutable map of step name to successful attempt
|
|
28
|
+
*/
|
|
29
|
+
export function createStepAttemptCacheFromAttempts(attempts) {
|
|
30
|
+
// 'succeeded' status is deprecated in favor of 'completed'
|
|
31
|
+
const successfulAttempts = attempts.filter((attempt) => attempt.status === "succeeded" || attempt.status === "completed");
|
|
32
|
+
return new Map(successfulAttempts.map((attempt) => [attempt.stepName, attempt]));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get a cached step attempt by name.
|
|
36
|
+
*
|
|
37
|
+
* @param cache - The step attempt cache
|
|
38
|
+
* @param stepName - The name of the step to look up
|
|
39
|
+
* @returns The cached attempt or undefined if not found
|
|
40
|
+
*/
|
|
41
|
+
export function getCachedStepAttempt(cache, stepName) {
|
|
42
|
+
return cache.get(stepName);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if a step attempt is cached (has completed successfully).
|
|
46
|
+
*
|
|
47
|
+
* @param cache - The step attempt cache
|
|
48
|
+
* @param stepName - The name of the step to check
|
|
49
|
+
* @returns True if the step has a cached successful result
|
|
50
|
+
*/
|
|
51
|
+
export function hasCompletedStep(cache, stepName) {
|
|
52
|
+
return cache.has(stepName);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Add a step attempt to the cache (returns new cache, original unchanged). This
|
|
56
|
+
* is an immutable operation.
|
|
57
|
+
*
|
|
58
|
+
* @param cache - The existing step attempt cache
|
|
59
|
+
* @param attempt - The attempt to add
|
|
60
|
+
* @returns A new cache with the attempt added
|
|
61
|
+
*/
|
|
62
|
+
export function addToStepAttemptCache(cache, attempt) {
|
|
63
|
+
return new Map([...cache, [attempt.stepName, attempt]]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Convert a step function result to a JSON-compatible value. Undefined values
|
|
67
|
+
* are converted to null for JSON serialization.
|
|
68
|
+
*
|
|
69
|
+
* @param result - The result from a step function
|
|
70
|
+
* @returns A JSON-serializable value
|
|
71
|
+
*/
|
|
72
|
+
export function normalizeStepOutput(result) {
|
|
73
|
+
return (result ?? null);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Calculate the resume time for a sleep step.
|
|
77
|
+
*
|
|
78
|
+
* @param duration - The duration string to sleep for
|
|
79
|
+
* @param now - The current timestamp (defaults to Date.now())
|
|
80
|
+
* @returns A Result containing the resume Date or an Error
|
|
81
|
+
*/
|
|
82
|
+
export function calculateSleepResumeAt(duration, now = Date.now()) {
|
|
83
|
+
const result = parseDuration(duration);
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return err(result.error);
|
|
86
|
+
}
|
|
87
|
+
return ok(new Date(now + result.value));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create the context object for a sleep step attempt.
|
|
91
|
+
*
|
|
92
|
+
* @param resumeAt - The time when the sleep should resume
|
|
93
|
+
* @returns The context object for the sleep step
|
|
94
|
+
*/
|
|
95
|
+
export function createSleepContext(resumeAt) {
|
|
96
|
+
return {
|
|
97
|
+
kind: "sleep",
|
|
98
|
+
resumeAt: resumeAt.toISOString(),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../core/step.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AA6DtC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;SAC3B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;KACvB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAgC;IAEhC,2DAA2D;IAC3D,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CACxC,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,MAAM,KAA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B,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.test.d.ts","sourceRoot":"","sources":["../../core/step.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { ok } from "./result.js";
|
|
2
|
+
import { serializeError, createStepAttemptCacheFromAttempts, getCachedStepAttempt, hasCompletedStep, addToStepAttemptCache, normalizeStepOutput, calculateSleepResumeAt, createSleepContext, } from "./step.js";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
describe("serializeError", () => {
|
|
5
|
+
test("serializes Error instance with name, message, and stack", () => {
|
|
6
|
+
const error = new Error("Something went wrong");
|
|
7
|
+
const result = serializeError(error);
|
|
8
|
+
expect(result.name).toBe("Error");
|
|
9
|
+
expect(result.message).toBe("Something went wrong");
|
|
10
|
+
expect(result.stack).toBeDefined();
|
|
11
|
+
expect(typeof result.stack).toBe("string");
|
|
12
|
+
});
|
|
13
|
+
test("serializes TypeError with correct name", () => {
|
|
14
|
+
const error = new TypeError("Invalid type");
|
|
15
|
+
const result = serializeError(error);
|
|
16
|
+
expect(result.name).toBe("TypeError");
|
|
17
|
+
expect(result.message).toBe("Invalid type");
|
|
18
|
+
});
|
|
19
|
+
test("serializes custom Error subclass", () => {
|
|
20
|
+
class CustomError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "CustomError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const error = new CustomError("Custom error message");
|
|
27
|
+
const result = serializeError(error);
|
|
28
|
+
expect(result.name).toBe("CustomError");
|
|
29
|
+
expect(result.message).toBe("Custom error message");
|
|
30
|
+
});
|
|
31
|
+
test("serializes Error without stack as null", () => {
|
|
32
|
+
const error = new Error("No stack");
|
|
33
|
+
// @ts-expect-error testing edge case
|
|
34
|
+
error.stack = undefined;
|
|
35
|
+
const result = serializeError(error);
|
|
36
|
+
expect(result.stack).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
test("serializes string to message", () => {
|
|
39
|
+
const result = serializeError("string error");
|
|
40
|
+
expect(result.message).toBe("string error");
|
|
41
|
+
expect(result.name).toBeUndefined();
|
|
42
|
+
expect(result.stack).toBeUndefined();
|
|
43
|
+
});
|
|
44
|
+
test("serializes number to message", () => {
|
|
45
|
+
const result = serializeError(42);
|
|
46
|
+
expect(result.message).toBe("42");
|
|
47
|
+
});
|
|
48
|
+
test("serializes null to message", () => {
|
|
49
|
+
const result = serializeError(null);
|
|
50
|
+
expect(result.message).toBe("null");
|
|
51
|
+
});
|
|
52
|
+
test("serializes undefined to message", () => {
|
|
53
|
+
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
54
|
+
const result = serializeError(undefined);
|
|
55
|
+
expect(result.message).toBe("undefined");
|
|
56
|
+
});
|
|
57
|
+
test("serializes object to message using String()", () => {
|
|
58
|
+
const result = serializeError({ foo: "bar" });
|
|
59
|
+
expect(result.message).toBe("[object Object]");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe("createStepAttemptCacheFromAttempts", () => {
|
|
63
|
+
test("creates empty cache from empty array", () => {
|
|
64
|
+
const cache = createStepAttemptCacheFromAttempts([]);
|
|
65
|
+
expect(cache.size).toBe(0);
|
|
66
|
+
});
|
|
67
|
+
test("includes completed attempts in cache", () => {
|
|
68
|
+
const attempt = createMockStepAttempt({
|
|
69
|
+
stepName: "step-a",
|
|
70
|
+
status: "completed",
|
|
71
|
+
output: "result",
|
|
72
|
+
});
|
|
73
|
+
const cache = createStepAttemptCacheFromAttempts([attempt]);
|
|
74
|
+
expect(cache.size).toBe(1);
|
|
75
|
+
expect(cache.get("step-a")).toBe(attempt);
|
|
76
|
+
});
|
|
77
|
+
test("includes succeeded attempts in cache (deprecated status)", () => {
|
|
78
|
+
const attempt = createMockStepAttempt({
|
|
79
|
+
stepName: "step-b",
|
|
80
|
+
status: "succeeded",
|
|
81
|
+
output: "result",
|
|
82
|
+
});
|
|
83
|
+
const cache = createStepAttemptCacheFromAttempts([attempt]);
|
|
84
|
+
expect(cache.size).toBe(1);
|
|
85
|
+
expect(cache.get("step-b")).toBe(attempt);
|
|
86
|
+
});
|
|
87
|
+
test("excludes running attempts from cache", () => {
|
|
88
|
+
const attempt = createMockStepAttempt({
|
|
89
|
+
stepName: "step-c",
|
|
90
|
+
status: "running",
|
|
91
|
+
});
|
|
92
|
+
const cache = createStepAttemptCacheFromAttempts([attempt]);
|
|
93
|
+
expect(cache.size).toBe(0);
|
|
94
|
+
});
|
|
95
|
+
test("excludes failed attempts from cache", () => {
|
|
96
|
+
const attempt = createMockStepAttempt({
|
|
97
|
+
stepName: "step-d",
|
|
98
|
+
status: "failed",
|
|
99
|
+
error: { message: "failed" },
|
|
100
|
+
});
|
|
101
|
+
const cache = createStepAttemptCacheFromAttempts([attempt]);
|
|
102
|
+
expect(cache.size).toBe(0);
|
|
103
|
+
});
|
|
104
|
+
test("filters mixed statuses correctly", () => {
|
|
105
|
+
const attempts = [
|
|
106
|
+
createMockStepAttempt({
|
|
107
|
+
stepName: "completed-step",
|
|
108
|
+
status: "completed",
|
|
109
|
+
}),
|
|
110
|
+
createMockStepAttempt({ stepName: "running-step", status: "running" }),
|
|
111
|
+
createMockStepAttempt({ stepName: "failed-step", status: "failed" }),
|
|
112
|
+
createMockStepAttempt({
|
|
113
|
+
stepName: "succeeded-step",
|
|
114
|
+
status: "succeeded",
|
|
115
|
+
}),
|
|
116
|
+
];
|
|
117
|
+
const cache = createStepAttemptCacheFromAttempts(attempts);
|
|
118
|
+
expect(cache.size).toBe(2);
|
|
119
|
+
expect(cache.has("completed-step")).toBe(true);
|
|
120
|
+
expect(cache.has("succeeded-step")).toBe(true);
|
|
121
|
+
expect(cache.has("running-step")).toBe(false);
|
|
122
|
+
expect(cache.has("failed-step")).toBe(false);
|
|
123
|
+
});
|
|
124
|
+
test("uses step name as cache key", () => {
|
|
125
|
+
const attempt = createMockStepAttempt({
|
|
126
|
+
stepName: "my-unique-step-name",
|
|
127
|
+
status: "completed",
|
|
128
|
+
});
|
|
129
|
+
const cache = createStepAttemptCacheFromAttempts([attempt]);
|
|
130
|
+
expect(cache.get("my-unique-step-name")).toBe(attempt);
|
|
131
|
+
expect(cache.get("other-name")).toBeUndefined();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
describe("getCachedStepAttempt", () => {
|
|
135
|
+
test("returns cached attempt when present", () => {
|
|
136
|
+
const attempt = createMockStepAttempt({ stepName: "cached-step" });
|
|
137
|
+
const cache = new Map([["cached-step", attempt]]);
|
|
138
|
+
const result = getCachedStepAttempt(cache, "cached-step");
|
|
139
|
+
expect(result).toBe(attempt);
|
|
140
|
+
});
|
|
141
|
+
test("returns undefined when step not in cache", () => {
|
|
142
|
+
const cache = new Map();
|
|
143
|
+
const result = getCachedStepAttempt(cache, "missing-step");
|
|
144
|
+
expect(result).toBeUndefined();
|
|
145
|
+
});
|
|
146
|
+
test("returns undefined for similar but different step names", () => {
|
|
147
|
+
const attempt = createMockStepAttempt({ stepName: "step-1" });
|
|
148
|
+
const cache = new Map([["step-1", attempt]]);
|
|
149
|
+
expect(getCachedStepAttempt(cache, "step-2")).toBeUndefined();
|
|
150
|
+
expect(getCachedStepAttempt(cache, "Step-1")).toBeUndefined();
|
|
151
|
+
expect(getCachedStepAttempt(cache, "step-1 ")).toBeUndefined();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
describe("hasCompletedStep", () => {
|
|
155
|
+
test("returns true when step is in cache", () => {
|
|
156
|
+
const attempt = createMockStepAttempt({ stepName: "step-x" });
|
|
157
|
+
const cache = new Map([["step-x", attempt]]);
|
|
158
|
+
expect(hasCompletedStep(cache, "step-x")).toBe(true);
|
|
159
|
+
});
|
|
160
|
+
test("returns false when step is not in cache", () => {
|
|
161
|
+
const cache = new Map();
|
|
162
|
+
expect(hasCompletedStep(cache, "step-y")).toBe(false);
|
|
163
|
+
});
|
|
164
|
+
test("returns false for empty cache", () => {
|
|
165
|
+
const cache = new Map();
|
|
166
|
+
expect(hasCompletedStep(cache, "any-step")).toBe(false);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("addToStepAttemptCache", () => {
|
|
170
|
+
test("adds attempt to empty cache", () => {
|
|
171
|
+
const cache = new Map();
|
|
172
|
+
const attempt = createMockStepAttempt({ stepName: "new-step" });
|
|
173
|
+
const newCache = addToStepAttemptCache(cache, attempt);
|
|
174
|
+
expect(newCache.size).toBe(1);
|
|
175
|
+
expect(newCache.get("new-step")).toBe(attempt);
|
|
176
|
+
});
|
|
177
|
+
test("adds attempt to existing cache", () => {
|
|
178
|
+
const existing = createMockStepAttempt({ stepName: "existing-step" });
|
|
179
|
+
const cache = new Map([["existing-step", existing]]);
|
|
180
|
+
const newAttempt = createMockStepAttempt({ stepName: "new-step" });
|
|
181
|
+
const newCache = addToStepAttemptCache(cache, newAttempt);
|
|
182
|
+
expect(newCache.size).toBe(2);
|
|
183
|
+
expect(newCache.get("existing-step")).toBe(existing);
|
|
184
|
+
expect(newCache.get("new-step")).toBe(newAttempt);
|
|
185
|
+
});
|
|
186
|
+
test("does not mutate original cache (immutable)", () => {
|
|
187
|
+
const existing = createMockStepAttempt({ stepName: "existing-step" });
|
|
188
|
+
const cache = new Map([["existing-step", existing]]);
|
|
189
|
+
const newAttempt = createMockStepAttempt({ stepName: "new-step" });
|
|
190
|
+
const newCache = addToStepAttemptCache(cache, newAttempt);
|
|
191
|
+
expect(cache.size).toBe(1);
|
|
192
|
+
expect(cache.has("new-step")).toBe(false);
|
|
193
|
+
expect(newCache.size).toBe(2);
|
|
194
|
+
});
|
|
195
|
+
test("overwrites existing entry with same step name", () => {
|
|
196
|
+
const original = createMockStepAttempt({
|
|
197
|
+
stepName: "step",
|
|
198
|
+
output: "original",
|
|
199
|
+
});
|
|
200
|
+
const cache = new Map([["step", original]]);
|
|
201
|
+
const replacement = createMockStepAttempt({
|
|
202
|
+
stepName: "step",
|
|
203
|
+
output: "replacement",
|
|
204
|
+
});
|
|
205
|
+
const newCache = addToStepAttemptCache(cache, replacement);
|
|
206
|
+
expect(newCache.size).toBe(1);
|
|
207
|
+
expect(newCache.get("step")?.output).toBe("replacement");
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
describe("normalizeStepOutput", () => {
|
|
211
|
+
test("passes through string values", () => {
|
|
212
|
+
expect(normalizeStepOutput("hello")).toBe("hello");
|
|
213
|
+
});
|
|
214
|
+
test("passes through number values", () => {
|
|
215
|
+
expect(normalizeStepOutput(42)).toBe(42);
|
|
216
|
+
expect(normalizeStepOutput(3.14)).toBe(3.14);
|
|
217
|
+
expect(normalizeStepOutput(0)).toBe(0);
|
|
218
|
+
expect(normalizeStepOutput(-1)).toBe(-1);
|
|
219
|
+
});
|
|
220
|
+
test("passes through boolean values", () => {
|
|
221
|
+
expect(normalizeStepOutput(true)).toBe(true);
|
|
222
|
+
expect(normalizeStepOutput(false)).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
test("passes through null", () => {
|
|
225
|
+
expect(normalizeStepOutput(null)).toBeNull();
|
|
226
|
+
});
|
|
227
|
+
test("converts undefined to null", () => {
|
|
228
|
+
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
229
|
+
expect(normalizeStepOutput(undefined)).toBeNull();
|
|
230
|
+
});
|
|
231
|
+
test("passes through object values", () => {
|
|
232
|
+
const obj = { foo: "bar", nested: { baz: 123 } };
|
|
233
|
+
expect(normalizeStepOutput(obj)).toBe(obj);
|
|
234
|
+
});
|
|
235
|
+
test("passes through array values", () => {
|
|
236
|
+
const arr = [1, 2, 3];
|
|
237
|
+
expect(normalizeStepOutput(arr)).toBe(arr);
|
|
238
|
+
});
|
|
239
|
+
test("passes through empty object", () => {
|
|
240
|
+
const obj = {};
|
|
241
|
+
expect(normalizeStepOutput(obj)).toBe(obj);
|
|
242
|
+
});
|
|
243
|
+
test("passes through empty array", () => {
|
|
244
|
+
const arr = [];
|
|
245
|
+
expect(normalizeStepOutput(arr)).toBe(arr);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
describe("calculateSleepResumeAt", () => {
|
|
249
|
+
test("calculates resume time from duration string", () => {
|
|
250
|
+
const now = 1_000_000;
|
|
251
|
+
const result = calculateSleepResumeAt("5s", now);
|
|
252
|
+
expect(result).toEqual(ok(new Date(now + 5000)));
|
|
253
|
+
});
|
|
254
|
+
test("calculates resume time with milliseconds", () => {
|
|
255
|
+
const now = 1_000_000;
|
|
256
|
+
const result = calculateSleepResumeAt("500ms", now);
|
|
257
|
+
expect(result).toEqual(ok(new Date(now + 500)));
|
|
258
|
+
});
|
|
259
|
+
test("calculates resume time with minutes", () => {
|
|
260
|
+
const now = 1_000_000;
|
|
261
|
+
const result = calculateSleepResumeAt("2m", now);
|
|
262
|
+
expect(result).toEqual(ok(new Date(now + 2 * 60 * 1000)));
|
|
263
|
+
});
|
|
264
|
+
test("calculates resume time with hours", () => {
|
|
265
|
+
const now = 1_000_000;
|
|
266
|
+
const result = calculateSleepResumeAt("1h", now);
|
|
267
|
+
expect(result).toEqual(ok(new Date(now + 60 * 60 * 1000)));
|
|
268
|
+
});
|
|
269
|
+
test("uses Date.now() when now is not provided", () => {
|
|
270
|
+
const before = Date.now();
|
|
271
|
+
const result = calculateSleepResumeAt("1s");
|
|
272
|
+
const after = Date.now();
|
|
273
|
+
expect(result.ok).toBe(true);
|
|
274
|
+
if (result.ok) {
|
|
275
|
+
const resumeTime = result.value.getTime();
|
|
276
|
+
expect(resumeTime).toBeGreaterThanOrEqual(before + 1000);
|
|
277
|
+
expect(resumeTime).toBeLessThanOrEqual(after + 1000);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
test("returns error for invalid duration", () => {
|
|
281
|
+
// @ts-expect-error testing invalid input
|
|
282
|
+
const result = calculateSleepResumeAt("invalid");
|
|
283
|
+
expect(result.ok).toBe(false);
|
|
284
|
+
if (!result.ok) {
|
|
285
|
+
expect(result.error).toBeInstanceOf(Error);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
test("returns error for empty duration", () => {
|
|
289
|
+
// @ts-expect-error testing invalid input
|
|
290
|
+
const result = calculateSleepResumeAt("");
|
|
291
|
+
expect(result.ok).toBe(false);
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
describe("createSleepContext", () => {
|
|
295
|
+
test("creates sleep context with ISO string timestamp", () => {
|
|
296
|
+
const resumeAt = new Date("2025-06-15T10:30:00.000Z");
|
|
297
|
+
const context = createSleepContext(resumeAt);
|
|
298
|
+
expect(context).toEqual({
|
|
299
|
+
kind: "sleep",
|
|
300
|
+
resumeAt: "2025-06-15T10:30:00.000Z",
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
test("preserves millisecond precision", () => {
|
|
304
|
+
const resumeAt = new Date("2025-01-01T00:00:00.123Z");
|
|
305
|
+
const context = createSleepContext(resumeAt);
|
|
306
|
+
expect(context.resumeAt).toBe("2025-01-01T00:00:00.123Z");
|
|
307
|
+
});
|
|
308
|
+
test("always has kind set to sleep", () => {
|
|
309
|
+
const resumeAt = new Date();
|
|
310
|
+
const context = createSleepContext(resumeAt);
|
|
311
|
+
expect(context.kind).toBe("sleep");
|
|
312
|
+
});
|
|
313
|
+
test("creates context from current date", () => {
|
|
314
|
+
const now = new Date();
|
|
315
|
+
const context = createSleepContext(now);
|
|
316
|
+
expect(context.resumeAt).toBe(now.toISOString());
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
function createMockStepAttempt(overrides = {}) {
|
|
320
|
+
return {
|
|
321
|
+
namespaceId: "default",
|
|
322
|
+
id: "step-1",
|
|
323
|
+
workflowRunId: "workflow-1",
|
|
324
|
+
stepName: "test-step",
|
|
325
|
+
kind: "function",
|
|
326
|
+
status: "completed",
|
|
327
|
+
config: {},
|
|
328
|
+
context: null,
|
|
329
|
+
output: null,
|
|
330
|
+
error: null,
|
|
331
|
+
childWorkflowRunNamespaceId: null,
|
|
332
|
+
childWorkflowRunId: null,
|
|
333
|
+
startedAt: new Date("2025-01-01T00:00:00Z"),
|
|
334
|
+
finishedAt: new Date("2025-01-01T00:00:01Z"),
|
|
335
|
+
createdAt: new Date("2025-01-01T00:00:00Z"),
|
|
336
|
+
updatedAt: new Date("2025-01-01T00:00:01Z"),
|
|
337
|
+
...overrides,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=step.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.test.js","sourceRoot":"","sources":["../../core/step.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,cAAc,EACd,kCAAkC,EAClC,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEhD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACnE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAA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