@bian-womp/spark-graph 0.3.24 → 0.3.25
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 +34 -2
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/builder/GraphBuilder.d.ts +1 -0
- package/lib/cjs/src/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/cjs/src/misc/base.d.ts +3 -1
- package/lib/cjs/src/misc/base.d.ts.map +1 -1
- package/lib/cjs/src/runtime/GraphLifecycleApi.d.ts +1 -0
- package/lib/cjs/src/runtime/GraphLifecycleApi.d.ts.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +2 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/index.js +34 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/builder/GraphBuilder.d.ts +1 -0
- package/lib/esm/src/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/esm/src/misc/base.d.ts +3 -1
- package/lib/esm/src/misc/base.d.ts.map +1 -1
- package/lib/esm/src/runtime/GraphLifecycleApi.d.ts +1 -0
- package/lib/esm/src/runtime/GraphLifecycleApi.d.ts.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +2 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -2778,6 +2778,8 @@ class GraphRuntime {
|
|
|
2778
2778
|
}
|
|
2779
2779
|
static create(def, registry, opts) {
|
|
2780
2780
|
const gr = new GraphRuntime();
|
|
2781
|
+
if (opts?.startPaused)
|
|
2782
|
+
gr.pause();
|
|
2781
2783
|
gr.environment = opts?.environment ?? {};
|
|
2782
2784
|
// Set registry and environment on components
|
|
2783
2785
|
gr.graph.setRegistry(registry);
|
|
@@ -2785,7 +2787,15 @@ class GraphRuntime {
|
|
|
2785
2787
|
gr.handleResolver.setEnvironment(gr.environment);
|
|
2786
2788
|
gr.nodeExecutor.setEnvironment(gr.environment);
|
|
2787
2789
|
// Precompute per-node resolved handles (use def-provided overrides; do not compute dynamically here)
|
|
2788
|
-
const initial =
|
|
2790
|
+
const initial = gr.pauseRefCount
|
|
2791
|
+
? {
|
|
2792
|
+
resolved: new Map(),
|
|
2793
|
+
pending: new Set(),
|
|
2794
|
+
}
|
|
2795
|
+
: tryHandleResolving(def, registry, gr.environment);
|
|
2796
|
+
if (gr.pauseRefCount) {
|
|
2797
|
+
gr.handleResolvingSkippedRef = def;
|
|
2798
|
+
}
|
|
2789
2799
|
for (const [nodeId, handles] of initial.resolved) {
|
|
2790
2800
|
gr.graph.setResolvedHandles(nodeId, handles);
|
|
2791
2801
|
}
|
|
@@ -3089,6 +3099,20 @@ class GraphRuntime {
|
|
|
3089
3099
|
if (this.persistentPauseToken) {
|
|
3090
3100
|
this.persistentPauseToken();
|
|
3091
3101
|
this.persistentPauseToken = null;
|
|
3102
|
+
// If handle resolving was skipped, trigger it now
|
|
3103
|
+
if (this.handleResolvingSkippedRef) {
|
|
3104
|
+
const registry = this.graph.getRegistry();
|
|
3105
|
+
if (registry) {
|
|
3106
|
+
const result = tryHandleResolving(this.handleResolvingSkippedRef, registry, this.environment);
|
|
3107
|
+
for (const [nodeId, handles] of result.resolved) {
|
|
3108
|
+
this.graph.setResolvedHandles(nodeId, handles);
|
|
3109
|
+
}
|
|
3110
|
+
for (const nodeId of result.pending) {
|
|
3111
|
+
this.handleResolver.scheduleRecomputeHandles(nodeId);
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
this.handleResolvingSkippedRef = undefined;
|
|
3115
|
+
}
|
|
3092
3116
|
}
|
|
3093
3117
|
}
|
|
3094
3118
|
copyOutputs(fromNodeId, toNodeId, options) {
|
|
@@ -3276,7 +3300,15 @@ class GraphRuntime {
|
|
|
3276
3300
|
});
|
|
3277
3301
|
{
|
|
3278
3302
|
// Update handles and edges
|
|
3279
|
-
const result =
|
|
3303
|
+
const result = this.pauseRefCount
|
|
3304
|
+
? {
|
|
3305
|
+
resolved: new Map(),
|
|
3306
|
+
pending: new Set(),
|
|
3307
|
+
}
|
|
3308
|
+
: tryHandleResolving(def, registry, this.environment);
|
|
3309
|
+
if (this.pauseRefCount) {
|
|
3310
|
+
this.handleResolvingSkippedRef = def;
|
|
3311
|
+
}
|
|
3280
3312
|
const changedHandles = {};
|
|
3281
3313
|
for (const [nodeId, newHandles] of result.resolved) {
|
|
3282
3314
|
const oldHandles = this.graph.getResolvedHandles(nodeId);
|