@w6w/embed 0.2.34 → 0.2.35
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/{CreateFunctionModal-glk2zg1r.js → CreateFunctionModal-CYNHJUGJ.js} +3 -3
- package/dist/{CreateFunctionModal-glk2zg1r.js.map → CreateFunctionModal-CYNHJUGJ.js.map} +1 -1
- package/dist/{DocumentFormModal-B3OkvI5v.js → DocumentFormModal-CLmdGx34.js} +2 -2
- package/dist/{DocumentFormModal-B3OkvI5v.js.map → DocumentFormModal-CLmdGx34.js.map} +1 -1
- package/dist/ImportSpecModal-BzEyiNWD.js +378 -0
- package/dist/ImportSpecModal-BzEyiNWD.js.map +1 -0
- package/dist/WorkflowEditor-CxTuK8_d.js +1272 -0
- package/dist/WorkflowEditor-CxTuK8_d.js.map +1 -0
- package/dist/{apps-CFWdgGst.js → apps-CyEszfIu.js} +33 -33
- package/dist/{apps-CFWdgGst.js.map → apps-CyEszfIu.js.map} +1 -1
- package/dist/callable-row-actions-BPBPflMn.js +56 -0
- package/dist/callable-row-actions-BPBPflMn.js.map +1 -0
- package/dist/callables-dLF2IcwA.js +317 -0
- package/dist/callables-dLF2IcwA.js.map +1 -0
- package/dist/chrome/TagEditor.d.ts +6 -1
- package/dist/chrome/workspace.d.ts +16 -0
- package/dist/documents-hgltn0xe.js +1017 -0
- package/dist/documents-hgltn0xe.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/WaitingForm.d.ts +19 -0
- package/dist/{editor-apps-ShwCmvLY.js → editor-apps-DsGrGKfe.js} +3 -3
- package/dist/{editor-apps-ShwCmvLY.js.map → editor-apps-DsGrGKfe.js.map} +1 -1
- package/dist/{editor-tools-rY9nddqr.js → editor-tools-Ct7YPPj8.js} +682 -784
- package/dist/editor-tools-Ct7YPPj8.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +18 -18
- package/dist/{endpoints-zOuwci2U.js → endpoints-DJxXRh-I.js} +12 -12
- package/dist/{endpoints-zOuwci2U.js.map → endpoints-DJxXRh-I.js.map} +1 -1
- package/dist/forms.mjs +1 -1
- package/dist/index.mjs +140 -115
- package/dist/index.mjs.map +1 -1
- package/dist/lib/callable-row-actions.d.ts +17 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/run-event-stream.d.ts +122 -0
- package/dist/lib/tag-editor.d.ts +6 -0
- package/dist/lib/workflow-live-run.d.ts +7 -0
- package/dist/lib/workflow-validity.d.ts +7 -1
- package/dist/lib.mjs +52 -47
- package/dist/lists/CallableKindList.d.ts +12 -0
- package/dist/lists/CallableRowParts.d.ts +8 -1
- package/dist/lists/EndpointList.d.ts +3 -0
- package/dist/lists/FunctionList.d.ts +3 -0
- package/dist/lists/WorkflowList.d.ts +3 -0
- package/dist/lists.d.ts +1 -0
- package/dist/lists.mjs +1589 -1513
- package/dist/lists.mjs.map +1 -1
- package/dist/rail.mjs +1 -1
- package/dist/repos/callables.d.ts +25 -0
- package/dist/repos/documents.d.ts +9 -1
- package/dist/repos/saved-file-names.d.ts +10 -0
- package/dist/repos/workflows.d.ts +19 -13
- package/dist/repos.mjs +333 -328
- package/dist/{setup-incomplete-BHs3Lpfy.js → setup-incomplete-6PAbN0EW.js} +50 -49
- package/dist/setup-incomplete-6PAbN0EW.js.map +1 -0
- package/dist/spec-import-BKyfhTYG.js +200 -0
- package/dist/spec-import-BKyfhTYG.js.map +1 -0
- package/dist/{use-callable-draft-w4tDTYcb.js → use-callable-draft-7HwfTuYQ.js} +3 -3
- package/dist/{use-callable-draft-w4tDTYcb.js.map → use-callable-draft-7HwfTuYQ.js.map} +1 -1
- package/package.json +3 -3
- package/src/styles.css +43 -0
- package/dist/ImportSpecModal-SQvTwtcX.js +0 -252
- package/dist/ImportSpecModal-SQvTwtcX.js.map +0 -1
- package/dist/WorkflowEditor-D2EfEP-U.js +0 -1201
- package/dist/WorkflowEditor-D2EfEP-U.js.map +0 -1
- package/dist/callable-record-Bhxim8C1.js +0 -14
- package/dist/callable-record-Bhxim8C1.js.map +0 -1
- package/dist/callables-B49tS2vv.js +0 -297
- package/dist/callables-B49tS2vv.js.map +0 -1
- package/dist/editor-tools-rY9nddqr.js.map +0 -1
- package/dist/setup-incomplete-BHs3Lpfy.js.map +0 -1
- package/dist/spec-import-CPbDnnuv.js +0 -272
- package/dist/spec-import-CPbDnnuv.js.map +0 -1
- package/dist/workflows-RhR8kwt7.js +0 -667
- package/dist/workflows-RhR8kwt7.js.map +0 -1
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
import { jsxs as b, jsx as a, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Wt, useQueries as Fe } from "@tanstack/react-query";
|
|
3
|
+
import { ApiError as Le } from "@w6w/sdk";
|
|
4
|
+
import { Modal as Cn, IconButton as fe, JsonEditor as An, useExpressionOptions as Pn, ExpressionEditorModal as On, useW6WApi as $t, W6WUIProvider as jn, isTestRequired as It, paramsValid as Tn, requiredParamsFilled as In, ExecutionLogDock as Fn, ExecutionLogView as Ln, testInputSavesSettled as Mn, StepStatusPill as Dn, formatDurationMs as Jn } from "@w6w/ui";
|
|
5
|
+
import { useState as w, useMemo as N, createElement as $, useId as xn, useCallback as O, useContext as Wn, useRef as k, useEffect as F, Suspense as $n, lazy as Bn } from "react";
|
|
6
|
+
import { E as Kn, aa as Qn, a5 as _n, _ as qn, a4 as Vn, x as Hn, a6 as zn, D as Gn, L as Yn, K as Un, X as Xn, b as Zn, J as es, s as ts, I as ns, B as ss, d as os } from "./documents-hgltn0xe.js";
|
|
7
|
+
import { H as is, a as rs } from "./editor-apps-DsGrGKfe.js";
|
|
8
|
+
import { M as pe } from "./ConfirmModal-WqBfWftD.js";
|
|
9
|
+
import { d as as, W as ls, e as cs, R as us, P as ds, b as fs, c as ps } from "./editor-tools-Ct7YPPj8.js";
|
|
10
|
+
import { u as hs } from "./client-context-CX61Bgw-.js";
|
|
11
|
+
import { u as ms } from "./use-workflow-draft-l3P5KZzw.js";
|
|
12
|
+
import { r as gs, h as bs, e as ys, f as vs, a as ws, d as Ss, b as ks, p as Ns, i as Rs, g as Es } from "./setup-incomplete-6PAbN0EW.js";
|
|
13
|
+
import { g as Ft, r as Cs, c as As, v as Ps } from "./document-sources-Khcw2zB5.js";
|
|
14
|
+
import { n as Lt } from "./import-bindings-EUtxZ9Ti.js";
|
|
15
|
+
import { p as Os, d as js } from "./settings-rail-gUU2ZbSw.js";
|
|
16
|
+
import { u as Ts, b as Is } from "./project-context-Tvp-La7A.js";
|
|
17
|
+
import { i as Fs, d as Mt } from "./connections-CzsCyIxY.js";
|
|
18
|
+
import { i as Ls, d as Ms, h as Ds, e as Js, f as xs } from "./spec-import-BKyfhTYG.js";
|
|
19
|
+
import { l as Dt, a as Me, w as Ws } from "./step-tests-B4E4W3ly.js";
|
|
20
|
+
import { u as $s } from "./spec-export-BtnoV0ex.js";
|
|
21
|
+
import { i as Bs, f as Ks } from "./vault-BSEWhMYC.js";
|
|
22
|
+
import { i as Qs } from "./data-stores-UeQvwVCa.js";
|
|
23
|
+
import { f as _s } from "./apps-CyEszfIu.js";
|
|
24
|
+
import { E as qs } from "./theme-context-E2ZhlXDX.js";
|
|
25
|
+
import { validateInitialState as Vs } from "@w6w/expr";
|
|
26
|
+
function Hs({ title: n }) {
|
|
27
|
+
const { value: e, placeholder: s, maxLength: o, ariaLabel: r, onChange: l, onBlur: u } = n;
|
|
28
|
+
return /* @__PURE__ */ a(
|
|
29
|
+
"input",
|
|
30
|
+
{
|
|
31
|
+
className: "wf-title-input",
|
|
32
|
+
value: e,
|
|
33
|
+
placeholder: s,
|
|
34
|
+
maxLength: o,
|
|
35
|
+
size: Math.min(Math.max(e.length, s.length), 80),
|
|
36
|
+
"aria-label": r,
|
|
37
|
+
onChange: (d) => l(d.target.value),
|
|
38
|
+
onBlur: u
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function zs({
|
|
43
|
+
onBack: n,
|
|
44
|
+
backLabel: e,
|
|
45
|
+
title: s,
|
|
46
|
+
titleAdornment: o,
|
|
47
|
+
actions: r
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ b("div", { className: "wf-fullbleed-head", children: [
|
|
50
|
+
e !== null && /* @__PURE__ */ a(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
type: "button",
|
|
54
|
+
className: "muted wf-back-btn",
|
|
55
|
+
"data-testid": "wf-editor-back",
|
|
56
|
+
onClick: n,
|
|
57
|
+
children: e
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
s.editable ? /* @__PURE__ */ a(Hs, { title: s }) : /* @__PURE__ */ b("h2", { className: "exec-profile-title", children: [
|
|
61
|
+
s.value,
|
|
62
|
+
" ",
|
|
63
|
+
o
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ b("div", { className: "wf-head-actions", style: { marginLeft: "auto" }, children: [
|
|
66
|
+
s.editable && o,
|
|
67
|
+
r
|
|
68
|
+
] })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function Gs(n, e, s) {
|
|
72
|
+
if (!(n !== "workflow" || e === void 0))
|
|
73
|
+
return (o) => {
|
|
74
|
+
s(), e(o.id);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function Ys(n) {
|
|
78
|
+
const { kind: e, id: s, onClose: o, onOpenRun: r } = n, [l, u] = w(Kn), d = Gs(e, r, o);
|
|
79
|
+
return /* @__PURE__ */ a(
|
|
80
|
+
Cn,
|
|
81
|
+
{
|
|
82
|
+
size: "full",
|
|
83
|
+
title: "History",
|
|
84
|
+
subtitle: s,
|
|
85
|
+
onClose: o,
|
|
86
|
+
headerRight: /* @__PURE__ */ a(fe, { icon: "close", label: "Close", onClick: o }),
|
|
87
|
+
children: /* @__PURE__ */ a("div", { className: "w6w-modal-body", children: /* @__PURE__ */ a(
|
|
88
|
+
is,
|
|
89
|
+
{
|
|
90
|
+
scope: { callable: s },
|
|
91
|
+
workflowId: e === "workflow" ? s : void 0,
|
|
92
|
+
showKind: !1,
|
|
93
|
+
filters: l,
|
|
94
|
+
onFiltersChange: u,
|
|
95
|
+
onOpenInEditor: d
|
|
96
|
+
}
|
|
97
|
+
) })
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function Us(n) {
|
|
102
|
+
return /* @__PURE__ */ a(fe, { icon: "json", onClick: n.onClick, label: "Edit raw JSON definition" });
|
|
103
|
+
}
|
|
104
|
+
function Xs(n) {
|
|
105
|
+
return n.open ? n.mode === "apply" ? /* @__PURE__ */ a(Zs, { ...n }) : /* @__PURE__ */ a(eo, { ...n }) : null;
|
|
106
|
+
}
|
|
107
|
+
function Bt(n) {
|
|
108
|
+
return /* @__PURE__ */ a("div", { className: "json-toggle-editor", children: /* @__PURE__ */ a(
|
|
109
|
+
An,
|
|
110
|
+
{
|
|
111
|
+
value: n.value,
|
|
112
|
+
onChange: n.onChange,
|
|
113
|
+
minHeight: "120px",
|
|
114
|
+
"aria-label": n.label
|
|
115
|
+
}
|
|
116
|
+
) });
|
|
117
|
+
}
|
|
118
|
+
function Zs(n) {
|
|
119
|
+
const { onClose: e, title: s, value: o, prepareApply: r, onApply: l, editorLabel: u } = n, [d, g] = w(o), [h, m] = w(o), [R, C] = w([]), [E, T] = w(!1), L = N(
|
|
120
|
+
() => (r == null ? void 0 : r(d)) ?? { ok: !0, text: d, restored: [] },
|
|
121
|
+
[r, d]
|
|
122
|
+
), B = d !== h, te = () => B ? T(!0) : e(), ne = () => {
|
|
123
|
+
!L.ok || !B || (l == null || l(L.text), g(L.text), m(L.text), C(L.restored), T(!1));
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ b(pe, { title: s, onClose: te, wide: !0, className: "modal-json", children: [
|
|
126
|
+
/* @__PURE__ */ b("div", { className: "modal-body", children: [
|
|
127
|
+
/* @__PURE__ */ b("p", { className: "muted small", children: [
|
|
128
|
+
"Edit the raw definition (",
|
|
129
|
+
/* @__PURE__ */ a("code", { children: 'manifestVersion: "2"' }),
|
|
130
|
+
"). Apply updates the visual editor; Save stores it."
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ a(
|
|
133
|
+
Bt,
|
|
134
|
+
{
|
|
135
|
+
value: d,
|
|
136
|
+
onChange: (se) => {
|
|
137
|
+
g(se), T(!1);
|
|
138
|
+
},
|
|
139
|
+
label: u
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
!L.ok && /* @__PURE__ */ a("p", { className: "error small", role: "alert", "data-testid": "json-toggle-error", children: L.error }),
|
|
143
|
+
R.length > 0 && /* @__PURE__ */ b("p", { className: "muted small", "data-testid": "json-toggle-restored", children: [
|
|
144
|
+
"Restored ",
|
|
145
|
+
R.join(", "),
|
|
146
|
+
": ",
|
|
147
|
+
R.length > 1 ? "these fields" : "this field",
|
|
148
|
+
" ",
|
|
149
|
+
"can't be changed in JSON."
|
|
150
|
+
] })
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ a("div", { className: "modal-actions", children: E ? /* @__PURE__ */ b(ee, { children: [
|
|
153
|
+
/* @__PURE__ */ a("span", { className: "muted small json-toggle-confirm", children: "Discard unapplied changes?" }),
|
|
154
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn ghost", onClick: () => T(!1), children: "Keep editing" }),
|
|
155
|
+
/* @__PURE__ */ a(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
type: "button",
|
|
159
|
+
className: "btn danger",
|
|
160
|
+
"data-testid": "json-toggle-discard",
|
|
161
|
+
onClick: e,
|
|
162
|
+
children: "Discard"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] }) : /* @__PURE__ */ b(ee, { children: [
|
|
166
|
+
/* @__PURE__ */ a(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
className: "btn ghost",
|
|
171
|
+
"data-testid": "json-toggle-close",
|
|
172
|
+
onClick: te,
|
|
173
|
+
children: "Close"
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ a(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
className: "btn",
|
|
181
|
+
"data-testid": "json-toggle-apply",
|
|
182
|
+
disabled: !L.ok || !B,
|
|
183
|
+
onClick: ne,
|
|
184
|
+
children: "Apply"
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }) })
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
function eo(n) {
|
|
191
|
+
const { onClose: e, title: s, value: o, onChange: r, guard: l, onSave: u, saving: d, error: g, editorLabel: h } = n, m = (l == null ? void 0 : l(o)) ?? null;
|
|
192
|
+
return /* @__PURE__ */ b(pe, { title: s, onClose: e, wide: !0, className: "modal-json", children: [
|
|
193
|
+
/* @__PURE__ */ b("div", { className: "modal-body", children: [
|
|
194
|
+
/* @__PURE__ */ a("p", { className: "muted small", children: "Save replaces the stored definition." }),
|
|
195
|
+
/* @__PURE__ */ a(Bt, { value: o, onChange: (R) => r == null ? void 0 : r(R), label: h }),
|
|
196
|
+
m && /* @__PURE__ */ a("p", { className: "muted small", "data-testid": "json-toggle-reason", children: m }),
|
|
197
|
+
g && /* @__PURE__ */ a("div", { className: "error", children: g })
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ b("div", { className: "modal-actions", children: [
|
|
200
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn ghost", onClick: e, children: "Cancel" }),
|
|
201
|
+
/* @__PURE__ */ a(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
className: "btn",
|
|
206
|
+
"data-testid": "json-toggle-save",
|
|
207
|
+
disabled: m != null || !!d,
|
|
208
|
+
onClick: u,
|
|
209
|
+
children: d ? "Saving…" : "Save"
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
function to(n, e, s, o = () => {
|
|
216
|
+
}) {
|
|
217
|
+
var u, d, g;
|
|
218
|
+
const r = /* @__PURE__ */ new Map();
|
|
219
|
+
for (const h of e) {
|
|
220
|
+
const m = (u = h.uses) == null ? void 0 : u.app, R = (d = h.uses) == null ? void 0 : d.action;
|
|
221
|
+
if (typeof h.id != "string" || typeof m != "string" || typeof R != "string") continue;
|
|
222
|
+
const C = { app: m, action: R };
|
|
223
|
+
((g = h.uses) == null ? void 0 : g.trigger) === !0 && (C.trigger = !0);
|
|
224
|
+
const E = s.get(m);
|
|
225
|
+
E && (E.displayName && (C.appName = E.displayName), E.iconSvg && (C.iconSvg = E.iconSvg), E.iconSvgDark && (C.iconSvgDark = E.iconSvgDark), E.brandColor && (C.brandColor = E.brandColor));
|
|
226
|
+
const T = o(m, R);
|
|
227
|
+
T && (C.actionName = T), r.set(h.id, C);
|
|
228
|
+
}
|
|
229
|
+
if (r.size === 0) return [...n];
|
|
230
|
+
const l = (h) => {
|
|
231
|
+
var C;
|
|
232
|
+
const m = h.node ?? r.get(h.id), R = (C = h.iterations) == null ? void 0 : C.map((E) => ({ ...E, steps: E.steps.map(l) }));
|
|
233
|
+
return !m && !R ? h : { ...h, ...m ? { node: m } : {}, ...R ? { iterations: R } : {} };
|
|
234
|
+
};
|
|
235
|
+
return n.map(l);
|
|
236
|
+
}
|
|
237
|
+
function Jt(n, e, s = {}) {
|
|
238
|
+
const o = (l) => Array.isArray(l) ? l.map(o) : l !== null && typeof l == "object" ? Object.fromEntries(
|
|
239
|
+
Object.entries(l).sort(([u], [d]) => u.localeCompare(d)).map(([u, d]) => [u, o(d)])
|
|
240
|
+
) : l, r = (l) => {
|
|
241
|
+
if (!he(l)) return l;
|
|
242
|
+
const { status: u, ...d } = l, g = { ...d, key: d.key ?? null, tags: d.tags ?? [] };
|
|
243
|
+
return s.presentation ? g : no(g);
|
|
244
|
+
};
|
|
245
|
+
return JSON.stringify(o(r(n))) === JSON.stringify(o(r(e)));
|
|
246
|
+
}
|
|
247
|
+
const he = (n) => n !== null && typeof n == "object" && !Array.isArray(n), Kt = (n, e) => {
|
|
248
|
+
if (!he(n)) return n;
|
|
249
|
+
const s = { ...n };
|
|
250
|
+
for (const o of e) delete s[o];
|
|
251
|
+
return s;
|
|
252
|
+
}, xt = (n, e) => Array.isArray(n) ? n.map((s) => Kt(s, e)) : n;
|
|
253
|
+
function no(n) {
|
|
254
|
+
const e = { ...n };
|
|
255
|
+
for (const s of ["nodes", "steps"])
|
|
256
|
+
s in e && (e[s] = xt(e[s], ["position"]));
|
|
257
|
+
if (he(e.settings)) {
|
|
258
|
+
const s = Kt(e.settings, ["viewport", "autoSave", "savePosition"]);
|
|
259
|
+
e.settings = Object.keys(s).length === 0 ? void 0 : s;
|
|
260
|
+
}
|
|
261
|
+
if (he(e.canvas)) {
|
|
262
|
+
const s = { ...e.canvas };
|
|
263
|
+
for (const o of ["notes", "sections"])
|
|
264
|
+
o in s && (s[o] = xt(s[o], ["position", "size"]));
|
|
265
|
+
e.canvas = s;
|
|
266
|
+
}
|
|
267
|
+
return e;
|
|
268
|
+
}
|
|
269
|
+
function so(n) {
|
|
270
|
+
const { kind: e, problemCount: s, canEnable: o, onEnable: r, pending: l } = n, u = s > 0 ? `This ${e} is disabled and ${s} ${s === 1 ? "step uses" : "steps use"} a connection that no longer exists. Choose another connection, save, then Enable.` : "Connections fixed. Enable to run again.";
|
|
271
|
+
return $(
|
|
272
|
+
"div",
|
|
273
|
+
{ role: "alert", className: "error", "data-testid": "binding-disabled-banner" },
|
|
274
|
+
$("span", null, u),
|
|
275
|
+
" ",
|
|
276
|
+
$(
|
|
277
|
+
"button",
|
|
278
|
+
{
|
|
279
|
+
type: "button",
|
|
280
|
+
"data-testid": "binding-enable",
|
|
281
|
+
disabled: !o || l === !0,
|
|
282
|
+
onClick: r
|
|
283
|
+
},
|
|
284
|
+
"Enable"
|
|
285
|
+
)
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function oo({
|
|
289
|
+
project: n,
|
|
290
|
+
onNavigate: e,
|
|
291
|
+
rail: s = !0,
|
|
292
|
+
storageKey: o,
|
|
293
|
+
tools: r = cs,
|
|
294
|
+
children: l
|
|
295
|
+
}) {
|
|
296
|
+
const u = as(), d = /* @__PURE__ */ a(us, { project: n, onNavigate: e, children: /* @__PURE__ */ b(ds, { project: n, children: [
|
|
297
|
+
l,
|
|
298
|
+
s && /* @__PURE__ */ a(fs, { tools: r, storageKey: o })
|
|
299
|
+
] }) });
|
|
300
|
+
return s || !u ? /* @__PURE__ */ a(ls, { children: d }) : d;
|
|
301
|
+
}
|
|
302
|
+
function io({
|
|
303
|
+
message: n,
|
|
304
|
+
disabled: e = !1,
|
|
305
|
+
children: s
|
|
306
|
+
}) {
|
|
307
|
+
const o = xn(), [r, l] = w(!1);
|
|
308
|
+
return /* @__PURE__ */ b(
|
|
309
|
+
"fieldset",
|
|
310
|
+
{
|
|
311
|
+
className: "wf-publish-tooltip",
|
|
312
|
+
"aria-label": "Publish workflow",
|
|
313
|
+
"aria-describedby": o,
|
|
314
|
+
tabIndex: e ? 0 : void 0,
|
|
315
|
+
onMouseEnter: () => l(!0),
|
|
316
|
+
onMouseLeave: () => l(!1),
|
|
317
|
+
onFocus: () => l(!0),
|
|
318
|
+
onBlur: (u) => {
|
|
319
|
+
u.currentTarget.contains(u.relatedTarget) || l(!1);
|
|
320
|
+
},
|
|
321
|
+
onKeyDown: (u) => {
|
|
322
|
+
u.key === "Escape" && l(!1);
|
|
323
|
+
},
|
|
324
|
+
children: [
|
|
325
|
+
s(o),
|
|
326
|
+
r && /* @__PURE__ */ a("span", { id: o, role: "tooltip", className: "wf-publish-hint", children: n })
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
function ro(n) {
|
|
332
|
+
const { problems: e, nodeLabel: s } = n, o = Object.entries(e).filter(([, l]) => l.length > 0);
|
|
333
|
+
if (o.length === 0) return null;
|
|
334
|
+
const r = o.length;
|
|
335
|
+
return $(
|
|
336
|
+
"div",
|
|
337
|
+
{ role: "status", className: "error", "data-testid": "setup-incomplete-banner" },
|
|
338
|
+
$(
|
|
339
|
+
"span",
|
|
340
|
+
null,
|
|
341
|
+
`Setup incomplete: ${r} ${r === 1 ? "step needs" : "steps need"} attention. The workflow can still run.`
|
|
342
|
+
),
|
|
343
|
+
$(
|
|
344
|
+
"ul",
|
|
345
|
+
{ "data-testid": "setup-incomplete-list" },
|
|
346
|
+
...o.map(
|
|
347
|
+
([l, u]) => $("li", { key: l }, `${s ? s(l) : l}: ${u.join(", ")}`)
|
|
348
|
+
)
|
|
349
|
+
)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
const ao = {
|
|
353
|
+
invalid_json: "This isn't valid JSON yet, so it isn't saved. Fix it to save.",
|
|
354
|
+
not_object: 'Starting state must be a JSON object, like {"region": "us"}. Not saved.',
|
|
355
|
+
too_large: "Starting state is over the 64 KiB limit. Not saved."
|
|
356
|
+
};
|
|
357
|
+
function lo(n) {
|
|
358
|
+
const e = Pn();
|
|
359
|
+
return /* @__PURE__ */ a(
|
|
360
|
+
On,
|
|
361
|
+
{
|
|
362
|
+
mode: "json-binding",
|
|
363
|
+
startingState: !0,
|
|
364
|
+
title: "Starting state",
|
|
365
|
+
fieldLabel: "initialState",
|
|
366
|
+
value: void 0,
|
|
367
|
+
options: e,
|
|
368
|
+
jsonValue: n.initialState,
|
|
369
|
+
jsonProblem: (s) => {
|
|
370
|
+
const o = Ft(s);
|
|
371
|
+
if (!o.ok) return ao[o.reason];
|
|
372
|
+
const r = o.value === void 0 ? void 0 : Vs(o.value)[0];
|
|
373
|
+
return r ? `${r.message} Not saved.` : null;
|
|
374
|
+
},
|
|
375
|
+
onSaveJson: (s) => {
|
|
376
|
+
const o = Ft(s === void 0 ? "" : JSON.stringify(s));
|
|
377
|
+
o.ok && n.onChange(o.value);
|
|
378
|
+
},
|
|
379
|
+
onClose: n.onClose
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
function co(n) {
|
|
384
|
+
const e = n == null ? void 0 : n.waitingForms;
|
|
385
|
+
return Array.isArray(e) ? e.filter(
|
|
386
|
+
(s) => !!s && typeof s.stepId == "string" && typeof s.url == "string" && /^https?:\/\//i.test(s.url)
|
|
387
|
+
) : [];
|
|
388
|
+
}
|
|
389
|
+
function uo({ forms: n, labelOf: e }) {
|
|
390
|
+
return n.length === 0 ? null : /* @__PURE__ */ a("div", { className: "wf-waiting-forms", "data-testid": "wf-waiting-forms", children: n.map((s) => {
|
|
391
|
+
const o = (e == null ? void 0 : e(s.stepId)) || s.stepId;
|
|
392
|
+
return /* @__PURE__ */ b("section", { "data-testid": "wf-waiting-form", children: [
|
|
393
|
+
/* @__PURE__ */ b("header", { className: "wf-waiting-form-head", children: [
|
|
394
|
+
/* @__PURE__ */ a("strong", { children: "Waiting for form" }),
|
|
395
|
+
/* @__PURE__ */ a("span", { className: "muted", children: o }),
|
|
396
|
+
/* @__PURE__ */ a(
|
|
397
|
+
"a",
|
|
398
|
+
{
|
|
399
|
+
className: "btn",
|
|
400
|
+
href: s.url,
|
|
401
|
+
target: "_blank",
|
|
402
|
+
rel: "noopener noreferrer",
|
|
403
|
+
"data-testid": "wf-waiting-form-open",
|
|
404
|
+
children: "Open form"
|
|
405
|
+
}
|
|
406
|
+
)
|
|
407
|
+
] }),
|
|
408
|
+
/* @__PURE__ */ a("p", { className: "muted wf-waiting-form-hint", children: "The run is paused here. Submit the form to continue it." }),
|
|
409
|
+
/* @__PURE__ */ a(
|
|
410
|
+
"iframe",
|
|
411
|
+
{
|
|
412
|
+
className: "wf-waiting-form-frame",
|
|
413
|
+
title: `Form: ${o}`,
|
|
414
|
+
src: s.url,
|
|
415
|
+
sandbox: "allow-forms allow-scripts allow-same-origin allow-popups"
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
] }, s.stepId);
|
|
419
|
+
}) });
|
|
420
|
+
}
|
|
421
|
+
const Qt = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, fo = "Untitled workflow", po = ["id", "key", "manifestVersion"];
|
|
422
|
+
function ho(n) {
|
|
423
|
+
let e = 0;
|
|
424
|
+
const s = () => {
|
|
425
|
+
for (; e < n.length && `
|
|
426
|
+
\r`.includes(n[e]); ) e++;
|
|
427
|
+
}, o = () => {
|
|
428
|
+
throw e;
|
|
429
|
+
}, r = (h) => {
|
|
430
|
+
for (const m of h)
|
|
431
|
+
n[e] !== m && o(), e++;
|
|
432
|
+
}, l = () => {
|
|
433
|
+
for (e++; n[e] !== '"'; ) {
|
|
434
|
+
const h = n[e];
|
|
435
|
+
if ((h === void 0 || h < " ") && o(), h === "\\")
|
|
436
|
+
if (e++, n[e] === "u")
|
|
437
|
+
for (let m = 0; m < 4; m++)
|
|
438
|
+
e++, /[0-9a-fA-F]/.test(n[e] ?? "") || o();
|
|
439
|
+
else '"\\/bfnrt'.includes(n[e] ?? "x") || o();
|
|
440
|
+
e++;
|
|
441
|
+
}
|
|
442
|
+
e++;
|
|
443
|
+
}, u = /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/y, d = () => {
|
|
444
|
+
u.lastIndex = e, u.test(n) || o(), e = u.lastIndex;
|
|
445
|
+
}, g = () => {
|
|
446
|
+
s();
|
|
447
|
+
const h = n[e];
|
|
448
|
+
if (h === "{" || h === "[") {
|
|
449
|
+
const m = h === "{" ? "}" : "]";
|
|
450
|
+
if (e++, s(), n[e] === m) {
|
|
451
|
+
e++;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
for (; ; )
|
|
455
|
+
if (m === "}" && (s(), n[e] !== '"' && o(), l(), s(), n[e] !== ":" && o(), e++), g(), s(), n[e] === ",") e++;
|
|
456
|
+
else if (n[e] === m) {
|
|
457
|
+
e++;
|
|
458
|
+
return;
|
|
459
|
+
} else o();
|
|
460
|
+
}
|
|
461
|
+
h === '"' ? l() : h === "t" ? r("true") : h === "f" ? r("false") : h === "n" ? r("null") : d();
|
|
462
|
+
};
|
|
463
|
+
try {
|
|
464
|
+
return g(), s(), e < n.length ? e : null;
|
|
465
|
+
} catch (h) {
|
|
466
|
+
return typeof h == "number" ? Math.min(h, n.length) : 0;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function mo(n, e) {
|
|
470
|
+
const s = e instanceof Error ? e.message : String(e), o = ho(n);
|
|
471
|
+
if (o === null) return s;
|
|
472
|
+
const r = n.slice(0, o), l = r.split(`
|
|
473
|
+
`).length, u = o - r.lastIndexOf(`
|
|
474
|
+
`);
|
|
475
|
+
return `Line ${l}, column ${u}: ${s}`;
|
|
476
|
+
}
|
|
477
|
+
const de = (n) => typeof n == "object" && n !== null && !Array.isArray(n);
|
|
478
|
+
function go(n) {
|
|
479
|
+
if (typeof n.name != "string" || n.name.length === 0) return "`name` is required.";
|
|
480
|
+
const e = n.nodes ?? n.steps;
|
|
481
|
+
if (!Array.isArray(e)) return "`nodes` must be an array.";
|
|
482
|
+
const s = /* @__PURE__ */ new Set();
|
|
483
|
+
for (let o = 0; o < e.length; o++) {
|
|
484
|
+
const r = e[o];
|
|
485
|
+
if (!de(r)) return `\`nodes[${o}]\` must be an object.`;
|
|
486
|
+
if (typeof r.id != "string" || r.id.length === 0)
|
|
487
|
+
return `\`nodes[${o}].id\` must be a non-empty string.`;
|
|
488
|
+
if (r.id.includes(".")) return `Node id "${r.id}" may not contain ".".`;
|
|
489
|
+
if (s.has(r.id)) return `Node id "${r.id}" is used twice.`;
|
|
490
|
+
s.add(r.id);
|
|
491
|
+
const l = r.position;
|
|
492
|
+
if (l !== void 0 && (!de(l) || !Number.isFinite(l.x) || !Number.isFinite(l.y)))
|
|
493
|
+
return `\`nodes[${o}].position\` must be { "x": number, "y": number }.`;
|
|
494
|
+
}
|
|
495
|
+
if (n.edges !== void 0) {
|
|
496
|
+
if (!Array.isArray(n.edges)) return "`edges` must be an array.";
|
|
497
|
+
for (let o = 0; o < n.edges.length; o++) {
|
|
498
|
+
const r = n.edges[o];
|
|
499
|
+
if (!de(r)) return `\`edges[${o}]\` must be an object.`;
|
|
500
|
+
for (const l of ["from", "to"])
|
|
501
|
+
if (typeof r[l] != "string" || !s.has(r[l]))
|
|
502
|
+
return `\`edges[${o}].${l}\` does not name an existing node.`;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
function bo(n, e) {
|
|
508
|
+
let s;
|
|
509
|
+
try {
|
|
510
|
+
s = JSON.parse(n);
|
|
511
|
+
} catch (d) {
|
|
512
|
+
return { ok: !1, error: mo(n, d) };
|
|
513
|
+
}
|
|
514
|
+
if (!de(s)) return { ok: !1, error: "The definition must be a JSON object." };
|
|
515
|
+
const o = [];
|
|
516
|
+
let r = s;
|
|
517
|
+
const l = {};
|
|
518
|
+
if (e) {
|
|
519
|
+
for (const d of po) {
|
|
520
|
+
const g = Object.hasOwn(e, d), h = Object.hasOwn(r, d);
|
|
521
|
+
if (!(g === h && JSON.stringify(e[d]) === JSON.stringify(r[d])))
|
|
522
|
+
if (o.push(d), g)
|
|
523
|
+
h ? r = { ...r, [d]: e[d] } : l[d] = e[d];
|
|
524
|
+
else {
|
|
525
|
+
const { [d]: m, ...R } = r;
|
|
526
|
+
r = R;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
r = { ...l, ...r };
|
|
530
|
+
}
|
|
531
|
+
if (typeof r.id == "string" && !Qt.test(r.id))
|
|
532
|
+
return { ok: !1, error: "Invalid workflow id." };
|
|
533
|
+
const u = go(r);
|
|
534
|
+
return u !== null ? { ok: !1, error: u } : { ok: !0, text: o.length > 0 ? JSON.stringify(r, null, 2) : n, restored: o };
|
|
535
|
+
}
|
|
536
|
+
function yo(n, e, s, o) {
|
|
537
|
+
const r = {};
|
|
538
|
+
for (const l of n) {
|
|
539
|
+
const u = { code: l.code, connection: l.connection };
|
|
540
|
+
r[l.siteId] = [...Object.hasOwn(r, l.siteId) ? r[l.siteId] : [], u];
|
|
541
|
+
}
|
|
542
|
+
for (const l of [e, s, o])
|
|
543
|
+
for (const [u, d] of Object.entries(l ?? {}))
|
|
544
|
+
d.length > 0 && (r[u] = [...Object.hasOwn(r, u) ? r[u] : [], ...d]);
|
|
545
|
+
return r;
|
|
546
|
+
}
|
|
547
|
+
const vo = Bn(
|
|
548
|
+
() => import("@w6w/ui/flow").then((n) => ({ default: n.WorkflowFlowEditor }))
|
|
549
|
+
);
|
|
550
|
+
function wo(n) {
|
|
551
|
+
var Et, Ct, At, Pt, Ot, jt;
|
|
552
|
+
const { workflowId: e, project: s, projectPending: o, initialRunId: r, onNavigate: l, slots: u } = n, d = hs(), g = $t(), [h, m] = w(null), [R, C] = w(!1), [E, T] = w(0), [L, B] = w(!1), [te, ne] = w(!1), [se, De] = w(!1), [oe, Je] = w(void 0), xe = k(!0), ie = k(void 0), We = k(() => null), _t = O(
|
|
553
|
+
(t) => {
|
|
554
|
+
const i = t;
|
|
555
|
+
return Qt.test(typeof i.id == "string" ? i.id : "") ? ie.current !== void 0 && (i.key ?? null) === ie.current ? null : Lt(oe, i.key).reason : "Invalid workflow id.";
|
|
556
|
+
},
|
|
557
|
+
[oe]
|
|
558
|
+
), p = ms({
|
|
559
|
+
workflowId: e,
|
|
560
|
+
project: s,
|
|
561
|
+
autoSave: xe.current,
|
|
562
|
+
// The expression editor holds uncommitted parts in its own local state until its Save
|
|
563
|
+
// button, so saving from under it would persist a workflow without the expression the user
|
|
564
|
+
// is looking at. Read at fire time (opening it changes neither the buffer nor `canSave`).
|
|
565
|
+
canAutoSave: () => !document.querySelector(".w6w-exprmodal"),
|
|
566
|
+
saveGuard: _t,
|
|
567
|
+
publishBlockedReason: (t) => We.current(t)
|
|
568
|
+
}), $e = p.json, c = p.parsed, K = p.canSave, qt = p.dirty;
|
|
569
|
+
F(() => {
|
|
570
|
+
if (p.loading || p.loadError !== null) {
|
|
571
|
+
Je(void 0);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
!p.dirty && c && Je(c.key ?? null);
|
|
575
|
+
}, [p.loading, p.loadError, p.dirty, c]);
|
|
576
|
+
const [Vt, me] = w(!1);
|
|
577
|
+
F(() => {
|
|
578
|
+
p.stale || me(!1);
|
|
579
|
+
}, [p.stale]);
|
|
580
|
+
const [Ht, Be] = w(!1), Ke = k(!1);
|
|
581
|
+
F(() => {
|
|
582
|
+
p.saving ? Be(!1) : Ke.current && p.error === null && Be(!0), Ke.current = p.saving;
|
|
583
|
+
}, [p.saving, p.error]);
|
|
584
|
+
const [A, P] = w(null), Qe = Qn(), _e = _n(), qe = qn(), I = Vn(A), J = (Et = I.data) == null ? void 0 : Et.status, Ve = I.isError, V = Hn(J, Ve), zt = zn(A, J), ge = Gn(
|
|
585
|
+
Yn(I.data),
|
|
586
|
+
(Ct = zt.data) == null ? void 0 : Ct.writes
|
|
587
|
+
), He = Un(I.data, ge), Gt = J === "queued" ? co(I.data) : [], [Yt, ze] = w(!1);
|
|
588
|
+
F(() => {
|
|
589
|
+
A && ze(!0);
|
|
590
|
+
}, [A]);
|
|
591
|
+
const be = k(!1), [Ut, Ge] = w(!1);
|
|
592
|
+
F(() => {
|
|
593
|
+
P(null);
|
|
594
|
+
}, [e]), F(() => {
|
|
595
|
+
r && P(r);
|
|
596
|
+
}, [e, r]), F(() => {
|
|
597
|
+
I.data && I.data.workflowId !== e && P(null);
|
|
598
|
+
}, [I.data, e]);
|
|
599
|
+
async function Ye(t) {
|
|
600
|
+
try {
|
|
601
|
+
const i = await p.flushThen(t);
|
|
602
|
+
!i.ok && i.outcome.status === "blocked" && m(i.outcome.reason);
|
|
603
|
+
} catch (i) {
|
|
604
|
+
m(i instanceof Le ? i.message : String(i));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
async function Xt() {
|
|
608
|
+
if (!(!e || V || be.current)) {
|
|
609
|
+
m(null), be.current = !0, Ge(!0);
|
|
610
|
+
try {
|
|
611
|
+
const t = v ? ts(j, v.isManualTrigger, v.isEntryTrigger) : (H == null ? void 0 : H[0]) && { id: H[0].id, manual: !0 };
|
|
612
|
+
await Mn();
|
|
613
|
+
const i = await ns(
|
|
614
|
+
t == null ? void 0 : t.id,
|
|
615
|
+
(f) => Dt(d, e, f),
|
|
616
|
+
() => ss(d, e)
|
|
617
|
+
);
|
|
618
|
+
await Ye(
|
|
619
|
+
() => t && !t.manual ? (
|
|
620
|
+
// A webhook / schedule / app trigger entry runs FROM that trigger: the server takes
|
|
621
|
+
// the payload as the event that fired it (its output and `trigger.event`), which a
|
|
622
|
+
// plain run's `input` — the Manual trigger's slot — never reaches.
|
|
623
|
+
_e.mutateAsync({
|
|
624
|
+
id: e,
|
|
625
|
+
nodeId: t.id,
|
|
626
|
+
body: { stopAt: [], ...i ? { input: i } : {} }
|
|
627
|
+
}).then((f) => P(f.runId))
|
|
628
|
+
) : Qe.mutateAsync({
|
|
629
|
+
id: e,
|
|
630
|
+
variables: {},
|
|
631
|
+
...i ? { input: i } : {}
|
|
632
|
+
}).then((f) => P(f.runId))
|
|
633
|
+
);
|
|
634
|
+
} finally {
|
|
635
|
+
be.current = !1, Ge(!1);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
async function Zt(t, i) {
|
|
640
|
+
if (!e) return;
|
|
641
|
+
m(null);
|
|
642
|
+
const f = await p.flushThen(
|
|
643
|
+
() => {
|
|
644
|
+
var y;
|
|
645
|
+
return _e.mutateAsync({
|
|
646
|
+
id: e,
|
|
647
|
+
nodeId: t,
|
|
648
|
+
body: {
|
|
649
|
+
stopAt: i.stopAt,
|
|
650
|
+
...(y = i.state) != null && y.steps ? { nodes: i.state.steps } : {},
|
|
651
|
+
...i.input ? { input: i.input } : {}
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
if (!f.ok)
|
|
657
|
+
throw new Error(
|
|
658
|
+
f.outcome.status === "blocked" ? f.outcome.reason : "The workflow could not be saved, so it was not run."
|
|
659
|
+
);
|
|
660
|
+
P(f.value.runId);
|
|
661
|
+
}
|
|
662
|
+
function en() {
|
|
663
|
+
A && (qe.mutate(A, {
|
|
664
|
+
onError: (t) => {
|
|
665
|
+
const i = t instanceof Le ? t.code : "";
|
|
666
|
+
os(i) === "surface" && m(t instanceof Le ? t.message : String(t));
|
|
667
|
+
}
|
|
668
|
+
}), P(null));
|
|
669
|
+
}
|
|
670
|
+
async function tn() {
|
|
671
|
+
De(!0);
|
|
672
|
+
try {
|
|
673
|
+
await p.reload(), T((t) => t + 1), m(null);
|
|
674
|
+
} finally {
|
|
675
|
+
De(!1);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
const re = p.stale ? null : p.error ?? p.loadError, ye = h ?? (re === null ? null : re instanceof Error ? re.message : String(re)), nn = c !== null && (Array.isArray(c.nodes) || Array.isArray(c.steps)), Ue = (c == null ? void 0 : c.displayName) ?? "", ve = gs(c == null ? void 0 : c.settings), ae = Cs(c == null ? void 0 : c.initialState), sn = N(() => As(c == null ? void 0 : c.variables), [c == null ? void 0 : c.variables]), Xe = Lt(oe, c == null ? void 0 : c.key), we = c !== null && oe !== void 0 && !Xe.allowed ? Xe.reason : null, j = N(
|
|
679
|
+
() => bs(c),
|
|
680
|
+
[c]
|
|
681
|
+
), [v, on] = w(null);
|
|
682
|
+
F(() => {
|
|
683
|
+
let t = !1;
|
|
684
|
+
return import("@w6w/ui/flow").then((i) => {
|
|
685
|
+
t || on({
|
|
686
|
+
internalNodes: i.INTERNAL_NODES,
|
|
687
|
+
isInternalApp: i.isInternalApp,
|
|
688
|
+
internalNodeParams: i.internalNodeParams,
|
|
689
|
+
isManualTrigger: (f) => f === i.TRIGGER_APP,
|
|
690
|
+
isEntryTrigger: i.isTriggerStep,
|
|
691
|
+
asFieldDefs: i.asFieldDefs,
|
|
692
|
+
findLoopProblems: i.findLoopProblems,
|
|
693
|
+
findStateWriteProblems: i.findStateWriteProblems
|
|
694
|
+
});
|
|
695
|
+
}), () => {
|
|
696
|
+
t = !0;
|
|
697
|
+
};
|
|
698
|
+
}, []);
|
|
699
|
+
const H = N(() => {
|
|
700
|
+
if (v)
|
|
701
|
+
return ys(
|
|
702
|
+
{ steps: j },
|
|
703
|
+
{
|
|
704
|
+
isManualTrigger: v.isManualTrigger,
|
|
705
|
+
asFieldDefs: v.asFieldDefs
|
|
706
|
+
}
|
|
707
|
+
);
|
|
708
|
+
}, [v, j]), D = N(() => {
|
|
709
|
+
if (!v) return [];
|
|
710
|
+
const t = /* @__PURE__ */ new Set();
|
|
711
|
+
for (const i of j) {
|
|
712
|
+
const { app: f, action: y } = i.uses ?? {};
|
|
713
|
+
f && y && !v.isInternalApp(f) && t.add(f);
|
|
714
|
+
}
|
|
715
|
+
return [...t];
|
|
716
|
+
}, [v, j]), { byId: z } = rs(D), rn = N(() => [...z.values()], [z]), Se = Fe({
|
|
717
|
+
queries: D.map((t) => ({
|
|
718
|
+
queryKey: _s(t),
|
|
719
|
+
queryFn: () => g.getAppActions(t)
|
|
720
|
+
}))
|
|
721
|
+
}), Ze = N(() => {
|
|
722
|
+
var i, f;
|
|
723
|
+
const t = {};
|
|
724
|
+
if (!v) return t;
|
|
725
|
+
for (const y of j) {
|
|
726
|
+
const { app: S, action: M } = y.uses ?? {};
|
|
727
|
+
if (!S || !M) continue;
|
|
728
|
+
const Z = `${S}::${M}`;
|
|
729
|
+
if (!(Z in t))
|
|
730
|
+
if (v.isInternalApp(S))
|
|
731
|
+
t[Z] = v.internalNodeParams(S, M);
|
|
732
|
+
else {
|
|
733
|
+
const Tt = D.indexOf(S), Ie = Tt >= 0 ? (i = Se[Tt]) == null ? void 0 : i.data : void 0;
|
|
734
|
+
t[Z] = ((f = Ie == null ? void 0 : Ie.find((En) => En.key === M)) == null ? void 0 : f.params) ?? [];
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return t;
|
|
738
|
+
}, [v, j, D, Se]), an = to(
|
|
739
|
+
ge,
|
|
740
|
+
j,
|
|
741
|
+
z,
|
|
742
|
+
(t, i) => {
|
|
743
|
+
var S, M;
|
|
744
|
+
const f = D.indexOf(t), y = f >= 0 ? (S = Se[f]) == null ? void 0 : S.data : void 0;
|
|
745
|
+
return (M = y == null ? void 0 : y.find((Z) => Z.key === i)) == null ? void 0 : M.title;
|
|
746
|
+
}
|
|
747
|
+
), G = N(() => {
|
|
748
|
+
const t = {};
|
|
749
|
+
for (const [i, f] of z) t[i] = f;
|
|
750
|
+
return t;
|
|
751
|
+
}, [z]), ke = N(
|
|
752
|
+
() => j.filter((t) => {
|
|
753
|
+
var f;
|
|
754
|
+
const i = (f = t.uses) == null ? void 0 : f.app;
|
|
755
|
+
return !!i && i in G && It(G[i]);
|
|
756
|
+
}),
|
|
757
|
+
[j, G]
|
|
758
|
+
), et = Fe({
|
|
759
|
+
queries: ke.map((t) => ({
|
|
760
|
+
queryKey: Me(e, t.id),
|
|
761
|
+
queryFn: () => Dt(d, e, t.id),
|
|
762
|
+
enabled: !!e
|
|
763
|
+
}))
|
|
764
|
+
}), tt = N(() => {
|
|
765
|
+
const t = {};
|
|
766
|
+
return ke.forEach((i, f) => {
|
|
767
|
+
var y, S;
|
|
768
|
+
t[i.id] = !!((S = (y = et[f]) == null ? void 0 : y.data) != null && S.some((M) => M.lastRunStatus === "succeeded"));
|
|
769
|
+
}), t;
|
|
770
|
+
}, [ke, et]), Y = Ls("workflow", e, !!e), Ne = Ms("workflow"), x = ((At = Y.data) == null ? void 0 : At.currentPublishedVersion) ?? null, Q = Ds("workflow", e, x, !!e), Re = Q.data !== void 0 && c !== null && Jt(c, Q.data.definition), ln = Re && !Jt(c, (Pt = Q.data) == null ? void 0 : Pt.definition, { presentation: !0 }), W = Y.data === void 0 ? void 0 : x === null ? "unpublished" : Q.data === void 0 || p.loading ? void 0 : Re ? "published" : "draft", [cn, nt] = w(!1), un = Js("workflow");
|
|
771
|
+
async function st(t) {
|
|
772
|
+
nt(!0), m(null);
|
|
773
|
+
try {
|
|
774
|
+
await p.discardThen(() => un.mutateAsync({ id: e, versionNumber: t })), T((i) => i + 1), P(null);
|
|
775
|
+
} finally {
|
|
776
|
+
nt(!1);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
const le = Wt(), ot = k(null);
|
|
780
|
+
F(() => {
|
|
781
|
+
var t;
|
|
782
|
+
if (!(!e || !A || ot.current === A) && Xn(J, (t = I.data) == null ? void 0 : t.workflowId, e)) {
|
|
783
|
+
ot.current = A;
|
|
784
|
+
for (const i of Zn)
|
|
785
|
+
setTimeout(
|
|
786
|
+
() => void le.invalidateQueries({ queryKey: Ws(e) }),
|
|
787
|
+
i
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
}, [e, A, J, (Ot = I.data) == null ? void 0 : Ot.workflowId, le]);
|
|
791
|
+
const it = Fe({
|
|
792
|
+
queries: D.map((t) => ({
|
|
793
|
+
queryKey: Mt(t),
|
|
794
|
+
queryFn: () => Fs(d, t)
|
|
795
|
+
}))
|
|
796
|
+
}), rt = N(() => {
|
|
797
|
+
const t = /* @__PURE__ */ new Map();
|
|
798
|
+
return D.forEach((i, f) => {
|
|
799
|
+
const y = it[f];
|
|
800
|
+
y && (y.isError ? t.set(i, { state: "error" }) : y.isSuccess && !y.isFetching ? t.set(i, { state: "ready", ids: new Set((y.data ?? []).map((S) => S.id)) }) : t.set(i, { state: "loading" }));
|
|
801
|
+
}), t;
|
|
802
|
+
}, [D, it]), _ = N(
|
|
803
|
+
() => vs(j, (t) => rt.get(t), c == null ? void 0 : c.connections),
|
|
804
|
+
[j, rt, c == null ? void 0 : c.connections]
|
|
805
|
+
), at = Bs(s ?? void 0, s !== null), lt = Ks(), ct = $s(), ut = Qs(s ?? void 0), Ee = N(() => {
|
|
806
|
+
if (!c) return {};
|
|
807
|
+
const t = (i) => ({
|
|
808
|
+
names: (i.data ?? []).map((f) => f.name),
|
|
809
|
+
ready: i.isSuccess
|
|
810
|
+
});
|
|
811
|
+
return ws({
|
|
812
|
+
workflow: c,
|
|
813
|
+
lists: {
|
|
814
|
+
vars: t(at),
|
|
815
|
+
secrets: t(lt),
|
|
816
|
+
constants: t(ct),
|
|
817
|
+
stores: t(ut)
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}, [c, at, lt, ct, ut]), dt = N(() => {
|
|
821
|
+
const t = {};
|
|
822
|
+
for (const [i, f] of Object.entries(Ee))
|
|
823
|
+
t[i] = [{ code: "setup_incomplete", items: f }];
|
|
824
|
+
return t;
|
|
825
|
+
}, [Ee]), dn = N(
|
|
826
|
+
() => yo(
|
|
827
|
+
_,
|
|
828
|
+
v == null ? void 0 : v.findLoopProblems(c),
|
|
829
|
+
c ? v == null ? void 0 : v.findStateWriteProblems(c) : void 0,
|
|
830
|
+
dt
|
|
831
|
+
),
|
|
832
|
+
[_, v, c, dt]
|
|
833
|
+
), ft = k(/* @__PURE__ */ new Set());
|
|
834
|
+
F(() => {
|
|
835
|
+
for (const t of _) {
|
|
836
|
+
const i = `${t.app}|${t.connection}`;
|
|
837
|
+
ft.current.has(i) || (ft.current.add(i), le.invalidateQueries({ queryKey: Mt(t.app) }));
|
|
838
|
+
}
|
|
839
|
+
}, [_, le]);
|
|
840
|
+
const ce = k({ id: e, had: !1 });
|
|
841
|
+
ce.current.id !== e && (ce.current = { id: e, had: !1 }), _.length > 0 && (ce.current.had = !0);
|
|
842
|
+
const pt = xs("workflow"), Ce = Ss({
|
|
843
|
+
enabled: (jt = Y.data) == null ? void 0 : jt.enabled,
|
|
844
|
+
problemCount: _.length,
|
|
845
|
+
dirty: p.dirty,
|
|
846
|
+
hadProblems: ce.current.had
|
|
847
|
+
}), Ae = N(
|
|
848
|
+
() => ({
|
|
849
|
+
actionParamsByKey: Ze,
|
|
850
|
+
appsById: G,
|
|
851
|
+
testStatus: tt,
|
|
852
|
+
requiredParamsFilled: In,
|
|
853
|
+
paramsValid: Tn,
|
|
854
|
+
isTestRequired: It
|
|
855
|
+
}),
|
|
856
|
+
[Ze, G, tt]
|
|
857
|
+
), fn = N(
|
|
858
|
+
() => c !== null && v !== null ? ks(c, Ae) : [],
|
|
859
|
+
[c, v, Ae]
|
|
860
|
+
), [ht, mt] = w(!1), Pe = k(!1), U = Ns({
|
|
861
|
+
projectMissing: s === null,
|
|
862
|
+
loading: !K,
|
|
863
|
+
saveBlockedReason: p.saveBlockedReason ?? (K && c === null ? "the workflow JSON does not parse." : null),
|
|
864
|
+
catalogLoading: c !== null && v === null,
|
|
865
|
+
problems: fn,
|
|
866
|
+
publishing: ht || Ne.isPending
|
|
867
|
+
}) ?? (Y.isPending || x !== null && Q.isPending ? "Checking the published version…" : Y.isError || x !== null && Q.isError ? "Can't check the published version. Reload to try again." : Re ? ln ? "Already published. Moving things on the canvas doesn't need a new version." : "Already published. Make a change before publishing again." : null);
|
|
868
|
+
async function Oe() {
|
|
869
|
+
if (!(!e || U !== null || Pe.current)) {
|
|
870
|
+
Pe.current = !0, mt(!0), m(null);
|
|
871
|
+
try {
|
|
872
|
+
await Ye(() => Ne.mutateAsync(e));
|
|
873
|
+
} finally {
|
|
874
|
+
Pe.current = !1, mt(!1);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
We.current = (t) => t !== null && typeof t == "object" ? Rs(t, Ae) : null, xe.current = ve.autoSave;
|
|
879
|
+
const pn = O(
|
|
880
|
+
(t) => bo(t, X.current),
|
|
881
|
+
[]
|
|
882
|
+
);
|
|
883
|
+
function ue(t) {
|
|
884
|
+
if (!c) return;
|
|
885
|
+
const i = { ...c, ...t };
|
|
886
|
+
p.setJson(JSON.stringify(i, null, 2));
|
|
887
|
+
}
|
|
888
|
+
function gt(t) {
|
|
889
|
+
if (!c) return;
|
|
890
|
+
const i = { ...c, ...t };
|
|
891
|
+
m(null), p.commit(JSON.stringify(i, null, 2));
|
|
892
|
+
}
|
|
893
|
+
const X = k(c);
|
|
894
|
+
X.current = c;
|
|
895
|
+
const je = k(p.commit);
|
|
896
|
+
je.current = p.commit;
|
|
897
|
+
const bt = k(p.saveNow);
|
|
898
|
+
bt.current = p.saveNow;
|
|
899
|
+
const yt = k(p.json);
|
|
900
|
+
yt.current = p.json;
|
|
901
|
+
const vt = k(p.setJson);
|
|
902
|
+
vt.current = p.setJson, F(() => {
|
|
903
|
+
const t = (i) => {
|
|
904
|
+
i.altKey || !(i.metaKey || i.ctrlKey) || i.key.toLowerCase() !== "s" || (i.preventDefault(), !document.querySelector(".w6w-exprmodal") && K && bt.current());
|
|
905
|
+
};
|
|
906
|
+
return document.addEventListener("keydown", t), () => {
|
|
907
|
+
document.removeEventListener("keydown", t);
|
|
908
|
+
};
|
|
909
|
+
}, [K]);
|
|
910
|
+
const hn = N(
|
|
911
|
+
() => c ? Os(c) : {},
|
|
912
|
+
[c]
|
|
913
|
+
), mn = O((t) => {
|
|
914
|
+
const i = X.current;
|
|
915
|
+
if (!i) return;
|
|
916
|
+
const f = js(i, t);
|
|
917
|
+
m(null), je.current(JSON.stringify(f, null, 2));
|
|
918
|
+
}, []), gn = O(async (t) => {
|
|
919
|
+
const i = X.current;
|
|
920
|
+
if (!i) throw new Error("Workflow not loaded yet.");
|
|
921
|
+
const f = yt.current, y = { ...i, displayName: t.displayName };
|
|
922
|
+
t.key !== (i.key ?? null) && (y.key = t.key), t.tags !== void 0 && (y.tags = t.tags), ie.current = y.key ?? null, m(null);
|
|
923
|
+
try {
|
|
924
|
+
const S = await je.current(JSON.stringify(y, null, 2));
|
|
925
|
+
if (S.status === "blocked") throw new Error(S.reason);
|
|
926
|
+
if (S.status === "failed")
|
|
927
|
+
throw vt.current(f), S.error instanceof Error ? S.error : new Error(String(S.error));
|
|
928
|
+
} finally {
|
|
929
|
+
ie.current = void 0;
|
|
930
|
+
}
|
|
931
|
+
}, []), bn = O(() => ne(!0), []), wt = k(() => {
|
|
932
|
+
});
|
|
933
|
+
wt.current = (t) => {
|
|
934
|
+
P(t), l({ type: "run", id: e, runId: t });
|
|
935
|
+
};
|
|
936
|
+
const St = O((t) => wt.current(t), []), kt = k(st);
|
|
937
|
+
kt.current = st;
|
|
938
|
+
const yn = O((t) => kt.current(t), []), Nt = k(Oe);
|
|
939
|
+
Nt.current = Oe;
|
|
940
|
+
const vn = O(() => Nt.current(), []), Te = k({ saveMeta: gt, patchMeta: ue });
|
|
941
|
+
Te.current = { saveMeta: gt, patchMeta: ue };
|
|
942
|
+
const wn = O(
|
|
943
|
+
(t, i) => {
|
|
944
|
+
var f;
|
|
945
|
+
Te.current.saveMeta({
|
|
946
|
+
settings: Es((f = X.current) == null ? void 0 : f.settings, t, i)
|
|
947
|
+
});
|
|
948
|
+
},
|
|
949
|
+
[]
|
|
950
|
+
), Sn = O((t) => {
|
|
951
|
+
Te.current.patchMeta({ variables: Ps(t) });
|
|
952
|
+
}, []), [q, kn] = w(null), Rt = k(q);
|
|
953
|
+
Rt.current = q;
|
|
954
|
+
const Nn = O(
|
|
955
|
+
(t) => {
|
|
956
|
+
var i;
|
|
957
|
+
(i = Rt.current) == null || i.edit(t);
|
|
958
|
+
},
|
|
959
|
+
[]
|
|
960
|
+
), Rn = O(() => B(!0), []);
|
|
961
|
+
return ps({
|
|
962
|
+
kind: "workflow",
|
|
963
|
+
id: e,
|
|
964
|
+
connectionResources: (q == null ? void 0 : q.workflowId) === e ? { ...q, edit: Nn } : void 0,
|
|
965
|
+
label: Ue,
|
|
966
|
+
key: (c == null ? void 0 : c.key) ?? void 0,
|
|
967
|
+
triggers: H,
|
|
968
|
+
onRestoreVersion: yn,
|
|
969
|
+
definitionStatus: W,
|
|
970
|
+
onPublish: vn,
|
|
971
|
+
publishDisabled: U !== null,
|
|
972
|
+
policy: hn,
|
|
973
|
+
onPolicyChange: mn,
|
|
974
|
+
tags: Array.isArray(c == null ? void 0 : c.tags) ? c.tags : [],
|
|
975
|
+
onSettingsChange: gn,
|
|
976
|
+
hasStartingState: ae !== void 0 && Object.keys(ae).length > 0,
|
|
977
|
+
startingState: ae,
|
|
978
|
+
onOpenStartingState: bn,
|
|
979
|
+
onOpenRun: St,
|
|
980
|
+
authoringSettings: { autoSave: ve.autoSave, savePosition: ve.savePosition },
|
|
981
|
+
onAuthoringSettingChange: wn,
|
|
982
|
+
variables: sn,
|
|
983
|
+
onVariablesChange: Sn,
|
|
984
|
+
onOpenHistory: Rn
|
|
985
|
+
}), /* @__PURE__ */ b("div", { className: "wf-fullbleed", style: { height: "100%", minWidth: 0, flex: 1 }, children: [
|
|
986
|
+
(u == null ? void 0 : u.header) ?? /* @__PURE__ */ a(
|
|
987
|
+
zs,
|
|
988
|
+
{
|
|
989
|
+
onBack: () => l({ type: "list" }),
|
|
990
|
+
backLabel: (u == null ? void 0 : u.backLabel) === null ? null : (u == null ? void 0 : u.backLabel) ?? "← Workflows",
|
|
991
|
+
title: {
|
|
992
|
+
editable: !0,
|
|
993
|
+
value: Ue,
|
|
994
|
+
placeholder: fo,
|
|
995
|
+
maxLength: 80,
|
|
996
|
+
ariaLabel: "Workflow name",
|
|
997
|
+
onChange: (t) => ue({ displayName: t }),
|
|
998
|
+
onBlur: () => {
|
|
999
|
+
K && p.saveNow();
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
titleAdornment: W && /* @__PURE__ */ a(
|
|
1003
|
+
"span",
|
|
1004
|
+
{
|
|
1005
|
+
className: `badge wf-definition-status ${W}`,
|
|
1006
|
+
"data-testid": "wf-definition-status",
|
|
1007
|
+
"aria-live": "polite",
|
|
1008
|
+
title: W === "published" ? "This workflow matches the published version. Edits create a separate draft." : W === "draft" ? "You are editing a draft. The published version stays unchanged until you publish." : "You are editing a draft. This workflow has not been published.",
|
|
1009
|
+
children: W === "published" ? "Live" : "Draft"
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
actions: /* @__PURE__ */ b(ee, { children: [
|
|
1013
|
+
/* @__PURE__ */ a(
|
|
1014
|
+
fe,
|
|
1015
|
+
{
|
|
1016
|
+
icon: "play",
|
|
1017
|
+
label: es(J, Ve),
|
|
1018
|
+
"data-testid": "wf-run-start",
|
|
1019
|
+
onClick: Xt,
|
|
1020
|
+
disabled: !e || V || Ut || Qe.isPending
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
V && /* @__PURE__ */ a(
|
|
1024
|
+
fe,
|
|
1025
|
+
{
|
|
1026
|
+
icon: "stop",
|
|
1027
|
+
label: "Stop this run",
|
|
1028
|
+
"data-testid": "wf-run-stop",
|
|
1029
|
+
onClick: en,
|
|
1030
|
+
disabled: qe.isPending
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
/* @__PURE__ */ a(
|
|
1034
|
+
"button",
|
|
1035
|
+
{
|
|
1036
|
+
type: "button",
|
|
1037
|
+
className: "btn ghost",
|
|
1038
|
+
"data-testid": "wf-save",
|
|
1039
|
+
disabled: s === null || !K || !qt,
|
|
1040
|
+
onClick: p.saveNow,
|
|
1041
|
+
children: p.saving ? "Saving…" : "Save"
|
|
1042
|
+
}
|
|
1043
|
+
),
|
|
1044
|
+
Ht && /* @__PURE__ */ a("span", { className: "ok wf-saved", "aria-live": "polite", children: "Saved." }),
|
|
1045
|
+
/* @__PURE__ */ a(
|
|
1046
|
+
io,
|
|
1047
|
+
{
|
|
1048
|
+
disabled: U !== null,
|
|
1049
|
+
message: U ?? (x !== null ? "Republish this draft as a new live version" : "Publish this draft as a new live version"),
|
|
1050
|
+
children: (t) => /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a(
|
|
1051
|
+
"button",
|
|
1052
|
+
{
|
|
1053
|
+
type: "button",
|
|
1054
|
+
className: "btn ghost wf-publish",
|
|
1055
|
+
"data-testid": "wf-publish",
|
|
1056
|
+
onClick: () => void Oe(),
|
|
1057
|
+
disabled: U !== null,
|
|
1058
|
+
"aria-describedby": t,
|
|
1059
|
+
children: ht || Ne.isPending ? x !== null ? "Republishing…" : "Publishing…" : x !== null ? W === "draft" ? "Republish" : "Published" : "Publish"
|
|
1060
|
+
}
|
|
1061
|
+
) })
|
|
1062
|
+
}
|
|
1063
|
+
),
|
|
1064
|
+
/* @__PURE__ */ a(Us, { onClick: () => C(!0) }),
|
|
1065
|
+
u == null ? void 0 : u.headerActions
|
|
1066
|
+
] })
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
/* @__PURE__ */ a(ro, { problems: Ee }),
|
|
1070
|
+
Ce.show && /* @__PURE__ */ a(
|
|
1071
|
+
so,
|
|
1072
|
+
{
|
|
1073
|
+
kind: "workflow",
|
|
1074
|
+
problemCount: Ce.problemCount,
|
|
1075
|
+
canEnable: Ce.canEnable,
|
|
1076
|
+
pending: pt.isPending,
|
|
1077
|
+
onEnable: () => pt.mutate({ id: e, enabled: !0 })
|
|
1078
|
+
}
|
|
1079
|
+
),
|
|
1080
|
+
/* @__PURE__ */ a("div", { className: "wf-fullbleed-canvas", children: /* @__PURE__ */ a("div", { className: "wf-run-area", children: /* @__PURE__ */ a("div", { className: "wf-run-canvas", children: /* @__PURE__ */ a($n, { fallback: /* @__PURE__ */ a("p", { className: "muted", children: "Loading visual editor…" }), children: nn && c ? /* @__PURE__ */ a(
|
|
1081
|
+
vo,
|
|
1082
|
+
{
|
|
1083
|
+
onConnectionResourcesChange: kn,
|
|
1084
|
+
value: c,
|
|
1085
|
+
onChange: (t, i) => {
|
|
1086
|
+
p.setJson(JSON.stringify(t, null, 2)), i != null && i.viewportOnly || P(null);
|
|
1087
|
+
},
|
|
1088
|
+
apps: rn,
|
|
1089
|
+
project: s ?? void 0,
|
|
1090
|
+
height: "100%",
|
|
1091
|
+
readOnly: V,
|
|
1092
|
+
stepProblems: dn,
|
|
1093
|
+
runState: I.data,
|
|
1094
|
+
onTestRun: () => P(null),
|
|
1095
|
+
onRunFromNode: Zt
|
|
1096
|
+
},
|
|
1097
|
+
E
|
|
1098
|
+
) : $e === "" ? /* @__PURE__ */ a("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ a("p", { className: "muted", children: "Fix the JSON to render the visual editor." }) }) }) }) }),
|
|
1099
|
+
s === null && !o && /* @__PURE__ */ b("div", { role: "alert", className: "error", "data-testid": "wf-project-required", children: [
|
|
1100
|
+
"No project selected — pass a ",
|
|
1101
|
+
/* @__PURE__ */ a("code", { children: "project" }),
|
|
1102
|
+
" prop (or set the provider's project) to edit and save this workflow."
|
|
1103
|
+
] }),
|
|
1104
|
+
(ye || we) && /* @__PURE__ */ b("div", { className: "wf-fullbleed-alerts", children: [
|
|
1105
|
+
ye && /* @__PURE__ */ a("div", { className: "error", children: ye }),
|
|
1106
|
+
we && /* @__PURE__ */ a("div", { className: "error", "data-testid": "wf-key-guard", children: we })
|
|
1107
|
+
] }),
|
|
1108
|
+
/* @__PURE__ */ a(
|
|
1109
|
+
Fn,
|
|
1110
|
+
{
|
|
1111
|
+
open: Yt,
|
|
1112
|
+
onOpenChange: ze,
|
|
1113
|
+
windowClassName: "w6w-embed-root",
|
|
1114
|
+
windowTitle: `Logs · ${(c == null ? void 0 : c.displayName) || "Workflow"}`,
|
|
1115
|
+
summary: /* @__PURE__ */ a(No, { active: !!A, status: J, steps: ge }),
|
|
1116
|
+
onClear: A ? () => P(null) : void 0,
|
|
1117
|
+
children: A ? /* @__PURE__ */ b("div", { className: "wf-run-log", "data-testid": "wf-run-log", children: [
|
|
1118
|
+
/* @__PURE__ */ a(
|
|
1119
|
+
uo,
|
|
1120
|
+
{
|
|
1121
|
+
forms: Gt,
|
|
1122
|
+
labelOf: (t) => {
|
|
1123
|
+
var f;
|
|
1124
|
+
const i = (f = c == null ? void 0 : c.nodes) == null ? void 0 : f.find((y) => y.id === t);
|
|
1125
|
+
return typeof (i == null ? void 0 : i.name) == "string" ? i.name : void 0;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
),
|
|
1129
|
+
/* @__PURE__ */ a(
|
|
1130
|
+
Ln,
|
|
1131
|
+
{
|
|
1132
|
+
steps: an,
|
|
1133
|
+
runError: He.runError,
|
|
1134
|
+
stepErrors: He.stepErrors,
|
|
1135
|
+
emptyLabel: V ? "Waiting for the first step…" : void 0
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] }) : /* @__PURE__ */ a("p", { className: "muted wf-run-log-idle", children: "Run the workflow to see each step's input, output and timing here." })
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
cn && /* @__PURE__ */ a(pe, { title: "Restoring version…", onClose: () => {
|
|
1142
|
+
}, children: /* @__PURE__ */ a("div", { className: "modal-body", children: "Replacing the draft…" }) }),
|
|
1143
|
+
/* @__PURE__ */ a(
|
|
1144
|
+
Xs,
|
|
1145
|
+
{
|
|
1146
|
+
open: R,
|
|
1147
|
+
onClose: () => C(!1),
|
|
1148
|
+
title: `JSON — ${(c == null ? void 0 : c.displayName) || "workflow"}`,
|
|
1149
|
+
mode: "apply",
|
|
1150
|
+
value: $e,
|
|
1151
|
+
prepareApply: pn,
|
|
1152
|
+
onApply: (t) => {
|
|
1153
|
+
p.setJson(t), T((i) => i + 1), P(null);
|
|
1154
|
+
},
|
|
1155
|
+
editorLabel: "Workflow definition JSON"
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
p.stale && !Vt && /* @__PURE__ */ b(pe, { title: "This workflow changed on the server", onClose: () => me(!0), children: [
|
|
1159
|
+
/* @__PURE__ */ b("div", { className: "modal-body", children: [
|
|
1160
|
+
/* @__PURE__ */ a("p", { className: "muted small", children: "Someone else — another tab, another session — saved this workflow after you opened it. Your save was refused rather than applied, so their work is still intact." }),
|
|
1161
|
+
/* @__PURE__ */ b("p", { className: "muted small", children: [
|
|
1162
|
+
/* @__PURE__ */ a("strong", { children: "Reload from server" }),
|
|
1163
|
+
" replaces what is on this canvas with the saved copy; anything you changed here and have not saved is lost.",
|
|
1164
|
+
" ",
|
|
1165
|
+
/* @__PURE__ */ a("strong", { children: "Keep editing" }),
|
|
1166
|
+
" leaves your version exactly as it is — but every save will be refused the same way until you reload, so copy out anything you need first."
|
|
1167
|
+
] })
|
|
1168
|
+
] }),
|
|
1169
|
+
/* @__PURE__ */ b("div", { className: "modal-actions", children: [
|
|
1170
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn ghost", onClick: () => me(!0), children: "Keep editing" }),
|
|
1171
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn", disabled: se, onClick: tn, children: se ? "Reloading…" : "Reload from server" })
|
|
1172
|
+
] })
|
|
1173
|
+
] }),
|
|
1174
|
+
L && /* @__PURE__ */ a(
|
|
1175
|
+
Ys,
|
|
1176
|
+
{
|
|
1177
|
+
kind: "workflow",
|
|
1178
|
+
id: e,
|
|
1179
|
+
onClose: () => B(!1),
|
|
1180
|
+
onOpenRun: St
|
|
1181
|
+
}
|
|
1182
|
+
),
|
|
1183
|
+
te && /* @__PURE__ */ a(
|
|
1184
|
+
lo,
|
|
1185
|
+
{
|
|
1186
|
+
initialState: ae,
|
|
1187
|
+
onChange: (t) => ue({ initialState: t }),
|
|
1188
|
+
onClose: () => ne(!1)
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
] });
|
|
1192
|
+
}
|
|
1193
|
+
function So({
|
|
1194
|
+
children: n,
|
|
1195
|
+
callableHref: e
|
|
1196
|
+
}) {
|
|
1197
|
+
const s = $t(), o = Wt(), r = Wn(qs), l = N(() => ({
|
|
1198
|
+
...s,
|
|
1199
|
+
saveStepTest: (...g) => s.saveStepTest(...g).finally(() => {
|
|
1200
|
+
o.invalidateQueries({ queryKey: Me(g[0], g[1]) });
|
|
1201
|
+
}),
|
|
1202
|
+
recordStepTestRun: (...g) => s.recordStepTestRun(...g).finally(() => {
|
|
1203
|
+
o.invalidateQueries({ queryKey: Me(g[0], g[1]) });
|
|
1204
|
+
}),
|
|
1205
|
+
callableHref: e ?? s.callableHref
|
|
1206
|
+
}), [s, o, e]);
|
|
1207
|
+
return /* @__PURE__ */ a(jn, { api: l, theme: r, children: n });
|
|
1208
|
+
}
|
|
1209
|
+
const ko = () => {
|
|
1210
|
+
};
|
|
1211
|
+
function No({
|
|
1212
|
+
active: n,
|
|
1213
|
+
status: e,
|
|
1214
|
+
steps: s
|
|
1215
|
+
}) {
|
|
1216
|
+
if (!n) return /* @__PURE__ */ a("span", { children: "No run yet" });
|
|
1217
|
+
const o = s.filter((d) => d.startedAt), r = o.map((d) => Date.parse(d.startedAt)).filter(Number.isFinite), l = s.map((d) => d.finishedAt ? Date.parse(d.finishedAt) : Number.NaN).filter(Number.isFinite), u = r.length > 0 && l.length > 0 ? Math.max(...l) - Math.min(...r) : null;
|
|
1218
|
+
return /* @__PURE__ */ b(ee, { children: [
|
|
1219
|
+
/* @__PURE__ */ a(Dn, { state: e ?? "queued" }),
|
|
1220
|
+
/* @__PURE__ */ b("span", { children: [
|
|
1221
|
+
o.length,
|
|
1222
|
+
" ",
|
|
1223
|
+
o.length === 1 ? "step" : "steps"
|
|
1224
|
+
] }),
|
|
1225
|
+
u !== null && u >= 0 && /* @__PURE__ */ a("span", { children: Jn(u) })
|
|
1226
|
+
] });
|
|
1227
|
+
}
|
|
1228
|
+
function Yo(n) {
|
|
1229
|
+
const { workflowId: e, initialRunId: s, onNavigate: o = ko, slots: r } = n, l = Ts(n.project), u = Is().status, d = n.project === void 0 && u === "resolving", g = O(
|
|
1230
|
+
(h) => {
|
|
1231
|
+
h.type === "list" ? o({ type: "list" }) : h.kind === "workflow" && o({ type: "workflow", id: h.id });
|
|
1232
|
+
},
|
|
1233
|
+
[o]
|
|
1234
|
+
);
|
|
1235
|
+
return /* @__PURE__ */ a(
|
|
1236
|
+
"div",
|
|
1237
|
+
{
|
|
1238
|
+
className: "w6w-embed-root",
|
|
1239
|
+
style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
|
|
1240
|
+
children: /* @__PURE__ */ a(
|
|
1241
|
+
oo,
|
|
1242
|
+
{
|
|
1243
|
+
project: l,
|
|
1244
|
+
onNavigate: g,
|
|
1245
|
+
rail: n.rail,
|
|
1246
|
+
storageKey: l === null ? null : `w6w.rail.embed.${l}`,
|
|
1247
|
+
children: /* @__PURE__ */ a(So, { callableHref: n.callableHref, children: /* @__PURE__ */ a(
|
|
1248
|
+
wo,
|
|
1249
|
+
{
|
|
1250
|
+
workflowId: e,
|
|
1251
|
+
project: l,
|
|
1252
|
+
projectPending: d,
|
|
1253
|
+
initialRunId: s,
|
|
1254
|
+
onNavigate: o,
|
|
1255
|
+
slots: r
|
|
1256
|
+
}
|
|
1257
|
+
) })
|
|
1258
|
+
}
|
|
1259
|
+
)
|
|
1260
|
+
}
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
export {
|
|
1264
|
+
so as B,
|
|
1265
|
+
zs as E,
|
|
1266
|
+
Ys as H,
|
|
1267
|
+
Xs as J,
|
|
1268
|
+
Yo as W,
|
|
1269
|
+
oo as a,
|
|
1270
|
+
Us as b
|
|
1271
|
+
};
|
|
1272
|
+
//# sourceMappingURL=WorkflowEditor-CxTuK8_d.js.map
|