@datatechsolutions/ui 2.11.77 → 2.11.78

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.
@@ -7022,15 +7022,25 @@ function WorkflowCanvasInner({
7022
7022
  );
7023
7023
  const buildInitialEdges = react.useCallback(() => {
7024
7024
  if (initialGraph && initialGraph.edges.length > 0) {
7025
+ const aggregatorIds = new Set(
7026
+ initialGraph.nodes.filter((node) => node.type === "variable_aggregator").map((node) => node.id)
7027
+ );
7028
+ const aggregatorPortCursor = /* @__PURE__ */ new Map();
7025
7029
  return initialGraph.edges.map((savedEdge) => {
7026
7030
  const handle = savedEdge.sourceHandle;
7027
7031
  const edgeColor = handle === "true-out" ? GRAPH_TRUE_EDGE_COLOR : handle === "false-out" ? GRAPH_FALSE_EDGE_COLOR : GRAPH_ACTIVE_EDGE_COLOR;
7032
+ let targetHandle = savedEdge.targetHandle;
7033
+ if (!targetHandle && aggregatorIds.has(savedEdge.target)) {
7034
+ const nextIndex = aggregatorPortCursor.get(savedEdge.target) ?? 0;
7035
+ targetHandle = `input-${nextIndex}`;
7036
+ aggregatorPortCursor.set(savedEdge.target, nextIndex + 1);
7037
+ }
7028
7038
  return {
7029
7039
  id: savedEdge.id,
7030
7040
  source: savedEdge.source,
7031
7041
  target: savedEdge.target,
7032
7042
  sourceHandle: savedEdge.sourceHandle,
7033
- targetHandle: savedEdge.targetHandle,
7043
+ targetHandle,
7034
7044
  type: "default",
7035
7045
  animated: true,
7036
7046
  data: {
@@ -7843,10 +7853,31 @@ function WorkflowCanvasInner({
7843
7853
  (connection) => {
7844
7854
  storeTakeSnapshot();
7845
7855
  const edgeLabel = resolveEdgeLabel(connection.sourceHandle, connection.source);
7856
+ const targetNode = connection.target ? getNode(connection.target) : void 0;
7857
+ let resolvedConnection = connection;
7858
+ if (targetNode?.type === "variable_aggregator") {
7859
+ const aggConfig = targetNode.data.config;
7860
+ const existingInputs = aggConfig?.inputVariables ?? [];
7861
+ const nextIndex = existingInputs.length;
7862
+ const nextHandle = `input-${nextIndex}`;
7863
+ resolvedConnection = { ...connection, targetHandle: nextHandle };
7864
+ const nextVarName = connection.source ?? `input-${nextIndex + 1}`;
7865
+ setNodes(
7866
+ (currentNodes) => currentNodes.map((node) => {
7867
+ if (node.id !== connection.target) return node;
7868
+ const data = node.data;
7869
+ const nextConfig = {
7870
+ ...data.config ?? { type: "variable_aggregator", inputVariables: [], outputVariable: "context" },
7871
+ inputVariables: [...existingInputs, nextVarName]
7872
+ };
7873
+ return { ...node, data: { ...data, config: nextConfig } };
7874
+ })
7875
+ );
7876
+ }
7846
7877
  setEdges(
7847
7878
  (currentEdges) => react$1.addEdge(
7848
7879
  {
7849
- ...connection,
7880
+ ...resolvedConnection,
7850
7881
  type: "default",
7851
7882
  animated: true,
7852
7883
  data: { label: edgeLabel, onInsertNode: insertNodeOnEdge },
@@ -7857,7 +7888,7 @@ function WorkflowCanvasInner({
7857
7888
  )
7858
7889
  );
7859
7890
  },
7860
- [setEdges, storeTakeSnapshot, resolveEdgeLabel, insertNodeOnEdge]
7891
+ [setEdges, setNodes, getNode, storeTakeSnapshot, resolveEdgeLabel, insertNodeOnEdge]
7861
7892
  );
7862
7893
  const isValidConnection = react.useCallback(
7863
7894
  (connection) => {
@@ -8393,5 +8424,5 @@ exports.useModalStore = useModalStore;
8393
8424
  exports.useWorkflowBuilderClient = useWorkflowBuilderClient;
8394
8425
  exports.useWorkflowBuilderClientOptional = useWorkflowBuilderClientOptional;
8395
8426
  exports.useWorkflowStore = useWorkflowStore;
8396
- //# sourceMappingURL=chunk-PIFVDMDN.js.map
8397
- //# sourceMappingURL=chunk-PIFVDMDN.js.map
8427
+ //# sourceMappingURL=chunk-BCE3FQVS.js.map
8428
+ //# sourceMappingURL=chunk-BCE3FQVS.js.map