@w6w/embed 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -4
- package/dist/ConfirmModal-RLbZT5_k.js +181 -0
- package/dist/ConfirmModal-RLbZT5_k.js.map +1 -0
- package/dist/CreateFunctionModal-DRsFx-FB.js +221 -0
- package/dist/CreateFunctionModal-DRsFx-FB.js.map +1 -0
- package/dist/DocumentFormModal-BExK1V-B.js +89 -0
- package/dist/DocumentFormModal-BExK1V-B.js.map +1 -0
- package/dist/ImportSpecModal-BDQIf6rg.js +136 -0
- package/dist/ImportSpecModal-BDQIf6rg.js.map +1 -0
- package/dist/W6WEmbedProvider.d.ts +22 -4
- package/dist/WorkflowEditor-DlbVv6Fs.js +854 -0
- package/dist/WorkflowEditor-DlbVv6Fs.js.map +1 -0
- package/dist/api-calls--JHyif6a.js +107 -0
- package/dist/api-calls--JHyif6a.js.map +1 -0
- package/dist/apps-1FNUwbGv.js +77 -0
- package/dist/apps-1FNUwbGv.js.map +1 -0
- package/dist/callables-3mFrMVG_.js +151 -0
- package/dist/callables-3mFrMVG_.js.map +1 -0
- package/dist/chrome/index.d.ts +6 -0
- package/dist/chrome/workspace.d.ts +29 -1
- package/dist/coerce-input-BicYr7nc.js +139 -0
- package/dist/coerce-input-BicYr7nc.js.map +1 -0
- package/dist/connections-CjjYeRqb.js +78 -0
- package/dist/connections-CjjYeRqb.js.map +1 -0
- package/dist/document-sources-C0grrtdq.js +86 -0
- package/dist/document-sources-C0grrtdq.js.map +1 -0
- package/dist/draft/index.d.ts +3 -1
- package/dist/draft/use-callable-draft.d.ts +65 -0
- package/dist/draft/workflow-save.d.ts +3 -0
- package/dist/draft.mjs +9 -5
- package/dist/draft.mjs.map +1 -1
- package/dist/editor/CallableEditorFrame.d.ts +33 -0
- package/dist/editor/EditorShell.d.ts +16 -0
- package/dist/editor/EndpointCards.d.ts +56 -0
- package/dist/editor/EndpointEditor.d.ts +26 -0
- package/dist/editor/FunctionEditor.d.ts +21 -0
- package/dist/editor/InputListEditor.d.ts +29 -0
- package/dist/editor/TargetSelector.d.ts +30 -0
- package/dist/editor/TargetSelector.types.d.ts +62 -0
- package/dist/editor/editor-apps.d.ts +8 -2
- package/dist/editor/types.d.ts +57 -0
- package/dist/editor-apps-BdenSV1o.js +95 -0
- package/dist/editor-apps-BdenSV1o.js.map +1 -0
- package/dist/editor-tools-RxmY5iyi.js +1279 -0
- package/dist/editor-tools-RxmY5iyi.js.map +1 -0
- package/dist/editor.mjs +2 -2166
- package/dist/editor.mjs.map +1 -1
- package/dist/editors/DocumentEditor.d.ts +20 -0
- package/dist/editors/doc-format.d.ts +3 -0
- package/dist/editors.d.ts +12 -0
- package/dist/editors.mjs +1313 -0
- package/dist/editors.mjs.map +1 -0
- package/dist/embed-status.d.ts +20 -0
- package/dist/endpoints-B2ynbZo-.js +227 -0
- package/dist/endpoints-B2ynbZo-.js.map +1 -0
- package/dist/forms/CreateEndpointModal.d.ts +54 -0
- package/dist/forms/CreateFunctionModal.d.ts +55 -0
- package/dist/forms/DocumentFormModal.d.ts +8 -0
- package/dist/forms/SecretsManager.d.ts +12 -0
- package/dist/forms/VarsManager.d.ts +29 -0
- package/dist/forms.d.ts +6 -0
- package/dist/forms.mjs +407 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +153 -50
- package/dist/index.mjs.map +1 -1
- package/dist/lib/callable-record.d.ts +21 -0
- package/dist/lib/coerce-input.d.ts +6 -0
- package/dist/lib/endpoint-editor.d.ts +23 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/input-coverage.d.ts +28 -0
- package/dist/lib/input-seeding.d.ts +67 -0
- package/dist/lib/rail-settings.d.ts +3 -3
- package/dist/lib/recent-activity.d.ts +128 -0
- package/dist/lib/target-fields.d.ts +168 -0
- package/dist/lib/workflow-blank.d.ts +2 -0
- package/dist/lib.mjs +70 -48
- package/dist/lib.mjs.map +1 -1
- package/dist/lists/ActivitySummary.d.ts +29 -0
- package/dist/lists/CallableKindList.d.ts +34 -0
- package/dist/lists/ConnectionDetail.d.ts +17 -0
- package/dist/lists/ConnectionList.d.ts +16 -0
- package/dist/lists/DocumentList.d.ts +29 -0
- package/dist/lists/EndpointList.d.ts +19 -0
- package/dist/lists/FunctionList.d.ts +18 -0
- package/dist/lists/ReliabilityBoard.d.ts +23 -0
- package/dist/lists/RunHistory.d.ts +11 -0
- package/dist/lists/ServiceDetail.d.ts +20 -0
- package/dist/lists/WorkflowList.d.ts +19 -0
- package/dist/lists/vendor-history.d.ts +40 -0
- package/dist/lists.d.ts +20 -0
- package/dist/lists.mjs +1185 -0
- package/dist/lists.mjs.map +1 -0
- package/dist/project-context-BiCjv_E3.js +25 -0
- package/dist/project-context-BiCjv_E3.js.map +1 -0
- package/dist/project-context.d.ts +15 -1
- package/dist/rail/CallableRail.d.ts +12 -0
- package/dist/rail/CallableWorkspace.d.ts +16 -0
- package/dist/rail/SettingsTool.d.ts +7 -1
- package/dist/rail/settings-sections.d.ts +2 -2
- package/dist/rail-settings-XYGToh00.js +111 -0
- package/dist/rail-settings-XYGToh00.js.map +1 -0
- package/dist/rail.d.ts +11 -0
- package/dist/rail.mjs +35 -0
- package/dist/rail.mjs.map +1 -0
- package/dist/repos/api-calls.d.ts +4 -0
- package/dist/repos/apps.d.ts +14 -0
- package/dist/repos/callables.d.ts +91 -0
- package/dist/repos/connections.d.ts +33 -0
- package/dist/repos/dashboard.d.ts +4 -0
- package/dist/repos/endpoints.d.ts +125 -0
- package/dist/repos/functions.d.ts +79 -0
- package/dist/repos/index.d.ts +10 -0
- package/dist/repos/reliability.d.ts +42 -0
- package/dist/repos/saved-tests.d.ts +46 -0
- package/dist/repos/spec-export.d.ts +23 -0
- package/dist/repos/workflows.d.ts +138 -0
- package/dist/repos.mjs +174 -88
- package/dist/repos.mjs.map +1 -1
- package/dist/settings-rail--GdRMusb.js +33 -0
- package/dist/settings-rail--GdRMusb.js.map +1 -0
- package/dist/slug-C4ktDPdy.js +315 -0
- package/dist/slug-C4ktDPdy.js.map +1 -0
- package/dist/spec-export-Cf3VQSQS.js +176 -0
- package/dist/spec-export-Cf3VQSQS.js.map +1 -0
- package/dist/spec-import-CjmxyZDR.js +465 -0
- package/dist/spec-import-CjmxyZDR.js.map +1 -0
- package/dist/step-tests-CivICmTq.js +18 -0
- package/dist/step-tests-CivICmTq.js.map +1 -0
- package/dist/trigger-preview-VPkrryDl.js +120 -0
- package/dist/trigger-preview-VPkrryDl.js.map +1 -0
- package/dist/use-callable-draft-zHLpcr-b.js +271 -0
- package/dist/use-callable-draft-zHLpcr-b.js.map +1 -0
- package/dist/{use-workflow-draft-oI02dsP-.js → use-workflow-draft-DzAyUeA6.js} +48 -46
- package/dist/use-workflow-draft-DzAyUeA6.js.map +1 -0
- package/dist/vault-BSEWhMYC.js +117 -0
- package/dist/vault-BSEWhMYC.js.map +1 -0
- package/dist/workflow-blank-DyL3_RUA.js +14 -0
- package/dist/workflow-blank-DyL3_RUA.js.map +1 -0
- package/package.json +34 -5
- package/src/styles.css +408 -1
- package/dist/project-context-Dbk0Gr1K.js +0 -16
- package/dist/project-context-Dbk0Gr1K.js.map +0 -1
- package/dist/slug-ByKQgxrf.js +0 -642
- package/dist/slug-ByKQgxrf.js.map +0 -1
- package/dist/spec-import-HgO7ZkLZ.js +0 -898
- package/dist/spec-import-HgO7ZkLZ.js.map +0 -1
- package/dist/use-workflow-draft-oI02dsP-.js.map +0 -1
package/dist/editor.mjs
CHANGED
|
@@ -1,2170 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
var Vn = (n, t, o) => t in n ? xn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[t] = o;
|
|
4
|
-
var Xe = (n, t, o) => Vn(n, typeof t != "symbol" ? t + "" : t, o);
|
|
5
|
-
import { jsxs as a, jsx as e, Fragment as R } from "react/jsx-runtime";
|
|
6
|
-
import { useQuery as cn, useQueries as en } from "@tanstack/react-query";
|
|
7
|
-
import { ApiError as _ } from "@w6w/sdk";
|
|
8
|
-
import { ExecutionStats as Fn, ExecutionFilters as Bn, ExecutionList as $n, ExecutionDetail as Hn, Modal as Kn, IconButton as z, JsonEditor as un, ExpressionOptionsProvider as hn, CodeBlock as Re, Icon as de, RetryPolicyFields as qn, StepBuilderModal as Qn, useEnterSubmit as _n, DeleteButton as Jn, EditButton as Un, ConfirmModal as nn, useExpressionOptions as zn, ExpressionInput as Gn, useW6WApi as fn, isTestRequired as tn, requiredParamsFilled as Yn, ExecutionLogPanel as Zn } from "@w6w/ui";
|
|
9
|
-
import { useRef as $, useState as p, useEffect as j, useCallback as we, Component as Xn, createContext as mn, useContext as Oe, useMemo as F, Suspense as et, lazy as nt } from "react";
|
|
10
|
-
import { a7 as tt, a8 as ot, a5 as it, H as on, E as st, a6 as at, ap as rt, ai as lt, a4 as dt, ah as ct, Z as ut, Y as ht, at as pn, d as ft, a9 as mt, aq as pt, ad as vt, aa as gt, as as bt, ag as yt, V as wt, a2 as kt, ar as vn, ac as gn, aj as Nt, ay as Ct, ak as St, W as Et, ab as Tt, r as It, w as Pt, F as At, u as sn, T as Rt, D as Ot, B as Dt, b as Lt } from "./spec-import-HgO7ZkLZ.js";
|
|
11
|
-
import { z as Mt, a as Wt, v as jt, b as bn, I as yn, l as xt, F as Vt, p as Ft, u as wn, e as an, m as Bt, g as $t, t as Ht, s as Kt, c as qt, K as Qt, M as rn, w as _t, x as Jt, H as Ut, N as zt, k as ln, d as Gt, J as Yt, O as Zt } from "./slug-ByKQgxrf.js";
|
|
12
|
-
import { u as kn } from "./client-context-CX61Bgw-.js";
|
|
13
|
-
import { u as Xt } from "./use-workflow-draft-oI02dsP-.js";
|
|
14
|
-
import { u as eo } from "./project-context-Dbk0Gr1K.js";
|
|
15
|
-
function no({ title: n }) {
|
|
16
|
-
const { value: t, placeholder: o, maxLength: i, ariaLabel: r, onChange: s, onBlur: u } = n;
|
|
17
|
-
return /* @__PURE__ */ e(
|
|
18
|
-
"input",
|
|
19
|
-
{
|
|
20
|
-
className: "wf-title-input",
|
|
21
|
-
value: t,
|
|
22
|
-
placeholder: o,
|
|
23
|
-
maxLength: i,
|
|
24
|
-
size: Math.min(Math.max(t.length, o.length), 80),
|
|
25
|
-
"aria-label": r,
|
|
26
|
-
onChange: (l) => s(l.target.value),
|
|
27
|
-
onBlur: u
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function to({
|
|
32
|
-
onBack: n,
|
|
33
|
-
backLabel: t,
|
|
34
|
-
title: o,
|
|
35
|
-
titleAdornment: i,
|
|
36
|
-
actions: r
|
|
37
|
-
}) {
|
|
38
|
-
return /* @__PURE__ */ a("div", { className: "wf-fullbleed-head", children: [
|
|
39
|
-
/* @__PURE__ */ e(
|
|
40
|
-
"button",
|
|
41
|
-
{
|
|
42
|
-
type: "button",
|
|
43
|
-
className: "muted wf-back-btn",
|
|
44
|
-
"data-testid": "wf-editor-back",
|
|
45
|
-
onClick: n,
|
|
46
|
-
children: t
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
o.editable ? /* @__PURE__ */ e(no, { title: o }) : /* @__PURE__ */ a("h2", { className: "exec-profile-title", children: [
|
|
50
|
-
o.value,
|
|
51
|
-
" ",
|
|
52
|
-
i
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ e("div", { className: "wf-head-actions", style: { marginLeft: "auto" }, children: r })
|
|
55
|
-
] });
|
|
56
|
-
}
|
|
57
|
-
const oo = 300;
|
|
58
|
-
function io(n) {
|
|
59
|
-
var g, H;
|
|
60
|
-
const { scope: t, showKind: o, filters: i, onFiltersChange: r, onOpenInEditor: s } = n, u = $(i);
|
|
61
|
-
u.current = i;
|
|
62
|
-
const [l, h] = p(i.q), k = $(null), [v, b] = p(null);
|
|
63
|
-
j(() => {
|
|
64
|
-
h(i.q);
|
|
65
|
-
}, [i.q]), j(
|
|
66
|
-
() => () => {
|
|
67
|
-
k.current && clearTimeout(k.current);
|
|
68
|
-
},
|
|
69
|
-
[]
|
|
70
|
-
);
|
|
71
|
-
const y = tt(t, i), N = ot(t, i), w = it(v), C = ((g = y.data) == null ? void 0 : g.executions) ?? [], m = i.offset, A = ((H = y.data) == null ? void 0 : H.hasMore) ?? !1, S = (c) => {
|
|
72
|
-
r({ ...c, offset: 0 });
|
|
73
|
-
}, D = (c) => {
|
|
74
|
-
if (c.q === l) {
|
|
75
|
-
S(c);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
h(c.q), k.current && clearTimeout(k.current), k.current = setTimeout(() => {
|
|
79
|
-
k.current = null, r({ ...u.current, q: c.q, offset: 0 });
|
|
80
|
-
}, oo);
|
|
81
|
-
}, L = () => r({ ...i, q: l, offset: Math.max(0, m - on) }), B = () => r({ ...i, q: l, offset: m + on }), P = we(
|
|
82
|
-
(c) => {
|
|
83
|
-
b(C.find((M) => M.id === c) ?? null);
|
|
84
|
-
},
|
|
85
|
-
[C]
|
|
86
|
-
), T = {
|
|
87
|
-
status: i.status,
|
|
88
|
-
kind: i.kind,
|
|
89
|
-
from: i.from,
|
|
90
|
-
to: i.to,
|
|
91
|
-
q: l
|
|
92
|
-
}, O = (v == null ? void 0 : v.kind) === "workflow" && s ? () => s(v) : void 0;
|
|
93
|
-
return /* @__PURE__ */ a(R, { children: [
|
|
94
|
-
/* @__PURE__ */ e(Fn, { stats: N.data ?? null }),
|
|
95
|
-
/* @__PURE__ */ e(Bn, { showKind: o, value: T, onChange: D }),
|
|
96
|
-
y.isError && /* @__PURE__ */ e("p", { className: "error", "data-testid": "history-error", children: "Couldn't load execution history." }),
|
|
97
|
-
/* @__PURE__ */ e(
|
|
98
|
-
$n,
|
|
99
|
-
{
|
|
100
|
-
items: C,
|
|
101
|
-
showCallable: o,
|
|
102
|
-
loading: y.isLoading,
|
|
103
|
-
selectedId: (v == null ? void 0 : v.id) ?? null,
|
|
104
|
-
hasPrev: m > 0,
|
|
105
|
-
hasNext: A,
|
|
106
|
-
onPrev: L,
|
|
107
|
-
onNext: B,
|
|
108
|
-
onSelect: P
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
v && /* @__PURE__ */ e(
|
|
112
|
-
Hn,
|
|
113
|
-
{
|
|
114
|
-
execution: w.data ?? null,
|
|
115
|
-
loading: w.isLoading,
|
|
116
|
-
errorMessage: w.isError ? "This execution is no longer available." : void 0,
|
|
117
|
-
onClose: () => b(null),
|
|
118
|
-
onOpenInEditor: O
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] });
|
|
122
|
-
}
|
|
123
|
-
function so(n, t, o) {
|
|
124
|
-
if (!(n !== "workflow" || t === void 0))
|
|
125
|
-
return (i) => {
|
|
126
|
-
o(), t(i.id);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function ao(n) {
|
|
130
|
-
const { kind: t, id: o, onClose: i, onOpenRun: r } = n, [s, u] = p(st), l = so(t, r, i);
|
|
131
|
-
return /* @__PURE__ */ e(
|
|
132
|
-
Kn,
|
|
133
|
-
{
|
|
134
|
-
size: "full",
|
|
135
|
-
title: "History",
|
|
136
|
-
subtitle: o,
|
|
137
|
-
onClose: i,
|
|
138
|
-
headerRight: /* @__PURE__ */ e(z, { icon: "close", label: "Close", onClick: i }),
|
|
139
|
-
children: /* @__PURE__ */ e("div", { className: "w6w-modal-body", children: /* @__PURE__ */ e(
|
|
140
|
-
io,
|
|
141
|
-
{
|
|
142
|
-
scope: { callable: o },
|
|
143
|
-
showKind: !1,
|
|
144
|
-
filters: s,
|
|
145
|
-
onFiltersChange: u,
|
|
146
|
-
onOpenInEditor: l
|
|
147
|
-
}
|
|
148
|
-
) })
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
function Nn({
|
|
153
|
-
hasExecuted: n,
|
|
154
|
-
onClick: t,
|
|
155
|
-
buttonRef: o
|
|
156
|
-
}) {
|
|
157
|
-
return /* @__PURE__ */ e(
|
|
158
|
-
z,
|
|
159
|
-
{
|
|
160
|
-
ref: o,
|
|
161
|
-
icon: "history",
|
|
162
|
-
"data-testid": "history-button",
|
|
163
|
-
label: "Execution history",
|
|
164
|
-
title: n ? "Execution history" : "No executions yet",
|
|
165
|
-
disabled: !n,
|
|
166
|
-
onClick: t
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
function ro({ kind: n, id: t, onOpenRun: o }) {
|
|
171
|
-
const { hasExecuted: i } = at(t), [r, s] = p(!1), u = $(null), l = $(!1);
|
|
172
|
-
return j(() => {
|
|
173
|
-
var h;
|
|
174
|
-
l.current && !r && ((h = u.current) == null || h.focus()), l.current = r;
|
|
175
|
-
}, [r]), /* @__PURE__ */ a(R, { children: [
|
|
176
|
-
/* @__PURE__ */ e(
|
|
177
|
-
Nn,
|
|
178
|
-
{
|
|
179
|
-
hasExecuted: i,
|
|
180
|
-
buttonRef: u,
|
|
181
|
-
onClick: () => s(!0)
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
r && /* @__PURE__ */ e(ao, { kind: n, id: t, onClose: () => s(!1), onOpenRun: o })
|
|
185
|
-
] });
|
|
186
|
-
}
|
|
187
|
-
class lo extends Xn {
|
|
188
|
-
constructor() {
|
|
189
|
-
super(...arguments);
|
|
190
|
-
Xe(this, "state", { failed: !1 });
|
|
191
|
-
}
|
|
192
|
-
static getDerivedStateFromError() {
|
|
193
|
-
return { failed: !0 };
|
|
194
|
-
}
|
|
195
|
-
componentDidCatch(o) {
|
|
196
|
-
console.error("history probe answer was unreadable; disabling the button", o);
|
|
197
|
-
}
|
|
198
|
-
render() {
|
|
199
|
-
return this.state.failed ? /* @__PURE__ */ e(Nn, { hasExecuted: !1, onClick: () => {
|
|
200
|
-
} }) : this.props.children;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function co(n) {
|
|
204
|
-
return /* @__PURE__ */ e(lo, { children: /* @__PURE__ */ e(ro, { ...n }) });
|
|
205
|
-
}
|
|
206
|
-
function J({
|
|
207
|
-
title: n,
|
|
208
|
-
onClose: t,
|
|
209
|
-
children: o,
|
|
210
|
-
wide: i = !1,
|
|
211
|
-
xl: r = !1,
|
|
212
|
-
headerRight: s
|
|
213
|
-
}) {
|
|
214
|
-
const u = $(null);
|
|
215
|
-
return j(() => {
|
|
216
|
-
const l = u.current;
|
|
217
|
-
if (!l) return;
|
|
218
|
-
l.open || l.showModal();
|
|
219
|
-
const h = (v) => {
|
|
220
|
-
v.preventDefault(), t();
|
|
221
|
-
}, k = (v) => {
|
|
222
|
-
if (v.target !== l) return;
|
|
223
|
-
const b = l.getBoundingClientRect();
|
|
224
|
-
(v.clientX < b.left || v.clientX > b.right || v.clientY < b.top || v.clientY > b.bottom) && t();
|
|
225
|
-
};
|
|
226
|
-
return l.addEventListener("cancel", h), l.addEventListener("click", k), () => {
|
|
227
|
-
l.removeEventListener("cancel", h), l.removeEventListener("click", k);
|
|
228
|
-
};
|
|
229
|
-
}, [t]), /* @__PURE__ */ e("div", { className: "modal-backdrop", children: /* @__PURE__ */ a(
|
|
230
|
-
"dialog",
|
|
231
|
-
{
|
|
232
|
-
ref: u,
|
|
233
|
-
className: `modal${i ? " modal-wide" : ""}${r ? " modal-xl" : ""}`,
|
|
234
|
-
"aria-label": n,
|
|
235
|
-
children: [
|
|
236
|
-
s ? /* @__PURE__ */ a("div", { className: "modal-head", children: [
|
|
237
|
-
/* @__PURE__ */ e("h3", { children: n }),
|
|
238
|
-
s
|
|
239
|
-
] }) : /* @__PURE__ */ e("h3", { children: n }),
|
|
240
|
-
o
|
|
241
|
-
]
|
|
242
|
-
}
|
|
243
|
-
) });
|
|
244
|
-
}
|
|
245
|
-
function uo(n) {
|
|
246
|
-
return /* @__PURE__ */ e(z, { icon: "json", onClick: n.onClick, label: "Edit raw JSON definition" });
|
|
247
|
-
}
|
|
248
|
-
function ho(n) {
|
|
249
|
-
const {
|
|
250
|
-
open: t,
|
|
251
|
-
onClose: o,
|
|
252
|
-
title: i,
|
|
253
|
-
mode: r,
|
|
254
|
-
value: s,
|
|
255
|
-
onChange: u,
|
|
256
|
-
onValidityChange: l,
|
|
257
|
-
invalidReason: h,
|
|
258
|
-
guard: k,
|
|
259
|
-
onSave: v,
|
|
260
|
-
saving: b,
|
|
261
|
-
error: y,
|
|
262
|
-
editorLabel: N
|
|
263
|
-
} = n;
|
|
264
|
-
if (!t) return null;
|
|
265
|
-
const w = (k == null ? void 0 : k(s)) ?? null;
|
|
266
|
-
return /* @__PURE__ */ a(J, { title: i, onClose: o, wide: !0, children: [
|
|
267
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
268
|
-
/* @__PURE__ */ e("p", { className: "muted small", children: r === "synced" ? /* @__PURE__ */ a(R, { children: [
|
|
269
|
-
"Edit the raw definition (",
|
|
270
|
-
/* @__PURE__ */ e("code", { children: 'manifestVersion: "2"' }),
|
|
271
|
-
"). Changes sync live to the visual editor."
|
|
272
|
-
] }) : "Save replaces the stored definition." }),
|
|
273
|
-
/* @__PURE__ */ e(
|
|
274
|
-
un,
|
|
275
|
-
{
|
|
276
|
-
value: s,
|
|
277
|
-
onChange: u,
|
|
278
|
-
onValidityChange: ({ valid: C, error: m }) => l == null ? void 0 : l({ valid: C, error: m ?? null }),
|
|
279
|
-
minHeight: "420px",
|
|
280
|
-
"aria-label": N
|
|
281
|
-
}
|
|
282
|
-
),
|
|
283
|
-
w && /* @__PURE__ */ e("p", { className: "muted small", "data-testid": "json-toggle-reason", children: w }),
|
|
284
|
-
h && /* @__PURE__ */ a("div", { className: "muted small", children: [
|
|
285
|
-
"Invalid JSON — ",
|
|
286
|
-
h
|
|
287
|
-
] }),
|
|
288
|
-
y && /* @__PURE__ */ e("div", { className: "error", children: y })
|
|
289
|
-
] }),
|
|
290
|
-
/* @__PURE__ */ e("div", { className: "modal-actions", children: r === "synced" ? /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: o, children: "Done" }) : /* @__PURE__ */ a(R, { children: [
|
|
291
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: o, children: "Cancel" }),
|
|
292
|
-
/* @__PURE__ */ e(
|
|
293
|
-
"button",
|
|
294
|
-
{
|
|
295
|
-
type: "button",
|
|
296
|
-
className: "btn",
|
|
297
|
-
"data-testid": "json-toggle-save",
|
|
298
|
-
disabled: w != null || !!b,
|
|
299
|
-
onClick: v,
|
|
300
|
-
children: b ? "Saving…" : "Save"
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] }) })
|
|
304
|
-
] });
|
|
305
|
-
}
|
|
306
|
-
const De = mn(null);
|
|
307
|
-
function fo({ children: n }) {
|
|
308
|
-
const [t, o] = p(null);
|
|
309
|
-
return /* @__PURE__ */ e(De.Provider, { value: { resource: t, setCallable: o }, children: n });
|
|
310
|
-
}
|
|
311
|
-
function mo(n) {
|
|
312
|
-
const t = Oe(De);
|
|
313
|
-
if (!t) throw new Error("useWorkspace must be used within <WorkspaceProvider>");
|
|
314
|
-
const { setCallable: o } = t, i = n ? JSON.stringify(n) : "";
|
|
315
|
-
j(() => (o(n), () => o(null)), [i, o]);
|
|
316
|
-
}
|
|
317
|
-
function po() {
|
|
318
|
-
const n = Oe(De);
|
|
319
|
-
if (!n) throw new Error("useWorkspaceCallable must be used within <WorkspaceProvider>");
|
|
320
|
-
return n.resource;
|
|
321
|
-
}
|
|
322
|
-
const Cn = { open: !1, activeTool: null };
|
|
323
|
-
function vo(n) {
|
|
324
|
-
if (typeof localStorage > "u") return Cn;
|
|
325
|
-
const t = localStorage.getItem(n), { activeTool: o } = Mt(t);
|
|
326
|
-
return { open: !1, activeTool: o };
|
|
327
|
-
}
|
|
328
|
-
function Sn({
|
|
329
|
-
tools: n,
|
|
330
|
-
ctx: t,
|
|
331
|
-
state: o,
|
|
332
|
-
onToggle: i
|
|
333
|
-
}) {
|
|
334
|
-
const r = o.open ? n.find((s) => s.id === o.activeTool) ?? null : null;
|
|
335
|
-
return /* @__PURE__ */ a("aside", { className: "right-rail", children: [
|
|
336
|
-
/* @__PURE__ */ e("div", { className: "right-rail-strip", children: n.map((s) => /* @__PURE__ */ e(
|
|
337
|
-
"button",
|
|
338
|
-
{
|
|
339
|
-
type: "button",
|
|
340
|
-
"data-testid": `rail-tool-${s.id}`,
|
|
341
|
-
className: `right-rail-tool-btn${(r == null ? void 0 : r.id) === s.id ? " active" : ""}`,
|
|
342
|
-
title: s.title,
|
|
343
|
-
"aria-label": s.title,
|
|
344
|
-
"aria-pressed": (r == null ? void 0 : r.id) === s.id,
|
|
345
|
-
onClick: () => i(s.id),
|
|
346
|
-
children: /* @__PURE__ */ e(s.Icon, {})
|
|
347
|
-
},
|
|
348
|
-
s.id
|
|
349
|
-
)) }),
|
|
350
|
-
r && /* @__PURE__ */ a("div", { className: "right-rail-panel", "data-testid": `rail-panel-${r.id}`, children: [
|
|
351
|
-
!r.rendersHeading && /* @__PURE__ */ e("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ e("h3", { children: r.title }) }),
|
|
352
|
-
/* @__PURE__ */ e(r.Panel, { ctx: t })
|
|
353
|
-
] })
|
|
354
|
-
] });
|
|
355
|
-
}
|
|
356
|
-
function go({
|
|
357
|
-
storageKey: n,
|
|
358
|
-
tools: t,
|
|
359
|
-
ctx: o
|
|
360
|
-
}) {
|
|
361
|
-
const [i, r] = p(() => vo(n));
|
|
362
|
-
j(() => {
|
|
363
|
-
typeof localStorage > "u" || localStorage.setItem(n, JSON.stringify({ activeTool: i.activeTool }));
|
|
364
|
-
}, [n, i.activeTool]);
|
|
365
|
-
function s(u) {
|
|
366
|
-
r(
|
|
367
|
-
(l) => l.open && l.activeTool === u ? { open: !1, activeTool: u } : { open: !0, activeTool: u }
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
return /* @__PURE__ */ e(Sn, { tools: t, ctx: o, state: i, onToggle: s });
|
|
371
|
-
}
|
|
372
|
-
function bo({
|
|
373
|
-
tools: n,
|
|
374
|
-
storageKey: t
|
|
375
|
-
}) {
|
|
376
|
-
const o = po(), i = n.filter((r) => r.isAvailable(o));
|
|
377
|
-
return i.length === 0 ? null : t === null ? /* @__PURE__ */ e(Sn, { tools: i, ctx: o, state: Cn, onToggle: () => {
|
|
378
|
-
} }) : /* @__PURE__ */ e(go, { storageKey: t, tools: i, ctx: o }, t);
|
|
379
|
-
}
|
|
380
|
-
function yo(n) {
|
|
381
|
-
const t = n, o = rt(t ?? void 0, t != null), i = lt(), r = dt(t ?? void 0, t != null), s = ct(), u = ut(), l = ht();
|
|
382
|
-
return F(
|
|
383
|
-
() => ({
|
|
384
|
-
vars: (o.data ?? []).map((h) => h.name),
|
|
385
|
-
secrets: (i.data ?? []).map((h) => h.name),
|
|
386
|
-
// `document-sources.ts` owns the `format === "json"` gate and the raw
|
|
387
|
-
// field enumeration — no parsing, no gate logic, and no filtering here
|
|
388
|
-
// (A5c); `isRefSafeKey` filtering happens once, downstream, at the
|
|
389
|
-
// modal's render site.
|
|
390
|
-
documents: jt(r.data ?? []),
|
|
391
|
-
// Real project values so the ƒx Result preview substitutes them for
|
|
392
|
-
// `vars.<name>` / `documents.<key>` / `documents.<key>.<field>` refs
|
|
393
|
-
// instead of the raw template.
|
|
394
|
-
sampleValues: {
|
|
395
|
-
...Object.fromEntries((o.data ?? []).map((h) => [`vars.${h.name}`, h.value])),
|
|
396
|
-
...Wt(r.data ?? [])
|
|
397
|
-
},
|
|
398
|
-
sealSecret: s,
|
|
399
|
-
// A created var carries the SAME project the read above carried (B3) —
|
|
400
|
-
// it must land in the project whose rail asked for it. `type: "string"`
|
|
401
|
-
// is pinned (a string type's `raw` passes through untouched) — the modal
|
|
402
|
-
// has no type field.
|
|
403
|
-
createVar: (h) => u.mutateAsync({
|
|
404
|
-
input: {
|
|
405
|
-
name: h.name,
|
|
406
|
-
type: "string",
|
|
407
|
-
value: h.value,
|
|
408
|
-
description: h.description
|
|
409
|
-
},
|
|
410
|
-
project: t ?? void 0
|
|
411
|
-
}).then(() => {
|
|
412
|
-
}),
|
|
413
|
-
// Secrets carry NO project (B4) — `vault_secrets` has no `project`
|
|
414
|
-
// column and the routes read no `?project=`. Plaintext in, the server
|
|
415
|
-
// encrypts; the resolved value is referenced nowhere (B5).
|
|
416
|
-
createSecret: (h) => l.mutateAsync({ name: h.name, value: h.value, description: h.description }).then(() => {
|
|
417
|
-
})
|
|
418
|
-
}),
|
|
419
|
-
[
|
|
420
|
-
o.data,
|
|
421
|
-
i.data,
|
|
422
|
-
r.data,
|
|
423
|
-
s,
|
|
424
|
-
u.mutateAsync,
|
|
425
|
-
l.mutateAsync,
|
|
426
|
-
t
|
|
427
|
-
]
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
function wo({
|
|
431
|
-
project: n,
|
|
432
|
-
children: t
|
|
433
|
-
}) {
|
|
434
|
-
const o = yo(n);
|
|
435
|
-
return /* @__PURE__ */ e(hn, { value: o, children: t });
|
|
436
|
-
}
|
|
437
|
-
const ye = [
|
|
438
|
-
{ id: "node", label: "Node", language: "TypeScript", grammar: "typescript", icon: "lang-node" },
|
|
439
|
-
{ id: "cli", label: "CLI", language: "Shell", grammar: "bash", icon: "terminal" },
|
|
440
|
-
{ id: "python", label: "Python", language: "Python", grammar: "python", icon: "lang-python" },
|
|
441
|
-
{ id: "curl", label: "curl", language: "Shell", grammar: "bash", icon: "lang-curl" }
|
|
442
|
-
];
|
|
443
|
-
function ko(n) {
|
|
444
|
-
const t = bn(n);
|
|
445
|
-
return t ? ye.filter((o) => typeof t[o.id] == "string") : [];
|
|
446
|
-
}
|
|
447
|
-
function No({
|
|
448
|
-
resource: n,
|
|
449
|
-
triggers: t,
|
|
450
|
-
wrap: o = !1,
|
|
451
|
-
maxHeight: i = "420px",
|
|
452
|
-
initialTab: r
|
|
453
|
-
}) {
|
|
454
|
-
var C, m, A;
|
|
455
|
-
const [s, u] = p(r ?? "node"), [l, h] = p(0), k = !!t && t.length > 0, v = k ? t[Math.min(l, t.length - 1)] ?? t[0] : null, b = bn(n, v == null ? void 0 : v.fields), y = b ? ye.filter((S) => typeof b[S.id] == "string") : [], N = y.some((S) => S.id === s) ? s : ((C = y[0]) == null ? void 0 : C.id) ?? "node", w = (b == null ? void 0 : b[N]) ?? "";
|
|
456
|
-
return b === null ? /* @__PURE__ */ e("p", { className: "muted", children: yn(n) }) : /* @__PURE__ */ a(R, { children: [
|
|
457
|
-
k && v && /* @__PURE__ */ a("div", { className: "subpanel", style: { marginTop: 0, paddingTop: 0, borderTop: "none" }, children: [
|
|
458
|
-
/* @__PURE__ */ a("div", { "data-testid": "trigger-panel", children: [
|
|
459
|
-
/* @__PURE__ */ e("div", { className: "code-tabs", children: t.map((S, D) => /* @__PURE__ */ e(
|
|
460
|
-
"button",
|
|
461
|
-
{
|
|
462
|
-
type: "button",
|
|
463
|
-
className: `code-tab${D === l ? " active" : ""}`,
|
|
464
|
-
"data-testid": "trigger-tab",
|
|
465
|
-
onClick: () => h(D),
|
|
466
|
-
children: S.label
|
|
467
|
-
},
|
|
468
|
-
S.id
|
|
469
|
-
)) }),
|
|
470
|
-
v.fields.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: "This trigger declares no fields." })
|
|
471
|
-
] }),
|
|
472
|
-
t.length > 1 && /* @__PURE__ */ a("p", { className: "muted small", "data-testid": "trigger-multi-note", children: [
|
|
473
|
-
"This workflow has ",
|
|
474
|
-
t.length,
|
|
475
|
-
" manual triggers — the same input reaches every one of them identically; there is no per-trigger routing."
|
|
476
|
-
] })
|
|
477
|
-
] }),
|
|
478
|
-
/* @__PURE__ */ e("div", { className: "code-tabs", children: y.map((S) => /* @__PURE__ */ e(
|
|
479
|
-
"button",
|
|
480
|
-
{
|
|
481
|
-
type: "button",
|
|
482
|
-
className: `code-tab${N === S.id ? " active" : ""}`,
|
|
483
|
-
onClick: () => u(S.id),
|
|
484
|
-
children: S.label
|
|
485
|
-
},
|
|
486
|
-
S.id
|
|
487
|
-
)) }),
|
|
488
|
-
/* @__PURE__ */ e(
|
|
489
|
-
Re,
|
|
490
|
-
{
|
|
491
|
-
code: w,
|
|
492
|
-
language: ((m = ye.find((S) => S.id === N)) == null ? void 0 : m.grammar) ?? "plaintext",
|
|
493
|
-
maxHeight: i,
|
|
494
|
-
wrap: o,
|
|
495
|
-
"aria-label": `${((A = ye.find((S) => S.id === N)) == null ? void 0 : A.label) ?? N} snippet`,
|
|
496
|
-
copyable: !0
|
|
497
|
-
}
|
|
498
|
-
),
|
|
499
|
-
/* @__PURE__ */ e("p", { className: "muted small", style: { marginBottom: 0 }, children: N === "node" ? /* @__PURE__ */ a(R, { children: [
|
|
500
|
-
/* @__PURE__ */ e("code", { children: "npm i @w6w/sdk" }),
|
|
501
|
-
" · set ",
|
|
502
|
-
/* @__PURE__ */ e("code", { children: "W6W_BASE_URL" }),
|
|
503
|
-
" and ",
|
|
504
|
-
/* @__PURE__ */ e("code", { children: "W6W_TOKEN" }),
|
|
505
|
-
" · operation ",
|
|
506
|
-
/* @__PURE__ */ e("code", { children: b.operation })
|
|
507
|
-
] }) : N === "cli" ? /* @__PURE__ */ a(R, { children: [
|
|
508
|
-
/* @__PURE__ */ e("code", { children: "npm i -g @w6w/cli" }),
|
|
509
|
-
" · set ",
|
|
510
|
-
/* @__PURE__ */ e("code", { children: "W6W_BASE_URL" }),
|
|
511
|
-
" and",
|
|
512
|
-
" ",
|
|
513
|
-
/* @__PURE__ */ e("code", { children: "W6W_TOKEN" }),
|
|
514
|
-
" (or pass ",
|
|
515
|
-
/* @__PURE__ */ e("code", { children: "--base-url" }),
|
|
516
|
-
" / ",
|
|
517
|
-
/* @__PURE__ */ e("code", { children: "--token" }),
|
|
518
|
-
") · operation ",
|
|
519
|
-
/* @__PURE__ */ e("code", { children: b.operation })
|
|
520
|
-
] }) : N === "python" ? /* @__PURE__ */ a(R, { children: [
|
|
521
|
-
/* @__PURE__ */ e("code", { children: "pip install w6w" }),
|
|
522
|
-
" · set ",
|
|
523
|
-
/* @__PURE__ */ e("code", { children: "W6W_BASE_URL" }),
|
|
524
|
-
" and ",
|
|
525
|
-
/* @__PURE__ */ e("code", { children: "W6W_TOKEN" }),
|
|
526
|
-
" ",
|
|
527
|
-
"· operation ",
|
|
528
|
-
/* @__PURE__ */ e("code", { children: b.operation })
|
|
529
|
-
] }) : /* @__PURE__ */ a(R, { children: [
|
|
530
|
-
"No client library — any HTTP client will do. Set ",
|
|
531
|
-
/* @__PURE__ */ e("code", { children: "W6W_BASE_URL" }),
|
|
532
|
-
" to your w6w base URL (for an Endpoint, the URL above is the one this page is showing); substitute a w6w token for ",
|
|
533
|
-
/* @__PURE__ */ e("code", { children: "$W6W_TOKEN" }),
|
|
534
|
-
" and send the declared input as the JSON body."
|
|
535
|
-
] }) })
|
|
536
|
-
] });
|
|
537
|
-
}
|
|
538
|
-
function Co({ ctx: n }) {
|
|
539
|
-
const [t, o] = p(null), i = Vt(n);
|
|
540
|
-
if (!i) return null;
|
|
541
|
-
const r = (n == null ? void 0 : n.kind) === "workflow" ? n.triggers : void 0, s = ko(i);
|
|
542
|
-
return s.length === 0 ? /* @__PURE__ */ e("p", { className: "muted", children: yn(i) }) : /* @__PURE__ */ a("div", { children: [
|
|
543
|
-
/* @__PURE__ */ e("p", { className: "muted small", style: { marginTop: 0 }, children: "Call this from:" }),
|
|
544
|
-
/* @__PURE__ */ e("div", { className: "rail-code-langs", children: s.map(({ id: u, label: l, icon: h }) => /* @__PURE__ */ a(
|
|
545
|
-
"button",
|
|
546
|
-
{
|
|
547
|
-
type: "button",
|
|
548
|
-
className: "rail-code-lang",
|
|
549
|
-
"data-testid": `rail-code-lang-${u}`,
|
|
550
|
-
title: `Show the ${l} snippet`,
|
|
551
|
-
"aria-label": `Show the ${l} snippet`,
|
|
552
|
-
onClick: () => o(u),
|
|
553
|
-
children: [
|
|
554
|
-
/* @__PURE__ */ e(de, { name: h, size: 20 }),
|
|
555
|
-
/* @__PURE__ */ e("span", { children: l })
|
|
556
|
-
]
|
|
557
|
-
},
|
|
558
|
-
u
|
|
559
|
-
)) }),
|
|
560
|
-
t !== null && /* @__PURE__ */ e(J, { title: "Call from code", wide: !0, onClose: () => o(null), children: /* @__PURE__ */ e("div", { style: { height: 450 }, children: /* @__PURE__ */ e(No, { resource: i, triggers: r, initialTab: t }) }) })
|
|
561
|
-
] });
|
|
562
|
-
}
|
|
563
|
-
function So() {
|
|
564
|
-
return /* @__PURE__ */ e(de, { name: "code" });
|
|
565
|
-
}
|
|
566
|
-
const Eo = {
|
|
567
|
-
id: "code",
|
|
568
|
-
title: "Code",
|
|
569
|
-
Icon: So,
|
|
570
|
-
isAvailable: (n) => xt(n),
|
|
571
|
-
Panel: Co
|
|
572
|
-
}, To = { project: null, onNavigate: () => {
|
|
573
|
-
} }, En = mn(To);
|
|
574
|
-
function Io({
|
|
575
|
-
project: n,
|
|
576
|
-
onNavigate: t,
|
|
577
|
-
children: o
|
|
578
|
-
}) {
|
|
579
|
-
return /* @__PURE__ */ e(En.Provider, { value: { project: n, onNavigate: t }, children: o });
|
|
580
|
-
}
|
|
581
|
-
function Tn() {
|
|
582
|
-
return Oe(En);
|
|
583
|
-
}
|
|
584
|
-
const Po = "@w6w/call";
|
|
585
|
-
function dn(n) {
|
|
586
|
-
return n ? n.kind === "workflow" ? n.workflow : n.kind === "function" ? n.function : `${n.uses.app}/${n.uses.action}` : "";
|
|
587
|
-
}
|
|
588
|
-
function Ao(n) {
|
|
589
|
-
return (n == null ? void 0 : n.kind) === "workflow" ? "Workflow (asynchronous)" : (n == null ? void 0 : n.kind) === "function" ? "Function (synchronous)" : "App action (synchronous)";
|
|
590
|
-
}
|
|
591
|
-
function Ro(n) {
|
|
592
|
-
const t = kn();
|
|
593
|
-
return cn({
|
|
594
|
-
queryKey: ["functions"],
|
|
595
|
-
queryFn: () => t.functions.list(),
|
|
596
|
-
enabled: n
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
function Oo({
|
|
600
|
-
kind: n,
|
|
601
|
-
id: t,
|
|
602
|
-
policy: o,
|
|
603
|
-
ready: i,
|
|
604
|
-
saving: r,
|
|
605
|
-
onPersist: s
|
|
606
|
-
}) {
|
|
607
|
-
var D, L, B, P;
|
|
608
|
-
const u = Ro(!0), { project: l } = Tn(), h = pn(l ?? void 0, !0), [k, v] = p(!1), [b, y] = p(null), N = (D = o.reroute) == null ? void 0 : D.target, w = dn(N), C = N ? an({
|
|
609
|
-
resource: { kind: n, id: t },
|
|
610
|
-
target: { kind: N.kind, id: w },
|
|
611
|
-
hasAdapter: ((L = o.reroute) == null ? void 0 : L.with) !== void 0
|
|
612
|
-
}) : "allow", m = (N == null ? void 0 : N.kind) === "workflow" ? ((P = (B = h.data) == null ? void 0 : B.find((T) => T.id === w)) == null ? void 0 : P.displayName) ?? void 0 : (() => {
|
|
613
|
-
var O;
|
|
614
|
-
const T = (O = u.data) == null ? void 0 : O.find((g) => g.id === w);
|
|
615
|
-
return T ? T.displayName || T.key : void 0;
|
|
616
|
-
})();
|
|
617
|
-
j(() => {
|
|
618
|
-
t && n && y(null);
|
|
619
|
-
}, [t, n]);
|
|
620
|
-
function A(T) {
|
|
621
|
-
y(null), s(T, y);
|
|
622
|
-
}
|
|
623
|
-
function S(T) {
|
|
624
|
-
var H;
|
|
625
|
-
let O;
|
|
626
|
-
if (T.uses.app === Po) {
|
|
627
|
-
const c = T.with ?? {}, M = typeof c.targetId == "string" ? c.targetId : "";
|
|
628
|
-
if (!M) return;
|
|
629
|
-
O = c.targetKind === "workflow" ? { kind: "workflow", workflow: M } : { kind: "function", function: M };
|
|
630
|
-
} else if (!T.uses.app.startsWith("@w6w/"))
|
|
631
|
-
O = {
|
|
632
|
-
kind: "action",
|
|
633
|
-
uses: {
|
|
634
|
-
app: T.uses.app,
|
|
635
|
-
action: T.uses.action,
|
|
636
|
-
connection: T.uses.connection ?? void 0
|
|
637
|
-
},
|
|
638
|
-
...T.with ? { with: T.with } : {}
|
|
639
|
-
};
|
|
640
|
-
else
|
|
641
|
-
return;
|
|
642
|
-
if (an({
|
|
643
|
-
resource: { kind: n, id: t },
|
|
644
|
-
target: { kind: O.kind, id: dn(O) },
|
|
645
|
-
hasAdapter: ((H = o.reroute) == null ? void 0 : H.with) !== void 0
|
|
646
|
-
}) === "block") {
|
|
647
|
-
y(
|
|
648
|
-
"This handler would call itself with the same inputs and can loop forever. Choose another handler or keep a differing imported adapter."
|
|
649
|
-
), v(!1);
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
A({ ...o, reroute: { ...o.reroute, target: O } }), v(!1);
|
|
653
|
-
}
|
|
654
|
-
return !i && !r ? /* @__PURE__ */ e("p", { className: "muted small", children: "Loading…" }) : /* @__PURE__ */ a("div", { className: "w6w-stack", "data-testid": "rail-errorhandling-body", children: [
|
|
655
|
-
/* @__PURE__ */ a("section", { "data-testid": "rail-retry-section", children: [
|
|
656
|
-
/* @__PURE__ */ e(
|
|
657
|
-
qn,
|
|
658
|
-
{
|
|
659
|
-
value: o.retry,
|
|
660
|
-
onChange: (T) => A({ ...o, retry: T }),
|
|
661
|
-
readOnly: r,
|
|
662
|
-
target: n
|
|
663
|
-
}
|
|
664
|
-
),
|
|
665
|
-
n === "workflow" && /* @__PURE__ */ e("p", { className: "muted small", "data-testid": "rail-retry-run-warning", children: "Retrying re-runs the whole workflow from its first step, so steps that already succeeded run again. For a step that must not repeat (a send or a charge), set retry on that step instead." })
|
|
666
|
-
] }),
|
|
667
|
-
/* @__PURE__ */ e("p", { className: "muted small", children: n === "workflow" ? "What runs when this workflow's run fails, after every step's own retry is spent." : "What runs when this call fails, after retry (if any) is exhausted." }),
|
|
668
|
-
w ? /* @__PURE__ */ a("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
|
|
669
|
-
/* @__PURE__ */ a("span", { className: "list-main", children: [
|
|
670
|
-
/* @__PURE__ */ e("strong", { children: m ?? w }),
|
|
671
|
-
" ",
|
|
672
|
-
/* @__PURE__ */ e("code", { className: "muted", children: w }),
|
|
673
|
-
/* @__PURE__ */ e("span", { className: "muted small block", children: Ao(N) })
|
|
674
|
-
] }),
|
|
675
|
-
/* @__PURE__ */ e(
|
|
676
|
-
"button",
|
|
677
|
-
{
|
|
678
|
-
type: "button",
|
|
679
|
-
className: "btn ghost",
|
|
680
|
-
"data-testid": "rail-errorhandling-change",
|
|
681
|
-
disabled: r,
|
|
682
|
-
onClick: () => v(!0),
|
|
683
|
-
children: "Change"
|
|
684
|
-
}
|
|
685
|
-
)
|
|
686
|
-
] }) : /* @__PURE__ */ e(
|
|
687
|
-
"button",
|
|
688
|
-
{
|
|
689
|
-
type: "button",
|
|
690
|
-
className: "btn",
|
|
691
|
-
"data-testid": "rail-errorhandling-choose",
|
|
692
|
-
disabled: r,
|
|
693
|
-
onClick: () => v(!0),
|
|
694
|
-
children: "+ Choose what runs on failure"
|
|
695
|
-
}
|
|
696
|
-
),
|
|
697
|
-
w && /* @__PURE__ */ e(
|
|
698
|
-
"button",
|
|
699
|
-
{
|
|
700
|
-
type: "button",
|
|
701
|
-
className: "btn ghost",
|
|
702
|
-
"data-testid": "rail-errorhandling-clear",
|
|
703
|
-
disabled: r,
|
|
704
|
-
onClick: () => A({ ...o, reroute: void 0 }),
|
|
705
|
-
children: "Remove handler"
|
|
706
|
-
}
|
|
707
|
-
),
|
|
708
|
-
C === "warn" && /* @__PURE__ */ e("div", { className: "result error", "data-testid": "rail-errorhandling-self-caution", children: "This handler targets itself. Its imported input adapter is preserved; the server will refuse it if it resolves to the failed call's same inputs." }),
|
|
709
|
-
b && /* @__PURE__ */ e("div", { className: "error", "data-testid": "rail-errorhandling-error", children: b }),
|
|
710
|
-
k && /* @__PURE__ */ e(
|
|
711
|
-
Qn,
|
|
712
|
-
{
|
|
713
|
-
appsOnly: !0,
|
|
714
|
-
callables: ["function", "workflow"],
|
|
715
|
-
title: "Choose what runs on failure",
|
|
716
|
-
onClose: () => v(!1),
|
|
717
|
-
onAdd: S
|
|
718
|
-
}
|
|
719
|
-
)
|
|
720
|
-
] });
|
|
721
|
-
}
|
|
722
|
-
function Do({ ctx: n }) {
|
|
723
|
-
const t = (n == null ? void 0 : n.kind) === "workflow" ? n.policy : void 0, o = (n == null ? void 0 : n.kind) === "workflow" ? n.onPolicyChange : void 0;
|
|
724
|
-
return (n == null ? void 0 : n.kind) !== "workflow" ? null : /* @__PURE__ */ e(
|
|
725
|
-
Oo,
|
|
726
|
-
{
|
|
727
|
-
kind: "workflow",
|
|
728
|
-
id: n.id,
|
|
729
|
-
policy: t ? wn(t) : {},
|
|
730
|
-
ready: !!o,
|
|
731
|
-
saving: !1,
|
|
732
|
-
onPersist: (i) => o == null ? void 0 : o(i)
|
|
733
|
-
}
|
|
734
|
-
);
|
|
735
|
-
}
|
|
736
|
-
function Lo() {
|
|
737
|
-
return /* @__PURE__ */ e(de, { name: "warning" });
|
|
738
|
-
}
|
|
739
|
-
const Mo = {
|
|
740
|
-
id: "error-handling",
|
|
741
|
-
title: "Error handling",
|
|
742
|
-
Icon: Lo,
|
|
743
|
-
isAvailable: (n) => Ft(n) && (n == null ? void 0 : n.kind) === "workflow",
|
|
744
|
-
Panel: Do
|
|
745
|
-
};
|
|
746
|
-
function Wo(n, t) {
|
|
747
|
-
if (!t.includes(",")) return { tags: n, typed: t };
|
|
748
|
-
let o = n;
|
|
749
|
-
for (const i of t.split(",")) {
|
|
750
|
-
const r = i.trim();
|
|
751
|
-
r && !o.includes(r) && (o = [...o, r]);
|
|
752
|
-
}
|
|
753
|
-
return { tags: o, typed: "" };
|
|
754
|
-
}
|
|
755
|
-
function jo(n, t) {
|
|
756
|
-
return n.filter((o) => o !== t);
|
|
757
|
-
}
|
|
758
|
-
function xo({ tags: n, onChange: t }) {
|
|
759
|
-
const [o, i] = p("");
|
|
760
|
-
function r(s) {
|
|
761
|
-
const u = Wo(n, s);
|
|
762
|
-
i(u.typed), u.tags !== n && t(u.tags);
|
|
763
|
-
}
|
|
764
|
-
return /* @__PURE__ */ a("div", { className: "tag-list", "data-testid": "tag-editor", children: [
|
|
765
|
-
n.map((s) => /* @__PURE__ */ a("span", { className: "tag removable", children: [
|
|
766
|
-
s,
|
|
767
|
-
/* @__PURE__ */ e(
|
|
768
|
-
z,
|
|
769
|
-
{
|
|
770
|
-
danger: !0,
|
|
771
|
-
icon: "close",
|
|
772
|
-
label: `Remove tag ${s}`,
|
|
773
|
-
title: `Remove ${s}`,
|
|
774
|
-
onClick: () => t(jo(n, s))
|
|
775
|
-
}
|
|
776
|
-
)
|
|
777
|
-
] }, s)),
|
|
778
|
-
/* @__PURE__ */ e(
|
|
779
|
-
"input",
|
|
780
|
-
{
|
|
781
|
-
type: "text",
|
|
782
|
-
value: o,
|
|
783
|
-
placeholder: "Add a tag…",
|
|
784
|
-
"aria-label": "New tag",
|
|
785
|
-
onChange: (s) => r(s.target.value)
|
|
786
|
-
}
|
|
787
|
-
)
|
|
788
|
-
] });
|
|
789
|
-
}
|
|
790
|
-
function Vo(n) {
|
|
791
|
-
const t = ft(n.kind).settings, { initial: o } = n, [i, r] = p(o.displayName), [s, u] = p(o.key ?? ""), [l, h] = p(o.tags ?? []), [k, v] = p(!1), [b, y] = p(null), N = i !== o.displayName, w = s !== (o.key ?? ""), C = t.hasTags && JSON.stringify(l) !== JSON.stringify(o.tags ?? []), m = N || w || C, A = t.canEditKey, S = s === "" || Bt(s), D = m && S && !k;
|
|
792
|
-
async function L() {
|
|
793
|
-
if (D) {
|
|
794
|
-
y(null), v(!0);
|
|
795
|
-
try {
|
|
796
|
-
await n.onSave({
|
|
797
|
-
displayName: i.trim(),
|
|
798
|
-
key: A && w ? s : o.key,
|
|
799
|
-
tags: t.hasTags ? l : void 0
|
|
800
|
-
}), n.onClose();
|
|
801
|
-
} catch (P) {
|
|
802
|
-
y(P instanceof _ ? P.message : String(P));
|
|
803
|
-
} finally {
|
|
804
|
-
v(!1);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
const B = _n(L, { enabled: D });
|
|
809
|
-
return /* @__PURE__ */ a(J, { title: "Edit settings", onClose: n.onClose, children: [
|
|
810
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
811
|
-
/* @__PURE__ */ a("label", { className: "field", children: [
|
|
812
|
-
/* @__PURE__ */ e("span", { children: "Name" }),
|
|
813
|
-
/* @__PURE__ */ e(
|
|
814
|
-
"input",
|
|
815
|
-
{
|
|
816
|
-
type: "text",
|
|
817
|
-
value: i,
|
|
818
|
-
onChange: (P) => r(P.target.value),
|
|
819
|
-
placeholder: t.namePlaceholder,
|
|
820
|
-
autoFocus: !0,
|
|
821
|
-
...B
|
|
822
|
-
}
|
|
823
|
-
)
|
|
824
|
-
] }),
|
|
825
|
-
A && /* @__PURE__ */ a("label", { className: "field", children: [
|
|
826
|
-
/* @__PURE__ */ e("span", { children: "Key" }),
|
|
827
|
-
/* @__PURE__ */ e(
|
|
828
|
-
"input",
|
|
829
|
-
{
|
|
830
|
-
type: "text",
|
|
831
|
-
value: s,
|
|
832
|
-
onChange: (P) => u($t(P.target.value)),
|
|
833
|
-
placeholder: t.keyPlaceholder,
|
|
834
|
-
...B
|
|
835
|
-
}
|
|
836
|
-
),
|
|
837
|
-
/* @__PURE__ */ a("span", { className: "muted small", children: [
|
|
838
|
-
"Lowercase, kebab-case, 3–39 characters.",
|
|
839
|
-
t.keyHintSuffix
|
|
840
|
-
] })
|
|
841
|
-
] }),
|
|
842
|
-
t.hasTags && /* @__PURE__ */ a("div", { children: [
|
|
843
|
-
/* @__PURE__ */ e("p", { className: "muted small", style: { marginBottom: "8px" }, children: "Tags" }),
|
|
844
|
-
/* @__PURE__ */ e(xo, { tags: l, onChange: h })
|
|
845
|
-
] }),
|
|
846
|
-
b && /* @__PURE__ */ e("div", { className: "error", children: b })
|
|
847
|
-
] }),
|
|
848
|
-
/* @__PURE__ */ a("div", { className: "modal-actions", children: [
|
|
849
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: n.onClose, children: "Cancel" }),
|
|
850
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn", disabled: !D, onClick: L, children: k ? "Saving…" : "Save" })
|
|
851
|
-
] })
|
|
852
|
-
] });
|
|
853
|
-
}
|
|
854
|
-
const Fo = {
|
|
855
|
-
function: "functions",
|
|
856
|
-
endpoint: "endpoints",
|
|
857
|
-
workflow: "workflows"
|
|
858
|
-
}, Bo = {
|
|
859
|
-
function: {
|
|
860
|
-
json: "functions-import-json",
|
|
861
|
-
submit: "functions-import-submit",
|
|
862
|
-
unresolved: "functions-import-unresolved",
|
|
863
|
-
goto: "functions-import-goto"
|
|
864
|
-
},
|
|
865
|
-
endpoint: {
|
|
866
|
-
json: "endpoints-import-json",
|
|
867
|
-
submit: "endpoints-import-submit",
|
|
868
|
-
unresolved: "endpoints-import-unresolved",
|
|
869
|
-
goto: "endpoints-import-goto"
|
|
870
|
-
},
|
|
871
|
-
workflow: {
|
|
872
|
-
json: "workflows-import-json",
|
|
873
|
-
submit: "workflows-import-submit",
|
|
874
|
-
unresolved: "workflows-import-unresolved",
|
|
875
|
-
goto: "workflows-import-goto"
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
function $o(n) {
|
|
879
|
-
const { kind: t } = n, o = Fo[t], i = Bo[t], [r, s] = p(""), [u, l] = p(null), [h, k] = p(null), v = mt(n.project, n.listKeys), { parsed: b, blockedReason: y } = Ht(r, t), N = y !== null || v.isPending;
|
|
880
|
-
function w(m) {
|
|
881
|
-
n.onClose(), n.onOpenImported(t, m);
|
|
882
|
-
}
|
|
883
|
-
function C() {
|
|
884
|
-
y !== null || b === null || v.isPending || (l(null), k(null), v.mutate(b, {
|
|
885
|
-
onSuccess: (m) => {
|
|
886
|
-
if (m.references.every((S) => S.resolved)) {
|
|
887
|
-
w(m.callable.id);
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
k({
|
|
891
|
-
callableId: m.callable.id,
|
|
892
|
-
references: m.references.filter((S) => !S.resolved)
|
|
893
|
-
});
|
|
894
|
-
},
|
|
895
|
-
onError: (m) => l(m instanceof _ ? m.message : String(m))
|
|
896
|
-
}));
|
|
897
|
-
}
|
|
898
|
-
return /* @__PURE__ */ a(J, { title: `Import ${t}`, onClose: n.onClose, wide: !0, children: [
|
|
899
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
900
|
-
/* @__PURE__ */ a("p", { className: "muted small", children: [
|
|
901
|
-
"Paste a portable ",
|
|
902
|
-
t,
|
|
903
|
-
" spec document (exported via",
|
|
904
|
-
" ",
|
|
905
|
-
/* @__PURE__ */ a("code", { children: [
|
|
906
|
-
"GET /",
|
|
907
|
-
o,
|
|
908
|
-
"/:id/spec"
|
|
909
|
-
] }),
|
|
910
|
-
"). A fresh id is minted here; connection references are re-bound to whatever this account already has connected, and anything that couldn't be re-bound is reported below."
|
|
911
|
-
] }),
|
|
912
|
-
/* @__PURE__ */ e("div", { "data-testid": i.json, children: /* @__PURE__ */ e(
|
|
913
|
-
un,
|
|
914
|
-
{
|
|
915
|
-
value: r,
|
|
916
|
-
onChange: (m) => {
|
|
917
|
-
s(m), k(null), l(null);
|
|
918
|
-
},
|
|
919
|
-
minHeight: "320px",
|
|
920
|
-
"aria-label": `${t} spec document JSON`
|
|
921
|
-
}
|
|
922
|
-
) }),
|
|
923
|
-
y && r !== "" && /* @__PURE__ */ e("p", { className: "muted small", children: y }),
|
|
924
|
-
u && /* @__PURE__ */ e("div", { className: "result error", children: u }),
|
|
925
|
-
h && /* @__PURE__ */ a("div", { className: "result", "data-testid": i.unresolved, children: [
|
|
926
|
-
/* @__PURE__ */ a("p", { children: [
|
|
927
|
-
"The ",
|
|
928
|
-
t,
|
|
929
|
-
" was created, but ",
|
|
930
|
-
h.references.length,
|
|
931
|
-
" reference",
|
|
932
|
-
h.references.length === 1 ? "" : "s",
|
|
933
|
-
" could not be resolved:"
|
|
934
|
-
] }),
|
|
935
|
-
/* @__PURE__ */ e("ul", { className: "list", children: h.references.map((m) => /* @__PURE__ */ a("li", { children: [
|
|
936
|
-
/* @__PURE__ */ e("code", { children: m.path }),
|
|
937
|
-
" ",
|
|
938
|
-
/* @__PURE__ */ a("span", { className: "muted", children: [
|
|
939
|
-
"(",
|
|
940
|
-
m.kind,
|
|
941
|
-
")"
|
|
942
|
-
] }),
|
|
943
|
-
m.reason && /* @__PURE__ */ a("span", { className: "muted", children: [
|
|
944
|
-
" — ",
|
|
945
|
-
m.reason
|
|
946
|
-
] })
|
|
947
|
-
] }, m.path)) }),
|
|
948
|
-
/* @__PURE__ */ a(
|
|
949
|
-
"button",
|
|
950
|
-
{
|
|
951
|
-
type: "button",
|
|
952
|
-
className: "btn",
|
|
953
|
-
"data-testid": i.goto,
|
|
954
|
-
onClick: () => w(h.callableId),
|
|
955
|
-
children: [
|
|
956
|
-
"Open the created ",
|
|
957
|
-
t
|
|
958
|
-
]
|
|
959
|
-
}
|
|
960
|
-
)
|
|
961
|
-
] })
|
|
962
|
-
] }),
|
|
963
|
-
/* @__PURE__ */ a("div", { className: "modal-actions", children: [
|
|
964
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: n.onClose, children: "Cancel" }),
|
|
965
|
-
/* @__PURE__ */ e(
|
|
966
|
-
"button",
|
|
967
|
-
{
|
|
968
|
-
type: "button",
|
|
969
|
-
className: "btn",
|
|
970
|
-
"data-testid": i.submit,
|
|
971
|
-
disabled: N,
|
|
972
|
-
onClick: C,
|
|
973
|
-
children: v.isPending ? "Importing…" : "Import"
|
|
974
|
-
}
|
|
975
|
-
)
|
|
976
|
-
] })
|
|
977
|
-
] });
|
|
978
|
-
}
|
|
979
|
-
function Ho({
|
|
980
|
-
title: n,
|
|
981
|
-
message: t,
|
|
982
|
-
onConfirm: o,
|
|
983
|
-
onClose: i,
|
|
984
|
-
confirmLabel: r = "Confirm",
|
|
985
|
-
cancelLabel: s = "Cancel",
|
|
986
|
-
destructive: u = !0
|
|
987
|
-
}) {
|
|
988
|
-
return /* @__PURE__ */ a(J, { title: n, onClose: i, children: [
|
|
989
|
-
/* @__PURE__ */ e("div", { className: "modal-body", children: /* @__PURE__ */ e("p", { className: "muted small", children: t }) }),
|
|
990
|
-
/* @__PURE__ */ a("div", { className: "modal-actions", children: [
|
|
991
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: i, children: s }),
|
|
992
|
-
/* @__PURE__ */ e("button", { type: "button", className: u ? "btn danger" : "btn", onClick: o, children: r })
|
|
993
|
-
] })
|
|
994
|
-
] });
|
|
995
|
-
}
|
|
996
|
-
const Ko = {
|
|
997
|
-
function: {
|
|
998
|
-
json: "functions-version-json",
|
|
999
|
-
error: "functions-version-error",
|
|
1000
|
-
revertButton: "functions-version-revert",
|
|
1001
|
-
invokeButton: "functions-version-invoke",
|
|
1002
|
-
invokeJson: "functions-version-invoke-json",
|
|
1003
|
-
invokeError: "functions-version-invoke-error"
|
|
1004
|
-
},
|
|
1005
|
-
workflow: {
|
|
1006
|
-
json: "workflows-version-json",
|
|
1007
|
-
error: "workflows-version-error",
|
|
1008
|
-
revertButton: "workflows-version-revert",
|
|
1009
|
-
invokeButton: "workflows-version-invoke",
|
|
1010
|
-
invokeJson: "workflows-version-invoke-json",
|
|
1011
|
-
invokeError: "workflows-version-invoke-error"
|
|
1012
|
-
},
|
|
1013
|
-
endpoint: {
|
|
1014
|
-
json: "endpoints-version-json",
|
|
1015
|
-
error: "endpoints-version-error",
|
|
1016
|
-
revertButton: "endpoints-version-revert",
|
|
1017
|
-
invokeButton: "endpoints-version-invoke",
|
|
1018
|
-
invokeJson: "endpoints-version-invoke-json",
|
|
1019
|
-
invokeError: "endpoints-version-invoke-error"
|
|
1020
|
-
}
|
|
1021
|
-
};
|
|
1022
|
-
function qo(n) {
|
|
1023
|
-
const { kind: t, id: o, versionNumber: i } = n, r = Ko[t], s = pt(t, o, i, !0), u = vt(t), l = gt(t), [h, k] = p(!1);
|
|
1024
|
-
return /* @__PURE__ */ a(R, { children: [
|
|
1025
|
-
/* @__PURE__ */ a(J, { title: `Version ${i}`, onClose: n.onClose, wide: !0, children: [
|
|
1026
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
1027
|
-
s.isLoading ? /* @__PURE__ */ e("p", { className: "muted small", children: "Loading…" }) : s.isError ? /* @__PURE__ */ e("div", { className: "error", "data-testid": r.error, children: s.error instanceof Error ? s.error.message : String(s.error) }) : s.data ? /* @__PURE__ */ e("div", { "data-testid": r.json, children: /* @__PURE__ */ e(
|
|
1028
|
-
Re,
|
|
1029
|
-
{
|
|
1030
|
-
code: JSON.stringify(s.data.definition, null, 2),
|
|
1031
|
-
language: "json",
|
|
1032
|
-
maxHeight: "420px",
|
|
1033
|
-
copyable: !0
|
|
1034
|
-
}
|
|
1035
|
-
) }) : null,
|
|
1036
|
-
l.data !== void 0 && /* @__PURE__ */ e("div", { "data-testid": r.invokeJson, children: /* @__PURE__ */ e(
|
|
1037
|
-
Re,
|
|
1038
|
-
{
|
|
1039
|
-
code: JSON.stringify(l.data, null, 2),
|
|
1040
|
-
language: "json",
|
|
1041
|
-
maxHeight: "240px",
|
|
1042
|
-
copyable: !0
|
|
1043
|
-
}
|
|
1044
|
-
) }),
|
|
1045
|
-
l.isError && /* @__PURE__ */ e("div", { className: "error", "data-testid": r.invokeError, children: l.error instanceof _ ? l.error.message : String(l.error) })
|
|
1046
|
-
] }),
|
|
1047
|
-
/* @__PURE__ */ a("div", { className: "modal-actions", children: [
|
|
1048
|
-
/* @__PURE__ */ e(
|
|
1049
|
-
"button",
|
|
1050
|
-
{
|
|
1051
|
-
type: "button",
|
|
1052
|
-
className: "btn ghost",
|
|
1053
|
-
"data-testid": r.invokeButton,
|
|
1054
|
-
disabled: l.isPending,
|
|
1055
|
-
onClick: () => l.mutate({ id: o, versionNumber: i }),
|
|
1056
|
-
children: l.isPending ? "Invoking…" : "Invoke this version"
|
|
1057
|
-
}
|
|
1058
|
-
),
|
|
1059
|
-
/* @__PURE__ */ e(
|
|
1060
|
-
"button",
|
|
1061
|
-
{
|
|
1062
|
-
type: "button",
|
|
1063
|
-
className: "btn danger",
|
|
1064
|
-
"data-testid": r.revertButton,
|
|
1065
|
-
disabled: u.isPending,
|
|
1066
|
-
onClick: () => k(!0),
|
|
1067
|
-
children: u.isPending ? "Reverting…" : "Revert to this version"
|
|
1068
|
-
}
|
|
1069
|
-
),
|
|
1070
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: n.onClose, children: "Close" })
|
|
1071
|
-
] })
|
|
1072
|
-
] }),
|
|
1073
|
-
h && /* @__PURE__ */ e(
|
|
1074
|
-
Ho,
|
|
1075
|
-
{
|
|
1076
|
-
title: "Revert to this version",
|
|
1077
|
-
message: `Revert to version ${i}? This restores its content onto the resource's current draft; the resource's key and address stay unchanged.`,
|
|
1078
|
-
confirmLabel: "Revert",
|
|
1079
|
-
destructive: !0,
|
|
1080
|
-
onConfirm: () => {
|
|
1081
|
-
k(!1), u.mutate({ id: o, versionNumber: i });
|
|
1082
|
-
},
|
|
1083
|
-
onClose: () => k(!1)
|
|
1084
|
-
}
|
|
1085
|
-
)
|
|
1086
|
-
] });
|
|
1087
|
-
}
|
|
1088
|
-
function Qo(n) {
|
|
1089
|
-
const {
|
|
1090
|
-
archived: t,
|
|
1091
|
-
deleteLabel: o,
|
|
1092
|
-
deleteTestId: i,
|
|
1093
|
-
archiveTestId: r,
|
|
1094
|
-
onRequestDelete: s,
|
|
1095
|
-
onRequestArchive: u,
|
|
1096
|
-
deleteError: l,
|
|
1097
|
-
archiveError: h
|
|
1098
|
-
} = n;
|
|
1099
|
-
return /* @__PURE__ */ a("div", { className: "rail-danger-zone rail-danger-zone--panel", "data-testid": "rail-danger-zone-panel", children: [
|
|
1100
|
-
t ? /* @__PURE__ */ a("span", { className: "rail-danger-zone-delete", children: [
|
|
1101
|
-
/* @__PURE__ */ e(Jn, { label: o, "data-testid": i, onClick: s }),
|
|
1102
|
-
/* @__PURE__ */ e("span", { children: "Delete" })
|
|
1103
|
-
] }) : /* @__PURE__ */ e(
|
|
1104
|
-
"button",
|
|
1105
|
-
{
|
|
1106
|
-
type: "button",
|
|
1107
|
-
className: "btn danger",
|
|
1108
|
-
"data-testid": r,
|
|
1109
|
-
onClick: u,
|
|
1110
|
-
children: "Archive"
|
|
1111
|
-
}
|
|
1112
|
-
),
|
|
1113
|
-
l && /* @__PURE__ */ e("div", { className: "error", "data-testid": "rail-delete-error", children: l }),
|
|
1114
|
-
h && /* @__PURE__ */ e("div", { className: "error", "data-testid": "rail-archive-error", children: h })
|
|
1115
|
-
] });
|
|
1116
|
-
}
|
|
1117
|
-
function _o(n) {
|
|
1118
|
-
return /* @__PURE__ */ a("div", { className: "right-rail-panel-head rail-settings-head", children: [
|
|
1119
|
-
/* @__PURE__ */ e("h3", { children: "Settings" }),
|
|
1120
|
-
/* @__PURE__ */ e(Un, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: n.onEdit })
|
|
1121
|
-
] });
|
|
1122
|
-
}
|
|
1123
|
-
function Jo(n) {
|
|
1124
|
-
const { id: t, displayName: o, fields: i, row: r, tags: s } = n;
|
|
1125
|
-
return /* @__PURE__ */ e("div", { className: "rail-meta", children: /* @__PURE__ */ e(
|
|
1126
|
-
"div",
|
|
1127
|
-
{
|
|
1128
|
-
style: {
|
|
1129
|
-
display: "flex",
|
|
1130
|
-
justifyContent: "space-between",
|
|
1131
|
-
alignItems: "flex-start",
|
|
1132
|
-
gap: "8px"
|
|
1133
|
-
},
|
|
1134
|
-
children: /* @__PURE__ */ a("dl", { className: "rail-meta-list", children: [
|
|
1135
|
-
o && /* @__PURE__ */ a(R, { children: [
|
|
1136
|
-
/* @__PURE__ */ e("dt", { children: "Name" }),
|
|
1137
|
-
/* @__PURE__ */ e("dd", { "data-testid": "rail-meta-name", children: /* @__PURE__ */ e("code", { children: o }) })
|
|
1138
|
-
] }),
|
|
1139
|
-
/* @__PURE__ */ e("dt", { children: "ID" }),
|
|
1140
|
-
/* @__PURE__ */ e("dd", { "data-testid": "rail-meta-id", children: /* @__PURE__ */ e("code", { children: t }) }),
|
|
1141
|
-
i.includes("key") && r && /* @__PURE__ */ a(R, { children: [
|
|
1142
|
-
/* @__PURE__ */ e("dt", { children: "Key" }),
|
|
1143
|
-
/* @__PURE__ */ e("dd", { "data-testid": "rail-meta-key", children: /* @__PURE__ */ e("code", { children: r.key || "unset" }) })
|
|
1144
|
-
] }),
|
|
1145
|
-
i.includes("updatedAt") && r && /* @__PURE__ */ a(R, { children: [
|
|
1146
|
-
/* @__PURE__ */ e("dt", { children: "Updated" }),
|
|
1147
|
-
/* @__PURE__ */ e("dd", { "data-testid": "rail-meta-updated", "data-value": r.updatedAt, children: new Date(r.updatedAt).toLocaleString() })
|
|
1148
|
-
] }),
|
|
1149
|
-
s !== void 0 && r && /* @__PURE__ */ a(R, { children: [
|
|
1150
|
-
/* @__PURE__ */ e("dt", { children: "Tags" }),
|
|
1151
|
-
/* @__PURE__ */ e("dd", { "data-testid": "rail-meta-tags", children: s.length > 0 ? s.map((u) => /* @__PURE__ */ e("span", { className: "tag", children: u }, u)) : "No tags" })
|
|
1152
|
-
] })
|
|
1153
|
-
] })
|
|
1154
|
-
}
|
|
1155
|
-
) });
|
|
1156
|
-
}
|
|
1157
|
-
function Uo(n) {
|
|
1158
|
-
return /* @__PURE__ */ e("div", { className: "rail-spec-actions", children: /* @__PURE__ */ e(
|
|
1159
|
-
z,
|
|
1160
|
-
{
|
|
1161
|
-
icon: "file-text",
|
|
1162
|
-
label: "Export, edit, or import",
|
|
1163
|
-
"data-testid": "rail-spec-actions-open",
|
|
1164
|
-
onClick: n.onOpen
|
|
1165
|
-
}
|
|
1166
|
-
) });
|
|
1167
|
-
}
|
|
1168
|
-
function zo(n) {
|
|
1169
|
-
const { kind: t, children: o, onImport: i, onClose: r } = n;
|
|
1170
|
-
return /* @__PURE__ */ a(J, { title: "Definition", onClose: r, children: [
|
|
1171
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
1172
|
-
o,
|
|
1173
|
-
/* @__PURE__ */ a("p", { className: "muted small", children: [
|
|
1174
|
-
"Import a spec document to create a NEW ",
|
|
1175
|
-
t,
|
|
1176
|
-
" and navigate to it — this does not replace the ",
|
|
1177
|
-
t,
|
|
1178
|
-
" you have open."
|
|
1179
|
-
] }),
|
|
1180
|
-
/* @__PURE__ */ e("div", { className: "rail-spec-menu-row", children: /* @__PURE__ */ e(
|
|
1181
|
-
"button",
|
|
1182
|
-
{
|
|
1183
|
-
type: "button",
|
|
1184
|
-
className: "btn ghost",
|
|
1185
|
-
"data-testid": "rail-spec-import",
|
|
1186
|
-
onClick: i,
|
|
1187
|
-
children: "Import"
|
|
1188
|
-
}
|
|
1189
|
-
) })
|
|
1190
|
-
] }),
|
|
1191
|
-
/* @__PURE__ */ e("div", { className: "modal-actions", children: /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: r, children: "Close" }) })
|
|
1192
|
-
] });
|
|
1193
|
-
}
|
|
1194
|
-
function Go(n) {
|
|
1195
|
-
const { open: t, versions: o } = n;
|
|
1196
|
-
return /* @__PURE__ */ a("div", { className: "rail-version-section", children: [
|
|
1197
|
-
/* @__PURE__ */ a(
|
|
1198
|
-
"button",
|
|
1199
|
-
{
|
|
1200
|
-
type: "button",
|
|
1201
|
-
className: "rail-link-icon",
|
|
1202
|
-
"data-testid": "rail-history-show",
|
|
1203
|
-
"aria-label": "Version history",
|
|
1204
|
-
title: "Version history",
|
|
1205
|
-
onClick: n.onShow,
|
|
1206
|
-
children: [
|
|
1207
|
-
/* @__PURE__ */ e(de, { name: "clock", size: 14 }),
|
|
1208
|
-
/* @__PURE__ */ e("span", { children: "Version history" })
|
|
1209
|
-
]
|
|
1210
|
-
}
|
|
1211
|
-
),
|
|
1212
|
-
t && /* @__PURE__ */ a(R, { children: [
|
|
1213
|
-
/* @__PURE__ */ e("p", { className: "muted small", "data-testid": "rail-version-published", children: (o == null ? void 0 : o.currentPublishedVersion) != null ? `Published: v${o.currentPublishedVersion}` : "Never published" }),
|
|
1214
|
-
/* @__PURE__ */ a("div", { className: "rail-version-actions", children: [
|
|
1215
|
-
/* @__PURE__ */ e(
|
|
1216
|
-
"button",
|
|
1217
|
-
{
|
|
1218
|
-
type: "button",
|
|
1219
|
-
className: "btn ghost",
|
|
1220
|
-
"data-testid": "rail-publish",
|
|
1221
|
-
disabled: n.publishing,
|
|
1222
|
-
onClick: n.onPublish,
|
|
1223
|
-
children: n.publishing ? "Publishing…" : "Publish"
|
|
1224
|
-
}
|
|
1225
|
-
),
|
|
1226
|
-
" ",
|
|
1227
|
-
/* @__PURE__ */ e(
|
|
1228
|
-
"button",
|
|
1229
|
-
{
|
|
1230
|
-
type: "button",
|
|
1231
|
-
className: "btn ghost",
|
|
1232
|
-
"data-testid": "rail-enable-toggle",
|
|
1233
|
-
disabled: n.togglingEnabled || o === void 0,
|
|
1234
|
-
onClick: n.onToggleEnabled,
|
|
1235
|
-
children: n.togglingEnabled ? "Saving…" : o != null && o.enabled ? "Disable" : "Enable"
|
|
1236
|
-
}
|
|
1237
|
-
)
|
|
1238
|
-
] }),
|
|
1239
|
-
n.publishError && /* @__PURE__ */ e("div", { className: "error", "data-testid": "rail-publish-error", children: n.publishError }),
|
|
1240
|
-
n.enableError && /* @__PURE__ */ e("div", { className: "error", "data-testid": "rail-enable-error", children: n.enableError })
|
|
1241
|
-
] })
|
|
1242
|
-
] });
|
|
1243
|
-
}
|
|
1244
|
-
function Yo(n) {
|
|
1245
|
-
const { loading: t, versions: o } = n;
|
|
1246
|
-
return /* @__PURE__ */ a(J, { title: "All versions", onClose: n.onClose, wide: !0, children: [
|
|
1247
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
1248
|
-
t && /* @__PURE__ */ e("p", { className: "muted small", children: "Loading…" }),
|
|
1249
|
-
(o == null ? void 0 : o.length) === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: "No versions yet." }),
|
|
1250
|
-
o && o.length > 0 && /* @__PURE__ */ e("ul", { className: "list", children: o.map((i) => /* @__PURE__ */ e("li", { className: "selectable", children: /* @__PURE__ */ e(
|
|
1251
|
-
"button",
|
|
1252
|
-
{
|
|
1253
|
-
type: "button",
|
|
1254
|
-
className: "row-select",
|
|
1255
|
-
"data-testid": "rail-version-row",
|
|
1256
|
-
onClick: () => n.onSelect(i.versionNumber),
|
|
1257
|
-
children: /* @__PURE__ */ a("div", { className: "list-main", children: [
|
|
1258
|
-
/* @__PURE__ */ a("code", { children: [
|
|
1259
|
-
"v",
|
|
1260
|
-
i.versionNumber
|
|
1261
|
-
] }),
|
|
1262
|
-
" ",
|
|
1263
|
-
i.isCurrentPublished && /* @__PURE__ */ e("span", { className: "badge", "data-testid": "rail-version-current", children: "Published" }),
|
|
1264
|
-
/* @__PURE__ */ e("div", { className: "muted small", children: new Date(i.createdAt).toLocaleString() })
|
|
1265
|
-
] })
|
|
1266
|
-
}
|
|
1267
|
-
) }, i.versionNumber)) })
|
|
1268
|
-
] }),
|
|
1269
|
-
/* @__PURE__ */ e("div", { className: "modal-actions", children: /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: n.onClose, children: "Done" }) })
|
|
1270
|
-
] });
|
|
1271
|
-
}
|
|
1272
|
-
const Zo = {
|
|
1273
|
-
function: {
|
|
1274
|
-
deleteTitle: "Delete function",
|
|
1275
|
-
deleteMessage: "Delete this function permanently? Any endpoint, workflow, or call pointing to it will start failing with a not-found error the next time it runs, and this cannot be undone.",
|
|
1276
|
-
archiveTitle: "Archive function",
|
|
1277
|
-
archiveMessage: "Archive this function? It stops being invocable and can no longer be edited. Archiving is one-way — there is no unarchive — and only an archived function can be deleted.",
|
|
1278
|
-
deleteLabel: "Delete this function",
|
|
1279
|
-
deleteTestId: "delete-function",
|
|
1280
|
-
archiveTestId: "archive-function"
|
|
1281
|
-
},
|
|
1282
|
-
endpoint: {
|
|
1283
|
-
deleteTitle: "Delete endpoint",
|
|
1284
|
-
deleteMessage: "Delete this endpoint permanently? Any alias, workflow, or call pointing to it will start failing with a not-found error the next time it runs, and this cannot be undone.",
|
|
1285
|
-
archiveTitle: "Archive endpoint",
|
|
1286
|
-
archiveMessage: "Archive this endpoint? It stops being invocable and can no longer be edited. Archiving is one-way — there is no unarchive — and only an archived endpoint can be deleted.",
|
|
1287
|
-
deleteLabel: "Delete this endpoint",
|
|
1288
|
-
deleteTestId: "delete-endpoint",
|
|
1289
|
-
archiveTestId: "archive-endpoint"
|
|
1290
|
-
},
|
|
1291
|
-
workflow: {
|
|
1292
|
-
deleteTitle: "Delete workflow",
|
|
1293
|
-
deleteMessage: "Delete this workflow permanently? Its run history is discarded immediately via cascading deletes and cannot be recovered.",
|
|
1294
|
-
archiveTitle: "Archive workflow",
|
|
1295
|
-
archiveMessage: "Archive this workflow? It stops running and can no longer be published. Archiving is one-way — there is no unarchive — and only an archived workflow can be deleted.",
|
|
1296
|
-
deleteLabel: "Delete this workflow",
|
|
1297
|
-
deleteTestId: "wf-settings-delete",
|
|
1298
|
-
archiveTestId: "wf-settings-archive"
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
function Xo(n) {
|
|
1302
|
-
const t = Zo[n.kind];
|
|
1303
|
-
return /* @__PURE__ */ a(R, { children: [
|
|
1304
|
-
/* @__PURE__ */ e(
|
|
1305
|
-
Qo,
|
|
1306
|
-
{
|
|
1307
|
-
archived: n.archived,
|
|
1308
|
-
deleteLabel: t.deleteLabel,
|
|
1309
|
-
deleteTestId: t.deleteTestId,
|
|
1310
|
-
archiveTestId: t.archiveTestId,
|
|
1311
|
-
onRequestDelete: n.onRequestDelete,
|
|
1312
|
-
onRequestArchive: n.onRequestArchive,
|
|
1313
|
-
deleteError: n.deleteError,
|
|
1314
|
-
archiveError: n.archiveError
|
|
1315
|
-
}
|
|
1316
|
-
),
|
|
1317
|
-
n.deleteConfirming && /* @__PURE__ */ e(
|
|
1318
|
-
nn,
|
|
1319
|
-
{
|
|
1320
|
-
title: t.deleteTitle,
|
|
1321
|
-
message: t.deleteMessage,
|
|
1322
|
-
confirmLabel: "Delete",
|
|
1323
|
-
onConfirm: n.onConfirmDelete,
|
|
1324
|
-
onClose: n.onCloseDelete
|
|
1325
|
-
}
|
|
1326
|
-
),
|
|
1327
|
-
n.archiveConfirming && /* @__PURE__ */ e(
|
|
1328
|
-
nn,
|
|
1329
|
-
{
|
|
1330
|
-
title: t.archiveTitle,
|
|
1331
|
-
message: t.archiveMessage,
|
|
1332
|
-
confirmLabel: "Archive",
|
|
1333
|
-
onConfirm: n.onConfirmArchive,
|
|
1334
|
-
onClose: n.onCloseArchive
|
|
1335
|
-
}
|
|
1336
|
-
)
|
|
1337
|
-
] });
|
|
1338
|
-
}
|
|
1339
|
-
const ei = {
|
|
1340
|
-
functionsKey: ["functions"],
|
|
1341
|
-
endpointsKey: ["endpoints"],
|
|
1342
|
-
workflowsKey: Ct
|
|
1343
|
-
};
|
|
1344
|
-
function ni({
|
|
1345
|
-
ctx: n,
|
|
1346
|
-
project: t,
|
|
1347
|
-
onNavigate: o,
|
|
1348
|
-
open: i
|
|
1349
|
-
}) {
|
|
1350
|
-
var ae, ne;
|
|
1351
|
-
const {
|
|
1352
|
-
editingSettings: r,
|
|
1353
|
-
setEditingSettings: s,
|
|
1354
|
-
historyOpen: u,
|
|
1355
|
-
setHistoryOpen: l,
|
|
1356
|
-
versionListOpen: h,
|
|
1357
|
-
setVersionListOpen: k
|
|
1358
|
-
} = i, v = pn(t ?? void 0), b = (n == null ? void 0 : n.kind) === "workflow", y = (n == null ? void 0 : n.id) ?? "", N = bt(y, b), w = yt(t ?? void 0), C = wt(), m = kt(), [A, S] = p(!1), [D, L] = p(!1), [B, P] = p(!1), [T, O] = p(!1), [g, H] = p(null), [c, M] = p(null), Z = vn("workflow", y, u && b), ce = gn("workflow"), X = Nt("workflow"), [ke, oe] = p(null), [ue, G] = p(null), [x, ie] = p(
|
|
1359
|
-
null
|
|
1360
|
-
);
|
|
1361
|
-
if (!n || n.kind !== "workflow")
|
|
1362
|
-
return /* @__PURE__ */ e("p", { className: "muted small", children: "Open a workflow to see its settings." });
|
|
1363
|
-
const W = (ae = v.data) == null ? void 0 : ae.find((E) => E.id === n.id), K = W && typeof W.displayName == "string" ? W.displayName : "", se = (W == null ? void 0 : W.tags) ?? [], he = (W == null ? void 0 : W.status) === "archived";
|
|
1364
|
-
function ee() {
|
|
1365
|
-
H(null), m.mutate(y, {
|
|
1366
|
-
onSuccess: () => {
|
|
1367
|
-
P(!1), o({ type: "list" });
|
|
1368
|
-
},
|
|
1369
|
-
onError: (E) => {
|
|
1370
|
-
P(!1), H(E instanceof _ ? E.message : String(E));
|
|
1371
|
-
}
|
|
1372
|
-
});
|
|
1373
|
-
}
|
|
1374
|
-
function fe() {
|
|
1375
|
-
M(null), C.mutate(y, {
|
|
1376
|
-
onSuccess: () => {
|
|
1377
|
-
O(!1), o({ type: "list" });
|
|
1378
|
-
},
|
|
1379
|
-
onError: (E) => {
|
|
1380
|
-
O(!1), M(E instanceof _ ? E.message : String(E));
|
|
1381
|
-
}
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
return /* @__PURE__ */ a("div", { className: "rail-settings-panel", children: [
|
|
1385
|
-
/* @__PURE__ */ e(_o, { onEdit: () => s(!0) }),
|
|
1386
|
-
/* @__PURE__ */ e(
|
|
1387
|
-
Jo,
|
|
1388
|
-
{
|
|
1389
|
-
id: n.id,
|
|
1390
|
-
displayName: K,
|
|
1391
|
-
fields: Kt("workflow"),
|
|
1392
|
-
row: W,
|
|
1393
|
-
tags: se
|
|
1394
|
-
}
|
|
1395
|
-
),
|
|
1396
|
-
/* @__PURE__ */ e(Uo, { onOpen: () => S(!0) }),
|
|
1397
|
-
/* @__PURE__ */ e(
|
|
1398
|
-
Go,
|
|
1399
|
-
{
|
|
1400
|
-
open: u,
|
|
1401
|
-
versions: Z.data,
|
|
1402
|
-
publishing: ce.isPending,
|
|
1403
|
-
togglingEnabled: X.isPending,
|
|
1404
|
-
publishError: ke,
|
|
1405
|
-
enableError: ue,
|
|
1406
|
-
onShow: () => {
|
|
1407
|
-
l(!0), k(!0);
|
|
1408
|
-
},
|
|
1409
|
-
onPublish: () => {
|
|
1410
|
-
oe(null), ce.mutate(y, {
|
|
1411
|
-
onError: (E) => oe(E instanceof _ ? E.message : String(E))
|
|
1412
|
-
});
|
|
1413
|
-
},
|
|
1414
|
-
onToggleEnabled: () => {
|
|
1415
|
-
var E;
|
|
1416
|
-
G(null), X.mutate(
|
|
1417
|
-
{ id: y, enabled: !((E = Z.data) != null && E.enabled) },
|
|
1418
|
-
{ onError: (q) => G(q instanceof _ ? q.message : String(q)) }
|
|
1419
|
-
);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
),
|
|
1423
|
-
h && /* @__PURE__ */ e(
|
|
1424
|
-
Yo,
|
|
1425
|
-
{
|
|
1426
|
-
loading: Z.isLoading,
|
|
1427
|
-
versions: (ne = Z.data) == null ? void 0 : ne.versions,
|
|
1428
|
-
onSelect: (E) => ie({ id: y, versionNumber: E }),
|
|
1429
|
-
onClose: () => k(!1)
|
|
1430
|
-
}
|
|
1431
|
-
),
|
|
1432
|
-
x && x.id === y && /* @__PURE__ */ e(
|
|
1433
|
-
qo,
|
|
1434
|
-
{
|
|
1435
|
-
kind: "workflow",
|
|
1436
|
-
id: y,
|
|
1437
|
-
versionNumber: x.versionNumber,
|
|
1438
|
-
onClose: () => ie(null)
|
|
1439
|
-
}
|
|
1440
|
-
),
|
|
1441
|
-
A && /* @__PURE__ */ e(
|
|
1442
|
-
zo,
|
|
1443
|
-
{
|
|
1444
|
-
kind: "workflow",
|
|
1445
|
-
onClose: () => S(!1),
|
|
1446
|
-
onImport: () => {
|
|
1447
|
-
S(!1), L(!0);
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
),
|
|
1451
|
-
r && W && /* @__PURE__ */ e(
|
|
1452
|
-
Vo,
|
|
1453
|
-
{
|
|
1454
|
-
kind: "workflow",
|
|
1455
|
-
id: y,
|
|
1456
|
-
initial: {
|
|
1457
|
-
displayName: K,
|
|
1458
|
-
key: W.key ?? null,
|
|
1459
|
-
tags: se
|
|
1460
|
-
},
|
|
1461
|
-
onSave: async (E) => {
|
|
1462
|
-
if (!N.data) throw new Error("Unable to save settings");
|
|
1463
|
-
const q = N.data;
|
|
1464
|
-
return new Promise((me, Ne) => {
|
|
1465
|
-
const re = {
|
|
1466
|
-
...q.workflow,
|
|
1467
|
-
displayName: E.displayName
|
|
1468
|
-
};
|
|
1469
|
-
E.key !== void 0 && (re.key = E.key), E.tags !== void 0 && (re.tags = E.tags), w.mutate(
|
|
1470
|
-
{ definition: re, ifUnmodifiedSince: q.updatedAt },
|
|
1471
|
-
{ onSuccess: () => me(), onError: Ne }
|
|
1472
|
-
);
|
|
1473
|
-
});
|
|
1474
|
-
},
|
|
1475
|
-
onClose: () => s(!1)
|
|
1476
|
-
},
|
|
1477
|
-
y
|
|
1478
|
-
),
|
|
1479
|
-
/* @__PURE__ */ e(
|
|
1480
|
-
Xo,
|
|
1481
|
-
{
|
|
1482
|
-
kind: "workflow",
|
|
1483
|
-
archived: he,
|
|
1484
|
-
deleteConfirming: B,
|
|
1485
|
-
archiveConfirming: T,
|
|
1486
|
-
deleteError: g,
|
|
1487
|
-
archiveError: c,
|
|
1488
|
-
onRequestDelete: () => P(!0),
|
|
1489
|
-
onRequestArchive: () => O(!0),
|
|
1490
|
-
onConfirmDelete: ee,
|
|
1491
|
-
onConfirmArchive: fe,
|
|
1492
|
-
onCloseDelete: () => P(!1),
|
|
1493
|
-
onCloseArchive: () => O(!1)
|
|
1494
|
-
}
|
|
1495
|
-
),
|
|
1496
|
-
D && /* @__PURE__ */ e(
|
|
1497
|
-
$o,
|
|
1498
|
-
{
|
|
1499
|
-
kind: "workflow",
|
|
1500
|
-
project: t ?? void 0,
|
|
1501
|
-
listKeys: ei,
|
|
1502
|
-
onOpenImported: (E, q) => o({ type: "imported", kind: E, id: q }),
|
|
1503
|
-
onClose: () => L(!1)
|
|
1504
|
-
}
|
|
1505
|
-
)
|
|
1506
|
-
] });
|
|
1507
|
-
}
|
|
1508
|
-
function ti({ ctx: n }) {
|
|
1509
|
-
const { project: t, onNavigate: o } = Tn(), [i, r] = p(!1), [s, u] = p(!1), [l, h] = p(!1);
|
|
1510
|
-
return /* @__PURE__ */ e(
|
|
1511
|
-
ni,
|
|
1512
|
-
{
|
|
1513
|
-
ctx: n,
|
|
1514
|
-
project: t,
|
|
1515
|
-
onNavigate: o,
|
|
1516
|
-
open: {
|
|
1517
|
-
editingSettings: i,
|
|
1518
|
-
setEditingSettings: r,
|
|
1519
|
-
historyOpen: s,
|
|
1520
|
-
setHistoryOpen: u,
|
|
1521
|
-
versionListOpen: l,
|
|
1522
|
-
setVersionListOpen: h
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
);
|
|
1526
|
-
}
|
|
1527
|
-
function oi() {
|
|
1528
|
-
return /* @__PURE__ */ e(de, { name: "settings" });
|
|
1529
|
-
}
|
|
1530
|
-
const ii = {
|
|
1531
|
-
id: "settings",
|
|
1532
|
-
title: "Settings",
|
|
1533
|
-
rendersHeading: !0,
|
|
1534
|
-
Icon: oi,
|
|
1535
|
-
isAvailable: (n) => (n == null ? void 0 : n.kind) === "workflow",
|
|
1536
|
-
Panel: ti
|
|
1537
|
-
}, si = [ii, Eo, Mo], ai = ["string", "number", "boolean", "object", "array"];
|
|
1538
|
-
function ri(n) {
|
|
1539
|
-
const { autoSave: t, savePosition: o, variables: i, onClose: r, onChange: s, onVariablesChange: u } = n, l = zn().vars ?? [], [h, k] = p("general");
|
|
1540
|
-
function v() {
|
|
1541
|
-
u([...i, { key: "" }]);
|
|
1542
|
-
}
|
|
1543
|
-
function b(w, C) {
|
|
1544
|
-
u(i.map((m, A) => A === w ? { ...m, ...C } : m));
|
|
1545
|
-
}
|
|
1546
|
-
function y(w) {
|
|
1547
|
-
u(i.filter((C, m) => m !== w));
|
|
1548
|
-
}
|
|
1549
|
-
const N = qt(i);
|
|
1550
|
-
return /* @__PURE__ */ a(J, { title: "Workflow settings", onClose: r, wide: !0, children: [
|
|
1551
|
-
/* @__PURE__ */ a("div", { className: "w6w-subtabs", children: [
|
|
1552
|
-
/* @__PURE__ */ e(
|
|
1553
|
-
"button",
|
|
1554
|
-
{
|
|
1555
|
-
type: "button",
|
|
1556
|
-
className: `w6w-subtab${h === "general" ? " active" : ""}`,
|
|
1557
|
-
onClick: () => k("general"),
|
|
1558
|
-
children: "General"
|
|
1559
|
-
}
|
|
1560
|
-
),
|
|
1561
|
-
/* @__PURE__ */ e(
|
|
1562
|
-
"button",
|
|
1563
|
-
{
|
|
1564
|
-
type: "button",
|
|
1565
|
-
className: `w6w-subtab${h === "variables" ? " active" : ""}`,
|
|
1566
|
-
onClick: () => k("variables"),
|
|
1567
|
-
children: "Variables"
|
|
1568
|
-
}
|
|
1569
|
-
)
|
|
1570
|
-
] }),
|
|
1571
|
-
h === "general" ? /* @__PURE__ */ a(R, { children: [
|
|
1572
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
1573
|
-
/* @__PURE__ */ e("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." }),
|
|
1574
|
-
/* @__PURE__ */ a(
|
|
1575
|
-
"label",
|
|
1576
|
-
{
|
|
1577
|
-
style: {
|
|
1578
|
-
display: "flex",
|
|
1579
|
-
alignItems: "center",
|
|
1580
|
-
gap: "var(--w6w-sp-2)",
|
|
1581
|
-
cursor: "pointer"
|
|
1582
|
-
},
|
|
1583
|
-
title: "Save edits as you make them, without pressing Save.",
|
|
1584
|
-
children: [
|
|
1585
|
-
/* @__PURE__ */ e(
|
|
1586
|
-
"input",
|
|
1587
|
-
{
|
|
1588
|
-
type: "checkbox",
|
|
1589
|
-
checked: t,
|
|
1590
|
-
onChange: (w) => s("autoSave", w.target.checked)
|
|
1591
|
-
}
|
|
1592
|
-
),
|
|
1593
|
-
/* @__PURE__ */ e("span", { className: "muted small", children: "Auto-save edits" })
|
|
1594
|
-
]
|
|
1595
|
-
}
|
|
1596
|
-
),
|
|
1597
|
-
/* @__PURE__ */ a(
|
|
1598
|
-
"label",
|
|
1599
|
-
{
|
|
1600
|
-
style: {
|
|
1601
|
-
display: "flex",
|
|
1602
|
-
alignItems: "center",
|
|
1603
|
-
gap: "var(--w6w-sp-2)",
|
|
1604
|
-
cursor: "pointer"
|
|
1605
|
-
},
|
|
1606
|
-
title: "Keep the arrangement of the canvas — where each step sits, and the view you left it at.",
|
|
1607
|
-
children: [
|
|
1608
|
-
/* @__PURE__ */ e(
|
|
1609
|
-
"input",
|
|
1610
|
-
{
|
|
1611
|
-
type: "checkbox",
|
|
1612
|
-
checked: o,
|
|
1613
|
-
onChange: (w) => s("savePosition", w.target.checked)
|
|
1614
|
-
}
|
|
1615
|
-
),
|
|
1616
|
-
/* @__PURE__ */ e("span", { className: "muted small", children: "Save step positions and canvas view" })
|
|
1617
|
-
]
|
|
1618
|
-
}
|
|
1619
|
-
)
|
|
1620
|
-
] }),
|
|
1621
|
-
/* @__PURE__ */ e("div", { className: "modal-actions", children: /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: r, children: "Done" }) })
|
|
1622
|
-
] }) : /* @__PURE__ */ a(R, { children: [
|
|
1623
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
1624
|
-
/* @__PURE__ */ a("p", { className: "muted small", children: [
|
|
1625
|
-
"Declaring variables here defines this workflow's ",
|
|
1626
|
-
/* @__PURE__ */ e("strong", { children: "public input schema" }),
|
|
1627
|
-
": API and AI (MCP) callers then see exactly these inputs. With none declared, they may send anything."
|
|
1628
|
-
] }),
|
|
1629
|
-
/* @__PURE__ */ a("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
|
|
1630
|
-
/* @__PURE__ */ e("span", { className: "muted small", children: i.length === 0 ? "No variables declared." : `${i.length} variable${i.length === 1 ? "" : "s"} declared.` }),
|
|
1631
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: v, children: "+ Add variable" })
|
|
1632
|
-
] }),
|
|
1633
|
-
i.length > 0 && /* @__PURE__ */ e("ul", { className: "list", "data-testid": "workflow-variables-list", children: i.map((w, C) => /* @__PURE__ */ a(
|
|
1634
|
-
"li",
|
|
1635
|
-
{
|
|
1636
|
-
style: {
|
|
1637
|
-
flexDirection: "column",
|
|
1638
|
-
alignItems: "stretch",
|
|
1639
|
-
gap: "var(--w6w-sp-1)"
|
|
1640
|
-
},
|
|
1641
|
-
children: [
|
|
1642
|
-
/* @__PURE__ */ a("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: [
|
|
1643
|
-
/* @__PURE__ */ e(
|
|
1644
|
-
"input",
|
|
1645
|
-
{
|
|
1646
|
-
type: "text",
|
|
1647
|
-
value: w.key,
|
|
1648
|
-
placeholder: "key",
|
|
1649
|
-
"aria-label": "Variable key",
|
|
1650
|
-
onChange: (m) => b(C, { key: m.target.value })
|
|
1651
|
-
}
|
|
1652
|
-
),
|
|
1653
|
-
/* @__PURE__ */ a(
|
|
1654
|
-
"select",
|
|
1655
|
-
{
|
|
1656
|
-
value: w.type ?? "",
|
|
1657
|
-
"aria-label": "Variable type",
|
|
1658
|
-
onChange: (m) => b(C, {
|
|
1659
|
-
type: m.target.value || void 0
|
|
1660
|
-
}),
|
|
1661
|
-
children: [
|
|
1662
|
-
/* @__PURE__ */ e("option", { value: "", children: "(unset)" }),
|
|
1663
|
-
ai.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
|
|
1664
|
-
]
|
|
1665
|
-
}
|
|
1666
|
-
),
|
|
1667
|
-
/* @__PURE__ */ a(
|
|
1668
|
-
"label",
|
|
1669
|
-
{
|
|
1670
|
-
className: "row",
|
|
1671
|
-
style: { gap: "var(--w6w-sp-1)", alignItems: "center" },
|
|
1672
|
-
children: [
|
|
1673
|
-
/* @__PURE__ */ e(
|
|
1674
|
-
"input",
|
|
1675
|
-
{
|
|
1676
|
-
type: "checkbox",
|
|
1677
|
-
checked: w.required ?? !1,
|
|
1678
|
-
onChange: (m) => b(C, { required: m.target.checked })
|
|
1679
|
-
}
|
|
1680
|
-
),
|
|
1681
|
-
/* @__PURE__ */ e("span", { className: "muted small", children: "required" })
|
|
1682
|
-
]
|
|
1683
|
-
}
|
|
1684
|
-
),
|
|
1685
|
-
/* @__PURE__ */ e(
|
|
1686
|
-
hn,
|
|
1687
|
-
{
|
|
1688
|
-
value: { vars: Qt(i, C, l) },
|
|
1689
|
-
children: /* @__PURE__ */ e(
|
|
1690
|
-
Gn,
|
|
1691
|
-
{
|
|
1692
|
-
value: w.default,
|
|
1693
|
-
onChange: (m) => b(C, { default: m }),
|
|
1694
|
-
placeholder: "default",
|
|
1695
|
-
"aria-label": "Variable default"
|
|
1696
|
-
},
|
|
1697
|
-
`${i.length}:${C}`
|
|
1698
|
-
)
|
|
1699
|
-
}
|
|
1700
|
-
),
|
|
1701
|
-
/* @__PURE__ */ e(
|
|
1702
|
-
z,
|
|
1703
|
-
{
|
|
1704
|
-
danger: !0,
|
|
1705
|
-
icon: "close",
|
|
1706
|
-
label: `Remove variable ${w.key || C + 1}`,
|
|
1707
|
-
onClick: () => y(C)
|
|
1708
|
-
}
|
|
1709
|
-
)
|
|
1710
|
-
] }),
|
|
1711
|
-
N.includes(C) && /* @__PURE__ */ e("span", { className: "muted small", "data-testid": "variable-duplicate", children: "Duplicate key — a later row with the same name wins." })
|
|
1712
|
-
]
|
|
1713
|
-
},
|
|
1714
|
-
C
|
|
1715
|
-
)) })
|
|
1716
|
-
] }),
|
|
1717
|
-
/* @__PURE__ */ e("div", { className: "modal-actions", children: /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: r, children: "Done" }) })
|
|
1718
|
-
] })
|
|
1719
|
-
] });
|
|
1720
|
-
}
|
|
1721
|
-
const li = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, di = "Untitled workflow", ci = (n) => ["app-actions", n], ui = /* @__PURE__ */ new Map();
|
|
1722
|
-
function hi(n) {
|
|
1723
|
-
var l;
|
|
1724
|
-
const t = fn(), o = (l = t.listAppsByIds) == null ? void 0 : l.bind(t), i = [...n].sort().join(","), s = cn({
|
|
1725
|
-
queryKey: ["editor-apps", i],
|
|
1726
|
-
queryFn: ({ signal: h }) => o ? o(n, { signal: h }) : Promise.resolve([]),
|
|
1727
|
-
enabled: n.length > 0 && typeof o == "function"
|
|
1728
|
-
}).data;
|
|
1729
|
-
return { byId: F(
|
|
1730
|
-
() => s ? new Map(s.map((h) => [h.id, h])) : ui,
|
|
1731
|
-
[s]
|
|
1732
|
-
) };
|
|
1733
|
-
}
|
|
1734
|
-
const fi = nt(
|
|
1735
|
-
() => import("@w6w/ui/flow").then((n) => ({ default: n.WorkflowFlowEditor }))
|
|
1736
|
-
);
|
|
1737
|
-
function mi(n) {
|
|
1738
|
-
var Je, Ue, ze, Ge, Ye;
|
|
1739
|
-
const { workflowId: t, project: o, initialRunId: i, onNavigate: r, slots: s } = n, u = kn(), l = fn(), [h, k] = p(!0), [v, b] = p(null), [y, N] = p(null), [w, C] = p(!1), [m, A] = p(!1), [S, D] = p(!1), [L, B] = p(void 0), P = $(!0), T = $(() => null), O = we(
|
|
1740
|
-
(d) => {
|
|
1741
|
-
const f = d;
|
|
1742
|
-
return li.test(typeof f.id == "string" ? f.id : "") ? rn(L, f.key).reason : "Invalid workflow id.";
|
|
1743
|
-
},
|
|
1744
|
-
[L]
|
|
1745
|
-
), g = Xt({
|
|
1746
|
-
workflowId: t,
|
|
1747
|
-
project: o,
|
|
1748
|
-
autoSave: P.current,
|
|
1749
|
-
// The expression editor holds uncommitted parts in its own local state until its Save
|
|
1750
|
-
// button, so saving from under it would persist a workflow without the expression the user
|
|
1751
|
-
// is looking at. Read at fire time (opening it changes neither the buffer nor `canSave`).
|
|
1752
|
-
canAutoSave: () => !document.querySelector(".w6w-exprmodal"),
|
|
1753
|
-
saveGuard: O,
|
|
1754
|
-
publishBlockedReason: (d) => T.current(d)
|
|
1755
|
-
}), H = g.json, c = g.parsed, M = g.canSave, Z = g.dirty;
|
|
1756
|
-
j(() => {
|
|
1757
|
-
if (g.loading || g.loadError !== null) {
|
|
1758
|
-
B(void 0);
|
|
1759
|
-
return;
|
|
1760
|
-
}
|
|
1761
|
-
!g.dirty && c && B(c.key ?? null);
|
|
1762
|
-
}, [g.loading, g.loadError, g.dirty, c]);
|
|
1763
|
-
const [ce, X] = p(!1);
|
|
1764
|
-
j(() => {
|
|
1765
|
-
g.stale || X(!1);
|
|
1766
|
-
}, [g.stale]);
|
|
1767
|
-
const [ke, oe] = p(!1), ue = $(!1);
|
|
1768
|
-
j(() => {
|
|
1769
|
-
g.saving ? oe(!1) : ue.current && g.error === null && oe(!0), ue.current = g.saving;
|
|
1770
|
-
}, [g.saving, g.error]);
|
|
1771
|
-
const [G, x] = p(null), ie = St(), W = Et(), K = Tt(G), se = (Je = K.data) == null ? void 0 : Je.status, he = K.isError, ee = It(se, he), fe = Pt(
|
|
1772
|
-
(Ue = K.data) == null ? void 0 : Ue.steps
|
|
1773
|
-
), ae = At(K.data, fe), ne = $(!1), [E, q] = p(!1);
|
|
1774
|
-
j(() => {
|
|
1775
|
-
x(null);
|
|
1776
|
-
}, [t]), j(() => {
|
|
1777
|
-
i && x(i);
|
|
1778
|
-
}, [t, i]), j(() => {
|
|
1779
|
-
K.data && K.data.workflowId !== t && x(null);
|
|
1780
|
-
}, [K.data, t]);
|
|
1781
|
-
async function me(d) {
|
|
1782
|
-
try {
|
|
1783
|
-
const f = await g.flushThen(d);
|
|
1784
|
-
!f.ok && f.outcome.status === "blocked" && N(f.outcome.reason);
|
|
1785
|
-
} catch (f) {
|
|
1786
|
-
N(f instanceof _ ? f.message : String(f));
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
async function Ne() {
|
|
1790
|
-
var d;
|
|
1791
|
-
if (!(!t || ee || ne.current)) {
|
|
1792
|
-
N(null), ne.current = !0, q(!0);
|
|
1793
|
-
try {
|
|
1794
|
-
const f = await Dt(
|
|
1795
|
-
(d = ve == null ? void 0 : ve[0]) == null ? void 0 : d.id,
|
|
1796
|
-
(I) => sn(u, t, I)
|
|
1797
|
-
);
|
|
1798
|
-
await me(
|
|
1799
|
-
() => ie.mutateAsync({ id: t, variables: {}, ...f ? { input: f } : {} }).then((I) => x(I.runId))
|
|
1800
|
-
);
|
|
1801
|
-
} finally {
|
|
1802
|
-
ne.current = !1, q(!1);
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
function re() {
|
|
1807
|
-
G && (W.mutate(G, {
|
|
1808
|
-
onError: (d) => {
|
|
1809
|
-
const f = d instanceof _ ? d.code : "";
|
|
1810
|
-
Lt(f) === "surface" && N(d instanceof _ ? d.message : String(d));
|
|
1811
|
-
}
|
|
1812
|
-
}), x(null));
|
|
1813
|
-
}
|
|
1814
|
-
async function In() {
|
|
1815
|
-
D(!0);
|
|
1816
|
-
try {
|
|
1817
|
-
await g.reload(), k(!0), b(null), N(null);
|
|
1818
|
-
} finally {
|
|
1819
|
-
D(!1);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
const pe = g.stale ? null : g.error ?? g.loadError, Le = y ?? (pe === null ? null : pe instanceof Error ? pe.message : String(pe)), Pn = c !== null && Array.isArray(c.steps), Me = (c == null ? void 0 : c.displayName) ?? "", Ce = _t(c == null ? void 0 : c.settings), An = F(() => Jt(c == null ? void 0 : c.variables), [c == null ? void 0 : c.variables]), We = rn(L, c == null ? void 0 : c.key), je = c !== null && L !== void 0 && !We.allowed ? We.reason : null, Q = F(
|
|
1823
|
-
() => Array.isArray(c == null ? void 0 : c.steps) ? c.steps : [],
|
|
1824
|
-
[c]
|
|
1825
|
-
), [V, Rn] = p(null);
|
|
1826
|
-
j(() => {
|
|
1827
|
-
let d = !1;
|
|
1828
|
-
return import("@w6w/ui/flow").then((f) => {
|
|
1829
|
-
d || Rn({
|
|
1830
|
-
internalNodes: f.INTERNAL_NODES,
|
|
1831
|
-
isInternalApp: f.isInternalApp,
|
|
1832
|
-
internalNodeParams: f.internalNodeParams,
|
|
1833
|
-
isManualTrigger: (I) => I === f.TRIGGER_APP,
|
|
1834
|
-
asFieldDefs: f.asFieldDefs
|
|
1835
|
-
});
|
|
1836
|
-
}), () => {
|
|
1837
|
-
d = !0;
|
|
1838
|
-
};
|
|
1839
|
-
}, []);
|
|
1840
|
-
const ve = F(() => {
|
|
1841
|
-
if (V)
|
|
1842
|
-
return Ut(
|
|
1843
|
-
{ steps: Q },
|
|
1844
|
-
{ isManualTrigger: V.isManualTrigger, asFieldDefs: V.asFieldDefs }
|
|
1845
|
-
);
|
|
1846
|
-
}, [V, Q]), xe = F(() => {
|
|
1847
|
-
if (!V) return !1;
|
|
1848
|
-
const d = new Set(
|
|
1849
|
-
V.internalNodes.filter((f) => f.group === "trigger").map((f) => `${f.app}::${f.action}`)
|
|
1850
|
-
);
|
|
1851
|
-
return Q.some((f) => {
|
|
1852
|
-
const { app: I, action: U } = f.uses ?? {};
|
|
1853
|
-
return !!I && !!U && d.has(`${I}::${U}`);
|
|
1854
|
-
});
|
|
1855
|
-
}, [V, Q]), ge = F(() => {
|
|
1856
|
-
if (!V) return [];
|
|
1857
|
-
const d = /* @__PURE__ */ new Set();
|
|
1858
|
-
for (const f of Q) {
|
|
1859
|
-
const { app: I, action: U } = f.uses ?? {};
|
|
1860
|
-
I && U && !V.isInternalApp(I) && d.add(I);
|
|
1861
|
-
}
|
|
1862
|
-
return [...d];
|
|
1863
|
-
}, [V, Q]), { byId: be } = hi(ge), On = F(() => [...be.values()], [be]), Ve = en({
|
|
1864
|
-
queries: ge.map((d) => ({
|
|
1865
|
-
queryKey: ci(d),
|
|
1866
|
-
queryFn: () => l.getAppActions(d)
|
|
1867
|
-
}))
|
|
1868
|
-
}), Fe = F(() => {
|
|
1869
|
-
var f, I;
|
|
1870
|
-
const d = {};
|
|
1871
|
-
if (!V) return d;
|
|
1872
|
-
for (const U of Q) {
|
|
1873
|
-
const { app: Y, action: te } = U.uses ?? {};
|
|
1874
|
-
if (!Y || !te) continue;
|
|
1875
|
-
const Pe = `${Y}::${te}`;
|
|
1876
|
-
if (!(Pe in d))
|
|
1877
|
-
if (V.isInternalApp(Y))
|
|
1878
|
-
d[Pe] = V.internalNodeParams(Y, te);
|
|
1879
|
-
else {
|
|
1880
|
-
const Ze = ge.indexOf(Y), Ae = Ze >= 0 ? (f = Ve[Ze]) == null ? void 0 : f.data : void 0;
|
|
1881
|
-
d[Pe] = ((I = Ae == null ? void 0 : Ae.find((jn) => jn.key === te)) == null ? void 0 : I.params) ?? [];
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
return d;
|
|
1885
|
-
}, [V, Q, ge, Ve]), le = F(() => {
|
|
1886
|
-
const d = {};
|
|
1887
|
-
for (const [f, I] of be) d[f] = I;
|
|
1888
|
-
return d;
|
|
1889
|
-
}, [be]), Se = F(
|
|
1890
|
-
() => Q.filter((d) => {
|
|
1891
|
-
var I;
|
|
1892
|
-
const f = (I = d.uses) == null ? void 0 : I.app;
|
|
1893
|
-
return !!f && f in le && tn(le[f]);
|
|
1894
|
-
}),
|
|
1895
|
-
[Q, le]
|
|
1896
|
-
), Be = en({
|
|
1897
|
-
queries: Se.map((d) => ({
|
|
1898
|
-
queryKey: Rt(t, d.id),
|
|
1899
|
-
queryFn: () => sn(u, t, d.id),
|
|
1900
|
-
enabled: !!t
|
|
1901
|
-
}))
|
|
1902
|
-
}), $e = F(() => {
|
|
1903
|
-
const d = {};
|
|
1904
|
-
return Se.forEach((f, I) => {
|
|
1905
|
-
var U, Y;
|
|
1906
|
-
d[f.id] = !!((Y = (U = Be[I]) == null ? void 0 : U.data) != null && Y.some((te) => te.lastRunStatus === "succeeded"));
|
|
1907
|
-
}), d;
|
|
1908
|
-
}, [Se, Be]), Ee = vn("workflow", t, !!t), Te = gn("workflow"), Ie = F(
|
|
1909
|
-
() => ({
|
|
1910
|
-
hasTrigger: xe,
|
|
1911
|
-
actionParamsByKey: Fe,
|
|
1912
|
-
appsById: le,
|
|
1913
|
-
testStatus: $e,
|
|
1914
|
-
requiredParamsFilled: Yn,
|
|
1915
|
-
isTestRequired: tn
|
|
1916
|
-
}),
|
|
1917
|
-
[xe, Fe, le, $e]
|
|
1918
|
-
), He = c !== null && zt(c, Ie), Dn = c !== null ? ln(c, Ie) : null;
|
|
1919
|
-
T.current = (d) => d !== null && typeof d == "object" ? ln(d, Ie) : null, P.current = Ce.autoSave;
|
|
1920
|
-
function Ke(d) {
|
|
1921
|
-
if (!c) return;
|
|
1922
|
-
const f = { ...c, ...d };
|
|
1923
|
-
g.setJson(JSON.stringify(f, null, 2));
|
|
1924
|
-
}
|
|
1925
|
-
function Ln(d) {
|
|
1926
|
-
if (!c) return;
|
|
1927
|
-
const f = { ...c, ...d };
|
|
1928
|
-
N(null), g.commit(JSON.stringify(f, null, 2));
|
|
1929
|
-
}
|
|
1930
|
-
const qe = $(c);
|
|
1931
|
-
qe.current = c;
|
|
1932
|
-
const Qe = $(g.commit);
|
|
1933
|
-
Qe.current = g.commit;
|
|
1934
|
-
const _e = $(g.saveNow);
|
|
1935
|
-
_e.current = g.saveNow, j(() => {
|
|
1936
|
-
const d = (f) => {
|
|
1937
|
-
f.altKey || !(f.metaKey || f.ctrlKey) || f.key.toLowerCase() !== "s" || (f.preventDefault(), !document.querySelector(".w6w-exprmodal") && M && _e.current());
|
|
1938
|
-
};
|
|
1939
|
-
return document.addEventListener("keydown", d), () => {
|
|
1940
|
-
document.removeEventListener("keydown", d);
|
|
1941
|
-
};
|
|
1942
|
-
}, [M]);
|
|
1943
|
-
const Mn = F(
|
|
1944
|
-
() => c ? wn(c) : {},
|
|
1945
|
-
[c]
|
|
1946
|
-
), Wn = we((d) => {
|
|
1947
|
-
const f = qe.current;
|
|
1948
|
-
if (!f) return;
|
|
1949
|
-
const I = Gt(f, d);
|
|
1950
|
-
N(null), Qe.current(JSON.stringify(I, null, 2));
|
|
1951
|
-
}, []);
|
|
1952
|
-
return mo({
|
|
1953
|
-
kind: "workflow",
|
|
1954
|
-
id: t,
|
|
1955
|
-
label: Me,
|
|
1956
|
-
key: (c == null ? void 0 : c.key) ?? void 0,
|
|
1957
|
-
triggers: ve,
|
|
1958
|
-
policy: Mn,
|
|
1959
|
-
onPolicyChange: Wn
|
|
1960
|
-
}), /* @__PURE__ */ a("div", { className: "wf-fullbleed", style: { height: "100%", minWidth: 0, flex: 1 }, children: [
|
|
1961
|
-
(s == null ? void 0 : s.header) ?? /* @__PURE__ */ e(
|
|
1962
|
-
to,
|
|
1963
|
-
{
|
|
1964
|
-
onBack: () => r({ type: "list" }),
|
|
1965
|
-
backLabel: (s == null ? void 0 : s.backLabel) ?? "← Workflows",
|
|
1966
|
-
title: {
|
|
1967
|
-
editable: !0,
|
|
1968
|
-
value: Me,
|
|
1969
|
-
placeholder: di,
|
|
1970
|
-
maxLength: 80,
|
|
1971
|
-
ariaLabel: "Workflow name",
|
|
1972
|
-
onChange: (d) => Ke({ displayName: d }),
|
|
1973
|
-
onBlur: () => {
|
|
1974
|
-
M && g.saveNow();
|
|
1975
|
-
}
|
|
1976
|
-
},
|
|
1977
|
-
actions: /* @__PURE__ */ a(R, { children: [
|
|
1978
|
-
/* @__PURE__ */ e(
|
|
1979
|
-
z,
|
|
1980
|
-
{
|
|
1981
|
-
icon: "play",
|
|
1982
|
-
label: Ot(se, he),
|
|
1983
|
-
"data-testid": "wf-run-start",
|
|
1984
|
-
onClick: Ne,
|
|
1985
|
-
disabled: !t || ee || E || ie.isPending
|
|
1986
|
-
}
|
|
1987
|
-
),
|
|
1988
|
-
ee && /* @__PURE__ */ e(
|
|
1989
|
-
z,
|
|
1990
|
-
{
|
|
1991
|
-
icon: "stop",
|
|
1992
|
-
label: "Stop this run",
|
|
1993
|
-
"data-testid": "wf-run-stop",
|
|
1994
|
-
onClick: re,
|
|
1995
|
-
disabled: W.isPending
|
|
1996
|
-
}
|
|
1997
|
-
),
|
|
1998
|
-
/* @__PURE__ */ e(
|
|
1999
|
-
"button",
|
|
2000
|
-
{
|
|
2001
|
-
type: "button",
|
|
2002
|
-
className: `btn ghost wf-publish${((ze = Ee.data) == null ? void 0 : ze.currentPublishedVersion) != null ? " active" : ""}`,
|
|
2003
|
-
"data-testid": "wf-publish",
|
|
2004
|
-
onClick: () => {
|
|
2005
|
-
t && (N(null), me(() => Te.mutateAsync(t)));
|
|
2006
|
-
},
|
|
2007
|
-
disabled: o === null || !M || !He || Te.isPending,
|
|
2008
|
-
title: M && !He ? Dn ?? "Workflow is not valid" : ((Ge = Ee.data) == null ? void 0 : Ge.currentPublishedVersion) != null ? "Published — click to publish a new version" : "Never published — click to publish",
|
|
2009
|
-
children: Te.isPending ? "Publishing…" : ((Ye = Ee.data) == null ? void 0 : Ye.currentPublishedVersion) != null ? "● Published" : "Publish"
|
|
2010
|
-
}
|
|
2011
|
-
),
|
|
2012
|
-
/* @__PURE__ */ e(
|
|
2013
|
-
co,
|
|
2014
|
-
{
|
|
2015
|
-
kind: "workflow",
|
|
2016
|
-
id: t,
|
|
2017
|
-
onOpenRun: (d) => {
|
|
2018
|
-
x(d), r({ type: "run", id: t, runId: d });
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
),
|
|
2022
|
-
/* @__PURE__ */ e(uo, { onClick: () => C(!0) }),
|
|
2023
|
-
/* @__PURE__ */ e(
|
|
2024
|
-
z,
|
|
2025
|
-
{
|
|
2026
|
-
icon: "settings",
|
|
2027
|
-
label: "Workflow settings",
|
|
2028
|
-
onClick: () => A(!0)
|
|
2029
|
-
}
|
|
2030
|
-
),
|
|
2031
|
-
s == null ? void 0 : s.headerActions
|
|
2032
|
-
] })
|
|
2033
|
-
}
|
|
2034
|
-
),
|
|
2035
|
-
/* @__PURE__ */ e("div", { className: "wf-fullbleed-canvas", children: /* @__PURE__ */ a("div", { className: "wf-run-area", children: [
|
|
2036
|
-
/* @__PURE__ */ e("div", { className: "wf-run-canvas", children: /* @__PURE__ */ e(et, { fallback: /* @__PURE__ */ e("p", { className: "muted", children: "Loading visual editor…" }), children: Pn && c ? /* @__PURE__ */ e(
|
|
2037
|
-
fi,
|
|
2038
|
-
{
|
|
2039
|
-
value: c,
|
|
2040
|
-
onChange: (d) => {
|
|
2041
|
-
g.setJson(JSON.stringify(d, null, 2)), k(!0), b(null), x(null);
|
|
2042
|
-
},
|
|
2043
|
-
apps: On,
|
|
2044
|
-
project: o ?? void 0,
|
|
2045
|
-
height: "100%",
|
|
2046
|
-
readOnly: ee,
|
|
2047
|
-
fitViewKey: G !== null,
|
|
2048
|
-
runState: K.data,
|
|
2049
|
-
onTestRun: () => x(null)
|
|
2050
|
-
}
|
|
2051
|
-
) : H === "" ? /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ e("p", { className: "muted", children: "Fix the JSON to render the visual editor." }) }) }),
|
|
2052
|
-
G && /* @__PURE__ */ e("div", { className: "wf-run-log", "data-testid": "wf-run-log", children: /* @__PURE__ */ e(
|
|
2053
|
-
Zn,
|
|
2054
|
-
{
|
|
2055
|
-
steps: fe,
|
|
2056
|
-
runError: ae.runError,
|
|
2057
|
-
stepErrors: ae.stepErrors,
|
|
2058
|
-
onDismiss: () => x(null)
|
|
2059
|
-
}
|
|
2060
|
-
) })
|
|
2061
|
-
] }) }),
|
|
2062
|
-
o === null && /* @__PURE__ */ a("div", { role: "alert", className: "error", "data-testid": "wf-project-required", children: [
|
|
2063
|
-
"No project selected — pass a ",
|
|
2064
|
-
/* @__PURE__ */ e("code", { children: "project" }),
|
|
2065
|
-
" prop (or set the provider's project) to edit and save this workflow."
|
|
2066
|
-
] }),
|
|
2067
|
-
/* @__PURE__ */ a("div", { className: "wf-fullbleed-foot", children: [
|
|
2068
|
-
/* @__PURE__ */ a("div", { className: "row", style: { flexWrap: "wrap", alignItems: "center" }, children: [
|
|
2069
|
-
/* @__PURE__ */ e(
|
|
2070
|
-
"button",
|
|
2071
|
-
{
|
|
2072
|
-
type: "button",
|
|
2073
|
-
className: "btn",
|
|
2074
|
-
disabled: o === null || !M || !Z,
|
|
2075
|
-
onClick: g.saveNow,
|
|
2076
|
-
children: g.saving ? "Saving…" : "Save"
|
|
2077
|
-
}
|
|
2078
|
-
),
|
|
2079
|
-
ke && /* @__PURE__ */ e("span", { className: "ok", children: "Saved." })
|
|
2080
|
-
] }),
|
|
2081
|
-
Le && /* @__PURE__ */ e("div", { className: "error", children: Le }),
|
|
2082
|
-
je && /* @__PURE__ */ e("div", { className: "error", "data-testid": "wf-key-guard", children: je })
|
|
2083
|
-
] }),
|
|
2084
|
-
/* @__PURE__ */ e(
|
|
2085
|
-
ho,
|
|
2086
|
-
{
|
|
2087
|
-
open: w,
|
|
2088
|
-
onClose: () => C(!1),
|
|
2089
|
-
title: `JSON — ${(c == null ? void 0 : c.displayName) || "workflow"}`,
|
|
2090
|
-
mode: "synced",
|
|
2091
|
-
value: H,
|
|
2092
|
-
onChange: (d) => {
|
|
2093
|
-
g.setJson(d), x(null);
|
|
2094
|
-
},
|
|
2095
|
-
onValidityChange: ({ valid: d, error: f }) => {
|
|
2096
|
-
k(d), b(f);
|
|
2097
|
-
},
|
|
2098
|
-
invalidReason: h ? null : v,
|
|
2099
|
-
editorLabel: "Workflow definition JSON"
|
|
2100
|
-
}
|
|
2101
|
-
),
|
|
2102
|
-
g.stale && !ce && /* @__PURE__ */ a(J, { title: "This workflow changed on the server", onClose: () => X(!0), children: [
|
|
2103
|
-
/* @__PURE__ */ a("div", { className: "modal-body", children: [
|
|
2104
|
-
/* @__PURE__ */ e("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." }),
|
|
2105
|
-
/* @__PURE__ */ a("p", { className: "muted small", children: [
|
|
2106
|
-
/* @__PURE__ */ e("strong", { children: "Reload from server" }),
|
|
2107
|
-
" replaces what is on this canvas with the saved copy; anything you changed here and have not saved is lost.",
|
|
2108
|
-
" ",
|
|
2109
|
-
/* @__PURE__ */ e("strong", { children: "Keep editing" }),
|
|
2110
|
-
" 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."
|
|
2111
|
-
] })
|
|
2112
|
-
] }),
|
|
2113
|
-
/* @__PURE__ */ a("div", { className: "modal-actions", children: [
|
|
2114
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => X(!0), children: "Keep editing" }),
|
|
2115
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn", disabled: S, onClick: In, children: S ? "Reloading…" : "Reload from server" })
|
|
2116
|
-
] })
|
|
2117
|
-
] }),
|
|
2118
|
-
m && /* @__PURE__ */ e(
|
|
2119
|
-
ri,
|
|
2120
|
-
{
|
|
2121
|
-
autoSave: Ce.autoSave,
|
|
2122
|
-
savePosition: Ce.savePosition,
|
|
2123
|
-
variables: An,
|
|
2124
|
-
onClose: () => A(!1),
|
|
2125
|
-
onChange: (d, f) => Ln({ settings: Zt(c == null ? void 0 : c.settings, d, f) }),
|
|
2126
|
-
onVariablesChange: (d) => Ke({ variables: Yt(d) })
|
|
2127
|
-
}
|
|
2128
|
-
)
|
|
2129
|
-
] });
|
|
2130
|
-
}
|
|
2131
|
-
const pi = () => {
|
|
2132
|
-
};
|
|
2133
|
-
function Ii(n) {
|
|
2134
|
-
const { workflowId: t, initialRunId: o, onNavigate: i = pi, slots: r } = n, s = eo(n.project), u = we(
|
|
2135
|
-
(l) => {
|
|
2136
|
-
l.type === "list" ? i({ type: "list" }) : l.kind === "workflow" && i({ type: "workflow", id: l.id });
|
|
2137
|
-
},
|
|
2138
|
-
[i]
|
|
2139
|
-
);
|
|
2140
|
-
return /* @__PURE__ */ e(
|
|
2141
|
-
"div",
|
|
2142
|
-
{
|
|
2143
|
-
className: "w6w-embed-root",
|
|
2144
|
-
style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
|
|
2145
|
-
children: /* @__PURE__ */ e(fo, { children: /* @__PURE__ */ e(Io, { project: s, onNavigate: u, children: /* @__PURE__ */ a(wo, { project: s, children: [
|
|
2146
|
-
/* @__PURE__ */ e(
|
|
2147
|
-
mi,
|
|
2148
|
-
{
|
|
2149
|
-
workflowId: t,
|
|
2150
|
-
project: s,
|
|
2151
|
-
initialRunId: o,
|
|
2152
|
-
onNavigate: i,
|
|
2153
|
-
slots: r
|
|
2154
|
-
}
|
|
2155
|
-
),
|
|
2156
|
-
/* @__PURE__ */ e(
|
|
2157
|
-
bo,
|
|
2158
|
-
{
|
|
2159
|
-
tools: si,
|
|
2160
|
-
storageKey: s === null ? null : `w6w.rail.embed.${s}`
|
|
2161
|
-
}
|
|
2162
|
-
)
|
|
2163
|
-
] }) }) })
|
|
2164
|
-
}
|
|
2165
|
-
);
|
|
2166
|
-
}
|
|
2
|
+
import { W as e } from "./WorkflowEditor-DlbVv6Fs.js";
|
|
2167
3
|
export {
|
|
2168
|
-
|
|
4
|
+
e as WorkflowEditor
|
|
2169
5
|
};
|
|
2170
6
|
//# sourceMappingURL=editor.mjs.map
|