@bian-womp/spark-workbench 0.3.40 → 0.3.42

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 CHANGED
@@ -342,6 +342,18 @@ class InMemoryWorkbench extends AbstractWorkbench {
342
342
  change: { type: "updateParams", nodeId },
343
343
  });
344
344
  }
345
+ updateResolvedHandles(nodeId, resolvedHandles, options) {
346
+ const n = this._def.nodes.find((n) => n.nodeId === nodeId);
347
+ if (!n)
348
+ return;
349
+ n.resolvedHandles = { ...(n.resolvedHandles ?? {}), ...resolvedHandles };
350
+ this.emit("graphChanged", {
351
+ def: this._def,
352
+ change: { type: "updateResolvedHandles", nodeId },
353
+ ...options,
354
+ });
355
+ this.refreshValidation();
356
+ }
345
357
  // Position and selection APIs for React Flow bridge
346
358
  setPositions(positions, options) {
347
359
  this.positions = { ...this.positions, ...positions };
@@ -4158,20 +4170,16 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
4158
4170
  });
4159
4171
  // Helper to apply resolved handles from event payload to workbench
4160
4172
  const applyResolvedHandles = (resolvedHandles) => {
4161
- let changed = false;
4162
4173
  for (const n of wb.def.nodes) {
4163
4174
  const updated = resolvedHandles[n.nodeId];
4164
4175
  if (updated) {
4165
4176
  const before = JSON.stringify(n.resolvedHandles || {});
4166
4177
  const after = JSON.stringify(updated);
4167
4178
  if (before !== after) {
4168
- n.resolvedHandles = updated;
4169
- changed = true;
4179
+ wb.updateResolvedHandles(n.nodeId, updated, { dry: true });
4170
4180
  }
4171
4181
  }
4172
4182
  }
4173
- if (changed)
4174
- wb.refreshValidation();
4175
4183
  };
4176
4184
  const offRunnerValue = runner.on("value", (e) => {
4177
4185
  if (e?.dry)
@@ -4461,6 +4469,9 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
4461
4469
  else if (changeType === "setInputs") {
4462
4470
  reason = "set-inputs";
4463
4471
  }
4472
+ else if (changeType === "updateResolvedHandles") {
4473
+ reason = "update-resolved-handles";
4474
+ }
4464
4475
  }
4465
4476
  if (event.change?.type === "setInputs") {
4466
4477
  const { nodeId, inputs } = event.change;
@@ -4497,7 +4508,8 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
4497
4508
  }
4498
4509
  }
4499
4510
  }
4500
- else if (event.change?.type !== "setInputs") {
4511
+ else if (event.change?.type !== "setInputs" &&
4512
+ event.change?.type !== "updateResolvedHandles") {
4501
4513
  await runner.update(event.def, { dry: event.dry });
4502
4514
  }
4503
4515
  if (event.commit) {
@@ -5937,6 +5949,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
5937
5949
  measured: n.measured,
5938
5950
  data: n.data && {
5939
5951
  typeId: n.data.typeId,
5952
+ handles: n.data.handles,
5940
5953
  inputHandles: n.data.inputHandles,
5941
5954
  outputHandles: n.data.outputHandles,
5942
5955
  showValues: n.data.showValues,