@bian-womp/spark-remote 0.3.2 → 0.3.4
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 +20 -17
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/RemoteGraphLifecycleApi.d.ts +4 -1
- package/lib/cjs/src/RemoteGraphLifecycleApi.d.ts.map +1 -1
- package/lib/cjs/src/server/ServerCommandHandler.d.ts.map +1 -1
- package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/lib/esm/index.js +21 -18
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/RemoteGraphLifecycleApi.d.ts +4 -1
- package/lib/esm/src/RemoteGraphLifecycleApi.d.ts.map +1 -1
- package/lib/esm/src/server/ServerCommandHandler.d.ts.map +1 -1
- package/lib/esm/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.cjs
CHANGED
|
@@ -462,8 +462,14 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
462
462
|
// (e.g., { ui } or { runtime }) without dropping the other ones.
|
|
463
463
|
extData = { ...extData, ...data };
|
|
464
464
|
},
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
updateExtData: async (updates) => {
|
|
466
|
+
if (!extData || typeof extData !== "object" || Array.isArray(extData)) {
|
|
467
|
+
extData = {};
|
|
468
|
+
}
|
|
469
|
+
for (const { path, value } of updates) {
|
|
470
|
+
const pathSegments = sparkGraph.parseJsonPath(path);
|
|
471
|
+
sparkGraph.setValueAtPathWithCreation(extData, pathSegments, value);
|
|
472
|
+
}
|
|
467
473
|
},
|
|
468
474
|
snapshot: async () => {
|
|
469
475
|
const inputs = {};
|
|
@@ -484,14 +490,12 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
484
490
|
},
|
|
485
491
|
snapshotFull: async () => {
|
|
486
492
|
const snap = await originalAdapter.snapshot();
|
|
487
|
-
const extData = await originalAdapter.getExtData();
|
|
488
493
|
const env = graphRuntime?.getEnvironment?.() ?? {};
|
|
489
494
|
const def = graphRuntime?.getGraphDef();
|
|
490
495
|
return {
|
|
496
|
+
...snap,
|
|
491
497
|
def,
|
|
492
498
|
environment: env,
|
|
493
|
-
inputs: snap.inputs,
|
|
494
|
-
outputs: snap.outputs,
|
|
495
499
|
extData,
|
|
496
500
|
};
|
|
497
501
|
},
|
|
@@ -686,7 +690,7 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
686
690
|
applyRegistry: wrapMethod("applyRegistry", originalAdapter.applyRegistry),
|
|
687
691
|
build: wrapMethod("build", originalAdapter.build),
|
|
688
692
|
setExtData: wrapMethod("setExtData", originalAdapter.setExtData),
|
|
689
|
-
|
|
693
|
+
updateExtData: wrapMethod("updateExtData", originalAdapter.updateExtData),
|
|
690
694
|
snapshot: wrapMethod("snapshot", originalAdapter.snapshot),
|
|
691
695
|
snapshotFull: wrapMethod("snapshotFull", originalAdapter.snapshotFull),
|
|
692
696
|
applySnapshotFull: wrapMethod("applySnapshotFull", originalAdapter.applySnapshotFull),
|
|
@@ -964,13 +968,11 @@ class RemoteGraphLifecycleApi {
|
|
|
964
968
|
message: { type: "SetExtData", payload: data },
|
|
965
969
|
});
|
|
966
970
|
}
|
|
967
|
-
async
|
|
971
|
+
async updateExtData(updates) {
|
|
968
972
|
const transport = await this.ensureConnected();
|
|
969
|
-
|
|
970
|
-
message: { type: "
|
|
973
|
+
await transport.request({
|
|
974
|
+
message: { type: "UpdateExtData", payload: updates },
|
|
971
975
|
});
|
|
972
|
-
const payload = res?.message || {};
|
|
973
|
-
return payload.extData || {};
|
|
974
976
|
}
|
|
975
977
|
async setViewport(viewport) {
|
|
976
978
|
const transport = await this.ensureConnected();
|
|
@@ -1405,9 +1407,7 @@ class ServerCommandHandler {
|
|
|
1405
1407
|
toNodeId: msg.payload.toNodeId,
|
|
1406
1408
|
dry: !!dry,
|
|
1407
1409
|
});
|
|
1408
|
-
await this.adapter.copyOutputs(msg.payload.fromNodeId, msg.payload.toNodeId, {
|
|
1409
|
-
dry,
|
|
1410
|
-
});
|
|
1410
|
+
await this.adapter.copyOutputs(msg.payload.fromNodeId, msg.payload.toNodeId, { dry });
|
|
1411
1411
|
ack();
|
|
1412
1412
|
break;
|
|
1413
1413
|
}
|
|
@@ -1418,9 +1418,7 @@ class ServerCommandHandler {
|
|
|
1418
1418
|
event: summarize(msg.payload.event),
|
|
1419
1419
|
dry: !!dry,
|
|
1420
1420
|
});
|
|
1421
|
-
await this.adapter.triggerExternal(msg.payload.nodeId, msg.payload.event, {
|
|
1422
|
-
dry,
|
|
1423
|
-
});
|
|
1421
|
+
await this.adapter.triggerExternal(msg.payload.nodeId, msg.payload.event, { dry });
|
|
1424
1422
|
ack();
|
|
1425
1423
|
break;
|
|
1426
1424
|
}
|
|
@@ -1522,6 +1520,11 @@ class ServerCommandHandler {
|
|
|
1522
1520
|
ack();
|
|
1523
1521
|
break;
|
|
1524
1522
|
}
|
|
1523
|
+
case "UpdateExtData": {
|
|
1524
|
+
await this.adapter.updateExtData(msg.payload);
|
|
1525
|
+
ack();
|
|
1526
|
+
break;
|
|
1527
|
+
}
|
|
1525
1528
|
case "Dispose": {
|
|
1526
1529
|
this.logCommand("Dispose", env);
|
|
1527
1530
|
await this.adapter.dispose();
|