@bian-womp/spark-remote 0.3.9 → 0.3.11
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 +14 -12
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts +2 -1
- package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/lib/esm/index.js +14 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/server/ServerRuntimeAdapter.d.ts +2 -1
- package/lib/esm/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.cjs
CHANGED
|
@@ -398,7 +398,9 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
398
398
|
return await resolved.convertAsync(value, ac.signal);
|
|
399
399
|
},
|
|
400
400
|
getEnvironment: async () => {
|
|
401
|
-
|
|
401
|
+
if (!graphRuntime)
|
|
402
|
+
return {};
|
|
403
|
+
return graphRuntime.getEnvironment();
|
|
402
404
|
},
|
|
403
405
|
applyRegistry: async (deltas) => {
|
|
404
406
|
// Pause runtime if exists
|
|
@@ -445,8 +447,8 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
445
447
|
});
|
|
446
448
|
},
|
|
447
449
|
build: async (def, opts) => {
|
|
448
|
-
const
|
|
449
|
-
graphRuntime = builder.build(def, { environment
|
|
450
|
+
const environment = opts?.environment || {};
|
|
451
|
+
graphRuntime = builder.build(def, { environment });
|
|
450
452
|
graphRuntime.on("value", (p) => send({ message: { type: "value", payload: p } }));
|
|
451
453
|
graphRuntime.on("invalidate", (p) => send({ message: { type: "invalidate", payload: p } }));
|
|
452
454
|
graphRuntime.on("error", (p) => send({ message: { type: "error", payload: p } }));
|
|
@@ -489,15 +491,12 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
489
491
|
return { inputs, outputs };
|
|
490
492
|
},
|
|
491
493
|
snapshotFull: async () => {
|
|
494
|
+
if (!graphRuntime)
|
|
495
|
+
return { inputs: {}, outputs: {} };
|
|
492
496
|
const snap = await originalAdapter.snapshot();
|
|
493
|
-
const
|
|
494
|
-
const def = graphRuntime
|
|
495
|
-
return {
|
|
496
|
-
...snap,
|
|
497
|
-
def,
|
|
498
|
-
environment: env,
|
|
499
|
-
extData,
|
|
500
|
-
};
|
|
497
|
+
const environment = graphRuntime.getEnvironment();
|
|
498
|
+
const def = graphRuntime.getGraphDef();
|
|
499
|
+
return { ...snap, def, environment, extData };
|
|
501
500
|
},
|
|
502
501
|
applySnapshotFull: async (payload, options) => {
|
|
503
502
|
const def = payload.def;
|
|
@@ -513,7 +512,9 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
513
512
|
await originalAdapter.build(def, { environment: payload.environment });
|
|
514
513
|
}
|
|
515
514
|
// Hydrate inputs/outputs exactly, then re-emit outputs without scheduling runs
|
|
516
|
-
graphRuntime
|
|
515
|
+
if (!graphRuntime)
|
|
516
|
+
return;
|
|
517
|
+
graphRuntime.hydrate({
|
|
517
518
|
inputs: payload.inputs,
|
|
518
519
|
outputs: payload.outputs,
|
|
519
520
|
});
|
|
@@ -715,6 +716,7 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
715
716
|
cancelNodeRuns: wrapMethod("cancelNodeRuns", originalAdapter.cancelNodeRuns),
|
|
716
717
|
getOutput: wrapMethod("getOutput", originalAdapter.getOutput),
|
|
717
718
|
on: wrapMethod("on", originalAdapter.on),
|
|
719
|
+
orignalDispose: originalAdapter.dispose,
|
|
718
720
|
};
|
|
719
721
|
return extendedAdapter;
|
|
720
722
|
}
|