@bian-womp/spark-graph 0.3.5 → 0.3.7
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 +22 -1
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +4 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/NodeExecutor.d.ts.map +1 -1
- package/lib/esm/index.js +22 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +4 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/NodeExecutor.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -1565,7 +1565,9 @@ class NodeExecutor {
|
|
|
1565
1565
|
// If autoRun is true, auto-generate a run context (similar to createExecutionContext pattern)
|
|
1566
1566
|
if (node.policy?.autoRun === true) {
|
|
1567
1567
|
runContextIds = new Set([
|
|
1568
|
-
this.runContextManager.createRunContext(nodeId),
|
|
1568
|
+
this.runContextManager.createRunContext(nodeId, () => { }, {
|
|
1569
|
+
propagate: false,
|
|
1570
|
+
}),
|
|
1569
1571
|
]);
|
|
1570
1572
|
}
|
|
1571
1573
|
else {
|
|
@@ -2155,8 +2157,27 @@ class GraphRuntime {
|
|
|
2155
2157
|
const node = this.graph.getNode(nodeId);
|
|
2156
2158
|
if (!node)
|
|
2157
2159
|
return;
|
|
2160
|
+
// If event is an invalidate event, re-run the node with same inputs
|
|
2161
|
+
if (this.isInvalidateEvent(event)) {
|
|
2162
|
+
// Check if node has all inbound inputs (required for execution)
|
|
2163
|
+
if (this.graph.allInboundHaveValue(nodeId)) {
|
|
2164
|
+
this.execute(nodeId);
|
|
2165
|
+
}
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
// Forward event to node's onExternalEvent handler for custom actions
|
|
2158
2169
|
node.runtime.onExternalEvent?.(event, node.state);
|
|
2159
2170
|
}
|
|
2171
|
+
/**
|
|
2172
|
+
* Check if an event is an invalidate event that should trigger re-execution
|
|
2173
|
+
*/
|
|
2174
|
+
isInvalidateEvent(event) {
|
|
2175
|
+
if (!event || typeof event !== "object")
|
|
2176
|
+
return false;
|
|
2177
|
+
// Check if event has action === "invalidate"
|
|
2178
|
+
const e = event;
|
|
2179
|
+
return e.action === "invalidate";
|
|
2180
|
+
}
|
|
2160
2181
|
cancelNodeRuns(nodeIds) {
|
|
2161
2182
|
this.nodeExecutor.cancelNodeRuns(nodeIds);
|
|
2162
2183
|
}
|