flowcraft 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index-B7cJxomy.d.mts +1291 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +747 -0
- package/dist/index.mjs.map +1 -0
- package/dist/replay-BB11M6K1.mjs +107 -0
- package/dist/replay-BB11M6K1.mjs.map +1 -0
- package/dist/runtime-Bob_ca8M.mjs +2215 -0
- package/dist/runtime-Bob_ca8M.mjs.map +1 -0
- package/dist/{sdk.d.ts → sdk.d.mts} +14 -12
- package/dist/sdk.mjs +29 -0
- package/dist/sdk.mjs.map +1 -0
- package/dist/testing/index.d.mts +172 -0
- package/dist/testing/index.mjs +277 -0
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/adapters/index.d.ts +0 -4
- package/dist/adapters/index.js +0 -4
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/persistent-event-bus.d.ts +0 -69
- package/dist/adapters/persistent-event-bus.js +0 -3
- package/dist/adapters/persistent-event-bus.js.map +0 -1
- package/dist/analysis.d.ts +0 -53
- package/dist/analysis.js +0 -3
- package/dist/analysis.js.map +0 -1
- package/dist/chunk-26VTGQAF.js +0 -103
- package/dist/chunk-26VTGQAF.js.map +0 -1
- package/dist/chunk-27STBUGG.js +0 -44
- package/dist/chunk-27STBUGG.js.map +0 -1
- package/dist/chunk-2TSADFQX.js +0 -46
- package/dist/chunk-2TSADFQX.js.map +0 -1
- package/dist/chunk-3Y5O5EGB.js +0 -3
- package/dist/chunk-3Y5O5EGB.js.map +0 -1
- package/dist/chunk-4JUPOFSL.js +0 -76
- package/dist/chunk-4JUPOFSL.js.map +0 -1
- package/dist/chunk-4PELJWF7.js +0 -29
- package/dist/chunk-4PELJWF7.js.map +0 -1
- package/dist/chunk-55J6XMHW.js +0 -3
- package/dist/chunk-55J6XMHW.js.map +0 -1
- package/dist/chunk-5A24LVGQ.js +0 -90
- package/dist/chunk-5A24LVGQ.js.map +0 -1
- package/dist/chunk-6RKHCJUU.js +0 -29
- package/dist/chunk-6RKHCJUU.js.map +0 -1
- package/dist/chunk-7EBKWATZ.js +0 -86
- package/dist/chunk-7EBKWATZ.js.map +0 -1
- package/dist/chunk-BC4G7OM6.js +0 -42
- package/dist/chunk-BC4G7OM6.js.map +0 -1
- package/dist/chunk-BCRWXTWX.js +0 -21
- package/dist/chunk-BCRWXTWX.js.map +0 -1
- package/dist/chunk-BV6MXL74.js +0 -340
- package/dist/chunk-BV6MXL74.js.map +0 -1
- package/dist/chunk-CIXL7AKH.js +0 -532
- package/dist/chunk-CIXL7AKH.js.map +0 -1
- package/dist/chunk-DL7KVYZF.js +0 -39
- package/dist/chunk-DL7KVYZF.js.map +0 -1
- package/dist/chunk-E6ICIXVR.js +0 -25
- package/dist/chunk-E6ICIXVR.js.map +0 -1
- package/dist/chunk-HFJXYY4E.js +0 -3
- package/dist/chunk-HFJXYY4E.js.map +0 -1
- package/dist/chunk-HNHM3FDK.js +0 -52
- package/dist/chunk-HNHM3FDK.js.map +0 -1
- package/dist/chunk-I53JB2KW.js +0 -26
- package/dist/chunk-I53JB2KW.js.map +0 -1
- package/dist/chunk-IDTYHLDQ.js +0 -16
- package/dist/chunk-IDTYHLDQ.js.map +0 -1
- package/dist/chunk-IKOTX22J.js +0 -85
- package/dist/chunk-IKOTX22J.js.map +0 -1
- package/dist/chunk-K446NZ4E.js +0 -25
- package/dist/chunk-K446NZ4E.js.map +0 -1
- package/dist/chunk-L3MX5MTA.js +0 -33
- package/dist/chunk-L3MX5MTA.js.map +0 -1
- package/dist/chunk-L46TQXCV.js +0 -144
- package/dist/chunk-L46TQXCV.js.map +0 -1
- package/dist/chunk-LM4ACVHL.js +0 -73
- package/dist/chunk-LM4ACVHL.js.map +0 -1
- package/dist/chunk-LNK7LZER.js +0 -51
- package/dist/chunk-LNK7LZER.js.map +0 -1
- package/dist/chunk-NVLZFLYM.js +0 -3
- package/dist/chunk-NVLZFLYM.js.map +0 -1
- package/dist/chunk-ONH7PIJZ.js +0 -300
- package/dist/chunk-ONH7PIJZ.js.map +0 -1
- package/dist/chunk-OOJEXFYY.js +0 -47
- package/dist/chunk-OOJEXFYY.js.map +0 -1
- package/dist/chunk-PH2IYZHV.js +0 -48
- package/dist/chunk-PH2IYZHV.js.map +0 -1
- package/dist/chunk-PU2VTWJD.js +0 -164
- package/dist/chunk-PU2VTWJD.js.map +0 -1
- package/dist/chunk-QA2WDZPV.js +0 -74
- package/dist/chunk-QA2WDZPV.js.map +0 -1
- package/dist/chunk-RM677CNU.js +0 -52
- package/dist/chunk-RM677CNU.js.map +0 -1
- package/dist/chunk-TKSSRS5U.js +0 -39
- package/dist/chunk-TKSSRS5U.js.map +0 -1
- package/dist/chunk-UNORA7EM.js +0 -103
- package/dist/chunk-UNORA7EM.js.map +0 -1
- package/dist/chunk-VZ4BRDBK.js +0 -54
- package/dist/chunk-VZ4BRDBK.js.map +0 -1
- package/dist/chunk-X5RJOZY2.js +0 -279
- package/dist/chunk-X5RJOZY2.js.map +0 -1
- package/dist/chunk-ZETQCNEF.js +0 -139
- package/dist/chunk-ZETQCNEF.js.map +0 -1
- package/dist/chunk-ZKINHLMS.js +0 -230
- package/dist/chunk-ZKINHLMS.js.map +0 -1
- package/dist/chunk-ZLW4QOTS.js +0 -192
- package/dist/chunk-ZLW4QOTS.js.map +0 -1
- package/dist/container-factory.d.ts +0 -17
- package/dist/container-factory.js +0 -13
- package/dist/container-factory.js.map +0 -1
- package/dist/container.d.ts +0 -23
- package/dist/container.js +0 -3
- package/dist/container.js.map +0 -1
- package/dist/context.d.ts +0 -65
- package/dist/context.js +0 -3
- package/dist/context.js.map +0 -1
- package/dist/error-mapper.d.ts +0 -15
- package/dist/error-mapper.js +0 -4
- package/dist/error-mapper.js.map +0 -1
- package/dist/errors.d.ts +0 -20
- package/dist/errors.js +0 -3
- package/dist/errors.js.map +0 -1
- package/dist/evaluator.d.ts +0 -32
- package/dist/evaluator.js +0 -3
- package/dist/evaluator.js.map +0 -1
- package/dist/flow.d.ts +0 -83
- package/dist/flow.js +0 -4
- package/dist/flow.js.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.js +0 -38
- package/dist/index.js.map +0 -1
- package/dist/linter.d.ts +0 -26
- package/dist/linter.js +0 -4
- package/dist/linter.js.map +0 -1
- package/dist/logger.d.ts +0 -20
- package/dist/logger.js +0 -3
- package/dist/logger.js.map +0 -1
- package/dist/node.d.ts +0 -3
- package/dist/node.js +0 -3
- package/dist/node.js.map +0 -1
- package/dist/nodes/batch-gather.d.ts +0 -9
- package/dist/nodes/batch-gather.js +0 -4
- package/dist/nodes/batch-gather.js.map +0 -1
- package/dist/nodes/batch-scatter.d.ts +0 -9
- package/dist/nodes/batch-scatter.js +0 -4
- package/dist/nodes/batch-scatter.js.map +0 -1
- package/dist/nodes/sleep.d.ts +0 -9
- package/dist/nodes/sleep.js +0 -4
- package/dist/nodes/sleep.js.map +0 -1
- package/dist/nodes/subflow.d.ts +0 -9
- package/dist/nodes/subflow.js +0 -10
- package/dist/nodes/subflow.js.map +0 -1
- package/dist/nodes/wait.d.ts +0 -9
- package/dist/nodes/wait.js +0 -4
- package/dist/nodes/wait.js.map +0 -1
- package/dist/nodes/webhook.d.ts +0 -13
- package/dist/nodes/webhook.js +0 -4
- package/dist/nodes/webhook.js.map +0 -1
- package/dist/runtime/adapter.d.ts +0 -114
- package/dist/runtime/adapter.js +0 -28
- package/dist/runtime/adapter.js.map +0 -1
- package/dist/runtime/builtin-keys.d.ts +0 -38
- package/dist/runtime/builtin-keys.js +0 -10
- package/dist/runtime/builtin-keys.js.map +0 -1
- package/dist/runtime/execution-context.d.ts +0 -3
- package/dist/runtime/execution-context.js +0 -6
- package/dist/runtime/execution-context.js.map +0 -1
- package/dist/runtime/executors.d.ts +0 -3
- package/dist/runtime/executors.js +0 -4
- package/dist/runtime/executors.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -7
- package/dist/runtime/index.js +0 -31
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/node-executor-factory.d.ts +0 -12
- package/dist/runtime/node-executor-factory.js +0 -6
- package/dist/runtime/node-executor-factory.js.map +0 -1
- package/dist/runtime/orchestrator.d.ts +0 -9
- package/dist/runtime/orchestrator.js +0 -8
- package/dist/runtime/orchestrator.js.map +0 -1
- package/dist/runtime/orchestrators/replay.d.ts +0 -45
- package/dist/runtime/orchestrators/replay.js +0 -3
- package/dist/runtime/orchestrators/replay.js.map +0 -1
- package/dist/runtime/orchestrators/step-by-step.d.ts +0 -16
- package/dist/runtime/orchestrators/step-by-step.js +0 -5
- package/dist/runtime/orchestrators/step-by-step.js.map +0 -1
- package/dist/runtime/orchestrators/utils.d.ts +0 -35
- package/dist/runtime/orchestrators/utils.js +0 -4
- package/dist/runtime/orchestrators/utils.js.map +0 -1
- package/dist/runtime/runtime.d.ts +0 -3
- package/dist/runtime/runtime.js +0 -27
- package/dist/runtime/runtime.js.map +0 -1
- package/dist/runtime/scheduler.d.ts +0 -3
- package/dist/runtime/scheduler.js +0 -3
- package/dist/runtime/scheduler.js.map +0 -1
- package/dist/runtime/state.d.ts +0 -3
- package/dist/runtime/state.js +0 -5
- package/dist/runtime/state.js.map +0 -1
- package/dist/runtime/traverser.d.ts +0 -3
- package/dist/runtime/traverser.js +0 -5
- package/dist/runtime/traverser.js.map +0 -1
- package/dist/runtime/types.d.ts +0 -3
- package/dist/runtime/types.js +0 -3
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/workflow-logic-handler.d.ts +0 -17
- package/dist/runtime/workflow-logic-handler.js +0 -5
- package/dist/runtime/workflow-logic-handler.js.map +0 -1
- package/dist/sanitizer.d.ts +0 -12
- package/dist/sanitizer.js +0 -3
- package/dist/sanitizer.js.map +0 -1
- package/dist/sdk.js +0 -20
- package/dist/sdk.js.map +0 -1
- package/dist/serializer.d.ts +0 -18
- package/dist/serializer.js +0 -3
- package/dist/serializer.js.map +0 -1
- package/dist/testing/event-logger.d.ts +0 -63
- package/dist/testing/event-logger.js +0 -3
- package/dist/testing/event-logger.js.map +0 -1
- package/dist/testing/index.d.ts +0 -7
- package/dist/testing/index.js +0 -37
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/run-with-trace.d.ts +0 -38
- package/dist/testing/run-with-trace.js +0 -33
- package/dist/testing/run-with-trace.js.map +0 -1
- package/dist/testing/stepper.d.ts +0 -79
- package/dist/testing/stepper.js +0 -11
- package/dist/testing/stepper.js.map +0 -1
- package/dist/types-Biip2gLh.d.ts +0 -676
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
package/dist/error-mapper.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"error-mapper.js"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single, comprehensive error class for the framework.
|
|
3
|
-
* Use this for all errors to ensure consistent structure and easy debugging.
|
|
4
|
-
*/
|
|
5
|
-
declare class FlowcraftError extends Error {
|
|
6
|
-
readonly message: string;
|
|
7
|
-
readonly nodeId?: string;
|
|
8
|
-
readonly blueprintId?: string;
|
|
9
|
-
readonly executionId?: string;
|
|
10
|
-
readonly isFatal: boolean;
|
|
11
|
-
constructor(message: string, options?: {
|
|
12
|
-
cause?: Error;
|
|
13
|
-
nodeId?: string;
|
|
14
|
-
blueprintId?: string;
|
|
15
|
-
executionId?: string;
|
|
16
|
-
isFatal?: boolean;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { FlowcraftError };
|
package/dist/errors.js
DELETED
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"errors.js"}
|
package/dist/evaluator.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { x as IEvaluator } from './types-Biip2gLh.js';
|
|
2
|
-
import './errors.js';
|
|
3
|
-
import './container.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A safe evaluator that only allows simple property access.
|
|
7
|
-
* It cannot execute arbitrary code and is secure for untrusted inputs.
|
|
8
|
-
*
|
|
9
|
-
* Example expressions:
|
|
10
|
-
* - "result.output.status"
|
|
11
|
-
* - "context.user.isAdmin"
|
|
12
|
-
* - "input.value"
|
|
13
|
-
*/
|
|
14
|
-
declare class PropertyEvaluator implements IEvaluator {
|
|
15
|
-
evaluate(expression: string, context: Record<string, any>): any;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @warning This evaluator uses `new Function()` and can execute arbitrary
|
|
19
|
-
* JavaScript code. It poses a significant security risk if the expressions
|
|
20
|
-
* are not from a trusted source (e.g., user input).
|
|
21
|
-
*
|
|
22
|
-
* It should only be used in controlled environments where all workflow
|
|
23
|
-
* definitions are static and authored by trusted developers.
|
|
24
|
-
*
|
|
25
|
-
* For safer evaluation, use the default `PropertyEvaluator` or install a
|
|
26
|
-
* sandboxed library like `jsep` to create a custom, secure evaluator.
|
|
27
|
-
*/
|
|
28
|
-
declare class UnsafeEvaluator implements IEvaluator {
|
|
29
|
-
evaluate(expression: string, context: Record<string, any>): any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { PropertyEvaluator, UnsafeEvaluator };
|
package/dist/evaluator.js
DELETED
package/dist/evaluator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"evaluator.js"}
|
package/dist/flow.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { o as NodeFunction, p as NodeClass, j as NodeDefinition, k as EdgeDefinition, h as WorkflowBlueprint, U as UIGraph } from './types-Biip2gLh.js';
|
|
2
|
-
import './errors.js';
|
|
3
|
-
import './container.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A fluent API for programmatically constructing a WorkflowBlueprint.
|
|
7
|
-
*/
|
|
8
|
-
declare class FlowBuilder<TContext extends Record<string, any> = Record<string, any>, TDependencies extends Record<string, any> = Record<string, any>> {
|
|
9
|
-
private blueprint;
|
|
10
|
-
private functionRegistry;
|
|
11
|
-
private loopDefinitions;
|
|
12
|
-
private batchDefinitions;
|
|
13
|
-
private cycleEntryPoints;
|
|
14
|
-
constructor(id: string);
|
|
15
|
-
node<TInput = any, TOutput = any, TAction extends string = string>(id: string, implementation: NodeFunction<TContext, TDependencies, TInput, TOutput, TAction> | NodeClass<TContext, TDependencies, TInput, TOutput, TAction>, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
16
|
-
edge(source: string, target: string, options?: Omit<EdgeDefinition, 'source' | 'target'>): this;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a batch processing pattern.
|
|
19
|
-
* It takes an input array, runs a worker node on each item in parallel, and gathers the results.
|
|
20
|
-
* This method augments the Flow's TContext with a new key for the output array.
|
|
21
|
-
*
|
|
22
|
-
* @param id The base ID for this batch operation.
|
|
23
|
-
* @param worker The node implementation to run on each item.
|
|
24
|
-
* @param options Configuration for the batch operation.
|
|
25
|
-
* @returns The Flow instance with an updated context type for chaining.
|
|
26
|
-
*/
|
|
27
|
-
batch<TWorkerInput, TWorkerOutput, TWorkerAction extends string, TOutputKey extends string>(id: string, worker: NodeFunction<TContext, TDependencies, TWorkerInput, TWorkerOutput, TWorkerAction> | NodeClass<TContext, TDependencies, TWorkerInput, TWorkerOutput, TWorkerAction>, options: {
|
|
28
|
-
/** The key in the context that holds the input array for the batch. */
|
|
29
|
-
inputKey: keyof TContext;
|
|
30
|
-
/** The key in the context where the array of results will be stored. */
|
|
31
|
-
outputKey: TOutputKey;
|
|
32
|
-
/** The number of items to process in each chunk to limit memory usage. */
|
|
33
|
-
chunkSize?: number;
|
|
34
|
-
}): FlowBuilder<TContext & {
|
|
35
|
-
[K in TOutputKey]: TWorkerOutput[];
|
|
36
|
-
}, TDependencies>;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a sleep node that pauses workflow execution for a specified duration.
|
|
39
|
-
* @param id A unique identifier for the sleep node.
|
|
40
|
-
* @param options Configuration for the sleep duration.
|
|
41
|
-
*/
|
|
42
|
-
sleep(id: string, options: {
|
|
43
|
-
/** The duration to sleep in milliseconds or a string like '5s', '1m', '2h', '1d'. */
|
|
44
|
-
duration: number | string;
|
|
45
|
-
}): this;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a wait node that pauses workflow execution for external input.
|
|
48
|
-
* @param id A unique identifier for the wait node.
|
|
49
|
-
* @param options Optional configuration for the wait node.
|
|
50
|
-
*/
|
|
51
|
-
wait(id: string, options?: Omit<NodeDefinition, 'id' | 'uses'>): this;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a loop pattern in the workflow graph.
|
|
54
|
-
* @param id A unique identifier for the loop construct.
|
|
55
|
-
* @param options Defines the start, end, and continuation condition of the loop.
|
|
56
|
-
* @param options.startNodeId The ID of the first node inside the loop body.
|
|
57
|
-
* @param options.endNodeId The ID of the last node inside the loop body.
|
|
58
|
-
* @param options.condition An expression that, if true, causes the loop to run again.
|
|
59
|
-
*/
|
|
60
|
-
loop(id: string, options: {
|
|
61
|
-
/** The ID of the first node inside the loop body. */
|
|
62
|
-
startNodeId: string;
|
|
63
|
-
/** The ID of the last node inside the loop body. */
|
|
64
|
-
endNodeId: string;
|
|
65
|
-
/** An expression that, if true, causes the loop to run again. */
|
|
66
|
-
condition: string;
|
|
67
|
-
}): this;
|
|
68
|
-
/**
|
|
69
|
-
* Sets the preferred entry point for a cycle in non-DAG workflows.
|
|
70
|
-
* This helps remove ambiguity when the runtime needs to choose a starting node for cycles.
|
|
71
|
-
* @param nodeId The ID of the node to use as the entry point for cycles containing this node.
|
|
72
|
-
*/
|
|
73
|
-
setCycleEntryPoint(nodeId: string): this;
|
|
74
|
-
toBlueprint(): WorkflowBlueprint;
|
|
75
|
-
getFunctionRegistry(): Map<string, NodeFunction | NodeClass>;
|
|
76
|
-
toGraphRepresentation(): UIGraph;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Helper function to create a new Flow builder instance.
|
|
80
|
-
*/
|
|
81
|
-
declare function createFlow<TContext extends Record<string, any> = Record<string, any>, TDependencies extends Record<string, any> = Record<string, any>>(id: string): FlowBuilder<TContext, TDependencies>;
|
|
82
|
-
|
|
83
|
-
export { FlowBuilder, createFlow };
|
package/dist/flow.js
DELETED
package/dist/flow.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"flow.js"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { IEventStore, InMemoryEventStore, PersistentEventBusAdapter } from './adapters/persistent-event-bus.js';
|
|
2
|
-
export { BlueprintAnalysis, Cycles, analyzeBlueprint, checkForCycles, generateMermaid, generateMermaidForRun } from './analysis.js';
|
|
3
|
-
export { DIContainer, ServiceToken, ServiceTokens } from './container.js';
|
|
4
|
-
export { ContainerOptions, createDefaultContainer } from './container-factory.js';
|
|
5
|
-
export { AsyncContextView, Context, TrackedAsyncContext } from './context.js';
|
|
6
|
-
export { createErrorMapper } from './error-mapper.js';
|
|
7
|
-
export { FlowcraftError } from './errors.js';
|
|
8
|
-
export { PropertyEvaluator, UnsafeEvaluator } from './evaluator.js';
|
|
9
|
-
export { FlowBuilder, createFlow } from './flow.js';
|
|
10
|
-
export { LinterIssue, LinterIssueCode, LinterResult, lintBlueprint } from './linter.js';
|
|
11
|
-
export { ConsoleLogger, NullLogger } from './logger.js';
|
|
12
|
-
export { B as BaseNode, C as ClassNodeExecutor, s as ContextImplementation, k as EdgeDefinition, e as ExecutionServices, E as ExecutionStrategy, c as FlowRuntime, z as FlowcraftEvent, F as FunctionNodeExecutor, G as GraphTraverser, u as IAsyncContext, x as IEvaluator, A as IEventBus, y as ILogger, I as IOrchestrator, f as IRuntime, D as ISerializer, t as ISyncContext, M as Middleware, p as NodeClass, l as NodeConfig, n as NodeContext, j as NodeDefinition, N as NodeExecutionResult, b as NodeExecutor, a as NodeExecutorConfig, d as NodeExecutorFactory, o as NodeFunction, q as NodeImplementation, r as NodeRegistry, m as NodeResult, P as PatchOperation, R as ReadyNode, v as RuntimeDependencies, w as RuntimeOptions, S as SourceLocation, U as UIGraph, h as WorkflowBlueprint, g as WorkflowBlueprintMetadata, H as WorkflowError, K as WorkflowResult, W as WorkflowState, J as WorkflowStatus, i as isNodeClass } from './types-Biip2gLh.js';
|
|
13
|
-
export { AdapterOptions, BaseDistributedAdapter, ICoordinationStore, JobPayload } from './runtime/adapter.js';
|
|
14
|
-
export { DefaultOrchestrator } from './runtime/orchestrator.js';
|
|
15
|
-
export { ReplayOrchestrator } from './runtime/orchestrators/replay.js';
|
|
16
|
-
export { executeBatch, processResults } from './runtime/orchestrators/utils.js';
|
|
17
|
-
export { sanitizeBlueprint } from './sanitizer.js';
|
|
18
|
-
export { JsonSerializer } from './serializer.js';
|
package/dist/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import './chunk-HFJXYY4E.js';
|
|
2
|
-
export { ReplayOrchestrator } from './chunk-UNORA7EM.js';
|
|
3
|
-
import './chunk-NVLZFLYM.js';
|
|
4
|
-
export { BaseDistributedAdapter } from './chunk-BV6MXL74.js';
|
|
5
|
-
export { FlowRuntime } from './chunk-CIXL7AKH.js';
|
|
6
|
-
import './chunk-PU2VTWJD.js';
|
|
7
|
-
import './chunk-DL7KVYZF.js';
|
|
8
|
-
import './chunk-LM4ACVHL.js';
|
|
9
|
-
export { ClassNodeExecutor, FunctionNodeExecutor, NodeExecutor } from './chunk-ONH7PIJZ.js';
|
|
10
|
-
import './chunk-3Y5O5EGB.js';
|
|
11
|
-
export { InMemoryEventStore, PersistentEventBusAdapter } from './chunk-2TSADFQX.js';
|
|
12
|
-
import './chunk-BC4G7OM6.js';
|
|
13
|
-
import './chunk-RM677CNU.js';
|
|
14
|
-
import './chunk-HNHM3FDK.js';
|
|
15
|
-
import './chunk-5A24LVGQ.js';
|
|
16
|
-
export { GraphTraverser } from './chunk-ZKINHLMS.js';
|
|
17
|
-
import './chunk-IDTYHLDQ.js';
|
|
18
|
-
import './chunk-I53JB2KW.js';
|
|
19
|
-
export { lintBlueprint } from './chunk-IKOTX22J.js';
|
|
20
|
-
export { sanitizeBlueprint } from './chunk-TKSSRS5U.js';
|
|
21
|
-
import './chunk-55J6XMHW.js';
|
|
22
|
-
export { analyzeBlueprint, checkForCycles, generateMermaid, generateMermaidForRun } from './chunk-ZLW4QOTS.js';
|
|
23
|
-
export { createDefaultContainer } from './chunk-E6ICIXVR.js';
|
|
24
|
-
export { DefaultOrchestrator } from './chunk-QA2WDZPV.js';
|
|
25
|
-
export { executeBatch, processResults } from './chunk-26VTGQAF.js';
|
|
26
|
-
import './chunk-L3MX5MTA.js';
|
|
27
|
-
export { WorkflowState } from './chunk-L46TQXCV.js';
|
|
28
|
-
export { ConsoleLogger, NullLogger } from './chunk-4PELJWF7.js';
|
|
29
|
-
export { JsonSerializer } from './chunk-6RKHCJUU.js';
|
|
30
|
-
export { DIContainer, ServiceTokens } from './chunk-OOJEXFYY.js';
|
|
31
|
-
export { AsyncContextView, Context, TrackedAsyncContext } from './chunk-ZETQCNEF.js';
|
|
32
|
-
export { createErrorMapper } from './chunk-27STBUGG.js';
|
|
33
|
-
export { FlowcraftError } from './chunk-BCRWXTWX.js';
|
|
34
|
-
export { PropertyEvaluator, UnsafeEvaluator } from './chunk-PH2IYZHV.js';
|
|
35
|
-
export { FlowBuilder, createFlow } from './chunk-X5RJOZY2.js';
|
|
36
|
-
export { BaseNode, isNodeClass } from './chunk-LNK7LZER.js';
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/linter.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { h as WorkflowBlueprint, o as NodeFunction, p as NodeClass } from './types-Biip2gLh.js';
|
|
2
|
-
import './errors.js';
|
|
3
|
-
import './container.js';
|
|
4
|
-
|
|
5
|
-
type LinterIssueCode = 'INVALID_EDGE_SOURCE' | 'INVALID_EDGE_TARGET' | 'MISSING_NODE_IMPLEMENTATION' | 'ORPHAN_NODE' | 'INVALID_BATCH_WORKER_KEY' | 'INVALID_SUBFLOW_BLUEPRINT_ID';
|
|
6
|
-
interface LinterIssue {
|
|
7
|
-
code: LinterIssueCode;
|
|
8
|
-
message: string;
|
|
9
|
-
nodeId?: string;
|
|
10
|
-
relatedId?: string;
|
|
11
|
-
}
|
|
12
|
-
interface LinterResult {
|
|
13
|
-
isValid: boolean;
|
|
14
|
-
issues: LinterIssue[];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Statically analyzes a workflow blueprint against a registry of implementations
|
|
18
|
-
* to find common errors before runtime.
|
|
19
|
-
*
|
|
20
|
-
* @param blueprint The WorkflowBlueprint to analyze.
|
|
21
|
-
* @param registry A map of node implementations (functions or classes) to check against.
|
|
22
|
-
* @returns A LinterResult object containing any issues found.
|
|
23
|
-
*/
|
|
24
|
-
declare function lintBlueprint(blueprint: WorkflowBlueprint, registry: Map<string, NodeFunction | NodeClass> | Record<string, NodeFunction | NodeClass>, blueprints?: Record<string, WorkflowBlueprint>): LinterResult;
|
|
25
|
-
|
|
26
|
-
export { type LinterIssue, type LinterIssueCode, type LinterResult, lintBlueprint };
|
package/dist/linter.js
DELETED
package/dist/linter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"linter.js"}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { y as ILogger } from './types-Biip2gLh.js';
|
|
2
|
-
import './errors.js';
|
|
3
|
-
import './container.js';
|
|
4
|
-
|
|
5
|
-
/** A logger implementation that outputs to the console. */
|
|
6
|
-
declare class ConsoleLogger implements ILogger {
|
|
7
|
-
debug(message: string, meta?: Record<string, any>): void;
|
|
8
|
-
info(message: string, meta?: Record<string, any>): void;
|
|
9
|
-
warn(message: string, meta?: Record<string, any>): void;
|
|
10
|
-
error(message: string, meta?: Record<string, any>): void;
|
|
11
|
-
}
|
|
12
|
-
/** A logger implementation that does nothing (no-op). */
|
|
13
|
-
declare class NullLogger implements ILogger {
|
|
14
|
-
debug(_message: string, _meta?: Record<string, any>): void;
|
|
15
|
-
info(_message: string, _meta?: Record<string, any>): void;
|
|
16
|
-
warn(_message: string, _meta?: Record<string, any>): void;
|
|
17
|
-
error(_message: string, _meta?: Record<string, any>): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { ConsoleLogger, NullLogger };
|
package/dist/logger.js
DELETED
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"logger.js"}
|
package/dist/node.d.ts
DELETED
package/dist/node.js
DELETED
package/dist/node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"node.js"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class BatchGatherNode extends BaseNode {
|
|
6
|
-
exec(_prepResult: any, context: NodeContext<any, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { BatchGatherNode };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"batch-gather.js"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class BatchScatterNode extends BaseNode {
|
|
6
|
-
exec(_prepResult: any, context: NodeContext<any, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { BatchScatterNode };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"batch-scatter.js"}
|
package/dist/nodes/sleep.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class SleepNode extends BaseNode {
|
|
6
|
-
exec(_prepResult: any, context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { SleepNode };
|
package/dist/nodes/sleep.js
DELETED
package/dist/nodes/sleep.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"sleep.js"}
|
package/dist/nodes/subflow.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class SubflowNode extends BaseNode {
|
|
6
|
-
exec(_prepResult: any, context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { SubflowNode };
|
package/dist/nodes/subflow.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { SubflowNode } from '../chunk-5A24LVGQ.js';
|
|
2
|
-
import '../chunk-ZKINHLMS.js';
|
|
3
|
-
import '../chunk-ZLW4QOTS.js';
|
|
4
|
-
import '../chunk-L3MX5MTA.js';
|
|
5
|
-
import '../chunk-L46TQXCV.js';
|
|
6
|
-
import '../chunk-ZETQCNEF.js';
|
|
7
|
-
import '../chunk-BCRWXTWX.js';
|
|
8
|
-
import '../chunk-LNK7LZER.js';
|
|
9
|
-
//# sourceMappingURL=subflow.js.map
|
|
10
|
-
//# sourceMappingURL=subflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subflow.js"}
|
package/dist/nodes/wait.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class WaitNode extends BaseNode {
|
|
6
|
-
exec(_prepResult: any, context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { WaitNode };
|
package/dist/nodes/wait.js
DELETED
package/dist/nodes/wait.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"wait.js"}
|
package/dist/nodes/webhook.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { B as BaseNode, n as NodeContext, m as NodeResult } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
declare class WebhookNode extends BaseNode {
|
|
6
|
-
prep(context: NodeContext<Record<string, any>, any, any>): Promise<any>;
|
|
7
|
-
exec(prepResult: {
|
|
8
|
-
url: string;
|
|
9
|
-
event: string;
|
|
10
|
-
}, _context: NodeContext<Record<string, any>, any, any>): Promise<Omit<NodeResult, 'error'>>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { WebhookNode };
|
package/dist/nodes/webhook.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"webhook.js"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { w as RuntimeOptions, A as IEventBus, c as FlowRuntime, D as ISerializer, y as ILogger, u as IAsyncContext, K as WorkflowResult, h as WorkflowBlueprint } from '../types-Biip2gLh.js';
|
|
2
|
-
import '../errors.js';
|
|
3
|
-
import '../container.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the contract for an atomic, distributed key-value store required by
|
|
7
|
-
* the adapter for coordination tasks like fan-in joins and locking.
|
|
8
|
-
*/
|
|
9
|
-
interface ICoordinationStore {
|
|
10
|
-
/** Atomically increments a key and returns the new value. Ideal for 'all' joins. */
|
|
11
|
-
increment: (key: string, ttlSeconds: number) => Promise<number>;
|
|
12
|
-
/** Sets a key only if it does not already exist. Ideal for 'any' joins (locking). */
|
|
13
|
-
setIfNotExist: (key: string, value: string, ttlSeconds: number) => Promise<boolean>;
|
|
14
|
-
/** Extends the TTL of an existing key. Used for heartbeat mechanism in long-running jobs. */
|
|
15
|
-
extendTTL: (key: string, ttlSeconds: number) => Promise<boolean>;
|
|
16
|
-
/** Deletes a key. Used for cleanup. */
|
|
17
|
-
delete: (key: string) => Promise<void>;
|
|
18
|
-
/** Gets the value of a key. */
|
|
19
|
-
get: (key: string) => Promise<string | undefined>;
|
|
20
|
-
}
|
|
21
|
-
/** Configuration options for constructing a BaseDistributedAdapter. */
|
|
22
|
-
interface AdapterOptions {
|
|
23
|
-
runtimeOptions: RuntimeOptions<any>;
|
|
24
|
-
coordinationStore: ICoordinationStore;
|
|
25
|
-
eventBus?: IEventBus;
|
|
26
|
-
}
|
|
27
|
-
/** The data payload expected for a job in the queue. */
|
|
28
|
-
interface JobPayload {
|
|
29
|
-
runId: string;
|
|
30
|
-
blueprintId: string;
|
|
31
|
-
nodeId: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* The base class for all distributed adapters. It handles the technology-agnostic
|
|
35
|
-
* orchestration logic and leaves queue-specific implementation to subclasses.
|
|
36
|
-
*/
|
|
37
|
-
declare abstract class BaseDistributedAdapter {
|
|
38
|
-
protected readonly runtime: FlowRuntime<any, any>;
|
|
39
|
-
protected readonly store: ICoordinationStore;
|
|
40
|
-
protected readonly serializer: ISerializer;
|
|
41
|
-
protected readonly logger: ILogger;
|
|
42
|
-
protected readonly eventBus?: IEventBus;
|
|
43
|
-
constructor(options: AdapterOptions);
|
|
44
|
-
/**
|
|
45
|
-
* Starts the worker, which begins listening for and processing jobs from the queue.
|
|
46
|
-
*/
|
|
47
|
-
start(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a technology-specific distributed context for a given workflow run.
|
|
50
|
-
* @param runId The unique ID for the workflow execution.
|
|
51
|
-
*/
|
|
52
|
-
protected abstract createContext(runId: string): IAsyncContext<Record<string, any>>;
|
|
53
|
-
/**
|
|
54
|
-
* Sets up the listener for the message queue. The implementation should call the
|
|
55
|
-
* provided `handler` function for each new job received.
|
|
56
|
-
* @param handler The core logic to execute for each job.
|
|
57
|
-
*/
|
|
58
|
-
protected abstract processJobs(handler: (job: JobPayload) => Promise<void>): void;
|
|
59
|
-
/**
|
|
60
|
-
* Enqueues a new job onto the message queue.
|
|
61
|
-
* @param job The payload for the job to be enqueued.
|
|
62
|
-
*/
|
|
63
|
-
protected abstract enqueueJob(job: JobPayload): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Publishes the final result of a completed or failed workflow run.
|
|
66
|
-
* @param runId The unique ID of the workflow run.
|
|
67
|
-
* @param result The final status and payload of the workflow.
|
|
68
|
-
*/
|
|
69
|
-
protected abstract publishFinalResult(runId: string, result: {
|
|
70
|
-
status: 'completed' | 'failed';
|
|
71
|
-
payload?: WorkflowResult;
|
|
72
|
-
reason?: string;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Registers a webhook endpoint for a specific node in a workflow run.
|
|
76
|
-
* @param runId The unique ID of the workflow run.
|
|
77
|
-
* @param nodeId The ID of the node that will wait for the webhook.
|
|
78
|
-
* @returns The URL and event name for the webhook.
|
|
79
|
-
*/
|
|
80
|
-
abstract registerWebhookEndpoint(runId: string, nodeId: string): Promise<{
|
|
81
|
-
url: string;
|
|
82
|
-
event: string;
|
|
83
|
-
}>;
|
|
84
|
-
/**
|
|
85
|
-
* Hook called at the start of job processing. Subclasses can override this
|
|
86
|
-
* to perform additional setup (e.g., timestamp tracking for reconciliation).
|
|
87
|
-
*/
|
|
88
|
-
protected onJobStart(_runId: string, _blueprintId: string, _nodeId: string): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* The main handler for processing a single job from the queue.
|
|
91
|
-
*/
|
|
92
|
-
protected handleJob(job: JobPayload): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* Encapsulates the fan-in join logic using the coordination store.
|
|
95
|
-
*/
|
|
96
|
-
protected isReadyForFanIn(runId: string, blueprint: WorkflowBlueprint, targetNodeId: string): Promise<boolean>;
|
|
97
|
-
/**
|
|
98
|
-
* Reconciles the state of a workflow run. It inspects the persisted
|
|
99
|
-
* context to find completed nodes, determines the next set of executable
|
|
100
|
-
* nodes (the frontier), and enqueues jobs for them if they aren't
|
|
101
|
-
* already running. This is the core of the resume functionality.
|
|
102
|
-
*
|
|
103
|
-
* @param runId The unique ID of the workflow execution to reconcile.
|
|
104
|
-
* @returns The set of node IDs that were enqueued for execution.
|
|
105
|
-
*/
|
|
106
|
-
reconcile(runId: string): Promise<Set<string>>;
|
|
107
|
-
private calculateResumedFrontier;
|
|
108
|
-
/**
|
|
109
|
-
* Writes a poison pill for 'all' join successors and a cancellation pill for 'any' join successors of a failed node to prevent stalling or ambiguous states.
|
|
110
|
-
*/
|
|
111
|
-
private writePoisonPillForSuccessors;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { type AdapterOptions, BaseDistributedAdapter, type ICoordinationStore, type JobPayload };
|
package/dist/runtime/adapter.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { BaseDistributedAdapter } from '../chunk-BV6MXL74.js';
|
|
2
|
-
import '../chunk-CIXL7AKH.js';
|
|
3
|
-
import '../chunk-PU2VTWJD.js';
|
|
4
|
-
import '../chunk-DL7KVYZF.js';
|
|
5
|
-
import '../chunk-LM4ACVHL.js';
|
|
6
|
-
import '../chunk-ONH7PIJZ.js';
|
|
7
|
-
import '../chunk-BC4G7OM6.js';
|
|
8
|
-
import '../chunk-RM677CNU.js';
|
|
9
|
-
import '../chunk-HNHM3FDK.js';
|
|
10
|
-
import '../chunk-5A24LVGQ.js';
|
|
11
|
-
import '../chunk-ZKINHLMS.js';
|
|
12
|
-
import '../chunk-IDTYHLDQ.js';
|
|
13
|
-
import '../chunk-I53JB2KW.js';
|
|
14
|
-
import '../chunk-TKSSRS5U.js';
|
|
15
|
-
import '../chunk-ZLW4QOTS.js';
|
|
16
|
-
import '../chunk-QA2WDZPV.js';
|
|
17
|
-
import '../chunk-26VTGQAF.js';
|
|
18
|
-
import '../chunk-L3MX5MTA.js';
|
|
19
|
-
import '../chunk-L46TQXCV.js';
|
|
20
|
-
import '../chunk-4PELJWF7.js';
|
|
21
|
-
import '../chunk-6RKHCJUU.js';
|
|
22
|
-
import '../chunk-OOJEXFYY.js';
|
|
23
|
-
import '../chunk-ZETQCNEF.js';
|
|
24
|
-
import '../chunk-BCRWXTWX.js';
|
|
25
|
-
import '../chunk-PH2IYZHV.js';
|
|
26
|
-
import '../chunk-LNK7LZER.js';
|
|
27
|
-
//# sourceMappingURL=adapter.js.map
|
|
28
|
-
//# sourceMappingURL=adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"adapter.js"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A registry defining the dynamic context keys set by each built-in node.
|
|
3
|
-
* This object is the single source of truth.
|
|
4
|
-
*/
|
|
5
|
-
declare const BUILTIN_KEYS: {
|
|
6
|
-
readonly 'batch-scatter': readonly ["currentIndex", "hasMore"];
|
|
7
|
-
readonly 'batch-gather': readonly ["allWorkerIds", "hasMore"];
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* A comprehensive map of all possible dynamic keys to their corresponding TypeScript types.
|
|
11
|
-
* The compiler will enforce that any key used in `BUILTIN_KEYS` must have an entry here.
|
|
12
|
-
*/
|
|
13
|
-
type DynamicKeyTypeMap = {
|
|
14
|
-
currentIndex: number;
|
|
15
|
-
hasMore: boolean;
|
|
16
|
-
allWorkerIds: string[];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* A utility type that creates a union of all possible dynamic key strings
|
|
20
|
-
* by flattening the values of the `BUILTIN_KEYS` object.
|
|
21
|
-
*
|
|
22
|
-
* Example: 'currentIndex' | 'hasMore' | 'allWorkerIds'
|
|
23
|
-
*/
|
|
24
|
-
type AllDynamicKeyStrings = (typeof BUILTIN_KEYS)[keyof typeof BUILTIN_KEYS][number];
|
|
25
|
-
/**
|
|
26
|
-
* The final, dynamically generated `DynamicKeys` type.
|
|
27
|
-
*
|
|
28
|
-
* It uses a mapped type to construct an object where:
|
|
29
|
-
* - The keys are the union of all strings from `AllDynamicKeyStrings`.
|
|
30
|
-
* - The value for each key is looked up from our central `DynamicKeyTypeMap`.
|
|
31
|
-
*
|
|
32
|
-
* This ensures that `DynamicKeys` is always perfectly in sync with `BUILTIN_KEYS`.
|
|
33
|
-
*/
|
|
34
|
-
type DynamicKeys = {
|
|
35
|
-
[K in AllDynamicKeyStrings]: DynamicKeyTypeMap[K];
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { BUILTIN_KEYS, type DynamicKeys };
|