@w6w/embed 0.2.1 → 0.2.11
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/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
- package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
- package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
- package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
- package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
- package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
- package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
- package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
- package/dist/ModelRoutesManager-BGESQahw.js +345 -0
- package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
- package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
- package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
- package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
- package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
- package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
- package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
- package/dist/chrome/ConfirmModal.d.ts +4 -1
- package/dist/chrome/workspace.d.ts +4 -0
- package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
- package/dist/coerce-input-DttlcSdO.js.map +1 -0
- package/dist/connections-D7cgXhDS.js +119 -0
- package/dist/connections-D7cgXhDS.js.map +1 -0
- package/dist/credentials-DaQU3Ca_.js +171 -0
- package/dist/credentials-DaQU3Ca_.js.map +1 -0
- package/dist/document-sources-UCwe8x77.js +91 -0
- package/dist/document-sources-UCwe8x77.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/BindingBanner.d.ts +13 -0
- package/dist/editor/CallableEditorFrame.d.ts +7 -0
- package/dist/editor/EndpointCards.d.ts +4 -1
- package/dist/editor/PublishControl.d.ts +19 -0
- package/dist/editor/TargetSelector.d.ts +15 -0
- package/dist/editor/TargetSelector.types.d.ts +2 -0
- package/dist/editor/definition.d.ts +2 -0
- package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
- package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
- package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
- package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +768 -621
- package/dist/editors.mjs.map +1 -1
- package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
- package/dist/endpoints-DSRo1Lc5.js.map +1 -0
- package/dist/fields-DvS8XZFc.js +21 -0
- package/dist/fields-DvS8XZFc.js.map +1 -0
- package/dist/forms/ModelBudgetsManager.d.ts +9 -0
- package/dist/forms/ModelRoutesManager.d.ts +14 -0
- package/dist/forms.d.ts +4 -0
- package/dist/forms.mjs +611 -212
- package/dist/forms.mjs.map +1 -1
- package/dist/index.mjs +119 -112
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +38 -0
- package/dist/lib/code-rail.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/invoke-error.d.ts +1 -0
- package/dist/lib/sdk-snippets.d.ts +1 -1
- package/dist/lib/target-fields.d.ts +8 -0
- package/dist/lib/trigger-preview.d.ts +1 -0
- package/dist/lib/workflow-live-run.d.ts +9 -2
- package/dist/lib/workflow-nodes.d.ts +5 -0
- package/dist/lib/workflow-validity.d.ts +1 -0
- package/dist/lib.mjs +72 -70
- package/dist/lists/ConnectionDependents.d.ts +31 -0
- package/dist/lists/ConnectionDetail.d.ts +4 -1
- package/dist/lists/ConnectionList.d.ts +4 -1
- package/dist/lists/CredentialDetail.d.ts +15 -0
- package/dist/lists/CredentialList.d.ts +14 -0
- package/dist/lists/ModelCatalog.d.ts +12 -0
- package/dist/lists/ModelUsage.d.ts +12 -0
- package/dist/lists.d.ts +8 -0
- package/dist/lists.mjs +1322 -604
- package/dist/lists.mjs.map +1 -1
- package/dist/models-bAayQPJ_.js +270 -0
- package/dist/models-bAayQPJ_.js.map +1 -0
- package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
- package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
- package/dist/rail.mjs +4 -4
- package/dist/repos/agents-studio-agents.d.ts +52 -0
- package/dist/repos/agents-studio-assets.d.ts +68 -0
- package/dist/repos/connections.d.ts +30 -12
- package/dist/repos/credentials.d.ts +83 -0
- package/dist/repos/endpoints.d.ts +9 -3
- package/dist/repos/fields.d.ts +34 -0
- package/dist/repos/functions.d.ts +7 -5
- package/dist/repos/index.d.ts +5 -0
- package/dist/repos/models.d.ts +289 -0
- package/dist/repos.mjs +613 -176
- package/dist/repos.mjs.map +1 -1
- package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
- package/dist/slug-BVdgiP_L.js.map +1 -0
- package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
- package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
- package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
- package/dist/spec-import-CW6R_Wk1.js.map +1 -0
- package/dist/theme-context-E2ZhlXDX.js +6 -0
- package/dist/theme-context-E2ZhlXDX.js.map +1 -0
- package/dist/theme-context.d.ts +2 -0
- package/dist/trigger-preview-DKxfjzUY.js +145 -0
- package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
- package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
- package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
- package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
- package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
- package/package.json +1 -1
- package/src/styles.css +2 -6
- package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
- package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
- package/dist/coerce-input-BicYr7nc.js.map +0 -1
- package/dist/connections-CjjYeRqb.js +0 -78
- package/dist/connections-CjjYeRqb.js.map +0 -1
- package/dist/document-sources-C0grrtdq.js +0 -86
- package/dist/document-sources-C0grrtdq.js.map +0 -1
- package/dist/editor-tools-RxmY5iyi.js.map +0 -1
- package/dist/endpoints-B2ynbZo-.js.map +0 -1
- package/dist/slug-C4ktDPdy.js.map +0 -1
- package/dist/spec-import-CjmxyZDR.js.map +0 -1
- package/dist/trigger-preview-VPkrryDl.js +0 -120
- package/dist/trigger-preview-VPkrryDl.js.map +0 -1
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var Rt = (r, a, o) => a in r ? Et(r, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[a] = o;
|
|
3
|
+
var Ze = (r, a, o) => Rt(r, typeof a != "symbol" ? a + "" : a, o);
|
|
4
|
+
import { jsxs as c, jsx as t, Fragment as B } from "react/jsx-runtime";
|
|
5
|
+
import { useQueryClient as st, useQueries as oe } from "@tanstack/react-query";
|
|
6
|
+
import { ApiError as re } from "@w6w/sdk";
|
|
7
|
+
import { Modal as Pt, IconButton as L, JsonEditor as xt, useExpressionOptions as It, ExpressionOptionsProvider as At, ExpressionInput as Tt, useW6WApi as ot, W6WUIProvider as Ft, isTestRequired as Xe, requiredParamsFilled as Lt, ExecutionLogPanel as Kt } from "@w6w/ui";
|
|
8
|
+
import { useState as w, Component as Mt, useRef as R, useEffect as A, createElement as ie, useCallback as le, useContext as Wt, useMemo as v, Suspense as qt, lazy as Bt } from "react";
|
|
9
|
+
import { i as Vt, c as Ot } from "./apps-CboASBKr.js";
|
|
10
|
+
import { E as $t, W as jt, K as Dt, Q as Ht, q as Jt, t as Qt, z as _t, y as zt, x as Gt, w as Yt, d as Ut } from "./spec-import-CW6R_Wk1.js";
|
|
11
|
+
import { H as Zt, u as Xt } from "./editor-apps-BUZWld-m.js";
|
|
12
|
+
import { M as de } from "./ConfirmModal-BE-SdX-O.js";
|
|
13
|
+
import { c as en, W as tn, e as nn, R as an, P as sn, b as on, d as rn } from "./editor-tools-B_Lfx3kw.js";
|
|
14
|
+
import { u as ln } from "./client-context-CX61Bgw-.js";
|
|
15
|
+
import { u as cn } from "./use-workflow-draft-DzAyUeA6.js";
|
|
16
|
+
import { a as dn, j as un, r as hn, c as fn, l as pn, h as mn, f as bn, d as yn, w as vn, i as et, v as gn, k as wn } from "./trigger-preview-DKxfjzUY.js";
|
|
17
|
+
import { w as tt } from "./rail-settings-XYGToh00.js";
|
|
18
|
+
import { p as kn, d as Nn } from "./settings-rail--GdRMusb.js";
|
|
19
|
+
import { u as Sn } from "./project-context-Tvp-La7A.js";
|
|
20
|
+
import { j as Cn, e as nt } from "./connections-D7cgXhDS.js";
|
|
21
|
+
import { f as En, a as Rn, c as Pn } from "./spec-export-CBbloO_n.js";
|
|
22
|
+
import { l as at, a as ce } from "./step-tests-CivICmTq.js";
|
|
23
|
+
import { E as xn } from "./theme-context-E2ZhlXDX.js";
|
|
24
|
+
function In({ title: r }) {
|
|
25
|
+
const { value: a, placeholder: o, maxLength: i, ariaLabel: h, onChange: d, onBlur: p } = r;
|
|
26
|
+
return /* @__PURE__ */ t(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
className: "wf-title-input",
|
|
30
|
+
value: a,
|
|
31
|
+
placeholder: o,
|
|
32
|
+
maxLength: i,
|
|
33
|
+
size: Math.min(Math.max(a.length, o.length), 80),
|
|
34
|
+
"aria-label": h,
|
|
35
|
+
onChange: (u) => d(u.target.value),
|
|
36
|
+
onBlur: p
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function An({
|
|
41
|
+
onBack: r,
|
|
42
|
+
backLabel: a,
|
|
43
|
+
title: o,
|
|
44
|
+
titleAdornment: i,
|
|
45
|
+
actions: h
|
|
46
|
+
}) {
|
|
47
|
+
return /* @__PURE__ */ c("div", { className: "wf-fullbleed-head", children: [
|
|
48
|
+
/* @__PURE__ */ t(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
className: "muted wf-back-btn",
|
|
53
|
+
"data-testid": "wf-editor-back",
|
|
54
|
+
onClick: r,
|
|
55
|
+
children: a
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
o.editable ? /* @__PURE__ */ t(In, { title: o }) : /* @__PURE__ */ c("h2", { className: "exec-profile-title", children: [
|
|
59
|
+
o.value,
|
|
60
|
+
" ",
|
|
61
|
+
i
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ t("div", { className: "wf-head-actions", style: { marginLeft: "auto" }, children: h })
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
function Tn(r, a, o) {
|
|
67
|
+
if (!(r !== "workflow" || a === void 0))
|
|
68
|
+
return (i) => {
|
|
69
|
+
o(), a(i.id);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function Fn(r) {
|
|
73
|
+
const { kind: a, id: o, onClose: i, onOpenRun: h } = r, [d, p] = w($t), u = Tn(a, h, i);
|
|
74
|
+
return /* @__PURE__ */ t(
|
|
75
|
+
Pt,
|
|
76
|
+
{
|
|
77
|
+
size: "full",
|
|
78
|
+
title: "History",
|
|
79
|
+
subtitle: o,
|
|
80
|
+
onClose: i,
|
|
81
|
+
headerRight: /* @__PURE__ */ t(L, { icon: "close", label: "Close", onClick: i }),
|
|
82
|
+
children: /* @__PURE__ */ t("div", { className: "w6w-modal-body", children: /* @__PURE__ */ t(
|
|
83
|
+
Zt,
|
|
84
|
+
{
|
|
85
|
+
scope: { callable: o },
|
|
86
|
+
showKind: !1,
|
|
87
|
+
filters: d,
|
|
88
|
+
onFiltersChange: p,
|
|
89
|
+
onOpenInEditor: u
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function rt({
|
|
96
|
+
hasExecuted: r,
|
|
97
|
+
onClick: a,
|
|
98
|
+
buttonRef: o
|
|
99
|
+
}) {
|
|
100
|
+
return /* @__PURE__ */ t(
|
|
101
|
+
L,
|
|
102
|
+
{
|
|
103
|
+
ref: o,
|
|
104
|
+
icon: "history",
|
|
105
|
+
"data-testid": "history-button",
|
|
106
|
+
label: "Execution history",
|
|
107
|
+
title: r ? "Execution history" : "No executions yet",
|
|
108
|
+
disabled: !r,
|
|
109
|
+
onClick: a
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function Ln({ kind: r, id: a, onOpenRun: o }) {
|
|
114
|
+
const { hasExecuted: i } = Vt(a), [h, d] = w(!1), p = R(null), u = R(!1);
|
|
115
|
+
return A(() => {
|
|
116
|
+
var C;
|
|
117
|
+
u.current && !h && ((C = p.current) == null || C.focus()), u.current = h;
|
|
118
|
+
}, [h]), /* @__PURE__ */ c(B, { children: [
|
|
119
|
+
/* @__PURE__ */ t(
|
|
120
|
+
rt,
|
|
121
|
+
{
|
|
122
|
+
hasExecuted: i,
|
|
123
|
+
buttonRef: p,
|
|
124
|
+
onClick: () => d(!0)
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
h && /* @__PURE__ */ t(Fn, { kind: r, id: a, onClose: () => d(!1), onOpenRun: o })
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
class Kn extends Mt {
|
|
131
|
+
constructor() {
|
|
132
|
+
super(...arguments);
|
|
133
|
+
Ze(this, "state", { failed: !1 });
|
|
134
|
+
}
|
|
135
|
+
static getDerivedStateFromError() {
|
|
136
|
+
return { failed: !0 };
|
|
137
|
+
}
|
|
138
|
+
componentDidCatch(o) {
|
|
139
|
+
console.error("history probe answer was unreadable; disabling the button", o);
|
|
140
|
+
}
|
|
141
|
+
render() {
|
|
142
|
+
return this.state.failed ? /* @__PURE__ */ t(rt, { hasExecuted: !1, onClick: () => {
|
|
143
|
+
} }) : this.props.children;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function Mn(r) {
|
|
147
|
+
return /* @__PURE__ */ t(Kn, { children: /* @__PURE__ */ t(Ln, { ...r }) });
|
|
148
|
+
}
|
|
149
|
+
function Wn(r) {
|
|
150
|
+
return /* @__PURE__ */ t(L, { icon: "json", onClick: r.onClick, label: "Edit raw JSON definition" });
|
|
151
|
+
}
|
|
152
|
+
function qn(r) {
|
|
153
|
+
const {
|
|
154
|
+
open: a,
|
|
155
|
+
onClose: o,
|
|
156
|
+
title: i,
|
|
157
|
+
mode: h,
|
|
158
|
+
value: d,
|
|
159
|
+
onChange: p,
|
|
160
|
+
onValidityChange: u,
|
|
161
|
+
invalidReason: C,
|
|
162
|
+
guard: P,
|
|
163
|
+
onSave: V,
|
|
164
|
+
saving: E,
|
|
165
|
+
error: K,
|
|
166
|
+
editorLabel: N
|
|
167
|
+
} = r;
|
|
168
|
+
if (!a) return null;
|
|
169
|
+
const b = (P == null ? void 0 : P(d)) ?? null;
|
|
170
|
+
return /* @__PURE__ */ c(de, { title: i, onClose: o, wide: !0, children: [
|
|
171
|
+
/* @__PURE__ */ c("div", { className: "modal-body", children: [
|
|
172
|
+
/* @__PURE__ */ t("p", { className: "muted small", children: h === "synced" ? /* @__PURE__ */ c(B, { children: [
|
|
173
|
+
"Edit the raw definition (",
|
|
174
|
+
/* @__PURE__ */ t("code", { children: 'manifestVersion: "2"' }),
|
|
175
|
+
"). Changes sync live to the visual editor."
|
|
176
|
+
] }) : "Save replaces the stored definition." }),
|
|
177
|
+
/* @__PURE__ */ t(
|
|
178
|
+
xt,
|
|
179
|
+
{
|
|
180
|
+
value: d,
|
|
181
|
+
onChange: p,
|
|
182
|
+
onValidityChange: ({ valid: y, error: m }) => u == null ? void 0 : u({ valid: y, error: m ?? null }),
|
|
183
|
+
minHeight: "420px",
|
|
184
|
+
"aria-label": N
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
b && /* @__PURE__ */ t("p", { className: "muted small", "data-testid": "json-toggle-reason", children: b }),
|
|
188
|
+
C && /* @__PURE__ */ c("div", { className: "muted small", children: [
|
|
189
|
+
"Invalid JSON — ",
|
|
190
|
+
C
|
|
191
|
+
] }),
|
|
192
|
+
K && /* @__PURE__ */ t("div", { className: "error", children: K })
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ t("div", { className: "modal-actions", children: h === "synced" ? /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: o, children: "Done" }) : /* @__PURE__ */ c(B, { children: [
|
|
195
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: o, children: "Cancel" }),
|
|
196
|
+
/* @__PURE__ */ t(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
type: "button",
|
|
200
|
+
className: "btn",
|
|
201
|
+
"data-testid": "json-toggle-save",
|
|
202
|
+
disabled: b != null || !!E,
|
|
203
|
+
onClick: V,
|
|
204
|
+
children: E ? "Saving…" : "Save"
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] }) })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
function Bn(r) {
|
|
211
|
+
const { kind: a, problemCount: o, canEnable: i, onEnable: h, pending: d } = r, p = o > 0 ? `This ${a} 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.";
|
|
212
|
+
return ie(
|
|
213
|
+
"div",
|
|
214
|
+
{ role: "alert", className: "error", "data-testid": "binding-disabled-banner" },
|
|
215
|
+
ie("span", null, p),
|
|
216
|
+
" ",
|
|
217
|
+
ie(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
type: "button",
|
|
221
|
+
"data-testid": "binding-enable",
|
|
222
|
+
disabled: !i || d === !0,
|
|
223
|
+
onClick: h
|
|
224
|
+
},
|
|
225
|
+
"Enable"
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
function Vn({
|
|
230
|
+
project: r,
|
|
231
|
+
onNavigate: a,
|
|
232
|
+
rail: o = !0,
|
|
233
|
+
storageKey: i,
|
|
234
|
+
tools: h = nn,
|
|
235
|
+
children: d
|
|
236
|
+
}) {
|
|
237
|
+
const p = en(), u = /* @__PURE__ */ t(an, { project: r, onNavigate: a, children: /* @__PURE__ */ c(sn, { project: r, children: [
|
|
238
|
+
d,
|
|
239
|
+
o && /* @__PURE__ */ t(on, { tools: h, storageKey: i })
|
|
240
|
+
] }) });
|
|
241
|
+
return o || !p ? /* @__PURE__ */ t(tn, { children: u }) : u;
|
|
242
|
+
}
|
|
243
|
+
const On = ["string", "number", "boolean", "object", "array"];
|
|
244
|
+
function $n(r) {
|
|
245
|
+
const { autoSave: a, savePosition: o, variables: i, onClose: h, onChange: d, onVariablesChange: p } = r, u = It().vars ?? [], [C, P] = w("general");
|
|
246
|
+
function V() {
|
|
247
|
+
p([...i, { key: "" }]);
|
|
248
|
+
}
|
|
249
|
+
function E(b, y) {
|
|
250
|
+
p(i.map((m, j) => j === b ? { ...m, ...y } : m));
|
|
251
|
+
}
|
|
252
|
+
function K(b) {
|
|
253
|
+
p(i.filter((y, m) => m !== b));
|
|
254
|
+
}
|
|
255
|
+
const N = dn(i);
|
|
256
|
+
return /* @__PURE__ */ c(de, { title: "Workflow settings", onClose: h, wide: !0, children: [
|
|
257
|
+
/* @__PURE__ */ c("div", { className: "w6w-subtabs", children: [
|
|
258
|
+
/* @__PURE__ */ t(
|
|
259
|
+
"button",
|
|
260
|
+
{
|
|
261
|
+
type: "button",
|
|
262
|
+
className: `w6w-subtab${C === "general" ? " active" : ""}`,
|
|
263
|
+
onClick: () => P("general"),
|
|
264
|
+
children: "General"
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ t(
|
|
268
|
+
"button",
|
|
269
|
+
{
|
|
270
|
+
type: "button",
|
|
271
|
+
className: `w6w-subtab${C === "variables" ? " active" : ""}`,
|
|
272
|
+
onClick: () => P("variables"),
|
|
273
|
+
children: "Variables"
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] }),
|
|
277
|
+
C === "general" ? /* @__PURE__ */ c(B, { children: [
|
|
278
|
+
/* @__PURE__ */ c("div", { className: "modal-body", children: [
|
|
279
|
+
/* @__PURE__ */ t("p", { className: "muted small", children: "These settings belong to the workflow, so everyone who opens it gets the same behaviour. Both are on unless you turn them off; each change saves straight away." }),
|
|
280
|
+
/* @__PURE__ */ c(
|
|
281
|
+
"label",
|
|
282
|
+
{
|
|
283
|
+
style: {
|
|
284
|
+
display: "flex",
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
gap: "var(--w6w-sp-2)",
|
|
287
|
+
cursor: "pointer"
|
|
288
|
+
},
|
|
289
|
+
title: "Save edits as you make them, without pressing Save.",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ t(
|
|
292
|
+
"input",
|
|
293
|
+
{
|
|
294
|
+
type: "checkbox",
|
|
295
|
+
checked: a,
|
|
296
|
+
onChange: (b) => d("autoSave", b.target.checked)
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: "Auto-save edits" })
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ c(
|
|
304
|
+
"label",
|
|
305
|
+
{
|
|
306
|
+
style: {
|
|
307
|
+
display: "flex",
|
|
308
|
+
alignItems: "center",
|
|
309
|
+
gap: "var(--w6w-sp-2)",
|
|
310
|
+
cursor: "pointer"
|
|
311
|
+
},
|
|
312
|
+
title: "Keep the arrangement of the canvas — where each node sits, and the view you left it at.",
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ t(
|
|
315
|
+
"input",
|
|
316
|
+
{
|
|
317
|
+
type: "checkbox",
|
|
318
|
+
checked: o,
|
|
319
|
+
onChange: (b) => d("savePosition", b.target.checked)
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: "Save node positions and canvas view" })
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
] }),
|
|
327
|
+
/* @__PURE__ */ t("div", { className: "modal-actions", children: /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: h, children: "Done" }) })
|
|
328
|
+
] }) : /* @__PURE__ */ c(B, { children: [
|
|
329
|
+
/* @__PURE__ */ c("div", { className: "modal-body", children: [
|
|
330
|
+
/* @__PURE__ */ c("p", { className: "muted small", children: [
|
|
331
|
+
"Declaring variables here defines this workflow's ",
|
|
332
|
+
/* @__PURE__ */ t("strong", { children: "public input schema" }),
|
|
333
|
+
": API and AI (MCP) callers then see exactly these inputs. With none declared, they may send anything."
|
|
334
|
+
] }),
|
|
335
|
+
/* @__PURE__ */ c("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
|
|
336
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: i.length === 0 ? "No variables declared." : `${i.length} variable${i.length === 1 ? "" : "s"} declared.` }),
|
|
337
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: V, children: "+ Add variable" })
|
|
338
|
+
] }),
|
|
339
|
+
i.length > 0 && /* @__PURE__ */ t("ul", { className: "list", "data-testid": "workflow-variables-list", children: i.map((b, y) => /* @__PURE__ */ c(
|
|
340
|
+
"li",
|
|
341
|
+
{
|
|
342
|
+
style: {
|
|
343
|
+
flexDirection: "column",
|
|
344
|
+
alignItems: "stretch",
|
|
345
|
+
gap: "var(--w6w-sp-1)"
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ c("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: [
|
|
349
|
+
/* @__PURE__ */ t(
|
|
350
|
+
"input",
|
|
351
|
+
{
|
|
352
|
+
type: "text",
|
|
353
|
+
value: b.key,
|
|
354
|
+
placeholder: "key",
|
|
355
|
+
"aria-label": "Variable key",
|
|
356
|
+
onChange: (m) => E(y, { key: m.target.value })
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ c(
|
|
360
|
+
"select",
|
|
361
|
+
{
|
|
362
|
+
value: b.type ?? "",
|
|
363
|
+
"aria-label": "Variable type",
|
|
364
|
+
onChange: (m) => E(y, {
|
|
365
|
+
type: m.target.value || void 0
|
|
366
|
+
}),
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ t("option", { value: "", children: "(unset)" }),
|
|
369
|
+
On.map((m) => /* @__PURE__ */ t("option", { value: m, children: m }, m))
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ c(
|
|
374
|
+
"label",
|
|
375
|
+
{
|
|
376
|
+
className: "row",
|
|
377
|
+
style: { gap: "var(--w6w-sp-1)", alignItems: "center" },
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ t(
|
|
380
|
+
"input",
|
|
381
|
+
{
|
|
382
|
+
type: "checkbox",
|
|
383
|
+
checked: b.required ?? !1,
|
|
384
|
+
onChange: (m) => E(y, { required: m.target.checked })
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: "required" })
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ t(
|
|
392
|
+
At,
|
|
393
|
+
{
|
|
394
|
+
value: { vars: un(i, y, u) },
|
|
395
|
+
children: /* @__PURE__ */ t(
|
|
396
|
+
Tt,
|
|
397
|
+
{
|
|
398
|
+
value: b.default,
|
|
399
|
+
onChange: (m) => E(y, { default: m }),
|
|
400
|
+
placeholder: "default",
|
|
401
|
+
"aria-label": "Variable default"
|
|
402
|
+
},
|
|
403
|
+
`${i.length}:${y}`
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ t(
|
|
408
|
+
L,
|
|
409
|
+
{
|
|
410
|
+
danger: !0,
|
|
411
|
+
icon: "close",
|
|
412
|
+
label: `Remove variable ${b.key || y + 1}`,
|
|
413
|
+
onClick: () => K(y)
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
] }),
|
|
417
|
+
N.includes(y) && /* @__PURE__ */ t("span", { className: "muted small", "data-testid": "variable-duplicate", children: "Duplicate key — a later row with the same name wins." })
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
y
|
|
421
|
+
)) })
|
|
422
|
+
] }),
|
|
423
|
+
/* @__PURE__ */ t("div", { className: "modal-actions", children: /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: h, children: "Done" }) })
|
|
424
|
+
] })
|
|
425
|
+
] });
|
|
426
|
+
}
|
|
427
|
+
const jn = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, Dn = "Untitled workflow", Hn = Bt(
|
|
428
|
+
() => import("@w6w/ui/flow").then((r) => ({ default: r.WorkflowFlowEditor }))
|
|
429
|
+
);
|
|
430
|
+
function Jn(r) {
|
|
431
|
+
var Qe, _e, ze, Ge, Ye;
|
|
432
|
+
const { workflowId: a, project: o, initialRunId: i, onNavigate: h, slots: d } = r, p = ln(), u = ot(), [C, P] = w(!0), [V, E] = w(null), [K, N] = w(null), [b, y] = w(!1), [m, j] = w(!1), [ue, he] = w(!1), [D, fe] = w(void 0), pe = R(!0), me = R(() => null), it = le(
|
|
433
|
+
(e) => {
|
|
434
|
+
const n = e;
|
|
435
|
+
return jn.test(typeof n.id == "string" ? n.id : "") ? tt(D, n.key).reason : "Invalid workflow id.";
|
|
436
|
+
},
|
|
437
|
+
[D]
|
|
438
|
+
), l = cn({
|
|
439
|
+
workflowId: a,
|
|
440
|
+
project: o,
|
|
441
|
+
autoSave: pe.current,
|
|
442
|
+
// The expression editor holds uncommitted parts in its own local state until its Save
|
|
443
|
+
// button, so saving from under it would persist a workflow without the expression the user
|
|
444
|
+
// is looking at. Read at fire time (opening it changes neither the buffer nor `canSave`).
|
|
445
|
+
canAutoSave: () => !document.querySelector(".w6w-exprmodal"),
|
|
446
|
+
saveGuard: it,
|
|
447
|
+
publishBlockedReason: (e) => me.current(e)
|
|
448
|
+
}), be = l.json, s = l.parsed, M = l.canSave, lt = l.dirty;
|
|
449
|
+
A(() => {
|
|
450
|
+
if (l.loading || l.loadError !== null) {
|
|
451
|
+
fe(void 0);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
!l.dirty && s && fe(s.key ?? null);
|
|
455
|
+
}, [l.loading, l.loadError, l.dirty, s]);
|
|
456
|
+
const [ct, Y] = w(!1);
|
|
457
|
+
A(() => {
|
|
458
|
+
l.stale || Y(!1);
|
|
459
|
+
}, [l.stale]);
|
|
460
|
+
const [dt, ye] = w(!1), ve = R(!1);
|
|
461
|
+
A(() => {
|
|
462
|
+
l.saving ? ye(!1) : ve.current && l.error === null && ye(!0), ve.current = l.saving;
|
|
463
|
+
}, [l.saving, l.error]);
|
|
464
|
+
const [O, x] = w(null), ge = jt(), we = Dt(), T = Ht(O), ke = (Qe = T.data) == null ? void 0 : Qe.status, Ne = T.isError, H = Jt(ke, Ne), Se = Qt(_t(T.data)), Ce = zt(T.data, Se), U = R(!1), [ut, Ee] = w(!1);
|
|
465
|
+
A(() => {
|
|
466
|
+
x(null);
|
|
467
|
+
}, [a]), A(() => {
|
|
468
|
+
i && x(i);
|
|
469
|
+
}, [a, i]), A(() => {
|
|
470
|
+
T.data && T.data.workflowId !== a && x(null);
|
|
471
|
+
}, [T.data, a]);
|
|
472
|
+
async function Re(e) {
|
|
473
|
+
try {
|
|
474
|
+
const n = await l.flushThen(e);
|
|
475
|
+
!n.ok && n.outcome.status === "blocked" && N(n.outcome.reason);
|
|
476
|
+
} catch (n) {
|
|
477
|
+
N(n instanceof re ? n.message : String(n));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
async function ht() {
|
|
481
|
+
var e;
|
|
482
|
+
if (!(!a || H || U.current)) {
|
|
483
|
+
N(null), U.current = !0, Ee(!0);
|
|
484
|
+
try {
|
|
485
|
+
const n = await Yt(
|
|
486
|
+
(e = Q == null ? void 0 : Q[0]) == null ? void 0 : e.id,
|
|
487
|
+
(f) => at(p, a, f)
|
|
488
|
+
);
|
|
489
|
+
await Re(
|
|
490
|
+
() => ge.mutateAsync({
|
|
491
|
+
id: a,
|
|
492
|
+
variables: {},
|
|
493
|
+
...n ? { input: n } : {}
|
|
494
|
+
}).then((f) => x(f.runId))
|
|
495
|
+
);
|
|
496
|
+
} finally {
|
|
497
|
+
U.current = !1, Ee(!1);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function ft() {
|
|
502
|
+
O && (we.mutate(O, {
|
|
503
|
+
onError: (e) => {
|
|
504
|
+
const n = e instanceof re ? e.code : "";
|
|
505
|
+
Ut(n) === "surface" && N(e instanceof re ? e.message : String(e));
|
|
506
|
+
}
|
|
507
|
+
}), x(null));
|
|
508
|
+
}
|
|
509
|
+
async function pt() {
|
|
510
|
+
he(!0);
|
|
511
|
+
try {
|
|
512
|
+
await l.reload(), P(!0), E(null), N(null);
|
|
513
|
+
} finally {
|
|
514
|
+
he(!1);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const J = l.stale ? null : l.error ?? l.loadError, Pe = K ?? (J === null ? null : J instanceof Error ? J.message : String(J)), mt = s !== null && (Array.isArray(s.nodes) || Array.isArray(s.steps)), xe = (s == null ? void 0 : s.displayName) ?? "", Z = hn(s == null ? void 0 : s.settings), bt = v(() => fn(s == null ? void 0 : s.variables), [s == null ? void 0 : s.variables]), Ie = tt(D, s == null ? void 0 : s.key), Ae = s !== null && D !== void 0 && !Ie.allowed ? Ie.reason : null, S = v(
|
|
518
|
+
() => pn(s),
|
|
519
|
+
[s]
|
|
520
|
+
), [k, yt] = w(null);
|
|
521
|
+
A(() => {
|
|
522
|
+
let e = !1;
|
|
523
|
+
return import("@w6w/ui/flow").then((n) => {
|
|
524
|
+
e || yt({
|
|
525
|
+
internalNodes: n.INTERNAL_NODES,
|
|
526
|
+
isInternalApp: n.isInternalApp,
|
|
527
|
+
internalNodeParams: n.internalNodeParams,
|
|
528
|
+
isManualTrigger: (f) => f === n.TRIGGER_APP,
|
|
529
|
+
asFieldDefs: n.asFieldDefs
|
|
530
|
+
});
|
|
531
|
+
}), () => {
|
|
532
|
+
e = !0;
|
|
533
|
+
};
|
|
534
|
+
}, []);
|
|
535
|
+
const Q = v(() => {
|
|
536
|
+
if (k)
|
|
537
|
+
return mn(
|
|
538
|
+
{ steps: S },
|
|
539
|
+
{
|
|
540
|
+
isManualTrigger: k.isManualTrigger,
|
|
541
|
+
asFieldDefs: k.asFieldDefs
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}, [k, S]), Te = v(() => {
|
|
545
|
+
if (!k) return !1;
|
|
546
|
+
const e = new Set(
|
|
547
|
+
k.internalNodes.filter((n) => n.group === "trigger").map((n) => `${n.app}::${n.action}`)
|
|
548
|
+
);
|
|
549
|
+
return S.some((n) => {
|
|
550
|
+
const { app: f, action: g } = n.uses ?? {};
|
|
551
|
+
return !!f && !!g && e.has(`${f}::${g}`);
|
|
552
|
+
});
|
|
553
|
+
}, [k, S]), F = v(() => {
|
|
554
|
+
if (!k) return [];
|
|
555
|
+
const e = /* @__PURE__ */ new Set();
|
|
556
|
+
for (const n of S) {
|
|
557
|
+
const { app: f, action: g } = n.uses ?? {};
|
|
558
|
+
f && g && !k.isInternalApp(f) && e.add(f);
|
|
559
|
+
}
|
|
560
|
+
return [...e];
|
|
561
|
+
}, [k, S]), { byId: _ } = Xt(F), vt = v(() => [..._.values()], [_]), Fe = oe({
|
|
562
|
+
queries: F.map((e) => ({
|
|
563
|
+
queryKey: Ot(e),
|
|
564
|
+
queryFn: () => u.getAppActions(e)
|
|
565
|
+
}))
|
|
566
|
+
}), Le = v(() => {
|
|
567
|
+
var n, f;
|
|
568
|
+
const e = {};
|
|
569
|
+
if (!k) return e;
|
|
570
|
+
for (const g of S) {
|
|
571
|
+
const { app: I, action: q } = g.uses ?? {};
|
|
572
|
+
if (!I || !q) continue;
|
|
573
|
+
const ae = `${I}::${q}`;
|
|
574
|
+
if (!(ae in e))
|
|
575
|
+
if (k.isInternalApp(I))
|
|
576
|
+
e[ae] = k.internalNodeParams(I, q);
|
|
577
|
+
else {
|
|
578
|
+
const Ue = F.indexOf(I), se = Ue >= 0 ? (n = Fe[Ue]) == null ? void 0 : n.data : void 0;
|
|
579
|
+
e[ae] = ((f = se == null ? void 0 : se.find((Ct) => Ct.key === q)) == null ? void 0 : f.params) ?? [];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return e;
|
|
583
|
+
}, [k, S, F, Fe]), $ = v(() => {
|
|
584
|
+
const e = {};
|
|
585
|
+
for (const [n, f] of _) e[n] = f;
|
|
586
|
+
return e;
|
|
587
|
+
}, [_]), X = v(
|
|
588
|
+
() => S.filter((e) => {
|
|
589
|
+
var f;
|
|
590
|
+
const n = (f = e.uses) == null ? void 0 : f.app;
|
|
591
|
+
return !!n && n in $ && Xe($[n]);
|
|
592
|
+
}),
|
|
593
|
+
[S, $]
|
|
594
|
+
), Ke = oe({
|
|
595
|
+
queries: X.map((e) => ({
|
|
596
|
+
queryKey: ce(a, e.id),
|
|
597
|
+
queryFn: () => at(p, a, e.id),
|
|
598
|
+
enabled: !!a
|
|
599
|
+
}))
|
|
600
|
+
}), Me = v(() => {
|
|
601
|
+
const e = {};
|
|
602
|
+
return X.forEach((n, f) => {
|
|
603
|
+
var g, I;
|
|
604
|
+
e[n.id] = !!((I = (g = Ke[f]) == null ? void 0 : g.data) != null && I.some((q) => q.lastRunStatus === "succeeded"));
|
|
605
|
+
}), e;
|
|
606
|
+
}, [X, Ke]), z = En("workflow", a, !!a), ee = Rn("workflow"), We = st(), qe = oe({
|
|
607
|
+
queries: F.map((e) => ({
|
|
608
|
+
queryKey: nt(e),
|
|
609
|
+
queryFn: () => Cn(p, e)
|
|
610
|
+
}))
|
|
611
|
+
}), Be = v(() => {
|
|
612
|
+
const e = /* @__PURE__ */ new Map();
|
|
613
|
+
return F.forEach((n, f) => {
|
|
614
|
+
const g = qe[f];
|
|
615
|
+
g && (g.isError ? e.set(n, { state: "error" }) : g.isSuccess && !g.isFetching ? e.set(n, { state: "ready", ids: new Set((g.data ?? []).map((I) => I.id)) }) : e.set(n, { state: "loading" }));
|
|
616
|
+
}), e;
|
|
617
|
+
}, [F, qe]), W = v(
|
|
618
|
+
() => bn(S, (e) => Be.get(e)),
|
|
619
|
+
[S, Be]
|
|
620
|
+
), gt = v(() => {
|
|
621
|
+
const e = {};
|
|
622
|
+
for (const n of W) e[n.siteId] = { code: n.code, connection: n.connection };
|
|
623
|
+
return e;
|
|
624
|
+
}, [W]), Ve = R(/* @__PURE__ */ new Set());
|
|
625
|
+
A(() => {
|
|
626
|
+
for (const e of W) {
|
|
627
|
+
const n = `${e.app}|${e.connection}`;
|
|
628
|
+
Ve.current.has(n) || (Ve.current.add(n), We.invalidateQueries({ queryKey: nt(e.app) }));
|
|
629
|
+
}
|
|
630
|
+
}, [W, We]);
|
|
631
|
+
const G = R({ id: a, had: !1 });
|
|
632
|
+
G.current.id !== a && (G.current = { id: a, had: !1 }), W.length > 0 && (G.current.had = !0);
|
|
633
|
+
const Oe = Pn("workflow"), te = yn({
|
|
634
|
+
enabled: (_e = z.data) == null ? void 0 : _e.enabled,
|
|
635
|
+
problemCount: W.length,
|
|
636
|
+
dirty: l.dirty,
|
|
637
|
+
hadProblems: G.current.had
|
|
638
|
+
}), ne = v(
|
|
639
|
+
() => ({
|
|
640
|
+
hasTrigger: Te,
|
|
641
|
+
actionParamsByKey: Le,
|
|
642
|
+
appsById: $,
|
|
643
|
+
testStatus: Me,
|
|
644
|
+
requiredParamsFilled: Lt,
|
|
645
|
+
isTestRequired: Xe
|
|
646
|
+
}),
|
|
647
|
+
[Te, Le, $, Me]
|
|
648
|
+
), $e = s !== null && vn(s, ne), wt = s !== null ? et(s, ne) : null;
|
|
649
|
+
me.current = (e) => e !== null && typeof e == "object" ? et(e, ne) : null, pe.current = Z.autoSave;
|
|
650
|
+
function je(e) {
|
|
651
|
+
if (!s) return;
|
|
652
|
+
const n = { ...s, ...e };
|
|
653
|
+
l.setJson(JSON.stringify(n, null, 2));
|
|
654
|
+
}
|
|
655
|
+
function kt(e) {
|
|
656
|
+
if (!s) return;
|
|
657
|
+
const n = { ...s, ...e };
|
|
658
|
+
N(null), l.commit(JSON.stringify(n, null, 2));
|
|
659
|
+
}
|
|
660
|
+
const De = R(s);
|
|
661
|
+
De.current = s;
|
|
662
|
+
const He = R(l.commit);
|
|
663
|
+
He.current = l.commit;
|
|
664
|
+
const Je = R(l.saveNow);
|
|
665
|
+
Je.current = l.saveNow, A(() => {
|
|
666
|
+
const e = (n) => {
|
|
667
|
+
n.altKey || !(n.metaKey || n.ctrlKey) || n.key.toLowerCase() !== "s" || (n.preventDefault(), !document.querySelector(".w6w-exprmodal") && M && Je.current());
|
|
668
|
+
};
|
|
669
|
+
return document.addEventListener("keydown", e), () => {
|
|
670
|
+
document.removeEventListener("keydown", e);
|
|
671
|
+
};
|
|
672
|
+
}, [M]);
|
|
673
|
+
const Nt = v(
|
|
674
|
+
() => s ? kn(s) : {},
|
|
675
|
+
[s]
|
|
676
|
+
), St = le((e) => {
|
|
677
|
+
const n = De.current;
|
|
678
|
+
if (!n) return;
|
|
679
|
+
const f = Nn(n, e);
|
|
680
|
+
N(null), He.current(JSON.stringify(f, null, 2));
|
|
681
|
+
}, []);
|
|
682
|
+
return rn({
|
|
683
|
+
kind: "workflow",
|
|
684
|
+
id: a,
|
|
685
|
+
label: xe,
|
|
686
|
+
key: (s == null ? void 0 : s.key) ?? void 0,
|
|
687
|
+
triggers: Q,
|
|
688
|
+
policy: Nt,
|
|
689
|
+
onPolicyChange: St
|
|
690
|
+
}), /* @__PURE__ */ c("div", { className: "wf-fullbleed", style: { height: "100%", minWidth: 0, flex: 1 }, children: [
|
|
691
|
+
(d == null ? void 0 : d.header) ?? /* @__PURE__ */ t(
|
|
692
|
+
An,
|
|
693
|
+
{
|
|
694
|
+
onBack: () => h({ type: "list" }),
|
|
695
|
+
backLabel: (d == null ? void 0 : d.backLabel) ?? "← Workflows",
|
|
696
|
+
title: {
|
|
697
|
+
editable: !0,
|
|
698
|
+
value: xe,
|
|
699
|
+
placeholder: Dn,
|
|
700
|
+
maxLength: 80,
|
|
701
|
+
ariaLabel: "Workflow name",
|
|
702
|
+
onChange: (e) => je({ displayName: e }),
|
|
703
|
+
onBlur: () => {
|
|
704
|
+
M && l.saveNow();
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
actions: /* @__PURE__ */ c(B, { children: [
|
|
708
|
+
/* @__PURE__ */ t(
|
|
709
|
+
L,
|
|
710
|
+
{
|
|
711
|
+
icon: "play",
|
|
712
|
+
label: Gt(ke, Ne),
|
|
713
|
+
"data-testid": "wf-run-start",
|
|
714
|
+
onClick: ht,
|
|
715
|
+
disabled: !a || H || ut || ge.isPending
|
|
716
|
+
}
|
|
717
|
+
),
|
|
718
|
+
H && /* @__PURE__ */ t(
|
|
719
|
+
L,
|
|
720
|
+
{
|
|
721
|
+
icon: "stop",
|
|
722
|
+
label: "Stop this run",
|
|
723
|
+
"data-testid": "wf-run-stop",
|
|
724
|
+
onClick: ft,
|
|
725
|
+
disabled: we.isPending
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
/* @__PURE__ */ t(
|
|
729
|
+
"button",
|
|
730
|
+
{
|
|
731
|
+
type: "button",
|
|
732
|
+
className: `btn ghost wf-publish${((ze = z.data) == null ? void 0 : ze.currentPublishedVersion) != null ? " active" : ""}`,
|
|
733
|
+
"data-testid": "wf-publish",
|
|
734
|
+
onClick: () => {
|
|
735
|
+
a && (N(null), Re(() => ee.mutateAsync(a)));
|
|
736
|
+
},
|
|
737
|
+
disabled: o === null || !M || !$e || ee.isPending,
|
|
738
|
+
title: M && !$e ? wt ?? "Workflow is not valid" : ((Ge = z.data) == null ? void 0 : Ge.currentPublishedVersion) != null ? "Published — click to publish a new version" : "Never published — click to publish",
|
|
739
|
+
children: ee.isPending ? "Publishing…" : ((Ye = z.data) == null ? void 0 : Ye.currentPublishedVersion) != null ? "● Published" : "Publish"
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
/* @__PURE__ */ t(
|
|
743
|
+
Mn,
|
|
744
|
+
{
|
|
745
|
+
kind: "workflow",
|
|
746
|
+
id: a,
|
|
747
|
+
onOpenRun: (e) => {
|
|
748
|
+
x(e), h({ type: "run", id: a, runId: e });
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
),
|
|
752
|
+
/* @__PURE__ */ t(Wn, { onClick: () => y(!0) }),
|
|
753
|
+
/* @__PURE__ */ t(
|
|
754
|
+
L,
|
|
755
|
+
{
|
|
756
|
+
icon: "settings",
|
|
757
|
+
label: "Workflow settings",
|
|
758
|
+
onClick: () => j(!0)
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
d == null ? void 0 : d.headerActions
|
|
762
|
+
] })
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
te.show && /* @__PURE__ */ t(
|
|
766
|
+
Bn,
|
|
767
|
+
{
|
|
768
|
+
kind: "workflow",
|
|
769
|
+
problemCount: te.problemCount,
|
|
770
|
+
canEnable: te.canEnable,
|
|
771
|
+
pending: Oe.isPending,
|
|
772
|
+
onEnable: () => Oe.mutate({ id: a, enabled: !0 })
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
/* @__PURE__ */ t("div", { className: "wf-fullbleed-canvas", children: /* @__PURE__ */ c("div", { className: "wf-run-area", children: [
|
|
776
|
+
/* @__PURE__ */ t("div", { className: "wf-run-canvas", children: /* @__PURE__ */ t(qt, { fallback: /* @__PURE__ */ t("p", { className: "muted", children: "Loading visual editor…" }), children: mt && s ? /* @__PURE__ */ t(
|
|
777
|
+
Hn,
|
|
778
|
+
{
|
|
779
|
+
value: s,
|
|
780
|
+
onChange: (e) => {
|
|
781
|
+
l.setJson(JSON.stringify(e, null, 2)), P(!0), E(null), x(null);
|
|
782
|
+
},
|
|
783
|
+
apps: vt,
|
|
784
|
+
project: o ?? void 0,
|
|
785
|
+
height: "100%",
|
|
786
|
+
readOnly: H,
|
|
787
|
+
fitViewKey: O !== null,
|
|
788
|
+
stepProblems: gt,
|
|
789
|
+
runState: T.data,
|
|
790
|
+
onTestRun: () => x(null)
|
|
791
|
+
}
|
|
792
|
+
) : be === "" ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ t("p", { className: "muted", children: "Fix the JSON to render the visual editor." }) }) }),
|
|
793
|
+
O && /* @__PURE__ */ t("div", { className: "wf-run-log", "data-testid": "wf-run-log", children: /* @__PURE__ */ t(
|
|
794
|
+
Kt,
|
|
795
|
+
{
|
|
796
|
+
steps: Se,
|
|
797
|
+
runError: Ce.runError,
|
|
798
|
+
stepErrors: Ce.stepErrors,
|
|
799
|
+
onDismiss: () => x(null)
|
|
800
|
+
}
|
|
801
|
+
) })
|
|
802
|
+
] }) }),
|
|
803
|
+
o === null && /* @__PURE__ */ c("div", { role: "alert", className: "error", "data-testid": "wf-project-required", children: [
|
|
804
|
+
"No project selected — pass a ",
|
|
805
|
+
/* @__PURE__ */ t("code", { children: "project" }),
|
|
806
|
+
" prop (or set the provider's project) to edit and save this workflow."
|
|
807
|
+
] }),
|
|
808
|
+
/* @__PURE__ */ c("div", { className: "wf-fullbleed-foot", children: [
|
|
809
|
+
/* @__PURE__ */ c("div", { className: "row", style: { flexWrap: "wrap", alignItems: "center" }, children: [
|
|
810
|
+
/* @__PURE__ */ t(
|
|
811
|
+
"button",
|
|
812
|
+
{
|
|
813
|
+
type: "button",
|
|
814
|
+
className: "btn",
|
|
815
|
+
disabled: o === null || !M || !lt,
|
|
816
|
+
onClick: l.saveNow,
|
|
817
|
+
children: l.saving ? "Saving…" : "Save"
|
|
818
|
+
}
|
|
819
|
+
),
|
|
820
|
+
dt && /* @__PURE__ */ t("span", { className: "ok", children: "Saved." })
|
|
821
|
+
] }),
|
|
822
|
+
Pe && /* @__PURE__ */ t("div", { className: "error", children: Pe }),
|
|
823
|
+
Ae && /* @__PURE__ */ t("div", { className: "error", "data-testid": "wf-key-guard", children: Ae })
|
|
824
|
+
] }),
|
|
825
|
+
/* @__PURE__ */ t(
|
|
826
|
+
qn,
|
|
827
|
+
{
|
|
828
|
+
open: b,
|
|
829
|
+
onClose: () => y(!1),
|
|
830
|
+
title: `JSON — ${(s == null ? void 0 : s.displayName) || "workflow"}`,
|
|
831
|
+
mode: "synced",
|
|
832
|
+
value: be,
|
|
833
|
+
onChange: (e) => {
|
|
834
|
+
l.setJson(e), x(null);
|
|
835
|
+
},
|
|
836
|
+
onValidityChange: ({ valid: e, error: n }) => {
|
|
837
|
+
P(e), E(n);
|
|
838
|
+
},
|
|
839
|
+
invalidReason: C ? null : V,
|
|
840
|
+
editorLabel: "Workflow definition JSON"
|
|
841
|
+
}
|
|
842
|
+
),
|
|
843
|
+
l.stale && !ct && /* @__PURE__ */ c(de, { title: "This workflow changed on the server", onClose: () => Y(!0), children: [
|
|
844
|
+
/* @__PURE__ */ c("div", { className: "modal-body", children: [
|
|
845
|
+
/* @__PURE__ */ t("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." }),
|
|
846
|
+
/* @__PURE__ */ c("p", { className: "muted small", children: [
|
|
847
|
+
/* @__PURE__ */ t("strong", { children: "Reload from server" }),
|
|
848
|
+
" replaces what is on this canvas with the saved copy; anything you changed here and have not saved is lost.",
|
|
849
|
+
" ",
|
|
850
|
+
/* @__PURE__ */ t("strong", { children: "Keep editing" }),
|
|
851
|
+
" 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."
|
|
852
|
+
] })
|
|
853
|
+
] }),
|
|
854
|
+
/* @__PURE__ */ c("div", { className: "modal-actions", children: [
|
|
855
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: () => Y(!0), children: "Keep editing" }),
|
|
856
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: ue, onClick: pt, children: ue ? "Reloading…" : "Reload from server" })
|
|
857
|
+
] })
|
|
858
|
+
] }),
|
|
859
|
+
m && /* @__PURE__ */ t(
|
|
860
|
+
$n,
|
|
861
|
+
{
|
|
862
|
+
autoSave: Z.autoSave,
|
|
863
|
+
savePosition: Z.savePosition,
|
|
864
|
+
variables: bt,
|
|
865
|
+
onClose: () => j(!1),
|
|
866
|
+
onChange: (e, n) => kt({ settings: wn(s == null ? void 0 : s.settings, e, n) }),
|
|
867
|
+
onVariablesChange: (e) => je({ variables: gn(e) })
|
|
868
|
+
}
|
|
869
|
+
)
|
|
870
|
+
] });
|
|
871
|
+
}
|
|
872
|
+
function Qn({ children: r }) {
|
|
873
|
+
const a = ot(), o = st(), i = Wt(xn), h = v(() => ({ ...a, saveStepTest: (...u) => a.saveStepTest(...u).finally(() => {
|
|
874
|
+
o.invalidateQueries({ queryKey: ce(u[0], u[1]) });
|
|
875
|
+
}), recordStepTestRun: (...u) => a.recordStepTestRun(...u).finally(() => {
|
|
876
|
+
o.invalidateQueries({ queryKey: ce(u[0], u[1]) });
|
|
877
|
+
}) }), [a, o]);
|
|
878
|
+
return /* @__PURE__ */ t(Ft, { api: h, theme: i, children: r });
|
|
879
|
+
}
|
|
880
|
+
const _n = () => {
|
|
881
|
+
};
|
|
882
|
+
function ma(r) {
|
|
883
|
+
const { workflowId: a, initialRunId: o, onNavigate: i = _n, slots: h } = r, d = Sn(r.project), p = le(
|
|
884
|
+
(u) => {
|
|
885
|
+
u.type === "list" ? i({ type: "list" }) : u.kind === "workflow" && i({ type: "workflow", id: u.id });
|
|
886
|
+
},
|
|
887
|
+
[i]
|
|
888
|
+
);
|
|
889
|
+
return /* @__PURE__ */ t(
|
|
890
|
+
"div",
|
|
891
|
+
{
|
|
892
|
+
className: "w6w-embed-root",
|
|
893
|
+
style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
|
|
894
|
+
children: /* @__PURE__ */ t(
|
|
895
|
+
Vn,
|
|
896
|
+
{
|
|
897
|
+
project: d,
|
|
898
|
+
onNavigate: p,
|
|
899
|
+
rail: r.rail,
|
|
900
|
+
storageKey: d === null ? null : `w6w.rail.embed.${d}`,
|
|
901
|
+
children: /* @__PURE__ */ t(Qn, { children: /* @__PURE__ */ t(
|
|
902
|
+
Jn,
|
|
903
|
+
{
|
|
904
|
+
workflowId: a,
|
|
905
|
+
project: d,
|
|
906
|
+
initialRunId: o,
|
|
907
|
+
onNavigate: i,
|
|
908
|
+
slots: h
|
|
909
|
+
}
|
|
910
|
+
) })
|
|
911
|
+
}
|
|
912
|
+
)
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
export {
|
|
917
|
+
Bn as B,
|
|
918
|
+
An as E,
|
|
919
|
+
Mn as H,
|
|
920
|
+
qn as J,
|
|
921
|
+
ma as W,
|
|
922
|
+
Vn as a,
|
|
923
|
+
Wn as b
|
|
924
|
+
};
|
|
925
|
+
//# sourceMappingURL=WorkflowEditor-CwvmAGp2.js.map
|