@bian-womp/spark-workbench 0.2.81 → 0.2.83
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 +43 -13
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/cjs/src/misc/hooks.d.ts.map +1 -1
- package/lib/cjs/src/runtime/AbstractGraphRunner.d.ts +1 -0
- package/lib/cjs/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/IGraphRunner.d.ts +1 -1
- package/lib/cjs/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts +1 -0
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts +5 -2
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +43 -13
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/esm/src/misc/hooks.d.ts.map +1 -1
- package/lib/esm/src/runtime/AbstractGraphRunner.d.ts +1 -0
- package/lib/esm/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/IGraphRunner.d.ts +1 -1
- package/lib/esm/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts +1 -0
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts +5 -2
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -1174,9 +1174,9 @@ class LocalGraphRunner extends AbstractGraphRunner {
|
|
|
1174
1174
|
this.build(payload.def);
|
|
1175
1175
|
}
|
|
1176
1176
|
this.setEnvironment?.(payload.environment || {}, { merge: false });
|
|
1177
|
-
this.hydrate(payload);
|
|
1177
|
+
this.hydrate(payload, { dry: options?.dry });
|
|
1178
1178
|
}
|
|
1179
|
-
hydrate(snapshot) {
|
|
1179
|
+
hydrate(snapshot, opts) {
|
|
1180
1180
|
// Hydrate via runtime for exact restore (this emits events on runtime emitter)
|
|
1181
1181
|
this.runtime?.hydrate({
|
|
1182
1182
|
inputs: snapshot.inputs || {},
|
|
@@ -1185,12 +1185,24 @@ class LocalGraphRunner extends AbstractGraphRunner {
|
|
|
1185
1185
|
// Also emit directly from runner to ensure UI gets events even if engine isn't running
|
|
1186
1186
|
for (const [nodeId, map] of Object.entries(snapshot.inputs || {})) {
|
|
1187
1187
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1188
|
-
this.emit("value", {
|
|
1188
|
+
this.emit("value", {
|
|
1189
|
+
nodeId,
|
|
1190
|
+
handle,
|
|
1191
|
+
value,
|
|
1192
|
+
io: "input",
|
|
1193
|
+
dry: opts?.dry,
|
|
1194
|
+
});
|
|
1189
1195
|
}
|
|
1190
1196
|
}
|
|
1191
1197
|
for (const [nodeId, map] of Object.entries(snapshot.outputs || {})) {
|
|
1192
1198
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1193
|
-
this.emit("value", {
|
|
1199
|
+
this.emit("value", {
|
|
1200
|
+
nodeId,
|
|
1201
|
+
handle,
|
|
1202
|
+
value,
|
|
1203
|
+
io: "output",
|
|
1204
|
+
dry: opts?.dry,
|
|
1205
|
+
});
|
|
1194
1206
|
}
|
|
1195
1207
|
}
|
|
1196
1208
|
}
|
|
@@ -1744,17 +1756,17 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1744
1756
|
}
|
|
1745
1757
|
async applySnapshotFull(payload, options) {
|
|
1746
1758
|
// Hydrate local cache first so UI can display values immediately
|
|
1747
|
-
this.hydrateValueCache(payload);
|
|
1759
|
+
this.hydrateValueCache(payload, { dry: options?.dry });
|
|
1748
1760
|
// Then sync with backend
|
|
1749
1761
|
const client = await this.ensureClient();
|
|
1750
|
-
await client.applySnapshotFull(payload, options);
|
|
1762
|
+
await client.applySnapshotFull(payload, { skipBuild: options?.skipBuild });
|
|
1751
1763
|
}
|
|
1752
1764
|
/**
|
|
1753
1765
|
* Hydrates the local valueCache from a snapshot and emits value events.
|
|
1754
1766
|
* This ensures the UI can display inputs/outputs immediately without waiting
|
|
1755
1767
|
* for value events from the remote backend.
|
|
1756
1768
|
*/
|
|
1757
|
-
hydrateValueCache(snapshot) {
|
|
1769
|
+
hydrateValueCache(snapshot, opts) {
|
|
1758
1770
|
// Hydrate inputs
|
|
1759
1771
|
for (const [nodeId, map] of Object.entries(snapshot.inputs || {})) {
|
|
1760
1772
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
@@ -1762,7 +1774,13 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1762
1774
|
io: "input",
|
|
1763
1775
|
value,
|
|
1764
1776
|
});
|
|
1765
|
-
this.emit("value", {
|
|
1777
|
+
this.emit("value", {
|
|
1778
|
+
nodeId,
|
|
1779
|
+
handle,
|
|
1780
|
+
value,
|
|
1781
|
+
io: "input",
|
|
1782
|
+
dry: opts?.dry,
|
|
1783
|
+
});
|
|
1766
1784
|
}
|
|
1767
1785
|
}
|
|
1768
1786
|
// Hydrate outputs
|
|
@@ -1772,7 +1790,13 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1772
1790
|
io: "output",
|
|
1773
1791
|
value,
|
|
1774
1792
|
});
|
|
1775
|
-
this.emit("value", {
|
|
1793
|
+
this.emit("value", {
|
|
1794
|
+
nodeId,
|
|
1795
|
+
handle,
|
|
1796
|
+
value,
|
|
1797
|
+
io: "output",
|
|
1798
|
+
dry: opts?.dry,
|
|
1799
|
+
});
|
|
1776
1800
|
}
|
|
1777
1801
|
}
|
|
1778
1802
|
}
|
|
@@ -2268,8 +2292,9 @@ function useWorkbenchBridge(wb) {
|
|
|
2268
2292
|
function useWorkbenchGraphTick(wb) {
|
|
2269
2293
|
const [tick, setTick] = React.useState(0);
|
|
2270
2294
|
React.useEffect(() => {
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2295
|
+
const off = wb.on("graphChanged", () => {
|
|
2296
|
+
setTick((t) => t + 1);
|
|
2297
|
+
});
|
|
2273
2298
|
return () => off();
|
|
2274
2299
|
}, [wb]);
|
|
2275
2300
|
return tick;
|
|
@@ -2277,8 +2302,11 @@ function useWorkbenchGraphTick(wb) {
|
|
|
2277
2302
|
function useWorkbenchGraphUiTick(wb) {
|
|
2278
2303
|
const [tick, setTick] = React.useState(0);
|
|
2279
2304
|
React.useEffect(() => {
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2305
|
+
const off = wb.on("graphUiChanged", (evt) => {
|
|
2306
|
+
if (evt.change?.type === "viewport")
|
|
2307
|
+
return;
|
|
2308
|
+
setTick((t) => t + 1);
|
|
2309
|
+
});
|
|
2282
2310
|
return () => off();
|
|
2283
2311
|
}, [wb]);
|
|
2284
2312
|
return tick;
|
|
@@ -3104,6 +3132,8 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, overrides, uiVer
|
|
|
3104
3132
|
wb.refreshValidation();
|
|
3105
3133
|
};
|
|
3106
3134
|
const offRunnerValue = runner.on("value", (e) => {
|
|
3135
|
+
if (e?.dry)
|
|
3136
|
+
return;
|
|
3107
3137
|
const now = Date.now();
|
|
3108
3138
|
if (e?.io === "input") {
|
|
3109
3139
|
const nodeId = e.nodeId;
|