@burdenoff/fluidgrids-fe-sdk 2026.922.7 → 2026.922.9

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.
Files changed (56) hide show
  1. package/dist/ExecutionDetailPage-V3LXDOAT.js +11 -0
  2. package/dist/{ExecutionDetailPage-WLC63RRK.js.map → ExecutionDetailPage-V3LXDOAT.js.map} +1 -1
  3. package/dist/ExecutionsListPage-AATDFFIH.js +10 -0
  4. package/dist/{ExecutionsListPage-P5DRISMN.js.map → ExecutionsListPage-AATDFFIH.js.map} +1 -1
  5. package/dist/{WorkflowBuilder-LZ7X2M5Y.js → WorkflowBuilder-DS4EK7JE.js} +7 -7
  6. package/dist/{WorkflowBuilder-LZ7X2M5Y.js.map → WorkflowBuilder-DS4EK7JE.js.map} +1 -1
  7. package/dist/WorkflowsList-DUCKDRKC.js +13 -0
  8. package/dist/{WorkflowsList-QDPC2HVV.js.map → WorkflowsList-DUCKDRKC.js.map} +1 -1
  9. package/dist/{chunk-4KX6I7PA.js → chunk-5XUOENLH.js} +5 -5
  10. package/dist/{chunk-4KX6I7PA.js.map → chunk-5XUOENLH.js.map} +1 -1
  11. package/dist/{chunk-WO3AHQVD.js → chunk-BHITFSOK.js} +73 -3
  12. package/dist/chunk-BHITFSOK.js.map +1 -0
  13. package/dist/{chunk-Z4XRVZZ2.js → chunk-C4HOB3JQ.js} +4 -4
  14. package/dist/{chunk-Z4XRVZZ2.js.map → chunk-C4HOB3JQ.js.map} +1 -1
  15. package/dist/{chunk-OZBZS6DM.js → chunk-CVVNQCFM.js} +3 -3
  16. package/dist/{chunk-OZBZS6DM.js.map → chunk-CVVNQCFM.js.map} +1 -1
  17. package/dist/{chunk-CVNW2EUB.js → chunk-EUZZLC3N.js} +3 -3
  18. package/dist/{chunk-CVNW2EUB.js.map → chunk-EUZZLC3N.js.map} +1 -1
  19. package/dist/{chunk-CQOQ6A73.js → chunk-ISS73LG3.js} +3 -3
  20. package/dist/{chunk-CQOQ6A73.js.map → chunk-ISS73LG3.js.map} +1 -1
  21. package/dist/{chunk-4LJOUX2R.js → chunk-KLWMUV2N.js} +5 -5
  22. package/dist/{chunk-4LJOUX2R.js.map → chunk-KLWMUV2N.js.map} +1 -1
  23. package/dist/{chunk-VTKT6XDA.js → chunk-NOOLXG62.js} +352 -18
  24. package/dist/chunk-NOOLXG62.js.map +1 -0
  25. package/dist/{chunk-XA3IJE2D.js → chunk-PTGKDQ5K.js} +44 -17
  26. package/dist/chunk-PTGKDQ5K.js.map +1 -0
  27. package/dist/{chunk-62OZJC2B.js → chunk-R6JFXZXN.js} +4 -4
  28. package/dist/{chunk-62OZJC2B.js.map → chunk-R6JFXZXN.js.map} +1 -1
  29. package/dist/{chunk-KAMWWBX5.js → chunk-UNW4I442.js} +3 -3
  30. package/dist/{chunk-KAMWWBX5.js.map → chunk-UNW4I442.js.map} +1 -1
  31. package/dist/{chunk-REM2BQK5.js → chunk-XC7A7NLP.js} +4 -4
  32. package/dist/{chunk-REM2BQK5.js.map → chunk-XC7A7NLP.js.map} +1 -1
  33. package/dist/{chunk-275FCUOI.js → chunk-YMD3T6J2.js} +17 -2
  34. package/dist/chunk-YMD3T6J2.js.map +1 -0
  35. package/dist/{chunk-WJQSPVU5.js → chunk-YP6P5E6M.js} +4 -4
  36. package/dist/{chunk-WJQSPVU5.js.map → chunk-YP6P5E6M.js.map} +1 -1
  37. package/dist/executions.js +5 -5
  38. package/dist/history.js +3 -3
  39. package/dist/index.d.ts +228 -8
  40. package/dist/index.js +20 -20
  41. package/dist/index.js.map +1 -1
  42. package/dist/nodes.js +2 -2
  43. package/dist/settings.js +3 -3
  44. package/dist/templates.js +5 -5
  45. package/dist/{workflow-builder-lgLa__fU.d.ts → workflow-builder-Y7PcoT2O.d.ts} +45 -13
  46. package/dist/workflow-builder.d.ts +1 -1
  47. package/dist/workflow-builder.js +6 -6
  48. package/dist/workflows-list.js +4 -4
  49. package/package.json +1 -1
  50. package/dist/ExecutionDetailPage-WLC63RRK.js +0 -11
  51. package/dist/ExecutionsListPage-P5DRISMN.js +0 -10
  52. package/dist/WorkflowsList-QDPC2HVV.js +0 -13
  53. package/dist/chunk-275FCUOI.js.map +0 -1
  54. package/dist/chunk-VTKT6XDA.js.map +0 -1
  55. package/dist/chunk-WO3AHQVD.js.map +0 -1
  56. package/dist/chunk-XA3IJE2D.js.map +0 -1
@@ -150,13 +150,15 @@ interface INodeExecutionSettings {
150
150
  * Workflow-level execution configuration (BOFF-7512).
151
151
  *
152
152
  * Mirrors `IWorkflowConfig` in `wspace-workflow-svc/src/modules/main/types/workflow.types.ts`
153
- * (`maxParallelism`, `timeout` in SECONDS, `retry`, `onError`) plus three
154
- * additive, frontend-only fields (`errorWorkflowId`, `saveDataOnSuccess`,
155
- * `saveDataOnError`) that don't exist on the backend interface yet.
156
- * `definitionJson` is a JSON scalar with no GraphQL/runtime schema
157
- * validation on its shape, so these round-trip through
158
- * `updateWorkflowDefinition` without needing a backend change — see the
159
- * Settings page for where they're read/written.
153
+ * (`maxParallelism`, `timeout` in SECONDS, `retry`, `onError`) plus two
154
+ * additive, frontend-only fields — `errorWorkflowKey` and `dataSaving` —
155
+ * that don't exist on the backend interface yet. `definitionJson` is a JSON
156
+ * scalar with no GraphQL/runtime schema validation on its shape, so these
157
+ * round-trip through `updateWorkflowDefinition` without needing a backend
158
+ * change. This is the SAME shape the per-workflow Settings page's Execution
159
+ * tab reads/writes (`SettingsPage.tsx`'s local `WorkflowExecutionSettings`
160
+ * — kept in sync with this interface by hand since that file intentionally
161
+ * doesn't import across the builder/settings module boundary).
160
162
  */
161
163
  interface IWorkflowConfig {
162
164
  /** Max parallel executions. */
@@ -169,12 +171,13 @@ interface IWorkflowConfig {
169
171
  initialDelay?: number;
170
172
  };
171
173
  onError?: "stop" | "continue" | "retry";
172
- /** Workflow key/id to trigger when this workflow's execution fails (frontend-only, additive). */
173
- errorWorkflowId?: string;
174
- /** Persist run data when an execution succeeds (frontend-only, additive; not yet engine-enforced). */
175
- saveDataOnSuccess?: boolean;
176
- /** Persist run data when an execution fails (frontend-only, additive; not yet engine-enforced). */
177
- saveDataOnError?: boolean;
174
+ /** workflowKey to trigger when this workflow's execution fails (frontend-only, additive). */
175
+ errorWorkflowKey?: string;
176
+ /** Persist run data on success/failure (frontend-only, additive; not yet engine-enforced — tracked separately as execution-lifecycle work). */
177
+ dataSaving?: {
178
+ saveSuccessExecutions?: boolean;
179
+ saveFailedExecutions?: boolean;
180
+ };
178
181
  }
179
182
  interface WorkflowDefinition {
180
183
  id: string;
@@ -285,6 +288,16 @@ interface ExecutionLog {
285
288
  duration: number | null;
286
289
  startTime: string;
287
290
  endTime: string | null;
291
+ /**
292
+ * True when this node's output came from pinned data instead of a real
293
+ * call (BOFF-7511). Always false/undefined outside a TEST run.
294
+ */
295
+ usedPinnedData?: boolean;
296
+ /**
297
+ * Set when this node's state was reused from an earlier run by
298
+ * `runFromNode` instead of being executed in this run (BOFF-7511).
299
+ */
300
+ reusedFromRunId?: string | null;
288
301
  }
289
302
  interface ExecutionsFilter {
290
303
  status?: RunStatus[];
@@ -596,6 +609,17 @@ interface IFlowState {
596
609
  dbId?: string;
597
610
  /** Current workflow status: DRAFT | ACTIVE | ARCHIVED | DEPRECATED */
598
611
  status?: string;
612
+ /**
613
+ * Pinned/mock output data, keyed by nodeId (BOFF-7511). Mirrors
614
+ * `WorkflowDefinition.pinnedNodeData` — hydrated on load, kept in sync by
615
+ * the NDV's pin/unpin actions so the canvas never shows a stale pin
616
+ * badge after a mutation round-trips.
617
+ */
618
+ pinnedNodeData?: Record<string, {
619
+ data: Record<string, unknown>;
620
+ pinnedAt?: string;
621
+ pinnedBy?: string;
622
+ }>;
599
623
  } & State;
600
624
  execution: ExecutionState;
601
625
  actions: Actions["actions"] & {
@@ -609,6 +633,14 @@ interface IFlowState {
609
633
  togglePanel: () => void;
610
634
  clearLogs: () => void;
611
635
  completeExecution: () => void;
636
+ /**
637
+ * Debug-in-editor (BOFF-7511): load a PAST run's node states onto the
638
+ * canvas as if they'd just executed, without marking anything as
639
+ * "running". Each node shows what it actually produced in `runId`, and
640
+ * `currentRunId` becomes that run's id so "Run from this node" knows
641
+ * which run to reuse upstream outputs from.
642
+ */
643
+ loadDebugRun: (runId: string, logs: ExecutionLog[]) => void;
612
644
  };
613
645
  };
614
646
  }
@@ -1,4 +1,4 @@
1
- export { I as IFlowState, W as WorkflowBuilder, o as WorkflowBuilderCore, p as WorkflowBuilderCoreProps, n as WorkflowBuilderPage, q as WorkflowBuilderProps, w as WorkflowSearchRedirect, x as refetchStoreNodes, y as useFlowStore } from './workflow-builder-lgLa__fU.js';
1
+ export { I as IFlowState, W as WorkflowBuilder, o as WorkflowBuilderCore, p as WorkflowBuilderCoreProps, n as WorkflowBuilderPage, q as WorkflowBuilderProps, w as WorkflowSearchRedirect, x as refetchStoreNodes, y as useFlowStore } from './workflow-builder-Y7PcoT2O.js';
2
2
  import 'react/jsx-runtime';
3
3
  import '@apollo/client/core';
4
4
  import '@xyflow/react';
@@ -1,6 +1,6 @@
1
- export { WorkflowBuilder, WorkflowBuilderCore, WorkflowSearchRedirect } from './chunk-4LJOUX2R.js';
2
- export { WorkflowBuilder as WorkflowBuilderPage } from './chunk-4KX6I7PA.js';
3
- export { refetchStoreNodes } from './chunk-VTKT6XDA.js';
1
+ export { WorkflowBuilder, WorkflowBuilderCore, WorkflowSearchRedirect } from './chunk-KLWMUV2N.js';
2
+ export { WorkflowBuilder as WorkflowBuilderPage } from './chunk-5XUOENLH.js';
3
+ export { refetchStoreNodes } from './chunk-NOOLXG62.js';
4
4
  import './chunk-P5PKRQAO.js';
5
5
  import './chunk-NH5YCY37.js';
6
6
  import './chunk-DBOMRIP5.js';
@@ -10,12 +10,12 @@ import './chunk-XQP33UJR.js';
10
10
  import './chunk-AANIWER2.js';
11
11
  import './chunk-UIY2HBWA.js';
12
12
  import './chunk-3ZYUGTIT.js';
13
- import './chunk-OZBZS6DM.js';
13
+ import './chunk-CVVNQCFM.js';
14
14
  import './chunk-LMO5ASOE.js';
15
15
  import './chunk-WWU2O2SR.js';
16
16
  import './chunk-5BDQNSP3.js';
17
- export { useFlowStore } from './chunk-275FCUOI.js';
18
- import './chunk-WO3AHQVD.js';
17
+ export { useFlowStore } from './chunk-YMD3T6J2.js';
18
+ import './chunk-BHITFSOK.js';
19
19
  import './chunk-7YWBH2A5.js';
20
20
  //# sourceMappingURL=workflow-builder.js.map
21
21
  //# sourceMappingURL=workflow-builder.js.map
@@ -1,13 +1,13 @@
1
- export { WorkflowsList } from './chunk-REM2BQK5.js';
1
+ export { WorkflowsList } from './chunk-XC7A7NLP.js';
2
2
  import './chunk-AANIWER2.js';
3
3
  import './chunk-UIY2HBWA.js';
4
4
  import './chunk-3ZYUGTIT.js';
5
- import './chunk-OZBZS6DM.js';
5
+ import './chunk-CVVNQCFM.js';
6
6
  import './chunk-LMO5ASOE.js';
7
7
  import './chunk-WWU2O2SR.js';
8
8
  import './chunk-5BDQNSP3.js';
9
- import './chunk-275FCUOI.js';
10
- import './chunk-WO3AHQVD.js';
9
+ import './chunk-YMD3T6J2.js';
10
+ import './chunk-BHITFSOK.js';
11
11
  import './chunk-7YWBH2A5.js';
12
12
  //# sourceMappingURL=workflows-list.js.map
13
13
  //# sourceMappingURL=workflows-list.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fluidgrids-fe-sdk",
3
- "version": "2026.922.7",
3
+ "version": "2026.922.9",
4
4
  "description": "FluidGrids Workflow Builder SDK - Embeddable visual workflow automation",
5
5
  "type": "module",
6
6
  "imports": {
@@ -1,11 +0,0 @@
1
- export { ExecutionDetailPage } from './chunk-Z4XRVZZ2.js';
2
- import './chunk-CVNW2EUB.js';
3
- import './chunk-UIY2HBWA.js';
4
- import './chunk-3ZYUGTIT.js';
5
- import './chunk-LMO5ASOE.js';
6
- import './chunk-WWU2O2SR.js';
7
- import './chunk-5BDQNSP3.js';
8
- import './chunk-WO3AHQVD.js';
9
- import './chunk-7YWBH2A5.js';
10
- //# sourceMappingURL=ExecutionDetailPage-WLC63RRK.js.map
11
- //# sourceMappingURL=ExecutionDetailPage-WLC63RRK.js.map
@@ -1,10 +0,0 @@
1
- export { ExecutionsListPage } from './chunk-62OZJC2B.js';
2
- import './chunk-CVNW2EUB.js';
3
- import './chunk-OZBZS6DM.js';
4
- import './chunk-LMO5ASOE.js';
5
- import './chunk-WWU2O2SR.js';
6
- import './chunk-5BDQNSP3.js';
7
- import './chunk-WO3AHQVD.js';
8
- import './chunk-7YWBH2A5.js';
9
- //# sourceMappingURL=ExecutionsListPage-P5DRISMN.js.map
10
- //# sourceMappingURL=ExecutionsListPage-P5DRISMN.js.map
@@ -1,13 +0,0 @@
1
- export { WorkflowsList } from './chunk-REM2BQK5.js';
2
- import './chunk-AANIWER2.js';
3
- import './chunk-UIY2HBWA.js';
4
- import './chunk-3ZYUGTIT.js';
5
- import './chunk-OZBZS6DM.js';
6
- import './chunk-LMO5ASOE.js';
7
- import './chunk-WWU2O2SR.js';
8
- import './chunk-5BDQNSP3.js';
9
- import './chunk-275FCUOI.js';
10
- import './chunk-WO3AHQVD.js';
11
- import './chunk-7YWBH2A5.js';
12
- //# sourceMappingURL=WorkflowsList-QDPC2HVV.js.map
13
- //# sourceMappingURL=WorkflowsList-QDPC2HVV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/builder/stores/flow-store.ts"],"names":[],"mappings":";;;;;AA2DA,IAAM,aAAA,GAAgB,GAAA;AAItB,IAAM,YAAA,GAAe,EAAA;AASrB,SAAS,WAAc,KAAA,EAAa;AAClC,EAAA,IAAI;AACF,IAAA,OAAO,gBAAgB,KAAK,CAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA,EACzC;AACF;AAkKA,IAAM,IAAA,GAAc;AAAA,EAClB,EAAE,KAAA,EAAO,WA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AAM,GAAG;AAAA;AACZ;AACF,WACF,CAAE,CAAA;AAAA,QACJ,CAAA;AAAA,QACA,SAAA,EAAW,CAAC,KAAA,KAAyB;AACnC,UAAA,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,YACd,SAAA,EAAW;AAAA,cACT,GAAG,KAAA,CAAM,SAAA;AAAA,cACT,aAAA,EAAe;AAAA;AACjB,WACF,CAAE,CAAA;AAAA,QACJ,CAAA;AAAA,QACA,aAAa,MAAM;AACjB,UAAA,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,YACd,SAAA,EAAW;AAAA,cACT,GAAG,KAAA,CAAM,SAAA;AAAA,cACT,aAAA,EAAe,CAAC,KAAA,CAAM,SAAA,CAAU;AAAA;AAClC,WACF,CAAE,CAAA;AAAA,QACJ,CAAA;AAAA,QACA,WAAW,MAAM;AACf,UAAA,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,YACd,SAAA,EAAW;AAAA,cACT,GAAG,KAAA,CAAM,SAAA;AAAA,cACT,MAAM,EAAC;AAAA,cACP,aAAA,EAAe,IAAA;AAAA,cACf,cAAc,EAAC;AAAA,cACf,gBAAgB;AAAC;AACnB,WACF,CAAE,CAAA;AAAA,QACJ,CAAA;AAAA,QACA,mBAAmB,MAAM;AACvB,UAAA,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,YACd,SAAA,EAAW;AAAA,cACT,GAAG,KAAA,CAAM,SAAA;AAAA,cACT,WAAA,EAAa,KAAA;AAAA,cACb,eAAA,EAAiB;AAAA;AACnB,WACF,CAAE,CAAA;AAAA,QACJ;AAAA;AACF;AACF,GACF;AACF,CAAC;AAID,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,MAAA,CAAA,IAAA,CAAY,KAAK,GAAA,EAAK;AACzD,EAAC,OAA8C,aAAA,GAAgB,YAAA;AACjE","file":"chunk-275FCUOI.js","sourcesContent":["import { nanoid } from \"nanoid/non-secure\";\nimport {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n type Connection,\n type Edge,\n type EdgeChange,\n type Node,\n type NodeChange,\n} from \"@xyflow/react\";\nimport { create } from \"zustand\";\nimport { produce } from \"immer\";\nimport type {\n ExtendedNodeType,\n EdgeCondition,\n EdgeMapping,\n} from \"../../types/node\";\nimport type { Tag } from \"../../types/workflow\";\nimport type { ExecutionLog } from \"../../types/execution\";\n\n// Node execution state for visual display\nexport interface NodeExecutionState {\n status: \"idle\" | \"running\" | \"success\" | \"error\";\n itemCount?: number;\n error?: string;\n}\n\n// Execution state for step execution feature\ninterface ExecutionState {\n isExecuting: boolean;\n executingNodeId: string | null;\n currentRunId: string | null;\n logs: ExecutionLog[];\n selectedLogId: string | null;\n panelExpanded: boolean;\n nodeStatuses: Record<string, \"idle\" | \"running\" | \"success\" | \"error\">;\n nodeItemCounts: Record<string, number>;\n}\n\ninterface CustomEdgeProps extends Edge {\n condition?: EdgeCondition;\n mapping?: EdgeMapping;\n}\n\n/** A point-in-time snapshot of canvas structure for undo/redo. */\nexport interface HistorySnapshot {\n nodes: Node[];\n edges: CustomEdgeProps[];\n}\n\n/** Undo/redo stacks for the currently open workflow. */\nexport interface HistoryState {\n past: HistorySnapshot[];\n future: HistorySnapshot[];\n}\n\n/** Bounds how far back undo can go — generous for an editing session without\n * letting the stacks grow unbounded on a long-lived tab. */\nconst HISTORY_LIMIT = 100;\n\n/** Canvas offset applied to duplicated/pasted nodes so clones never land\n * exactly on top of their source (n8n/Figma-style paste offset). */\nconst CLONE_OFFSET = 48;\n\n/**\n * Deep-clone a value for history snapshots / node-and-edge duplication.\n * `structuredClone` is preferred (fast, handles Dates/Maps/etc.), with a\n * JSON round-trip fallback for the rare manifest blob that carries something\n * structuredClone can't handle (e.g. a stray function reference) — dropping\n * that field is safer than throwing and losing the whole undo/copy action.\n */\nfunction cloneValue<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return JSON.parse(JSON.stringify(value)) as T;\n }\n}\n\ninterface State {\n nodes: Node[];\n edges: CustomEdgeProps[];\n /** Node currently open in the n8n-style 3-pane Node Detail View modal. */\n ndv?: { nodeId: string; type: ExtendedNodeType } | null;\n /** Node currently in inline-rename edit mode (F2 or double-click on its\n * title). Only one node can be renamed at a time. */\n renamingNodeId?: string | null;\n /**\n * Node currently open in the single-click floating quick-config panel\n * (Make-style, attached beside the node). The panel derives its own screen\n * position from the node's live rect, so no anchor is stored here.\n */\n quickConfig?: {\n nodeId: string;\n type: ExtendedNodeType;\n } | null;\n /**\n * Source handle awaiting attachment via the Node Store (the n8n-style \"+\"\n * button on an output handle). While set, clicking an operation in the\n * store panel creates the node and wires it to this handle.\n */\n pendingConnection?: { nodeId: string; handleId: string } | null;\n sidebar: {\n active: \"node-properties\" | \"store-browse\" | \"none\";\n panels: {\n nodeProperties: {\n selectedNode: { id: string; type: ExtendedNodeType } | null | undefined;\n };\n };\n };\n}\n\ninterface Actions {\n actions: {\n saveWorkflow: () => {\n id: string;\n name: string;\n version: string;\n alias?: string;\n dbId?: string;\n status?: string;\n nodes: Node[];\n edges: Edge[];\n };\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => void;\n resetWorkflow: () => void;\n history: {\n undo: () => void;\n redo: () => void;\n /** Wipe both stacks — called when a (different) workflow is loaded so\n * undo can never reach back into a previously open workflow. */\n clear: () => void;\n };\n nodes: {\n onNodesChange: (changes: NodeChange[]) => void;\n /** `historyKind` groups rapid same-kind writes (e.g. keystrokes in one\n * field) into a single undo step; `skipHistory` opts a caller out of\n * history entirely (e.g. transient UI-only patches). */\n setNodes: (\n nodes: Node[],\n opts?: { historyKind?: string; skipHistory?: boolean },\n ) => void;\n deleteNode: (node: Node) => void;\n /** Bulk delete (multi-select) — one undo step for the whole selection. */\n deleteNodes: (nodes: Node[]) => void;\n /** Clone the given nodes (+ edges strictly between them) with fresh ids,\n * offset on the canvas, and select only the clones. */\n duplicateNodes: (nodeIds: string[]) => void;\n /** Insert a clipboard payload (possibly from another workflow/tab):\n * fresh ids, offset, selects the pasted nodes. */\n pasteNodes: (payload: { nodes: Node[]; edges: Edge[] }) => void;\n toggleDisabled: (nodeId: string) => void;\n renameNode: (nodeId: string, label: string) => void;\n startRename: (nodeId: string) => void;\n endRename: () => void;\n };\n edges: {\n onEdgesChange: (changes: EdgeChange[]) => void;\n onConnect: (connection: Connection) => void;\n setEdges: (\n edges: Edge[],\n opts?: { historyKind?: string; skipHistory?: boolean },\n ) => void;\n deleteEdge: (edge: Edge) => void;\n };\n ndv: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) => void;\n close: () => void;\n };\n quickConfig: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) => void;\n close: () => void;\n };\n pendingConnection: {\n /** Arm attach mode for a source handle and open the Node Store panel. */\n start: (connection: { nodeId: string; handleId: string }) => void;\n clear: () => void;\n };\n sidebar: {\n setActivePanel: (\n panel: \"node-properties\" | \"store-browse\" | \"none\",\n ) => void;\n showNodePropertiesOf: (node: {\n id: string;\n type: ExtendedNodeType;\n block?: string;\n }) => void;\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) => void;\n };\n tags: {\n setTags: (tags: Tag[]) => void;\n createTag: (tag: Tag) => void;\n deleteTag: (tag: Tag) => void;\n updateTag: (tag: Tag, newTag: Tag) => void;\n };\n };\n };\n };\n}\n\nexport interface IFlowState {\n tags: Tag[];\n /** Undo/redo stacks — canvas structure (nodes/edges) AND parameter edits,\n * since both flow through the same `setNodes`/`setEdges` writes. */\n history: HistoryState;\n workflow: {\n id: string;\n workflowKey: string;\n name: string;\n version: string;\n alias?: string;\n /** Database row ID (used for updateWorkflowDefinition) */\n dbId?: string;\n /** Current workflow status: DRAFT | ACTIVE | ARCHIVED | DEPRECATED */\n status?: string;\n } & State;\n execution: ExecutionState;\n actions: Actions[\"actions\"] & {\n execution: {\n startExecution: (nodeId: string, runId: string) => void;\n addLog: (log: ExecutionLog) => void;\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => void;\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => void;\n setNodeItemCount: (nodeId: string, count: number) => void;\n selectLog: (logId: string | null) => void;\n togglePanel: () => void;\n clearLogs: () => void;\n completeExecution: () => void;\n };\n };\n}\n\nconst TAGS: Tag[] = [\n { value: \"marketing\", label: \"Marketing\", color: \"#ef4444\" },\n { value: \"support\", label: \"Support\", color: \"#ef4444\" },\n { value: \"lead\", label: \"Lead\", color: \"#eab308\" },\n { value: \"new\", label: \"New\", color: \"#22c55e\" },\n];\n\n/**\n * Pristine execution state. The `execution` slice is global (one run at a\n * time), so it MUST be reset whenever a different workflow is loaded —\n * otherwise the previous workflow's run logs leak into the next workflow's\n * Logs panel. Shared by the store initializer and `resetWorkflow`.\n */\nconst INITIAL_EXECUTION: ExecutionState = {\n isExecuting: false,\n executingNodeId: null,\n currentRunId: null,\n logs: [],\n selectedLogId: null,\n panelExpanded: false,\n nodeStatuses: {},\n nodeItemCounts: {},\n};\n\nconst INITIAL_HISTORY: HistoryState = { past: [], future: [] };\n\nexport const useFlowStore = create<IFlowState>()((set, get) => {\n // Coalescing bookkeeping for history checkpoints. Plain closure vars (not\n // store state) — they're write-tracking metadata, not something a\n // component should ever render off of.\n let lastCheckpointKind: string | null = null;\n let lastCheckpointAt = 0;\n\n /**\n * Record an undo point BEFORE a mutation is applied.\n *\n * `coalesce: true` merges this call into the immediately preceding one when\n * they share the same `kind` and land within the coalescing window — used\n * for bursty writes (keystrokes in one field, a drag in progress) so undo\n * has one step per logical edit, not one per change event. Structural\n * actions (delete, connect, duplicate, disable, rename, …) always pass\n * `coalesce: false` so each is its own undo step even if done quickly in\n * succession.\n */\n function pushCheckpoint(kind: string, coalesce: boolean) {\n const now = Date.now();\n const isCoalesced =\n coalesce && kind === lastCheckpointKind && now - lastCheckpointAt < 800;\n\n if (!isCoalesced) {\n const state = get();\n const snapshot: HistorySnapshot = {\n nodes: cloneValue(state.workflow.nodes),\n edges: cloneValue(state.workflow.edges),\n };\n set((s) => ({\n history: {\n past: [...s.history.past, snapshot].slice(-HISTORY_LIMIT),\n future: [],\n },\n }));\n } else if (get().history.future.length > 0) {\n // Still invalidate redo on a coalesced edit — the user has diverged\n // from whatever redo state existed.\n set((s) => ({ history: { ...s.history, future: [] } }));\n }\n\n lastCheckpointKind = kind;\n lastCheckpointAt = now;\n }\n\n /** Reset coalescing so the next edit always starts a fresh checkpoint. */\n function resetCoalescing() {\n lastCheckpointKind = null;\n lastCheckpointAt = 0;\n }\n\n return {\n tags: TAGS,\n history: { ...INITIAL_HISTORY },\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n edges: [],\n nodes: [],\n ndv: null,\n quickConfig: null,\n pendingConnection: null,\n renamingNodeId: null,\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n execution: { ...INITIAL_EXECUTION },\n actions: {\n saveWorkflow: () => {\n const { workflow } = get();\n const { id, name, version, alias, dbId, status, nodes, edges } =\n workflow;\n set({ workflow });\n return { id, name, version, alias, dbId, status, nodes, edges };\n },\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n ...workflow,\n },\n }));\n },\n resetWorkflow: () => {\n resetCoalescing();\n set(() => ({\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n dbId: undefined,\n status: undefined,\n edges: [],\n nodes: [],\n ndv: null,\n quickConfig: null,\n pendingConnection: null,\n renamingNodeId: null,\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n // Wipe run state too — resetWorkflow fires when the builder loads a\n // (different) workflow, so the previous workflow's logs must not carry\n // over into this one's Logs panel.\n execution: { ...INITIAL_EXECUTION },\n // A freshly loaded workflow must not be undo-able back to empty —\n // undo/redo only ever applies within the currently open workflow.\n history: { ...INITIAL_HISTORY },\n }));\n },\n history: {\n undo: () => {\n const { past, future } = get().history;\n const previous = past[past.length - 1];\n if (!previous) return;\n const { nodes, edges } = get().workflow;\n const current: HistorySnapshot = {\n nodes: cloneValue(nodes),\n edges: cloneValue(edges),\n };\n resetCoalescing();\n set((s) => ({\n workflow: {\n ...s.workflow,\n nodes: previous.nodes,\n edges: previous.edges,\n },\n history: {\n past: past.slice(0, -1),\n future: [current, ...future].slice(0, HISTORY_LIMIT),\n },\n }));\n },\n redo: () => {\n const { past, future } = get().history;\n const next = future[0];\n if (!next) return;\n const { nodes, edges } = get().workflow;\n const current: HistorySnapshot = {\n nodes: cloneValue(nodes),\n edges: cloneValue(edges),\n };\n resetCoalescing();\n set((s) => ({\n workflow: {\n ...s.workflow,\n nodes: next.nodes,\n edges: next.edges,\n },\n history: {\n past: [...past, current].slice(-HISTORY_LIMIT),\n future: future.slice(1),\n },\n }));\n },\n clear: () => {\n resetCoalescing();\n set({ history: { ...INITIAL_HISTORY } });\n },\n },\n ndv: {\n // Opening the full NDV supersedes the floating quick-config panel — the\n // two edit the same node data, so only one should be visible at a time.\n open: (node: { nodeId: string; type: ExtendedNodeType }) =>\n set((state) => ({\n workflow: { ...state.workflow, ndv: node, quickConfig: null },\n })),\n close: () =>\n set((state) => ({\n workflow: { ...state.workflow, ndv: null },\n })),\n },\n quickConfig: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) =>\n set((state) => ({\n workflow: { ...state.workflow, quickConfig: node },\n })),\n close: () =>\n set((state) => ({\n workflow: { ...state.workflow, quickConfig: null },\n })),\n },\n pendingConnection: {\n start: (connection: { nodeId: string; handleId: string }) =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n pendingConnection: connection,\n sidebar: { ...state.workflow.sidebar, active: \"store-browse\" },\n },\n })),\n clear: () =>\n set((state) => ({\n workflow: { ...state.workflow, pendingConnection: null },\n })),\n },\n sidebar: {\n // Leaving the store panel abandons any armed \"+\" attach mode — the\n // pending handle would otherwise silently capture a later insert.\n setActivePanel: (panel: \"node-properties\" | \"store-browse\" | \"none\") =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: { ...state.workflow.sidebar, active: panel },\n ...(panel !== \"store-browse\" ? { pendingConnection: null } : {}),\n },\n })),\n showNodePropertiesOf: (node: {\n id: string;\n type: ExtendedNodeType;\n }) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n pendingConnection: null,\n sidebar: {\n ...state.workflow.sidebar,\n active: \"node-properties\",\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n }));\n },\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: {\n ...state.workflow.sidebar,\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n })),\n },\n tags: {\n setTags: (tags: Tag[]) => set({ tags }),\n createTag: (tag: Tag) =>\n set((state) => ({\n tags: [...state.tags, tag],\n })),\n updateTag: (tag: Tag, newTag: Tag) =>\n set((state) => ({\n tags: state.tags.map((f) =>\n f.value === tag.value ? newTag : f,\n ),\n })),\n deleteTag: (tag: Tag) =>\n set((state) => ({\n tags: state.tags.filter((f) => f.value !== tag.value),\n })),\n },\n },\n },\n nodes: {\n onNodesChange: (changes) => {\n const removedIds = new Set(\n changes\n .filter(\n (c): c is Extract<NodeChange, { type: \"remove\" }> =>\n c.type === \"remove\",\n )\n .map((c) => c.id),\n );\n const addedCount = changes.filter((c) => c.type === \"add\").length;\n\n if (removedIds.size > 0) {\n const stillPresent = get().workflow.nodes.some((n) =>\n removedIds.has(n.id),\n );\n if (stillPresent) pushCheckpoint(\"nodes:remove\", false);\n } else if (addedCount > 0) {\n // A node landed on the canvas via React Flow's own imperative\n // `addNodes()` (drag-from-palette drop, Node Store click-insert,\n // sticky note insert — see useInsertNode / useInsertStickyNote)\n // rather than through our `setNodes` action, so it would\n // otherwise never reach the history stack and Undo would stay\n // disabled after adding a node.\n pushCheckpoint(\"nodes:add\", false);\n } else {\n const finishedDragIds = changes.filter(\n (c): c is Extract<NodeChange, { type: \"position\" }> =>\n c.type === \"position\" && c.dragging === false,\n );\n const actuallyMoved = finishedDragIds.some((c) => {\n const current = get().workflow.nodes.find((n) => n.id === c.id);\n return (\n current &&\n c.position &&\n (current.position.x !== c.position.x ||\n current.position.y !== c.position.y)\n );\n });\n if (actuallyMoved) pushCheckpoint(\"nodes:move\", false);\n }\n\n set((state) =>\n produce(state, (draft) => {\n const updatedNodes = applyNodeChanges(\n changes,\n draft.workflow.nodes,\n );\n draft.workflow.nodes = updatedNodes;\n }),\n );\n },\n setNodes: (nodes, opts) => {\n if (!opts?.skipHistory) {\n pushCheckpoint(\n opts?.historyKind ?? \"nodes:set\",\n !!opts?.historyKind,\n );\n }\n set({ workflow: { ...get().workflow, nodes } });\n },\n deleteNode: (node: Node) => {\n const exists = get().workflow.nodes.some((n) => n.id === node.id);\n if (exists) pushCheckpoint(\"nodes:delete\", false);\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.filter((n) => n.id !== node.id),\n // Drop any UI state pointing at the removed node.\n ...(state.workflow.quickConfig?.nodeId === node.id\n ? { quickConfig: null }\n : {}),\n ...(state.workflow.pendingConnection?.nodeId === node.id\n ? { pendingConnection: null }\n : {}),\n },\n }));\n },\n deleteNodes: (nodes: Node[]) => {\n const ids = new Set(nodes.map((n) => n.id));\n if (ids.size === 0) return;\n const anyExist = get().workflow.nodes.some((n) => ids.has(n.id));\n if (anyExist) pushCheckpoint(\"nodes:delete\", false);\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.filter((n) => !ids.has(n.id)),\n edges: state.workflow.edges.filter(\n (e) => !ids.has(e.source) && !ids.has(e.target),\n ),\n ...(state.workflow.quickConfig &&\n ids.has(state.workflow.quickConfig.nodeId)\n ? { quickConfig: null }\n : {}),\n ...(state.workflow.pendingConnection &&\n ids.has(state.workflow.pendingConnection.nodeId)\n ? { pendingConnection: null }\n : {}),\n },\n }));\n },\n duplicateNodes: (nodeIds: string[]) => {\n const { nodes, edges } = get().workflow;\n const idSet = new Set(nodeIds);\n const selected = nodes.filter((n) => idSet.has(n.id));\n if (selected.length === 0) return;\n pushCheckpoint(\"nodes:duplicate\", false);\n\n const idMap = new Map<string, string>();\n const clones = selected.map((n) => {\n const newId = nanoid();\n idMap.set(n.id, newId);\n const cloned = cloneValue(n);\n return {\n ...cloned,\n id: newId,\n position: {\n x: cloned.position.x + CLONE_OFFSET,\n y: cloned.position.y + CLONE_OFFSET,\n },\n selected: true,\n };\n });\n // Only edges strictly BETWEEN two duplicated nodes come along —\n // an edge to a non-duplicated neighbor would otherwise silently\n // rewire the original graph.\n const clonedEdges = edges\n .filter((e) => idMap.has(e.source) && idMap.has(e.target))\n .map((e) => {\n const cloned = cloneValue(e);\n return {\n ...cloned,\n id: nanoid(),\n source: idMap.get(e.source) as string,\n target: idMap.get(e.target) as string,\n selected: false,\n };\n });\n\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: [\n ...state.workflow.nodes.map((n) =>\n idSet.has(n.id) ? { ...n, selected: false } : n,\n ),\n ...clones,\n ],\n edges: [...state.workflow.edges, ...clonedEdges],\n },\n }));\n },\n pasteNodes: (payload: { nodes: Node[]; edges: Edge[] }) => {\n const pasteNodesIn = payload.nodes ?? [];\n if (pasteNodesIn.length === 0) return;\n pushCheckpoint(\"nodes:paste\", false);\n\n const idMap = new Map<string, string>();\n const clones = pasteNodesIn.map((n) => {\n const newId = nanoid();\n idMap.set(n.id, newId);\n const cloned = cloneValue(n);\n return {\n ...cloned,\n id: newId,\n position: {\n x: (cloned.position?.x ?? 0) + CLONE_OFFSET,\n y: (cloned.position?.y ?? 0) + CLONE_OFFSET,\n },\n selected: true,\n };\n });\n const clonedEdges = (payload.edges ?? [])\n .filter((e) => idMap.has(e.source) && idMap.has(e.target))\n .map((e) => {\n const cloned = cloneValue(e);\n return {\n ...cloned,\n id: nanoid(),\n source: idMap.get(e.source) as string,\n target: idMap.get(e.target) as string,\n selected: false,\n };\n });\n\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: [\n ...state.workflow.nodes.map((n) => ({ ...n, selected: false })),\n ...clones,\n ],\n edges: [...state.workflow.edges, ...clonedEdges],\n },\n }));\n },\n toggleDisabled: (nodeId: string) => {\n pushCheckpoint(\"nodes:disable\", false);\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.map((n) => {\n if (n.id !== nodeId) return n;\n const data = (n.data ?? {}) as Record<string, unknown>;\n return {\n ...n,\n data: { ...data, disabled: !(data.disabled === true) },\n };\n }),\n },\n }));\n },\n renameNode: (nodeId: string, label: string) => {\n pushCheckpoint(\"nodes:rename\", false);\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.map((n) =>\n n.id === nodeId\n ? { ...n, data: { ...(n.data ?? {}), label } }\n : n,\n ),\n renamingNodeId: null,\n },\n }));\n },\n startRename: (nodeId: string) => {\n set((state) => ({\n workflow: { ...state.workflow, renamingNodeId: nodeId },\n }));\n },\n endRename: () => {\n set((state) => ({\n workflow: { ...state.workflow, renamingNodeId: null },\n }));\n },\n },\n edges: {\n onEdgesChange: (changes) => {\n const removedIds = new Set(\n changes\n .filter(\n (c): c is Extract<EdgeChange, { type: \"remove\" }> =>\n c.type === \"remove\",\n )\n .map((c) => c.id),\n );\n if (removedIds.size > 0) {\n const stillPresent = get().workflow.edges.some((e) =>\n removedIds.has(e.id),\n );\n if (stillPresent) pushCheckpoint(\"edges:remove\", false);\n } else if (changes.some((c) => c.type === \"add\")) {\n // Same gap as onNodesChange's \"add\" case: an edge created via\n // React Flow's imperative `addEdges()` (e.g. drag a connection\n // off a handle onto empty canvas, then pick a node from the\n // floating menu — useAddNodeOnEdgeDrop) must still be undoable.\n pushCheckpoint(\"edges:add\", false);\n }\n\n set((state) =>\n produce(state, (draft) => {\n const updatedEdges = applyEdgeChanges(\n changes,\n draft.workflow.edges,\n );\n draft.workflow.edges = updatedEdges;\n }),\n );\n },\n onConnect: (connection) => {\n pushCheckpoint(\"edges:connect\", false);\n const edge = {\n ...connection,\n id: nanoid(),\n type: \"deletable\",\n } as Edge;\n set({\n workflow: {\n ...get().workflow,\n edges: addEdge(edge, get().workflow.edges),\n },\n });\n },\n setEdges: (edges, opts) => {\n if (!opts?.skipHistory) {\n pushCheckpoint(\n opts?.historyKind ?? \"edges:set\",\n !!opts?.historyKind,\n );\n }\n set({ workflow: { ...get().workflow, edges } });\n },\n deleteEdge: (edge: Edge) => {\n const exists = get().workflow.edges.some((e) => e.id === edge.id);\n if (exists) pushCheckpoint(\"edges:delete\", false);\n set((state) => ({\n workflow: {\n ...state.workflow,\n edges: state.workflow.edges.filter((e) => e.id !== edge.id),\n },\n }));\n },\n },\n execution: {\n startExecution: (nodeId: string, runId: string) => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: true,\n executingNodeId: nodeId,\n currentRunId: runId,\n panelExpanded: true,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: \"running\",\n },\n },\n }));\n },\n addLog: (log: ExecutionLog) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [...state.execution.logs, log],\n selectedLogId: log.id,\n },\n }));\n },\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: state.execution.logs.map((log) =>\n log.id === logId ? { ...log, ...updates } : log,\n ),\n },\n }));\n },\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: status,\n },\n },\n }));\n },\n setNodeItemCount: (nodeId: string, count: number) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeItemCounts: {\n ...state.execution.nodeItemCounts,\n [nodeId]: count,\n },\n },\n }));\n },\n selectLog: (logId: string | null) => {\n set((state) => ({\n execution: {\n ...state.execution,\n selectedLogId: logId,\n },\n }));\n },\n togglePanel: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n panelExpanded: !state.execution.panelExpanded,\n },\n }));\n },\n clearLogs: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [],\n selectedLogId: null,\n nodeStatuses: {},\n nodeItemCounts: {},\n },\n }));\n },\n completeExecution: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: false,\n executingNodeId: null,\n },\n }));\n },\n },\n },\n };\n});\n\n// Dev-only debug handle so the store can be inspected/driven from the browser\n// console or automated tests. No-op in production builds.\nif (typeof window !== \"undefined\" && import.meta.env?.DEV) {\n (window as unknown as Record<string, unknown>).__fgFlowStore = useFlowStore;\n}\n"]}