@bian-womp/spark-remote 0.2.68 → 0.2.69

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/esm/index.js CHANGED
@@ -443,6 +443,14 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
443
443
  });
444
444
  originalApi.setExtData(payload.extData || {});
445
445
  },
446
+ cancelNodeRuns: (nodeIds) => {
447
+ graphRuntime?.cancelNodeRuns(nodeIds);
448
+ },
449
+ commit: async () => { },
450
+ undo: async () => false,
451
+ redo: async () => false,
452
+ canUndo: async () => false,
453
+ canRedo: async () => false,
446
454
  describeRegistry: () => {
447
455
  // types (include enum options when available)
448
456
  const types = Array.from(registry.types.entries()).map(([id, d]) => {
@@ -653,6 +661,12 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
653
661
  launch: wrapMethod("launch", originalApi.launch),
654
662
  whenIdle: wrapMethod("whenIdle", originalApi.whenIdle),
655
663
  dispose: wrapMethod("dispose", originalApi.dispose),
664
+ commit: wrapMethod("commit", originalApi.commit),
665
+ cancelNodeRuns: wrapMethod("cancelNodeRuns", originalApi.cancelNodeRuns),
666
+ undo: wrapMethod("undo", originalApi.undo),
667
+ redo: wrapMethod("redo", originalApi.redo),
668
+ canUndo: wrapMethod("canUndo", originalApi.canUndo),
669
+ canRedo: wrapMethod("canRedo", originalApi.canRedo),
656
670
  };
657
671
  return extendedApi;
658
672
  }
@@ -1049,6 +1063,16 @@ class RuntimeApiClient {
1049
1063
  message: { type: "RegistryApply", payload: { deltas } },
1050
1064
  });
1051
1065
  }
1066
+ async setInputs(nodeId, inputs, options) {
1067
+ const transport = await this.ensureConnected();
1068
+ await transport.request({
1069
+ message: {
1070
+ type: "SetInputs",
1071
+ payload: { nodeId, inputs },
1072
+ dry: options?.dry,
1073
+ },
1074
+ });
1075
+ }
1052
1076
  async snapshot() {
1053
1077
  const transport = await this.ensureConnected();
1054
1078
  const res = await transport.request({
@@ -1155,6 +1179,44 @@ class RuntimeApiClient {
1155
1179
  message: { type: "SetExtData", payload: data },
1156
1180
  });
1157
1181
  }
1182
+ async commit() {
1183
+ const transport = await this.ensureConnected();
1184
+ await transport.request({
1185
+ message: { type: "Commit" },
1186
+ });
1187
+ }
1188
+ async undo() {
1189
+ const transport = await this.ensureConnected();
1190
+ const res = await transport.request({
1191
+ message: { type: "Undo" },
1192
+ });
1193
+ const payload = res?.message || {};
1194
+ return payload.success ?? false;
1195
+ }
1196
+ async redo() {
1197
+ const transport = await this.ensureConnected();
1198
+ const res = await transport.request({
1199
+ message: { type: "Redo" },
1200
+ });
1201
+ const payload = res?.message || {};
1202
+ return payload.success ?? false;
1203
+ }
1204
+ async canUndo() {
1205
+ const transport = await this.ensureConnected();
1206
+ const res = await transport.request({
1207
+ message: { type: "CanUndo" },
1208
+ });
1209
+ const payload = res?.message || {};
1210
+ return payload.canUndo ?? false;
1211
+ }
1212
+ async canRedo() {
1213
+ const transport = await this.ensureConnected();
1214
+ const res = await transport.request({
1215
+ message: { type: "CanRedo" },
1216
+ });
1217
+ const payload = res?.message || {};
1218
+ return payload.canRedo ?? false;
1219
+ }
1158
1220
  /**
1159
1221
  * Dispose the client and close the transport connection.
1160
1222
  * Idempotent: safe to call multiple times.
@@ -1410,6 +1472,36 @@ class RuntimeApiServer {
1410
1472
  ack();
1411
1473
  break;
1412
1474
  }
1475
+ case "Commit": {
1476
+ this.logCommand("Commit", env);
1477
+ await this.runtimeApi.commit();
1478
+ ack();
1479
+ break;
1480
+ }
1481
+ case "Undo": {
1482
+ this.logCommand("Undo", env);
1483
+ const success = await this.runtimeApi.undo();
1484
+ ack({ success });
1485
+ break;
1486
+ }
1487
+ case "Redo": {
1488
+ this.logCommand("Redo", env);
1489
+ const success = await this.runtimeApi.redo();
1490
+ ack({ success });
1491
+ break;
1492
+ }
1493
+ case "CanUndo": {
1494
+ this.logCommand("CanUndo", env);
1495
+ const canUndo = await this.runtimeApi.canUndo();
1496
+ ack({ canUndo });
1497
+ break;
1498
+ }
1499
+ case "CanRedo": {
1500
+ this.logCommand("CanRedo", env);
1501
+ const canRedo = await this.runtimeApi.canRedo();
1502
+ ack({ canRedo });
1503
+ break;
1504
+ }
1413
1505
  default: {
1414
1506
  this.logCommand("Unknown type", env);
1415
1507
  ack();