@code0-tech/pictor 0.0.0-mvp.29 → 0.0.0-mvp.30
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/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/react-contenteditable.js +7 -0
- package/dist/_virtual/react-contenteditable2.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
- package/dist/_virtual/react-dom-server.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server.browser.production.js +4 -0
- package/dist/_virtual/react-is.development.js +4 -0
- package/dist/_virtual/react-is.production.min.js +4 -0
- package/dist/_virtual/server.browser.js +5 -0
- package/dist/_virtual/server.browser2.js +4 -0
- package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
- package/dist/assets/components/form/Input.style.css +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +12 -12
- package/dist/components/button-group/ButtonGroup.js +12 -12
- package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
- package/dist/components/d-flow/DFlow.js +304 -268
- package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
- package/dist/components/d-flow/DFlow.service.d.ts +3 -2
- package/dist/components/d-flow/DFlow.service.js +62 -47
- package/dist/components/d-flow/DFlow.util.d.ts +4 -0
- package/dist/components/d-flow/DFlow.util.js +63 -0
- package/dist/components/d-flow/DFlowEdge.js +34 -34
- package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
- package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
- package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
- package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
- package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
- package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
- package/dist/components/d-flow-file/DFlowTabs.js +26 -27
- package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
- package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
- package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
- package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
- package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
- package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
- package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
- package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
- package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
- package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
- package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
- package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
- package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
- package/dist/components/d-flow-panel/DFlowExport.js +1 -1
- package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
- package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
- package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
- package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
- package/dist/components/d-flow-type/DFlowType.view.js +22 -12
- package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
- package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
- package/dist/components/d-resizable/DResizable.d.ts +4 -4
- package/dist/components/d-resizable/DResizable.js +22 -21
- package/dist/components/d-user/DUserInput.js +23 -21
- package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
- package/dist/components/file-tabs/FileTabs.service.js +49 -53
- package/dist/components/form/EmailInput.js +9 -9
- package/dist/components/form/Input.d.ts +2 -1
- package/dist/components/form/Input.js +294 -397
- package/dist/components/form/Input.syntax.hook.d.ts +1 -18
- package/dist/components/form/Input.syntax.hook.js +7 -73
- package/dist/components/form/Input.utils.d.ts +1 -2
- package/dist/components/form/Input.utils.js +26 -21
- package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
- package/dist/components/form/InputContentEditable.hook.js +471 -0
- package/dist/components/form/InputSuggestion.d.ts +2 -2
- package/dist/components/form/InputSuggestion.js +169 -107
- package/dist/components/form/PasswordInput.js +8 -8
- package/dist/components/form/TextInput.js +11 -11
- package/dist/components/form/useForm.d.ts +1 -0
- package/dist/components/form/useForm.js +45 -60
- package/dist/components/menu/Menu.js +4 -4
- package/dist/index.js +155 -154
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
- package/dist/node_modules/fast-deep-equal/index.js +31 -0
- package/dist/node_modules/object-assign/index.js +49 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
- package/dist/node_modules/prop-types/index.js +17 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
- package/dist/node_modules/prop-types/lib/has.js +7 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
- package/dist/node_modules/react-dom/server.browser.js +15 -0
- package/dist/utils/generics.d.ts +2 -0
- package/dist/utils/generics.js +93 -80
- package/dist/utils/index.js +22 -21
- package/dist/utils/inspection.d.ts +4 -2
- package/dist/utils/inspection.js +27 -2
- package/package.json +10 -8
- package/dist/components/form/Input.selection.hook.d.ts +0 -17
- package/dist/components/form/Input.selection.hook.js +0 -78
- package/dist/components/form/InputSyntax.d.ts +0 -19
- package/dist/components/form/InputSyntax.js +0 -52
- package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
- package/dist/components/form/inputSyntaxMapping.js +0 -42
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import S from "react";
|
|
3
|
+
import "../../_virtual/compiler-runtime.js";
|
|
4
|
+
import "@radix-ui/react-checkbox";
|
|
5
|
+
import "merge-props";
|
|
6
|
+
import "@tabler/icons-react";
|
|
7
|
+
import '../../assets/components/form/Input.style.css';/* empty css */
|
|
8
|
+
import "../form/EmailInput.js";
|
|
9
|
+
import "../form/Input.js";
|
|
10
|
+
import "../form/InputSuggestion.js";
|
|
11
|
+
import "../form/NumberInput.js";
|
|
12
|
+
import "../form/PasswordInput.js";
|
|
13
|
+
import "@radix-ui/react-one-time-password-field";
|
|
14
|
+
import "@radix-ui/react-radio-group";
|
|
15
|
+
import "../form/SwitchInput.js";
|
|
16
|
+
import { TextInput as B } from "../form/TextInput.js";
|
|
17
|
+
import { MenuItem as D } from "../menu/Menu.js";
|
|
18
|
+
import { Text as b } from "../text/Text.js";
|
|
19
|
+
import { DFlowSuggestionMenuFooter as T } from "../d-flow-suggestion/DFlowSuggestionMenuFooter.js";
|
|
20
|
+
import { toInputSuggestions as x } from "../d-flow-suggestion/DFlowSuggestionMenu.util.js";
|
|
21
|
+
import { useService as a } from "../../utils/contextStore.js";
|
|
22
|
+
import { DFlowFunctionReactiveService as O } from "../d-flow-function/DFlowFunction.service.js";
|
|
23
|
+
import "js-md5";
|
|
24
|
+
import "../d-flow/DFlow.js";
|
|
25
|
+
import { DFlowReactiveService as h } from "../d-flow/DFlow.service.js";
|
|
26
|
+
import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
|
|
27
|
+
import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
|
|
28
|
+
import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
|
|
29
|
+
import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
|
|
30
|
+
import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
|
|
31
|
+
import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
|
|
32
|
+
import { useSuggestions as R } from "../d-flow-suggestion/DFlowSuggestion.hook.js";
|
|
33
|
+
import { DFlowInputNodeBadge as j } from "./DFlowInputNodeBadge.js";
|
|
34
|
+
import { DFlowInputReferenceBadge as L } from "./DFlowInputReferenceBadge.js";
|
|
35
|
+
import { DFlowTypeReactiveService as $ } from "../d-flow-type/DFlowType.service.js";
|
|
36
|
+
const k = (g) => {
|
|
37
|
+
const o = [];
|
|
38
|
+
let p = "", m = "", n = 0, s = "", r = !1;
|
|
39
|
+
const f = () => {
|
|
40
|
+
p && o.push(p), p = "";
|
|
41
|
+
}, d = (e) => {
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(e);
|
|
44
|
+
} catch {
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(e.replace(/'/g, '"').replace(/([{,]\s*)([A-Za-z_$][\w$]*)(\s*:)/g, '$1"$2"$3'));
|
|
47
|
+
} catch {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return g.split("").forEach((e) => {
|
|
53
|
+
if (n > 0) {
|
|
54
|
+
if (m += e, r) {
|
|
55
|
+
r = !1;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (e === "\\") {
|
|
59
|
+
r = !0;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (s) {
|
|
63
|
+
e === s && (s = "");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (e === '"' || e === "'") {
|
|
67
|
+
s = e;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
e === "{" && n++, e === "}" && n--, n === 0 && (o.push(d(m)), m = "");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (e === "{") {
|
|
74
|
+
f(), n = 1, m = "{";
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
p += e;
|
|
78
|
+
}), f(), o;
|
|
79
|
+
}, at = (g) => {
|
|
80
|
+
const {
|
|
81
|
+
flowId: o,
|
|
82
|
+
nodeId: p,
|
|
83
|
+
parameterId: m,
|
|
84
|
+
...n
|
|
85
|
+
} = g, s = a(O), r = a(h), f = a($), d = S.useMemo(() => r.getById(o), [r, o]), e = n.suggestions || R(o, p, m), I = S.useCallback((F) => {
|
|
86
|
+
const w = String(F ?? "");
|
|
87
|
+
let u = 0;
|
|
88
|
+
const l = (t) => {
|
|
89
|
+
const i = {
|
|
90
|
+
type: "text",
|
|
91
|
+
value: t,
|
|
92
|
+
start: u,
|
|
93
|
+
end: u + t.length,
|
|
94
|
+
visualLength: t.length,
|
|
95
|
+
content: t
|
|
96
|
+
};
|
|
97
|
+
return u += t.length, i;
|
|
98
|
+
}, y = (t, i) => {
|
|
99
|
+
const N = {
|
|
100
|
+
type: "block",
|
|
101
|
+
value: i,
|
|
102
|
+
start: u,
|
|
103
|
+
end: u + JSON.stringify(i).length,
|
|
104
|
+
visualLength: 1,
|
|
105
|
+
content: t
|
|
106
|
+
};
|
|
107
|
+
return u += JSON.stringify(i).length, N;
|
|
108
|
+
};
|
|
109
|
+
return k(w).map((t) => {
|
|
110
|
+
if (typeof t != "object")
|
|
111
|
+
return l(t);
|
|
112
|
+
if (t?.__typename === "NodeFunctionIdWrapper" || t?.__typename === "NodeFunction") {
|
|
113
|
+
const i = t?.__typename === "NodeFunction" ? t : r.getNodeById(o, t.id);
|
|
114
|
+
return y(/* @__PURE__ */ c(j, { value: t, flowId: o, definition: s.getById(i?.functionDefinition.id) }), t);
|
|
115
|
+
}
|
|
116
|
+
if (t?.__typename === "ReferenceValue") {
|
|
117
|
+
const i = t.nodeFunctionId === "gid://sagittarius/NodeFunction/-1" ? f.getById(d?.type?.id) : s.getById(r.getNodeById(o, t.nodeFunctionId)?.functionDefinition?.id);
|
|
118
|
+
return y(/* @__PURE__ */ c(L, { flowId: o, definition: i, value: t }), t);
|
|
119
|
+
}
|
|
120
|
+
return t?.__typename === "LiteralValue" ? l(t.value) : l(t);
|
|
121
|
+
});
|
|
122
|
+
}, [s, r]);
|
|
123
|
+
return /* @__PURE__ */ c(B, { suggestionsEmptyState: /* @__PURE__ */ c(D, { children: /* @__PURE__ */ c(b, { children: "No suggestion found" }) }), suggestionsFooter: /* @__PURE__ */ c(T, {}), filterSuggestionsByLastToken: !0, enforceUniqueSuggestions: !0, validationUsesSyntax: !0, transformSyntax: I, suggestions: n.suggestions ? n.suggestions : x(e), ...n });
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
at as DFlowInputDefault,
|
|
127
|
+
k as splitTextAndObjects
|
|
128
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BadgeType } from '../badge/Badge';
|
|
3
|
+
import { LiteralValue } from '@code0-tech/sagittarius-graphql-types';
|
|
4
|
+
export interface DFlowInputLiteralBadgeProps extends Omit<BadgeType, 'value' | 'children'> {
|
|
5
|
+
value: LiteralValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const DFlowInputLiteralBadge: React.FC<DFlowInputLiteralBadgeProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as n } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { Badge as a } from "../badge/Badge.js";
|
|
4
|
+
import { Text as f } from "../text/Text.js";
|
|
5
|
+
const x = (m) => {
|
|
6
|
+
const e = n.c(9);
|
|
7
|
+
let t, r;
|
|
8
|
+
e[0] !== m ? ({
|
|
9
|
+
value: r,
|
|
10
|
+
...t
|
|
11
|
+
} = m, e[0] = m, e[1] = t, e[2] = r) : (t = e[1], r = e[2]);
|
|
12
|
+
let i;
|
|
13
|
+
e[3] === Symbol.for("react.memo_cache_sentinel") ? (i = {
|
|
14
|
+
verticalAlign: "middle"
|
|
15
|
+
}, e[3] = i) : i = e[3];
|
|
16
|
+
const c = String(r.value);
|
|
17
|
+
let l;
|
|
18
|
+
e[4] !== c ? (l = /* @__PURE__ */ s(f, { size: "sm", children: c }), e[4] = c, e[5] = l) : l = e[5];
|
|
19
|
+
let o;
|
|
20
|
+
return e[6] !== t || e[7] !== l ? (o = /* @__PURE__ */ s(a, { style: i, color: "secondary", ...t, children: l }), e[6] = t, e[7] = l, e[8] = o) : o = e[8], o;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
x as DFlowInputLiteralBadge
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BadgeType } from '../badge/Badge';
|
|
2
|
+
import { Flow, NodeFunction, NodeFunctionIdWrapper } from '@code0-tech/sagittarius-graphql-types';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
import { FunctionDefinitionView } from '../d-flow-function';
|
|
5
|
+
import { FlowTypeView } from '../d-flow-type';
|
|
6
|
+
export interface DFlowInputNodeBadgeProps extends Omit<BadgeType, 'value' | 'children'> {
|
|
7
|
+
value: NodeFunction | NodeFunctionIdWrapper;
|
|
8
|
+
flowId: Flow['id'];
|
|
9
|
+
definition?: FunctionDefinitionView | FlowTypeView;
|
|
10
|
+
}
|
|
11
|
+
export declare const DFlowInputNodeBadge: React.FC<DFlowInputNodeBadgeProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as B, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as T } from "../badge/Badge.js";
|
|
3
|
+
import p from "react";
|
|
4
|
+
import { IconBolt as N, IconNote as _ } from "@tabler/icons-react";
|
|
5
|
+
import { Text as h } from "../text/Text.js";
|
|
6
|
+
import { useService as n, useStore as c } from "../../utils/contextStore.js";
|
|
7
|
+
import "merge-props";
|
|
8
|
+
import { DFlowFunctionReactiveService as f } from "../d-flow-function/DFlowFunction.service.js";
|
|
9
|
+
import { hashToColor as D } from "../d-flow/DFlow.util.js";
|
|
10
|
+
import "../d-flow/DFlow.js";
|
|
11
|
+
import { DFlowReactiveService as d } from "../d-flow/DFlow.service.js";
|
|
12
|
+
import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
|
|
13
|
+
import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
|
|
14
|
+
import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
|
|
15
|
+
import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
|
|
16
|
+
import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
|
|
17
|
+
import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
|
|
18
|
+
import { DFlowTypeReactiveService as l } from "../d-flow-type/DFlowType.service.js";
|
|
19
|
+
import { FlowTypeView as x } from "../d-flow-type/DFlowType.view.js";
|
|
20
|
+
const Q = (u) => {
|
|
21
|
+
const {
|
|
22
|
+
value: e,
|
|
23
|
+
flowId: m,
|
|
24
|
+
definition: o,
|
|
25
|
+
...a
|
|
26
|
+
} = u, y = o || n(f), g = o || c(f), s = o || n(d), v = o || c(d), w = o || n(l), S = o || c(l), t = e.__typename === "NodeFunctionIdWrapper" && e.id === "gid://sagittarius/NodeFunction/-1", r = p.useMemo(() => {
|
|
27
|
+
if (t && !o) {
|
|
28
|
+
const I = s.getById(m);
|
|
29
|
+
return w.getById(I?.type?.id);
|
|
30
|
+
}
|
|
31
|
+
return e.__typename === "NodeFunction" || o ? e : s.getNodeById(m, e.id);
|
|
32
|
+
}, [v, S]), F = p.useMemo(() => o ? o.names?.[0]?.content : t && r instanceof x ? r.names?.[0]?.content : y.getById(r?.functionDefinition?.id)?.names?.[0]?.content, [g, r]);
|
|
33
|
+
return /* @__PURE__ */ B(T, { style: {
|
|
34
|
+
verticalAlign: "middle"
|
|
35
|
+
}, color: t ? "info" : D(e.id || ""), border: !0, ...a, children: [
|
|
36
|
+
t ? /* @__PURE__ */ i(N, { size: 12 }) : /* @__PURE__ */ i(_, { size: 12 }),
|
|
37
|
+
/* @__PURE__ */ i(h, { size: "sm", style: {
|
|
38
|
+
color: "inherit"
|
|
39
|
+
}, children: String(F) })
|
|
40
|
+
] });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
Q as DFlowInputNodeBadge
|
|
44
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BadgeType } from '../badge/Badge';
|
|
2
|
+
import { Flow, ReferenceValue } from '@code0-tech/sagittarius-graphql-types';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
import { FunctionDefinitionView } from '../d-flow-function';
|
|
5
|
+
import { FlowTypeView } from '../d-flow-type';
|
|
6
|
+
export interface DFlowInputReferenceBadge extends Omit<BadgeType, 'value' | 'children'> {
|
|
7
|
+
value: ReferenceValue;
|
|
8
|
+
flowId: Flow['id'];
|
|
9
|
+
definition?: FunctionDefinitionView | FlowTypeView;
|
|
10
|
+
}
|
|
11
|
+
export declare const DFlowInputReferenceBadge: React.FC<DFlowInputReferenceBadge>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as a } from "../badge/Badge.js";
|
|
3
|
+
import c from "react";
|
|
4
|
+
import { Text as m } from "../text/Text.js";
|
|
5
|
+
import { Flex as f } from "../flex/Flex.js";
|
|
6
|
+
import { DFlowInputNodeBadge as s } from "./DFlowInputNodeBadge.js";
|
|
7
|
+
import { IconVariable as u } from "@tabler/icons-react";
|
|
8
|
+
const w = (o) => {
|
|
9
|
+
const {
|
|
10
|
+
value: e,
|
|
11
|
+
flowId: t,
|
|
12
|
+
definition: p,
|
|
13
|
+
...d
|
|
14
|
+
} = o, l = c.useMemo(() => (console.log(e), e.nodeFunctionId && t ? /* @__PURE__ */ i(f, { align: "center", display: "inline-flex", children: [
|
|
15
|
+
/* @__PURE__ */ r(s, { definition: p, value: {
|
|
16
|
+
id: e.nodeFunctionId,
|
|
17
|
+
__typename: "NodeFunctionIdWrapper"
|
|
18
|
+
}, flowId: t }),
|
|
19
|
+
"inputTypeIdentifier" in e && e.inputTypeIdentifier ? "." + e.inputTypeIdentifier : "",
|
|
20
|
+
e.referencePath ? "." + (e.referencePath?.map((n) => n.path).join(".") ?? "") : ""
|
|
21
|
+
] }) : `{{ ${String(e.depth)}-${String(e.scope)}-${String(e.node)}-${e.referencePath?.map((n) => n.path).join(".") ?? ""} }}`), [e]);
|
|
22
|
+
return /* @__PURE__ */ i(a, { style: {
|
|
23
|
+
verticalAlign: "middle"
|
|
24
|
+
}, color: "warning", py: "0", border: !0, ...d, children: [
|
|
25
|
+
/* @__PURE__ */ r(u, { size: 12 }),
|
|
26
|
+
/* @__PURE__ */ r(m, { size: "sm", style: {
|
|
27
|
+
color: "inherit"
|
|
28
|
+
}, children: l })
|
|
29
|
+
] });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
w as DFlowInputReferenceBadge
|
|
33
|
+
};
|
|
@@ -5,13 +5,13 @@ import { useService as w, useStore as b } from "../../utils/contextStore.js";
|
|
|
5
5
|
import "merge-props";
|
|
6
6
|
import "../d-flow/DFlow.js";
|
|
7
7
|
import { DFlowReactiveService as m } from "../d-flow/DFlow.service.js";
|
|
8
|
+
import "js-md5";
|
|
8
9
|
import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
|
|
9
10
|
import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
|
|
10
11
|
import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
|
|
11
12
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
|
|
12
13
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
|
|
13
14
|
import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
|
|
14
|
-
import "js-md5";
|
|
15
15
|
import { Button as x } from "../button/Button.js";
|
|
16
16
|
const F = (p) => {
|
|
17
17
|
const {
|
|
@@ -6,13 +6,13 @@ import "../../utils/contextStore.js";
|
|
|
6
6
|
import "react";
|
|
7
7
|
import "merge-props";
|
|
8
8
|
import { FLOW_EDGE_RAINBOW as p } from "../d-flow/DFlow.edges.hook.js";
|
|
9
|
+
import "js-md5";
|
|
9
10
|
import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
|
|
10
11
|
import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
|
|
11
12
|
import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
|
|
12
13
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
|
|
13
14
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
|
|
14
15
|
import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
|
|
15
|
-
import "js-md5";
|
|
16
16
|
import '../../assets/components/d-flow-panel/DFlowMiniMap.style.css';/* empty css */
|
|
17
17
|
const F = (c) => {
|
|
18
18
|
const i = a.c(2), m = d();
|
|
@@ -1,70 +1,72 @@
|
|
|
1
1
|
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import l from "react";
|
|
3
|
-
import { ButtonGroup as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { IconTrash as
|
|
6
|
-
import { Panel as
|
|
7
|
-
import { useService as
|
|
3
|
+
import { ButtonGroup as k } from "../button-group/ButtonGroup.js";
|
|
4
|
+
import { Button as s } from "../button/Button.js";
|
|
5
|
+
import { IconTrash as F, IconPlus as z } from "@tabler/icons-react";
|
|
6
|
+
import { Panel as P } from "@xyflow/react";
|
|
7
|
+
import { useService as f, useStore as u } from "../../utils/contextStore.js";
|
|
8
8
|
import "merge-props";
|
|
9
|
-
import { FileTabsService as
|
|
9
|
+
import { FileTabsService as h } from "../file-tabs/FileTabs.service.js";
|
|
10
10
|
import "../d-flow/DFlow.js";
|
|
11
|
-
import { DFlowReactiveService as
|
|
11
|
+
import { DFlowReactiveService as w } from "../d-flow/DFlow.service.js";
|
|
12
|
+
import "js-md5";
|
|
12
13
|
import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
|
|
13
14
|
import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
|
|
14
15
|
import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
|
|
15
16
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
|
|
16
17
|
import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
|
|
17
18
|
import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
|
|
18
|
-
import "js
|
|
19
|
-
import { Tooltip as f, TooltipTrigger as h, TooltipPortal as v, TooltipContent as T, TooltipArrow as x } from "../tooltip/Tooltip.js";
|
|
19
|
+
import { Tooltip as S, TooltipTrigger as T, TooltipPortal as v, TooltipContent as x, TooltipArrow as g } from "../tooltip/Tooltip.js";
|
|
20
20
|
import { Text as d } from "../text/Text.js";
|
|
21
|
-
import { Badge as
|
|
22
|
-
import { DFlowSuggestionMenu as
|
|
23
|
-
import { useSuggestions as
|
|
24
|
-
const
|
|
21
|
+
import { Badge as y } from "../badge/Badge.js";
|
|
22
|
+
import { DFlowSuggestionMenu as _ } from "../d-flow-suggestion/DFlowSuggestionMenu.js";
|
|
23
|
+
import { useSuggestions as D } from "../d-flow-suggestion/DFlowSuggestion.hook.js";
|
|
24
|
+
const ro = (N) => {
|
|
25
25
|
const {
|
|
26
26
|
flowId: r
|
|
27
|
-
} =
|
|
28
|
-
e &&
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
} = N, a = f(h), p = u(h), i = f(w), b = u(w), [, c] = l.useTransition(), e = l.useMemo(() => p.find((n) => n.active), [p, a]), I = D(r, e?.content?.props?.node?.id), B = l.useCallback(() => {
|
|
28
|
+
e && e.content.props.flowId && c(async () => {
|
|
29
|
+
i.getLinkedNodesById(r, e.content.props.node.id).forEach((m) => {
|
|
30
|
+
m.id && a.deleteById(m.id);
|
|
31
|
+
}), await i.deleteNodeById(e.content.props.flowId, e.content.props.node.id);
|
|
32
|
+
});
|
|
33
|
+
}, [e, i, b]), C = l.useCallback((n) => {
|
|
32
34
|
r && n.value.__typename === "NodeFunction" && "node" in e.content.props ? c(async () => {
|
|
33
35
|
await i.addNextNodeById(r, e.content.props.node.id ?? void 0, n.value);
|
|
34
36
|
}) : c(async () => {
|
|
35
37
|
await i.addNextNodeById(r, null, n.value);
|
|
36
38
|
});
|
|
37
39
|
}, [r, i, e]);
|
|
38
|
-
return /* @__PURE__ */ o(
|
|
39
|
-
/* @__PURE__ */ t(
|
|
40
|
-
/* @__PURE__ */ o(
|
|
41
|
-
/* @__PURE__ */ o(v, { children: /* @__PURE__ */ t(
|
|
40
|
+
return /* @__PURE__ */ o(P, { position: "bottom-center", children: /* @__PURE__ */ t(k, { children: [
|
|
41
|
+
/* @__PURE__ */ t(S, { children: [
|
|
42
|
+
/* @__PURE__ */ o(T, { asChild: !0, children: /* @__PURE__ */ o(s, { color: "info", paddingSize: "xxs", variant: "none", "aria-selected": !0, children: "Execute flow" }) }),
|
|
43
|
+
/* @__PURE__ */ o(v, { children: /* @__PURE__ */ t(x, { maw: "300px", children: [
|
|
42
44
|
/* @__PURE__ */ t(d, { children: [
|
|
43
45
|
"To execute this flow you can call the following endpoint ",
|
|
44
46
|
" ",
|
|
45
47
|
" ",
|
|
46
48
|
/* @__PURE__ */ o("br", {}),
|
|
47
|
-
/* @__PURE__ */ o(
|
|
48
|
-
/* @__PURE__ */ o(
|
|
49
|
+
/* @__PURE__ */ o(y, { children: /* @__PURE__ */ o(d, { children: "POST" }) }),
|
|
50
|
+
/* @__PURE__ */ o(y, { color: "info", border: !0, children: /* @__PURE__ */ o(d, { style: {
|
|
49
51
|
color: "inherit"
|
|
50
52
|
}, children: "localhost:6212/72hsa13/users/get" }) })
|
|
51
53
|
] }),
|
|
52
|
-
/* @__PURE__ */ o(
|
|
54
|
+
/* @__PURE__ */ o(g, {})
|
|
53
55
|
] }) })
|
|
54
56
|
] }),
|
|
55
|
-
/* @__PURE__ */ t(
|
|
56
|
-
/* @__PURE__ */ o(
|
|
57
|
-
/* @__PURE__ */ o(v, { children: /* @__PURE__ */ t(
|
|
57
|
+
/* @__PURE__ */ t(S, { children: [
|
|
58
|
+
/* @__PURE__ */ o(T, { asChild: !0, children: /* @__PURE__ */ o(s, { disabled: !e || !e.content.props.flowId, onClick: B, paddingSize: "xxs", variant: "none", color: "primary", children: /* @__PURE__ */ o(F, { size: 16 }) }) }),
|
|
59
|
+
/* @__PURE__ */ o(v, { children: /* @__PURE__ */ t(x, { children: [
|
|
58
60
|
/* @__PURE__ */ o(d, { children: "Select a node to delete it" }),
|
|
59
|
-
/* @__PURE__ */ o(
|
|
61
|
+
/* @__PURE__ */ o(g, {})
|
|
60
62
|
] }) })
|
|
61
63
|
] }),
|
|
62
|
-
/* @__PURE__ */ o(
|
|
63
|
-
/* @__PURE__ */ o(
|
|
64
|
+
/* @__PURE__ */ o(_, { suggestions: I, onSuggestionSelect: C, triggerContent: /* @__PURE__ */ t(s, { disabled: !e, paddingSize: "xxs", variant: "none", color: "primary", children: [
|
|
65
|
+
/* @__PURE__ */ o(z, { size: 16 }),
|
|
64
66
|
"Next node"
|
|
65
67
|
] }) })
|
|
66
68
|
] }) });
|
|
67
69
|
};
|
|
68
70
|
export {
|
|
69
|
-
|
|
71
|
+
ro as DFlowPanelControl
|
|
70
72
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as s } from "../../_virtual/compiler-runtime.js";
|
|
2
|
+
import { useService as c, useStore as n } from "../../utils/contextStore.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "merge-props";
|
|
5
|
+
import { DFlowDataTypeReactiveService as p } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
6
|
+
import "js-md5";
|
|
7
|
+
import { DFlowSuggestionType as l } from "./DFlowSuggestion.view.js";
|
|
8
|
+
const _ = (t) => {
|
|
9
|
+
const e = s.c(3), o = c(p);
|
|
10
|
+
n(p);
|
|
11
|
+
const m = t ? o?.getDataType(t) : void 0;
|
|
12
|
+
let a;
|
|
13
|
+
e: {
|
|
14
|
+
if (!m || m.variant !== "DATA_TYPE") {
|
|
15
|
+
let i;
|
|
16
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = [], e[0] = i) : i = e[0], a = i;
|
|
17
|
+
break e;
|
|
18
|
+
}
|
|
19
|
+
let r;
|
|
20
|
+
e[1] !== o ? (r = o.values().map(u), e[1] = o, e[2] = r) : r = e[2], a = r;
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
function u(t) {
|
|
25
|
+
return {
|
|
26
|
+
path: [],
|
|
27
|
+
type: l.DATA_TYPE,
|
|
28
|
+
displayText: [t.name[0]?.content],
|
|
29
|
+
value: t.json
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
_ as useDataTypeSuggestions
|
|
34
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import s from "react";
|
|
2
|
+
import { useService as F, useStore as v } from "../../utils/contextStore.js";
|
|
3
|
+
import "merge-props";
|
|
4
|
+
import { DFlowDataTypeReactiveService as g } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
5
|
+
import "js-md5";
|
|
6
|
+
import { DFlowSuggestionType as A } from "./DFlowSuggestion.view.js";
|
|
7
|
+
import { DFlowFunctionReactiveService as S } from "../d-flow-function/DFlowFunction.service.js";
|
|
8
|
+
import { replaceGenericsAndSortType as f, resolveType as d, isMatchingType as M } from "../../utils/generics.js";
|
|
9
|
+
const P = (t, u = []) => {
|
|
10
|
+
const r = F(g), c = F(S), m = v(g), y = v(S), p = s.useMemo(() => t ? r?.getDataType(t) : void 0, [t, r, m]), i = s.useMemo(() => t ? f(d(t, r), u) : void 0, [t, r, m, u]);
|
|
11
|
+
return s.useMemo(() => c.values().filter((e) => {
|
|
12
|
+
if (!t || !i) return !0;
|
|
13
|
+
if (e.runtimeFunctionDefinition?.identifier == "std::control::return" && t) return !1;
|
|
14
|
+
if (p?.variant === "NODE") return !0;
|
|
15
|
+
if (!e.returnType || !e.genericKeys) return !1;
|
|
16
|
+
const o = f(d(e.returnType, r), e.genericKeys);
|
|
17
|
+
return M(i, o);
|
|
18
|
+
}).sort((e, o) => {
|
|
19
|
+
const [n, T, C] = e.runtimeFunctionDefinition.identifier.split("::"), [D, N, h] = o.runtimeFunctionDefinition.identifier.split("::"), a = n.localeCompare(D);
|
|
20
|
+
if (a !== 0) return a;
|
|
21
|
+
const l = T.localeCompare(N);
|
|
22
|
+
return l !== 0 ? l : C.localeCompare(h);
|
|
23
|
+
}).map((e) => {
|
|
24
|
+
const o = {
|
|
25
|
+
__typename: "NodeFunction",
|
|
26
|
+
id: "gid://sagittarius/NodeFunction/1",
|
|
27
|
+
functionDefinition: {
|
|
28
|
+
id: e.id,
|
|
29
|
+
runtimeFunctionDefinition: e.runtimeFunctionDefinition
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
nodes: e.parameterDefinitions?.map((n) => ({
|
|
33
|
+
id: n.id,
|
|
34
|
+
runtimeParameter: {
|
|
35
|
+
id: n.id
|
|
36
|
+
}
|
|
37
|
+
})) ?? []
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
path: [],
|
|
42
|
+
type: A.FUNCTION,
|
|
43
|
+
displayText: [e.names[0]?.content],
|
|
44
|
+
value: o
|
|
45
|
+
};
|
|
46
|
+
}), [p, t, r, c, y, i]);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
P as useFunctionSuggestions
|
|
50
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DFlowSuggestion } from './DFlowSuggestion.view';
|
|
2
|
+
import { DataTypeIdentifier, Flow, NodeFunction } from '@code0-tech/sagittarius-graphql-types';
|
|
3
|
+
export declare const useReferenceSuggestions: (flowId: Flow["id"], nodeId?: NodeFunction["id"], dataTypeIdentifier?: DataTypeIdentifier, genericKeys?: string[]) => DFlowSuggestion[];
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import l from "react";
|
|
2
|
+
import { useService as F, useStore as N } from "../../utils/contextStore.js";
|
|
3
|
+
import "merge-props";
|
|
4
|
+
import { DFlowDataTypeReactiveService as h } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
5
|
+
import "js-md5";
|
|
6
|
+
import { DFlowSuggestionType as $ } from "./DFlowSuggestion.view.js";
|
|
7
|
+
import { replaceGenericsAndSortType as W, resolveType as C, isMatchingType as K, resolveGenericKeys as V, targetForGenericKey as A, replaceGenericKeysInType as Y } from "../../utils/generics.js";
|
|
8
|
+
import { DFlowFunctionReactiveService as E } from "../d-flow-function/DFlowFunction.service.js";
|
|
9
|
+
import "../d-flow/DFlow.js";
|
|
10
|
+
import { DFlowReactiveService as x } from "../d-flow/DFlow.service.js";
|
|
11
|
+
import { useReturnType as k } from "../d-flow-function/DFlowFunction.return.hook.js";
|
|
12
|
+
const oe = (n, t, o, m = []) => {
|
|
13
|
+
const y = F(h), r = N(h), v = F(x), g = N(x), M = P(n), D = l.useMemo(() => t ? M?.find((i) => i.nodeFunctionId === t) : void 0, [M, t]), a = l.useMemo(() => t ? v.getNodeById(n, t)?.parameters?.nodes?.map((s) => s?.value).filter((s) => s?.__typename === "NodeFunctionIdWrapper") ?? [] : [], [n, t, v, g]), u = l.useMemo(() => o ? W(C(o, y), m) : void 0, [o, y, r, m]), T = J(n);
|
|
14
|
+
return l.useMemo(() => {
|
|
15
|
+
if (!u || !D) return [];
|
|
16
|
+
const {
|
|
17
|
+
depth: i,
|
|
18
|
+
scope: s,
|
|
19
|
+
node: d
|
|
20
|
+
} = D;
|
|
21
|
+
return T.flatMap((e) => {
|
|
22
|
+
if (e.node === null || e.node === void 0) return [];
|
|
23
|
+
if (e.depth === null || e.depth === void 0) return [];
|
|
24
|
+
if (e.scope === null || e.scope === void 0) return [];
|
|
25
|
+
const c = e.parameterIndex !== void 0 && e.inputTypeIndex !== void 0, I = c ? e.scope?.every((f, B) => s?.[B] === f) : !0;
|
|
26
|
+
if (c && !I) return [];
|
|
27
|
+
if (a.some((f) => f.id === e.nodeFunctionId)) return [];
|
|
28
|
+
if (!c && e.node >= d) return [];
|
|
29
|
+
if (e.depth > i) return [];
|
|
30
|
+
if (e.scope.some((f) => !s.includes(f))) return [];
|
|
31
|
+
const R = W(C(e.dataTypeIdentifier, y), []);
|
|
32
|
+
return K(u, R) ? [{
|
|
33
|
+
path: [],
|
|
34
|
+
type: $.REF_OBJECT,
|
|
35
|
+
displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((f) => f.path).join(".") ?? ""}`],
|
|
36
|
+
value: e
|
|
37
|
+
}] : [];
|
|
38
|
+
});
|
|
39
|
+
}, [y, D, a, T, u]);
|
|
40
|
+
}, J = (n) => {
|
|
41
|
+
const t = F(h);
|
|
42
|
+
N(h);
|
|
43
|
+
const o = F(E), m = F(x), y = N(x), r = l.useMemo(() => m.getById(n), [n, y]), v = P(n), g = l.useMemo(() => r?.nodes?.nodes?.map((a) => {
|
|
44
|
+
const u = a?.parameters?.nodes?.map((d) => d?.value) ?? [], T = o.getById(a?.functionDefinition?.id), i = k(T, u, t), s = v?.find((d) => d.nodeFunctionId === a?.id);
|
|
45
|
+
return i && s ? w(s, i, t) : {};
|
|
46
|
+
}) ?? [], [r]), M = l.useMemo(() => w({
|
|
47
|
+
node: 0,
|
|
48
|
+
depth: 0,
|
|
49
|
+
nodeFunctionId: "gid://sagittarius/NodeFunction/-1",
|
|
50
|
+
scope: [0]
|
|
51
|
+
}, {
|
|
52
|
+
dataType: r?.inputType
|
|
53
|
+
}), [r]);
|
|
54
|
+
return [...l.useMemo(() => r?.nodes?.nodes?.length ? r.nodes.nodes.flatMap((a) => {
|
|
55
|
+
const u = o.getById(a?.functionDefinition?.id);
|
|
56
|
+
if (!u) return [];
|
|
57
|
+
const T = a?.parameters?.nodes?.map((i) => i?.value).filter(Boolean) ?? [];
|
|
58
|
+
return (u.parameterDefinitions ?? []).flatMap((i, s) => {
|
|
59
|
+
const d = i?.dataTypeIdentifier;
|
|
60
|
+
if (!d) return [];
|
|
61
|
+
const e = t.getDataType(d);
|
|
62
|
+
if (!e || e.variant !== "NODE") return [];
|
|
63
|
+
const c = a?.parameters?.nodes?.find((p) => p?.id === i?.id);
|
|
64
|
+
if (!c?.value || c.value.__typename !== "NodeFunctionIdWrapper") return [];
|
|
65
|
+
const I = v?.find((p) => c?.value?.__typename === "NodeFunctionIdWrapper" && p.nodeFunctionId === c.value?.id);
|
|
66
|
+
if (!I) return [];
|
|
67
|
+
const R = e.rules?.nodes?.filter((p) => p?.variant === "INPUT_TYPES") ?? [], f = V(u, T, t), B = A(u, d), S = new Map([...f].map(([p, G]) => [B.get(p) ?? p, G]));
|
|
68
|
+
return R.flatMap((p) => (p?.config?.inputTypes ?? []).flatMap((O, j) => {
|
|
69
|
+
const b = Y(O.dataTypeIdentifier, S);
|
|
70
|
+
return b ? w({
|
|
71
|
+
...I,
|
|
72
|
+
nodeFunctionId: a?.id,
|
|
73
|
+
parameterIndex: s,
|
|
74
|
+
inputTypeIndex: j,
|
|
75
|
+
inputTypeIdentifier: O.inputIdentifier
|
|
76
|
+
}, b, t) : [];
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
}) : [], [r, v, o, t]), ...M, ...g].flat();
|
|
80
|
+
}, w = (n, t, o) => {
|
|
81
|
+
const m = o ? o.getDataType(t) : t.dataType ?? t.genericType?.dataType;
|
|
82
|
+
return m ? [...m.rules?.nodes?.map((r) => {
|
|
83
|
+
if (r?.variant === "CONTAINS_KEY")
|
|
84
|
+
return t ? w({
|
|
85
|
+
...n,
|
|
86
|
+
referencePath: [...n.referencePath ?? [], {
|
|
87
|
+
path: r.config.key
|
|
88
|
+
}]
|
|
89
|
+
}, r.config.dataTypeIdentifier) : void 0;
|
|
90
|
+
}).flat().filter((r) => !!r) ?? [], {
|
|
91
|
+
__typename: "ReferenceValue",
|
|
92
|
+
dataTypeIdentifier: t,
|
|
93
|
+
nodeFunctionId: n.nodeFunctionId,
|
|
94
|
+
...n
|
|
95
|
+
}] : [];
|
|
96
|
+
}, P = (n) => {
|
|
97
|
+
const t = F(h), o = F(x), m = F(E), y = N(x), r = N(E), v = N(h), g = l.useMemo(() => o.getById(n), [n, y]);
|
|
98
|
+
return l.useMemo(() => {
|
|
99
|
+
if (!t || !o || !m || !g?.startingNodeId) return;
|
|
100
|
+
let M = 0;
|
|
101
|
+
const D = () => ++M;
|
|
102
|
+
let a = 0;
|
|
103
|
+
const u = () => ++a, T = [], i = (s, d, e) => {
|
|
104
|
+
if (!s) return;
|
|
105
|
+
let c = s.__typename === "NodeFunctionIdWrapper" ? o.getNodeById(n, s.id) : s;
|
|
106
|
+
for (; c; ) {
|
|
107
|
+
const I = m.getById(c.functionDefinition?.id);
|
|
108
|
+
if (!I) break;
|
|
109
|
+
if (c.parameters && I.parameterDefinitions)
|
|
110
|
+
for (const f of I.parameterDefinitions) {
|
|
111
|
+
const B = t.getDataType(f.dataTypeIdentifier), S = c.parameters?.nodes?.find((p) => p?.id === f.id);
|
|
112
|
+
if (B?.variant === "NODE") {
|
|
113
|
+
if (S?.value && S.value.__typename === "NodeFunctionIdWrapper") {
|
|
114
|
+
const p = [...e, D()];
|
|
115
|
+
i(S.value, d + 1, p);
|
|
116
|
+
}
|
|
117
|
+
} else S?.value && S.value.__typename === "NodeFunctionIdWrapper" && i(S.value, d, e);
|
|
118
|
+
}
|
|
119
|
+
const R = u();
|
|
120
|
+
T.push({
|
|
121
|
+
node: R,
|
|
122
|
+
depth: d,
|
|
123
|
+
scope: e,
|
|
124
|
+
nodeFunctionId: c.id
|
|
125
|
+
}), c = o.getNodeById(g.id, c.nextNodeId);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return i(o.getNodeById(g.id, g.startingNodeId), 0, [0]), T;
|
|
129
|
+
}, [t, g, n, o, m, v, y, r]) ?? [];
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
oe as useReferenceSuggestions
|
|
133
|
+
};
|