@superdurable/dex 0.1.2 → 0.1.4
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 +82 -3
- package/dist/src/attribute-store-sync.d.ts +5 -0
- package/dist/src/attribute-store-sync.js +19 -0
- package/dist/src/attribute-store-sync.js.map +1 -0
- package/dist/src/blob-cache.d.ts +36 -0
- package/dist/src/blob-cache.js +13 -0
- package/dist/src/blob-cache.js.map +1 -1
- package/dist/src/client.d.ts +186 -5
- package/dist/src/client.js +174 -33
- package/dist/src/client.js.map +1 -1
- package/dist/src/codec.d.ts +73 -0
- package/dist/src/codec.js +23 -0
- package/dist/src/codec.js.map +1 -1
- package/dist/src/context.d.ts +80 -0
- package/dist/src/errors.d.ts +122 -6
- package/dist/src/errors.js +139 -9
- package/dist/src/errors.js.map +1 -1
- package/dist/src/flow.d.ts +36 -1
- package/dist/src/flow.js +96 -28
- package/dist/src/flow.js.map +1 -1
- package/dist/src/gen/dex.d.ts +58 -9
- package/dist/src/gen/dex.js +417 -55
- package/dist/src/gen/dex.js.map +1 -1
- package/dist/src/grpc-status.d.ts +5 -4
- package/dist/src/grpc-status.js +52 -6
- package/dist/src/grpc-status.js.map +1 -1
- package/dist/src/invocation-context.js +3 -0
- package/dist/src/invocation-context.js.map +1 -1
- package/dist/src/options.d.ts +162 -0
- package/dist/src/options.js +53 -0
- package/dist/src/options.js.map +1 -1
- package/dist/src/persistence.d.ts +103 -0
- package/dist/src/persistence.js +98 -0
- package/dist/src/persistence.js.map +1 -1
- package/dist/src/rpc.d.ts +58 -5
- package/dist/src/rpc.js +17 -0
- package/dist/src/rpc.js.map +1 -1
- package/dist/src/step.d.ts +164 -2
- package/dist/src/step.js +85 -0
- package/dist/src/step.js.map +1 -1
- package/dist/src/value-mapper.d.ts +1 -0
- package/dist/src/value-mapper.js +75 -14
- package/dist/src/value-mapper.js.map +1 -1
- package/dist/src/wait.d.ts +180 -0
- package/dist/src/wait.js +157 -0
- package/dist/src/wait.js.map +1 -1
- package/dist/src/worker-dispatcher.js +55 -29
- package/dist/src/worker-dispatcher.js.map +1 -1
- package/dist/src/worker.d.ts +30 -1
- package/dist/src/worker.js +48 -2
- package/dist/src/worker.js.map +1 -1
- package/native/linux-aarch64/dex_blob_cache_node.node +0 -0
- package/native/linux-x86_64/dex_blob_cache_node.node +0 -0
- package/native/macos-aarch64/dex_blob_cache_node.node +0 -0
- package/native/macos-x86_64/dex_blob_cache_node.node +0 -0
- package/native/windows-x86_64/dex_blob_cache_node.node +0 -0
- package/package.json +2 -1
package/dist/src/step.d.ts
CHANGED
|
@@ -2,40 +2,105 @@ import type { Codec } from "./codec.js";
|
|
|
2
2
|
import type { Context } from "./context.js";
|
|
3
3
|
import type { AttributeLock } from "./persistence.js";
|
|
4
4
|
import type { Channel, ChannelMap, Wait } from "./wait.js";
|
|
5
|
+
/** Controls when a Step handler result is durably acknowledged. */
|
|
5
6
|
export type StepDurability = "sync" | "async";
|
|
7
|
+
/** Controls whether exhausted `waitFor` failures fail the Flow or run `execute`. */
|
|
6
8
|
export type WaitForFailurePolicy = "failFlow" | "proceed";
|
|
9
|
+
/** Configures exponential retries for a Step handler or Flow. */
|
|
7
10
|
export interface RetryPolicy {
|
|
11
|
+
/** Delay before the first retry in milliseconds. */
|
|
8
12
|
readonly initialIntervalMs?: number;
|
|
13
|
+
/** Retry-delay multiplier; uses the server default when omitted. */
|
|
9
14
|
readonly backoffCoefficient?: number;
|
|
15
|
+
/** Upper bound for one retry delay in milliseconds. */
|
|
10
16
|
readonly maximumIntervalMs?: number;
|
|
17
|
+
/** Total attempt limit including the initial call. */
|
|
11
18
|
readonly maximumAttempts?: number;
|
|
19
|
+
/** Overall elapsed-time limit in milliseconds. */
|
|
12
20
|
readonly totalDurationMs?: number;
|
|
13
21
|
}
|
|
22
|
+
/** Routes exhausted `execute` retries to a fallback Step. */
|
|
14
23
|
export interface ExecuteFailure {
|
|
24
|
+
/** Registered fallback Step. */
|
|
15
25
|
readonly step: Step<unknown>;
|
|
26
|
+
/** Options applied to the fallback movement. */
|
|
16
27
|
readonly options?: StepOptions;
|
|
17
28
|
}
|
|
29
|
+
/** Creates execute-failure routing settings. */
|
|
18
30
|
export declare const ExecuteFailure: Readonly<{
|
|
31
|
+
/**
|
|
32
|
+
* Routes exhausted execution retries to another Step.
|
|
33
|
+
* @typeParam Input - Fallback Step input type.
|
|
34
|
+
* @param step - Registered fallback Step.
|
|
35
|
+
* @param options - Optional options for the fallback movement.
|
|
36
|
+
* @returns The failure-routing settings.
|
|
37
|
+
*/
|
|
19
38
|
proceedTo<Input>(step: Step<Input>, options?: StepOptions): ExecuteFailure;
|
|
20
39
|
}>;
|
|
40
|
+
/** Configures timeouts, retries, durability, locks, and failure routing for a Step. */
|
|
21
41
|
export interface StepOptions {
|
|
42
|
+
/** Maximum duration of one `waitFor` attempt in milliseconds. */
|
|
22
43
|
readonly waitForMethodTimeoutMs?: number;
|
|
44
|
+
/** Maximum duration of one `execute` attempt in milliseconds. */
|
|
23
45
|
readonly executeMethodTimeoutMs?: number;
|
|
46
|
+
/** Optional retry policy for `waitFor`. */
|
|
24
47
|
readonly waitForRetry?: RetryPolicy;
|
|
48
|
+
/** Optional retry policy for `execute`. */
|
|
25
49
|
readonly executeRetry?: RetryPolicy;
|
|
50
|
+
/** Behavior after all `waitFor` attempts fail. */
|
|
26
51
|
readonly waitForFailure?: WaitForFailurePolicy;
|
|
52
|
+
/** Durability used for the `waitFor` result. */
|
|
27
53
|
readonly waitForDurability?: StepDurability;
|
|
54
|
+
/** Durability used for the `execute` result. */
|
|
28
55
|
readonly executeDurability?: StepDurability;
|
|
56
|
+
/** Attribute locks held during `waitFor`. */
|
|
29
57
|
readonly waitForLockAttributes?: readonly AttributeLock[];
|
|
58
|
+
/** Attribute locks held during `execute`. */
|
|
30
59
|
readonly executeLockAttributes?: readonly AttributeLock[];
|
|
60
|
+
/** Fallback routing after exhausted `execute` retries. */
|
|
31
61
|
readonly executeFailure?: ExecuteFailure;
|
|
32
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Defines one typed unit of durable Flow application logic.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const confirm: Step<string> = {
|
|
69
|
+
* inputCodec: stringCodec,
|
|
70
|
+
* getStepType: () => "Confirm",
|
|
71
|
+
* waitFor: () => Wait.until(Timer.byDuration(1_000)),
|
|
72
|
+
* execute: (_context, input) => forceComplete(input),
|
|
73
|
+
* };
|
|
74
|
+
* ```
|
|
75
|
+
* @typeParam Input - Value passed by an incoming Step movement.
|
|
76
|
+
*/
|
|
33
77
|
export interface Step<Input> {
|
|
78
|
+
/** Codec used for every incoming input value. */
|
|
34
79
|
readonly inputCodec: Codec<Input>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the protocol Step type.
|
|
82
|
+
* @returns A non-empty Step type unique within the containing Flow.
|
|
83
|
+
*/
|
|
35
84
|
getStepType(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Returns this Step's static options.
|
|
87
|
+
* @returns Static options, or `undefined` for Flow and server defaults.
|
|
88
|
+
*/
|
|
36
89
|
getStepOptions?(): StepOptions | undefined;
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Describes durable conditions required before execution.
|
|
92
|
+
* @param context - Current execution metadata and persistence operations.
|
|
93
|
+
* @param input - Decoded Step input.
|
|
94
|
+
* @returns A Wait or promise resolving to one.
|
|
95
|
+
*/
|
|
96
|
+
waitFor?(context: Context, input: Input): Wait | Promise<Wait>;
|
|
97
|
+
/**
|
|
98
|
+
* Runs application logic and produces the next durable decision.
|
|
99
|
+
* @param context - Current execution metadata and persistence operations.
|
|
100
|
+
* @param input - Decoded Step input.
|
|
101
|
+
* @returns A StepDecision or promise resolving to one.
|
|
102
|
+
*/
|
|
103
|
+
execute(context: Context, input: Input): StepDecision | Promise<StepDecision>;
|
|
39
104
|
}
|
|
40
105
|
interface StartStepDefinition<StartInput> {
|
|
41
106
|
readonly step: Step<StartInput>;
|
|
@@ -47,46 +112,143 @@ interface NonStartStepDefinition {
|
|
|
47
112
|
}
|
|
48
113
|
type StepDefinition = StartStepDefinition<unknown> | NonStartStepDefinition;
|
|
49
114
|
declare const startInputType: unique symbol;
|
|
115
|
+
/**
|
|
116
|
+
* Builds the ordered Step definitions for a Flow.
|
|
117
|
+
* @typeParam StartInput - Input type of the optional starting Step.
|
|
118
|
+
*/
|
|
50
119
|
export declare class StepList<StartInput> {
|
|
120
|
+
/** Compile-time brand preserving the starting input type. */
|
|
51
121
|
readonly [startInputType]: (input: StartInput) => StartInput;
|
|
52
122
|
private readonly definitions;
|
|
53
123
|
private constructor();
|
|
124
|
+
/**
|
|
125
|
+
* Creates a StepList with no Steps.
|
|
126
|
+
* @typeParam StartInput - Declared Flow start input type.
|
|
127
|
+
* @returns An empty StepList.
|
|
128
|
+
*/
|
|
54
129
|
static empty<StartInput = void>(): StepList<StartInput>;
|
|
130
|
+
/**
|
|
131
|
+
* Creates a StepList with one starting Step.
|
|
132
|
+
* @typeParam StartInput - Starting Step input type.
|
|
133
|
+
* @param step - Step receiving `startFlow` input.
|
|
134
|
+
* @returns A StepList with exactly one starting Step.
|
|
135
|
+
*/
|
|
55
136
|
static startStep<StartInput>(step: Step<StartInput>): StepList<StartInput>;
|
|
137
|
+
/**
|
|
138
|
+
* Creates a StepList containing only non-starting Steps.
|
|
139
|
+
* @typeParam StartInput - Declared start input; defaults to `never`.
|
|
140
|
+
* @param steps - Steps reachable through decisions, RPCs, or failure routing.
|
|
141
|
+
* @returns A StepList without a starting Step.
|
|
142
|
+
*/
|
|
56
143
|
static withoutStartStep<StartInput = never>(...steps: readonly Step<any>[]): StepList<StartInput>;
|
|
144
|
+
/**
|
|
145
|
+
* Returns a copy with non-starting Steps appended.
|
|
146
|
+
* @param steps - Registered Steps appended in argument order.
|
|
147
|
+
* @returns A new StepList.
|
|
148
|
+
*/
|
|
57
149
|
otherSteps(...steps: readonly Step<any>[]): StepList<StartInput>;
|
|
150
|
+
/**
|
|
151
|
+
* Iterates Step definitions in registration order.
|
|
152
|
+
* @returns An iterator over the registered Step definitions.
|
|
153
|
+
*/
|
|
58
154
|
[Symbol.iterator](): Iterator<StepDefinition>;
|
|
59
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Schedules one registered Step with typed input and optional options.
|
|
158
|
+
* @typeParam Input - Destination Step input type.
|
|
159
|
+
*/
|
|
60
160
|
export interface StepMovement<Input> {
|
|
161
|
+
/** Registered destination Step. */
|
|
61
162
|
readonly step: Step<Input>;
|
|
163
|
+
/** Value encoded for the destination Step. */
|
|
62
164
|
readonly input: Input;
|
|
165
|
+
/** Optional per-movement Step options. */
|
|
63
166
|
readonly options?: StepOptions;
|
|
64
167
|
}
|
|
168
|
+
/** Creates typed Step movements. */
|
|
65
169
|
export declare const StepMovement: Readonly<{
|
|
170
|
+
/**
|
|
171
|
+
* Creates a movement to one Step.
|
|
172
|
+
* @typeParam Input - Destination Step input type.
|
|
173
|
+
* @param step - Registered destination Step.
|
|
174
|
+
* @param input - Typed destination input.
|
|
175
|
+
* @param options - Optional per-movement options.
|
|
176
|
+
* @returns The new Step movement.
|
|
177
|
+
*/
|
|
66
178
|
of<Input>(step: Step<Input>, input: Input, options?: StepOptions): StepMovement<Input>;
|
|
67
179
|
}>;
|
|
180
|
+
/** Describes the durable transition returned by `Step.execute`. */
|
|
68
181
|
export type StepDecision = Readonly<{
|
|
182
|
+
/** Schedules next Step movements. */
|
|
69
183
|
kind: "next";
|
|
184
|
+
/** Ordered destination movements. */
|
|
70
185
|
movements: readonly StepMovement<unknown>[];
|
|
71
186
|
}> | Readonly<{
|
|
187
|
+
/** Requests graceful or immediate successful completion. */
|
|
72
188
|
kind: "gracefulComplete" | "forceComplete";
|
|
189
|
+
/** Codec-supported Flow result. */
|
|
73
190
|
output: unknown;
|
|
74
191
|
}> | Readonly<{
|
|
192
|
+
/** Completes only when selected Channels are empty. */
|
|
75
193
|
kind: "forceCompleteIfChannelsEmpty";
|
|
194
|
+
/** Codec-supported Flow result. */
|
|
76
195
|
output: unknown;
|
|
196
|
+
/** Movement scheduled when any selected Channel is non-empty. */
|
|
77
197
|
fallback: StepMovement<unknown>;
|
|
198
|
+
/** Registered Channels inspected for emptiness. */
|
|
78
199
|
channels: readonly (Channel<unknown> | ChannelMap<unknown>)[];
|
|
79
200
|
}> | Readonly<{
|
|
201
|
+
/** Requests immediate Flow failure. */
|
|
80
202
|
kind: "forceFail";
|
|
203
|
+
/** Application-readable failure detail. */
|
|
81
204
|
reason: string;
|
|
82
205
|
}> | Readonly<{
|
|
206
|
+
/** Ends this path without scheduling work or closing the Flow. */
|
|
83
207
|
kind: "deadEnd";
|
|
84
208
|
}>;
|
|
209
|
+
/**
|
|
210
|
+
* Creates a decision scheduling one next Step.
|
|
211
|
+
* @typeParam Input - Destination Step input type.
|
|
212
|
+
* @param step - Registered destination Step.
|
|
213
|
+
* @param input - Typed destination input.
|
|
214
|
+
* @returns A next decision containing one movement.
|
|
215
|
+
*/
|
|
85
216
|
export declare const goTo: <Input>(step: Step<Input>, input: Input) => StepDecision;
|
|
217
|
+
/**
|
|
218
|
+
* Creates a decision scheduling several next Steps.
|
|
219
|
+
* @param movements - Typed movements applied in argument order.
|
|
220
|
+
* @returns A next decision containing every movement.
|
|
221
|
+
*/
|
|
86
222
|
export declare const goToMulti: (...movements: readonly StepMovement<unknown>[]) => StepDecision;
|
|
223
|
+
/**
|
|
224
|
+
* Requests successful completion after already-scheduled Steps finish.
|
|
225
|
+
* @param output - Optional codec-supported Flow result.
|
|
226
|
+
* @returns A graceful-completion decision.
|
|
227
|
+
*/
|
|
87
228
|
export declare const gracefulComplete: (output?: unknown) => StepDecision;
|
|
229
|
+
/**
|
|
230
|
+
* Requests immediate successful completion.
|
|
231
|
+
* @param output - Optional codec-supported Flow result.
|
|
232
|
+
* @returns A force-completion decision.
|
|
233
|
+
*/
|
|
88
234
|
export declare const forceComplete: (output?: unknown) => StepDecision;
|
|
235
|
+
/**
|
|
236
|
+
* Completes only when selected Channels are empty, otherwise schedules a fallback.
|
|
237
|
+
* @param output - Codec-supported completion result.
|
|
238
|
+
* @param fallback - Movement used when any selected Channel is non-empty.
|
|
239
|
+
* @param channels - Registered Channel definitions to inspect.
|
|
240
|
+
* @returns A conditional force-completion decision.
|
|
241
|
+
*/
|
|
89
242
|
export declare const forceCompleteWhenChannelsEmpty: (output: unknown, fallback: StepMovement<unknown>, ...channels: readonly (Channel<unknown> | ChannelMap<unknown>)[]) => StepDecision;
|
|
243
|
+
/**
|
|
244
|
+
* Requests immediate Flow failure.
|
|
245
|
+
* @param reason - Non-empty application-readable failure detail.
|
|
246
|
+
* @returns A force-failure decision.
|
|
247
|
+
*/
|
|
90
248
|
export declare const forceFail: (reason: string) => StepDecision;
|
|
249
|
+
/**
|
|
250
|
+
* Creates a dead-end decision.
|
|
251
|
+
* @returns A decision ending this path without closing the Flow.
|
|
252
|
+
*/
|
|
91
253
|
export declare const deadEnd: () => StepDecision;
|
|
92
254
|
export {};
|
package/dist/src/step.js
CHANGED
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
// See the LICENSE file in the repository root.
|
|
6
6
|
//
|
|
7
7
|
// SPDX-License-Identifier: LicenseRef-Super-Durable-1.0
|
|
8
|
+
/** Creates execute-failure routing settings. */
|
|
8
9
|
export const ExecuteFailure = Object.freeze({
|
|
10
|
+
/**
|
|
11
|
+
* Routes exhausted execution retries to another Step.
|
|
12
|
+
* @typeParam Input - Fallback Step input type.
|
|
13
|
+
* @param step - Registered fallback Step.
|
|
14
|
+
* @param options - Optional options for the fallback movement.
|
|
15
|
+
* @returns The failure-routing settings.
|
|
16
|
+
*/
|
|
9
17
|
proceedTo(step, options) {
|
|
10
18
|
return {
|
|
11
19
|
step: step,
|
|
@@ -13,31 +21,70 @@ export const ExecuteFailure = Object.freeze({
|
|
|
13
21
|
};
|
|
14
22
|
},
|
|
15
23
|
});
|
|
24
|
+
/**
|
|
25
|
+
* Builds the ordered Step definitions for a Flow.
|
|
26
|
+
* @typeParam StartInput - Input type of the optional starting Step.
|
|
27
|
+
*/
|
|
16
28
|
export class StepList {
|
|
17
29
|
definitions;
|
|
18
30
|
constructor(definitions) {
|
|
19
31
|
this.definitions = Object.freeze([...definitions]);
|
|
20
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a StepList with no Steps.
|
|
35
|
+
* @typeParam StartInput - Declared Flow start input type.
|
|
36
|
+
* @returns An empty StepList.
|
|
37
|
+
*/
|
|
21
38
|
static empty() {
|
|
22
39
|
return new StepList([]);
|
|
23
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a StepList with one starting Step.
|
|
43
|
+
* @typeParam StartInput - Starting Step input type.
|
|
44
|
+
* @param step - Step receiving `startFlow` input.
|
|
45
|
+
* @returns A StepList with exactly one starting Step.
|
|
46
|
+
*/
|
|
24
47
|
static startStep(step) {
|
|
25
48
|
return new StepList([{ step: step, isStartStep: true }]);
|
|
26
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a StepList containing only non-starting Steps.
|
|
52
|
+
* @typeParam StartInput - Declared start input; defaults to `never`.
|
|
53
|
+
* @param steps - Steps reachable through decisions, RPCs, or failure routing.
|
|
54
|
+
* @returns A StepList without a starting Step.
|
|
55
|
+
*/
|
|
27
56
|
static withoutStartStep(...steps) {
|
|
28
57
|
return new StepList(steps.map((step) => ({ step: step, isStartStep: false })));
|
|
29
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns a copy with non-starting Steps appended.
|
|
61
|
+
* @param steps - Registered Steps appended in argument order.
|
|
62
|
+
* @returns A new StepList.
|
|
63
|
+
*/
|
|
30
64
|
otherSteps(...steps) {
|
|
31
65
|
return new StepList([
|
|
32
66
|
...this.definitions,
|
|
33
67
|
...steps.map((step) => ({ step: step, isStartStep: false })),
|
|
34
68
|
]);
|
|
35
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Iterates Step definitions in registration order.
|
|
72
|
+
* @returns An iterator over the registered Step definitions.
|
|
73
|
+
*/
|
|
36
74
|
[Symbol.iterator]() {
|
|
37
75
|
return this.definitions[Symbol.iterator]();
|
|
38
76
|
}
|
|
39
77
|
}
|
|
78
|
+
/** Creates typed Step movements. */
|
|
40
79
|
export const StepMovement = Object.freeze({
|
|
80
|
+
/**
|
|
81
|
+
* Creates a movement to one Step.
|
|
82
|
+
* @typeParam Input - Destination Step input type.
|
|
83
|
+
* @param step - Registered destination Step.
|
|
84
|
+
* @param input - Typed destination input.
|
|
85
|
+
* @param options - Optional per-movement options.
|
|
86
|
+
* @returns The new Step movement.
|
|
87
|
+
*/
|
|
41
88
|
of(step, input, options) {
|
|
42
89
|
return {
|
|
43
90
|
step,
|
|
@@ -46,17 +93,55 @@ export const StepMovement = Object.freeze({
|
|
|
46
93
|
};
|
|
47
94
|
},
|
|
48
95
|
});
|
|
96
|
+
/**
|
|
97
|
+
* Creates a decision scheduling one next Step.
|
|
98
|
+
* @typeParam Input - Destination Step input type.
|
|
99
|
+
* @param step - Registered destination Step.
|
|
100
|
+
* @param input - Typed destination input.
|
|
101
|
+
* @returns A next decision containing one movement.
|
|
102
|
+
*/
|
|
49
103
|
export const goTo = (step, input) => goToMulti(StepMovement.of(step, input));
|
|
104
|
+
/**
|
|
105
|
+
* Creates a decision scheduling several next Steps.
|
|
106
|
+
* @param movements - Typed movements applied in argument order.
|
|
107
|
+
* @returns A next decision containing every movement.
|
|
108
|
+
*/
|
|
50
109
|
export const goToMulti = (...movements) => ({
|
|
51
110
|
kind: "next",
|
|
52
111
|
movements,
|
|
53
112
|
});
|
|
113
|
+
/**
|
|
114
|
+
* Requests successful completion after already-scheduled Steps finish.
|
|
115
|
+
* @param output - Optional codec-supported Flow result.
|
|
116
|
+
* @returns A graceful-completion decision.
|
|
117
|
+
*/
|
|
54
118
|
export const gracefulComplete = (output) => ({
|
|
55
119
|
kind: "gracefulComplete",
|
|
56
120
|
output,
|
|
57
121
|
});
|
|
122
|
+
/**
|
|
123
|
+
* Requests immediate successful completion.
|
|
124
|
+
* @param output - Optional codec-supported Flow result.
|
|
125
|
+
* @returns A force-completion decision.
|
|
126
|
+
*/
|
|
58
127
|
export const forceComplete = (output) => ({ kind: "forceComplete", output });
|
|
128
|
+
/**
|
|
129
|
+
* Completes only when selected Channels are empty, otherwise schedules a fallback.
|
|
130
|
+
* @param output - Codec-supported completion result.
|
|
131
|
+
* @param fallback - Movement used when any selected Channel is non-empty.
|
|
132
|
+
* @param channels - Registered Channel definitions to inspect.
|
|
133
|
+
* @returns A conditional force-completion decision.
|
|
134
|
+
*/
|
|
59
135
|
export const forceCompleteWhenChannelsEmpty = (output, fallback, ...channels) => ({ kind: "forceCompleteIfChannelsEmpty", output, fallback, channels });
|
|
136
|
+
/**
|
|
137
|
+
* Requests immediate Flow failure.
|
|
138
|
+
* @param reason - Non-empty application-readable failure detail.
|
|
139
|
+
* @returns A force-failure decision.
|
|
140
|
+
*/
|
|
60
141
|
export const forceFail = (reason) => ({ kind: "forceFail", reason });
|
|
142
|
+
/**
|
|
143
|
+
* Creates a dead-end decision.
|
|
144
|
+
* @returns A decision ending this path without closing the Flow.
|
|
145
|
+
*/
|
|
61
146
|
export const deadEnd = () => ({ kind: "deadEnd" });
|
|
62
147
|
//# sourceMappingURL=step.js.map
|
package/dist/src/step.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../src/step.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,uDAAuD;AACvD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;
|
|
1
|
+
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../src/step.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,uDAAuD;AACvD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;AAkCxD,gDAAgD;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,M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MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,GAAiB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { Value as ProtoValue, type FlowServiceClient } from "./gen/dex.js";
|
|
|
4
4
|
export declare function encodeValue<T>(codec: Codec<T>, value: T): ProtoValue;
|
|
5
5
|
export declare function encodeUnknown(value: unknown): ProtoValue;
|
|
6
6
|
export declare function decodeValue<T>(codec: Codec<T>, value: ProtoValue): T;
|
|
7
|
+
export declare function decodeUnknown(value: ProtoValue): unknown;
|
|
7
8
|
export declare function deletionValue(): ProtoValue;
|
|
8
9
|
export declare class ValueHydrator {
|
|
9
10
|
private readonly service;
|
package/dist/src/value-mapper.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// See the LICENSE file in the repository root.
|
|
6
6
|
//
|
|
7
7
|
// SPDX-License-Identifier: LicenseRef-Super-Durable-1.0
|
|
8
|
+
import { ValueMappingError } from "./errors.js";
|
|
8
9
|
import { NullValue } from "./gen/google/protobuf/struct.js";
|
|
9
10
|
import { Value as ProtoValue, } from "./gen/dex.js";
|
|
10
11
|
const textEncoder = new TextEncoder();
|
|
@@ -13,7 +14,13 @@ export function encodeValue(codec, value) {
|
|
|
13
14
|
if (value === undefined || value === null) {
|
|
14
15
|
return objectValue("json", textEncoder.encode("null"));
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
let encoded;
|
|
18
|
+
try {
|
|
19
|
+
encoded = codec.encode(value);
|
|
20
|
+
}
|
|
21
|
+
catch (failure) {
|
|
22
|
+
throw mappingError("encode", failure);
|
|
23
|
+
}
|
|
17
24
|
switch (encoded.kind) {
|
|
18
25
|
case "string":
|
|
19
26
|
return ProtoValue.create({ kind: { $case: "stringValue", value: encoded.data } });
|
|
@@ -44,16 +51,22 @@ export function encodeUnknown(value) {
|
|
|
44
51
|
}
|
|
45
52
|
if (typeof value === "number") {
|
|
46
53
|
if (!Number.isFinite(value)) {
|
|
47
|
-
throw new
|
|
54
|
+
throw new ValueMappingError("encode", "non-finite numbers are unsupported");
|
|
48
55
|
}
|
|
49
56
|
return ProtoValue.create({ kind: { $case: "doubleValue", value } });
|
|
50
57
|
}
|
|
51
58
|
if (value instanceof Uint8Array) {
|
|
52
59
|
return objectValue("rawbytes", value);
|
|
53
60
|
}
|
|
54
|
-
|
|
61
|
+
let json;
|
|
62
|
+
try {
|
|
63
|
+
json = JSON.stringify(value);
|
|
64
|
+
}
|
|
65
|
+
catch (failure) {
|
|
66
|
+
throw mappingError("encode", failure);
|
|
67
|
+
}
|
|
55
68
|
if (json === undefined) {
|
|
56
|
-
throw new
|
|
69
|
+
throw new ValueMappingError("encode", "value cannot be encoded as JSON");
|
|
57
70
|
}
|
|
58
71
|
return objectValue("json", textEncoder.encode(json));
|
|
59
72
|
}
|
|
@@ -63,7 +76,48 @@ export function decodeValue(codec, value) {
|
|
|
63
76
|
textDecoder.decode(value.kind.value.payload) === "null") {
|
|
64
77
|
return undefined;
|
|
65
78
|
}
|
|
66
|
-
|
|
79
|
+
try {
|
|
80
|
+
return codec.decode(toCodecValue(value));
|
|
81
|
+
}
|
|
82
|
+
catch (failure) {
|
|
83
|
+
throw mappingError("decode", failure);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function decodeUnknown(value) {
|
|
87
|
+
const kind = value.kind;
|
|
88
|
+
if (kind === undefined) {
|
|
89
|
+
throw new ValueMappingError("decode", "Value has no concrete kind");
|
|
90
|
+
}
|
|
91
|
+
switch (kind.$case) {
|
|
92
|
+
case "stringValue":
|
|
93
|
+
return kind.value;
|
|
94
|
+
case "boolValue":
|
|
95
|
+
return kind.value;
|
|
96
|
+
case "intValue":
|
|
97
|
+
return kind.value;
|
|
98
|
+
case "doubleValue":
|
|
99
|
+
return kind.value;
|
|
100
|
+
case "objValue": {
|
|
101
|
+
const object = kind.value;
|
|
102
|
+
if (object.encoding === "rawbytes") {
|
|
103
|
+
return object.payload;
|
|
104
|
+
}
|
|
105
|
+
if (object.encoding === "json") {
|
|
106
|
+
try {
|
|
107
|
+
return JSON.parse(textDecoder.decode(object.payload));
|
|
108
|
+
}
|
|
109
|
+
catch (failure) {
|
|
110
|
+
throw mappingError("decode", failure);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
throw new ValueMappingError("decode", `unsupported object encoding ${object.encoding}`);
|
|
114
|
+
}
|
|
115
|
+
case "internalBlobIdForStringValue":
|
|
116
|
+
case "internalBlobIdForObjValue":
|
|
117
|
+
throw new ValueMappingError("decode", "blob-backed Value was not hydrated");
|
|
118
|
+
case "nullValue":
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
67
121
|
}
|
|
68
122
|
export function deletionValue() {
|
|
69
123
|
return ProtoValue.create({
|
|
@@ -79,7 +133,7 @@ export class ValueHydrator {
|
|
|
79
133
|
}
|
|
80
134
|
async hydrate(value) {
|
|
81
135
|
if (value?.kind === undefined) {
|
|
82
|
-
throw new
|
|
136
|
+
throw new ValueMappingError("hydrate", "Value has no concrete kind");
|
|
83
137
|
}
|
|
84
138
|
const blobId = blobIdOf(value);
|
|
85
139
|
if (blobId === undefined) {
|
|
@@ -92,7 +146,7 @@ export class ValueHydrator {
|
|
|
92
146
|
const response = await unary((callback) => this.service.loadBlobs({ values: [value] }, callback));
|
|
93
147
|
const hydrated = response.values[blobId];
|
|
94
148
|
if (hydrated?.kind === undefined || blobIdOf(hydrated) !== undefined) {
|
|
95
|
-
throw new
|
|
149
|
+
throw new ValueMappingError("hydrate", `Dex did not hydrate blob ${blobId}`);
|
|
96
150
|
}
|
|
97
151
|
this.blobCache.put(blobId, ProtoValue.encode(hydrated).finish());
|
|
98
152
|
return hydrated;
|
|
@@ -103,7 +157,7 @@ export class ValueHydrator {
|
|
|
103
157
|
for (let index = 0; index < values.length; index += 1) {
|
|
104
158
|
const value = values[index];
|
|
105
159
|
if (value?.kind === undefined) {
|
|
106
|
-
throw new
|
|
160
|
+
throw new ValueMappingError("hydrate", "Value has no concrete kind");
|
|
107
161
|
}
|
|
108
162
|
const blobId = blobIdOf(value);
|
|
109
163
|
if (blobId === undefined) {
|
|
@@ -128,7 +182,7 @@ export class ValueHydrator {
|
|
|
128
182
|
for (const [blobId, pending] of missing) {
|
|
129
183
|
const value = response.values[blobId];
|
|
130
184
|
if (value?.kind === undefined || blobIdOf(value) !== undefined) {
|
|
131
|
-
throw new
|
|
185
|
+
throw new ValueMappingError("hydrate", `Dex did not hydrate blob ${blobId}`);
|
|
132
186
|
}
|
|
133
187
|
this.blobCache.put(blobId, ProtoValue.encode(value).finish());
|
|
134
188
|
for (const index of pending.indexes) {
|
|
@@ -138,7 +192,7 @@ export class ValueHydrator {
|
|
|
138
192
|
}
|
|
139
193
|
return hydrated.map((value) => {
|
|
140
194
|
if (value === undefined) {
|
|
141
|
-
throw new
|
|
195
|
+
throw new ValueMappingError("hydrate", "Value hydration left an unresolved entry");
|
|
142
196
|
}
|
|
143
197
|
return value;
|
|
144
198
|
});
|
|
@@ -152,7 +206,7 @@ function objectValue(encoding, payload) {
|
|
|
152
206
|
function toCodecValue(value) {
|
|
153
207
|
const kind = value.kind;
|
|
154
208
|
if (kind === undefined) {
|
|
155
|
-
throw new
|
|
209
|
+
throw new ValueMappingError("decode", "Value has no concrete kind");
|
|
156
210
|
}
|
|
157
211
|
switch (kind.$case) {
|
|
158
212
|
case "stringValue":
|
|
@@ -170,12 +224,12 @@ function toCodecValue(value) {
|
|
|
170
224
|
if (kind.value.encoding === "json") {
|
|
171
225
|
return { kind: "json", data: textDecoder.decode(kind.value.payload) };
|
|
172
226
|
}
|
|
173
|
-
throw new
|
|
227
|
+
throw new ValueMappingError("decode", `unsupported object encoding ${kind.value.encoding}`);
|
|
174
228
|
case "internalBlobIdForStringValue":
|
|
175
229
|
case "internalBlobIdForObjValue":
|
|
176
|
-
throw new
|
|
230
|
+
throw new ValueMappingError("decode", "blob-backed Value was not hydrated");
|
|
177
231
|
case "nullValue":
|
|
178
|
-
throw new
|
|
232
|
+
throw new ValueMappingError("decode", "attribute deletion marker cannot be decoded");
|
|
179
233
|
}
|
|
180
234
|
}
|
|
181
235
|
function blobIdOf(value) {
|
|
@@ -196,4 +250,11 @@ function unary(invoke) {
|
|
|
196
250
|
});
|
|
197
251
|
});
|
|
198
252
|
}
|
|
253
|
+
function mappingError(operation, failure) {
|
|
254
|
+
if (failure instanceof ValueMappingError) {
|
|
255
|
+
return failure;
|
|
256
|
+
}
|
|
257
|
+
const detail = failure instanceof Error ? failure.message : String(failure);
|
|
258
|
+
return new ValueMappingError(operation, detail, { cause: failure });
|
|
259
|
+
}
|
|
199
260
|
//# sourceMappingURL=value-mapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-mapper.js","sourceRoot":"","sources":["../../src/value-mapper.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,uDAAuD;AACvD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;AAIxD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EACL,KAAK,IAAI,UAAU,GAGpB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,MAAM,UAAU,WAAW,CAAI,KAAe,EAAE,KAAQ;IACtD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,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