@bian-womp/spark-graph 0.3.49 → 0.3.51
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/lib/cjs/index.cjs +129 -108
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/types.d.ts +1 -0
- package/lib/cjs/src/core/types.d.ts.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +7 -2
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/LocalEngine.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/NodeExecutor.d.ts +8 -4
- package/lib/cjs/src/runtime/components/NodeExecutor.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/interfaces.d.ts +5 -1
- package/lib/cjs/src/runtime/components/interfaces.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/types.d.ts +1 -0
- package/lib/cjs/src/runtime/components/types.d.ts.map +1 -1
- package/lib/esm/index.js +129 -108
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/types.d.ts +1 -0
- package/lib/esm/src/core/types.d.ts.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +7 -2
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/LocalEngine.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/NodeExecutor.d.ts +8 -4
- package/lib/esm/src/runtime/components/NodeExecutor.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/interfaces.d.ts +5 -1
- package/lib/esm/src/runtime/components/interfaces.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/types.d.ts +1 -0
- package/lib/esm/src/runtime/components/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/lib/src/builder/GraphBuilder.d.ts +0 -43
- package/lib/src/builder/GraphBuilder.d.ts.map +0 -1
- package/lib/src/builder/GraphBuilder.js +0 -284
- package/lib/src/builder/GraphBuilder.js.map +0 -1
- package/lib/src/builder/Registry.d.ts +0 -93
- package/lib/src/builder/Registry.d.ts.map +0 -1
- package/lib/src/builder/Registry.js +0 -393
- package/lib/src/builder/Registry.js.map +0 -1
- package/lib/src/core/categories.d.ts +0 -22
- package/lib/src/core/categories.d.ts.map +0 -1
- package/lib/src/core/categories.js +0 -2
- package/lib/src/core/categories.js.map +0 -1
- package/lib/src/core/order.d.ts +0 -7
- package/lib/src/core/order.d.ts.map +0 -1
- package/lib/src/core/order.js +0 -66
- package/lib/src/core/order.js.map +0 -1
- package/lib/src/core/type-utils.d.ts +0 -29
- package/lib/src/core/type-utils.d.ts.map +0 -1
- package/lib/src/core/type-utils.js +0 -97
- package/lib/src/core/type-utils.js.map +0 -1
- package/lib/src/core/types.d.ts +0 -92
- package/lib/src/core/types.d.ts.map +0 -1
- package/lib/src/core/types.js +0 -2
- package/lib/src/core/types.js.map +0 -1
- package/lib/src/examples/arrays.d.ts +0 -5
- package/lib/src/examples/arrays.d.ts.map +0 -1
- package/lib/src/examples/arrays.js +0 -49
- package/lib/src/examples/arrays.js.map +0 -1
- package/lib/src/examples/async.d.ts +0 -5
- package/lib/src/examples/async.d.ts.map +0 -1
- package/lib/src/examples/async.js +0 -91
- package/lib/src/examples/async.js.map +0 -1
- package/lib/src/examples/progress.d.ts +0 -5
- package/lib/src/examples/progress.d.ts.map +0 -1
- package/lib/src/examples/progress.js +0 -51
- package/lib/src/examples/progress.js.map +0 -1
- package/lib/src/examples/run.d.ts +0 -2
- package/lib/src/examples/run.d.ts.map +0 -1
- package/lib/src/examples/run.js +0 -32
- package/lib/src/examples/run.js.map +0 -1
- package/lib/src/examples/runMode.d.ts +0 -2
- package/lib/src/examples/runMode.d.ts.map +0 -1
- package/lib/src/examples/runMode.js +0 -223
- package/lib/src/examples/runMode.js.map +0 -1
- package/lib/src/examples/shared.d.ts +0 -5
- package/lib/src/examples/shared.d.ts.map +0 -1
- package/lib/src/examples/shared.js +0 -49
- package/lib/src/examples/shared.js.map +0 -1
- package/lib/src/examples/simple.d.ts +0 -5
- package/lib/src/examples/simple.d.ts.map +0 -1
- package/lib/src/examples/simple.js +0 -79
- package/lib/src/examples/simple.js.map +0 -1
- package/lib/src/examples/snapshot.d.ts +0 -4
- package/lib/src/examples/snapshot.d.ts.map +0 -1
- package/lib/src/examples/snapshot.js +0 -58
- package/lib/src/examples/snapshot.js.map +0 -1
- package/lib/src/examples/validation.d.ts +0 -5
- package/lib/src/examples/validation.d.ts.map +0 -1
- package/lib/src/examples/validation.js +0 -105
- package/lib/src/examples/validation.js.map +0 -1
- package/lib/src/index.d.ts +0 -27
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js +0 -19
- package/lib/src/index.js.map +0 -1
- package/lib/src/misc/base.d.ts +0 -51
- package/lib/src/misc/base.d.ts.map +0 -1
- package/lib/src/misc/base.js +0 -1122
- package/lib/src/misc/base.js.map +0 -1
- package/lib/src/misc/utils/json.d.ts +0 -22
- package/lib/src/misc/utils/json.d.ts.map +0 -1
- package/lib/src/misc/utils/json.js +0 -239
- package/lib/src/misc/utils/json.js.map +0 -1
- package/lib/src/misc/utils/merge.d.ts +0 -51
- package/lib/src/misc/utils/merge.d.ts.map +0 -1
- package/lib/src/misc/utils/merge.js +0 -600
- package/lib/src/misc/utils/merge.js.map +0 -1
- package/lib/src/plugins/composite.d.ts +0 -22
- package/lib/src/plugins/composite.d.ts.map +0 -1
- package/lib/src/plugins/composite.js +0 -59
- package/lib/src/plugins/composite.js.map +0 -1
- package/lib/src/plugins/compute.d.ts +0 -5
- package/lib/src/plugins/compute.d.ts.map +0 -1
- package/lib/src/plugins/compute.js +0 -39
- package/lib/src/plugins/compute.js.map +0 -1
- package/lib/src/runtime/Engine.d.ts +0 -28
- package/lib/src/runtime/Engine.d.ts.map +0 -1
- package/lib/src/runtime/Engine.js +0 -2
- package/lib/src/runtime/Engine.js.map +0 -1
- package/lib/src/runtime/GraphLifecycleApi.d.ts +0 -46
- package/lib/src/runtime/GraphLifecycleApi.d.ts.map +0 -1
- package/lib/src/runtime/GraphLifecycleApi.js +0 -2
- package/lib/src/runtime/GraphLifecycleApi.js.map +0 -1
- package/lib/src/runtime/GraphRuntime.d.ts +0 -94
- package/lib/src/runtime/GraphRuntime.d.ts.map +0 -1
- package/lib/src/runtime/GraphRuntime.js +0 -729
- package/lib/src/runtime/GraphRuntime.js.map +0 -1
- package/lib/src/runtime/LocalEngine.d.ts +0 -45
- package/lib/src/runtime/LocalEngine.d.ts.map +0 -1
- package/lib/src/runtime/LocalEngine.js +0 -89
- package/lib/src/runtime/LocalEngine.js.map +0 -1
- package/lib/src/runtime/components/EdgePropagator.d.ts +0 -101
- package/lib/src/runtime/components/EdgePropagator.d.ts.map +0 -1
- package/lib/src/runtime/components/EdgePropagator.js +0 -372
- package/lib/src/runtime/components/EdgePropagator.js.map +0 -1
- package/lib/src/runtime/components/EventEmitter.d.ts +0 -12
- package/lib/src/runtime/components/EventEmitter.d.ts.map +0 -1
- package/lib/src/runtime/components/EventEmitter.js +0 -33
- package/lib/src/runtime/components/EventEmitter.js.map +0 -1
- package/lib/src/runtime/components/Graph.d.ts +0 -211
- package/lib/src/runtime/components/Graph.d.ts.map +0 -1
- package/lib/src/runtime/components/Graph.js +0 -468
- package/lib/src/runtime/components/Graph.js.map +0 -1
- package/lib/src/runtime/components/HandleResolver.d.ts +0 -36
- package/lib/src/runtime/components/HandleResolver.d.ts.map +0 -1
- package/lib/src/runtime/components/HandleResolver.js +0 -231
- package/lib/src/runtime/components/HandleResolver.js.map +0 -1
- package/lib/src/runtime/components/NodeExecutor.d.ts +0 -110
- package/lib/src/runtime/components/NodeExecutor.d.ts.map +0 -1
- package/lib/src/runtime/components/NodeExecutor.js +0 -659
- package/lib/src/runtime/components/NodeExecutor.js.map +0 -1
- package/lib/src/runtime/components/RunContextManager.d.ts +0 -86
- package/lib/src/runtime/components/RunContextManager.d.ts.map +0 -1
- package/lib/src/runtime/components/RunContextManager.js +0 -302
- package/lib/src/runtime/components/RunContextManager.js.map +0 -1
- package/lib/src/runtime/components/RuntimeValidatorManager.d.ts +0 -31
- package/lib/src/runtime/components/RuntimeValidatorManager.d.ts.map +0 -1
- package/lib/src/runtime/components/RuntimeValidatorManager.js +0 -55
- package/lib/src/runtime/components/RuntimeValidatorManager.js.map +0 -1
- package/lib/src/runtime/components/graph-utils.d.ts +0 -33
- package/lib/src/runtime/components/graph-utils.d.ts.map +0 -1
- package/lib/src/runtime/components/graph-utils.js +0 -292
- package/lib/src/runtime/components/graph-utils.js.map +0 -1
- package/lib/src/runtime/components/interfaces.d.ts +0 -54
- package/lib/src/runtime/components/interfaces.d.ts.map +0 -1
- package/lib/src/runtime/components/interfaces.js +0 -2
- package/lib/src/runtime/components/interfaces.js.map +0 -1
- package/lib/src/runtime/components/types.d.ts +0 -55
- package/lib/src/runtime/components/types.d.ts.map +0 -1
- package/lib/src/runtime/components/types.js +0 -2
- package/lib/src/runtime/components/types.js.map +0 -1
- package/lib/src/runtime/utils.d.ts +0 -67
- package/lib/src/runtime/utils.d.ts.map +0 -1
- package/lib/src/runtime/utils.js +0 -137
- package/lib/src/runtime/utils.js.map +0 -1
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import { isTyped } from "../../core/type-utils";
|
|
2
|
-
import { valuesEqual } from "../utils";
|
|
3
|
-
/**
|
|
4
|
-
* EdgePropagator component - handles value propagation through edges
|
|
5
|
-
*/
|
|
6
|
-
export class EdgePropagator {
|
|
7
|
-
constructor(graph, eventEmitter, runContextManager, handleResolver, nodeExecutor) {
|
|
8
|
-
this.graph = graph;
|
|
9
|
-
this.eventEmitter = eventEmitter;
|
|
10
|
-
this.runContextManager = runContextManager;
|
|
11
|
-
this.handleResolver = handleResolver;
|
|
12
|
-
this.nodeExecutor = nodeExecutor;
|
|
13
|
-
this.arrayInputBuckets = new Map();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Propagate value through edges
|
|
17
|
-
* @param runContextIds - Optional set of run-context IDs. If provided, propagation is run-context aware.
|
|
18
|
-
* If undefined or empty, behaves like auto mode (always propagates values and execution).
|
|
19
|
-
*/
|
|
20
|
-
propagate(srcNodeId, srcHandle, value, runContextIds) {
|
|
21
|
-
// Set source output
|
|
22
|
-
if (!this.setSourceOutput(srcNodeId, srcHandle, value)) {
|
|
23
|
-
return; // Node was removed
|
|
24
|
-
}
|
|
25
|
-
// Find outgoing edges
|
|
26
|
-
const outEdges = this.findOutgoingEdges(srcNodeId, srcHandle);
|
|
27
|
-
// Process each edge
|
|
28
|
-
for (const edge of outEdges) {
|
|
29
|
-
this.propagateToEdge(edge, value, srcNodeId, runContextIds);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Set source output value and emit event
|
|
34
|
-
*/
|
|
35
|
-
setSourceOutput(srcNodeId, srcHandle, value) {
|
|
36
|
-
if (!this.graph.hasNode(srcNodeId)) {
|
|
37
|
-
// Node was removed (e.g., graph updated) but an async emit arrived late; ignore
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
this.graph.updateNodeOutput(srcNodeId, srcHandle, value);
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Find all outgoing edges from a source node handle
|
|
45
|
-
*/
|
|
46
|
-
findOutgoingEdges(srcNodeId, srcHandle) {
|
|
47
|
-
return this.graph.getEdgesBySource(srcNodeId, srcHandle);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Propagate value to a single edge
|
|
51
|
-
*/
|
|
52
|
-
propagateToEdge(edge, value, srcNodeId, runContextIds) {
|
|
53
|
-
// Filter run-contexts
|
|
54
|
-
const effectiveRunContexts = runContextIds && runContextIds.size > 0
|
|
55
|
-
? this.filterEffectiveRunContexts(edge, srcNodeId, runContextIds)
|
|
56
|
-
: undefined;
|
|
57
|
-
if (runContextIds &&
|
|
58
|
-
runContextIds.size > 0 &&
|
|
59
|
-
!(effectiveRunContexts && effectiveRunContexts.size > 0)) {
|
|
60
|
-
return; // No valid run-contexts for this edge
|
|
61
|
-
}
|
|
62
|
-
// Validate union types
|
|
63
|
-
if (!this.validateUnionType(edge, value, srcNodeId)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// Clone value per edge to isolate conversions
|
|
67
|
-
let nextVal = structuredClone(value);
|
|
68
|
-
// Apply conversion and propagate
|
|
69
|
-
if (edge.convertAsync) {
|
|
70
|
-
this.handleAsyncConversion(edge, nextVal, effectiveRunContexts);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.handleSyncConversion(edge, nextVal, effectiveRunContexts);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Filter run-contexts to exclude cancelled nodes
|
|
78
|
-
*/
|
|
79
|
-
filterEffectiveRunContexts(edge, srcNodeId, runContextIds) {
|
|
80
|
-
const effectiveRunContexts = new Set();
|
|
81
|
-
for (const id of runContextIds) {
|
|
82
|
-
const ctx = this.runContextManager.getRunContext(id);
|
|
83
|
-
if (!ctx)
|
|
84
|
-
continue;
|
|
85
|
-
if (ctx.cancelledNodes.has(srcNodeId))
|
|
86
|
-
continue;
|
|
87
|
-
if (ctx.cancelledNodes.has(edge.target.nodeId))
|
|
88
|
-
continue;
|
|
89
|
-
effectiveRunContexts.add(id);
|
|
90
|
-
}
|
|
91
|
-
return effectiveRunContexts.size > 0 ? effectiveRunContexts : undefined;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Validate union type requirements
|
|
95
|
-
*/
|
|
96
|
-
validateUnionType(edge, value, srcNodeId) {
|
|
97
|
-
const isUnion = Array.isArray(edge.srcUnionTypes);
|
|
98
|
-
const isTypedValue = isTyped(value);
|
|
99
|
-
if (isUnion && !isTypedValue) {
|
|
100
|
-
const err = new Error(`Output ${srcNodeId}.${edge.source.handle} requires typed value for union output (allowed: ${edge.srcUnionTypes.join("|")})`);
|
|
101
|
-
this.eventEmitter.emit("error", {
|
|
102
|
-
kind: "edge-convert",
|
|
103
|
-
edgeId: edge.id,
|
|
104
|
-
source: { nodeId: edge.source.nodeId, handle: edge.source.handle },
|
|
105
|
-
target: { nodeId: edge.target.nodeId, handle: edge.target.handle },
|
|
106
|
-
err,
|
|
107
|
-
});
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Handle synchronous conversion
|
|
114
|
-
*/
|
|
115
|
-
handleSyncConversion(edge, value, effectiveRunContexts) {
|
|
116
|
-
let convertedValue = value;
|
|
117
|
-
if (edge.convert) {
|
|
118
|
-
convertedValue = edge.convert(value);
|
|
119
|
-
}
|
|
120
|
-
this.applyToTarget(edge, convertedValue, effectiveRunContexts);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Handle asynchronous conversion
|
|
124
|
-
*/
|
|
125
|
-
handleAsyncConversion(edge, value, effectiveRunContexts) {
|
|
126
|
-
if (!edge.convertAsync)
|
|
127
|
-
return;
|
|
128
|
-
// Track edge run-context IDs for pendingEdges tracking
|
|
129
|
-
const edgeRunContextIds = effectiveRunContexts
|
|
130
|
-
? Array.from(effectiveRunContexts)
|
|
131
|
-
: undefined;
|
|
132
|
-
if (edgeRunContextIds) {
|
|
133
|
-
for (const id of edgeRunContextIds) {
|
|
134
|
-
this.runContextManager.startEdgeConversion(id, edge.id);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
this.eventEmitter.emit("stats", {
|
|
138
|
-
kind: "edge-start",
|
|
139
|
-
edgeId: edge.id,
|
|
140
|
-
typeId: edge.typeId,
|
|
141
|
-
source: { nodeId: edge.source.nodeId, handle: edge.source.handle },
|
|
142
|
-
target: { nodeId: edge.target.nodeId, handle: edge.target.handle },
|
|
143
|
-
});
|
|
144
|
-
const controller = new AbortController();
|
|
145
|
-
const startAt = Date.now();
|
|
146
|
-
const currentStats = edge.stats;
|
|
147
|
-
this.graph.updateEdgeStats(edge.id, {
|
|
148
|
-
runs: currentStats.runs + 1,
|
|
149
|
-
inFlight: true,
|
|
150
|
-
progress: 0,
|
|
151
|
-
});
|
|
152
|
-
edge
|
|
153
|
-
.convertAsync(value, controller.signal)
|
|
154
|
-
.then((converted) => {
|
|
155
|
-
if (!controller.signal.aborted) {
|
|
156
|
-
this.applyToTarget(edge, converted, effectiveRunContexts);
|
|
157
|
-
this.updateEdgeStatsOnSuccess(edge, startAt);
|
|
158
|
-
}
|
|
159
|
-
})
|
|
160
|
-
.catch((err) => {
|
|
161
|
-
if (controller.signal.aborted)
|
|
162
|
-
return;
|
|
163
|
-
this.handleEdgeConversionError(edge, err);
|
|
164
|
-
})
|
|
165
|
-
.finally(() => {
|
|
166
|
-
this.finishEdgeConversion(edgeRunContextIds, edge.id);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Apply value to target node input
|
|
171
|
-
*/
|
|
172
|
-
applyToTarget(edge, value, effectiveRunContexts) {
|
|
173
|
-
const dstNode = this.graph.getNode(edge.target.nodeId);
|
|
174
|
-
if (!dstNode)
|
|
175
|
-
return;
|
|
176
|
-
// Skip writing to unresolved handles
|
|
177
|
-
if (edge.dstDeclared === undefined)
|
|
178
|
-
return;
|
|
179
|
-
// Handle array types
|
|
180
|
-
const processedValue = this.processArrayInput(edge, value);
|
|
181
|
-
// Check if value changed
|
|
182
|
-
const prev = dstNode.inputs[edge.target.handle];
|
|
183
|
-
const valueChanged = !valuesEqual(prev, processedValue);
|
|
184
|
-
// Check if we should execute even if value is same:
|
|
185
|
-
// 1. If node has rerunOnSameInput policy (from node params or registry)
|
|
186
|
-
// 2. If input was set after last successful run (stale input detection)
|
|
187
|
-
const registry = this.graph.getRegistry();
|
|
188
|
-
const desc = registry?.nodes.get(dstNode.typeId);
|
|
189
|
-
const nodeRerunPolicy = dstNode.policy?.rerunOnSameInput === true;
|
|
190
|
-
const descRerunPolicy = desc?.policy?.rerunOnSameInput === true;
|
|
191
|
-
const shouldRerunOnSameInput = nodeRerunPolicy || descRerunPolicy;
|
|
192
|
-
const inputWasSetAfterLastRun = !dstNode.lastInputAt?.[edge.target.handle] ||
|
|
193
|
-
!dstNode.lastSuccessAt ||
|
|
194
|
-
dstNode.lastInputAt[edge.target.handle] > dstNode.lastSuccessAt;
|
|
195
|
-
const shouldExecute = valueChanged || shouldRerunOnSameInput || inputWasSetAfterLastRun;
|
|
196
|
-
if (!shouldExecute) {
|
|
197
|
-
return; // No change and no reason to rerun
|
|
198
|
-
}
|
|
199
|
-
// Set input value (respecting skipPropagateValues)
|
|
200
|
-
const shouldSetValue = this.shouldSetInputValue(effectiveRunContexts);
|
|
201
|
-
if (shouldSetValue && valueChanged) {
|
|
202
|
-
this.setTargetInput(edge, dstNode, processedValue);
|
|
203
|
-
}
|
|
204
|
-
else if (shouldSetValue && !valueChanged) {
|
|
205
|
-
// Even if value didn't change, update timestamp if we're forcing execution
|
|
206
|
-
const now = Date.now();
|
|
207
|
-
this.graph.updateNodeLastInputAt(edge.target.nodeId, edge.target.handle, now);
|
|
208
|
-
}
|
|
209
|
-
// Schedule downstream execution
|
|
210
|
-
this.executeDownstream(edge.target.nodeId, effectiveRunContexts);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Process array input by merging values from all edges
|
|
214
|
-
*/
|
|
215
|
-
processArrayInput(edge, value) {
|
|
216
|
-
const dstIsArray = typeof edge.dstDeclared === "string" && edge.dstDeclared.endsWith("[]");
|
|
217
|
-
if (!dstIsArray) {
|
|
218
|
-
return value;
|
|
219
|
-
}
|
|
220
|
-
const toArray = (x) => Array.isArray(x) ? x : x === undefined ? [] : [x];
|
|
221
|
-
let forNode = this.arrayInputBuckets.get(edge.target.nodeId);
|
|
222
|
-
if (!forNode) {
|
|
223
|
-
forNode = new Map();
|
|
224
|
-
this.arrayInputBuckets.set(edge.target.nodeId, forNode);
|
|
225
|
-
}
|
|
226
|
-
let forHandle = forNode.get(edge.target.handle);
|
|
227
|
-
if (!forHandle) {
|
|
228
|
-
forHandle = new Map();
|
|
229
|
-
forNode.set(edge.target.handle, forHandle);
|
|
230
|
-
}
|
|
231
|
-
forHandle.set(edge.id, toArray(value));
|
|
232
|
-
// Merge all parts for this handle
|
|
233
|
-
const targetEdges = this.graph.getEdgesByTarget(edge.target.nodeId, edge.target.handle);
|
|
234
|
-
const merged = [];
|
|
235
|
-
for (const ed of targetEdges) {
|
|
236
|
-
const part = forHandle.get(ed.id);
|
|
237
|
-
if (part && part.length)
|
|
238
|
-
merged.push(...part);
|
|
239
|
-
}
|
|
240
|
-
return merged;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Check if input value should be set (respecting skipPropagateValues)
|
|
244
|
-
*/
|
|
245
|
-
shouldSetInputValue(effectiveRunContexts) {
|
|
246
|
-
if (!effectiveRunContexts) {
|
|
247
|
-
return true; // Auto mode always sets values
|
|
248
|
-
}
|
|
249
|
-
// Check skipPropagateValues (only in run-context mode)
|
|
250
|
-
for (const id of effectiveRunContexts) {
|
|
251
|
-
const ctx = this.runContextManager.getRunContext(id);
|
|
252
|
-
if (ctx && ctx.skipPropagateValues) {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return true;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Set target input value and emit event
|
|
260
|
-
*/
|
|
261
|
-
setTargetInput(edge, dstNode, value) {
|
|
262
|
-
this.graph.updateNodeInput(edge.target.nodeId, edge.target.handle, value);
|
|
263
|
-
this.handleResolver.scheduleRecomputeHandles(edge.target.nodeId);
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Execute downstream if conditions are met
|
|
267
|
-
*/
|
|
268
|
-
executeDownstream(targetNodeId, effectiveRunContexts) {
|
|
269
|
-
// Determine if we should propagate
|
|
270
|
-
const shouldPropagate = this.shouldPropagateExecution(effectiveRunContexts);
|
|
271
|
-
if (shouldPropagate && this.graph.allInboundHaveValue(targetNodeId)) {
|
|
272
|
-
this.nodeExecutor.execute(targetNodeId, effectiveRunContexts);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Check if execution should propagate
|
|
277
|
-
*/
|
|
278
|
-
shouldPropagateExecution(effectiveRunContexts) {
|
|
279
|
-
if (!effectiveRunContexts) {
|
|
280
|
-
return true; // Auto mode always propagates
|
|
281
|
-
}
|
|
282
|
-
// Check propagate flag (only in run-context mode)
|
|
283
|
-
for (const id of effectiveRunContexts) {
|
|
284
|
-
const ctx = this.runContextManager.getRunContext(id);
|
|
285
|
-
if (ctx && ctx.propagate) {
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Update edge stats on successful conversion
|
|
293
|
-
*/
|
|
294
|
-
updateEdgeStatsOnSuccess(edge, startAt) {
|
|
295
|
-
const duration = Date.now() - startAt;
|
|
296
|
-
this.graph.updateEdgeStats(edge.id, {
|
|
297
|
-
inFlight: false,
|
|
298
|
-
lastDurationMs: duration,
|
|
299
|
-
lastEndAt: Date.now(),
|
|
300
|
-
lastError: undefined,
|
|
301
|
-
});
|
|
302
|
-
this.eventEmitter.emit("stats", {
|
|
303
|
-
kind: "edge-done",
|
|
304
|
-
edgeId: edge.id,
|
|
305
|
-
typeId: edge.typeId,
|
|
306
|
-
source: { nodeId: edge.source.nodeId, handle: edge.source.handle },
|
|
307
|
-
target: { nodeId: edge.target.nodeId, handle: edge.target.handle },
|
|
308
|
-
durationMs: duration,
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Handle edge conversion error
|
|
313
|
-
*/
|
|
314
|
-
handleEdgeConversionError(edge, err) {
|
|
315
|
-
this.graph.updateEdgeStats(edge.id, {
|
|
316
|
-
inFlight: false,
|
|
317
|
-
lastError: err,
|
|
318
|
-
});
|
|
319
|
-
this.eventEmitter.emit("error", {
|
|
320
|
-
kind: "edge-convert",
|
|
321
|
-
edgeId: edge.id,
|
|
322
|
-
source: { nodeId: edge.source.nodeId, handle: edge.source.handle },
|
|
323
|
-
target: { nodeId: edge.target.nodeId, handle: edge.target.handle },
|
|
324
|
-
err,
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Finish edge conversion and decrement pending edges
|
|
329
|
-
*/
|
|
330
|
-
finishEdgeConversion(edgeRunContextIds, edgeId) {
|
|
331
|
-
if (!edgeRunContextIds)
|
|
332
|
-
return;
|
|
333
|
-
for (const id of edgeRunContextIds) {
|
|
334
|
-
this.runContextManager.finishEdgeConversion(id, edgeId);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Re-emit all outputs from a node (used when graph updates)
|
|
339
|
-
* Only re-emits outputs that are valid according to resolved handles
|
|
340
|
-
*/
|
|
341
|
-
invalidateDownstream(nodeId) {
|
|
342
|
-
const node = this.graph.getNode(nodeId);
|
|
343
|
-
if (!node)
|
|
344
|
-
return;
|
|
345
|
-
// Get resolved handles to filter out invalid outputs
|
|
346
|
-
const resolved = this.graph.getResolvedHandles(nodeId);
|
|
347
|
-
const validOutputHandles = resolved?.outputs
|
|
348
|
-
? new Set(Object.keys(resolved.outputs))
|
|
349
|
-
: new Set();
|
|
350
|
-
// Use node's activeRunContexts to propagate to new nodes that were added
|
|
351
|
-
const activeRunContextIds = this.graph.getNodeRunContextIds(nodeId);
|
|
352
|
-
for (const [handle, value] of Object.entries(node.outputs)) {
|
|
353
|
-
// Only re-emit if this handle is still valid
|
|
354
|
-
if (validOutputHandles.has(handle)) {
|
|
355
|
-
this.propagate(nodeId, handle, value, activeRunContextIds.size > 0 ? activeRunContextIds : undefined);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Clear array input buckets for a node (when node is deleted)
|
|
361
|
-
*/
|
|
362
|
-
clearArrayBuckets(nodeId) {
|
|
363
|
-
this.arrayInputBuckets.delete(nodeId);
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Clear all array buckets
|
|
367
|
-
*/
|
|
368
|
-
clearAllArrayBuckets() {
|
|
369
|
-
this.arrayInputBuckets.clear();
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
//# sourceMappingURL=EdgePropagator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EdgePropagator.js","sourceRoot":"","sources":["../../../../src/runtime/components/EdgePropagator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAK9D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC;;GAEG;AACH,MAAM,OAAO,cAAc;IAMzB,YACmB,KAAY,EACZ,YAA0B,EAC1B,iBAAoC,EACpC,cAA+B,EAC/B,YAA2B;QAJ3B,UAAK,GAAL,KAAK,CAAO;QACZ,iBAAY,GAAZ,YAAY,CAAc;QAC1B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,mBAAc,GAAd,cAAc,CAAiB;QAC/B,iBAAY,GAAZ,YAAY,CAAe;QAVtC,sBAAiB,GAAG,IAAI,GAAG,EAGhC,CAAC;IAQD,CAAC;IAEJ;;;;OAIG;IACH,SAAS,CACP,SAAiB,EACjB,SAAiB,EACjB,KAAc,EACd,aAAiC;QAEjC,oBAAoB;QACpB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,OAAO,CAAC,mBAAmB;QAC7B,CAAC;QAED,sBAAsB;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9D,oBAAoB;QACpB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,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;gBACnC,IAAI,CAAC,SAAS,CACZ,MAAM,EACN,MAAM,EACN,KAAK,EACL,mBAAmB,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,MAAc;QAC9B,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { RuntimeEventName, RuntimeEventMap, RuntimeEventListener } from "../GraphRuntime";
|
|
2
|
-
/**
|
|
3
|
-
* Event emitter component for GraphRuntime
|
|
4
|
-
* Handles all event listener management and emission
|
|
5
|
-
*/
|
|
6
|
-
export declare class EventEmitter {
|
|
7
|
-
private listeners;
|
|
8
|
-
on<K extends RuntimeEventName>(event: K, handler: RuntimeEventListener<K>): () => void;
|
|
9
|
-
emit<K extends RuntimeEventName>(event: K, payload: RuntimeEventMap[K]): void;
|
|
10
|
-
clear(): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAGb;IAEJ,EAAE,CAAC,CAAC,SAAS,gBAAgB,EAC3B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,MAAM,IAAI;IAOb,IAAI,CAAC,CAAC,SAAS,gBAAgB,EAC7B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,IAAI;IAYP,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event emitter component for GraphRuntime
|
|
3
|
-
* Handles all event listener management and emission
|
|
4
|
-
*/
|
|
5
|
-
export class EventEmitter {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.listeners = new Map();
|
|
8
|
-
}
|
|
9
|
-
on(event, handler) {
|
|
10
|
-
if (!this.listeners.has(event))
|
|
11
|
-
this.listeners.set(event, new Set());
|
|
12
|
-
const set = this.listeners.get(event);
|
|
13
|
-
set.add(handler);
|
|
14
|
-
return () => set.delete(handler);
|
|
15
|
-
}
|
|
16
|
-
emit(event, payload) {
|
|
17
|
-
const set = this.listeners.get(event);
|
|
18
|
-
if (!set)
|
|
19
|
-
return;
|
|
20
|
-
for (const handler of Array.from(set)) {
|
|
21
|
-
try {
|
|
22
|
-
handler(payload);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.error(`Error in ${event} handler:`, err);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
clear() {
|
|
30
|
-
this.listeners.clear();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=EventEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../../../../src/runtime/components/EventEmitter.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,OAAO,YAAY;IAAzB;QACU,cAAS,GAAG,IAAI,GAAG,EAGxB,CAAC;IA8BN,CAAC;IA5BC,EAAE,CACA,KAAQ,EACR,OAAgC;QAEhC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACrE,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAiC,CAAC;QACtE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjB,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CACF,KAAQ,EACR,OAA2B;QAE3B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC;gBACH,OAAO,CAAC,OAAO,CAAC,CAAC;YACnB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,YAAY,KAAK,WAAW,EAAE,GAAG,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import type { ResolvedHandles } from "@bian-womp/spark-protocol";
|
|
2
|
-
import { Registry } from "../../builder/Registry";
|
|
3
|
-
import { EventEmitter } from "./EventEmitter";
|
|
4
|
-
import type { RuntimeNode, RuntimeEdge, ReadonlyRuntimeNode, ExecutionPlan } from "./types";
|
|
5
|
-
/**
|
|
6
|
-
* Graph component - manages nodes, edges, and handle resolution
|
|
7
|
-
* This is the ONLY place where nodes, edges, and resolvedByNode are directly updated.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Graph {
|
|
10
|
-
private eventEmitter;
|
|
11
|
-
private registry?;
|
|
12
|
-
private nodes;
|
|
13
|
-
private edges;
|
|
14
|
-
private resolvedByNode;
|
|
15
|
-
constructor(eventEmitter: EventEmitter, registry?: Registry | undefined);
|
|
16
|
-
/**
|
|
17
|
-
* Get a node by ID (readonly to prevent accidental modifications)
|
|
18
|
-
*/
|
|
19
|
-
getNode(nodeId: string): ReadonlyRuntimeNode<any> | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Get a node by ID (mutable, for internal use only)
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
private getNodeMutable;
|
|
25
|
-
/**
|
|
26
|
-
* Iterate over all nodes safely (readonly to prevent accidental modifications)
|
|
27
|
-
*/
|
|
28
|
-
forEachNode(callback: (node: ReadonlyRuntimeNode<any>, nodeId: string) => void): void;
|
|
29
|
-
/**
|
|
30
|
-
* Get all node IDs
|
|
31
|
-
*/
|
|
32
|
-
getNodeIds(): string[];
|
|
33
|
-
/**
|
|
34
|
-
* Check if a node exists
|
|
35
|
-
*/
|
|
36
|
-
hasNode(nodeId: string): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Set a node (creates or replaces)
|
|
39
|
-
*/
|
|
40
|
-
setNode(nodeId: string, node: RuntimeNode<any>): void;
|
|
41
|
-
/**
|
|
42
|
-
* Delete a node
|
|
43
|
-
*/
|
|
44
|
-
deleteNode(nodeId: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Update node inputs
|
|
47
|
-
*/
|
|
48
|
-
updateNodeInput(nodeId: string, handle: string, value: unknown, calculated?: boolean): void;
|
|
49
|
-
/**
|
|
50
|
-
* Update node outputs
|
|
51
|
-
*/
|
|
52
|
-
updateNodeOutput(nodeId: string, handle: string, value: unknown): void;
|
|
53
|
-
/**
|
|
54
|
-
* Update node state
|
|
55
|
-
*/
|
|
56
|
-
updateNodeState(nodeId: string, updates: Partial<RuntimeNode<any>["state"]>): void;
|
|
57
|
-
/**
|
|
58
|
-
* Update node params
|
|
59
|
-
*/
|
|
60
|
-
updateNodeParams(nodeId: string, params: Record<string, unknown> | undefined): void;
|
|
61
|
-
/**
|
|
62
|
-
* Update node policy
|
|
63
|
-
*/
|
|
64
|
-
updateNodePolicy(nodeId: string, policy: Partial<RuntimeNode<any>["policy"]>): void;
|
|
65
|
-
/**
|
|
66
|
-
* Update node stats
|
|
67
|
-
*/
|
|
68
|
-
updateNodeStats(nodeId: string, updates: Partial<RuntimeNode<any>["stats"]>): void;
|
|
69
|
-
/**
|
|
70
|
-
* Increment node runSeq
|
|
71
|
-
*/
|
|
72
|
-
incrementNodeRunSeq(nodeId: string): number;
|
|
73
|
-
/**
|
|
74
|
-
* Set node latestRunId
|
|
75
|
-
*/
|
|
76
|
-
setNodeLatestRunId(nodeId: string, runId: string): void;
|
|
77
|
-
/**
|
|
78
|
-
* Set node lastScheduledAt
|
|
79
|
-
*/
|
|
80
|
-
setNodeLastScheduledAt(nodeId: string, timestamp: number): void;
|
|
81
|
-
/**
|
|
82
|
-
* Update node lastInputAt timestamp for a handle
|
|
83
|
-
*/
|
|
84
|
-
updateNodeLastInputAt(nodeId: string, handle: string, timestamp: number): void;
|
|
85
|
-
/**
|
|
86
|
-
* Set node lastSuccessAt timestamp
|
|
87
|
-
*/
|
|
88
|
-
setNodeLastSuccessAt(nodeId: string, timestamp: number): void;
|
|
89
|
-
/**
|
|
90
|
-
* Add item to node queue
|
|
91
|
-
*/
|
|
92
|
-
addToNodeQueue(nodeId: string, item: ExecutionPlan): void;
|
|
93
|
-
/**
|
|
94
|
-
* Remove first item from node queue
|
|
95
|
-
*/
|
|
96
|
-
shiftNodeQueue(nodeId: string): ExecutionPlan | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Clear node queue
|
|
99
|
-
*/
|
|
100
|
-
clearNodeQueue(nodeId: string): void;
|
|
101
|
-
/**
|
|
102
|
-
* Replace node queue
|
|
103
|
-
*/
|
|
104
|
-
replaceNodeQueue(nodeId: string, items: ExecutionPlan[]): void;
|
|
105
|
-
/**
|
|
106
|
-
* Add controller to node
|
|
107
|
-
*/
|
|
108
|
-
addNodeController(nodeId: string, controller: AbortController, runId: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* Remove controller from node
|
|
111
|
-
*/
|
|
112
|
-
removeNodeController(nodeId: string, controller: AbortController): void;
|
|
113
|
-
/**
|
|
114
|
-
* Clear all controllers from node
|
|
115
|
-
*/
|
|
116
|
-
clearNodeControllers(nodeId: string): void;
|
|
117
|
-
/**
|
|
118
|
-
* Get all controllers for a node
|
|
119
|
-
*/
|
|
120
|
-
getNodeControllers(nodeId: string): Set<AbortController>;
|
|
121
|
-
/**
|
|
122
|
-
* Add run context ID to node
|
|
123
|
-
*/
|
|
124
|
-
addNodeRunContextId(nodeId: string, runContextId: string): void;
|
|
125
|
-
/**
|
|
126
|
-
* Add multiple run context IDs to node
|
|
127
|
-
*/
|
|
128
|
-
addNodeRunContextIds(nodeId: string, runContextIds: Set<string>): void;
|
|
129
|
-
/**
|
|
130
|
-
* Remove run context ID from node
|
|
131
|
-
*/
|
|
132
|
-
removeNodeRunContextId(nodeId: string, runContextId: string): void;
|
|
133
|
-
/**
|
|
134
|
-
* Clear all run context IDs from node
|
|
135
|
-
*/
|
|
136
|
-
clearNodeRunContextIds(nodeId: string): void;
|
|
137
|
-
/**
|
|
138
|
-
* Get run context IDs for a node
|
|
139
|
-
*/
|
|
140
|
-
getNodeRunContextIds(nodeId: string): Set<string>;
|
|
141
|
-
/**
|
|
142
|
-
* Add snapshot cancelled run ID to node
|
|
143
|
-
*/
|
|
144
|
-
addSnapshotCancelledRunId(nodeId: string, runId: string): void;
|
|
145
|
-
/**
|
|
146
|
-
* Iterate over all edges safely
|
|
147
|
-
*/
|
|
148
|
-
forEachEdge(callback: (edge: RuntimeEdge, index: number) => void): void;
|
|
149
|
-
/**
|
|
150
|
-
* Find edges matching a predicate
|
|
151
|
-
*/
|
|
152
|
-
findEdges(predicate: (edge: RuntimeEdge) => boolean): RuntimeEdge[];
|
|
153
|
-
/**
|
|
154
|
-
* Get edges by source node and handle
|
|
155
|
-
*/
|
|
156
|
-
getEdgesBySource(srcNodeId: string, srcHandle: string): RuntimeEdge[];
|
|
157
|
-
/**
|
|
158
|
-
* Get edges by target node and handle
|
|
159
|
-
*/
|
|
160
|
-
getEdgesByTarget(targetNodeId: string, targetHandle: string): RuntimeEdge[];
|
|
161
|
-
/**
|
|
162
|
-
* Get inbound edges for a node
|
|
163
|
-
*/
|
|
164
|
-
getInboundEdges(nodeId: string): RuntimeEdge[];
|
|
165
|
-
/**
|
|
166
|
-
* Get outbound edges for a node
|
|
167
|
-
*/
|
|
168
|
-
getOutboundEdges(nodeId: string): RuntimeEdge[];
|
|
169
|
-
/**
|
|
170
|
-
* Set all edges (replaces existing)
|
|
171
|
-
*/
|
|
172
|
-
setEdges(edges: RuntimeEdge[]): void;
|
|
173
|
-
/**
|
|
174
|
-
* Update an edge by ID
|
|
175
|
-
*/
|
|
176
|
-
updateEdge(edgeId: string, updates: Partial<RuntimeEdge>): void;
|
|
177
|
-
/**
|
|
178
|
-
* Update edge properties (convert, convertAsync, types, etc.)
|
|
179
|
-
*/
|
|
180
|
-
updateEdgeProperties(edgeId: string, updates: {
|
|
181
|
-
dstDeclared?: string | string[];
|
|
182
|
-
srcUnionTypes?: string[] | undefined;
|
|
183
|
-
convert?: ((value: unknown) => unknown) | undefined;
|
|
184
|
-
convertAsync?: ((value: unknown, signal: AbortSignal) => Promise<unknown>) | undefined;
|
|
185
|
-
}): void;
|
|
186
|
-
/**
|
|
187
|
-
* Update edge stats
|
|
188
|
-
*/
|
|
189
|
-
updateEdgeStats(edgeId: string, updates: Partial<RuntimeEdge["stats"]>): void;
|
|
190
|
-
/**
|
|
191
|
-
* Get edge by ID
|
|
192
|
-
*/
|
|
193
|
-
getEdge(edgeId: string): RuntimeEdge | undefined;
|
|
194
|
-
getRegistry(): Registry | undefined;
|
|
195
|
-
setRegistry(registry: Registry): void;
|
|
196
|
-
getResolvedHandles(nodeId: string): ResolvedHandles | undefined;
|
|
197
|
-
setResolvedHandles(nodeId: string, handles: ResolvedHandles): void;
|
|
198
|
-
/**
|
|
199
|
-
* Iterate over resolved handles safely
|
|
200
|
-
*/
|
|
201
|
-
forEachResolvedHandles(callback: (handles: ResolvedHandles, nodeId: string) => void): void;
|
|
202
|
-
/**
|
|
203
|
-
* Check if all inbound edges for a node have values
|
|
204
|
-
*/
|
|
205
|
-
allInboundHaveValue(nodeId: string): boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Clear all data
|
|
208
|
-
*/
|
|
209
|
-
clear(): void;
|
|
210
|
-
}
|
|
211
|
-
//# sourceMappingURL=Graph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../src/runtime/components/Graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,KAAK;IAMd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ,CAAC;IANnB,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,cAAc,CAAsC;gBAGlD,YAAY,EAAE,YAAY,EAC1B,QAAQ,CAAC,EAAE,QAAQ,YAAA;IAK7B;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,GAAG,SAAS;IAI7D;;;OAGG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,WAAW,CACT,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GACjE,IAAI;IAMP;;OAEG;IACH,UAAU,I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