@bian-womp/spark-graph 0.2.19 → 0.2.21
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/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +26 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/index.js +22 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +26 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -1059,7 +1059,9 @@ class GraphRuntime {
|
|
|
1059
1059
|
else
|
|
1060
1060
|
this.invalidateDownstream(nodeId);
|
|
1061
1061
|
}
|
|
1062
|
-
|
|
1062
|
+
else {
|
|
1063
|
+
node.runtime.onExternalEvent?.(event, ctx);
|
|
1064
|
+
}
|
|
1063
1065
|
}
|
|
1064
1066
|
dispose() {
|
|
1065
1067
|
for (const node of this.nodes.values()) {
|
|
@@ -1097,6 +1099,25 @@ class GraphRuntime {
|
|
|
1097
1099
|
setEnvironment(env) {
|
|
1098
1100
|
this.environment = { ...env };
|
|
1099
1101
|
}
|
|
1102
|
+
// Export a GraphDefinition reflecting the current runtime view
|
|
1103
|
+
getGraphDef() {
|
|
1104
|
+
const nodes = Array.from(this.nodes.values()).map((n) => {
|
|
1105
|
+
const resolved = this.resolvedByNode.get(n.nodeId);
|
|
1106
|
+
return {
|
|
1107
|
+
nodeId: n.nodeId,
|
|
1108
|
+
typeId: n.typeId,
|
|
1109
|
+
params: n.params ? { ...n.params } : undefined,
|
|
1110
|
+
resolvedHandles: resolved ? { ...resolved } : undefined,
|
|
1111
|
+
};
|
|
1112
|
+
});
|
|
1113
|
+
const edges = this.edges.map((e) => ({
|
|
1114
|
+
id: e.id,
|
|
1115
|
+
source: { nodeId: e.source.nodeId, handle: e.source.handle },
|
|
1116
|
+
target: { nodeId: e.target.nodeId, handle: e.target.handle },
|
|
1117
|
+
typeId: e.typeId && e.typeId !== "untyped" ? e.typeId : undefined,
|
|
1118
|
+
}));
|
|
1119
|
+
return { nodes, edges };
|
|
1120
|
+
}
|
|
1100
1121
|
async whenIdle() {
|
|
1101
1122
|
const isIdle = () => {
|
|
1102
1123
|
for (const n of this.nodes.values()) {
|