flowcraft 2.9.3 → 2.10.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 +3 -3
- package/dist/adapter-DzeZVjSE.d.mts +133 -0
- package/dist/adapters/index.d.mts +2 -0
- package/dist/adapters/index.mjs +3 -0
- package/dist/adapters/persistent-event-bus.d.mts +2 -0
- package/dist/adapters/persistent-event-bus.mjs +59 -0
- package/dist/analysis-B5Twr7sD.d.mts +52 -0
- package/dist/analysis.d.mts +2 -0
- package/dist/analysis.mjs +164 -0
- package/dist/batch-gather-BhF-IzQR.d.mts +8 -0
- package/dist/batch-scatter-DD8TU0Wm.d.mts +8 -0
- package/dist/container-BKdd-9wf.d.mts +24 -0
- package/dist/container-factory-fDY2kkxt.d.mts +17 -0
- package/dist/container-factory.d.mts +2 -0
- package/dist/container-factory.mjs +23 -0
- package/dist/container.d.mts +2 -0
- package/dist/container.mjs +43 -0
- package/dist/context-ZVtzXuZu.d.mts +64 -0
- package/dist/context.d.mts +2 -0
- package/dist/context.mjs +145 -0
- package/dist/error-mapper-BAv_YQMQ.d.mts +14 -0
- package/dist/error-mapper.d.mts +2 -0
- package/dist/error-mapper.mjs +37 -0
- package/dist/errors-CyyIj3OO.d.mts +21 -0
- package/dist/errors.d.mts +2 -0
- package/dist/errors.mjs +24 -0
- package/dist/evaluator-Dnj5qJ92.d.mts +31 -0
- package/dist/evaluator.d.mts +2 -0
- package/dist/evaluator.mjs +80 -0
- package/dist/flow-CZGpYpl-.d.mts +94 -0
- package/dist/flow.d.mts +2 -0
- package/dist/flow.mjs +328 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-Bk0eNZmQ.d.mts +1 -0
- package/dist/index-CNgSR_kt.d.mts +1 -0
- package/dist/index-CW2WHUXP.d.mts +1 -0
- package/dist/index.d.mts +24 -1
- package/dist/index.mjs +31 -746
- package/dist/linter-B8KALEae.d.mts +25 -0
- package/dist/linter.d.mts +2 -0
- package/dist/linter.mjs +74 -0
- package/dist/logger-BvDgvNHQ.d.mts +19 -0
- package/dist/logger.d.mts +2 -0
- package/dist/logger.mjs +26 -0
- package/dist/node.d.mts +2 -0
- package/dist/node.mjs +55 -0
- package/dist/nodes/batch-gather.d.mts +2 -0
- package/dist/nodes/batch-gather.mjs +47 -0
- package/dist/nodes/batch-scatter.d.mts +2 -0
- package/dist/nodes/batch-scatter.mjs +52 -0
- package/dist/nodes/index.d.mts +7 -0
- package/dist/nodes/index.mjs +8 -0
- package/dist/nodes/sleep.d.mts +2 -0
- package/dist/nodes/sleep.mjs +41 -0
- package/dist/nodes/subflow.d.mts +2 -0
- package/dist/nodes/subflow.mjs +64 -0
- package/dist/nodes/wait.d.mts +2 -0
- package/dist/nodes/wait.mjs +12 -0
- package/dist/nodes/webhook.d.mts +2 -0
- package/dist/nodes/webhook.mjs +24 -0
- package/dist/orchestrator-DwMIJRFI.d.mts +8 -0
- package/dist/persistent-event-bus-COiQOpWh.d.mts +68 -0
- package/dist/replay-CVOy6d_L.d.mts +44 -0
- package/dist/runtime/adapter.d.mts +2 -0
- package/dist/runtime/adapter.mjs +349 -0
- package/dist/runtime/builtin-keys.d.mts +37 -0
- package/dist/runtime/builtin-keys.mjs +12 -0
- package/dist/runtime/execution-context.d.mts +2 -0
- package/dist/runtime/execution-context.mjs +26 -0
- package/dist/runtime/executors.d.mts +2 -0
- package/dist/runtime/executors.mjs +259 -0
- package/dist/runtime/index.d.mts +6 -0
- package/dist/runtime/index.mjs +10 -0
- package/dist/runtime/node-executor-factory.d.mts +11 -0
- package/dist/runtime/node-executor-factory.mjs +41 -0
- package/dist/runtime/orchestrator.d.mts +2 -0
- package/dist/runtime/orchestrator.mjs +41 -0
- package/dist/runtime/orchestrators/replay.d.mts +2 -0
- package/dist/{replay-BB11M6K1.mjs → runtime/orchestrators/replay.mjs} +1 -20
- package/dist/runtime/orchestrators/step-by-step.d.mts +15 -0
- package/dist/runtime/orchestrators/step-by-step.mjs +41 -0
- package/dist/runtime/orchestrators/utils.d.mts +2 -0
- package/dist/runtime/orchestrators/utils.mjs +79 -0
- package/dist/runtime/runtime.d.mts +2 -0
- package/dist/runtime/runtime.mjs +425 -0
- package/dist/runtime/scheduler.d.mts +2 -0
- package/dist/runtime/scheduler.mjs +64 -0
- package/dist/runtime/state.d.mts +2 -0
- package/dist/runtime/state.mjs +127 -0
- package/dist/runtime/traverser.d.mts +2 -0
- package/dist/runtime/traverser.mjs +213 -0
- package/dist/runtime/types.d.mts +2 -0
- package/dist/runtime/types.mjs +1 -0
- package/dist/runtime/workflow-logic-handler.d.mts +16 -0
- package/dist/runtime/workflow-logic-handler.mjs +159 -0
- package/dist/sanitizer-Bi00YjvO.d.mts +11 -0
- package/dist/sanitizer.d.mts +2 -0
- package/dist/sanitizer.mjs +37 -0
- package/dist/sdk.d.mts +1 -2
- package/dist/sdk.mjs +1 -2
- package/dist/serializer-BnmJr13R.d.mts +17 -0
- package/dist/serializer.d.mts +2 -0
- package/dist/serializer.mjs +34 -0
- package/dist/sleep-DpwYaY5b.d.mts +8 -0
- package/dist/subflow-n2IMsRe2.d.mts +8 -0
- package/dist/testing/event-logger.d.mts +62 -0
- package/dist/testing/event-logger.mjs +98 -0
- package/dist/testing/index.d.mts +5 -172
- package/dist/testing/index.mjs +6 -276
- package/dist/testing/run-with-trace.d.mts +37 -0
- package/dist/testing/run-with-trace.mjs +49 -0
- package/dist/testing/stepper.d.mts +78 -0
- package/dist/testing/stepper.mjs +100 -0
- package/dist/types-BcrXJEPI.d.mts +687 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils-BUEgr9V2.d.mts +34 -0
- package/dist/wait-2Q-LA7V7.d.mts +8 -0
- package/dist/webhook-BiCm-HLx.d.mts +12 -0
- package/package.json +4 -4
- package/dist/index-DUPpyNvU.d.mts +0 -1326
- package/dist/index.mjs.map +0 -1
- package/dist/replay-BB11M6K1.mjs.map +0 -1
- package/dist/runtime-lNm7WbD1.mjs +0 -2250
- package/dist/runtime-lNm7WbD1.mjs.map +0 -1
- package/dist/sdk.mjs.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
package/dist/flow.mjs
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { isNodeClass } from "./node.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/flow.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates a deterministic hash for a function based on its source code and a unique counter.
|
|
6
|
+
*/
|
|
7
|
+
let hashCounter = 0;
|
|
8
|
+
function _hashFunction(fn) {
|
|
9
|
+
const source = fn.toString();
|
|
10
|
+
let hash = 0;
|
|
11
|
+
for (let i = 0; i < source.length; i++) {
|
|
12
|
+
const char = source.charCodeAt(i);
|
|
13
|
+
hash = (hash << 5) - hash + char;
|
|
14
|
+
hash = hash & hash;
|
|
15
|
+
}
|
|
16
|
+
return (Math.abs(hash) + hashCounter++).toString(16);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A fluent API for programmatically constructing a WorkflowBlueprint.
|
|
20
|
+
*/
|
|
21
|
+
var FlowBuilder = class {
|
|
22
|
+
blueprint;
|
|
23
|
+
functionRegistry;
|
|
24
|
+
loopDefinitions;
|
|
25
|
+
batchDefinitions;
|
|
26
|
+
cycleEntryPoints;
|
|
27
|
+
constructor(id) {
|
|
28
|
+
this.blueprint = {
|
|
29
|
+
id,
|
|
30
|
+
nodes: [],
|
|
31
|
+
edges: []
|
|
32
|
+
};
|
|
33
|
+
this.functionRegistry = /* @__PURE__ */ new Map();
|
|
34
|
+
this.loopDefinitions = [];
|
|
35
|
+
this.batchDefinitions = [];
|
|
36
|
+
this.cycleEntryPoints = /* @__PURE__ */ new Map();
|
|
37
|
+
}
|
|
38
|
+
node(id, implementation, options) {
|
|
39
|
+
let usesKey;
|
|
40
|
+
if (isNodeClass(implementation)) {
|
|
41
|
+
usesKey = implementation.name && implementation.name !== "BaseNode" ? implementation.name : `class_${_hashFunction(implementation)}`;
|
|
42
|
+
this.functionRegistry.set(usesKey, implementation);
|
|
43
|
+
} else {
|
|
44
|
+
usesKey = `fn_${_hashFunction(implementation)}`;
|
|
45
|
+
this.functionRegistry.set(usesKey, implementation);
|
|
46
|
+
}
|
|
47
|
+
const nodeDef = {
|
|
48
|
+
id,
|
|
49
|
+
uses: usesKey,
|
|
50
|
+
...options
|
|
51
|
+
};
|
|
52
|
+
this.blueprint.nodes?.push(nodeDef);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
edge(source, target, options) {
|
|
56
|
+
const edgeDef = {
|
|
57
|
+
source,
|
|
58
|
+
target,
|
|
59
|
+
...options
|
|
60
|
+
};
|
|
61
|
+
this.blueprint.edges?.push(edgeDef);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a batch processing pattern.
|
|
66
|
+
* It takes an input array, runs a worker node on each item in parallel, and gathers the results.
|
|
67
|
+
* This method augments the Flow's TContext with a new key for the output array.
|
|
68
|
+
*
|
|
69
|
+
* @param id The base ID for this batch operation.
|
|
70
|
+
* @param worker The node implementation to run on each item.
|
|
71
|
+
* @param options Configuration for the batch operation.
|
|
72
|
+
* @returns The Flow instance with an updated context type for chaining.
|
|
73
|
+
*/
|
|
74
|
+
batch(id, worker, options) {
|
|
75
|
+
const { inputKey, outputKey } = options;
|
|
76
|
+
const scatterId = `${id}_scatter`;
|
|
77
|
+
const gatherId = `${id}_gather`;
|
|
78
|
+
this.batchDefinitions.push({
|
|
79
|
+
id,
|
|
80
|
+
scatterId,
|
|
81
|
+
gatherId
|
|
82
|
+
});
|
|
83
|
+
let workerUsesKey;
|
|
84
|
+
if (isNodeClass(worker)) {
|
|
85
|
+
workerUsesKey = worker.name && worker.name !== "BaseNode" ? worker.name : `class_batch_worker_${_hashFunction(worker)}`;
|
|
86
|
+
this.functionRegistry.set(workerUsesKey, worker);
|
|
87
|
+
} else {
|
|
88
|
+
workerUsesKey = `fn_batch_worker_${_hashFunction(worker)}`;
|
|
89
|
+
this.functionRegistry.set(workerUsesKey, worker);
|
|
90
|
+
}
|
|
91
|
+
this.blueprint.nodes?.push({
|
|
92
|
+
id: scatterId,
|
|
93
|
+
uses: "batch-scatter",
|
|
94
|
+
inputs: inputKey,
|
|
95
|
+
params: {
|
|
96
|
+
workerUsesKey,
|
|
97
|
+
outputKey,
|
|
98
|
+
gatherNodeId: gatherId,
|
|
99
|
+
chunkSize: options.chunkSize
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
this.blueprint.nodes?.push({
|
|
103
|
+
id: gatherId,
|
|
104
|
+
uses: "batch-gather",
|
|
105
|
+
params: {
|
|
106
|
+
outputKey,
|
|
107
|
+
gatherNodeId: gatherId
|
|
108
|
+
},
|
|
109
|
+
config: { joinStrategy: "all" }
|
|
110
|
+
});
|
|
111
|
+
this.edge(scatterId, gatherId);
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Creates a sleep node that pauses workflow execution for a specified duration.
|
|
116
|
+
* @param id A unique identifier for the sleep node.
|
|
117
|
+
* @param options Configuration for the sleep duration.
|
|
118
|
+
*/
|
|
119
|
+
sleep(id, options) {
|
|
120
|
+
const nodeDef = {
|
|
121
|
+
id,
|
|
122
|
+
uses: "sleep",
|
|
123
|
+
params: { duration: options.duration }
|
|
124
|
+
};
|
|
125
|
+
this.blueprint.nodes?.push(nodeDef);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Creates a wait node that pauses workflow execution for external input.
|
|
130
|
+
* @param id A unique identifier for the wait node.
|
|
131
|
+
* @param options Optional configuration for the wait node.
|
|
132
|
+
*/
|
|
133
|
+
wait(id, options) {
|
|
134
|
+
const nodeDef = {
|
|
135
|
+
id,
|
|
136
|
+
uses: "wait",
|
|
137
|
+
...options
|
|
138
|
+
};
|
|
139
|
+
this.blueprint.nodes?.push(nodeDef);
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Creates a loop pattern in the workflow graph.
|
|
144
|
+
* @param id A unique identifier for the loop construct.
|
|
145
|
+
* @param options Defines the start, end, and continuation condition of the loop.
|
|
146
|
+
* @param options.startNodeId The ID of the first node inside the loop body.
|
|
147
|
+
* @param options.endNodeId The ID of the last node inside the loop body.
|
|
148
|
+
* @param options.condition An expression that, if true, causes the loop to run again.
|
|
149
|
+
*/
|
|
150
|
+
loop(id, options) {
|
|
151
|
+
const { startNodeId, endNodeId, condition } = options;
|
|
152
|
+
this.loopDefinitions.push({
|
|
153
|
+
id,
|
|
154
|
+
startNodeId,
|
|
155
|
+
endNodeId,
|
|
156
|
+
condition
|
|
157
|
+
});
|
|
158
|
+
this.blueprint.nodes?.push({
|
|
159
|
+
id,
|
|
160
|
+
uses: "loop-controller",
|
|
161
|
+
params: { condition },
|
|
162
|
+
config: { joinStrategy: "any" }
|
|
163
|
+
});
|
|
164
|
+
this.edge(endNodeId, id);
|
|
165
|
+
this.edge(id, startNodeId, {
|
|
166
|
+
action: "continue",
|
|
167
|
+
transform: `context["${endNodeId}"]`
|
|
168
|
+
});
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Sets the preferred entry point for a cycle in non-DAG workflows.
|
|
173
|
+
* This helps remove ambiguity when the runtime needs to choose a starting node for cycles.
|
|
174
|
+
* @param nodeId The ID of the node to use as the entry point for cycles containing this node.
|
|
175
|
+
*/
|
|
176
|
+
setCycleEntryPoint(nodeId) {
|
|
177
|
+
this.cycleEntryPoints.set(nodeId, nodeId);
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
toBlueprint() {
|
|
181
|
+
if (!this.blueprint.nodes || this.blueprint.nodes.length === 0) throw new Error("Cannot build a blueprint with no nodes.");
|
|
182
|
+
const finalEdges = [];
|
|
183
|
+
const processedOriginalEdges = /* @__PURE__ */ new Set();
|
|
184
|
+
const allOriginalEdges = this.blueprint.edges || [];
|
|
185
|
+
for (const loopDef of this.loopDefinitions) {
|
|
186
|
+
const edgesToRewire = allOriginalEdges.filter((e) => e.source === loopDef.id && e.target !== loopDef.startNodeId);
|
|
187
|
+
for (const edge of edgesToRewire) {
|
|
188
|
+
finalEdges.push({
|
|
189
|
+
...edge,
|
|
190
|
+
action: edge.action || "break",
|
|
191
|
+
transform: `context["${loopDef.endNodeId}"]`
|
|
192
|
+
});
|
|
193
|
+
processedOriginalEdges.add(edge);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
for (const batchDef of this.batchDefinitions) {
|
|
197
|
+
const incomingEdges = allOriginalEdges.filter((e) => e.target === batchDef.id);
|
|
198
|
+
for (const edge of incomingEdges) {
|
|
199
|
+
finalEdges.push({
|
|
200
|
+
...edge,
|
|
201
|
+
target: batchDef.scatterId
|
|
202
|
+
});
|
|
203
|
+
processedOriginalEdges.add(edge);
|
|
204
|
+
}
|
|
205
|
+
const outgoingEdges = allOriginalEdges.filter((e) => e.source === batchDef.id);
|
|
206
|
+
for (const edge of outgoingEdges) {
|
|
207
|
+
finalEdges.push({
|
|
208
|
+
...edge,
|
|
209
|
+
source: batchDef.gatherId
|
|
210
|
+
});
|
|
211
|
+
processedOriginalEdges.add(edge);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
for (const edge of allOriginalEdges) if (!processedOriginalEdges.has(edge)) finalEdges.push(edge);
|
|
215
|
+
this.blueprint.edges = finalEdges;
|
|
216
|
+
for (const loopDef of this.loopDefinitions) {
|
|
217
|
+
const startNode = this.blueprint.nodes?.find((n) => n.id === loopDef.startNodeId);
|
|
218
|
+
const endNode = this.blueprint.nodes?.find((n) => n.id === loopDef.endNodeId);
|
|
219
|
+
if (!startNode) throw new Error(`Loop '${loopDef.id}' references non-existent start node '${loopDef.startNodeId}'.`);
|
|
220
|
+
if (!endNode) throw new Error(`Loop '${loopDef.id}' references non-existent end node '${loopDef.endNodeId}'.`);
|
|
221
|
+
}
|
|
222
|
+
if (this.cycleEntryPoints.size > 0) this.blueprint.metadata = {
|
|
223
|
+
...this.blueprint.metadata,
|
|
224
|
+
cycleEntryPoints: Array.from(this.cycleEntryPoints.keys())
|
|
225
|
+
};
|
|
226
|
+
return this.blueprint;
|
|
227
|
+
}
|
|
228
|
+
getFunctionRegistry() {
|
|
229
|
+
return this.functionRegistry;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Runs this flow on the given runtime, automatically passing the function registry.
|
|
233
|
+
* Convenience wrapper around `runtime.run(blueprint, initialState, { functionRegistry })`.
|
|
234
|
+
*/
|
|
235
|
+
async run(runtime, initialState = {}, options) {
|
|
236
|
+
return runtime.run(this.toBlueprint(), initialState, {
|
|
237
|
+
...options,
|
|
238
|
+
functionRegistry: this.functionRegistry
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Resumes this flow on the given runtime, automatically passing the function registry.
|
|
243
|
+
* Convenience wrapper around `runtime.resume(blueprint, ...)`.
|
|
244
|
+
*/
|
|
245
|
+
async resume(runtime, serializedContext, resumeData, nodeId, options) {
|
|
246
|
+
return runtime.resume(this.toBlueprint(), serializedContext, resumeData, nodeId, {
|
|
247
|
+
...options,
|
|
248
|
+
functionRegistry: this.functionRegistry
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
toGraphRepresentation() {
|
|
252
|
+
const blueprint = this.toBlueprint();
|
|
253
|
+
const uiNodes = [];
|
|
254
|
+
const uiEdges = [];
|
|
255
|
+
const ignoredNodeIds = /* @__PURE__ */ new Set();
|
|
256
|
+
for (const loopDef of this.loopDefinitions) {
|
|
257
|
+
const id = loopDef.id;
|
|
258
|
+
ignoredNodeIds.add(id);
|
|
259
|
+
uiEdges.push({
|
|
260
|
+
source: loopDef.endNodeId,
|
|
261
|
+
target: loopDef.startNodeId,
|
|
262
|
+
data: {
|
|
263
|
+
isLoopback: true,
|
|
264
|
+
condition: loopDef.condition,
|
|
265
|
+
label: `continue if: ${loopDef.condition}`
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
const breakEdges = blueprint.edges.filter((edge) => edge.source === id && edge.action === "break");
|
|
269
|
+
for (const breakEdge of breakEdges) uiEdges.push({
|
|
270
|
+
...breakEdge,
|
|
271
|
+
source: loopDef.endNodeId
|
|
272
|
+
});
|
|
273
|
+
const incomingEdges = blueprint.edges.filter((edge) => edge.target === id && edge.source !== loopDef.endNodeId);
|
|
274
|
+
for (const incomingEdge of incomingEdges) uiEdges.push({
|
|
275
|
+
...incomingEdge,
|
|
276
|
+
target: loopDef.startNodeId
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
const scatterNodes = blueprint.nodes.filter((n) => n.uses === "batch-scatter");
|
|
280
|
+
for (const scatterNode of scatterNodes) {
|
|
281
|
+
const gatherNodeId = scatterNode.params?.gatherNodeId;
|
|
282
|
+
if (!gatherNodeId) continue;
|
|
283
|
+
ignoredNodeIds.add(scatterNode.id);
|
|
284
|
+
ignoredNodeIds.add(gatherNodeId);
|
|
285
|
+
const batchId = scatterNode.id.replace("_scatter", "");
|
|
286
|
+
const gatherNode = blueprint.nodes.find((n) => n.id === gatherNodeId);
|
|
287
|
+
uiNodes.push({
|
|
288
|
+
id: batchId,
|
|
289
|
+
uses: scatterNode.params?.workerUsesKey,
|
|
290
|
+
type: "batch-worker",
|
|
291
|
+
data: {
|
|
292
|
+
label: `Batch: ${batchId}`,
|
|
293
|
+
isBatchPlaceholder: true,
|
|
294
|
+
workerUsesKey: scatterNode.params?.workerUsesKey,
|
|
295
|
+
inputKey: scatterNode.inputs,
|
|
296
|
+
outputKey: gatherNode?.params?.outputKey
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
const incomingEdges = blueprint.edges.filter((e) => e.target === scatterNode.id);
|
|
300
|
+
for (const edge of incomingEdges) uiEdges.push({
|
|
301
|
+
...edge,
|
|
302
|
+
target: batchId
|
|
303
|
+
});
|
|
304
|
+
const outgoingEdges = blueprint.edges.filter((e) => e.source === gatherNodeId);
|
|
305
|
+
for (const edge of outgoingEdges) uiEdges.push({
|
|
306
|
+
...edge,
|
|
307
|
+
source: batchId
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
for (const node of blueprint.nodes) if (!ignoredNodeIds.has(node.id)) uiNodes.push(node);
|
|
311
|
+
for (const edge of blueprint.edges) if (!ignoredNodeIds.has(edge.source) && !ignoredNodeIds.has(edge.target)) {
|
|
312
|
+
if (!uiEdges.some((e) => e.source === edge.source && e.target === edge.target && e.action === edge.action)) uiEdges.push(edge);
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
nodes: uiNodes,
|
|
316
|
+
edges: uiEdges
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Helper function to create a new Flow builder instance.
|
|
322
|
+
*/
|
|
323
|
+
function createFlow(id) {
|
|
324
|
+
return new FlowBuilder(id);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
//#endregion
|
|
328
|
+
export { FlowBuilder, createFlow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as FlowcraftError } from "./errors-CyyIj3OO.mjs";
|
|
2
|
+
import { A as FlowRuntime, B as NodeExecutionResult, C as UIGraph, D as WorkflowResult, E as WorkflowError, F as GraphTraverser, H as NodeExecutorConfig, I as ReadyNode, K as BaseNode, L as ClassNodeExecutor, M as IOrchestrator, N as IRuntime, O as WorkflowStatus, P as NodeExecutorFactory, R as ExecutionStrategy, S as SourceLocation, T as WorkflowBlueprintMetadata, U as WorkflowState, V as NodeExecutor, _ as NodeRegistry, a as IEvaluator, b as RuntimeDependencies, c as ISerializer, d as NodeClass, f as NodeConfig, g as NodeImplementation, h as NodeFunction, i as IAsyncContext, j as ExecutionServices, l as ISyncContext, m as NodeDefinition, n as EdgeDefinition, o as IEventBus, p as NodeContext, q as isNodeClass, r as FlowcraftEvent, s as ILogger, t as ContextImplementation, u as Middleware, v as NodeResult, w as WorkflowBlueprint, x as RuntimeOptions, y as PatchOperation, z as FunctionNodeExecutor } from "./types-BcrXJEPI.mjs";
|
|
3
|
+
import { n as ServiceToken, r as ServiceTokens, t as DIContainer } from "./container-BKdd-9wf.mjs";
|
|
4
|
+
import { n as InMemoryEventStore, r as PersistentEventBusAdapter, t as IEventStore } from "./persistent-event-bus-COiQOpWh.mjs";
|
|
5
|
+
import { a as generateMermaid, i as checkForCycles, n as Cycles, o as generateMermaidForRun, r as analyzeBlueprint, t as BlueprintAnalysis } from "./analysis-B5Twr7sD.mjs";
|
|
6
|
+
import { n as createDefaultContainer, t as ContainerOptions } from "./container-factory-fDY2kkxt.mjs";
|
|
7
|
+
import { n as Context, r as TrackedAsyncContext, t as AsyncContextView } from "./context-ZVtzXuZu.mjs";
|
|
8
|
+
import { t as createErrorMapper } from "./error-mapper-BAv_YQMQ.mjs";
|
|
9
|
+
import { n as UnsafeEvaluator, t as PropertyEvaluator } from "./evaluator-Dnj5qJ92.mjs";
|
|
10
|
+
import { n as createFlow, t as FlowBuilder } from "./flow-CZGpYpl-.mjs";
|
|
11
|
+
import { i as lintBlueprint, n as LinterIssueCode, r as LinterResult, t as LinterIssue } from "./linter-B8KALEae.mjs";
|
|
12
|
+
import { n as NullLogger, t as ConsoleLogger } from "./logger-BvDgvNHQ.mjs";
|
|
13
|
+
import { t as BatchGatherNode } from "./batch-gather-BhF-IzQR.mjs";
|
|
14
|
+
import { t as BatchScatterNode } from "./batch-scatter-DD8TU0Wm.mjs";
|
|
15
|
+
import { t as SleepNode } from "./sleep-DpwYaY5b.mjs";
|
|
16
|
+
import { t as SubflowNode } from "./subflow-n2IMsRe2.mjs";
|
|
17
|
+
import { t as WaitNode } from "./wait-2Q-LA7V7.mjs";
|
|
18
|
+
import { t as WebhookNode } from "./webhook-BiCm-HLx.mjs";
|
|
19
|
+
import { i as JobPayload, n as BaseDistributedAdapter, r as ICoordinationStore, t as AdapterOptions } from "./adapter-DzeZVjSE.mjs";
|
|
20
|
+
import { t as DefaultOrchestrator } from "./orchestrator-DwMIJRFI.mjs";
|
|
21
|
+
import { t as ReplayOrchestrator } from "./replay-CVOy6d_L.mjs";
|
|
22
|
+
import { n as processResults, t as executeBatch } from "./utils-BUEgr9V2.mjs";
|
|
23
|
+
import { t as sanitizeBlueprint } from "./sanitizer-Bi00YjvO.mjs";
|
|
24
|
+
import { t as JsonSerializer } from "./serializer-BnmJr13R.mjs";
|
|
2
25
|
export { AdapterOptions, AsyncContextView, BaseDistributedAdapter, BaseNode, BatchGatherNode, BatchScatterNode, BlueprintAnalysis, ClassNodeExecutor, ConsoleLogger, ContainerOptions, Context, ContextImplementation, Cycles, DIContainer, DefaultOrchestrator, EdgeDefinition, ExecutionServices, ExecutionStrategy, FlowBuilder, FlowRuntime, FlowcraftError, FlowcraftEvent, FunctionNodeExecutor, GraphTraverser, IAsyncContext, ICoordinationStore, IEvaluator, IEventBus, IEventStore, ILogger, IOrchestrator, IRuntime, ISerializer, ISyncContext, InMemoryEventStore, JobPayload, JsonSerializer, LinterIssue, LinterIssueCode, LinterResult, Middleware, NodeClass, NodeConfig, NodeContext, NodeDefinition, NodeExecutionResult, NodeExecutor, NodeExecutorConfig, NodeExecutorFactory, NodeFunction, NodeImplementation, NodeRegistry, NodeResult, NullLogger, PatchOperation, PersistentEventBusAdapter, PropertyEvaluator, ReadyNode, ReplayOrchestrator, RuntimeDependencies, RuntimeOptions, ServiceToken, ServiceTokens, SleepNode, SourceLocation, SubflowNode, TrackedAsyncContext, UIGraph, UnsafeEvaluator, WaitNode, WebhookNode, WorkflowBlueprint, WorkflowBlueprintMetadata, WorkflowError, WorkflowResult, WorkflowState, WorkflowStatus, analyzeBlueprint, checkForCycles, createDefaultContainer, createErrorMapper, createFlow, executeBatch, generateMermaid, generateMermaidForRun, isNodeClass, lintBlueprint, processResults, sanitizeBlueprint };
|