@goplasmatic/dataflow-ui 2.0.4 → 2.0.6
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/README.md +46 -3
- package/dist/index.cjs +547 -77
- package/dist/index.d.ts +44 -1
- package/dist/index.js +547 -77
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
7
|
const require$$0 = require("react");
|
|
@@ -243,6 +246,21 @@ const FileJson = createLucideIcon("FileJson", [
|
|
|
243
246
|
{ d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1", key: "mpwhp6" }
|
|
244
247
|
]
|
|
245
248
|
]);
|
|
249
|
+
/**
|
|
250
|
+
* @license lucide-react v0.462.0 - ISC
|
|
251
|
+
*
|
|
252
|
+
* This source code is licensed under the ISC license.
|
|
253
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
+
*/
|
|
255
|
+
const Folder = createLucideIcon("Folder", [
|
|
256
|
+
[
|
|
257
|
+
"path",
|
|
258
|
+
{
|
|
259
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
|
|
260
|
+
key: "1kt360"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
]);
|
|
246
264
|
/**
|
|
247
265
|
* @license lucide-react v0.462.0 - ISC
|
|
248
266
|
*
|
|
@@ -628,7 +646,8 @@ const DebuggerContext = require$$0.createContext(null);
|
|
|
628
646
|
function DebuggerProvider({
|
|
629
647
|
children: children2,
|
|
630
648
|
initialPayload,
|
|
631
|
-
autoActivate = false
|
|
649
|
+
autoActivate = false,
|
|
650
|
+
engineFactory
|
|
632
651
|
}) {
|
|
633
652
|
const [state, dispatch2] = require$$0.useReducer(debuggerReducer, {
|
|
634
653
|
...initialState,
|
|
@@ -636,6 +655,9 @@ function DebuggerProvider({
|
|
|
636
655
|
isActive: autoActivate
|
|
637
656
|
});
|
|
638
657
|
const playbackTimerRef = require$$0.useRef(null);
|
|
658
|
+
const engineRef = require$$0.useRef(null);
|
|
659
|
+
const lastWorkflowsJsonRef = require$$0.useRef(null);
|
|
660
|
+
const isEngineReady = Boolean(engineFactory);
|
|
639
661
|
const activate = require$$0.useCallback(() => dispatch2({ type: "ACTIVATE" }), []);
|
|
640
662
|
const deactivate = require$$0.useCallback(() => dispatch2({ type: "DEACTIVATE" }), []);
|
|
641
663
|
const setInputPayload = require$$0.useCallback(
|
|
@@ -659,6 +681,38 @@ function DebuggerProvider({
|
|
|
659
681
|
const stepBackward = require$$0.useCallback(() => dispatch2({ type: "STEP_BACKWARD" }), []);
|
|
660
682
|
const goToStep = require$$0.useCallback((index2) => dispatch2({ type: "GO_TO_STEP", index: index2 }), []);
|
|
661
683
|
const setSpeed = require$$0.useCallback((speed) => dispatch2({ type: "SET_SPEED", speed }), []);
|
|
684
|
+
const runExecution = require$$0.useCallback(
|
|
685
|
+
async (workflows, payload) => {
|
|
686
|
+
var _a;
|
|
687
|
+
if (workflows.length === 0 || !engineFactory) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
try {
|
|
691
|
+
const workflowsJson = JSON.stringify(workflows);
|
|
692
|
+
if (lastWorkflowsJsonRef.current !== workflowsJson || !engineRef.current) {
|
|
693
|
+
if ((_a = engineRef.current) == null ? void 0 : _a.dispose) {
|
|
694
|
+
engineRef.current.dispose();
|
|
695
|
+
}
|
|
696
|
+
engineRef.current = engineFactory(workflows);
|
|
697
|
+
lastWorkflowsJsonRef.current = workflowsJson;
|
|
698
|
+
}
|
|
699
|
+
return await engineRef.current.processWithTrace(payload);
|
|
700
|
+
} catch (error) {
|
|
701
|
+
console.error("Execution error:", error);
|
|
702
|
+
throw error;
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
[engineFactory]
|
|
706
|
+
);
|
|
707
|
+
require$$0.useEffect(() => {
|
|
708
|
+
return () => {
|
|
709
|
+
var _a;
|
|
710
|
+
if ((_a = engineRef.current) == null ? void 0 : _a.dispose) {
|
|
711
|
+
engineRef.current.dispose();
|
|
712
|
+
engineRef.current = null;
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
}, []);
|
|
662
716
|
require$$0.useEffect(() => {
|
|
663
717
|
if (state.playbackState === "playing") {
|
|
664
718
|
playbackTimerRef.current = window.setInterval(() => {
|
|
@@ -701,6 +755,7 @@ function DebuggerProvider({
|
|
|
701
755
|
stepBackward,
|
|
702
756
|
goToStep,
|
|
703
757
|
setSpeed,
|
|
758
|
+
runExecution,
|
|
704
759
|
currentStep,
|
|
705
760
|
currentMessage,
|
|
706
761
|
currentChanges,
|
|
@@ -708,7 +763,8 @@ function DebuggerProvider({
|
|
|
708
763
|
isAtEnd,
|
|
709
764
|
hasTrace,
|
|
710
765
|
progress,
|
|
711
|
-
totalSteps
|
|
766
|
+
totalSteps,
|
|
767
|
+
isEngineReady
|
|
712
768
|
};
|
|
713
769
|
return /* @__PURE__ */ jsxRuntime.jsx(DebuggerContext.Provider, { value, children: children2 });
|
|
714
770
|
}
|
|
@@ -9609,9 +9665,9 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
9609
9665
|
}, children: children2 });
|
|
9610
9666
|
}
|
|
9611
9667
|
require$$0.memo(ResizeControl);
|
|
9612
|
-
var
|
|
9613
|
-
var
|
|
9614
|
-
var
|
|
9668
|
+
var __defProp2 = Object.defineProperty;
|
|
9669
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9670
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9615
9671
|
let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNodes;
|
|
9616
9672
|
(async () => {
|
|
9617
9673
|
const BRANCH_COLORS = {
|
|
@@ -13345,23 +13401,23 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
|
|
|
13345
13401
|
var EDGE_KEY_DELIM = "";
|
|
13346
13402
|
class Graph {
|
|
13347
13403
|
constructor(opts) {
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13404
|
+
__publicField2(this, "_isDirected", true);
|
|
13405
|
+
__publicField2(this, "_isMultigraph", false);
|
|
13406
|
+
__publicField2(this, "_isCompound", false);
|
|
13407
|
+
__publicField2(this, "_label");
|
|
13408
|
+
__publicField2(this, "_defaultNodeLabelFn", () => void 0);
|
|
13409
|
+
__publicField2(this, "_defaultEdgeLabelFn", () => void 0);
|
|
13410
|
+
__publicField2(this, "_nodes", {});
|
|
13411
|
+
__publicField2(this, "_in", {});
|
|
13412
|
+
__publicField2(this, "_preds", {});
|
|
13413
|
+
__publicField2(this, "_out", {});
|
|
13414
|
+
__publicField2(this, "_sucs", {});
|
|
13415
|
+
__publicField2(this, "_edgeObjs", {});
|
|
13416
|
+
__publicField2(this, "_edgeLabels", {});
|
|
13417
|
+
__publicField2(this, "_nodeCount", 0);
|
|
13418
|
+
__publicField2(this, "_edgeCount", 0);
|
|
13419
|
+
__publicField2(this, "_parent");
|
|
13420
|
+
__publicField2(this, "_children");
|
|
13365
13421
|
if (opts) {
|
|
13366
13422
|
this._isDirected = Object.hasOwn(opts, "directed") ? opts.directed : true;
|
|
13367
13423
|
this._isMultigraph = Object.hasOwn(opts, "multigraph") ? opts.multigraph : false;
|
|
@@ -13893,8 +13949,8 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
|
|
|
13893
13949
|
hasRequiredPriorityQueue = 1;
|
|
13894
13950
|
class PriorityQueue {
|
|
13895
13951
|
constructor() {
|
|
13896
|
-
|
|
13897
|
-
|
|
13952
|
+
__publicField2(this, "_arr", []);
|
|
13953
|
+
__publicField2(this, "_keyIndices", {});
|
|
13898
13954
|
}
|
|
13899
13955
|
size() {
|
|
13900
13956
|
return this._arr.length;
|
|
@@ -17574,13 +17630,13 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
|
|
|
17574
17630
|
try {
|
|
17575
17631
|
setLoading(true);
|
|
17576
17632
|
setError(null);
|
|
17577
|
-
const
|
|
17578
|
-
await
|
|
17633
|
+
const wasm2 = await Promise.resolve().then(() => require("./datalogic_wasm-4utZNR2J-B5BvlAcC.cjs"));
|
|
17634
|
+
await wasm2.default();
|
|
17579
17635
|
if (!cancelled) {
|
|
17580
17636
|
moduleRef.current = {
|
|
17581
|
-
evaluate:
|
|
17582
|
-
evaluate_with_trace:
|
|
17583
|
-
CompiledRule:
|
|
17637
|
+
evaluate: wasm2.evaluate,
|
|
17638
|
+
evaluate_with_trace: wasm2.evaluate_with_trace,
|
|
17639
|
+
CompiledRule: wasm2.CompiledRule
|
|
17584
17640
|
};
|
|
17585
17641
|
setReady(true);
|
|
17586
17642
|
setLoading(false);
|
|
@@ -19854,31 +19910,38 @@ function TreeNode({
|
|
|
19854
19910
|
};
|
|
19855
19911
|
const debugStateClass = debugState ? `df-tree-node-${debugState}` : "";
|
|
19856
19912
|
const currentClass = isCurrent ? "df-tree-node-current-step" : "";
|
|
19857
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
{
|
|
19861
|
-
|
|
19862
|
-
|
|
19863
|
-
|
|
19864
|
-
|
|
19865
|
-
|
|
19866
|
-
"
|
|
19867
|
-
{
|
|
19868
|
-
|
|
19869
|
-
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
|
|
19881
|
-
|
|
19913
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19914
|
+
"div",
|
|
19915
|
+
{
|
|
19916
|
+
className: `df-tree-node ${debugStateClass} ${currentClass}`,
|
|
19917
|
+
"data-current-step": isCurrent ? "true" : void 0,
|
|
19918
|
+
children: [
|
|
19919
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19920
|
+
"div",
|
|
19921
|
+
{
|
|
19922
|
+
className: `df-tree-node-content ${isSelected ? "df-tree-node-selected" : ""}`,
|
|
19923
|
+
style: { paddingLeft: `${level * 16 + 8}px` },
|
|
19924
|
+
onClick: handleClick,
|
|
19925
|
+
children: [
|
|
19926
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19927
|
+
"span",
|
|
19928
|
+
{
|
|
19929
|
+
className: "df-tree-toggle",
|
|
19930
|
+
onClick: hasChildren ? handleToggle : void 0,
|
|
19931
|
+
style: { visibility: hasChildren ? "visible" : "hidden" },
|
|
19932
|
+
children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 14 })
|
|
19933
|
+
}
|
|
19934
|
+
),
|
|
19935
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-tree-icon", style: iconColor ? { color: iconColor } : void 0, children: icon }),
|
|
19936
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-tree-label", children: label }),
|
|
19937
|
+
debugState && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-tree-debug-indicator", children: /* @__PURE__ */ jsxRuntime.jsx(DebugStateIcon, { state: debugState, conditionResult }) })
|
|
19938
|
+
]
|
|
19939
|
+
}
|
|
19940
|
+
),
|
|
19941
|
+
isExpanded && hasChildren && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-tree-children", children: children2 })
|
|
19942
|
+
]
|
|
19943
|
+
}
|
|
19944
|
+
);
|
|
19882
19945
|
}
|
|
19883
19946
|
const TREE_COLORS = {
|
|
19884
19947
|
workflow: "#0078d4",
|
|
@@ -19891,8 +19954,10 @@ const TREE_COLORS = {
|
|
|
19891
19954
|
// VSCode teal/green
|
|
19892
19955
|
validation: "#ce9178",
|
|
19893
19956
|
// VSCode orange
|
|
19894
|
-
tasks: "#9d9d9d"
|
|
19957
|
+
tasks: "#9d9d9d",
|
|
19895
19958
|
// VSCode gray
|
|
19959
|
+
folder: "#dcb67a"
|
|
19960
|
+
// VSCode folder yellow/gold
|
|
19896
19961
|
};
|
|
19897
19962
|
function TaskNode({
|
|
19898
19963
|
task,
|
|
@@ -20091,20 +20156,177 @@ function WorkflowNode({
|
|
|
20091
20156
|
}
|
|
20092
20157
|
);
|
|
20093
20158
|
}
|
|
20159
|
+
function FolderNode({
|
|
20160
|
+
folder,
|
|
20161
|
+
level,
|
|
20162
|
+
selection: selection2,
|
|
20163
|
+
onSelect,
|
|
20164
|
+
expandedNodes,
|
|
20165
|
+
toggleNode,
|
|
20166
|
+
debugMode = false
|
|
20167
|
+
}) {
|
|
20168
|
+
const folderId = `folder-${folder.fullPath}`;
|
|
20169
|
+
const isExpanded = expandedNodes.has(folderId);
|
|
20170
|
+
const hasChildren = folder.folders.size > 0 || folder.workflows.length > 0;
|
|
20171
|
+
const sortedFolders = Array.from(folder.folders.values()).sort(
|
|
20172
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
20173
|
+
);
|
|
20174
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20175
|
+
TreeNode,
|
|
20176
|
+
{
|
|
20177
|
+
label: `${folder.name} (${folder.totalWorkflowCount})`,
|
|
20178
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Folder, { size: 14 }),
|
|
20179
|
+
iconColor: TREE_COLORS.folder,
|
|
20180
|
+
isExpanded,
|
|
20181
|
+
hasChildren,
|
|
20182
|
+
level,
|
|
20183
|
+
onToggle: () => toggleNode(folderId),
|
|
20184
|
+
onClick: () => toggleNode(folderId),
|
|
20185
|
+
children: [
|
|
20186
|
+
sortedFolders.map((childFolder) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20187
|
+
FolderNode,
|
|
20188
|
+
{
|
|
20189
|
+
folder: childFolder,
|
|
20190
|
+
level: level + 1,
|
|
20191
|
+
selection: selection2,
|
|
20192
|
+
onSelect,
|
|
20193
|
+
expandedNodes,
|
|
20194
|
+
toggleNode,
|
|
20195
|
+
debugMode
|
|
20196
|
+
},
|
|
20197
|
+
childFolder.fullPath
|
|
20198
|
+
)),
|
|
20199
|
+
folder.workflows.map((workflow) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20200
|
+
WorkflowNode,
|
|
20201
|
+
{
|
|
20202
|
+
workflow,
|
|
20203
|
+
level: level + 1,
|
|
20204
|
+
selection: selection2,
|
|
20205
|
+
onSelect,
|
|
20206
|
+
expandedNodes,
|
|
20207
|
+
toggleNode,
|
|
20208
|
+
debugMode
|
|
20209
|
+
},
|
|
20210
|
+
workflow.id
|
|
20211
|
+
))
|
|
20212
|
+
]
|
|
20213
|
+
}
|
|
20214
|
+
);
|
|
20215
|
+
}
|
|
20216
|
+
function parsePath(path) {
|
|
20217
|
+
if (!path) return [];
|
|
20218
|
+
const trimmed = path.replace(/^\/+|\/+$/g, "");
|
|
20219
|
+
if (!trimmed) return [];
|
|
20220
|
+
return trimmed.split("/").filter((segment) => segment.length > 0);
|
|
20221
|
+
}
|
|
20222
|
+
function createFolderNode(name, fullPath) {
|
|
20223
|
+
return {
|
|
20224
|
+
name,
|
|
20225
|
+
fullPath,
|
|
20226
|
+
folders: /* @__PURE__ */ new Map(),
|
|
20227
|
+
workflows: [],
|
|
20228
|
+
totalWorkflowCount: 0
|
|
20229
|
+
};
|
|
20230
|
+
}
|
|
20231
|
+
function calculateTotalCount(node) {
|
|
20232
|
+
let count = node.workflows.length;
|
|
20233
|
+
for (const child of node.folders.values()) {
|
|
20234
|
+
count += calculateTotalCount(child);
|
|
20235
|
+
}
|
|
20236
|
+
node.totalWorkflowCount = count;
|
|
20237
|
+
return count;
|
|
20238
|
+
}
|
|
20239
|
+
function buildFolderTree(workflows) {
|
|
20240
|
+
const tree = {
|
|
20241
|
+
folders: /* @__PURE__ */ new Map(),
|
|
20242
|
+
workflows: []
|
|
20243
|
+
};
|
|
20244
|
+
const sortedWorkflows = [...workflows].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
20245
|
+
for (const workflow of sortedWorkflows) {
|
|
20246
|
+
const segments = parsePath(workflow.path);
|
|
20247
|
+
if (segments.length === 0) {
|
|
20248
|
+
tree.workflows.push(workflow);
|
|
20249
|
+
} else {
|
|
20250
|
+
let currentLevel = tree.folders;
|
|
20251
|
+
let currentPath = "";
|
|
20252
|
+
for (let i = 0; i < segments.length; i++) {
|
|
20253
|
+
const segment = segments[i];
|
|
20254
|
+
currentPath = currentPath ? `${currentPath}/${segment}` : segment;
|
|
20255
|
+
if (!currentLevel.has(segment)) {
|
|
20256
|
+
currentLevel.set(segment, createFolderNode(segment, currentPath));
|
|
20257
|
+
}
|
|
20258
|
+
const folder = currentLevel.get(segment);
|
|
20259
|
+
if (i === segments.length - 1) {
|
|
20260
|
+
folder.workflows.push(workflow);
|
|
20261
|
+
} else {
|
|
20262
|
+
currentLevel = folder.folders;
|
|
20263
|
+
}
|
|
20264
|
+
}
|
|
20265
|
+
}
|
|
20266
|
+
}
|
|
20267
|
+
for (const folder of tree.folders.values()) {
|
|
20268
|
+
calculateTotalCount(folder);
|
|
20269
|
+
}
|
|
20270
|
+
return tree;
|
|
20271
|
+
}
|
|
20272
|
+
function getFirstLevelFolderIds(tree) {
|
|
20273
|
+
return Array.from(tree.folders.keys()).map((name) => `folder-${name}`);
|
|
20274
|
+
}
|
|
20275
|
+
function getParentFolderIds(path) {
|
|
20276
|
+
const segments = parsePath(path);
|
|
20277
|
+
if (segments.length === 0) return [];
|
|
20278
|
+
const ids = [];
|
|
20279
|
+
let currentPath = "";
|
|
20280
|
+
for (const segment of segments) {
|
|
20281
|
+
currentPath = currentPath ? `${currentPath}/${segment}` : segment;
|
|
20282
|
+
ids.push(`folder-${currentPath}`);
|
|
20283
|
+
}
|
|
20284
|
+
return ids;
|
|
20285
|
+
}
|
|
20094
20286
|
function TreeView({ workflows, selection: selection2, onSelect, debugMode = false }) {
|
|
20095
20287
|
const debuggerContext = useDebugger();
|
|
20096
20288
|
const effectiveDebugContext = debugMode ? debuggerContext : null;
|
|
20289
|
+
const folderTree = require$$0.useMemo(() => buildFolderTree(workflows), [workflows]);
|
|
20290
|
+
const sortedRootFolders = require$$0.useMemo(() => {
|
|
20291
|
+
return Array.from(folderTree.folders.values()).sort(
|
|
20292
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
20293
|
+
);
|
|
20294
|
+
}, [folderTree]);
|
|
20295
|
+
const rootWorkflows = folderTree.workflows;
|
|
20097
20296
|
const [expandedNodes, setExpandedNodes] = require$$0.useState(() => {
|
|
20098
20297
|
const initial = /* @__PURE__ */ new Set(["workflows-root"]);
|
|
20099
|
-
|
|
20100
|
-
initial.add(`workflow-${workflows[0].id}`);
|
|
20101
|
-
}
|
|
20298
|
+
getFirstLevelFolderIds(folderTree).forEach((id2) => initial.add(id2));
|
|
20102
20299
|
return initial;
|
|
20103
20300
|
});
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
|
|
20301
|
+
require$$0.useEffect(() => {
|
|
20302
|
+
setExpandedNodes((prev) => {
|
|
20303
|
+
const next = new Set(prev);
|
|
20304
|
+
next.add("workflows-root");
|
|
20305
|
+
getFirstLevelFolderIds(folderTree).forEach((id2) => next.add(id2));
|
|
20306
|
+
return next;
|
|
20307
|
+
});
|
|
20308
|
+
}, [folderTree]);
|
|
20309
|
+
require$$0.useEffect(() => {
|
|
20310
|
+
const allWorkflows = [...folderTree.workflows];
|
|
20311
|
+
function collectWorkflows(folders) {
|
|
20312
|
+
for (const folder of folders.values()) {
|
|
20313
|
+
allWorkflows.push(...folder.workflows);
|
|
20314
|
+
collectWorkflows(folder.folders);
|
|
20315
|
+
}
|
|
20316
|
+
}
|
|
20317
|
+
collectWorkflows(folderTree.folders);
|
|
20318
|
+
if (allWorkflows.length > 0) {
|
|
20319
|
+
allWorkflows.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
20320
|
+
setExpandedNodes((prev) => {
|
|
20321
|
+
const next = new Set(prev);
|
|
20322
|
+
next.add(`workflow-${allWorkflows[0].id}`);
|
|
20323
|
+
getParentFolderIds(allWorkflows[0].path).forEach((id2) => next.add(id2));
|
|
20324
|
+
return next;
|
|
20325
|
+
});
|
|
20326
|
+
}
|
|
20327
|
+
}, [folderTree]);
|
|
20107
20328
|
const lastSelectedRef = require$$0.useRef(null);
|
|
20329
|
+
const treeContainerRef = require$$0.useRef(null);
|
|
20108
20330
|
require$$0.useEffect(() => {
|
|
20109
20331
|
var _a, _b;
|
|
20110
20332
|
if (!debugMode || !(effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentStep) || effectiveDebugContext.state.currentStepIndex < 0) {
|
|
@@ -20114,9 +20336,13 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
|
|
|
20114
20336
|
if (((_a = lastSelectedRef.current) == null ? void 0 : _a.workflowId) === workflow_id && ((_b = lastSelectedRef.current) == null ? void 0 : _b.taskId) === task_id) {
|
|
20115
20337
|
return;
|
|
20116
20338
|
}
|
|
20339
|
+
const workflow = workflows.find((w) => w.id === workflow_id);
|
|
20117
20340
|
setExpandedNodes((prev) => {
|
|
20118
20341
|
const next = new Set(prev);
|
|
20119
20342
|
next.add("workflows-root");
|
|
20343
|
+
if (workflow == null ? void 0 : workflow.path) {
|
|
20344
|
+
getParentFolderIds(workflow.path).forEach((id2) => next.add(id2));
|
|
20345
|
+
}
|
|
20120
20346
|
next.add(`workflow-${workflow_id}`);
|
|
20121
20347
|
next.add(`tasks-${workflow_id}`);
|
|
20122
20348
|
if (task_id) {
|
|
@@ -20125,7 +20351,6 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
|
|
|
20125
20351
|
return next;
|
|
20126
20352
|
});
|
|
20127
20353
|
if (task_id) {
|
|
20128
|
-
const workflow = workflows.find((w) => w.id === workflow_id);
|
|
20129
20354
|
const task = workflow == null ? void 0 : workflow.tasks.find((t) => t.id === task_id);
|
|
20130
20355
|
if (workflow && task) {
|
|
20131
20356
|
lastSelectedRef.current = { workflowId: workflow_id, taskId: task_id };
|
|
@@ -20134,6 +20359,16 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
|
|
|
20134
20359
|
} else {
|
|
20135
20360
|
lastSelectedRef.current = { workflowId: workflow_id };
|
|
20136
20361
|
}
|
|
20362
|
+
setTimeout(() => {
|
|
20363
|
+
var _a2;
|
|
20364
|
+
const currentStepElement = (_a2 = treeContainerRef.current) == null ? void 0 : _a2.querySelector('[data-current-step="true"]');
|
|
20365
|
+
if (currentStepElement) {
|
|
20366
|
+
currentStepElement.scrollIntoView({
|
|
20367
|
+
behavior: "smooth",
|
|
20368
|
+
block: "nearest"
|
|
20369
|
+
});
|
|
20370
|
+
}
|
|
20371
|
+
}, 50);
|
|
20137
20372
|
}, [debugMode, effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentStep, effectiveDebugContext == null ? void 0 : effectiveDebugContext.state.currentStepIndex, workflows, onSelect]);
|
|
20138
20373
|
const toggleNode = (id2) => {
|
|
20139
20374
|
setExpandedNodes((prev) => {
|
|
@@ -20147,30 +20382,46 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
|
|
|
20147
20382
|
});
|
|
20148
20383
|
};
|
|
20149
20384
|
const isRootExpanded = expandedNodes.has("workflows-root");
|
|
20150
|
-
|
|
20385
|
+
const totalWorkflowCount = workflows.length;
|
|
20386
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: treeContainerRef, className: `df-tree-view ${debugMode ? "df-tree-view-debug" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20151
20387
|
TreeNode,
|
|
20152
20388
|
{
|
|
20153
20389
|
label: "Workflows",
|
|
20154
20390
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Layers, { size: 14 }),
|
|
20155
20391
|
iconColor: TREE_COLORS.workflow,
|
|
20156
20392
|
isExpanded: isRootExpanded,
|
|
20157
|
-
hasChildren:
|
|
20393
|
+
hasChildren: totalWorkflowCount > 0,
|
|
20158
20394
|
level: 0,
|
|
20159
20395
|
onToggle: () => toggleNode("workflows-root"),
|
|
20160
20396
|
onClick: () => toggleNode("workflows-root"),
|
|
20161
|
-
children:
|
|
20162
|
-
|
|
20163
|
-
|
|
20164
|
-
|
|
20165
|
-
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20397
|
+
children: [
|
|
20398
|
+
sortedRootFolders.map((folder) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20399
|
+
FolderNode,
|
|
20400
|
+
{
|
|
20401
|
+
folder,
|
|
20402
|
+
level: 1,
|
|
20403
|
+
selection: selection2,
|
|
20404
|
+
onSelect,
|
|
20405
|
+
expandedNodes,
|
|
20406
|
+
toggleNode,
|
|
20407
|
+
debugMode
|
|
20408
|
+
},
|
|
20409
|
+
folder.fullPath
|
|
20410
|
+
)),
|
|
20411
|
+
rootWorkflows.map((workflow) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20412
|
+
WorkflowNode,
|
|
20413
|
+
{
|
|
20414
|
+
workflow,
|
|
20415
|
+
level: 1,
|
|
20416
|
+
selection: selection2,
|
|
20417
|
+
onSelect,
|
|
20418
|
+
expandedNodes,
|
|
20419
|
+
toggleNode,
|
|
20420
|
+
debugMode
|
|
20421
|
+
},
|
|
20422
|
+
workflow.id
|
|
20423
|
+
))
|
|
20424
|
+
]
|
|
20174
20425
|
}
|
|
20175
20426
|
) });
|
|
20176
20427
|
}
|
|
@@ -22023,6 +22274,223 @@ function DebugStateBadge({
|
|
|
22023
22274
|
conditionResult !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-badge-condition ${conditionResult ? "df-debug-badge-condition-pass" : "df-debug-badge-condition-fail"}`, children: conditionResult ? /* @__PURE__ */ jsxRuntime.jsx(Check, { size: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(X, { size: iconSize }) })
|
|
22024
22275
|
] });
|
|
22025
22276
|
}
|
|
22277
|
+
class WasmEngine {
|
|
22278
|
+
__destroy_into_raw() {
|
|
22279
|
+
const ptr = this.__wbg_ptr;
|
|
22280
|
+
this.__wbg_ptr = 0;
|
|
22281
|
+
WasmEngineFinalization.unregister(this);
|
|
22282
|
+
return ptr;
|
|
22283
|
+
}
|
|
22284
|
+
free() {
|
|
22285
|
+
const ptr = this.__destroy_into_raw();
|
|
22286
|
+
wasm.__wbg_wasmengine_free(ptr, 0);
|
|
22287
|
+
}
|
|
22288
|
+
/**
|
|
22289
|
+
* Create a new WasmEngine from a JSON array of workflow definitions.
|
|
22290
|
+
*
|
|
22291
|
+
* # Arguments
|
|
22292
|
+
* * `workflows_json` - JSON string containing an array of workflow definitions
|
|
22293
|
+
*
|
|
22294
|
+
* # Example
|
|
22295
|
+
* ```javascript
|
|
22296
|
+
* const workflows = JSON.stringify([{
|
|
22297
|
+
* id: "workflow1",
|
|
22298
|
+
* name: "My Workflow",
|
|
22299
|
+
* priority: 1,
|
|
22300
|
+
* tasks: [...]
|
|
22301
|
+
* }]);
|
|
22302
|
+
* const engine = new WasmEngine(workflows);
|
|
22303
|
+
* ```
|
|
22304
|
+
* @param {string} workflows_json
|
|
22305
|
+
*/
|
|
22306
|
+
constructor(workflows_json) {
|
|
22307
|
+
const ptr0 = passStringToWasm0(workflows_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
22308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
22309
|
+
const ret = wasm.wasmengine_new(ptr0, len0);
|
|
22310
|
+
if (ret[2]) {
|
|
22311
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
22312
|
+
}
|
|
22313
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
22314
|
+
WasmEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
22315
|
+
return this;
|
|
22316
|
+
}
|
|
22317
|
+
/**
|
|
22318
|
+
* Process a payload through the engine's workflows.
|
|
22319
|
+
*
|
|
22320
|
+
* This is an async operation that returns a Promise.
|
|
22321
|
+
*
|
|
22322
|
+
* # Arguments
|
|
22323
|
+
* * `payload_json` - JSON string of the payload to process
|
|
22324
|
+
*
|
|
22325
|
+
* # Returns
|
|
22326
|
+
* A Promise that resolves to the processed message as a JSON string
|
|
22327
|
+
*
|
|
22328
|
+
* # Example
|
|
22329
|
+
* ```javascript
|
|
22330
|
+
* const payload = JSON.stringify({ name: "John", email: "john@example.com" });
|
|
22331
|
+
* const result = await engine.process(payload);
|
|
22332
|
+
* const processed = JSON.parse(result);
|
|
22333
|
+
* console.log(processed.context.data);
|
|
22334
|
+
* ```
|
|
22335
|
+
* @param {string} payload_json
|
|
22336
|
+
* @returns {Promise<any>}
|
|
22337
|
+
*/
|
|
22338
|
+
process(payload_json) {
|
|
22339
|
+
const ptr0 = passStringToWasm0(payload_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
22340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
22341
|
+
const ret = wasm.wasmengine_process(this.__wbg_ptr, ptr0, len0);
|
|
22342
|
+
return ret;
|
|
22343
|
+
}
|
|
22344
|
+
/**
|
|
22345
|
+
* Process a payload with step-by-step execution tracing.
|
|
22346
|
+
*
|
|
22347
|
+
* This is an async operation that returns a Promise with the execution trace.
|
|
22348
|
+
* The trace contains message snapshots after each step, including which
|
|
22349
|
+
* workflows/tasks were executed or skipped.
|
|
22350
|
+
*
|
|
22351
|
+
* # Arguments
|
|
22352
|
+
* * `payload_json` - JSON string of the payload to process
|
|
22353
|
+
*
|
|
22354
|
+
* # Returns
|
|
22355
|
+
* A Promise that resolves to the execution trace as a JSON string
|
|
22356
|
+
*
|
|
22357
|
+
* # Example
|
|
22358
|
+
* ```javascript
|
|
22359
|
+
* const payload = JSON.stringify({ name: "John", email: "john@example.com" });
|
|
22360
|
+
* const trace = await engine.process_with_trace(payload);
|
|
22361
|
+
* const traceData = JSON.parse(trace);
|
|
22362
|
+
* console.log(traceData.steps); // Array of execution steps
|
|
22363
|
+
* ```
|
|
22364
|
+
* @param {string} payload_json
|
|
22365
|
+
* @returns {Promise<any>}
|
|
22366
|
+
*/
|
|
22367
|
+
process_with_trace(payload_json) {
|
|
22368
|
+
const ptr0 = passStringToWasm0(payload_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
22369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
22370
|
+
const ret = wasm.wasmengine_process_with_trace(this.__wbg_ptr, ptr0, len0);
|
|
22371
|
+
return ret;
|
|
22372
|
+
}
|
|
22373
|
+
/**
|
|
22374
|
+
* Get the number of workflows registered in the engine.
|
|
22375
|
+
* @returns {number}
|
|
22376
|
+
*/
|
|
22377
|
+
workflow_count() {
|
|
22378
|
+
const ret = wasm.wasmengine_workflow_count(this.__wbg_ptr);
|
|
22379
|
+
return ret >>> 0;
|
|
22380
|
+
}
|
|
22381
|
+
/**
|
|
22382
|
+
* Get the list of workflow IDs.
|
|
22383
|
+
*
|
|
22384
|
+
* # Returns
|
|
22385
|
+
* JSON array of workflow IDs as a string
|
|
22386
|
+
* @returns {string}
|
|
22387
|
+
*/
|
|
22388
|
+
workflow_ids() {
|
|
22389
|
+
let deferred1_0;
|
|
22390
|
+
let deferred1_1;
|
|
22391
|
+
try {
|
|
22392
|
+
const ret = wasm.wasmengine_workflow_ids(this.__wbg_ptr);
|
|
22393
|
+
deferred1_0 = ret[0];
|
|
22394
|
+
deferred1_1 = ret[1];
|
|
22395
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
22396
|
+
} finally {
|
|
22397
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
22398
|
+
}
|
|
22399
|
+
}
|
|
22400
|
+
}
|
|
22401
|
+
if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
|
|
22402
|
+
const WasmEngineFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
22403
|
+
}, unregister: () => {
|
|
22404
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_wasmengine_free(ptr >>> 0, 1));
|
|
22405
|
+
typeof FinalizationRegistry === "undefined" ? {} : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
|
|
22406
|
+
function getStringFromWasm0(ptr, len) {
|
|
22407
|
+
ptr = ptr >>> 0;
|
|
22408
|
+
return decodeText(ptr, len);
|
|
22409
|
+
}
|
|
22410
|
+
let cachedUint8ArrayMemory0 = null;
|
|
22411
|
+
function getUint8ArrayMemory0() {
|
|
22412
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
22413
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
22414
|
+
}
|
|
22415
|
+
return cachedUint8ArrayMemory0;
|
|
22416
|
+
}
|
|
22417
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
22418
|
+
if (realloc === void 0) {
|
|
22419
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
22420
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
22421
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
22422
|
+
WASM_VECTOR_LEN = buf.length;
|
|
22423
|
+
return ptr2;
|
|
22424
|
+
}
|
|
22425
|
+
let len = arg.length;
|
|
22426
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
22427
|
+
const mem = getUint8ArrayMemory0();
|
|
22428
|
+
let offset = 0;
|
|
22429
|
+
for (; offset < len; offset++) {
|
|
22430
|
+
const code = arg.charCodeAt(offset);
|
|
22431
|
+
if (code > 127) break;
|
|
22432
|
+
mem[ptr + offset] = code;
|
|
22433
|
+
}
|
|
22434
|
+
if (offset !== len) {
|
|
22435
|
+
if (offset !== 0) {
|
|
22436
|
+
arg = arg.slice(offset);
|
|
22437
|
+
}
|
|
22438
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
22439
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
22440
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
22441
|
+
offset += ret.written;
|
|
22442
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
22443
|
+
}
|
|
22444
|
+
WASM_VECTOR_LEN = offset;
|
|
22445
|
+
return ptr;
|
|
22446
|
+
}
|
|
22447
|
+
function takeFromExternrefTable0(idx) {
|
|
22448
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
22449
|
+
wasm.__externref_table_dealloc(idx);
|
|
22450
|
+
return value;
|
|
22451
|
+
}
|
|
22452
|
+
let cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
22453
|
+
cachedTextDecoder.decode();
|
|
22454
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
22455
|
+
let numBytesDecoded = 0;
|
|
22456
|
+
function decodeText(ptr, len) {
|
|
22457
|
+
numBytesDecoded += len;
|
|
22458
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
22459
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
22460
|
+
cachedTextDecoder.decode();
|
|
22461
|
+
numBytesDecoded = len;
|
|
22462
|
+
}
|
|
22463
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
22464
|
+
}
|
|
22465
|
+
const cachedTextEncoder = new TextEncoder();
|
|
22466
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
22467
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
22468
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
22469
|
+
view.set(buf);
|
|
22470
|
+
return {
|
|
22471
|
+
read: arg.length,
|
|
22472
|
+
written: buf.length
|
|
22473
|
+
};
|
|
22474
|
+
};
|
|
22475
|
+
}
|
|
22476
|
+
let WASM_VECTOR_LEN = 0;
|
|
22477
|
+
let wasm;
|
|
22478
|
+
class WasmEngineAdapter {
|
|
22479
|
+
constructor(workflows) {
|
|
22480
|
+
__publicField(this, "engine");
|
|
22481
|
+
const workflowsJson = JSON.stringify(workflows);
|
|
22482
|
+
this.engine = new WasmEngine(workflowsJson);
|
|
22483
|
+
}
|
|
22484
|
+
async processWithTrace(payload) {
|
|
22485
|
+
const payloadJson = JSON.stringify(payload);
|
|
22486
|
+
const traceJson = await this.engine.process_with_trace(payloadJson);
|
|
22487
|
+
return JSON.parse(traceJson);
|
|
22488
|
+
}
|
|
22489
|
+
dispose() {
|
|
22490
|
+
this.engine.free();
|
|
22491
|
+
}
|
|
22492
|
+
}
|
|
22493
|
+
const defaultEngineFactory = (workflows) => new WasmEngineAdapter(workflows);
|
|
22026
22494
|
exports.ConditionBadge = ConditionBadge;
|
|
22027
22495
|
exports.DebugInfoBubble = DebugInfoBubble;
|
|
22028
22496
|
exports.DebugStateBadge = DebugStateBadge;
|
|
@@ -22038,11 +22506,13 @@ exports.SearchInput = SearchInput;
|
|
|
22038
22506
|
exports.TaskRow = TaskRow;
|
|
22039
22507
|
exports.ThemeProvider = ThemeProvider;
|
|
22040
22508
|
exports.TreeView = TreeView;
|
|
22509
|
+
exports.WasmEngineAdapter = WasmEngineAdapter;
|
|
22041
22510
|
exports.WorkflowCard = WorkflowCard;
|
|
22042
22511
|
exports.WorkflowFlowView = WorkflowFlowView;
|
|
22043
22512
|
exports.WorkflowVisualizer = WorkflowVisualizer;
|
|
22044
22513
|
exports.cloneMessage = cloneMessage;
|
|
22045
22514
|
exports.createEmptyMessage = createEmptyMessage;
|
|
22515
|
+
exports.defaultEngineFactory = defaultEngineFactory;
|
|
22046
22516
|
exports.getChangesAtStep = getChangesAtStep;
|
|
22047
22517
|
exports.getFunctionDisplayInfo = getFunctionDisplayInfo;
|
|
22048
22518
|
exports.getMessageAtStep = getMessageAtStep;
|