@fluidgrids/workflows 2026.1027.0 → 2026.1028.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 +170 -18
- package/dist/activation-BBh1p82z.d.cts +57 -0
- package/dist/activation-DnhG7SmF.d.ts +57 -0
- package/dist/assemble-BLqQ8lSu.d.cts +39 -0
- package/dist/assemble-DWgaXHd-.d.ts +39 -0
- package/dist/chunk-2DP2Y6EU.cjs +832 -0
- package/dist/chunk-2J6TF7YI.cjs +86 -0
- package/dist/chunk-3FOTFQ3J.js +1622 -0
- package/dist/chunk-4LYSEANA.js +199 -0
- package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
- package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
- package/dist/chunk-623FVQSN.cjs +251 -0
- package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
- package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
- package/dist/chunk-7NQ37GZU.js +73 -0
- package/dist/chunk-ABFZWYHT.js +612 -0
- package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
- package/dist/chunk-BO6OVILK.js +79 -0
- package/dist/chunk-C5OLWZ42.js +245 -0
- package/dist/chunk-CBL5JSCC.cjs +75 -0
- package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
- package/dist/chunk-CSNWNFKU.cjs +1635 -0
- package/dist/chunk-DJYMDLV5.js +227 -0
- package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
- package/dist/chunk-FMSW2HDF.cjs +267 -0
- package/dist/chunk-FQIHX7YI.cjs +80 -0
- package/dist/chunk-FR7KYWRO.cjs +41 -0
- package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
- package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
- package/dist/chunk-H7KEVW2M.js +816 -0
- package/dist/chunk-HR3BN4C4.cjs +27 -0
- package/dist/chunk-IISBRUWJ.js +13 -0
- package/dist/chunk-JD2VQIDZ.cjs +15 -0
- package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
- package/dist/chunk-L24YIZY7.cjs +207 -0
- package/dist/chunk-LNUQE6D6.js +39 -0
- package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
- package/dist/chunk-P6TA5EZT.cjs +634 -0
- package/dist/chunk-PDHLTDZB.js +72 -0
- package/dist/chunk-PMCM2OH4.js +46 -0
- package/dist/chunk-PZCVF76Q.cjs +868 -0
- package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
- package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
- package/dist/chunk-SAENRNBJ.cjs +52 -0
- package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
- package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
- package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
- package/dist/chunk-VOKMAAJP.js +848 -0
- package/dist/chunk-XB53G2DK.js +25 -0
- package/dist/chunk-Z2Y65YOY.cjs +7 -0
- package/dist/codegen/index.cjs +9 -7
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/codegen/index.js +6 -5
- package/dist/file-BOoHZgoQ.d.cts +1557 -0
- package/dist/file-yuPCFU5b.d.ts +1557 -0
- package/dist/history/index.cjs +287 -0
- package/dist/history/index.d.cts +157 -0
- package/dist/history/index.d.ts +157 -0
- package/dist/history/index.js +5 -0
- package/dist/index.cjs +134 -36
- package/dist/index.d.cts +137 -9
- package/dist/index.d.ts +137 -9
- package/dist/index.js +8 -3
- package/dist/ir/index.cjs +161 -165
- package/dist/ir/index.d.cts +32 -12
- package/dist/ir/index.d.ts +32 -12
- package/dist/ir/index.js +54 -61
- package/dist/lower-BuSvAFqi.d.cts +129 -0
- package/dist/lower-C_Qv_34S.d.ts +129 -0
- package/dist/lower-types-nofRXw9c.d.cts +15 -0
- package/dist/lower-types-nofRXw9c.d.ts +15 -0
- package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
- package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
- package/dist/node-evaluator-CJNP4GHX.js +12 -0
- package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
- package/dist/quickjs/index.cjs +256 -78
- package/dist/quickjs/index.d.cts +48 -7
- package/dist/quickjs/index.d.ts +48 -7
- package/dist/quickjs/index.js +254 -79
- package/dist/roundtrip/index.cjs +404 -129
- package/dist/roundtrip/index.d.cts +43 -8
- package/dist/roundtrip/index.d.ts +43 -8
- package/dist/roundtrip/index.js +260 -19
- package/dist/runtime/index.cjs +90 -0
- package/dist/runtime/index.d.cts +297 -0
- package/dist/runtime/index.d.ts +297 -0
- package/dist/runtime/index.js +8 -0
- package/dist/testing/index.cjs +1057 -0
- package/dist/testing/index.d.cts +305 -0
- package/dist/testing/index.d.ts +305 -0
- package/dist/testing/index.js +1037 -0
- package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
- package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
- package/dist/types-CpBBjaGX.d.cts +380 -0
- package/dist/types-DV-HX_Gt.d.ts +380 -0
- package/dist/{assemble-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
- package/dist/workflow-C2a05WUJ.d.ts +444 -0
- package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
- package/dist/workflow-J-yYixny.d.cts +444 -0
- package/fixtures/README.md +128 -0
- package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
- package/fixtures/histories/activity-retry-then-success.history.json +147 -0
- package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
- package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
- package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
- package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
- package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
- package/fixtures/histories/cancel-during-timer.history.json +123 -0
- package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
- package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
- package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
- package/fixtures/histories/child-cancel-default.history.json +234 -0
- package/fixtures/histories/child-cancel-request.history.json +206 -0
- package/fixtures/histories/child-durable-child-side.history.json +124 -0
- package/fixtures/histories/child-durable-result.history.json +163 -0
- package/fixtures/histories/child-failure-caught.history.json +166 -0
- package/fixtures/histories/child-graph-by-key.history.json +138 -0
- package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
- package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
- package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
- package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
- package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
- package/fixtures/histories/details-and-context.history.json +176 -0
- package/fixtures/histories/deterministic-values.history.json +128 -0
- package/fixtures/histories/engine-builtins.history.json +172 -0
- package/fixtures/histories/gather-activities.history.json +291 -0
- package/fixtures/histories/gather-all-settled.history.json +219 -0
- package/fixtures/histories/gather-mixed.history.json +281 -0
- package/fixtures/histories/input-during-running-task.history.json +111 -0
- package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
- package/fixtures/histories/patched-deprecated.history.json +271 -0
- package/fixtures/histories/patched-new-run.history.json +270 -0
- package/fixtures/histories/patched-old-history.history.json +190 -0
- package/fixtures/histories/race-activity-wins.history.json +152 -0
- package/fixtures/histories/race-signal-beats-child.history.json +161 -0
- package/fixtures/histories/race-timeout-wins.history.json +118 -0
- package/fixtures/histories/side-effect-recorded.history.json +153 -0
- package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
- package/fixtures/histories/signal-default-handler.history.json +187 -0
- package/fixtures/histories/signal-handler.history.json +191 -0
- package/fixtures/histories/signal-parent-child-side.history.json +132 -0
- package/fixtures/histories/signal-parent.history.json +202 -0
- package/fixtures/histories/signal-run-delivered.history.json +128 -0
- package/fixtures/histories/signal-run-undelivered.history.json +134 -0
- package/fixtures/histories/signal-wait.history.json +111 -0
- package/fixtures/histories/task-failure-code-error.history.json +137 -0
- package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
- package/fixtures/histories/timer-condition-met.history.json +201 -0
- package/fixtures/histories/timer-condition-timeout.history.json +118 -0
- package/fixtures/histories/timer-sleep-once.history.json +118 -0
- package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
- package/fixtures/histories/update-accepted-completed.history.json +149 -0
- package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
- package/package.json +85 -20
- package/schema/history-file.schema.json +2544 -0
- package/schema/ir-v2.schema.json +16 -0
- package/schema/run-event.schema.json +2374 -0
- package/schema/workflow-command.schema.json +1095 -0
- package/schema/workflow-task.schema.json +3560 -0
- package/dist/chunk-265J2FCH.cjs +0 -33
- package/dist/chunk-LUXCXFOE.cjs +0 -269
- package/dist/chunk-S34NJE3A.js +0 -262
- package/dist/chunk-SRQRLWOS.js +0 -31
- package/dist/lower-DcOY8ux0.d.cts +0 -49
- package/dist/lower-Dw5grNrI.d.ts +0 -49
- package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
- package/dist/node-evaluator-RMYEWCXZ.js +0 -8
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { J as JsonObject, E as ErrorType, a as Json } from './types-BGoPzgcl.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The durable-function history contract (PLAN-B C-HIST, C-CMD, C-ABI):
|
|
5
|
+
* event types, command types, workflow-task failure causes, failures and the
|
|
6
|
+
* records the service stores in `workflow_run_events`.
|
|
7
|
+
*
|
|
8
|
+
* This module is pure data and types. It has no imports with side effects, so
|
|
9
|
+
* the runtime that runs inside the isolate can bundle it, and the service, the
|
|
10
|
+
* workers and the Python SDK read the same lists through the JSON Schemas in
|
|
11
|
+
* `schema/` (generated from `schema.ts`).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Version of the runtime ABI and of the history file format. */
|
|
15
|
+
declare const HISTORY_PROTOCOL = 1;
|
|
16
|
+
/** Every value of the `type` column of `workflow_run_events`, UPPER_SNAKE (DB4). */
|
|
17
|
+
declare const EVENT_TYPES: readonly ["WORKFLOW_STARTED", "WORKFLOW_TASK_SCHEDULED", "WORKFLOW_TASK_STARTED", "WORKFLOW_TASK_COMPLETED", "WORKFLOW_TASK_FAILED", "WORKFLOW_TASK_TIMED_OUT", "ACTIVITY_SCHEDULED", "ACTIVITY_STARTED", "ACTIVITY_HEARTBEAT", "ACTIVITY_COMPLETED", "ACTIVITY_FAILED", "ACTIVITY_TIMED_OUT", "ACTIVITY_CANCEL_REQUESTED", "ACTIVITY_CANCELLED", "ACTIVITY_PAUSED", "ACTIVITY_UNPAUSED", "ACTIVITY_RESET", "ACTIVITY_OPTIONS_UPDATED", "TIMER_STARTED", "TIMER_FIRED", "TIMER_CANCELLED", "SIGNAL_RECEIVED", "UPDATE_ADMITTED", "UPDATE_ACCEPTED", "UPDATE_COMPLETED", "CHILD_RUN_INITIATED", "CHILD_RUN_STARTED", "CHILD_RUN_COMPLETED", "CHILD_RUN_FAILED", "CHILD_RUN_CANCELLED", "CHILD_RUN_TERMINATED", "CHILD_RUN_TIMED_OUT", "EXTERNAL_RUN_CANCEL_REQUESTED", "EXTERNAL_RUN_CANCEL_RESOLVED", "EXTERNAL_RUN_SIGNALED", "SIDE_EFFECT_RECORDED", "LOCAL_ACTIVITY_COMPLETED", "LOCAL_ACTIVITY_FAILED", "SEARCH_ATTRIBUTES_UPSERTED", "CONTEXT_UPSERTED", "MARKER_RECORDED", "WORKFLOW_CANCEL_REQUESTED", "WORKFLOW_RESET", "VERSIONING_OVERRIDE_SET", "WORKFLOW_COMPLETED", "WORKFLOW_FAILED", "WORKFLOW_CANCELLED", "WORKFLOW_TERMINATED", "WORKFLOW_TIMED_OUT", "WORKFLOW_CONTINUED_AS_NEW"];
|
|
18
|
+
type RunEventType = (typeof EVENT_TYPES)[number];
|
|
19
|
+
/** Every command a workflow task may return (C-CMD), UPPER_SNAKE. */
|
|
20
|
+
declare const COMMAND_TYPES: readonly ["SCHEDULE_ACTIVITY", "REQUEST_CANCEL_ACTIVITY", "START_TIMER", "CANCEL_TIMER", "START_CHILD_RUN", "SIGNAL_RUN", "RECORD_SIDE_EFFECT", "RECORD_MARKER", "COMPLETE_WORKFLOW", "FAIL_WORKFLOW", "CANCEL_WORKFLOW", "UPSERT_CONTEXT", "RECORD_LOCAL_ACTIVITY", "CONTINUE_AS_NEW", "REQUEST_CANCEL_EXTERNAL_RUN", "UPSERT_SEARCH_ATTRIBUTES", "ACCEPT_UPDATE", "REJECT_UPDATE", "COMPLETE_UPDATE"];
|
|
21
|
+
type CommandType = (typeof COMMAND_TYPES)[number];
|
|
22
|
+
/** Commands of the Phase B core release. */
|
|
23
|
+
declare const PHASE_B_CORE_COMMANDS: ReadonlySet<CommandType>;
|
|
24
|
+
/** Commands of the Phase B parity releases (defined now, enabled by the service per release). */
|
|
25
|
+
declare const PHASE_B_PARITY_COMMANDS: ReadonlySet<CommandType>;
|
|
26
|
+
/** Commands that are defined but refused in Phase B (`UNSUPPORTED_COMMAND`). */
|
|
27
|
+
declare const PHASE_C_COMMANDS: ReadonlySet<CommandType>;
|
|
28
|
+
/** Commands that end the run; one may appear, and only last in a batch. */
|
|
29
|
+
declare const TERMINAL_COMMANDS: ReadonlySet<CommandType>;
|
|
30
|
+
/** Why a workflow task failed (`WorkflowTaskFailureCause`). A task failure never fails the run. */
|
|
31
|
+
declare const TASK_FAILURE_CAUSES: readonly ["NON_DETERMINISM", "TASK_TIMEOUT", "ISOLATE_MEMORY", "PROTOCOL_MISMATCH", "BUNDLE_UNAVAILABLE", "BUNDLE_INTEGRITY", "WORKFLOW_CODE_ERROR", "HISTORY_LIMIT", "UNSUPPORTED_COMMAND", "INVALID_REQUEST", "INTERNAL"];
|
|
32
|
+
type WorkflowTaskFailureCause = (typeof TASK_FAILURE_CAUSES)[number];
|
|
33
|
+
/** The shared `ErrorType` enum, as a list. */
|
|
34
|
+
declare const ERROR_TYPES: readonly ErrorType[];
|
|
35
|
+
/** `ExecutionKind`. */
|
|
36
|
+
declare const EXECUTION_KINDS: readonly ["GRAPH", "DURABLE_FN"];
|
|
37
|
+
type ExecutionKind = (typeof EXECUTION_KINDS)[number];
|
|
38
|
+
/** `ParentClosePolicy`. */
|
|
39
|
+
declare const PARENT_CLOSE_POLICIES: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
|
|
40
|
+
type ParentClosePolicy = (typeof PARENT_CLOSE_POLICIES)[number];
|
|
41
|
+
/** Activity cancellation types (11 §2.5). */
|
|
42
|
+
declare const ACTIVITY_CANCELLATION_TYPES: readonly ["WAIT_CANCELLATION_COMPLETED", "TRY_CANCEL", "ABANDON"];
|
|
43
|
+
type ActivityCancellationType = (typeof ACTIVITY_CANCELLATION_TYPES)[number];
|
|
44
|
+
/** Child cancellation types (11 §2.5). */
|
|
45
|
+
declare const CHILD_CANCELLATION_TYPES: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
|
|
46
|
+
type ChildCancellationType = (typeof CHILD_CANCELLATION_TYPES)[number];
|
|
47
|
+
/** Where a failure came from (11 §2.25). */
|
|
48
|
+
type FailureSource = 'sdk-ts' | 'sdk-py' | 'engine' | `node:${string}`;
|
|
49
|
+
/**
|
|
50
|
+
* A failure as it is stored in history and passed between the SDK, the
|
|
51
|
+
* service and the workers (11 §2.25). `type` is the free-form application
|
|
52
|
+
* type; `errorType` is always one value of the shared enum.
|
|
53
|
+
*/
|
|
54
|
+
interface Failure {
|
|
55
|
+
errorType: ErrorType;
|
|
56
|
+
message: string;
|
|
57
|
+
type?: string;
|
|
58
|
+
details?: Json;
|
|
59
|
+
nonRetryable?: boolean;
|
|
60
|
+
/** Overrides the retry policy's delay for the next attempt only. */
|
|
61
|
+
nextRetryDelayMs?: number;
|
|
62
|
+
category?: 'BENIGN';
|
|
63
|
+
/** For timeouts: `START_TO_CLOSE`, `SCHEDULE_TO_START`, `SCHEDULE_TO_CLOSE`, `HEARTBEAT`, `WORKFLOW_RUN`, `WORKFLOW_EXECUTION`. */
|
|
64
|
+
timeoutType?: string;
|
|
65
|
+
cause?: Failure;
|
|
66
|
+
stackTrace?: string;
|
|
67
|
+
source?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The retry policy an activity carries (`retryConfig` plus Temporal's
|
|
71
|
+
* deny-list). `maxRetries` absent means unlimited attempts, bounded by
|
|
72
|
+
* `scheduleToCloseTimeout`.
|
|
73
|
+
*/
|
|
74
|
+
interface RetryPolicy {
|
|
75
|
+
maxRetries?: number;
|
|
76
|
+
/** Delay before the first retry, in milliseconds. */
|
|
77
|
+
retryDelay: number;
|
|
78
|
+
backoffMultiplier?: number;
|
|
79
|
+
/** Largest delay, in milliseconds. */
|
|
80
|
+
maxDelay?: number;
|
|
81
|
+
/** Allow-list on `errorType`. */
|
|
82
|
+
retryOnErrorTypes?: ErrorType[];
|
|
83
|
+
/** Deny-list on the free-form `Failure.type`; wins over the allow-list. */
|
|
84
|
+
nonRetryableErrorTypes?: string[];
|
|
85
|
+
}
|
|
86
|
+
/** One stored history event, as the service returns it (offloaded payloads already inlined). */
|
|
87
|
+
interface RunEventRecord {
|
|
88
|
+
/** 1-based, gapless. */
|
|
89
|
+
seq: number;
|
|
90
|
+
type: RunEventType;
|
|
91
|
+
/** The workflow task that produced the event, for command events and task events. */
|
|
92
|
+
taskId?: string | null;
|
|
93
|
+
payload: JsonObject;
|
|
94
|
+
/** ISO 8601 timestamp. */
|
|
95
|
+
createdAt: string;
|
|
96
|
+
dedupeKey?: string | null;
|
|
97
|
+
}
|
|
98
|
+
/** An event the service is to append (no `seq` or timestamp yet). */
|
|
99
|
+
interface RunEventDraft {
|
|
100
|
+
type: RunEventType;
|
|
101
|
+
taskId?: string;
|
|
102
|
+
payload: JsonObject;
|
|
103
|
+
}
|
|
104
|
+
/** Headers carried on commands and events (interceptors, Phase C). */
|
|
105
|
+
type Headers = Record<string, string>;
|
|
106
|
+
interface CommandBase {
|
|
107
|
+
headers?: Headers;
|
|
108
|
+
}
|
|
109
|
+
/** Signal and cancel targets. `workflowKey`/`workflowId` addressing is parity (11 §2.1). */
|
|
110
|
+
type RunTarget = {
|
|
111
|
+
runId: string;
|
|
112
|
+
} | {
|
|
113
|
+
parent: true;
|
|
114
|
+
} | {
|
|
115
|
+
childId: string;
|
|
116
|
+
} | {
|
|
117
|
+
workflowKey: string;
|
|
118
|
+
workflowId: string;
|
|
119
|
+
};
|
|
120
|
+
interface ScheduleActivityCommand extends CommandBase {
|
|
121
|
+
type: 'SCHEDULE_ACTIVITY';
|
|
122
|
+
activityId: string;
|
|
123
|
+
kind: 'node';
|
|
124
|
+
nodeType: string;
|
|
125
|
+
nodeVersion?: string;
|
|
126
|
+
operation: string;
|
|
127
|
+
args: Json;
|
|
128
|
+
connection?: string;
|
|
129
|
+
retry: RetryPolicy;
|
|
130
|
+
startToCloseTimeout?: number;
|
|
131
|
+
scheduleToCloseTimeout?: number;
|
|
132
|
+
scheduleToStartTimeout?: number;
|
|
133
|
+
heartbeatTimeout?: number;
|
|
134
|
+
cancellationType?: ActivityCancellationType;
|
|
135
|
+
priority?: number;
|
|
136
|
+
summary?: string;
|
|
137
|
+
runOn?: string;
|
|
138
|
+
}
|
|
139
|
+
interface RequestCancelActivityCommand extends CommandBase {
|
|
140
|
+
type: 'REQUEST_CANCEL_ACTIVITY';
|
|
141
|
+
activityId: string;
|
|
142
|
+
}
|
|
143
|
+
interface StartTimerCommand extends CommandBase {
|
|
144
|
+
type: 'START_TIMER';
|
|
145
|
+
timerId: string;
|
|
146
|
+
durationMs: number;
|
|
147
|
+
summary?: string;
|
|
148
|
+
}
|
|
149
|
+
interface CancelTimerCommand extends CommandBase {
|
|
150
|
+
type: 'CANCEL_TIMER';
|
|
151
|
+
timerId: string;
|
|
152
|
+
}
|
|
153
|
+
/** Child start options (11 §2.35); everything but `parentClosePolicy` is optional. */
|
|
154
|
+
interface ChildRunOptions {
|
|
155
|
+
parentClosePolicy: ParentClosePolicy;
|
|
156
|
+
cancellationType?: ChildCancellationType;
|
|
157
|
+
taskQueue?: string;
|
|
158
|
+
workflowId?: string;
|
|
159
|
+
priority?: number;
|
|
160
|
+
summary?: string;
|
|
161
|
+
details?: string;
|
|
162
|
+
context?: JsonObject;
|
|
163
|
+
executionTimeout?: number;
|
|
164
|
+
runTimeout?: number;
|
|
165
|
+
workflowTaskTimeout?: number;
|
|
166
|
+
startDelay?: number;
|
|
167
|
+
[key: string]: Json | undefined;
|
|
168
|
+
}
|
|
169
|
+
interface StartChildRunCommand extends CommandBase {
|
|
170
|
+
type: 'START_CHILD_RUN';
|
|
171
|
+
childId: string;
|
|
172
|
+
/** Another workflow (graph or durable) by key. */
|
|
173
|
+
workflowKey?: string;
|
|
174
|
+
/** A function of the same bundle, by export name. */
|
|
175
|
+
workflowFn?: string;
|
|
176
|
+
/** `active`, `vN` or `@alias`; default `active`. */
|
|
177
|
+
version?: string;
|
|
178
|
+
input: Json;
|
|
179
|
+
options: ChildRunOptions;
|
|
180
|
+
}
|
|
181
|
+
interface SignalRunCommand extends CommandBase {
|
|
182
|
+
type: 'SIGNAL_RUN';
|
|
183
|
+
externalId: string;
|
|
184
|
+
target: RunTarget;
|
|
185
|
+
name: string;
|
|
186
|
+
payload: Json;
|
|
187
|
+
}
|
|
188
|
+
interface RecordSideEffectCommand extends CommandBase {
|
|
189
|
+
type: 'RECORD_SIDE_EFFECT';
|
|
190
|
+
sideEffectId: string;
|
|
191
|
+
value: Json;
|
|
192
|
+
}
|
|
193
|
+
interface RecordMarkerCommand extends CommandBase {
|
|
194
|
+
type: 'RECORD_MARKER';
|
|
195
|
+
markerId: string;
|
|
196
|
+
data: Json;
|
|
197
|
+
}
|
|
198
|
+
interface CompleteWorkflowCommand extends CommandBase {
|
|
199
|
+
type: 'COMPLETE_WORKFLOW';
|
|
200
|
+
output: Json;
|
|
201
|
+
}
|
|
202
|
+
interface FailWorkflowCommand extends CommandBase {
|
|
203
|
+
type: 'FAIL_WORKFLOW';
|
|
204
|
+
failure: Failure;
|
|
205
|
+
}
|
|
206
|
+
interface CancelWorkflowCommand extends CommandBase {
|
|
207
|
+
type: 'CANCEL_WORKFLOW';
|
|
208
|
+
}
|
|
209
|
+
interface UpsertContextCommand extends CommandBase {
|
|
210
|
+
type: 'UPSERT_CONTEXT';
|
|
211
|
+
entries: JsonObject;
|
|
212
|
+
}
|
|
213
|
+
interface RecordLocalActivityCommand extends CommandBase {
|
|
214
|
+
type: 'RECORD_LOCAL_ACTIVITY';
|
|
215
|
+
localActivityId: string;
|
|
216
|
+
result?: Json;
|
|
217
|
+
failure?: Failure;
|
|
218
|
+
attempts: number;
|
|
219
|
+
}
|
|
220
|
+
interface ContinueAsNewCommand extends CommandBase {
|
|
221
|
+
type: 'CONTINUE_AS_NEW';
|
|
222
|
+
input: Json;
|
|
223
|
+
options: JsonObject;
|
|
224
|
+
}
|
|
225
|
+
interface RequestCancelExternalRunCommand extends CommandBase {
|
|
226
|
+
type: 'REQUEST_CANCEL_EXTERNAL_RUN';
|
|
227
|
+
externalId: string;
|
|
228
|
+
target: RunTarget;
|
|
229
|
+
}
|
|
230
|
+
interface UpsertSearchAttributesCommand extends CommandBase {
|
|
231
|
+
type: 'UPSERT_SEARCH_ATTRIBUTES';
|
|
232
|
+
attributes: JsonObject;
|
|
233
|
+
}
|
|
234
|
+
interface AcceptUpdateCommand extends CommandBase {
|
|
235
|
+
type: 'ACCEPT_UPDATE';
|
|
236
|
+
updateId: string;
|
|
237
|
+
}
|
|
238
|
+
interface RejectUpdateCommand extends CommandBase {
|
|
239
|
+
type: 'REJECT_UPDATE';
|
|
240
|
+
updateId: string;
|
|
241
|
+
failure: Failure;
|
|
242
|
+
}
|
|
243
|
+
interface CompleteUpdateCommand extends CommandBase {
|
|
244
|
+
type: 'COMPLETE_UPDATE';
|
|
245
|
+
updateId: string;
|
|
246
|
+
result?: Json;
|
|
247
|
+
failure?: Failure;
|
|
248
|
+
}
|
|
249
|
+
/** One command, a flat object discriminated by `type` (DB4). */
|
|
250
|
+
type WorkflowCommand = ScheduleActivityCommand | RequestCancelActivityCommand | StartTimerCommand | CancelTimerCommand | StartChildRunCommand | SignalRunCommand | RecordSideEffectCommand | RecordMarkerCommand | CompleteWorkflowCommand | FailWorkflowCommand | CancelWorkflowCommand | UpsertContextCommand | RecordLocalActivityCommand | ContinueAsNewCommand | RequestCancelExternalRunCommand | UpsertSearchAttributesCommand | AcceptUpdateCommand | RejectUpdateCommand | CompleteUpdateCommand;
|
|
251
|
+
/** History caps (C-HIST). */
|
|
252
|
+
interface HistoryLimit {
|
|
253
|
+
events: number;
|
|
254
|
+
bytes: number;
|
|
255
|
+
}
|
|
256
|
+
declare const DEFAULT_HISTORY_LIMIT: HistoryLimit;
|
|
257
|
+
/** Fraction of the cap at which `continueAsNewSuggested` turns true. */
|
|
258
|
+
declare const CONTINUE_AS_NEW_SUGGESTED_RATIO = 0.8;
|
|
259
|
+
/** Fraction of the cap at which the next command throws `HistoryLimitExceeded`. */
|
|
260
|
+
declare const HISTORY_LIMIT_EXCEEDED_RATIO = 0.95;
|
|
261
|
+
/** What a task knows about its run (C-ABI `WorkflowInfoSnapshot`). */
|
|
262
|
+
interface WorkflowInfoSnapshot {
|
|
263
|
+
runId: string;
|
|
264
|
+
workspaceId: string;
|
|
265
|
+
workflowKey?: string;
|
|
266
|
+
version?: number | string;
|
|
267
|
+
buildId?: string;
|
|
268
|
+
businessId?: string;
|
|
269
|
+
attempt?: number;
|
|
270
|
+
taskQueue?: string;
|
|
271
|
+
parentRunId?: string | null;
|
|
272
|
+
rootRunId?: string | null;
|
|
273
|
+
firstRunId?: string | null;
|
|
274
|
+
continuedFromRunId?: string | null;
|
|
275
|
+
lastResult?: Json;
|
|
276
|
+
lastFailure?: Failure | null;
|
|
277
|
+
startedAt?: string;
|
|
278
|
+
runStartedAt?: string;
|
|
279
|
+
historyLimit?: HistoryLimit;
|
|
280
|
+
timeouts?: {
|
|
281
|
+
executionTimeout?: number;
|
|
282
|
+
runTimeout?: number;
|
|
283
|
+
workflowTaskTimeout?: number;
|
|
284
|
+
};
|
|
285
|
+
headers?: Headers;
|
|
286
|
+
priority?: number;
|
|
287
|
+
summary?: string;
|
|
288
|
+
details?: string;
|
|
289
|
+
context?: JsonObject;
|
|
290
|
+
}
|
|
291
|
+
/** A built-in query (11 §2.21). Custom queries are Phase C. */
|
|
292
|
+
type BuiltInQueryName = '__stack_trace' | '__enhanced_stack_trace' | '__metadata';
|
|
293
|
+
declare const BUILT_IN_QUERIES: readonly BuiltInQueryName[];
|
|
294
|
+
/** The input of one workflow task (C-ABI). */
|
|
295
|
+
interface WorkflowTaskRequest {
|
|
296
|
+
protocol: number;
|
|
297
|
+
kind: 'task' | 'query' | 'verify';
|
|
298
|
+
workflowFn: string;
|
|
299
|
+
info: WorkflowInfoSnapshot;
|
|
300
|
+
history: RunEventRecord[];
|
|
301
|
+
/** The task's start time; the clock for new side effects only. */
|
|
302
|
+
nowMs: number;
|
|
303
|
+
localActivityResults?: Array<{
|
|
304
|
+
localActivityId: string;
|
|
305
|
+
result?: Json;
|
|
306
|
+
failure?: Failure;
|
|
307
|
+
attempts: number;
|
|
308
|
+
}>;
|
|
309
|
+
queries?: Array<{
|
|
310
|
+
queryId: string;
|
|
311
|
+
name: BuiltInQueryName;
|
|
312
|
+
args?: Json;
|
|
313
|
+
}>;
|
|
314
|
+
}
|
|
315
|
+
/** A local activity the task wants run before it can continue (parity). */
|
|
316
|
+
interface LocalActivityRequest {
|
|
317
|
+
localActivityId: string;
|
|
318
|
+
nodeType: string;
|
|
319
|
+
operation: string;
|
|
320
|
+
args: Json;
|
|
321
|
+
connection?: string;
|
|
322
|
+
retry?: RetryPolicy;
|
|
323
|
+
startToCloseTimeout?: number;
|
|
324
|
+
}
|
|
325
|
+
interface TaskLogLine {
|
|
326
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
327
|
+
message: string;
|
|
328
|
+
data?: Json;
|
|
329
|
+
}
|
|
330
|
+
/** The output of one workflow task (C-ABI). */
|
|
331
|
+
interface WorkflowTaskResult {
|
|
332
|
+
protocol: number;
|
|
333
|
+
outcome: 'commands' | 'failed' | 'localActivityRequested';
|
|
334
|
+
commands: WorkflowCommand[];
|
|
335
|
+
localActivityRequests?: LocalActivityRequest[];
|
|
336
|
+
queryResults?: Array<{
|
|
337
|
+
queryId: string;
|
|
338
|
+
value?: Json;
|
|
339
|
+
error?: string;
|
|
340
|
+
}>;
|
|
341
|
+
failure?: {
|
|
342
|
+
cause: WorkflowTaskFailureCause;
|
|
343
|
+
message: string;
|
|
344
|
+
stackTrace?: string;
|
|
345
|
+
seq?: number;
|
|
346
|
+
errorType?: string;
|
|
347
|
+
};
|
|
348
|
+
logs: TaskLogLine[];
|
|
349
|
+
stackTrace?: string;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* The event each command appends (C-CMD). `REJECT_UPDATE` appends nothing: a
|
|
353
|
+
* rejected update leaves no history (11 §2.39). `RECORD_LOCAL_ACTIVITY`
|
|
354
|
+
* appends `LOCAL_ACTIVITY_COMPLETED` or `LOCAL_ACTIVITY_FAILED` by outcome.
|
|
355
|
+
*/
|
|
356
|
+
declare const COMMAND_EVENT_TYPES: Readonly<Record<CommandType, RunEventType | null>>;
|
|
357
|
+
/**
|
|
358
|
+
* Events a command appends. During replay each one is matched against the
|
|
359
|
+
* command the code issues at the same position (spec 04 §4).
|
|
360
|
+
* `EXTERNAL_RUN_SIGNALED` is a command event only in its initiated form (no
|
|
361
|
+
* `resolved`); the service's delivery outcome is an input event of the same
|
|
362
|
+
* type with `resolved: true`.
|
|
363
|
+
*/
|
|
364
|
+
declare const COMMAND_EVENTS: ReadonlySet<RunEventType>;
|
|
365
|
+
/** Events that deliver something to the workflow code (resolve an awaitable or run a handler). */
|
|
366
|
+
declare const INPUT_EVENTS: ReadonlySet<RunEventType>;
|
|
367
|
+
/** Events that end the run. */
|
|
368
|
+
declare const TERMINAL_EVENTS: ReadonlySet<RunEventType>;
|
|
369
|
+
/** True when the event delivers something to the code (see {@link INPUT_EVENTS}). */
|
|
370
|
+
declare function isInputEvent(event: {
|
|
371
|
+
type: RunEventType;
|
|
372
|
+
payload: JsonObject;
|
|
373
|
+
}): boolean;
|
|
374
|
+
/** True when the event was appended for a command (see {@link COMMAND_EVENTS}). */
|
|
375
|
+
declare function isCommandEvent(event: {
|
|
376
|
+
type: RunEventType;
|
|
377
|
+
payload: JsonObject;
|
|
378
|
+
}): boolean;
|
|
379
|
+
|
|
380
|
+
export { type StartTimerCommand as $, ACTIVITY_CANCELLATION_TYPES as A, BUILT_IN_QUERIES as B, type ChildCancellationType as C, DEFAULT_HISTORY_LIMIT as D, ERROR_TYPES as E, type Failure as F, PHASE_B_PARITY_COMMANDS as G, HISTORY_LIMIT_EXCEEDED_RATIO as H, INPUT_EVENTS as I, PHASE_C_COMMANDS as J, type RecordLocalActivityCommand as K, type LocalActivityRequest as L, type RecordMarkerCommand as M, type RecordSideEffectCommand as N, type RejectUpdateCommand as O, type ParentClosePolicy as P, type RequestCancelActivityCommand as Q, type RetryPolicy as R, type RequestCancelExternalRunCommand as S, type RunEventDraft as T, type RunEventRecord as U, type RunEventType as V, type WorkflowCommand as W, type RunTarget as X, type ScheduleActivityCommand as Y, type SignalRunCommand as Z, type StartChildRunCommand as _, type WorkflowTaskFailureCause as a, TASK_FAILURE_CAUSES as a0, TERMINAL_COMMANDS as a1, TERMINAL_EVENTS as a2, type TaskLogLine as a3, type UpsertContextCommand as a4, type UpsertSearchAttributesCommand as a5, type WorkflowInfoSnapshot as a6, type WorkflowTaskRequest as a7, type WorkflowTaskResult as a8, isCommandEvent as a9, isInputEvent as aa, type AcceptUpdateCommand as b, type ActivityCancellationType as c, type BuiltInQueryName as d, CHILD_CANCELLATION_TYPES as e, COMMAND_EVENTS as f, COMMAND_EVENT_TYPES as g, COMMAND_TYPES as h, CONTINUE_AS_NEW_SUGGESTED_RATIO as i, type CancelTimerCommand as j, type CancelWorkflowCommand as k, type ChildRunOptions as l, type CommandType as m, type CompleteUpdateCommand as n, type CompleteWorkflowCommand as o, type ContinueAsNewCommand as p, EVENT_TYPES as q, EXECUTION_KINDS as r, type ExecutionKind as s, type FailWorkflowCommand as t, type FailureSource as u, HISTORY_PROTOCOL as v, type Headers as w, type HistoryLimit as x, PARENT_CLOSE_POLICIES as y, PHASE_B_CORE_COMMANDS as z };
|
|
@@ -1,127 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Node operation descriptors: what a builder call needs to know about the node
|
|
5
|
-
* it emits. Generated clients (`.fluidgrids/nodes.ts`) are lists of these;
|
|
6
|
-
* the built-in internal nodes and triggers ship here so `nodes.internal.*` and
|
|
7
|
-
* `triggers.*` work without a registry.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/** A file reference in node inputs and outputs. */
|
|
11
|
-
interface FileRef {
|
|
12
|
-
fileId: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
mimeType?: string;
|
|
15
|
-
size?: number;
|
|
16
|
-
}
|
|
17
|
-
declare const OPERATION_TYPES: unique symbol;
|
|
18
|
-
/** One node operation. `In` and `Out` type the arguments and the output. */
|
|
19
|
-
interface Operation<In = Record<string, Json>, Out = Json> {
|
|
20
|
-
readonly kind: 'operation';
|
|
21
|
-
readonly nodeType: string;
|
|
22
|
-
/** Written as the node's `version` unless the call overrides it. */
|
|
23
|
-
readonly version?: string;
|
|
24
|
-
/** Written as the node's `operation_name` unless the call overrides it. */
|
|
25
|
-
readonly operation?: string;
|
|
26
|
-
readonly role?: 'trigger';
|
|
27
|
-
/** Type-level only; never present at run time. */
|
|
28
|
-
readonly [OPERATION_TYPES]?: {
|
|
29
|
-
input: In;
|
|
30
|
-
output: Out;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/** A trigger operation. */
|
|
34
|
-
type TriggerOperation<In = Record<string, Json>, Out = Json> = Operation<In, Out> & {
|
|
35
|
-
readonly role: 'trigger';
|
|
36
|
-
};
|
|
37
|
-
/** Describe a node operation (generated clients call this). */
|
|
38
|
-
declare function op<In = Record<string, Json>, Out = Json>(nodeType: string, version?: string, operation?: string): Operation<In, Out>;
|
|
39
|
-
/** Describe a trigger operation (generated clients call this). */
|
|
40
|
-
declare function trigger<In = Record<string, Json>, Out = Json>(nodeType: string, version?: string, operation?: string): TriggerOperation<In, Out>;
|
|
41
|
-
/** True for a value made by {@link op} or {@link trigger}. */
|
|
42
|
-
declare function isOperation(value: unknown): value is Operation<unknown, unknown>;
|
|
43
|
-
/** Built-in trigger nodes (`wspace-workflow-svc` `triggers/manifests`). */
|
|
44
|
-
declare const triggers: {
|
|
45
|
-
readonly api: TriggerOperation<Record<string, Json>, Json>;
|
|
46
|
-
readonly manual: TriggerOperation<Record<string, Json>, Json>;
|
|
47
|
-
readonly schedule: TriggerOperation<Record<string, Json>, Json>;
|
|
48
|
-
readonly webhook: TriggerOperation<Record<string, Json>, Json>;
|
|
49
|
-
readonly form: TriggerOperation<Record<string, Json>, Json>;
|
|
50
|
-
readonly errorTrigger: TriggerOperation<Record<string, Json>, Json>;
|
|
51
|
-
readonly workflowCall: TriggerOperation<Record<string, Json>, Json>;
|
|
52
|
-
readonly rssFeed: TriggerOperation<Record<string, Json>, Json>;
|
|
53
|
-
readonly httpPoll: TriggerOperation<Record<string, Json>, Json>;
|
|
54
|
-
readonly databasePoll: TriggerOperation<Record<string, Json>, Json>;
|
|
55
|
-
readonly emailImap: TriggerOperation<Record<string, Json>, Json>;
|
|
56
|
-
readonly fileUpload: TriggerOperation<Record<string, Json>, Json>;
|
|
57
|
-
readonly recordChange: TriggerOperation<Record<string, Json>, Json>;
|
|
58
|
-
readonly stateChange: TriggerOperation<Record<string, Json>, Json>;
|
|
59
|
-
};
|
|
60
|
-
/** Built-in internal nodes (`wspace-workflow-svc` `internalnodes/manifests`, plus the two IR v2 nodes). */
|
|
61
|
-
declare const internalNodes: {
|
|
62
|
-
readonly merge: Operation<Record<string, Json>, Json>;
|
|
63
|
-
readonly if: Operation<Record<string, Json>, Json>;
|
|
64
|
-
readonly switch: Operation<Record<string, Json>, Json>;
|
|
65
|
-
readonly loop: Operation<Record<string, Json>, Json>;
|
|
66
|
-
readonly set: Operation<Record<string, Json>, Json>;
|
|
67
|
-
readonly filter: Operation<Record<string, Json>, Json>;
|
|
68
|
-
readonly aggregate: Operation<Record<string, Json>, Json>;
|
|
69
|
-
readonly wait: Operation<Record<string, Json>, Json>;
|
|
70
|
-
readonly noop: Operation<Record<string, Json>, Json>;
|
|
71
|
-
readonly code: Operation<Record<string, Json>, Json>;
|
|
72
|
-
readonly http: Operation<Record<string, Json>, Json>;
|
|
73
|
-
readonly transform: Operation<Record<string, Json>, Json>;
|
|
74
|
-
readonly validate: Operation<Record<string, Json>, Json>;
|
|
75
|
-
readonly log: Operation<Record<string, Json>, Json>;
|
|
76
|
-
readonly error: Operation<Record<string, Json>, Json>;
|
|
77
|
-
readonly subworkflow: Operation<Record<string, Json>, Json>;
|
|
78
|
-
readonly compareDatasets: Operation<Record<string, Json>, Json>;
|
|
79
|
-
readonly splitOut: Operation<Record<string, Json>, Json>;
|
|
80
|
-
readonly limit: Operation<Record<string, Json>, Json>;
|
|
81
|
-
readonly dedupe: Operation<Record<string, Json>, Json>;
|
|
82
|
-
readonly sort: Operation<Record<string, Json>, Json>;
|
|
83
|
-
readonly dataTable: Operation<Record<string, Json>, Json>;
|
|
84
|
-
readonly respondToWebhook: Operation<Record<string, Json>, Json>;
|
|
85
|
-
readonly sendAndWait: Operation<Record<string, Json>, Json>;
|
|
86
|
-
readonly codeWorkflow: Operation<Record<string, Json>, Json>;
|
|
87
|
-
readonly waitForSignal: Operation<Record<string, Json>, Json>;
|
|
88
|
-
};
|
|
89
|
-
/** Node clients that need no registry: the internal nodes and `custom()`. */
|
|
90
|
-
declare const nodes: {
|
|
91
|
-
readonly internal: {
|
|
92
|
-
readonly merge: Operation<Record<string, Json>, Json>;
|
|
93
|
-
readonly if: Operation<Record<string, Json>, Json>;
|
|
94
|
-
readonly switch: Operation<Record<string, Json>, Json>;
|
|
95
|
-
readonly loop: Operation<Record<string, Json>, Json>;
|
|
96
|
-
readonly set: Operation<Record<string, Json>, Json>;
|
|
97
|
-
readonly filter: Operation<Record<string, Json>, Json>;
|
|
98
|
-
readonly aggregate: Operation<Record<string, Json>, Json>;
|
|
99
|
-
readonly wait: Operation<Record<string, Json>, Json>;
|
|
100
|
-
readonly noop: Operation<Record<string, Json>, Json>;
|
|
101
|
-
readonly code: Operation<Record<string, Json>, Json>;
|
|
102
|
-
readonly http: Operation<Record<string, Json>, Json>;
|
|
103
|
-
readonly transform: Operation<Record<string, Json>, Json>;
|
|
104
|
-
readonly validate: Operation<Record<string, Json>, Json>;
|
|
105
|
-
readonly log: Operation<Record<string, Json>, Json>;
|
|
106
|
-
readonly error: Operation<Record<string, Json>, Json>;
|
|
107
|
-
readonly subworkflow: Operation<Record<string, Json>, Json>;
|
|
108
|
-
readonly compareDatasets: Operation<Record<string, Json>, Json>;
|
|
109
|
-
readonly splitOut: Operation<Record<string, Json>, Json>;
|
|
110
|
-
readonly limit: Operation<Record<string, Json>, Json>;
|
|
111
|
-
readonly dedupe: Operation<Record<string, Json>, Json>;
|
|
112
|
-
readonly sort: Operation<Record<string, Json>, Json>;
|
|
113
|
-
readonly dataTable: Operation<Record<string, Json>, Json>;
|
|
114
|
-
readonly respondToWebhook: Operation<Record<string, Json>, Json>;
|
|
115
|
-
readonly sendAndWait: Operation<Record<string, Json>, Json>;
|
|
116
|
-
readonly codeWorkflow: Operation<Record<string, Json>, Json>;
|
|
117
|
-
readonly waitForSignal: Operation<Record<string, Json>, Json>;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Any node type, including ones the registry snapshot does not know. Typed
|
|
121
|
-
* as JSON in and out.
|
|
122
|
-
*/
|
|
123
|
-
readonly custom: (nodeType: string, operation?: string, version?: string) => Operation<Record<string, Json>, Json>;
|
|
124
|
-
};
|
|
1
|
+
import { a as Json, J as JsonObject, d as ConnectionRef, L as LegacyCredentialRef, R as RetryConfig, g as NodeTimeout, f as NodeErrorConfig, e as ExecutionSettings, m as WorkflowNode, l as WorkflowEdge, k as WorkflowConfig, W as WorkflowInterface, j as WorkflowCode } from './types-BGoPzgcl.js';
|
|
2
|
+
import { h as DurableWorkflow, O as Operation } from './workflow-C2a05WUJ.js';
|
|
125
3
|
|
|
126
4
|
/**
|
|
127
5
|
* Typed references and predicates for the tier-1 builder (spec 02 §3).
|
|
@@ -270,7 +148,11 @@ interface CompareRef extends NodeRef {
|
|
|
270
148
|
}
|
|
271
149
|
/** Options of an explicit edge, made with {@link edge}. */
|
|
272
150
|
interface EdgeOptions {
|
|
273
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Edge id. Default: `e-<source>-<target>[-<sourceHandle>][-<targetHandle>]`, with
|
|
153
|
+
* `-2`, `-3`, … added in declaration order when that id is already taken;
|
|
154
|
+
* `false` writes none.
|
|
155
|
+
*/
|
|
274
156
|
id?: string | false;
|
|
275
157
|
/** Edge type. Default `deletable` (what the canvas writes); `false` writes none. */
|
|
276
158
|
type?: string | false;
|
|
@@ -379,15 +261,26 @@ interface Tier1Recording {
|
|
|
379
261
|
edgeOrder?: Array<string | number>;
|
|
380
262
|
notes: RecordedNote[];
|
|
381
263
|
}
|
|
264
|
+
/** A `wf.codeWorkflow` node whose `workflowFn` is resolved to an export name at collection. */
|
|
265
|
+
interface DurableRef {
|
|
266
|
+
nodeId: string;
|
|
267
|
+
definition: DurableWorkflow<never, unknown>;
|
|
268
|
+
}
|
|
382
269
|
/** The value `defineWorkflow` returns. */
|
|
383
270
|
interface Tier1Workflow {
|
|
384
271
|
readonly __fluidgrids: typeof WORKFLOW_MARKER;
|
|
385
272
|
readonly key: string;
|
|
386
273
|
readonly recording: Tier1Recording;
|
|
274
|
+
/** `wf.codeWorkflow` calls given a function; not part of the recording JSON. */
|
|
275
|
+
readonly durableRefs?: readonly DurableRef[];
|
|
387
276
|
}
|
|
388
277
|
/** True for a value returned by {@link defineWorkflow}. */
|
|
389
278
|
declare function isTier1Workflow(value: unknown): value is Tier1Workflow;
|
|
390
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Default edge id, the scheme the AI draft generator uses. Ids may contain `-`,
|
|
281
|
+
* so two edges can share a default id (`a` to `b-c` and `a-b` to `c`); the
|
|
282
|
+
* builder then gives the later edges `-2`, `-3`, … in declaration order.
|
|
283
|
+
*/
|
|
391
284
|
declare function defaultEdgeId(source: string, target: string, sourceHandle?: string, targetHandle?: string): string;
|
|
392
285
|
/** Options of `wf.if`. */
|
|
393
286
|
interface IfOptions extends NodeOptions {
|
|
@@ -422,6 +315,27 @@ interface WaitForSignalOptions extends NodeOptions {
|
|
|
422
315
|
amount: number;
|
|
423
316
|
unit: string;
|
|
424
317
|
};
|
|
318
|
+
/** `limitWaitUntil`: an absolute deadline (ISO 8601). Give `limit` or `until`, not both. */
|
|
319
|
+
until?: string | Date;
|
|
320
|
+
/** `first` (default) resumes with one signal; `all` collects every buffered one. */
|
|
321
|
+
consume?: 'first' | 'all';
|
|
322
|
+
}
|
|
323
|
+
/** Options of `wf.codeWorkflow`. */
|
|
324
|
+
interface CodeWorkflowOptions extends NodeOptions {
|
|
325
|
+
/** `inputMapping`; default passthrough. */
|
|
326
|
+
input?: ArgValue;
|
|
327
|
+
/** Default `managed` (the only queue in Phase B). */
|
|
328
|
+
taskQueue?: string;
|
|
329
|
+
/** Default true. */
|
|
330
|
+
waitForCompletion?: boolean;
|
|
331
|
+
/** Node-level timeout in seconds; 0 or absent means none. */
|
|
332
|
+
timeoutSeconds?: number;
|
|
333
|
+
failOnError?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Default (DB13, applied by the service when absent): `TERMINATE` when the
|
|
336
|
+
* node waits for completion, `ABANDON` when it does not.
|
|
337
|
+
*/
|
|
338
|
+
parentClosePolicy?: 'TERMINATE' | 'ABANDON' | 'REQUEST_CANCEL';
|
|
425
339
|
}
|
|
426
340
|
/** Options of `wf.subworkflow`. */
|
|
427
341
|
interface SubworkflowOptions extends NodeOptions {
|
|
@@ -447,8 +361,12 @@ declare class WorkflowBuilder {
|
|
|
447
361
|
private readonly edges;
|
|
448
362
|
private readonly notes;
|
|
449
363
|
private readonly ids;
|
|
364
|
+
/** Ids given explicitly; a second edge with the same explicit id is an error. */
|
|
450
365
|
private readonly edgeIds;
|
|
366
|
+
/** Edges whose id is the default, as indices into `edges`, with the unsuffixed default id. */
|
|
367
|
+
private readonly defaultIds;
|
|
451
368
|
private edgeOrder;
|
|
369
|
+
private readonly durableRefs;
|
|
452
370
|
constructor(autoIds: boolean);
|
|
453
371
|
/** A reference to a node by id, for nodes declared later in the source. */
|
|
454
372
|
ref(id: string): NodeRef;
|
|
@@ -476,6 +394,14 @@ declare class WorkflowBuilder {
|
|
|
476
394
|
sendAndWait(options: NodeOptions): ApprovalRef;
|
|
477
395
|
/** `internal:subworkflow`. */
|
|
478
396
|
subworkflow(options: SubworkflowOptions): NodeRef;
|
|
397
|
+
/**
|
|
398
|
+
* `internal:code-workflow`: run a tier-2 function of this project as a
|
|
399
|
+
* durable child run. `fn` is a `workflow()` value (its export name is
|
|
400
|
+
* resolved when the bundle is collected) or an export name.
|
|
401
|
+
*/
|
|
402
|
+
codeWorkflow(fn: DurableWorkflow<never, unknown> | string, options?: CodeWorkflowOptions): NodeRef;
|
|
403
|
+
/** The `wf.codeWorkflow` calls that named a function. */
|
|
404
|
+
durableReferences(): DurableRef[];
|
|
479
405
|
/** `internal:validate`. */
|
|
480
406
|
validate(options: NodeOptions): ValidateRef;
|
|
481
407
|
/** `internal:compare-datasets`. */
|
|
@@ -525,45 +451,17 @@ declare class WorkflowBuilder {
|
|
|
525
451
|
finish(key: string, document: JsonObject): Tier1Recording;
|
|
526
452
|
private claimId;
|
|
527
453
|
private resolveId;
|
|
454
|
+
/**
|
|
455
|
+
* Give every edge declared without an id its default id. Explicit ids are
|
|
456
|
+
* claimed first, so a default never takes an id the code names; a default that
|
|
457
|
+
* is taken gets `-2`, `-3`, … in declaration order. The result depends only on
|
|
458
|
+
* the builder calls.
|
|
459
|
+
*/
|
|
460
|
+
private assignDefaultEdgeIds;
|
|
528
461
|
private addEdge;
|
|
529
462
|
private add;
|
|
530
463
|
}
|
|
531
464
|
/** Define a tier-1 workflow. The callback runs once, immediately. */
|
|
532
465
|
declare function defineWorkflow(options: WorkflowOptions, build: (wf: WorkflowBuilder) => void): Tier1Workflow;
|
|
533
466
|
|
|
534
|
-
|
|
535
|
-
declare const LAYOUT_FORMAT_VERSION = 1;
|
|
536
|
-
/**
|
|
537
|
-
* The layout sidecar (`workflows/<key>.layout.json`): canvas positions, sticky
|
|
538
|
-
* notes and `meta.layout`, kept out of the code so it stays readable.
|
|
539
|
-
*/
|
|
540
|
-
interface LayoutSidecar {
|
|
541
|
-
format: typeof LAYOUT_FORMAT;
|
|
542
|
-
formatVersion: typeof LAYOUT_FORMAT_VERSION;
|
|
543
|
-
positions: Record<string, Position>;
|
|
544
|
-
stickyNotes?: JsonObject[];
|
|
545
|
-
metaLayout?: JsonObject;
|
|
546
|
-
}
|
|
547
|
-
/** How connection names in code resolve to connection references. */
|
|
548
|
-
type ConnectionResolver = Readonly<Record<string, ConnectionRef>> | ((name: string) => ConnectionRef | undefined);
|
|
549
|
-
interface AssembleOptions {
|
|
550
|
-
layout?: LayoutSidecar;
|
|
551
|
-
connections?: ConnectionResolver;
|
|
552
|
-
/** TEST-only pinned data (`workflows/<key>.pinned.json`). */
|
|
553
|
-
pinnedData?: JsonObject;
|
|
554
|
-
/** Provenance; defaults to `{ mode: 'canvas', generator: 'sdk-ts', generatorVersion }`. */
|
|
555
|
-
authoring?: WorkflowAuthoring;
|
|
556
|
-
}
|
|
557
|
-
/** Connection names used in code that the target workspace does not have. */
|
|
558
|
-
declare class UnresolvedConnectionsError extends Error {
|
|
559
|
-
readonly names: string[];
|
|
560
|
-
constructor(names: string[]);
|
|
561
|
-
}
|
|
562
|
-
/** Validate a parsed layout sidecar. */
|
|
563
|
-
declare function parseLayoutSidecar(value: unknown): LayoutSidecar;
|
|
564
|
-
/** Assemble IR v2 from a recording. */
|
|
565
|
-
declare function assembleRecording(recording: Tier1Recording, options?: AssembleOptions): WorkflowDefinition;
|
|
566
|
-
/** Lower a tier-1 workflow to IR v2 (spec 10 §1 `toIR`). */
|
|
567
|
-
declare function toIR(workflow: Tier1Workflow, options?: AssembleOptions): WorkflowDefinition;
|
|
568
|
-
|
|
569
|
-
export { defineWorkflow as $, type AfterInput as A, BuilderError as B, type CompareRef as C, type SwitchOptions as D, type EdgeOptions as E, type FileRef as F, type SwitchRef as G, type HandleRef as H, type IfOptions as I, type Tier1Workflow as J, type TriggerOperation as K, LAYOUT_FORMAT as L, type MergeOptions as M, type NodeOptions as N, type OnErrorOption as O, PREDICATE_OPERATORS as P, WorkflowBuilder as Q, RECORDING_FORMAT as R, type SignalWaitRef as S, type Tier1Recording as T, UnresolvedConnectionsError as U, type ValidateRef as V, type WaitForSignalOptions as W, type WorkflowOptions as X, and as Y, assembleRecording as Z, defaultEdgeId as _, type AnyRef as a, edge as a0, expr as a1, internalNodes as a2, isOperation as a3, isTier1Workflow as a4, nodes as a5, op as a6, or as a7, parseLayoutSidecar as a8, toIR as a9, trigger as aa, triggers as ab, type ApprovalRef as b, type ArgValue as c, type ArgsOf as d, type AssembleOptions as e, type ConditionGroup as f, type ConditionRule as g, type ConnectionResolver as h, type EdgeSource as i, type EdgeSpec as j, type IfRef as k, LAYOUT_FORMAT_VERSION as l, type LayoutSidecar as m, type LoopOptions as n, type LoopRef as o, type NodeRef as p, type NoteOptions as q, type Operation as r, type OutputRef as s, type Predicate as t, type PredicateMethods as u, RECORDING_FORMAT_VERSION as v, type RecordedNode as w, type RecordedNote as x, type RuleValue as y, type SubworkflowOptions as z };
|
|
467
|
+
export { type AfterInput as A, BuilderError as B, type CodeWorkflowOptions as C, type DurableRef as D, type EdgeOptions as E, and as F, defaultEdgeId as G, type HandleRef as H, type IfOptions as I, defineWorkflow as J, edge as K, type LoopOptions as L, type MergeOptions as M, type NodeOptions as N, type OnErrorOption as O, PREDICATE_OPERATORS as P, expr as Q, RECORDING_FORMAT as R, type SignalWaitRef as S, type Tier1Recording as T, isTier1Workflow as U, type ValidateRef as V, type WaitForSignalOptions as W, or as X, type AnyRef as a, type ApprovalRef as b, type ArgValue as c, type ArgsOf as d, type CompareRef as e, type ConditionGroup as f, type ConditionRule as g, type EdgeSource as h, type EdgeSpec as i, type IfRef as j, type LoopRef as k, type NodeRef as l, type NoteOptions as m, type OutputRef as n, type Predicate as o, type PredicateMethods as p, RECORDING_FORMAT_VERSION as q, type RecordedNode as r, type RecordedNote as s, type RuleValue as t, type SubworkflowOptions as u, type SwitchOptions as v, type SwitchRef as w, type Tier1Workflow as x, WorkflowBuilder as y, type WorkflowOptions as z };
|