@cascade-flow/backend-interface 0.1.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 +79 -0
- package/dist/analytics-helpers.d.ts +51 -0
- package/dist/analytics-helpers.d.ts.map +1 -0
- package/dist/analytics.d.ts +338 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/error-fingerprint.d.ts +43 -0
- package/dist/error-fingerprint.d.ts.map +1 -0
- package/dist/events.d.ts +818 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13780 -0
- package/dist/index.js.map +85 -0
- package/dist/interface.d.ts +745 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/projection.d.ts +93 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/schema-conversion.d.ts +40 -0
- package/dist/schema-conversion.d.ts.map +1 -0
- package/dist/schemas.d.ts +271 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/serialization.d.ts +37 -0
- package/dist/serialization.d.ts.map +1 -0
- package/dist/time-utils.d.ts +28 -0
- package/dist/time-utils.d.ts.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EACjB,MA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G;IACH,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAE7F;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAEjE;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IAEzE;;;;;;;;OAQG;IACH,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CACpF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Event, StepEvent, WorkflowEvent } from "./events.js";
|
|
2
|
+
import type { StepRecord, StepState, LogEntry, RunState } from "./schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* Project (replay) a sequence of events to compute the current StepRecord state
|
|
5
|
+
*
|
|
6
|
+
* This is a pure function that implements event sourcing projection logic.
|
|
7
|
+
* Given a chronologically ordered array of events, it computes the current
|
|
8
|
+
* state of a step by replaying all state transitions.
|
|
9
|
+
*
|
|
10
|
+
* @param events - Chronologically ordered events for a single step (must be step events)
|
|
11
|
+
* @returns The current state of the step
|
|
12
|
+
*/
|
|
13
|
+
export declare function projectStepRecord(events: Event[]): StepRecord;
|
|
14
|
+
/**
|
|
15
|
+
* Extract log entries from events
|
|
16
|
+
*
|
|
17
|
+
* Filters out LogEntry events and converts them to the LogEntry format
|
|
18
|
+
* used by the Backend interface.
|
|
19
|
+
*
|
|
20
|
+
* @param events - All events for a step
|
|
21
|
+
* @returns Array of log entries in chronological order
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractLogsFromEvents(events: Event[]): LogEntry[];
|
|
24
|
+
/**
|
|
25
|
+
* Metadata about a specific attempt of a step execution
|
|
26
|
+
*/
|
|
27
|
+
export type AttemptMetadata = {
|
|
28
|
+
attemptNumber: number;
|
|
29
|
+
status: "running" | "completed" | "failed";
|
|
30
|
+
startTime?: number;
|
|
31
|
+
endTime?: number;
|
|
32
|
+
duration?: number;
|
|
33
|
+
hasLogs: boolean;
|
|
34
|
+
logCount: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Extract metadata for all attempts from step events
|
|
38
|
+
*
|
|
39
|
+
* Computes status, timing, and log count for each attempt by analyzing
|
|
40
|
+
* StepStarted, StepCompleted, StepFailed, and LogEntry events.
|
|
41
|
+
*
|
|
42
|
+
* @param events - All events for a step
|
|
43
|
+
* @returns Array of attempt metadata, indexed by attempt number (1-indexed)
|
|
44
|
+
*/
|
|
45
|
+
export declare function extractAttemptMetadata(events: Event[]): AttemptMetadata[];
|
|
46
|
+
/**
|
|
47
|
+
* Get the current attempt number for a step based on its events
|
|
48
|
+
*
|
|
49
|
+
* Counts the number of StepStarted events to determine which attempt
|
|
50
|
+
* is currently in progress.
|
|
51
|
+
*
|
|
52
|
+
* @param events - All events for a step
|
|
53
|
+
* @returns The current attempt number (1-indexed)
|
|
54
|
+
*/
|
|
55
|
+
export declare function getCurrentAttemptNumber(events: Event[]): number;
|
|
56
|
+
/**
|
|
57
|
+
* Project (replay) workflow events to compute the current RunState
|
|
58
|
+
*
|
|
59
|
+
* This is the core of the events-as-queue pattern: queue state is computed
|
|
60
|
+
* by replaying workflow events in chronological order.
|
|
61
|
+
*
|
|
62
|
+
* State transitions:
|
|
63
|
+
* - RunSubmitted → pending
|
|
64
|
+
* - RunClaimed → claimed
|
|
65
|
+
* - RunScheduled → pending (with new availableAt)
|
|
66
|
+
* - WorkflowStarted → running
|
|
67
|
+
* - WorkflowCompleted/Failed/Cancelled → completed/failed/cancelled
|
|
68
|
+
*
|
|
69
|
+
* @param events - Chronologically ordered workflow events for a single run
|
|
70
|
+
* @param workflowSlug - The workflow this run belongs to
|
|
71
|
+
* @returns The current state of the run
|
|
72
|
+
*/
|
|
73
|
+
export declare function projectRunStateFromEvents(events: WorkflowEvent[], workflowSlug: string): RunState;
|
|
74
|
+
/**
|
|
75
|
+
* Project (replay) step events to compute the current StepState
|
|
76
|
+
*
|
|
77
|
+
* This is the core projection function for step-level distribution.
|
|
78
|
+
* Given a chronologically ordered array of step events, it computes
|
|
79
|
+
* the current state of a step by replaying all state transitions.
|
|
80
|
+
*
|
|
81
|
+
* State machine:
|
|
82
|
+
* - pending → scheduled (StepScheduled)
|
|
83
|
+
* - scheduled → running (StepStarted)
|
|
84
|
+
* - running → completed (StepCompleted)
|
|
85
|
+
* - running → failed (StepFailed with terminal=true)
|
|
86
|
+
* - running → scheduled (StepFailed with terminal=false, or StepReclaimed)
|
|
87
|
+
*
|
|
88
|
+
* @param events - Chronologically ordered step events for a single step
|
|
89
|
+
* @param workflowSlug - The workflow this step belongs to
|
|
90
|
+
* @returns The current state of the step
|
|
91
|
+
*/
|
|
92
|
+
export declare function projectStepState(events: StepEvent[], workflowSlug: string): StepState;
|
|
93
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EAST,aAAa,EAGd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CA+G7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CASjE;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,EAAE,CAgEzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAG/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EAAE,EACvB,YAAY,EAAE,MAAM,GACnB,QAAQ,CA2EV;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EAAE,EACnB,YAAY,EAAE,MAAM,GACnB,SAAS,CAiLX"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ZodSchema } from "zod";
|
|
2
|
+
import type { JSONSchema as ZodJSONSchema } from "zod/v4/core";
|
|
3
|
+
/**
|
|
4
|
+
* JSON Schema Draft 2020-12 type
|
|
5
|
+
* Represents the output of Zod's toJSONSchema() conversion
|
|
6
|
+
*/
|
|
7
|
+
export type JSONSchema = ZodJSONSchema.BaseSchema;
|
|
8
|
+
/**
|
|
9
|
+
* Convert a Zod schema to JSON Schema Draft 2020-12 format
|
|
10
|
+
*
|
|
11
|
+
* This allows Zod schemas (TypeScript-based) to be serialized and stored
|
|
12
|
+
* in backends like Postgres, or exposed to clients for documentation and
|
|
13
|
+
* dynamic form generation.
|
|
14
|
+
*
|
|
15
|
+
* @param schema - Zod schema to convert
|
|
16
|
+
* @returns JSON Schema object that can be serialized
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { z } from "zod";
|
|
21
|
+
* import { convertZodToJSONSchema } from "@cascade-flow/backend-interface";
|
|
22
|
+
*
|
|
23
|
+
* const zodSchema = z.object({
|
|
24
|
+
* userId: z.string(),
|
|
25
|
+
* count: z.number().positive(),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const jsonSchema = convertZodToJSONSchema(zodSchema);
|
|
29
|
+
* // Can now be JSON.stringify'd and stored in database
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @note
|
|
33
|
+
* Some Zod features don't translate to JSON Schema:
|
|
34
|
+
* - Custom .refine() and .superRefine() validations
|
|
35
|
+
* - .transform() functions (use { io: "input" } option if needed)
|
|
36
|
+
* - Branded types
|
|
37
|
+
* - Cross-field validations
|
|
38
|
+
*/
|
|
39
|
+
export declare function convertZodToJSONSchema(schema: ZodSchema): JSONSchema;
|
|
40
|
+
//# sourceMappingURL=schema-conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-conversion.d.ts","sourceRoot":"","sources":["../src/schema-conversion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAWpE"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Status of a step in the workflow
|
|
4
|
+
* - pending: Step not yet ready (dependencies not satisfied)
|
|
5
|
+
* - scheduled: Step ready and scheduled for execution
|
|
6
|
+
* - running: Step is currently executing
|
|
7
|
+
* - completed: Step finished successfully
|
|
8
|
+
* - failed: Step failed (terminal failure, no more retries)
|
|
9
|
+
* - skipped: Step was skipped (either threw Skip or dependency was skipped)
|
|
10
|
+
*/
|
|
11
|
+
export declare const StepStatusSchema: z.ZodEnum<{
|
|
12
|
+
pending: "pending";
|
|
13
|
+
scheduled: "scheduled";
|
|
14
|
+
running: "running";
|
|
15
|
+
completed: "completed";
|
|
16
|
+
failed: "failed";
|
|
17
|
+
skipped: "skipped";
|
|
18
|
+
}>;
|
|
19
|
+
export type StepStatus = z.infer<typeof StepStatusSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* A single state change event for a step
|
|
22
|
+
*/
|
|
23
|
+
export declare const StateChangeSchema: z.ZodObject<{
|
|
24
|
+
status: z.ZodEnum<{
|
|
25
|
+
pending: "pending";
|
|
26
|
+
scheduled: "scheduled";
|
|
27
|
+
running: "running";
|
|
28
|
+
completed: "completed";
|
|
29
|
+
failed: "failed";
|
|
30
|
+
skipped: "skipped";
|
|
31
|
+
}>;
|
|
32
|
+
timestamp: z.ZodNumber;
|
|
33
|
+
message: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type StateChange = z.infer<typeof StateChangeSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Error information when a step fails
|
|
38
|
+
*/
|
|
39
|
+
export declare const StepErrorSchema: z.ZodObject<{
|
|
40
|
+
message: z.ZodString;
|
|
41
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
42
|
+
name: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type StepError = z.infer<typeof StepErrorSchema>;
|
|
45
|
+
/**
|
|
46
|
+
* A single log entry from stdout/stderr
|
|
47
|
+
*/
|
|
48
|
+
export declare const LogEntrySchema: z.ZodObject<{
|
|
49
|
+
timestamp: z.ZodNumber;
|
|
50
|
+
stream: z.ZodEnum<{
|
|
51
|
+
stdout: "stdout";
|
|
52
|
+
stderr: "stderr";
|
|
53
|
+
}>;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
attemptNumber: z.ZodNumber;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type LogEntry = z.infer<typeof LogEntrySchema>;
|
|
58
|
+
/**
|
|
59
|
+
* Complete record of a step execution (legacy - used for workflow-level distribution)
|
|
60
|
+
*/
|
|
61
|
+
export declare const StepRecordSchema: z.ZodObject<{
|
|
62
|
+
stepId: z.ZodString;
|
|
63
|
+
runId: z.ZodString;
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
pending: "pending";
|
|
66
|
+
scheduled: "scheduled";
|
|
67
|
+
running: "running";
|
|
68
|
+
completed: "completed";
|
|
69
|
+
failed: "failed";
|
|
70
|
+
skipped: "skipped";
|
|
71
|
+
}>;
|
|
72
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
76
|
+
input: z.ZodOptional<z.ZodString>;
|
|
77
|
+
output: z.ZodOptional<z.ZodString>;
|
|
78
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
message: z.ZodString;
|
|
80
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
81
|
+
name: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
logsFile: z.ZodOptional<z.ZodString>;
|
|
84
|
+
stateChanges: z.ZodArray<z.ZodObject<{
|
|
85
|
+
status: z.ZodEnum<{
|
|
86
|
+
pending: "pending";
|
|
87
|
+
scheduled: "scheduled";
|
|
88
|
+
running: "running";
|
|
89
|
+
completed: "completed";
|
|
90
|
+
failed: "failed";
|
|
91
|
+
skipped: "skipped";
|
|
92
|
+
}>;
|
|
93
|
+
timestamp: z.ZodNumber;
|
|
94
|
+
message: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export type StepRecord = z.infer<typeof StepRecordSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* Complete state of a step (for step-level distribution)
|
|
100
|
+
* Computed by projecting step events in chronological order
|
|
101
|
+
*/
|
|
102
|
+
export declare const StepStateSchema: z.ZodObject<{
|
|
103
|
+
stepId: z.ZodString;
|
|
104
|
+
runId: z.ZodString;
|
|
105
|
+
workflowSlug: z.ZodString;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
pending: "pending";
|
|
108
|
+
scheduled: "scheduled";
|
|
109
|
+
running: "running";
|
|
110
|
+
completed: "completed";
|
|
111
|
+
failed: "failed";
|
|
112
|
+
skipped: "skipped";
|
|
113
|
+
}>;
|
|
114
|
+
availableAt: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
scheduleReason: z.ZodOptional<z.ZodEnum<{
|
|
116
|
+
initial: "initial";
|
|
117
|
+
retry: "retry";
|
|
118
|
+
"dependency-satisfied": "dependency-satisfied";
|
|
119
|
+
}>>;
|
|
120
|
+
attemptNumber: z.ZodNumber;
|
|
121
|
+
claimedBy: z.ZodOptional<z.ZodString>;
|
|
122
|
+
lastHeartbeat: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
scheduledAt: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
128
|
+
output: z.ZodOptional<z.ZodString>;
|
|
129
|
+
exportOutput: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
message: z.ZodString;
|
|
132
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
133
|
+
name: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
terminal: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
nextRetryAt: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
wasReclaimed: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
reclaimedFrom: z.ZodOptional<z.ZodString>;
|
|
139
|
+
reclaimedBy: z.ZodOptional<z.ZodString>;
|
|
140
|
+
stateChanges: z.ZodArray<z.ZodObject<{
|
|
141
|
+
status: z.ZodEnum<{
|
|
142
|
+
pending: "pending";
|
|
143
|
+
scheduled: "scheduled";
|
|
144
|
+
running: "running";
|
|
145
|
+
completed: "completed";
|
|
146
|
+
failed: "failed";
|
|
147
|
+
skipped: "skipped";
|
|
148
|
+
}>;
|
|
149
|
+
timestamp: z.ZodNumber;
|
|
150
|
+
message: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
export type StepState = z.infer<typeof StepStateSchema>;
|
|
154
|
+
/**
|
|
155
|
+
* Metadata about a workflow run
|
|
156
|
+
*/
|
|
157
|
+
export declare const RunMetadataSchema: z.ZodObject<{
|
|
158
|
+
runId: z.ZodString;
|
|
159
|
+
startTime: z.ZodNumber;
|
|
160
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
running: "running";
|
|
163
|
+
completed: "completed";
|
|
164
|
+
failed: "failed";
|
|
165
|
+
partial: "partial";
|
|
166
|
+
}>;
|
|
167
|
+
totalSteps: z.ZodNumber;
|
|
168
|
+
completedSteps: z.ZodNumber;
|
|
169
|
+
failedSteps: z.ZodNumber;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export type RunMetadata = z.infer<typeof RunMetadataSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* Status of a run in the queue
|
|
174
|
+
*/
|
|
175
|
+
export declare const RunStatusSchema: z.ZodEnum<{
|
|
176
|
+
pending: "pending";
|
|
177
|
+
running: "running";
|
|
178
|
+
completed: "completed";
|
|
179
|
+
failed: "failed";
|
|
180
|
+
claimed: "claimed";
|
|
181
|
+
cancelled: "cancelled";
|
|
182
|
+
}>;
|
|
183
|
+
export type RunStatus = z.infer<typeof RunStatusSchema>;
|
|
184
|
+
/**
|
|
185
|
+
* Parameters for submitting a run to the queue
|
|
186
|
+
*/
|
|
187
|
+
export declare const RunSubmissionSchema: z.ZodObject<{
|
|
188
|
+
workflowSlug: z.ZodString;
|
|
189
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
190
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
191
|
+
availableAt: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
194
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
195
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
196
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
export type RunSubmission = z.infer<typeof RunSubmissionSchema>;
|
|
199
|
+
/**
|
|
200
|
+
* Complete state of a run in the system
|
|
201
|
+
*/
|
|
202
|
+
export declare const RunStateSchema: z.ZodObject<{
|
|
203
|
+
runId: z.ZodString;
|
|
204
|
+
workflowSlug: z.ZodString;
|
|
205
|
+
status: z.ZodEnum<{
|
|
206
|
+
pending: "pending";
|
|
207
|
+
running: "running";
|
|
208
|
+
completed: "completed";
|
|
209
|
+
failed: "failed";
|
|
210
|
+
claimed: "claimed";
|
|
211
|
+
cancelled: "cancelled";
|
|
212
|
+
}>;
|
|
213
|
+
availableAt: z.ZodNumber;
|
|
214
|
+
priority: z.ZodNumber;
|
|
215
|
+
workflowAttemptNumber: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
createdAt: z.ZodNumber;
|
|
217
|
+
claimedAt: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
claimedBy: z.ZodOptional<z.ZodString>;
|
|
221
|
+
lastHeartbeat: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
224
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
225
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
input: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
export type RunState = z.infer<typeof RunStateSchema>;
|
|
229
|
+
/**
|
|
230
|
+
* Step definition for workflow registration
|
|
231
|
+
* Contains metadata about a step without its implementation
|
|
232
|
+
* - id: Unique identifier (directory name)
|
|
233
|
+
* - name: Display name (from step.name or directory name fallback)
|
|
234
|
+
* - dependencies: Array of step IDs (not display names)
|
|
235
|
+
*/
|
|
236
|
+
export declare const StepDefinitionSchema: z.ZodObject<{
|
|
237
|
+
id: z.ZodString;
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
240
|
+
exportOutput: z.ZodBoolean;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
export type StepDefinition = z.infer<typeof StepDefinitionSchema>;
|
|
243
|
+
/**
|
|
244
|
+
* Workflow metadata (backend-agnostic)
|
|
245
|
+
* Does not contain filesystem-specific paths
|
|
246
|
+
*/
|
|
247
|
+
export declare const WorkflowMetadataSchema: z.ZodObject<{
|
|
248
|
+
slug: z.ZodString;
|
|
249
|
+
name: z.ZodString;
|
|
250
|
+
location: z.ZodOptional<z.ZodString>;
|
|
251
|
+
inputSchemaJSON: z.ZodOptional<z.ZodAny>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export type WorkflowMetadata = z.infer<typeof WorkflowMetadataSchema>;
|
|
254
|
+
/**
|
|
255
|
+
* Complete workflow registration data
|
|
256
|
+
* Used when registering a workflow with the backend
|
|
257
|
+
*/
|
|
258
|
+
export declare const WorkflowRegistrationSchema: z.ZodObject<{
|
|
259
|
+
slug: z.ZodString;
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
location: z.ZodOptional<z.ZodString>;
|
|
262
|
+
inputSchemaJSON: z.ZodOptional<z.ZodAny>;
|
|
263
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
name: z.ZodString;
|
|
266
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
267
|
+
exportOutput: z.ZodBoolean;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
}, z.core.$strip>;
|
|
270
|
+
export type WorkflowRegistration = z.infer<typeof WorkflowRegistrationSchema>;
|
|
271
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;;;;EAAgF,CAAC;AAC9G,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAI5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,eAAe;;;;iBAI1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;iBAKzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD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EtE;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAMrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Result of attempting to serialize data
|
|
4
|
+
*/
|
|
5
|
+
export type SerializationResult = {
|
|
6
|
+
success: true;
|
|
7
|
+
data: string;
|
|
8
|
+
} | {
|
|
9
|
+
success: false;
|
|
10
|
+
error: string;
|
|
11
|
+
fallback: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Safely serialize data to JSON string
|
|
15
|
+
* Handles non-serializable values like functions, circular references, etc.
|
|
16
|
+
*
|
|
17
|
+
* @param value - Value to serialize
|
|
18
|
+
* @returns Serialization result with the JSON string or error info
|
|
19
|
+
*/
|
|
20
|
+
export declare function safeSerialize(value: unknown): SerializationResult;
|
|
21
|
+
/**
|
|
22
|
+
* Safely deserialize and validate data using a Zod schema
|
|
23
|
+
*
|
|
24
|
+
* @param jsonString - JSON string to parse
|
|
25
|
+
* @param schema - Zod schema to validate against
|
|
26
|
+
* @returns Validated data or throws error
|
|
27
|
+
*/
|
|
28
|
+
export declare function safeDeserialize<T extends z.ZodType>(jsonString: string, schema: T): z.infer<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Try to deserialize data, returning null if parsing/validation fails
|
|
31
|
+
*
|
|
32
|
+
* @param jsonString - JSON string to parse
|
|
33
|
+
* @param schema - Zod schema to validate against
|
|
34
|
+
* @returns Validated data or null if parsing/validation fails
|
|
35
|
+
*/
|
|
36
|
+
export declare function tryDeserialize<T extends z.ZodType>(jsonString: string, schema: T): z.infer<T> | null;
|
|
37
|
+
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CA6DjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACjD,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,GACR,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAGZ;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAChD,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,GACR,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAMnB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time utilities for high-resolution timestamp generation across the workflow orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* All timestamps in the system are stored as microseconds since epoch for consistency
|
|
5
|
+
* and to enable sub-millisecond precision in duration measurements.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Conversion constant for microseconds to milliseconds
|
|
9
|
+
*/
|
|
10
|
+
export declare const MICROSECONDS_PER_MILLISECOND = 1000;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a high-resolution timestamp in microseconds since epoch.
|
|
13
|
+
*
|
|
14
|
+
* Combines Date.now() (millisecond precision) with performance.now() (sub-millisecond precision)
|
|
15
|
+
* to provide microsecond-level timestamps. This enables accurate duration measurements
|
|
16
|
+
* that can show fractional seconds (e.g., "1.23s" instead of "1.00s").
|
|
17
|
+
*
|
|
18
|
+
* @returns Timestamp in microseconds since epoch
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const startTime = getMicrosecondTimestamp();
|
|
22
|
+
* // ... do work ...
|
|
23
|
+
* const endTime = getMicrosecondTimestamp();
|
|
24
|
+
* const durationUs = endTime - startTime;
|
|
25
|
+
* const durationMs = durationUs / MICROSECONDS_PER_MILLISECOND;
|
|
26
|
+
*/
|
|
27
|
+
export declare function getMicrosecondTimestamp(): number;
|
|
28
|
+
//# sourceMappingURL=time-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-utils.d.ts","sourceRoot":"","sources":["../src/time-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAIhD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cascade-flow/backend-interface",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rm -rf dist && bun build src/index.ts --outdir dist --target node --sourcemap=external --external=@cascade-flow/* && tsc -p tsconfig.build.json",
|
|
17
|
+
"prepublishOnly": "bun run build",
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"test:unit": "bun test tests/unit",
|
|
20
|
+
"test:coverage": "bun test --coverage"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"zod": "^4.1.12"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/bun": "latest",
|
|
27
|
+
"typescript": "^5"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"typescript": "^5"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/cascadeflow/cascadeflow.git",
|
|
41
|
+
"directory": "packages/backend-interface"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"description": "Abstract persistence layer and event sourcing schemas for CascadeFlow workflow orchestrator",
|
|
45
|
+
"keywords": [
|
|
46
|
+
"workflow",
|
|
47
|
+
"orchestrator",
|
|
48
|
+
"event-sourcing",
|
|
49
|
+
"backend",
|
|
50
|
+
"persistence"
|
|
51
|
+
]
|
|
52
|
+
}
|