@bian-womp/spark-graph 0.2.80 → 0.2.81

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
@@ -4064,6 +4064,25 @@ function mergeSnapshotData(targetSnapshot, sourceSnapshot, sourceDef, nodeIdMap,
4064
4064
  mergedPositions,
4065
4065
  };
4066
4066
  }
4067
+ /**
4068
+ * Merge runtime metadata from source into target, remapping node IDs using nodeIdMap.
4069
+ * Preserves target metadata and adds/updates source metadata with remapped IDs.
4070
+ */
4071
+ function mergeRuntimeState(targetRuntime, sourceRuntime, nodeIdMap) {
4072
+ const result = {
4073
+ nodes: { ...(targetRuntime?.nodes || {}) },
4074
+ };
4075
+ if (!sourceRuntime?.nodes)
4076
+ return result;
4077
+ // Remap source node IDs to new merged node IDs
4078
+ for (const [sourceNodeId, newNodeId] of Object.entries(nodeIdMap)) {
4079
+ const sourceNodeMeta = sourceRuntime.nodes[sourceNodeId];
4080
+ if (sourceNodeMeta) {
4081
+ result.nodes[newNodeId] = { ...sourceNodeMeta };
4082
+ }
4083
+ }
4084
+ return result;
4085
+ }
4067
4086
  function matchesPattern(value, pattern) {
4068
4087
  if (!pattern)
4069
4088
  return true;
@@ -4276,6 +4295,7 @@ exports.isInputPrivate = isInputPrivate;
4276
4295
  exports.isTypedOutput = isTypedOutput;
4277
4296
  exports.mergeGraphDefinitions = mergeGraphDefinitions;
4278
4297
  exports.mergeInputsOutputs = mergeInputsOutputs;
4298
+ exports.mergeRuntimeState = mergeRuntimeState;
4279
4299
  exports.mergeSnapshotData = mergeSnapshotData;
4280
4300
  exports.offsetImportedPositions = offsetImportedPositions;
4281
4301
  exports.parseJsonPath = parseJsonPath;