@bian-womp/spark-graph 0.3.58 → 0.3.59
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 +27 -19
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts +9 -8
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/esm/index.js +27 -19
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts +9 -8
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -2573,31 +2573,15 @@ class HandleResolver {
|
|
|
2573
2573
|
* EdgePropagator component - handles value propagation through edges
|
|
2574
2574
|
*/
|
|
2575
2575
|
class EdgePropagator {
|
|
2576
|
-
constructor(graph, eventEmitter, runContextManager, handleResolver, nodeExecutor) {
|
|
2576
|
+
constructor(graph, eventEmitter, runContextManager, handleResolver, nodeExecutor, runtime) {
|
|
2577
2577
|
this.graph = graph;
|
|
2578
2578
|
this.eventEmitter = eventEmitter;
|
|
2579
2579
|
this.runContextManager = runContextManager;
|
|
2580
2580
|
this.handleResolver = handleResolver;
|
|
2581
2581
|
this.nodeExecutor = nodeExecutor;
|
|
2582
|
+
this.runtime = runtime;
|
|
2582
2583
|
this.arrayInputBuckets = new Map();
|
|
2583
2584
|
}
|
|
2584
|
-
/**
|
|
2585
|
-
* Propagate value through edges
|
|
2586
|
-
* @param runContextIds - Optional set of run-context IDs. If provided, propagation is run-context aware.
|
|
2587
|
-
* If undefined or empty, behaves like auto mode (always propagates values and execution).
|
|
2588
|
-
*/
|
|
2589
|
-
propagate(srcNodeId, srcHandle, value, runContextIds) {
|
|
2590
|
-
// Set source output
|
|
2591
|
-
if (!this.setSourceOutput(srcNodeId, srcHandle, value)) {
|
|
2592
|
-
return; // Node was removed
|
|
2593
|
-
}
|
|
2594
|
-
// Find outgoing edges
|
|
2595
|
-
const outEdges = this.findOutgoingEdges(srcNodeId, srcHandle);
|
|
2596
|
-
// Process each edge
|
|
2597
|
-
for (const edge of outEdges) {
|
|
2598
|
-
this.propagateToEdge(edge, value, srcNodeId, runContextIds);
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
2585
|
/**
|
|
2602
2586
|
* Set source output value and emit event
|
|
2603
2587
|
*/
|
|
@@ -2686,6 +2670,9 @@ class EdgePropagator {
|
|
|
2686
2670
|
if (edge.convert) {
|
|
2687
2671
|
convertedValue = edge.convert(value);
|
|
2688
2672
|
}
|
|
2673
|
+
else {
|
|
2674
|
+
console.warn(`No convert function for edge ${edge.id} of type ${edge.source.nodeId}.${edge.source.handle} -> ${edge.target.nodeId}.${edge.target.handle}`);
|
|
2675
|
+
}
|
|
2689
2676
|
this.applyToTarget(edge, convertedValue, effectiveRunContexts);
|
|
2690
2677
|
}
|
|
2691
2678
|
/**
|
|
@@ -2906,11 +2893,32 @@ class EdgePropagator {
|
|
|
2906
2893
|
this.runContextManager.finishEdgeConversion(id, edgeId);
|
|
2907
2894
|
}
|
|
2908
2895
|
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Propagate value through edges
|
|
2898
|
+
* @param runContextIds - Optional set of run-context IDs. If provided, propagation is run-context aware.
|
|
2899
|
+
* If undefined or empty, behaves like auto mode (always propagates values and execution).
|
|
2900
|
+
*/
|
|
2901
|
+
propagate(srcNodeId, srcHandle, value, runContextIds) {
|
|
2902
|
+
if (this.runtime.isPaused())
|
|
2903
|
+
return;
|
|
2904
|
+
// Set source output
|
|
2905
|
+
if (!this.setSourceOutput(srcNodeId, srcHandle, value)) {
|
|
2906
|
+
return; // Node was removed
|
|
2907
|
+
}
|
|
2908
|
+
// Find outgoing edges
|
|
2909
|
+
const outEdges = this.findOutgoingEdges(srcNodeId, srcHandle);
|
|
2910
|
+
// Process each edge
|
|
2911
|
+
for (const edge of outEdges) {
|
|
2912
|
+
this.propagateToEdge(edge, value, srcNodeId, runContextIds);
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2909
2915
|
/**
|
|
2910
2916
|
* Re-emit all outputs from a node (used when graph updates)
|
|
2911
2917
|
* Only re-emits outputs that are valid according to resolved handles
|
|
2912
2918
|
*/
|
|
2913
2919
|
invalidateDownstream(nodeId) {
|
|
2920
|
+
if (this.runtime.isPaused())
|
|
2921
|
+
return;
|
|
2914
2922
|
const node = this.graph.getNode(nodeId);
|
|
2915
2923
|
if (!node)
|
|
2916
2924
|
return;
|
|
@@ -3653,7 +3661,7 @@ class GraphRuntime {
|
|
|
3653
3661
|
this.graph = new Graph(this.eventEmitter);
|
|
3654
3662
|
this.runContextManager = new RunContextManager(this.graph, "warn");
|
|
3655
3663
|
this.handleResolver = new HandleResolver(this.graph, this.eventEmitter, this.runContextManager, this);
|
|
3656
|
-
this.edgePropagator = new EdgePropagator(this.graph, this.eventEmitter, this.runContextManager, this.handleResolver, this);
|
|
3664
|
+
this.edgePropagator = new EdgePropagator(this.graph, this.eventEmitter, this.runContextManager, this.handleResolver, this, this);
|
|
3657
3665
|
// Create NodeExecutor with EdgePropagator and HandleResolver
|
|
3658
3666
|
this.nodeExecutor = new NodeExecutor(this.graph, this.eventEmitter, this.runContextManager, this.handleResolver, this, this);
|
|
3659
3667
|
// Create RuntimeValidatorManager
|