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