@ai-digital-factory/state-flow-runtime 0.1.0 → 0.1.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 +195 -41
- package/dist/index.d.ts +536 -251
- package/dist/index.js +3368 -1840
- package/package.json +1 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/** Base class for durable runtime rejections (infrastructure, defects, invalid input). */
|
|
4
|
-
declare class DurableRuntimeError extends Error {
|
|
5
|
-
constructor(message: string, options?: {
|
|
6
|
-
cause?: unknown;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
/** Another runtime already owns the database (ADR 0047). */
|
|
10
|
-
declare class DurableOwnershipError extends DurableRuntimeError {
|
|
11
|
-
}
|
|
12
|
-
/** The runtime is closing or closed and admits no new work (ADR 0061). */
|
|
13
|
-
declare class DurableRuntimeClosedError extends DurableRuntimeError {
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* `close({ timeoutMs })` elapsed while callbacks were still running. The runtime keeps the
|
|
17
|
-
* database lock; exit the process to release it (ADR 0075).
|
|
18
|
-
*/
|
|
19
|
-
declare class DurableShutdownTimeoutError extends DurableRuntimeError {
|
|
20
|
-
}
|
|
21
|
-
/** A compiled module failed startup validation before any handler ran (ADR 0046). */
|
|
22
|
-
declare class DurableDefinitionError extends DurableRuntimeError {
|
|
23
|
-
readonly problems: readonly string[];
|
|
24
|
-
constructor(chartName: string, problems: readonly string[]);
|
|
25
|
-
}
|
|
26
|
-
/** Input that cannot become trusted durable data (IDs, payloads, transitions). */
|
|
27
|
-
declare class DurableInputError extends DurableRuntimeError {
|
|
28
|
-
}
|
|
29
|
-
/** The database was written by a newer State Flow schema. */
|
|
30
|
-
declare class DurableSchemaError extends DurableRuntimeError {
|
|
31
|
-
}
|
|
32
|
-
/** A non-applied dispatch outcome routed to the application's shared failure handler. */
|
|
33
|
-
declare class DurableDispatchError extends DurableRuntimeError {
|
|
34
|
-
readonly outcome: Exclude<DispatchOutcome, "applied">;
|
|
35
|
-
readonly instanceId: InstanceId;
|
|
36
|
-
readonly context: unknown;
|
|
37
|
-
readonly phase: "dispatch";
|
|
38
|
-
constructor(outcome: Exclude<DispatchOutcome, "applied">, instanceId: InstanceId, context: unknown);
|
|
39
|
-
}
|
|
40
|
-
/** Runtime operation failures retain the original exception as cause. */
|
|
41
|
-
declare class DurableOperationError extends DurableRuntimeError {
|
|
42
|
-
readonly phase: "create-flow" | "ensure-instance" | "dispatch";
|
|
43
|
-
readonly outcome: "error";
|
|
44
|
-
constructor(phase: "create-flow" | "ensure-instance" | "dispatch", cause: unknown);
|
|
45
|
-
}
|
|
46
|
-
/** Stored instances remain untouched when their definition or handler revision is incompatible. */
|
|
47
|
-
declare class DurableDefinitionMismatchError extends DurableRuntimeError {
|
|
48
|
-
readonly context: DefinitionMismatchContext;
|
|
49
|
-
readonly phase: "ensure-instance";
|
|
50
|
-
readonly outcome: "definition-mismatch";
|
|
51
|
-
constructor(context: DefinitionMismatchContext);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
3
|
/** Shared runtime contract for manual actions, also used by companion transports. */
|
|
55
4
|
declare const resolveInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
5
|
action: z.ZodLiteral<"retry">;
|
|
@@ -76,12 +25,45 @@ declare const resolveInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
76
25
|
operationId: z.ZodPipe<z.ZodString, z.ZodTransform<OperationId, string>>;
|
|
77
26
|
expectedAttempts: z.ZodNumber;
|
|
78
27
|
reason: z.ZodString;
|
|
28
|
+
}, z.core.$strict>, z.ZodPipe<z.ZodObject<{
|
|
29
|
+
action: z.ZodLiteral<"confirm-completed">;
|
|
30
|
+
callback: z.ZodLiteral<"on-transition">;
|
|
31
|
+
result: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
operationId: z.ZodPipe<z.ZodString, z.ZodTransform<OperationId, string>>;
|
|
33
|
+
expectedAttempts: z.ZodNumber;
|
|
34
|
+
reason: z.ZodString;
|
|
35
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
36
|
+
action: "confirm-completed";
|
|
37
|
+
callback: "on-transition";
|
|
38
|
+
operationId: OperationId;
|
|
39
|
+
expectedAttempts: number;
|
|
40
|
+
reason: string;
|
|
41
|
+
} | {
|
|
42
|
+
result: string;
|
|
43
|
+
action: "confirm-completed";
|
|
44
|
+
callback: "on-transition";
|
|
45
|
+
operationId: OperationId;
|
|
46
|
+
expectedAttempts: number;
|
|
47
|
+
reason: string;
|
|
48
|
+
}, {
|
|
49
|
+
action: "confirm-completed";
|
|
50
|
+
callback: "on-transition";
|
|
51
|
+
operationId: OperationId;
|
|
52
|
+
expectedAttempts: number;
|
|
53
|
+
reason: string;
|
|
54
|
+
result?: string | null | undefined;
|
|
55
|
+
}>>, z.ZodObject<{
|
|
56
|
+
action: z.ZodLiteral<"confirm-completed">;
|
|
57
|
+
callback: z.ZodLiteral<"children">;
|
|
58
|
+
result: z.ZodJSONSchema;
|
|
59
|
+
operationId: z.ZodPipe<z.ZodString, z.ZodTransform<OperationId, string>>;
|
|
60
|
+
expectedAttempts: z.ZodNumber;
|
|
61
|
+
reason: z.ZodString;
|
|
79
62
|
}, z.core.$strict>, z.ZodPipe<z.ZodObject<{
|
|
80
63
|
action: z.ZodLiteral<"confirm-completed">;
|
|
81
64
|
callback: z.ZodEnum<{
|
|
82
65
|
"on-enter": "on-enter";
|
|
83
66
|
"on-exit": "on-exit";
|
|
84
|
-
"on-transition": "on-transition";
|
|
85
67
|
}>;
|
|
86
68
|
result: z.ZodOptional<z.ZodNull>;
|
|
87
69
|
operationId: z.ZodPipe<z.ZodString, z.ZodTransform<OperationId, string>>;
|
|
@@ -89,13 +71,13 @@ declare const resolveInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
89
71
|
reason: z.ZodString;
|
|
90
72
|
}, z.core.$strict>, z.ZodTransform<{
|
|
91
73
|
action: "confirm-completed";
|
|
92
|
-
callback: "on-enter" | "on-exit"
|
|
74
|
+
callback: "on-enter" | "on-exit";
|
|
93
75
|
operationId: OperationId;
|
|
94
76
|
expectedAttempts: number;
|
|
95
77
|
reason: string;
|
|
96
78
|
}, {
|
|
97
79
|
action: "confirm-completed";
|
|
98
|
-
callback: "on-enter" | "on-exit"
|
|
80
|
+
callback: "on-enter" | "on-exit";
|
|
99
81
|
operationId: OperationId;
|
|
100
82
|
expectedAttempts: number;
|
|
101
83
|
reason: string;
|
|
@@ -108,21 +90,21 @@ declare function parseResolveInput(value: unknown): ResolveInput<string>;
|
|
|
108
90
|
/**
|
|
109
91
|
* Public types for the durable runtime (ADRs 0046–0075).
|
|
110
92
|
*
|
|
111
|
-
* Handler authors use the callback types (`
|
|
112
|
-
* Services use the outcome-handler, snapshot, and resolve types through `
|
|
93
|
+
* Handler authors use the callback types (`Guard`, `TransitionCallback`, …).
|
|
94
|
+
* Services use the outcome-handler, snapshot, and resolve types through `Runtime`.
|
|
113
95
|
*/
|
|
114
96
|
declare const durableIdKind: unique symbol;
|
|
115
|
-
type
|
|
97
|
+
type BrandedId<Kind extends string> = string & {
|
|
116
98
|
readonly [durableIdKind]: Kind;
|
|
117
99
|
};
|
|
118
100
|
/** Application-supplied flow instance identity. Build with `instanceId(...)`. */
|
|
119
|
-
type InstanceId =
|
|
101
|
+
type InstanceId = BrandedId<"instance">;
|
|
120
102
|
/** Application-supplied dispatch request identity. Build with `requestId(...)`. */
|
|
121
|
-
type RequestId =
|
|
103
|
+
type RequestId = BrandedId<"request">;
|
|
122
104
|
/** State Flow-generated logical callback operation identity, stable across attempts. */
|
|
123
|
-
type OperationId =
|
|
105
|
+
type OperationId = BrandedId<"operation">;
|
|
124
106
|
/** State Flow-generated identity of one execution or recovery attempt. */
|
|
125
|
-
type AttemptId =
|
|
107
|
+
type AttemptId = BrandedId<"attempt">;
|
|
126
108
|
type JsonPrimitive = string | number | boolean | null;
|
|
127
109
|
type JsonValue = JsonPrimitive | readonly JsonValue[] | {
|
|
128
110
|
readonly [key: string]: JsonValue;
|
|
@@ -141,22 +123,37 @@ type NonJsonPayloadTransitions<Payloads> = {
|
|
|
141
123
|
[T in keyof Payloads]: IsJsonCompatible<Payloads[T]> extends true ? never : T;
|
|
142
124
|
}[keyof Payloads];
|
|
143
125
|
type RecoveryStrategy = "safe-replay" | "reconcile" | "manual";
|
|
144
|
-
type
|
|
126
|
+
type OperationInfo = {
|
|
145
127
|
readonly operationId: OperationId;
|
|
146
128
|
readonly attemptId: AttemptId;
|
|
147
129
|
/** 1 for the first run; increases with each run or reconciliation attempt. */
|
|
148
130
|
readonly attempt: number;
|
|
149
131
|
};
|
|
150
132
|
/** Fields State Flow adds to every durable callback context. */
|
|
151
|
-
type
|
|
133
|
+
type ExecutionContext = {
|
|
134
|
+
/** The root instance, also for callbacks of nested scopes. */
|
|
152
135
|
readonly instanceId: InstanceId;
|
|
153
|
-
readonly operation:
|
|
154
|
-
/**
|
|
136
|
+
readonly operation: OperationInfo;
|
|
137
|
+
/**
|
|
138
|
+
* Cooperative cancellation: aborted when the runtime closes (ADR 0068) and when a parent
|
|
139
|
+
* Transition interrupts this nested scope (ADR 0095). Unrelated scopes are not affected.
|
|
140
|
+
*/
|
|
155
141
|
readonly signal: AbortSignal;
|
|
142
|
+
/** Where this callback runs: `null` for the root graph, otherwise its nested scope. */
|
|
143
|
+
readonly scope: ScopeRef | null;
|
|
144
|
+
};
|
|
145
|
+
/** Identity of one nested activation (ADR 0096). */
|
|
146
|
+
type ScopeRef = {
|
|
147
|
+
/** Composition path from the root, for example `authenticated` or `workspace:uploads`. */
|
|
148
|
+
readonly path: string;
|
|
149
|
+
/** Distinct per activation: re-entering the same path creates a new one. */
|
|
150
|
+
readonly activationId: string;
|
|
151
|
+
/** FlowList member key; `null` outside a FlowList. */
|
|
152
|
+
readonly memberKey: string | null;
|
|
156
153
|
};
|
|
157
|
-
type
|
|
154
|
+
type CallbackContext<Context> = Context & ExecutionContext;
|
|
158
155
|
type RecoveryCause = "failed" | "interrupted";
|
|
159
|
-
type ReconcileContext<Context> =
|
|
156
|
+
type ReconcileContext<Context> = CallbackContext<Context> & {
|
|
160
157
|
readonly recovery: {
|
|
161
158
|
/** `interrupted` when the process stopped while `run` was in flight. */
|
|
162
159
|
readonly cause: RecoveryCause;
|
|
@@ -192,91 +189,170 @@ type RecoveryDeclaration<Context, Args extends readonly unknown[], Result> = {
|
|
|
192
189
|
readonly reconcile: (context: ReconcileContext<Context>, ...args: Args) => ReconcileDecision<Result> | Promise<ReconcileDecision<Result>>;
|
|
193
190
|
};
|
|
194
191
|
/** One implemented callback: its execution and its recovery declared together. */
|
|
195
|
-
type
|
|
196
|
-
readonly run: (context:
|
|
192
|
+
type Callback<Context, Args extends readonly unknown[], Result> = {
|
|
193
|
+
readonly run: (context: CallbackContext<Context>, ...args: Args) => Result | Promise<Result>;
|
|
197
194
|
readonly recovery: RecoveryDeclaration<Context, Args, Result>;
|
|
198
195
|
};
|
|
199
196
|
/** `onEnter` / `onExit` in a durable state handler. */
|
|
200
|
-
type
|
|
197
|
+
type StateCallback<Context> = Callback<Context, [], void>;
|
|
198
|
+
/** One FlowList member: a key unique within the activation and the member's invocation input. */
|
|
199
|
+
type ListMember<Input> = {
|
|
200
|
+
readonly key: string;
|
|
201
|
+
readonly input: Input;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* What a composite State's `children` callback returns (ADR 0096): the input of each placed
|
|
205
|
+
* Flow that declares one, and the members of each FlowList. Placed Flows without input are omitted.
|
|
206
|
+
*/
|
|
207
|
+
type ChildInputsOf<Regions extends Record<string, {
|
|
208
|
+
readonly kind: "flow" | "list";
|
|
209
|
+
readonly input: unknown;
|
|
210
|
+
}>> = {
|
|
211
|
+
readonly [R in keyof Regions as Regions[R]["kind"] extends "list" ? R : [Regions[R]["input"]] extends [null] ? never : R]: Regions[R]["kind"] extends "list" ? readonly ListMember<Regions[R]["input"]>[] : Regions[R]["input"];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* `children` in a composite State handler: checkpointed once per activation. It receives the
|
|
215
|
+
* entering Transition's payload, or `null` when the State is entered at a default.
|
|
216
|
+
*/
|
|
217
|
+
type ChildrenCallback<Context, Inputs, EntryPayload = null> = Callback<Context, [
|
|
218
|
+
payload: EntryPayload
|
|
219
|
+
], Inputs>;
|
|
220
|
+
/** Handlers of a composite State: `children` is required when the result has required fields. */
|
|
221
|
+
type CompositeStateHandlers<EntryContext, ExitContext, ChildrenContext, Inputs, EntryPayload = null> = StateHandlers<EntryContext, ExitContext> & (Record<never, never> extends Inputs ? {
|
|
222
|
+
readonly children?: ChildrenCallback<ChildrenContext, Inputs, EntryPayload>;
|
|
223
|
+
} : {
|
|
224
|
+
readonly children: ChildrenCallback<ChildrenContext, Inputs, EntryPayload>;
|
|
225
|
+
});
|
|
201
226
|
/** `guard` in a durable transition handler. */
|
|
202
|
-
type
|
|
227
|
+
type Guard<Context, Payload> = Callback<Context, [
|
|
203
228
|
payload: Payload
|
|
204
229
|
], boolean>;
|
|
205
|
-
/**
|
|
206
|
-
|
|
230
|
+
/**
|
|
231
|
+
* `onTransition` in a durable transition handler. `Result` is `void` for a fixed destination and
|
|
232
|
+
* the generated union of destination names when the transition branches (ADR 0087).
|
|
233
|
+
*/
|
|
234
|
+
type TransitionCallback<Context, Payload, Result = void> = Callback<Context, [
|
|
207
235
|
payload: Payload
|
|
208
|
-
],
|
|
236
|
+
], Result>;
|
|
209
237
|
/** `resolveStartState` in a durable creation handler. Return the initial state for ordinary creation. */
|
|
210
|
-
type
|
|
238
|
+
type StartStateResolver<Context, StateName extends string> = Callback<Context, [
|
|
239
|
+
], StateName>;
|
|
211
240
|
/**
|
|
212
241
|
* `onEnter` receives the incoming transition (or `"default"` at creation); `onExit` receives the
|
|
213
242
|
* outgoing transition, so the two callbacks have different context types.
|
|
214
243
|
*/
|
|
215
|
-
type
|
|
216
|
-
readonly onEnter?:
|
|
217
|
-
readonly onExit?:
|
|
244
|
+
type StateHandlers<EntryContext, ExitContext> = {
|
|
245
|
+
readonly onEnter?: StateCallback<EntryContext>;
|
|
246
|
+
readonly onExit?: StateCallback<ExitContext>;
|
|
247
|
+
};
|
|
248
|
+
/** Handlers of a transition with one fixed destination: both callbacks are optional. */
|
|
249
|
+
type TransitionHandlers<Context, Payload, Result = void> = {
|
|
250
|
+
readonly guard?: Guard<Context, Payload>;
|
|
251
|
+
readonly onTransition?: TransitionCallback<Context, Payload, Result>;
|
|
218
252
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
readonly
|
|
253
|
+
/** Handlers of a branching transition: `onTransition` is required and selects the destination. */
|
|
254
|
+
type BranchingTransitionHandlers<Context, Payload, Result> = {
|
|
255
|
+
readonly guard?: Guard<Context, Payload>;
|
|
256
|
+
readonly onTransition: TransitionCallback<Context, Payload, Result>;
|
|
222
257
|
};
|
|
223
|
-
type
|
|
224
|
-
readonly resolveStartState?:
|
|
258
|
+
type CreationHandlers<Context, StateName extends string> = {
|
|
259
|
+
readonly resolveStartState?: StartStateResolver<Context, StateName>;
|
|
225
260
|
};
|
|
226
261
|
type EndpointMapFor<StateName extends string> = Record<string, {
|
|
227
262
|
fromState: StateName;
|
|
228
|
-
|
|
263
|
+
destinations: readonly StateName[];
|
|
229
264
|
}>;
|
|
230
|
-
type
|
|
231
|
-
readonly states: Readonly<Record<string,
|
|
232
|
-
readonly transitions: Readonly<Record<string,
|
|
233
|
-
readonly creation:
|
|
265
|
+
type HandlerTable = {
|
|
266
|
+
readonly states: Readonly<Record<string, StateHandlers<any, any> | CompositeStateHandlers<any, any, any, any, any> | null>>;
|
|
267
|
+
readonly transitions: Readonly<Record<string, TransitionHandlers<any, any> | TransitionHandlers<any, any, string> | null>>;
|
|
268
|
+
readonly creation: CreationHandlers<any, string> | null;
|
|
234
269
|
};
|
|
235
|
-
|
|
270
|
+
/** Contract of one nested scope reachable through `instance.scope(...)` (ADR 0096). */
|
|
271
|
+
type ScopeEntry<StateName extends string, EndpointMap, Payloads, List extends boolean, Scopes> = {
|
|
272
|
+
readonly states: StateName;
|
|
273
|
+
readonly endpoints: EndpointMap;
|
|
274
|
+
readonly payloads: Payloads;
|
|
275
|
+
/** A FlowList: address members with their key. */
|
|
276
|
+
readonly list: List;
|
|
277
|
+
readonly scopes: Scopes;
|
|
278
|
+
};
|
|
279
|
+
/** Erased scope map: composition-path segment → scope contract. */
|
|
280
|
+
type ScopeMap = Record<string, ScopeEntry<string, EndpointMapFor<string>, Record<string, unknown>, boolean, unknown>>;
|
|
281
|
+
type CompiledFlowModule<StateName extends string, TransitionPayloads extends Record<string, unknown>, Dependencies, EndpointMap extends EndpointMapFor<StateName>, Handlers extends HandlerTable, Scopes = Record<never, never>, Input = null> = {
|
|
236
282
|
readonly execution: "durable";
|
|
237
|
-
readonly
|
|
283
|
+
readonly flowName: string;
|
|
238
284
|
readonly initialStateId: string;
|
|
239
285
|
readonly states: ReadonlyArray<{
|
|
240
286
|
readonly id: string;
|
|
241
287
|
readonly name: StateName;
|
|
288
|
+
/** `final` for a FinalState; reaching it completes the instance. */
|
|
289
|
+
readonly kind?: "state" | "final";
|
|
290
|
+
/** Nested States name their composite parent and region (ADR 0095). */
|
|
291
|
+
readonly parentId?: string;
|
|
292
|
+
readonly region?: string;
|
|
242
293
|
}>;
|
|
243
294
|
readonly transitions: ReadonlyArray<{
|
|
244
295
|
readonly fromId: string;
|
|
245
296
|
readonly fromName: StateName;
|
|
246
|
-
readonly toId: string;
|
|
247
|
-
readonly toName: StateName;
|
|
248
297
|
readonly name: Extract<keyof TransitionPayloads, string>;
|
|
249
298
|
readonly description: string;
|
|
299
|
+
readonly destinations: ReadonlyArray<{
|
|
300
|
+
readonly toId: string;
|
|
301
|
+
readonly toName: StateName;
|
|
302
|
+
readonly description: string;
|
|
303
|
+
}>;
|
|
304
|
+
readonly childWork?: "block" | "interrupt";
|
|
305
|
+
readonly trigger?: "dispatch" | "done";
|
|
306
|
+
}>;
|
|
307
|
+
/** Composite States and their regions (ADR 0096); absent for a flat flow. */
|
|
308
|
+
readonly compositions?: ReadonlyArray<{
|
|
309
|
+
readonly stateId: string;
|
|
310
|
+
readonly kind: "compound" | "parallel";
|
|
311
|
+
readonly regions: ReadonlyArray<{
|
|
312
|
+
readonly name: string;
|
|
313
|
+
readonly kind: "inline";
|
|
314
|
+
readonly defaultId: string;
|
|
315
|
+
} | {
|
|
316
|
+
readonly name: string;
|
|
317
|
+
readonly kind: "flow" | "list";
|
|
318
|
+
readonly flow: string;
|
|
319
|
+
}>;
|
|
250
320
|
}>;
|
|
321
|
+
/** Compiled modules of the Flows this one places, by flow name. */
|
|
322
|
+
readonly placedFlows?: Readonly<Record<string, unknown>>;
|
|
323
|
+
/** Invocation input contract when this Flow runs as a nested child. */
|
|
324
|
+
readonly inputSchema?: z.ZodType<Input, Input>;
|
|
325
|
+
/** Dispatchable Transitions of the root graph. */
|
|
251
326
|
readonly transitionEndpointMap: EndpointMap;
|
|
252
327
|
/** Runtime payload contracts; generated from each transition module's payloadSchema. */
|
|
253
328
|
readonly payloadSchemas: {
|
|
254
329
|
readonly [T in keyof TransitionPayloads]: z.ZodType<TransitionPayloads[T], TransitionPayloads[T]>;
|
|
255
330
|
};
|
|
256
|
-
readonly
|
|
331
|
+
readonly handlers: Handlers;
|
|
257
332
|
/**
|
|
258
|
-
* Hash of the
|
|
333
|
+
* Hash of the flow's handler sources, written by compile. Unresolved work started under a
|
|
259
334
|
* different revision is not resumed (ADR 0049, 0075). `null` for hand-built modules.
|
|
260
335
|
*/
|
|
261
336
|
readonly handlerRevision?: string | null;
|
|
262
|
-
readonly
|
|
263
|
-
readonly transitionPayloadTypeLabels?: Readonly<Record<string, string>>;
|
|
264
|
-
readonly __flowConfigBrand?: FlowConfig;
|
|
337
|
+
readonly __dependenciesBrand?: Dependencies;
|
|
265
338
|
readonly __transitionPayloadsBrand?: TransitionPayloads;
|
|
266
|
-
|
|
339
|
+
readonly __scopesBrand?: Scopes;
|
|
340
|
+
} & PayloadCheck<TransitionPayloads>;
|
|
267
341
|
/** Rejects a compiled module whose transition payloads are not JSON-compatible. */
|
|
268
|
-
type
|
|
342
|
+
type PayloadCheck<TransitionPayloads> = [
|
|
269
343
|
NonJsonPayloadTransitions<TransitionPayloads>
|
|
270
344
|
] extends [never] ? unknown : {
|
|
271
345
|
readonly "State Flow: transition payloads must be JSON-compatible": NonJsonPayloadTransitions<TransitionPayloads>;
|
|
272
346
|
};
|
|
347
|
+
/** Allowed destinations of transition `T`. */
|
|
348
|
+
type DestinationOf<EndpointMap extends EndpointMapFor<string>, T extends keyof EndpointMap> = EndpointMap[T]["destinations"][number];
|
|
273
349
|
/** States that have at least one outgoing transition. */
|
|
274
350
|
type StatesWithOutgoing<StateName extends string, EndpointMap extends EndpointMapFor<StateName>> = EndpointMap[keyof EndpointMap]["fromState"];
|
|
275
351
|
type OutgoingFrom<EndpointMap extends EndpointMapFor<string>, From extends string> = {
|
|
276
352
|
[K in keyof EndpointMap]: EndpointMap[K]["fromState"] extends From ? K & string : never;
|
|
277
353
|
}[keyof EndpointMap];
|
|
278
354
|
/** Dispatch input for a scoped dispatcher. Narrowing `transition` narrows `payload`. */
|
|
279
|
-
type
|
|
355
|
+
type DispatchInput<TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<string>, From extends string> = {
|
|
280
356
|
[T in OutgoingFrom<EndpointMap, From>]: {
|
|
281
357
|
readonly requestId: RequestId;
|
|
282
358
|
readonly transition: T;
|
|
@@ -291,6 +367,11 @@ type CallbackRef<StateName extends string, TransitionName extends string> = {
|
|
|
291
367
|
} | {
|
|
292
368
|
readonly kind: "on-exit";
|
|
293
369
|
readonly state: StateName;
|
|
370
|
+
}
|
|
371
|
+
/** A composite State's `children` callback (ADR 0096). */
|
|
372
|
+
| {
|
|
373
|
+
readonly kind: "children";
|
|
374
|
+
readonly state: StateName;
|
|
294
375
|
} | {
|
|
295
376
|
readonly kind: "guard";
|
|
296
377
|
readonly transition: TransitionName;
|
|
@@ -316,6 +397,16 @@ type ExecutionStatus<StateName extends string, TransitionName extends string> =
|
|
|
316
397
|
} | {
|
|
317
398
|
readonly kind: "running";
|
|
318
399
|
readonly requestId: RequestId | null;
|
|
400
|
+
/**
|
|
401
|
+
* The transition in progress, `null` during creation. The committed `state` remains its
|
|
402
|
+
* source until the selected destination commits, so UIs show progress from this (ADR 0087).
|
|
403
|
+
*/
|
|
404
|
+
readonly transition: TransitionName | null;
|
|
405
|
+
/**
|
|
406
|
+
* The destination this execution recorded once `onTransition` selected it (or a fixed
|
|
407
|
+
* destination advanced); `null` before selection.
|
|
408
|
+
*/
|
|
409
|
+
readonly destination: StateName | null;
|
|
319
410
|
} | {
|
|
320
411
|
readonly kind: "recovering";
|
|
321
412
|
readonly work: UnresolvedWork<StateName, TransitionName>;
|
|
@@ -326,10 +417,22 @@ type ExecutionStatus<StateName extends string, TransitionName extends string> =
|
|
|
326
417
|
} | {
|
|
327
418
|
readonly kind: "terminated";
|
|
328
419
|
readonly reason: string;
|
|
420
|
+
}
|
|
421
|
+
/** The instance reached a FinalState. Distinct from operational termination (ADR 0087). */
|
|
422
|
+
| {
|
|
423
|
+
readonly kind: "completed";
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* A nested scope whose activation ended (ADR 0095). `interrupted` when a parent Transition
|
|
427
|
+
* interrupted its work. Retained unresolved work shows as `recovering` or `needs-attention`.
|
|
428
|
+
*/
|
|
429
|
+
| {
|
|
430
|
+
readonly kind: "exited";
|
|
431
|
+
readonly interrupted: boolean;
|
|
329
432
|
};
|
|
330
|
-
type
|
|
433
|
+
type InstanceSnapshot<StateName extends string, TransitionName extends string> = {
|
|
331
434
|
readonly instanceId: InstanceId;
|
|
332
|
-
readonly
|
|
435
|
+
readonly flowName: string;
|
|
333
436
|
/** The committed authored state. Stays visible while post-commit work recovers (ADR 0060). */
|
|
334
437
|
readonly state: StateName;
|
|
335
438
|
/** Increases with every committed state or status change. */
|
|
@@ -344,8 +447,36 @@ type DurableSnapshot<StateName extends string, TransitionName extends string> =
|
|
|
344
447
|
readonly error: string;
|
|
345
448
|
readonly at: string;
|
|
346
449
|
} | null;
|
|
450
|
+
/**
|
|
451
|
+
* Nested scopes of a root instance (ADR 0096): every active scope, and exited scopes that
|
|
452
|
+
* still retain unresolved work. Empty for a flat flow and for scope snapshots.
|
|
453
|
+
*/
|
|
454
|
+
readonly scopes: readonly ScopeSnapshot[];
|
|
455
|
+
};
|
|
456
|
+
/** One nested activation in a root snapshot. */
|
|
457
|
+
type ScopeSnapshot = ScopeRef & {
|
|
458
|
+
/** Composition-path segment relative to the parent scope. */
|
|
459
|
+
readonly segment: string;
|
|
460
|
+
/** Activation of the parent scope, `null` when the parent is the root. */
|
|
461
|
+
readonly parentActivationId: string | null;
|
|
462
|
+
/** The Flow whose graph this scope executes. */
|
|
463
|
+
readonly flowName: string;
|
|
464
|
+
readonly state: string;
|
|
465
|
+
/** False once the scope's activation exited. */
|
|
466
|
+
readonly active: boolean;
|
|
467
|
+
readonly status: ExecutionStatus<string, string>;
|
|
347
468
|
};
|
|
348
|
-
type HistoryEventType = "instance-created" | "execution-started" | "callback-started" | "callback-completed" | "callback-failed" | "recovery-scheduled" | "recovery-interrupted" | "state-committed" | "execution-applied" | "execution-blocked" | "needs-attention" | "manual-resolution" | "instance-terminated"
|
|
469
|
+
type HistoryEventType = "instance-created" | "execution-started" | "callback-started" | "callback-completed" | "callback-failed" | "recovery-scheduled" | "recovery-interrupted" | "state-committed" | "execution-applied" | "execution-blocked" | "needs-attention" | "manual-resolution" | "instance-terminated" | "instance-completed"
|
|
470
|
+
/** A composite State activated its child scopes (ADR 0096). */
|
|
471
|
+
| "scope-activated"
|
|
472
|
+
/** A nested scope exited because an ancestor Transition left its State. */
|
|
473
|
+
| "scope-exited"
|
|
474
|
+
/** A parent Transition interrupted a scope's running or unresolved work. */
|
|
475
|
+
| "scope-interrupted"
|
|
476
|
+
/** A nested scope reached a FinalState. */
|
|
477
|
+
| "scope-completed"
|
|
478
|
+
/** An interrupted operation's outcome was established after its activation exited. */
|
|
479
|
+
| "late-outcome";
|
|
349
480
|
type HistoryEvent = {
|
|
350
481
|
readonly sequence: number;
|
|
351
482
|
readonly at: string;
|
|
@@ -368,12 +499,14 @@ type HistoryPage = {
|
|
|
368
499
|
readonly nextAfterSequence: number | null;
|
|
369
500
|
};
|
|
370
501
|
type ExecutionStatusKind = ExecutionStatus<string, string>["kind"];
|
|
502
|
+
/** Statuses a root instance can have: only nested scopes exit (ADR 0096). */
|
|
503
|
+
type InstanceStatusKind = Exclude<ExecutionStatusKind, "exited">;
|
|
371
504
|
/** One row of an instance listing, read from storage without opening the instance. */
|
|
372
505
|
type InstanceSummary = {
|
|
373
506
|
readonly instanceId: InstanceId;
|
|
374
|
-
readonly
|
|
507
|
+
readonly flowName: string;
|
|
375
508
|
readonly state: string;
|
|
376
|
-
readonly status:
|
|
509
|
+
readonly status: InstanceStatusKind;
|
|
377
510
|
/** Needs-attention or termination reason. */
|
|
378
511
|
readonly statusReason: string | null;
|
|
379
512
|
readonly revision: number;
|
|
@@ -381,8 +514,8 @@ type InstanceSummary = {
|
|
|
381
514
|
readonly updatedAt: string;
|
|
382
515
|
};
|
|
383
516
|
type InstanceQuery = {
|
|
384
|
-
readonly
|
|
385
|
-
readonly status?:
|
|
517
|
+
readonly flowName?: string;
|
|
518
|
+
readonly status?: InstanceStatusKind | readonly InstanceStatusKind[];
|
|
386
519
|
/** Cursor from a previous page's `next`. */
|
|
387
520
|
readonly after?: string;
|
|
388
521
|
/** Defaults to 50; at most 500. */
|
|
@@ -406,7 +539,7 @@ type UnvalidatedDispatchInput<Input> = Input extends unknown ? Omit<Input, "payl
|
|
|
406
539
|
readonly payload: unknown;
|
|
407
540
|
} : never;
|
|
408
541
|
type CompletedDispatchContext<Input, StateName extends string, TransitionName extends string> = {
|
|
409
|
-
readonly snapshot:
|
|
542
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
410
543
|
} & ({
|
|
411
544
|
readonly duplicate: false;
|
|
412
545
|
readonly input: Input;
|
|
@@ -414,8 +547,15 @@ type CompletedDispatchContext<Input, StateName extends string, TransitionName ex
|
|
|
414
547
|
readonly duplicate: true;
|
|
415
548
|
readonly input: UnvalidatedDispatchInput<Input>;
|
|
416
549
|
});
|
|
550
|
+
/**
|
|
551
|
+
* Applied dispatch: `destination` is the State this request's execution recorded, which stays the
|
|
552
|
+
* same for duplicates even after the instance moves on; `snapshot` is the current condition.
|
|
553
|
+
*/
|
|
554
|
+
type AppliedContext<Input, StateName extends string, TransitionName extends string> = CompletedDispatchContext<Input, StateName, TransitionName> & {
|
|
555
|
+
readonly destination: StateName;
|
|
556
|
+
};
|
|
417
557
|
type DispatchOutcomeHandlers<StateName extends string, TransitionName extends string, Input, From extends StateName> = {
|
|
418
|
-
readonly applied: OutcomeHandler<
|
|
558
|
+
readonly applied: OutcomeHandler<AppliedContext<Input, StateName, TransitionName>>;
|
|
419
559
|
readonly "invalid-payload": OutcomeHandler<{
|
|
420
560
|
readonly input: UnvalidatedDispatchInput<Input>;
|
|
421
561
|
readonly issues: readonly {
|
|
@@ -426,16 +566,16 @@ type DispatchOutcomeHandlers<StateName extends string, TransitionName extends st
|
|
|
426
566
|
readonly blocked: OutcomeHandler<CompletedDispatchContext<Input, StateName, TransitionName>>;
|
|
427
567
|
readonly busy: OutcomeHandler<{
|
|
428
568
|
readonly input: Input;
|
|
429
|
-
readonly snapshot:
|
|
569
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
430
570
|
}>;
|
|
431
571
|
readonly "recovery-pending": OutcomeHandler<{
|
|
432
572
|
readonly input: Input;
|
|
433
|
-
readonly snapshot:
|
|
573
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
434
574
|
readonly work: UnresolvedWork<StateName, TransitionName>;
|
|
435
575
|
}>;
|
|
436
576
|
readonly "needs-attention": OutcomeHandler<{
|
|
437
577
|
readonly input: Input;
|
|
438
|
-
readonly snapshot:
|
|
578
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
439
579
|
readonly work: UnresolvedWork<StateName, TransitionName>;
|
|
440
580
|
readonly reason: string;
|
|
441
581
|
}>;
|
|
@@ -443,7 +583,7 @@ type DispatchOutcomeHandlers<StateName extends string, TransitionName extends st
|
|
|
443
583
|
readonly input: Input;
|
|
444
584
|
readonly expectedState: From;
|
|
445
585
|
readonly actualState: StateName;
|
|
446
|
-
readonly snapshot:
|
|
586
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
447
587
|
}>;
|
|
448
588
|
readonly "request-conflict": OutcomeHandler<{
|
|
449
589
|
readonly input: UnvalidatedDispatchInput<Input>;
|
|
@@ -455,83 +595,65 @@ type DispatchOutcomeHandlers<StateName extends string, TransitionName extends st
|
|
|
455
595
|
}>;
|
|
456
596
|
readonly terminated: OutcomeHandler<{
|
|
457
597
|
readonly input: Input;
|
|
458
|
-
readonly snapshot:
|
|
598
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
459
599
|
readonly reason: string;
|
|
460
600
|
}>;
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/** A non-applied outcome, with its context correlated to its discriminator. */
|
|
466
|
-
type DispatchFailure<StateName extends string, TransitionName extends string, Input, From extends StateName> = {
|
|
467
|
-
[Outcome in Exclude<DispatchOutcome, "applied">]: DurableDispatchError & {
|
|
468
|
-
readonly outcome: Outcome;
|
|
469
|
-
readonly context: Parameters<DispatchOutcomeHandlers<StateName, TransitionName, Input, From>[Outcome]>[0];
|
|
470
|
-
};
|
|
471
|
-
}[Exclude<DispatchOutcome, "applied">];
|
|
472
|
-
/** Shared application policy for setup, acquisition and non-applied dispatch outcomes. */
|
|
473
|
-
type FlowFailure<StateName extends string, TransitionName extends string, Input, From extends StateName> = DurableOperationError | DurableDefinitionMismatchError | DispatchFailure<StateName, TransitionName, Input, From>;
|
|
474
|
-
type CreateOutcomeHandlers<Instance, StateName extends string, TransitionName extends string> = {
|
|
475
|
-
readonly created: OutcomeHandler<{
|
|
476
|
-
readonly instance: Instance;
|
|
477
|
-
readonly snapshot: DurableSnapshot<StateName, TransitionName>;
|
|
478
|
-
}>;
|
|
479
|
-
readonly "already-exists": OutcomeHandler<{
|
|
480
|
-
readonly instanceId: InstanceId;
|
|
481
|
-
}>;
|
|
482
|
-
readonly "recovery-pending": OutcomeHandler<{
|
|
483
|
-
readonly instance: Instance;
|
|
484
|
-
readonly snapshot: DurableSnapshot<StateName, TransitionName>;
|
|
485
|
-
readonly work: UnresolvedWork<StateName, TransitionName>;
|
|
486
|
-
}>;
|
|
487
|
-
readonly "needs-attention": OutcomeHandler<{
|
|
488
|
-
readonly instance: Instance;
|
|
489
|
-
readonly snapshot: DurableSnapshot<StateName, TransitionName>;
|
|
490
|
-
readonly work: UnresolvedWork<StateName, TransitionName>;
|
|
491
|
-
readonly reason: string;
|
|
601
|
+
/** The instance reached a FinalState; this new request ran no callbacks. */
|
|
602
|
+
readonly completed: OutcomeHandler<{
|
|
603
|
+
readonly input: Input;
|
|
604
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
492
605
|
}>;
|
|
493
606
|
};
|
|
494
|
-
type
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
607
|
+
type DispatchOutcome = keyof DispatchOutcomeHandlers<string, string, unknown, string>;
|
|
608
|
+
/**
|
|
609
|
+
* Outcomes of a dispatch to a nested scope (ADR 0095, 0096): the root outcomes, plus
|
|
610
|
+
* `interrupted` when a parent Transition interrupted this request's execution, and `inactive`
|
|
611
|
+
* when no activation exists at the addressed scope.
|
|
612
|
+
*/
|
|
613
|
+
type ScopedDispatchOutcomeHandlers<StateName extends string, TransitionName extends string, Input, From extends StateName> = DispatchOutcomeHandlers<StateName, TransitionName, Input, From> & {
|
|
614
|
+
/** The execution was interrupted; nothing further commits for it. Not success, not rejection. */
|
|
615
|
+
readonly interrupted: OutcomeHandler<{
|
|
616
|
+
readonly input: UnvalidatedDispatchInput<Input>;
|
|
617
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
618
|
+
readonly duplicate: boolean;
|
|
502
619
|
}>;
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
readonly
|
|
506
|
-
readonly instanceId: InstanceId;
|
|
507
|
-
readonly message: string;
|
|
508
|
-
readonly storedChartName: string;
|
|
509
|
-
readonly storedDefinitionId: string;
|
|
510
|
-
readonly currentDefinitionId: string;
|
|
511
|
-
} | {
|
|
512
|
-
/** Handler code changed while this instance had unresolved work. */
|
|
513
|
-
readonly reason: "handler-revision";
|
|
514
|
-
readonly instanceId: InstanceId;
|
|
515
|
-
readonly message: string;
|
|
516
|
-
readonly storedHandlerRevision: string | null;
|
|
517
|
-
readonly currentHandlerRevision: string | null;
|
|
620
|
+
/** The addressed scope or FlowList member is not active, for example after its parent exited. */
|
|
621
|
+
readonly inactive: OutcomeHandler<{
|
|
622
|
+
readonly input: Input;
|
|
518
623
|
}>;
|
|
519
624
|
};
|
|
520
|
-
type
|
|
521
|
-
/**
|
|
522
|
-
type
|
|
523
|
-
/**
|
|
524
|
-
readonly
|
|
625
|
+
type ScopedDispatchOutcome = keyof ScopedDispatchOutcomeHandlers<string, string, unknown, string>;
|
|
626
|
+
/** Why `ensureInstance` rejected with `DefinitionMismatchError`; the stored instance is untouched. */
|
|
627
|
+
type DefinitionMismatchContext = {
|
|
628
|
+
/** The flow graph or recovery declarations changed. */
|
|
629
|
+
readonly reason: "definition";
|
|
630
|
+
readonly instanceId: InstanceId;
|
|
631
|
+
readonly message: string;
|
|
632
|
+
readonly storedFlowName: string;
|
|
633
|
+
readonly storedDefinitionId: string;
|
|
634
|
+
readonly currentDefinitionId: string;
|
|
635
|
+
} | {
|
|
636
|
+
/** Handler code changed while this instance had unresolved work. */
|
|
637
|
+
readonly reason: "handler-revision";
|
|
638
|
+
readonly instanceId: InstanceId;
|
|
639
|
+
readonly message: string;
|
|
640
|
+
readonly storedHandlerRevision: string | null;
|
|
641
|
+
readonly currentHandlerRevision: string | null;
|
|
525
642
|
};
|
|
526
643
|
type ResolveInput<StateName extends string> = Exclude<ParsedResolveInput, {
|
|
527
|
-
callback: "resolve-start-state";
|
|
644
|
+
callback: "resolve-start-state" | "on-transition";
|
|
528
645
|
}> | (Omit<Extract<ParsedResolveInput, {
|
|
529
646
|
callback: "resolve-start-state";
|
|
530
647
|
}>, "result"> & {
|
|
531
648
|
readonly result: StateName;
|
|
649
|
+
}) | (Omit<Extract<ParsedResolveInput, {
|
|
650
|
+
callback: "on-transition";
|
|
651
|
+
}>, "result"> & {
|
|
652
|
+
/** The selected destination when the transition branches; omitted for a fixed destination. */
|
|
653
|
+
readonly result?: StateName;
|
|
532
654
|
});
|
|
533
655
|
type ResolveRejection =
|
|
534
|
-
/** Inspector only: no registered flow can load this instance (unknown
|
|
656
|
+
/** Inspector only: no registered flow can load this instance (unknown flow or definition mismatch). */
|
|
535
657
|
"unavailable"
|
|
536
658
|
/**
|
|
537
659
|
* The operation is not the instance's current unresolved work awaiting attention, or it has
|
|
@@ -541,10 +663,15 @@ type ResolveRejection =
|
|
|
541
663
|
/** `callback` does not match the unresolved callback. */
|
|
542
664
|
| "callback-mismatch"
|
|
543
665
|
/** `result` does not satisfy the callback's result contract. */
|
|
544
|
-
| "invalid-result"
|
|
666
|
+
| "invalid-result"
|
|
667
|
+
/**
|
|
668
|
+
* Retry of interrupted work whose activation exited (ADR 0095): it is never replayed. Only a
|
|
669
|
+
* reconcile check, Confirm it completed, or Terminate are possible.
|
|
670
|
+
*/
|
|
671
|
+
| "not-replayable";
|
|
545
672
|
type ResolveResult<StateName extends string, TransitionName extends string> = {
|
|
546
673
|
readonly outcome: "accepted";
|
|
547
|
-
readonly snapshot:
|
|
674
|
+
readonly snapshot: InstanceSnapshot<StateName, TransitionName>;
|
|
548
675
|
} | {
|
|
549
676
|
readonly outcome: "rejected";
|
|
550
677
|
readonly reason: ResolveRejection;
|
|
@@ -563,8 +690,57 @@ type RestartOutcomeHandlers = {
|
|
|
563
690
|
readonly restarted: () => unknown;
|
|
564
691
|
readonly "not-restarted": () => unknown;
|
|
565
692
|
};
|
|
693
|
+
/** Execution statuses that block a deployment: the instance has unfinished execution. */
|
|
694
|
+
type BlockingStatusKind = Extract<ExecutionStatusKind, "running" | "recovering" | "needs-attention">;
|
|
695
|
+
/** One instance whose unfinished execution blocks a deployment. */
|
|
696
|
+
type DeploymentBlocker = {
|
|
697
|
+
/** The root instance, also when the unfinished work belongs to a nested scope. */
|
|
698
|
+
readonly instanceId: InstanceId;
|
|
699
|
+
readonly flowName: string;
|
|
700
|
+
readonly state: string;
|
|
701
|
+
readonly status: BlockingStatusKind;
|
|
702
|
+
/** Needs-attention reason; `null` otherwise. */
|
|
703
|
+
readonly statusReason: string | null;
|
|
704
|
+
/** The nested scope holding the work, including exited activations (ADR 0095); else `null`. */
|
|
705
|
+
readonly scope: (ScopeRef & {
|
|
706
|
+
readonly active: boolean;
|
|
707
|
+
}) | null;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* The established outcome of interrupted work after its activation exited: a late result, a
|
|
711
|
+
* post-exit reconciliation, or an operator's confirmation. Durable until acknowledged, because
|
|
712
|
+
* the exited graph can no longer react and the external effect may be live.
|
|
713
|
+
*/
|
|
714
|
+
type LateOutcome = ScopeRef & {
|
|
715
|
+
readonly sequence: number;
|
|
716
|
+
readonly instanceId: InstanceId;
|
|
717
|
+
readonly operationId: OperationId;
|
|
718
|
+
readonly callback: CallbackRef<string, string>;
|
|
719
|
+
readonly source: "late-result" | "reconciled" | "confirmed";
|
|
720
|
+
readonly result: JsonValue;
|
|
721
|
+
readonly recordedAt: string;
|
|
722
|
+
};
|
|
723
|
+
/** Every persisted instance with unfinished execution, ordered by instance ID. */
|
|
724
|
+
type DeploymentBlocked = {
|
|
725
|
+
readonly outcome: "blocked";
|
|
726
|
+
readonly blockers: readonly DeploymentBlocker[];
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* `runtime.handover()`: either the runtime closed and released the database, or nothing changed
|
|
730
|
+
* and the old application keeps running.
|
|
731
|
+
*/
|
|
732
|
+
type HandoverResult = {
|
|
733
|
+
readonly outcome: "handed-over";
|
|
734
|
+
} | DeploymentBlocked;
|
|
735
|
+
/** `checkDeployment()` against a database no runtime owns. */
|
|
736
|
+
type DeploymentCheck = {
|
|
737
|
+
readonly outcome: "ready";
|
|
738
|
+
} | DeploymentBlocked | {
|
|
739
|
+
readonly outcome: "owned";
|
|
740
|
+
readonly message: string;
|
|
741
|
+
};
|
|
566
742
|
|
|
567
|
-
type
|
|
743
|
+
type UnmanagedRuntimeOptions = {
|
|
568
744
|
/** Persistent SQLite file owned by State Flow, or `":memory:"` for disposable runs. */
|
|
569
745
|
readonly databasePath: string;
|
|
570
746
|
/** Receives subscriber failures, which never affect execution (ADR 0059). Defaults to console.error. */
|
|
@@ -575,44 +751,72 @@ type DurableRuntimeOptions = {
|
|
|
575
751
|
*/
|
|
576
752
|
readonly onRecoveryError?: (error: unknown) => void;
|
|
577
753
|
};
|
|
578
|
-
type
|
|
579
|
-
/**
|
|
580
|
-
|
|
754
|
+
type Runtime = {
|
|
755
|
+
/**
|
|
756
|
+
* Validates a compiled module, including every handler's recovery declaration, and registers it
|
|
757
|
+
* with its dependencies before any handler runs (ADR 0046, 0090). Rejects with `DefinitionError`
|
|
758
|
+
* for an invalid module and `InputError` when the flow is already registered.
|
|
759
|
+
*/
|
|
760
|
+
createFlow<StateName extends string, TransitionPayloads extends Record<string, unknown>, Dependencies, EndpointMap extends EndpointMapFor<StateName>, Handlers extends HandlerTable, Scopes = Record<never, never>, Input = null>(compiled: CompiledFlowModule<StateName, TransitionPayloads, Dependencies, EndpointMap, Handlers, Scopes, Input> & PayloadCheck<TransitionPayloads>,
|
|
581
761
|
/**
|
|
582
|
-
*
|
|
583
|
-
*
|
|
762
|
+
* Implementations of the handler-owned dependency interfaces (`context.dependencies`). A
|
|
763
|
+
* Flow that places other Flows uses each placed Flow's registered dependencies, so register
|
|
764
|
+
* placed Flows first (ADR 0096).
|
|
584
765
|
*/
|
|
585
|
-
|
|
766
|
+
dependencies: Dependencies): Promise<RegisteredFlow<StateName, TransitionPayloads, EndpointMap, Scopes>>;
|
|
586
767
|
/**
|
|
587
768
|
* Stops admission and recovery scheduling, aborts handler signals, lets active work checkpoint,
|
|
588
769
|
* and releases the database (ADR 0061). With `timeoutMs`, rejects with
|
|
589
|
-
* `
|
|
770
|
+
* `ShutdownTimeoutError` if callbacks are still running; the lock is kept until they
|
|
590
771
|
* settle or the process exits.
|
|
591
772
|
*/
|
|
592
773
|
close(options?: {
|
|
593
774
|
readonly timeoutMs?: number;
|
|
594
775
|
}): Promise<void>;
|
|
776
|
+
/**
|
|
777
|
+
* The deployment gate (ADR 0091, 0094). Resolves `blocked`, listing every persisted instance
|
|
778
|
+
* that is running, recovering or needs attention, and changes nothing: the application keeps
|
|
779
|
+
* running. Otherwise it closes the runtime in the same step and resolves `handed-over` once the
|
|
780
|
+
* database is released; a deployment abandoned after that restarts this build. Rejects when the
|
|
781
|
+
* check fails, and with `ShutdownTimeoutError` when the close times out: neither permits a
|
|
782
|
+
* deployment.
|
|
783
|
+
*/
|
|
784
|
+
handover(options?: {
|
|
785
|
+
readonly timeoutMs?: number;
|
|
786
|
+
}): Promise<HandoverResult>;
|
|
595
787
|
/**
|
|
596
788
|
* Cross-instance access for operator tools such as the companion UI: listing, snapshots and
|
|
597
789
|
* history straight from storage, runtime-wide subscriptions, and manual resolution. The
|
|
598
790
|
* application authorizes every resolve call it forwards (ADR 0062, 0063).
|
|
599
791
|
*/
|
|
600
|
-
readonly inspector:
|
|
792
|
+
readonly inspector: RuntimeInspector;
|
|
601
793
|
/** Explicit operator capability; pass inspector alone to read-only tools. */
|
|
602
|
-
readonly controls:
|
|
794
|
+
readonly controls: RuntimeControls;
|
|
603
795
|
};
|
|
604
|
-
type
|
|
796
|
+
type RuntimeInspector = {
|
|
797
|
+
/** Root instances; nested scopes appear in their root's snapshot (`scopes`). */
|
|
605
798
|
listInstances(query?: InstanceQuery): InstancePage;
|
|
606
799
|
/** `null` when no instance has this ID. */
|
|
607
|
-
getSnapshot(instanceId: InstanceId):
|
|
800
|
+
getSnapshot(instanceId: InstanceId): InstanceSnapshot<string, string> | null;
|
|
608
801
|
history(instanceId: InstanceId, query?: HistoryQuery): HistoryPage;
|
|
609
802
|
/** Snapshots of every instance this runtime executes, after each change. */
|
|
610
|
-
subscribe(listener: (snapshot:
|
|
803
|
+
subscribe(listener: (snapshot: InstanceSnapshot<string, string>) => unknown): () => void;
|
|
804
|
+
/**
|
|
805
|
+
* Late outcomes of interrupted work the application has not acknowledged, oldest first
|
|
806
|
+
* (ADR 0095, 0096). Durable: they survive restarts until `controls.acknowledgeLateOutcome`.
|
|
807
|
+
*/
|
|
808
|
+
lateOutcomes(query?: {
|
|
809
|
+
readonly instanceId?: InstanceId;
|
|
810
|
+
}): readonly LateOutcome[];
|
|
811
|
+
/** Called after each newly recorded late outcome commits. */
|
|
812
|
+
subscribeLateOutcomes(listener: (outcome: LateOutcome) => unknown): () => void;
|
|
611
813
|
};
|
|
612
|
-
type
|
|
814
|
+
type RuntimeControls = {
|
|
815
|
+
/** Marks a late outcome handled. False when it was already acknowledged or does not exist. */
|
|
816
|
+
acknowledgeLateOutcome(sequence: number): boolean;
|
|
613
817
|
/**
|
|
614
|
-
* Resolves unresolved work using the flow registered for the instance's
|
|
615
|
-
* instance if needed. When no registered flow can load it (unknown
|
|
818
|
+
* Resolves unresolved work using the flow registered for the instance's flow, opening the
|
|
819
|
+
* instance if needed. When no registered flow can load it (unknown flow, definition or
|
|
616
820
|
* handler-revision mismatch), only `terminate` is accepted, and it runs no handler; other
|
|
617
821
|
* actions return `unavailable`.
|
|
618
822
|
*/
|
|
@@ -621,76 +825,100 @@ type DurableControls = {
|
|
|
621
825
|
restartRecovery(instanceId: InstanceId): boolean;
|
|
622
826
|
};
|
|
623
827
|
type TransitionNameOf<TransitionPayloads> = Extract<keyof TransitionPayloads, string>;
|
|
624
|
-
type
|
|
625
|
-
|
|
626
|
-
run(): Promise<DurableFlow<StateName, TransitionPayloads, EndpointMap, true, true>>;
|
|
627
|
-
};
|
|
628
|
-
};
|
|
629
|
-
type EnsureInstanceBuilder<StateName extends string, TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<StateName>> = {
|
|
630
|
-
run(): Promise<DurableInstance<StateName, TransitionPayloads, EndpointMap, true>>;
|
|
631
|
-
handleEnsureInstance<Handlers extends EnsureOutcomeHandlers>(handlers: ExactHandlers<Handlers, EnsureOutcomeHandlers>): {
|
|
632
|
-
run(): Promise<DurableInstance<StateName, TransitionPayloads, EndpointMap, true>>;
|
|
633
|
-
};
|
|
634
|
-
};
|
|
635
|
-
type DurableFlow<StateName extends string, TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<StateName>, HasDispatchPolicy extends boolean = false, HasFlowFailurePolicy extends boolean = false> = {
|
|
636
|
-
readonly chartName: string;
|
|
828
|
+
type RegisteredFlow<StateName extends string, TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<StateName>, Scopes = Record<never, never>> = {
|
|
829
|
+
readonly flowName: string;
|
|
637
830
|
readonly definitionId: string;
|
|
638
|
-
/**
|
|
639
|
-
|
|
831
|
+
/**
|
|
832
|
+
* The only way to acquire an instance (ADR 0090): opens it, or creates it once when absent, and
|
|
833
|
+
* starts required recovery. Acquiring does not imply readiness. Rejects with
|
|
834
|
+
* `DefinitionMismatchError` when the stored instance belongs to another definition or has
|
|
835
|
+
* unresolved work from other handler code. To avoid creating, check
|
|
836
|
+
* `runtime.inspector.getSnapshot(instanceId)` first.
|
|
837
|
+
*/
|
|
838
|
+
ensureInstance(input: {
|
|
640
839
|
readonly instanceId: InstanceId;
|
|
641
|
-
})
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
840
|
+
}): Promise<FlowInstance<StateName, TransitionPayloads, EndpointMap, Scopes>>;
|
|
841
|
+
};
|
|
842
|
+
/** Composition-path segments that address a single activation (not a FlowList). */
|
|
843
|
+
type SingleSegment<Scopes> = {
|
|
844
|
+
[K in keyof Scopes & string]: Scopes[K] extends {
|
|
845
|
+
readonly list: false;
|
|
846
|
+
} ? K : never;
|
|
847
|
+
}[keyof Scopes & string];
|
|
848
|
+
/** Composition-path segments of FlowLists, addressed with a member key. */
|
|
849
|
+
type ListSegment<Scopes> = {
|
|
850
|
+
[K in keyof Scopes & string]: Scopes[K] extends {
|
|
851
|
+
readonly list: true;
|
|
852
|
+
} ? K : never;
|
|
853
|
+
}[keyof Scopes & string];
|
|
854
|
+
type ScopeHandleFor<Entry> = Entry extends {
|
|
855
|
+
readonly states: infer StateName extends string;
|
|
856
|
+
readonly endpoints: infer EndpointMap extends EndpointMapFor<string>;
|
|
857
|
+
readonly payloads: infer Payloads extends Record<string, unknown>;
|
|
858
|
+
readonly scopes: infer Nested;
|
|
859
|
+
} ? ScopeHandle<StateName, Payloads, EndpointMap, Nested> : never;
|
|
860
|
+
/** States of a scope with at least one dispatchable Transition. */
|
|
861
|
+
type ScopeFromStates<EndpointMap> = {
|
|
862
|
+
[K in keyof EndpointMap]: EndpointMap[K] extends {
|
|
863
|
+
readonly fromState: infer From extends string;
|
|
864
|
+
} ? From : never;
|
|
865
|
+
}[keyof EndpointMap];
|
|
866
|
+
/** Typed access to nested scopes (ADR 0096): one level per call, chained for deeper scopes. */
|
|
867
|
+
type ScopeNavigation<Scopes> = {
|
|
868
|
+
/**
|
|
869
|
+
* The active activation at `segment` (`state` for a compound State, `state:region` for a
|
|
870
|
+
* parallel region). Resolved at each call, so a handle never reaches an exited activation.
|
|
871
|
+
*/
|
|
872
|
+
scope<Segment extends SingleSegment<Scopes>>(segment: Segment): ScopeHandleFor<Scopes[Segment]>;
|
|
873
|
+
/** One FlowList member by key. */
|
|
874
|
+
scope<Segment extends ListSegment<Scopes>>(segment: Segment, memberKey: string): ScopeHandleFor<Scopes[Segment]>;
|
|
875
|
+
};
|
|
876
|
+
/** A nested scope addressed by composition path; every call resolves its current activation. */
|
|
877
|
+
type ScopeHandle<StateName extends string, TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<string>, Scopes> = ScopeNavigation<Scopes> & {
|
|
878
|
+
/** Composition path from the root, for example `workspace:uploads`. */
|
|
879
|
+
readonly path: string;
|
|
880
|
+
readonly memberKey: string | null;
|
|
881
|
+
/** The active activation's snapshot, or `null` when none is active. */
|
|
882
|
+
getSnapshot(): InstanceSnapshot<StateName, TransitionNameOf<TransitionPayloads>> | null;
|
|
883
|
+
/** History of the active activation; empty when none is active. */
|
|
884
|
+
history(query?: HistoryQuery): HistoryPage;
|
|
885
|
+
/**
|
|
886
|
+
* Dispatch to the active activation from `state`. Besides the root outcomes, `interrupted`
|
|
887
|
+
* reports an execution a parent Transition interrupted and `inactive` an absent activation.
|
|
888
|
+
* A duplicate request ID always refers to its original activation (ADR 0095).
|
|
889
|
+
*/
|
|
890
|
+
when<From extends ScopeFromStates<EndpointMap> & StateName>(state: From): {
|
|
891
|
+
handle<Handlers extends ScopedDispatchOutcomeHandlers<StateName, TransitionNameOf<TransitionPayloads>, DispatchInput<TransitionPayloads, EndpointMap, From>, From>>(handlers: ExactHandlers<Handlers, ScopedDispatchOutcomeHandlers<StateName, string, unknown, From>>): {
|
|
892
|
+
dispatch(input: DispatchInput<TransitionPayloads, EndpointMap, From>): Promise<HandlerResult<Handlers>>;
|
|
893
|
+
};
|
|
661
894
|
};
|
|
662
895
|
};
|
|
663
|
-
type
|
|
896
|
+
type FlowInstance<StateName extends string, TransitionPayloads extends Record<string, unknown>, EndpointMap extends EndpointMapFor<StateName>, Scopes = Record<never, never>> = ScopeNavigation<Scopes> & {
|
|
664
897
|
readonly instanceId: InstanceId;
|
|
665
|
-
getSnapshot():
|
|
898
|
+
getSnapshot(): InstanceSnapshot<StateName, TransitionNameOf<TransitionPayloads>>;
|
|
666
899
|
/** Called after every committed state or status change. Returns an unsubscribe function. */
|
|
667
|
-
subscribe(listener: (snapshot:
|
|
900
|
+
subscribe(listener: (snapshot: InstanceSnapshot<StateName, TransitionNameOf<TransitionPayloads>>) => unknown): () => void;
|
|
668
901
|
/** One page of this instance's execution history (ADR 0072). */
|
|
669
902
|
history(query?: HistoryQuery): HistoryPage;
|
|
670
|
-
/**
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
903
|
+
/**
|
|
904
|
+
* Dispatch from `state`: `handle` takes one callback per outcome, checked exhaustively at compile
|
|
905
|
+
* time, and returns a reusable dispatcher. The promise resolves to the selected callback's value;
|
|
906
|
+
* only programmer misuse and infrastructure failures reject (ADR 0090).
|
|
907
|
+
*/
|
|
908
|
+
when<From extends StatesWithOutgoing<StateName, EndpointMap>>(state: From): {
|
|
909
|
+
handle<Handlers extends DispatchOutcomeHandlers<StateName, TransitionNameOf<TransitionPayloads>, DispatchInput<TransitionPayloads, EndpointMap, From>, From>>(handlers: ExactHandlers<Handlers, DispatchOutcomeHandlers<StateName, string, unknown, From>>): {
|
|
910
|
+
dispatch(input: DispatchInput<TransitionPayloads, EndpointMap, From>): Promise<HandlerResult<Handlers>>;
|
|
676
911
|
};
|
|
677
912
|
};
|
|
678
|
-
/** Exhaustive outcome mapping for manual actions;
|
|
913
|
+
/** Exhaustive outcome mapping for manual actions; `runtime.controls` holds the raw primitive. */
|
|
679
914
|
handleResolve<Handlers extends ResolveOutcomeHandlers<StateName, TransitionNameOf<TransitionPayloads>>>(handlers: ExactHandlers<Handlers, ResolveOutcomeHandlers<StateName, TransitionNameOf<TransitionPayloads>>>): {
|
|
680
915
|
resolve(input: ResolveInput<StateName>): Promise<HandlerResult<Handlers>>;
|
|
681
916
|
};
|
|
682
917
|
handleRestart<Handlers extends RestartOutcomeHandlers>(handlers: ExactHandlers<Handlers, RestartOutcomeHandlers>): {
|
|
683
918
|
restart(): HandlerResult<Handlers> | Promise<HandlerResult<Handlers>>;
|
|
684
919
|
};
|
|
685
|
-
/** @deprecated Application instances use handleResolve; raw resolution is for trusted operator tooling. */
|
|
686
|
-
resolve(input: ResolveInput<StateName>): Promise<ResolveResult<StateName, TransitionNameOf<TransitionPayloads>>>;
|
|
687
|
-
/**
|
|
688
|
-
* @deprecated Application instances use handleRestart; raw restart is for trusted operator tooling.
|
|
689
|
-
* Returns false when the instance is not stalled or is executing.
|
|
690
|
-
*/
|
|
691
|
-
restartRecovery(): boolean;
|
|
692
920
|
};
|
|
693
|
-
declare function
|
|
921
|
+
declare function createUnmanagedRuntime(options: UnmanagedRuntimeOptions): Runtime;
|
|
694
922
|
|
|
695
923
|
/** Validates an application-supplied flow instance identity. */
|
|
696
924
|
declare function instanceId(value: string): InstanceId;
|
|
@@ -706,18 +934,64 @@ declare const MAX_ATTEMPTS = 4;
|
|
|
706
934
|
/** Delay before the next automatic attempt, indexed by attempts already used minus one. */
|
|
707
935
|
declare const RECOVERY_DELAYS_MS: readonly [1000, 5000, 30000];
|
|
708
936
|
|
|
709
|
-
|
|
937
|
+
/** Base class for durable runtime rejections (infrastructure, defects, invalid input). */
|
|
938
|
+
declare class RuntimeError extends Error {
|
|
939
|
+
constructor(message: string, options?: {
|
|
940
|
+
cause?: unknown;
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
/** Another runtime already owns the database (ADR 0047). */
|
|
944
|
+
declare class OwnershipError extends RuntimeError {
|
|
945
|
+
}
|
|
946
|
+
/** The runtime is closing or closed and admits no new work (ADR 0061). */
|
|
947
|
+
declare class RuntimeClosedError extends RuntimeError {
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* `close({ timeoutMs })` elapsed while callbacks were still running. The runtime keeps the
|
|
951
|
+
* database lock; exit the process to release it (ADR 0075).
|
|
952
|
+
*/
|
|
953
|
+
declare class ShutdownTimeoutError extends RuntimeError {
|
|
954
|
+
}
|
|
955
|
+
/** A compiled module failed startup validation before any handler ran (ADR 0046). */
|
|
956
|
+
declare class DefinitionError extends RuntimeError {
|
|
957
|
+
readonly problems: readonly string[];
|
|
958
|
+
constructor(flowName: string, problems: readonly string[]);
|
|
959
|
+
}
|
|
960
|
+
/** Input that cannot become trusted durable data (IDs, payloads, transitions). */
|
|
961
|
+
declare class InputError extends RuntimeError {
|
|
962
|
+
}
|
|
963
|
+
/** The database was written by a newer State Flow schema. */
|
|
964
|
+
declare class SchemaError extends RuntimeError {
|
|
965
|
+
}
|
|
966
|
+
/** Stored instances remain untouched when their definition or handler revision is incompatible. */
|
|
967
|
+
declare class DefinitionMismatchError extends RuntimeError {
|
|
968
|
+
readonly context: DefinitionMismatchContext;
|
|
969
|
+
constructor(context: DefinitionMismatchContext);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* The deployment gate for a database no runtime owns, for example after a crash or a manual
|
|
974
|
+
* stop (ADR 0094). It takes ownership for the check and releases it before returning, so it
|
|
975
|
+
* reports `owned` rather than readiness while a runtime is live. It never creates or upgrades the
|
|
976
|
+
* database or changes its data; a missing or foreign file throws, and other failures throw too: only
|
|
977
|
+
* `ready` permits a deployment.
|
|
978
|
+
*/
|
|
979
|
+
declare function checkDeployment(options: {
|
|
980
|
+
readonly databasePath: string;
|
|
981
|
+
}): DeploymentCheck;
|
|
982
|
+
|
|
983
|
+
type RuntimeOptions = UnmanagedRuntimeOptions & {
|
|
710
984
|
readonly shutdownTimeoutMs?: number;
|
|
711
985
|
};
|
|
712
986
|
/** A standalone runtime whose asynchronous disposal releases its database ownership. */
|
|
713
|
-
type ManagedRuntime =
|
|
987
|
+
type ManagedRuntime = Runtime & {
|
|
714
988
|
[Symbol.asyncDispose](): Promise<void>;
|
|
715
989
|
};
|
|
716
990
|
/** Use `await using runtime = createRuntime(options)` for automatic cleanup at scope exit. */
|
|
717
991
|
declare function createRuntime(options: RuntimeOptions): ManagedRuntime;
|
|
718
992
|
|
|
719
993
|
/** Owns runtime cleanup even when registration, execution, or response handling throws. */
|
|
720
|
-
declare function
|
|
994
|
+
declare function withRuntime<Result>(options: RuntimeOptions, run: (runtime: Runtime) => Result | Promise<Result>): Promise<Awaited<Result>>;
|
|
721
995
|
|
|
722
996
|
type TargetBase<StateName extends string> = {
|
|
723
997
|
retry(reason: string): ResolveInput<StateName>;
|
|
@@ -731,9 +1005,20 @@ type RecoveryTarget<StateName extends string> = TargetBase<StateName> & ({
|
|
|
731
1005
|
readonly callback: "resolve-start-state";
|
|
732
1006
|
confirm(result: StateName, reason: string): ResolveInput<StateName>;
|
|
733
1007
|
} | {
|
|
734
|
-
readonly callback: "on-enter" | "on-exit"
|
|
1008
|
+
readonly callback: "on-enter" | "on-exit";
|
|
735
1009
|
confirm(reason: string): ResolveInput<StateName>;
|
|
1010
|
+
} | {
|
|
1011
|
+
readonly callback: "children";
|
|
1012
|
+
/** The child inputs and FlowList members the callback produced (ADR 0096). */
|
|
1013
|
+
confirm(result: JsonValue, reason: string): ResolveInput<StateName>;
|
|
1014
|
+
} | {
|
|
1015
|
+
readonly callback: "on-transition";
|
|
1016
|
+
/**
|
|
1017
|
+
* A branching transition needs the destination the operation selected; a fixed
|
|
1018
|
+
* destination takes none. The runtime rejects an undeclared or missing destination.
|
|
1019
|
+
*/
|
|
1020
|
+
confirm(reason: string, destination?: StateName): ResolveInput<StateName>;
|
|
736
1021
|
});
|
|
737
1022
|
declare function recoveryTarget<StateName extends string>(work: UnresolvedWork<StateName, string>): RecoveryTarget<StateName>;
|
|
738
1023
|
|
|
739
|
-
export { type
|
|
1024
|
+
export { type AttemptId, type BlockingStatusKind, type BranchingTransitionHandlers, type Callback, type CallbackContext, type CallbackKind, type CallbackRef, type ChildInputsOf, type ChildrenCallback, type CompiledFlowModule, type CompletedDecision, type CompositeStateHandlers, type CreationHandlers, DefinitionError, type DefinitionMismatchContext, DefinitionMismatchError, type DeploymentBlocked, type DeploymentBlocker, type DeploymentCheck, type DestinationOf, type DispatchInput, type DispatchOutcome, type DispatchOutcomeHandlers, type EndpointMapFor, type ExactHandlers, type ExecutionContext, type ExecutionStatus, type ExecutionStatusKind, type FlowInstance, type Guard, type HandlerResult, type HandlerTable, type HandoverResult, type HistoryEvent, type HistoryEventType, type HistoryPage, type HistoryQuery, InputError, type InstanceId, type InstancePage, type InstanceQuery, type InstanceSnapshot, type InstanceStatusKind, type InstanceSummary, type IsJsonCompatible, type JsonCompatible, type JsonPrimitive, type JsonValue, type LateOutcome, type ListMember, MAX_ATTEMPTS, type ManagedRuntime, type NonJsonPayloadTransitions, type OperationId, type OperationInfo, type OutgoingFrom, OwnershipError, type PayloadCheck, RECOVERY_DELAYS_MS, type ReconcileContext, type ReconcileDecision, type RecoveryCause, type RecoveryDeclaration, type RecoveryStrategy, type RecoveryTarget, type RegisteredFlow, type RequestId, type ResolveInput, type ResolveOutcomeHandlers, type ResolveRejection, type ResolveResult, type RestartOutcomeHandlers, type Runtime, RuntimeClosedError, type RuntimeControls, RuntimeError, type RuntimeInspector, type RuntimeOptions, SchemaError, type ScopeEntry, type ScopeMap, type ScopeRef, type ScopeSnapshot, type ScopedDispatchOutcome, type ScopedDispatchOutcomeHandlers, ShutdownTimeoutError, type StartStateResolver, type StateCallback, type StateHandlers, type StatesWithOutgoing, type TransitionCallback, type TransitionHandlers, type UnmanagedRuntimeOptions, type UnresolvedWork, type UnvalidatedDispatchInput, checkDeployment, createRuntime, createUnmanagedRuntime, instanceId, parseResolveInput, recoveryTarget, requestId, resolveInputSchema, withRuntime };
|