@w6w/embed 0.2.11 → 0.2.20
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 +22 -5
- package/dist/ConfirmModal-Pv2-A_3U.js +186 -0
- package/dist/ConfirmModal-Pv2-A_3U.js.map +1 -0
- package/dist/{CreateFunctionModal-D6CQLpa_.js → CreateFunctionModal-DScxp_LN.js} +2 -2
- package/dist/{CreateFunctionModal-D6CQLpa_.js.map → CreateFunctionModal-DScxp_LN.js.map} +1 -1
- package/dist/{DocumentFormModal-YauVdolr.js → DocumentFormModal-Br4s8wmi.js} +3 -3
- package/dist/{DocumentFormModal-YauVdolr.js.map → DocumentFormModal-Br4s8wmi.js.map} +1 -1
- package/dist/ImportSpecModal-Cpzp8ndt.js +251 -0
- package/dist/ImportSpecModal-Cpzp8ndt.js.map +1 -0
- package/dist/{ModelRoutesManager-BGESQahw.js → ModelRoutesManager-1Ac5wcas.js} +3 -3
- package/dist/{ModelRoutesManager-BGESQahw.js.map → ModelRoutesManager-1Ac5wcas.js.map} +1 -1
- package/dist/WorkflowEditor-CmhXHRxi.js +1109 -0
- package/dist/WorkflowEditor-CmhXHRxi.js.map +1 -0
- package/dist/apps-ItBvnWX3.js +92 -0
- package/dist/apps-ItBvnWX3.js.map +1 -0
- package/dist/chrome/DangerZone.d.ts +4 -3
- package/dist/chrome/ExecutionProfileHeader.d.ts +3 -3
- package/dist/chrome/JsonToggle.d.ts +29 -20
- package/dist/chrome/Modal.d.ts +3 -1
- package/dist/chrome/RightRail.d.ts +6 -1
- package/dist/chrome/VersionHistoryModal.d.ts +2 -0
- package/dist/chrome/index.d.ts +1 -0
- package/dist/chrome/workspace.d.ts +32 -1
- package/dist/{coerce-input-DttlcSdO.js → coerce-input-DFJ4n_wc.js} +68 -69
- package/dist/coerce-input-DFJ4n_wc.js.map +1 -0
- package/dist/{connections-D7cgXhDS.js → connections-CzsCyIxY.js} +10 -10
- package/dist/{connections-D7cgXhDS.js.map → connections-CzsCyIxY.js.map} +1 -1
- package/dist/{credentials-DaQU3Ca_.js → credentials-Cn92LGhJ.js} +4 -4
- package/dist/{credentials-DaQU3Ca_.js.map → credentials-Cn92LGhJ.js.map} +1 -1
- package/dist/data-stores-UeQvwVCa.js +170 -0
- package/dist/data-stores-UeQvwVCa.js.map +1 -0
- package/dist/document-sources-DNmBojx6.js +169 -0
- package/dist/document-sources-DNmBojx6.js.map +1 -0
- package/dist/draft/use-workflow-draft.d.ts +2 -0
- package/dist/draft.mjs +2 -2
- package/dist/editor/PublishTooltip.d.ts +7 -0
- package/dist/editor/SetupIncompleteBanner.d.ts +12 -0
- package/dist/editor/StartingStateModal.d.ts +14 -0
- package/dist/editor/WorkflowSettingsModal.d.ts +6 -1
- package/dist/editor/WorkflowVariablesEditor.d.ts +6 -0
- package/dist/editor/definition.d.ts +4 -0
- package/dist/editor/json-apply.d.ts +29 -0
- package/dist/editor/step-problems-feed.d.ts +5 -0
- package/dist/editor/types.d.ts +2 -2
- package/dist/editor-apps-DkkC7wOQ.js +152 -0
- package/dist/editor-apps-DkkC7wOQ.js.map +1 -0
- package/dist/editor-tools-BR27RGto.js +1683 -0
- package/dist/editor-tools-BR27RGto.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +536 -478
- package/dist/editors.mjs.map +1 -1
- package/dist/forms.mjs +3 -3
- package/dist/{rail-settings-XYGToh00.js → import-bindings-EUtxZ9Ti.js} +90 -24
- package/dist/import-bindings-EUtxZ9Ti.js.map +1 -0
- package/dist/index.mjs +138 -108
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +5 -1
- package/dist/lib/history-query.d.ts +45 -0
- package/dist/lib/import-bindings.d.ts +89 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/rail-settings.d.ts +1 -1
- package/dist/lib/setup-incomplete.d.ts +22 -0
- package/dist/lib/starting-data.d.ts +31 -0
- package/dist/lib/state-panel.d.ts +29 -0
- package/dist/lib/target-fields.d.ts +3 -15
- package/dist/lib/workflow-live-run.d.ts +84 -6
- package/dist/lib/workflow-validity.d.ts +64 -16
- package/dist/lib/workflow-variables.d.ts +1 -1
- package/dist/lib/workflow-version.d.ts +2 -0
- package/dist/lib.mjs +87 -72
- package/dist/lists/DataStoreList.d.ts +17 -0
- package/dist/lists/DataStoreView.d.ts +19 -0
- package/dist/lists/Logs.d.ts +19 -0
- package/dist/lists.d.ts +6 -0
- package/dist/lists.mjs +1255 -816
- package/dist/lists.mjs.map +1 -1
- package/dist/rail/ConnectionsTool.d.ts +2 -0
- package/dist/rail/HistoryTool.d.ts +2 -0
- package/dist/rail/StartingStateTool.d.ts +2 -0
- package/dist/rail/settings-sections.d.ts +4 -1
- package/dist/rail.mjs +1 -1
- package/dist/repos/connections.d.ts +1 -0
- package/dist/repos/constants.d.ts +12 -0
- package/dist/repos/data-stores.d.ts +84 -0
- package/dist/repos/history.d.ts +9 -0
- package/dist/repos/index.d.ts +2 -0
- package/dist/repos/spec-export.d.ts +3 -3
- package/dist/repos/spec-import.d.ts +30 -1
- package/dist/repos/step-tests.d.ts +2 -0
- package/dist/repos/webhook-listen.d.ts +35 -0
- package/dist/repos/workflows.d.ts +105 -2
- package/dist/repos.mjs +370 -328
- package/dist/repos.mjs.map +1 -1
- package/dist/setup-incomplete-BHs3Lpfy.js +199 -0
- package/dist/setup-incomplete-BHs3Lpfy.js.map +1 -0
- package/dist/{spec-export-CBbloO_n.js → spec-export-DGy5ijps.js} +72 -59
- package/dist/spec-export-DGy5ijps.js.map +1 -0
- package/dist/spec-import-SWOonsNr.js +116 -0
- package/dist/spec-import-SWOonsNr.js.map +1 -0
- package/dist/{step-tests-CivICmTq.js → step-tests-B4E4W3ly.js} +8 -7
- package/dist/step-tests-B4E4W3ly.js.map +1 -0
- package/dist/{use-callable-draft-DsALnSfF.js → use-callable-draft-DCauHt5o.js} +2 -2
- package/dist/{use-callable-draft-DsALnSfF.js.map → use-callable-draft-DCauHt5o.js.map} +1 -1
- package/dist/use-workflow-draft-l3P5KZzw.js +338 -0
- package/dist/use-workflow-draft-l3P5KZzw.js.map +1 -0
- package/dist/workflows-BZN4Hyz1.js +623 -0
- package/dist/workflows-BZN4Hyz1.js.map +1 -0
- package/package.json +4 -3
- package/src/styles.css +153 -1
- package/dist/ConfirmModal-BE-SdX-O.js +0 -185
- package/dist/ConfirmModal-BE-SdX-O.js.map +0 -1
- package/dist/ImportSpecModal-B7qd1Km2.js +0 -136
- package/dist/ImportSpecModal-B7qd1Km2.js.map +0 -1
- package/dist/WorkflowEditor-CwvmAGp2.js +0 -925
- package/dist/WorkflowEditor-CwvmAGp2.js.map +0 -1
- package/dist/apps-CboASBKr.js +0 -77
- package/dist/apps-CboASBKr.js.map +0 -1
- package/dist/coerce-input-DttlcSdO.js.map +0 -1
- package/dist/document-sources-UCwe8x77.js +0 -91
- package/dist/document-sources-UCwe8x77.js.map +0 -1
- package/dist/editor-apps-BUZWld-m.js +0 -95
- package/dist/editor-apps-BUZWld-m.js.map +0 -1
- package/dist/editor-tools-B_Lfx3kw.js +0 -1279
- package/dist/editor-tools-B_Lfx3kw.js.map +0 -1
- package/dist/rail-settings-XYGToh00.js.map +0 -1
- package/dist/spec-export-CBbloO_n.js.map +0 -1
- package/dist/spec-import-CW6R_Wk1.js +0 -469
- package/dist/spec-import-CW6R_Wk1.js.map +0 -1
- package/dist/step-tests-CivICmTq.js.map +0 -1
- package/dist/trigger-preview-DKxfjzUY.js +0 -145
- package/dist/trigger-preview-DKxfjzUY.js.map +0 -1
- package/dist/use-workflow-draft-DzAyUeA6.js +0 -316
- package/dist/use-workflow-draft-DzAyUeA6.js.map +0 -1
|
@@ -0,0 +1,1683 @@
|
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { r as Cn, l as je, m as Ve, d as De, e as En, h as Oe, c as An } from "./import-bindings-EUtxZ9Ti.js";
|
|
3
|
+
import { useContext as ve, useState as u, useMemo as Qe, useEffect as be, createContext as We, useRef as Fe } from "react";
|
|
4
|
+
import { ExpressionOptionsProvider as He, Icon as K, RetryPolicyFields as Pn, StepBuilderModal as In, IconButton as we, useEnterSubmit as Tn, CodeBlock as pe, DeleteButton as Dn, EditButton as On, ConfirmModal as Re, JsonEditor as Rn, useExpressionOptions as Mn, ExpressionInput as Ln, ResultViewer as jn } from "@w6w/ui";
|
|
5
|
+
import { d as Vn, p as Qn, i as Wn, t as Fn, e as Me, a as Hn, h as $n, s as Bn } from "./document-sources-DNmBojx6.js";
|
|
6
|
+
import { u as Jn, g as qn, d as Kn, a as Un, f as $e, h as Be, b as Je, e as qe } from "./spec-export-DGy5ijps.js";
|
|
7
|
+
import { i as _n, f as zn, e as Gn, b as Yn, u as Zn } from "./vault-BSEWhMYC.js";
|
|
8
|
+
import { k as Xn } from "./spec-import-SWOonsNr.js";
|
|
9
|
+
import { s as xn, M as q, b as et, C as nt } from "./ConfirmModal-Pv2-A_3U.js";
|
|
10
|
+
import { u as tt, i as it, f as st } from "./slug-BVdgiP_L.js";
|
|
11
|
+
import { WorkflowConnectionsPanel as at } from "@w6w/ui/flow";
|
|
12
|
+
import { ApiError as L } from "@w6w/sdk";
|
|
13
|
+
import { i as rt, p as Ke, c as Ue, d as ot } from "./settings-rail--GdRMusb.js";
|
|
14
|
+
import { w as _e, v as ze, y as Ge, x as Ye, b as Ze, d as lt, f as dt, h as ct, u as ut, t as ht, s as ft, r as mt, q as gt } from "./endpoints-DSRo1Lc5.js";
|
|
15
|
+
import { a1 as Xe, a0 as pt, _ as vt, P as bt, U as yt, a3 as kt, Z as wt, V as Nt, X as St, K as Ct, I as Et } from "./workflows-BZN4Hyz1.js";
|
|
16
|
+
import { I as xe } from "./ImportSpecModal-Cpzp8ndt.js";
|
|
17
|
+
import { useQueryClient as At } from "@tanstack/react-query";
|
|
18
|
+
import { foldStateLog as Pt } from "@w6w/expr";
|
|
19
|
+
const ye = We(null);
|
|
20
|
+
function Ri({
|
|
21
|
+
children: e,
|
|
22
|
+
base: t = null
|
|
23
|
+
}) {
|
|
24
|
+
const [i, s] = u(null), a = i ?? t, l = Qe(() => ({ resource: a, setCallable: s }), [a]);
|
|
25
|
+
return /* @__PURE__ */ n(ye.Provider, { value: l, children: e });
|
|
26
|
+
}
|
|
27
|
+
function Mi() {
|
|
28
|
+
return ve(ye) !== null;
|
|
29
|
+
}
|
|
30
|
+
function Li(e) {
|
|
31
|
+
const t = ve(ye);
|
|
32
|
+
if (!t) throw new Error("useWorkspace must be used within <WorkspaceProvider>");
|
|
33
|
+
const { setCallable: i } = t, s = e ? JSON.stringify(e) : "";
|
|
34
|
+
be(() => (i(e), () => i(null)), [s, i]);
|
|
35
|
+
}
|
|
36
|
+
function It() {
|
|
37
|
+
const e = ve(ye);
|
|
38
|
+
if (!e) throw new Error("useWorkspaceCallable must be used within <WorkspaceProvider>");
|
|
39
|
+
return e.resource;
|
|
40
|
+
}
|
|
41
|
+
const en = { open: !1, activeTool: null };
|
|
42
|
+
function Tt(e) {
|
|
43
|
+
if (typeof localStorage > "u") return en;
|
|
44
|
+
const t = localStorage.getItem(e), { activeTool: i } = Cn(t);
|
|
45
|
+
return { open: !1, activeTool: i };
|
|
46
|
+
}
|
|
47
|
+
function nn({
|
|
48
|
+
tools: e,
|
|
49
|
+
ctx: t,
|
|
50
|
+
state: i,
|
|
51
|
+
onToggle: s
|
|
52
|
+
}) {
|
|
53
|
+
const a = i.open ? e.find((o) => o.id === i.activeTool && o.Panel) ?? null : null, l = a == null ? void 0 : a.Panel;
|
|
54
|
+
return /* @__PURE__ */ r("aside", { className: "right-rail", children: [
|
|
55
|
+
/* @__PURE__ */ n("div", { className: "right-rail-strip", children: e.map((o) => {
|
|
56
|
+
var c;
|
|
57
|
+
return /* @__PURE__ */ r(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
"data-testid": `rail-tool-${o.id}`,
|
|
62
|
+
className: `right-rail-tool-btn${(a == null ? void 0 : a.id) === o.id ? " active" : ""}`,
|
|
63
|
+
title: o.title,
|
|
64
|
+
"aria-label": o.title,
|
|
65
|
+
"aria-pressed": o.onActivate ? void 0 : (a == null ? void 0 : a.id) === o.id,
|
|
66
|
+
onClick: () => o.onActivate ? o.onActivate(t) : s(o.id),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ n(o.Icon, {}),
|
|
69
|
+
((c = o.hasIndicator) == null ? void 0 : c.call(o, t)) && /* @__PURE__ */ n(
|
|
70
|
+
"span",
|
|
71
|
+
{
|
|
72
|
+
className: "right-rail-tool-dot",
|
|
73
|
+
"data-testid": `rail-tool-${o.id}-dot`,
|
|
74
|
+
"aria-hidden": "true"
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
o.id
|
|
80
|
+
);
|
|
81
|
+
}) }),
|
|
82
|
+
a && l && /* @__PURE__ */ r("div", { className: "right-rail-panel", "data-testid": `rail-panel-${a.id}`, children: [
|
|
83
|
+
!a.rendersHeading && /* @__PURE__ */ n("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ n("h3", { children: a.title }) }),
|
|
84
|
+
/* @__PURE__ */ n(l, { ctx: t })
|
|
85
|
+
] })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
function Dt({
|
|
89
|
+
storageKey: e,
|
|
90
|
+
tools: t,
|
|
91
|
+
ctx: i
|
|
92
|
+
}) {
|
|
93
|
+
const [s, a] = u(() => Tt(e));
|
|
94
|
+
be(() => {
|
|
95
|
+
typeof localStorage > "u" || localStorage.setItem(e, JSON.stringify({ activeTool: s.activeTool }));
|
|
96
|
+
}, [e, s.activeTool]);
|
|
97
|
+
function l(o) {
|
|
98
|
+
a(
|
|
99
|
+
(c) => c.open && c.activeTool === o ? { open: !1, activeTool: o } : { open: !0, activeTool: o }
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ n(nn, { tools: t, ctx: i, state: s, onToggle: l });
|
|
103
|
+
}
|
|
104
|
+
function ji({
|
|
105
|
+
tools: e,
|
|
106
|
+
storageKey: t
|
|
107
|
+
}) {
|
|
108
|
+
const i = It(), s = e.filter((a) => a.isAvailable(i));
|
|
109
|
+
return s.length === 0 ? null : t === null ? /* @__PURE__ */ n(nn, { tools: s, ctx: i, state: en, onToggle: () => {
|
|
110
|
+
} }) : /* @__PURE__ */ n(Dt, { storageKey: t, tools: s, ctx: i }, t);
|
|
111
|
+
}
|
|
112
|
+
function Ot(e) {
|
|
113
|
+
const t = e, i = _n(t ?? void 0, t != null), s = zn(), a = Jn(), l = Xn(t ?? void 0, t != null), o = Gn(), c = Yn(), h = Zn();
|
|
114
|
+
return Qe(
|
|
115
|
+
() => ({
|
|
116
|
+
vars: (i.data ?? []).map((d) => d.name),
|
|
117
|
+
constants: (a.data ?? []).map((d) => d.name),
|
|
118
|
+
secrets: (s.data ?? []).map((d) => d.name),
|
|
119
|
+
// `document-sources.ts` owns the `format === "json"` gate and the raw
|
|
120
|
+
// field enumeration — no parsing, no gate logic, and no filtering here
|
|
121
|
+
// (A5c); `isRefSafeKey` filtering happens once, downstream, at the
|
|
122
|
+
// modal's render site.
|
|
123
|
+
documents: Qn(l.data ?? []),
|
|
124
|
+
// Real project values so the ƒx Result preview substitutes them for
|
|
125
|
+
// `var.<name>` / `const.<name>` / `documents.<key>` / `documents.<key>.<field>` refs
|
|
126
|
+
// instead of the raw template.
|
|
127
|
+
sampleValues: {
|
|
128
|
+
...Object.fromEntries((i.data ?? []).map((d) => [`var.${d.name}`, d.value])),
|
|
129
|
+
...Object.fromEntries((a.data ?? []).map((d) => [`const.${d.name}`, d.value])),
|
|
130
|
+
...Vn(l.data ?? [])
|
|
131
|
+
},
|
|
132
|
+
sealSecret: o,
|
|
133
|
+
// A created var carries the SAME project the read above carried (B3) —
|
|
134
|
+
// it must land in the project whose rail asked for it. `type: "string"`
|
|
135
|
+
// is pinned (a string type's `raw` passes through untouched) — the modal
|
|
136
|
+
// has no type field.
|
|
137
|
+
createVar: (d) => c.mutateAsync({
|
|
138
|
+
input: {
|
|
139
|
+
name: d.name,
|
|
140
|
+
type: "string",
|
|
141
|
+
value: d.value,
|
|
142
|
+
description: d.description
|
|
143
|
+
},
|
|
144
|
+
project: t ?? void 0
|
|
145
|
+
}).then(() => {
|
|
146
|
+
}),
|
|
147
|
+
// Secrets carry NO project (B4) — `vault_secrets` has no `project`
|
|
148
|
+
// column and the routes read no `?project=`. Plaintext in, the server
|
|
149
|
+
// encrypts; the resolved value is referenced nowhere (B5).
|
|
150
|
+
createSecret: (d) => h.mutateAsync({ name: d.name, value: d.value, description: d.description }).then(() => {
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
[
|
|
154
|
+
i.data,
|
|
155
|
+
a.data,
|
|
156
|
+
s.data,
|
|
157
|
+
l.data,
|
|
158
|
+
o,
|
|
159
|
+
c.mutateAsync,
|
|
160
|
+
h.mutateAsync,
|
|
161
|
+
t
|
|
162
|
+
]
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function Vi({
|
|
166
|
+
project: e,
|
|
167
|
+
children: t
|
|
168
|
+
}) {
|
|
169
|
+
const i = Ot(e);
|
|
170
|
+
return /* @__PURE__ */ n(He, { value: i, children: t });
|
|
171
|
+
}
|
|
172
|
+
function Rt({ ctx: e }) {
|
|
173
|
+
const [t, i] = u(null), s = Fn(e);
|
|
174
|
+
if (!s) return null;
|
|
175
|
+
const a = (e == null ? void 0 : e.kind) === "workflow" ? e.triggers : void 0, l = xn(s);
|
|
176
|
+
return l.length === 0 ? /* @__PURE__ */ n("p", { className: "muted", children: tt(s) }) : /* @__PURE__ */ r("div", { children: [
|
|
177
|
+
/* @__PURE__ */ n("p", { className: "muted small", style: { marginTop: 0 }, children: "Call this from:" }),
|
|
178
|
+
/* @__PURE__ */ n("div", { className: "rail-code-langs", children: l.map(({ id: o, label: c, icon: h }) => /* @__PURE__ */ r(
|
|
179
|
+
"button",
|
|
180
|
+
{
|
|
181
|
+
type: "button",
|
|
182
|
+
className: "rail-code-lang",
|
|
183
|
+
"data-testid": `rail-code-lang-${o}`,
|
|
184
|
+
title: `Show the ${c} snippet`,
|
|
185
|
+
"aria-label": `Show the ${c} snippet`,
|
|
186
|
+
onClick: () => i(o),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ n(K, { name: h, size: 20 }),
|
|
189
|
+
/* @__PURE__ */ n("span", { children: c })
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
o
|
|
193
|
+
)) }),
|
|
194
|
+
t !== null && /* @__PURE__ */ n(q, { title: "Call from code", wide: !0, onClose: () => i(null), children: /* @__PURE__ */ n("div", { style: { height: 450 }, children: /* @__PURE__ */ n(et, { resource: s, triggers: a, initialTab: t }) }) })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function Mt() {
|
|
198
|
+
return /* @__PURE__ */ n(K, { name: "code" });
|
|
199
|
+
}
|
|
200
|
+
const Lt = {
|
|
201
|
+
id: "code",
|
|
202
|
+
title: "Code",
|
|
203
|
+
Icon: Mt,
|
|
204
|
+
isAvailable: (e) => Wn(e),
|
|
205
|
+
Panel: Rt
|
|
206
|
+
}, jt = {
|
|
207
|
+
id: "connections",
|
|
208
|
+
title: "Connections",
|
|
209
|
+
rendersHeading: !0,
|
|
210
|
+
Icon: () => /* @__PURE__ */ n(K, { name: "plug" }),
|
|
211
|
+
isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" && !!e.connectionResources,
|
|
212
|
+
hasIndicator: (e) => {
|
|
213
|
+
var t;
|
|
214
|
+
return (e == null ? void 0 : e.kind) === "workflow" && Object.keys(((t = e.connectionResources) == null ? void 0 : t.connections) ?? {}).length > 0;
|
|
215
|
+
},
|
|
216
|
+
Panel: ({ ctx: e }) => (e == null ? void 0 : e.kind) === "workflow" && e.connectionResources ? /* @__PURE__ */ n(at, { resources: e.connectionResources }, e.id) : null
|
|
217
|
+
}, Vt = { project: null, onNavigate: () => {
|
|
218
|
+
} }, tn = We(Vt);
|
|
219
|
+
function Qi({
|
|
220
|
+
project: e,
|
|
221
|
+
onNavigate: t,
|
|
222
|
+
children: i
|
|
223
|
+
}) {
|
|
224
|
+
return /* @__PURE__ */ n(tn.Provider, { value: { project: e, onNavigate: t }, children: i });
|
|
225
|
+
}
|
|
226
|
+
function sn() {
|
|
227
|
+
return ve(tn);
|
|
228
|
+
}
|
|
229
|
+
const Qt = "@w6w/call";
|
|
230
|
+
function Le(e) {
|
|
231
|
+
return e ? e.kind === "workflow" ? e.workflow : e.kind === "function" ? e.function : `${e.uses.app}/${e.uses.action}` : "";
|
|
232
|
+
}
|
|
233
|
+
function Wt(e) {
|
|
234
|
+
return (e == null ? void 0 : e.kind) === "workflow" ? "Workflow (asynchronous)" : (e == null ? void 0 : e.kind) === "function" ? "Function (synchronous)" : "App action (synchronous)";
|
|
235
|
+
}
|
|
236
|
+
function an({
|
|
237
|
+
kind: e,
|
|
238
|
+
id: t,
|
|
239
|
+
policy: i,
|
|
240
|
+
ready: s,
|
|
241
|
+
saving: a,
|
|
242
|
+
onPersist: l
|
|
243
|
+
}) {
|
|
244
|
+
var y, M, V, N;
|
|
245
|
+
const o = Ze(!0), { project: c } = sn(), h = Xe(c ?? void 0, !0), [d, v] = u(!1), [b, m] = u(null), C = (y = i.reroute) == null ? void 0 : y.target, k = Le(C), D = C ? Me({
|
|
246
|
+
resource: { kind: e, id: t },
|
|
247
|
+
target: { kind: C.kind, id: k },
|
|
248
|
+
hasAdapter: ((M = i.reroute) == null ? void 0 : M.with) !== void 0
|
|
249
|
+
}) : "allow", O = (C == null ? void 0 : C.kind) === "workflow" ? ((N = (V = h.data) == null ? void 0 : V.find((p) => p.id === k)) == null ? void 0 : N.displayName) ?? void 0 : (() => {
|
|
250
|
+
var P;
|
|
251
|
+
const p = (P = o.data) == null ? void 0 : P.find(($) => $.id === k);
|
|
252
|
+
return p ? p.displayName || p.key : void 0;
|
|
253
|
+
})();
|
|
254
|
+
be(() => {
|
|
255
|
+
t && e && m(null);
|
|
256
|
+
}, [t, e]);
|
|
257
|
+
function E(p) {
|
|
258
|
+
m(null), l(p, m);
|
|
259
|
+
}
|
|
260
|
+
function R(p) {
|
|
261
|
+
var U;
|
|
262
|
+
let P;
|
|
263
|
+
if (p.uses.app === Qt) {
|
|
264
|
+
const Q = p.with ?? {}, W = typeof Q.targetId == "string" ? Q.targetId : "";
|
|
265
|
+
if (!W) return;
|
|
266
|
+
P = Q.targetKind === "workflow" ? { kind: "workflow", workflow: W } : { kind: "function", function: W };
|
|
267
|
+
} else if (!p.uses.app.startsWith("@w6w/"))
|
|
268
|
+
P = {
|
|
269
|
+
kind: "action",
|
|
270
|
+
uses: {
|
|
271
|
+
app: p.uses.app,
|
|
272
|
+
action: p.uses.action,
|
|
273
|
+
connection: p.uses.connection ?? void 0
|
|
274
|
+
},
|
|
275
|
+
...p.with ? { with: p.with } : {}
|
|
276
|
+
};
|
|
277
|
+
else
|
|
278
|
+
return;
|
|
279
|
+
if (Me({
|
|
280
|
+
resource: { kind: e, id: t },
|
|
281
|
+
target: { kind: P.kind, id: Le(P) },
|
|
282
|
+
hasAdapter: ((U = i.reroute) == null ? void 0 : U.with) !== void 0
|
|
283
|
+
}) === "block") {
|
|
284
|
+
m(
|
|
285
|
+
"This handler would call itself with the same inputs and can loop forever. Choose another handler or keep a differing imported adapter."
|
|
286
|
+
), v(!1);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
E({ ...i, reroute: { ...i.reroute, target: P } }), v(!1);
|
|
290
|
+
}
|
|
291
|
+
return !s && !a ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-errorhandling-body", children: [
|
|
292
|
+
/* @__PURE__ */ r("section", { "data-testid": "rail-retry-section", children: [
|
|
293
|
+
/* @__PURE__ */ n(
|
|
294
|
+
Pn,
|
|
295
|
+
{
|
|
296
|
+
value: i.retry,
|
|
297
|
+
onChange: (p) => E({ ...i, retry: p }),
|
|
298
|
+
readOnly: a,
|
|
299
|
+
target: e
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
e === "workflow" && /* @__PURE__ */ n("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." })
|
|
303
|
+
] }),
|
|
304
|
+
/* @__PURE__ */ n("p", { className: "muted small", children: e === "workflow" ? "What runs when this workflow's run fails, after every node's own retry is spent." : "What runs when this call fails, after retry (if any) is exhausted." }),
|
|
305
|
+
k ? /* @__PURE__ */ r("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
|
|
306
|
+
/* @__PURE__ */ r("span", { className: "list-main", children: [
|
|
307
|
+
/* @__PURE__ */ n("strong", { children: O ?? k }),
|
|
308
|
+
" ",
|
|
309
|
+
/* @__PURE__ */ n("code", { className: "muted", children: k }),
|
|
310
|
+
/* @__PURE__ */ n("span", { className: "muted small block", children: Wt(C) })
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ n(
|
|
313
|
+
"button",
|
|
314
|
+
{
|
|
315
|
+
type: "button",
|
|
316
|
+
className: "btn ghost",
|
|
317
|
+
"data-testid": "rail-errorhandling-change",
|
|
318
|
+
disabled: a,
|
|
319
|
+
onClick: () => v(!0),
|
|
320
|
+
children: "Change"
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
] }) : /* @__PURE__ */ n(
|
|
324
|
+
"button",
|
|
325
|
+
{
|
|
326
|
+
type: "button",
|
|
327
|
+
className: "btn",
|
|
328
|
+
"data-testid": "rail-errorhandling-choose",
|
|
329
|
+
disabled: a,
|
|
330
|
+
onClick: () => v(!0),
|
|
331
|
+
children: "+ Choose what runs on failure"
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
k && /* @__PURE__ */ n(
|
|
335
|
+
"button",
|
|
336
|
+
{
|
|
337
|
+
type: "button",
|
|
338
|
+
className: "btn ghost",
|
|
339
|
+
"data-testid": "rail-errorhandling-clear",
|
|
340
|
+
disabled: a,
|
|
341
|
+
onClick: () => E({ ...i, reroute: void 0 }),
|
|
342
|
+
children: "Remove handler"
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
D === "warn" && /* @__PURE__ */ n("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." }),
|
|
346
|
+
b && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-errorhandling-error", children: b }),
|
|
347
|
+
d && /* @__PURE__ */ n(
|
|
348
|
+
In,
|
|
349
|
+
{
|
|
350
|
+
appsOnly: !0,
|
|
351
|
+
callables: ["function", "workflow"],
|
|
352
|
+
title: "Choose what runs on failure",
|
|
353
|
+
onClose: () => v(!1),
|
|
354
|
+
onAdd: R
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] });
|
|
358
|
+
}
|
|
359
|
+
function Ft({ ctx: e }) {
|
|
360
|
+
const t = "policy" in e ? e.policy : void 0, i = "onPolicyChange" in e ? e.onPolicyChange : void 0;
|
|
361
|
+
return /* @__PURE__ */ n(
|
|
362
|
+
an,
|
|
363
|
+
{
|
|
364
|
+
kind: e.kind,
|
|
365
|
+
id: e.id,
|
|
366
|
+
policy: t ? Ke(t) : {},
|
|
367
|
+
ready: !!i,
|
|
368
|
+
saving: !1,
|
|
369
|
+
onPersist: (s) => i == null ? void 0 : i(s)
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
function Ht({ id: e, kind: t }) {
|
|
374
|
+
const i = _e(e, t === "function"), s = ze(e, t === "endpoint"), a = Ge(), l = Ye(), o = Ue(t, t === "function" ? i.data : s.data), c = t === "function" ? a.isPending : l.isPending;
|
|
375
|
+
return /* @__PURE__ */ n(
|
|
376
|
+
an,
|
|
377
|
+
{
|
|
378
|
+
kind: t,
|
|
379
|
+
id: e,
|
|
380
|
+
policy: o ? Ke(o.definition) : {},
|
|
381
|
+
ready: !!o,
|
|
382
|
+
saving: c,
|
|
383
|
+
onPersist: (h, d) => {
|
|
384
|
+
if (!o) return;
|
|
385
|
+
const v = {
|
|
386
|
+
definition: ot(o.definition, h),
|
|
387
|
+
ifUnmodifiedSince: o.updatedAt
|
|
388
|
+
}, b = {
|
|
389
|
+
onError: (m) => d(m instanceof L ? m.message : String(m))
|
|
390
|
+
};
|
|
391
|
+
t === "function" ? a.mutate(v, b) : l.mutate(v, b);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
function $t({ ctx: e }) {
|
|
397
|
+
return (e == null ? void 0 : e.kind) !== "workflow" && (e == null ? void 0 : e.kind) !== "function" && (e == null ? void 0 : e.kind) !== "endpoint" ? null : e.kind === "workflow" || typeof e.onPolicyChange == "function" ? /* @__PURE__ */ n(Ft, { ctx: e }) : /* @__PURE__ */ n(Ht, { id: e.id, kind: e.kind });
|
|
398
|
+
}
|
|
399
|
+
function Bt() {
|
|
400
|
+
return /* @__PURE__ */ n(K, { name: "warning" });
|
|
401
|
+
}
|
|
402
|
+
const Jt = {
|
|
403
|
+
id: "error-handling",
|
|
404
|
+
title: "Error handling",
|
|
405
|
+
Icon: Bt,
|
|
406
|
+
isAvailable: (e) => rt(e),
|
|
407
|
+
Panel: $t
|
|
408
|
+
}, qt = {
|
|
409
|
+
id: "history",
|
|
410
|
+
title: "Execution history",
|
|
411
|
+
Icon: () => /* @__PURE__ */ n(K, { name: "history" }),
|
|
412
|
+
isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" && !!e.onOpenHistory,
|
|
413
|
+
onActivate: (e) => {
|
|
414
|
+
var t;
|
|
415
|
+
(e == null ? void 0 : e.kind) === "workflow" && ((t = e.onOpenHistory) == null || t.call(e));
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
function Kt(e, t) {
|
|
419
|
+
if (!t.includes(",")) return { tags: e, typed: t };
|
|
420
|
+
let i = e;
|
|
421
|
+
for (const s of t.split(",")) {
|
|
422
|
+
const a = s.trim();
|
|
423
|
+
a && !i.includes(a) && (i = [...i, a]);
|
|
424
|
+
}
|
|
425
|
+
return { tags: i, typed: "" };
|
|
426
|
+
}
|
|
427
|
+
function Ut(e, t) {
|
|
428
|
+
return e.filter((i) => i !== t);
|
|
429
|
+
}
|
|
430
|
+
function _t({ tags: e, onChange: t }) {
|
|
431
|
+
const [i, s] = u("");
|
|
432
|
+
function a(l) {
|
|
433
|
+
const o = Kt(e, l);
|
|
434
|
+
s(o.typed), o.tags !== e && t(o.tags);
|
|
435
|
+
}
|
|
436
|
+
return /* @__PURE__ */ r("div", { className: "tag-list", "data-testid": "tag-editor", children: [
|
|
437
|
+
e.map((l) => /* @__PURE__ */ r("span", { className: "tag removable", children: [
|
|
438
|
+
l,
|
|
439
|
+
/* @__PURE__ */ n(
|
|
440
|
+
we,
|
|
441
|
+
{
|
|
442
|
+
danger: !0,
|
|
443
|
+
icon: "close",
|
|
444
|
+
label: `Remove tag ${l}`,
|
|
445
|
+
title: `Remove ${l}`,
|
|
446
|
+
onClick: () => t(Ut(e, l))
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
] }, l)),
|
|
450
|
+
/* @__PURE__ */ n(
|
|
451
|
+
"input",
|
|
452
|
+
{
|
|
453
|
+
type: "text",
|
|
454
|
+
value: i,
|
|
455
|
+
placeholder: "Add a tag…",
|
|
456
|
+
"aria-label": "New tag",
|
|
457
|
+
onChange: (l) => a(l.target.value)
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
] });
|
|
461
|
+
}
|
|
462
|
+
function rn(e) {
|
|
463
|
+
const t = lt(e.kind).settings, { initial: i } = e, [s, a] = u(i.displayName), [l, o] = u(i.key ?? ""), [c, h] = u(i.tags ?? []), [d, v] = u(!1), [b, m] = u(null), C = s !== i.displayName, k = l !== (i.key ?? ""), D = t.hasTags && JSON.stringify(c) !== JSON.stringify(i.tags ?? []), O = C || k || D, E = t.canEditKey, R = l === "" || it(l), y = O && R && !d;
|
|
464
|
+
async function M() {
|
|
465
|
+
if (y) {
|
|
466
|
+
m(null), v(!0);
|
|
467
|
+
try {
|
|
468
|
+
await e.onSave({
|
|
469
|
+
displayName: s.trim(),
|
|
470
|
+
key: E && k ? l : i.key,
|
|
471
|
+
tags: t.hasTags ? c : void 0
|
|
472
|
+
}), e.onClose();
|
|
473
|
+
} catch (N) {
|
|
474
|
+
m(N instanceof L ? N.message : String(N));
|
|
475
|
+
} finally {
|
|
476
|
+
v(!1);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
const V = Tn(M, { enabled: y });
|
|
481
|
+
return /* @__PURE__ */ r(q, { title: "Edit settings", onClose: e.onClose, children: [
|
|
482
|
+
/* @__PURE__ */ r("div", { className: "modal-body", children: [
|
|
483
|
+
/* @__PURE__ */ r("label", { className: "field", children: [
|
|
484
|
+
/* @__PURE__ */ n("span", { children: "Name" }),
|
|
485
|
+
/* @__PURE__ */ n(
|
|
486
|
+
"input",
|
|
487
|
+
{
|
|
488
|
+
type: "text",
|
|
489
|
+
value: s,
|
|
490
|
+
onChange: (N) => a(N.target.value),
|
|
491
|
+
placeholder: t.namePlaceholder,
|
|
492
|
+
autoFocus: !0,
|
|
493
|
+
...V
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] }),
|
|
497
|
+
E && /* @__PURE__ */ r("label", { className: "field", children: [
|
|
498
|
+
/* @__PURE__ */ n("span", { children: "Key" }),
|
|
499
|
+
/* @__PURE__ */ n(
|
|
500
|
+
"input",
|
|
501
|
+
{
|
|
502
|
+
type: "text",
|
|
503
|
+
value: l,
|
|
504
|
+
onChange: (N) => o(st(N.target.value)),
|
|
505
|
+
placeholder: t.keyPlaceholder,
|
|
506
|
+
...V
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
/* @__PURE__ */ r("span", { className: "muted small", children: [
|
|
510
|
+
"Lowercase, kebab-case, 3–39 characters.",
|
|
511
|
+
t.keyHintSuffix
|
|
512
|
+
] })
|
|
513
|
+
] }),
|
|
514
|
+
t.hasTags && /* @__PURE__ */ r("div", { children: [
|
|
515
|
+
/* @__PURE__ */ n("p", { className: "muted small", style: { marginBottom: "8px" }, children: "Tags" }),
|
|
516
|
+
/* @__PURE__ */ n(_t, { tags: c, onChange: h })
|
|
517
|
+
] }),
|
|
518
|
+
b && /* @__PURE__ */ n("div", { className: "error", children: b })
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ r("div", { className: "modal-actions", children: [
|
|
521
|
+
/* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
|
|
522
|
+
/* @__PURE__ */ n("button", { type: "button", className: "btn", disabled: !y, onClick: M, children: d ? "Saving…" : "Save" })
|
|
523
|
+
] })
|
|
524
|
+
] });
|
|
525
|
+
}
|
|
526
|
+
const zt = {
|
|
527
|
+
function: {
|
|
528
|
+
json: "functions-version-json",
|
|
529
|
+
error: "functions-version-error",
|
|
530
|
+
revertButton: "functions-version-revert",
|
|
531
|
+
invokeButton: "functions-version-invoke",
|
|
532
|
+
invokeJson: "functions-version-invoke-json",
|
|
533
|
+
invokeError: "functions-version-invoke-error"
|
|
534
|
+
},
|
|
535
|
+
workflow: {
|
|
536
|
+
json: "workflows-version-json",
|
|
537
|
+
error: "workflows-version-error",
|
|
538
|
+
revertButton: "workflows-version-revert",
|
|
539
|
+
invokeButton: "workflows-version-invoke",
|
|
540
|
+
invokeJson: "workflows-version-invoke-json",
|
|
541
|
+
invokeError: "workflows-version-invoke-error"
|
|
542
|
+
},
|
|
543
|
+
endpoint: {
|
|
544
|
+
json: "endpoints-version-json",
|
|
545
|
+
error: "endpoints-version-error",
|
|
546
|
+
revertButton: "endpoints-version-revert",
|
|
547
|
+
invokeButton: "endpoints-version-invoke",
|
|
548
|
+
invokeJson: "endpoints-version-invoke-json",
|
|
549
|
+
invokeError: "endpoints-version-invoke-error"
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
function on(e) {
|
|
553
|
+
const { kind: t, id: i, versionNumber: s } = e, a = zt[t], l = qn(t, i, s, !0), o = Kn(t), c = Un(t), [h, d] = u(!1), [v, b] = u(null);
|
|
554
|
+
return /* @__PURE__ */ r(j, { children: [
|
|
555
|
+
/* @__PURE__ */ r(q, { title: `Version ${s}`, onClose: e.onClose, wide: !0, children: [
|
|
556
|
+
/* @__PURE__ */ r("div", { className: "modal-body", children: [
|
|
557
|
+
l.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : l.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": a.error, children: l.error instanceof Error ? l.error.message : String(l.error) }) : l.data ? /* @__PURE__ */ n("div", { "data-testid": a.json, children: /* @__PURE__ */ n(
|
|
558
|
+
pe,
|
|
559
|
+
{
|
|
560
|
+
code: JSON.stringify(l.data.definition, null, 2),
|
|
561
|
+
language: "json",
|
|
562
|
+
maxHeight: "420px",
|
|
563
|
+
copyable: !0
|
|
564
|
+
}
|
|
565
|
+
) }) : null,
|
|
566
|
+
(v || o.isError) && /* @__PURE__ */ n("div", { className: "error", children: v ?? String(o.error) }),
|
|
567
|
+
c.data !== void 0 && /* @__PURE__ */ n("div", { "data-testid": a.invokeJson, children: /* @__PURE__ */ n(
|
|
568
|
+
pe,
|
|
569
|
+
{
|
|
570
|
+
code: JSON.stringify(c.data, null, 2),
|
|
571
|
+
language: "json",
|
|
572
|
+
maxHeight: "240px",
|
|
573
|
+
copyable: !0
|
|
574
|
+
}
|
|
575
|
+
) }),
|
|
576
|
+
c.isError && /* @__PURE__ */ n("div", { className: "error", "data-testid": a.invokeError, children: c.error instanceof L ? c.error.message : String(c.error) })
|
|
577
|
+
] }),
|
|
578
|
+
/* @__PURE__ */ r("div", { className: "modal-actions", children: [
|
|
579
|
+
/* @__PURE__ */ n(
|
|
580
|
+
"button",
|
|
581
|
+
{
|
|
582
|
+
type: "button",
|
|
583
|
+
className: "btn ghost",
|
|
584
|
+
"data-testid": a.invokeButton,
|
|
585
|
+
disabled: c.isPending,
|
|
586
|
+
onClick: () => c.mutate({ id: i, versionNumber: s }),
|
|
587
|
+
children: c.isPending ? "Invoking…" : "Invoke this version"
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ n(
|
|
591
|
+
"button",
|
|
592
|
+
{
|
|
593
|
+
type: "button",
|
|
594
|
+
className: "btn danger",
|
|
595
|
+
"data-testid": a.revertButton,
|
|
596
|
+
disabled: o.isPending,
|
|
597
|
+
onClick: () => d(!0),
|
|
598
|
+
children: o.isPending ? "Reverting…" : "Revert to this version"
|
|
599
|
+
}
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Close" })
|
|
602
|
+
] })
|
|
603
|
+
] }),
|
|
604
|
+
h && /* @__PURE__ */ n(
|
|
605
|
+
nt,
|
|
606
|
+
{
|
|
607
|
+
title: "Revert to this version",
|
|
608
|
+
message: `Revert to version ${s}? This restores its content onto the resource's current draft; the resource's key and address stay unchanged.`,
|
|
609
|
+
confirmLabel: "Revert",
|
|
610
|
+
destructive: !0,
|
|
611
|
+
onConfirm: () => {
|
|
612
|
+
d(!1), e.onRestore ? (b(null), e.onRestore(s).then(e.onClose, (m) => b(String(m)))) : o.mutate({ id: i, versionNumber: s });
|
|
613
|
+
},
|
|
614
|
+
onClose: () => d(!1)
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
] });
|
|
618
|
+
}
|
|
619
|
+
function Gt(e) {
|
|
620
|
+
const {
|
|
621
|
+
archived: t,
|
|
622
|
+
deleteLabel: i,
|
|
623
|
+
deleteTestId: s,
|
|
624
|
+
archiveTestId: a,
|
|
625
|
+
onRequestDelete: l,
|
|
626
|
+
onRequestArchive: o,
|
|
627
|
+
deleteError: c,
|
|
628
|
+
archiveError: h
|
|
629
|
+
} = e;
|
|
630
|
+
return /* @__PURE__ */ r("div", { className: "rail-danger-zone rail-danger-zone--panel", "data-testid": "rail-danger-zone-panel", children: [
|
|
631
|
+
/* @__PURE__ */ r("div", { className: "rail-danger-zone-actions", children: [
|
|
632
|
+
!t && /* @__PURE__ */ n(
|
|
633
|
+
"button",
|
|
634
|
+
{
|
|
635
|
+
type: "button",
|
|
636
|
+
className: "btn danger",
|
|
637
|
+
"data-testid": a,
|
|
638
|
+
onClick: o,
|
|
639
|
+
disabled: e.pending,
|
|
640
|
+
children: "Archive"
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
e.allowDirectDelete ? /* @__PURE__ */ n(
|
|
644
|
+
"button",
|
|
645
|
+
{
|
|
646
|
+
type: "button",
|
|
647
|
+
className: "btn danger",
|
|
648
|
+
"aria-label": i,
|
|
649
|
+
"data-testid": s,
|
|
650
|
+
onClick: l,
|
|
651
|
+
disabled: e.pending,
|
|
652
|
+
children: "Delete"
|
|
653
|
+
}
|
|
654
|
+
) : t ? /* @__PURE__ */ r("span", { className: "rail-danger-zone-delete", children: [
|
|
655
|
+
/* @__PURE__ */ n(
|
|
656
|
+
Dn,
|
|
657
|
+
{
|
|
658
|
+
label: i,
|
|
659
|
+
"data-testid": s,
|
|
660
|
+
onClick: l,
|
|
661
|
+
disabled: e.pending
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
/* @__PURE__ */ n("span", { children: "Delete" })
|
|
665
|
+
] }) : null
|
|
666
|
+
] }),
|
|
667
|
+
c && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-delete-error", children: c }),
|
|
668
|
+
h && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-archive-error", children: h })
|
|
669
|
+
] });
|
|
670
|
+
}
|
|
671
|
+
function ln(e) {
|
|
672
|
+
return /* @__PURE__ */ r("div", { className: "right-rail-panel-head rail-settings-head", children: [
|
|
673
|
+
/* @__PURE__ */ n("h3", { children: "Settings" }),
|
|
674
|
+
/* @__PURE__ */ n(On, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: e.onEdit })
|
|
675
|
+
] });
|
|
676
|
+
}
|
|
677
|
+
function dn(e) {
|
|
678
|
+
const { id: t, displayName: i, fields: s, row: a, tags: l } = e;
|
|
679
|
+
return /* @__PURE__ */ n("div", { className: "rail-meta", children: /* @__PURE__ */ n(
|
|
680
|
+
"div",
|
|
681
|
+
{
|
|
682
|
+
style: {
|
|
683
|
+
display: "flex",
|
|
684
|
+
justifyContent: "space-between",
|
|
685
|
+
alignItems: "flex-start",
|
|
686
|
+
gap: "8px"
|
|
687
|
+
},
|
|
688
|
+
children: /* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
|
|
689
|
+
i && /* @__PURE__ */ r(j, { children: [
|
|
690
|
+
/* @__PURE__ */ n("dt", { children: "Name" }),
|
|
691
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-meta-name", children: /* @__PURE__ */ n("code", { children: i }) })
|
|
692
|
+
] }),
|
|
693
|
+
/* @__PURE__ */ n("dt", { children: "ID" }),
|
|
694
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-meta-id", children: /* @__PURE__ */ n("code", { children: t }) }),
|
|
695
|
+
s.includes("key") && a && /* @__PURE__ */ r(j, { children: [
|
|
696
|
+
/* @__PURE__ */ n("dt", { children: "Key" }),
|
|
697
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-meta-key", children: /* @__PURE__ */ n("code", { children: a.key || "unset" }) })
|
|
698
|
+
] }),
|
|
699
|
+
s.includes("updatedAt") && a && /* @__PURE__ */ r(j, { children: [
|
|
700
|
+
/* @__PURE__ */ n("dt", { children: "Updated" }),
|
|
701
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-meta-updated", "data-value": a.updatedAt, children: new Date(a.updatedAt).toLocaleString() })
|
|
702
|
+
] }),
|
|
703
|
+
l !== void 0 && a && /* @__PURE__ */ r(j, { children: [
|
|
704
|
+
/* @__PURE__ */ n("dt", { children: "Tags" }),
|
|
705
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-meta-tags", children: l.length > 0 ? l.map((o) => /* @__PURE__ */ n("span", { className: "tag", children: o }, o)) : "No tags" })
|
|
706
|
+
] })
|
|
707
|
+
] })
|
|
708
|
+
}
|
|
709
|
+
) });
|
|
710
|
+
}
|
|
711
|
+
function cn(e) {
|
|
712
|
+
return /* @__PURE__ */ n("div", { className: "rail-spec-actions", children: /* @__PURE__ */ n(
|
|
713
|
+
we,
|
|
714
|
+
{
|
|
715
|
+
icon: "file-text",
|
|
716
|
+
label: "Export, edit, or import",
|
|
717
|
+
"data-testid": "rail-spec-actions-open",
|
|
718
|
+
onClick: e.onOpen
|
|
719
|
+
}
|
|
720
|
+
) });
|
|
721
|
+
}
|
|
722
|
+
function un(e) {
|
|
723
|
+
const { kind: t, children: i, onImport: s, onClose: a } = e;
|
|
724
|
+
return /* @__PURE__ */ r(q, { title: "Definition", onClose: a, children: [
|
|
725
|
+
/* @__PURE__ */ r("div", { className: "modal-body", children: [
|
|
726
|
+
i,
|
|
727
|
+
/* @__PURE__ */ r("p", { className: "muted small", children: [
|
|
728
|
+
"Import a spec document to create a NEW ",
|
|
729
|
+
t,
|
|
730
|
+
" and navigate to it — this does not replace the ",
|
|
731
|
+
t,
|
|
732
|
+
" you have open."
|
|
733
|
+
] }),
|
|
734
|
+
/* @__PURE__ */ n("div", { className: "rail-spec-menu-row", children: /* @__PURE__ */ n(
|
|
735
|
+
"button",
|
|
736
|
+
{
|
|
737
|
+
type: "button",
|
|
738
|
+
className: "btn ghost",
|
|
739
|
+
"data-testid": "rail-spec-import",
|
|
740
|
+
onClick: s,
|
|
741
|
+
children: "Import"
|
|
742
|
+
}
|
|
743
|
+
) })
|
|
744
|
+
] }),
|
|
745
|
+
/* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: a, children: "Close" }) })
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
function hn(e) {
|
|
749
|
+
const { open: t, versions: i } = e;
|
|
750
|
+
return /* @__PURE__ */ r("div", { className: "rail-version-section", children: [
|
|
751
|
+
e.definitionStatus && /* @__PURE__ */ r("div", { "aria-live": "polite", "data-testid": "rail-definition-status", children: [
|
|
752
|
+
/* @__PURE__ */ n("span", { className: `badge wf-definition-status ${e.definitionStatus}`, children: e.definitionStatus === "published" ? "Live" : "Draft" }),
|
|
753
|
+
/* @__PURE__ */ n("p", { className: "muted small", children: e.definitionStatus === "draft" ? "This definition has unpublished changes. Republish to update the live version." : e.definitionStatus === "unpublished" ? "This definition has never been published." : "This definition matches the published version." })
|
|
754
|
+
] }),
|
|
755
|
+
/* @__PURE__ */ r(
|
|
756
|
+
"button",
|
|
757
|
+
{
|
|
758
|
+
type: "button",
|
|
759
|
+
className: "rail-link-icon",
|
|
760
|
+
"data-testid": "rail-history-show",
|
|
761
|
+
"aria-label": "Version history",
|
|
762
|
+
title: "Version history",
|
|
763
|
+
onClick: e.onShow,
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ n(K, { name: "clock", size: 14 }),
|
|
766
|
+
/* @__PURE__ */ n("span", { children: "Version history" })
|
|
767
|
+
]
|
|
768
|
+
}
|
|
769
|
+
),
|
|
770
|
+
(t || e.definitionStatus) && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-version-published", children: (i == null ? void 0 : i.currentPublishedVersion) != null ? `Published: v${i.currentPublishedVersion}` : "Never published" }),
|
|
771
|
+
t && /* @__PURE__ */ r(j, { children: [
|
|
772
|
+
/* @__PURE__ */ r("div", { className: "rail-version-actions", children: [
|
|
773
|
+
/* @__PURE__ */ n(
|
|
774
|
+
"button",
|
|
775
|
+
{
|
|
776
|
+
type: "button",
|
|
777
|
+
className: "btn ghost",
|
|
778
|
+
"data-testid": "rail-publish",
|
|
779
|
+
disabled: e.publishing || e.publishDisabled || e.definitionStatus === "published",
|
|
780
|
+
onClick: e.onPublish,
|
|
781
|
+
children: e.publishing ? (i == null ? void 0 : i.currentPublishedVersion) != null ? "Republishing…" : "Publishing…" : e.definitionStatus === "published" || e.publishDisabled !== void 0 && e.definitionStatus === void 0 && (i == null ? void 0 : i.currentPublishedVersion) != null ? "Published" : (i == null ? void 0 : i.currentPublishedVersion) != null ? "Republish" : "Publish"
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
" ",
|
|
785
|
+
/* @__PURE__ */ n(
|
|
786
|
+
"button",
|
|
787
|
+
{
|
|
788
|
+
type: "button",
|
|
789
|
+
className: "btn ghost",
|
|
790
|
+
"data-testid": "rail-enable-toggle",
|
|
791
|
+
disabled: e.togglingEnabled || i === void 0,
|
|
792
|
+
onClick: e.onToggleEnabled,
|
|
793
|
+
children: e.togglingEnabled ? "Saving…" : i != null && i.enabled ? "Disable" : "Enable"
|
|
794
|
+
}
|
|
795
|
+
)
|
|
796
|
+
] }),
|
|
797
|
+
e.publishError && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-publish-error", children: e.publishError }),
|
|
798
|
+
e.enableError && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-enable-error", children: e.enableError })
|
|
799
|
+
] })
|
|
800
|
+
] });
|
|
801
|
+
}
|
|
802
|
+
function fn(e) {
|
|
803
|
+
const { loading: t, versions: i } = e;
|
|
804
|
+
return /* @__PURE__ */ r(q, { title: "All versions", onClose: e.onClose, wide: !0, children: [
|
|
805
|
+
/* @__PURE__ */ r("div", { className: "modal-body", children: [
|
|
806
|
+
t && /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }),
|
|
807
|
+
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ n("p", { className: "muted small", children: "No versions yet." }),
|
|
808
|
+
i && i.length > 0 && /* @__PURE__ */ n("ul", { className: "list", children: i.map((s) => /* @__PURE__ */ n("li", { className: "selectable", children: /* @__PURE__ */ n(
|
|
809
|
+
"button",
|
|
810
|
+
{
|
|
811
|
+
type: "button",
|
|
812
|
+
className: "row-select",
|
|
813
|
+
"data-testid": "rail-version-row",
|
|
814
|
+
onClick: () => e.onSelect(s.versionNumber),
|
|
815
|
+
children: /* @__PURE__ */ r("div", { className: "list-main", children: [
|
|
816
|
+
/* @__PURE__ */ r("code", { children: [
|
|
817
|
+
"v",
|
|
818
|
+
s.versionNumber
|
|
819
|
+
] }),
|
|
820
|
+
" ",
|
|
821
|
+
s.isCurrentPublished && /* @__PURE__ */ n("span", { className: "badge", "data-testid": "rail-version-current", children: "Published" }),
|
|
822
|
+
/* @__PURE__ */ n("div", { className: "muted small", children: new Date(s.createdAt).toLocaleString() })
|
|
823
|
+
] })
|
|
824
|
+
}
|
|
825
|
+
) }, s.versionNumber)) })
|
|
826
|
+
] }),
|
|
827
|
+
/* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Done" }) })
|
|
828
|
+
] });
|
|
829
|
+
}
|
|
830
|
+
const Yt = {
|
|
831
|
+
function: {
|
|
832
|
+
deleteTitle: "Delete function",
|
|
833
|
+
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.",
|
|
834
|
+
archiveTitle: "Archive function",
|
|
835
|
+
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.",
|
|
836
|
+
deleteLabel: "Delete this function",
|
|
837
|
+
deleteTestId: "delete-function",
|
|
838
|
+
archiveTestId: "archive-function"
|
|
839
|
+
},
|
|
840
|
+
endpoint: {
|
|
841
|
+
deleteTitle: "Delete endpoint",
|
|
842
|
+
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.",
|
|
843
|
+
archiveTitle: "Archive endpoint",
|
|
844
|
+
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.",
|
|
845
|
+
deleteLabel: "Delete this endpoint",
|
|
846
|
+
deleteTestId: "delete-endpoint",
|
|
847
|
+
archiveTestId: "archive-endpoint"
|
|
848
|
+
},
|
|
849
|
+
workflow: {
|
|
850
|
+
deleteTitle: "Delete workflow",
|
|
851
|
+
deleteMessage: "Permanently delete this workflow and its run history? This cannot be undone.",
|
|
852
|
+
archiveTitle: "Archive workflow",
|
|
853
|
+
archiveMessage: "Archive this workflow? It stops running and can no longer be published. Archiving is one-way — there is no unarchive. Its run history is kept until you delete it.",
|
|
854
|
+
deleteLabel: "Delete this workflow",
|
|
855
|
+
deleteTestId: "wf-settings-delete",
|
|
856
|
+
archiveTestId: "wf-settings-archive"
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
function mn(e) {
|
|
860
|
+
const t = Yt[e.kind];
|
|
861
|
+
return /* @__PURE__ */ r(j, { children: [
|
|
862
|
+
/* @__PURE__ */ n(
|
|
863
|
+
Gt,
|
|
864
|
+
{
|
|
865
|
+
archived: e.archived,
|
|
866
|
+
allowDirectDelete: e.kind === "workflow",
|
|
867
|
+
pending: e.pending,
|
|
868
|
+
deleteLabel: t.deleteLabel,
|
|
869
|
+
deleteTestId: t.deleteTestId,
|
|
870
|
+
archiveTestId: t.archiveTestId,
|
|
871
|
+
onRequestDelete: e.onRequestDelete,
|
|
872
|
+
onRequestArchive: e.onRequestArchive,
|
|
873
|
+
deleteError: e.deleteError,
|
|
874
|
+
archiveError: e.archiveError
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
e.deleteConfirming && /* @__PURE__ */ n(
|
|
878
|
+
Re,
|
|
879
|
+
{
|
|
880
|
+
title: t.deleteTitle,
|
|
881
|
+
message: t.deleteMessage,
|
|
882
|
+
confirmLabel: "Delete",
|
|
883
|
+
pending: e.pending,
|
|
884
|
+
onConfirm: e.onConfirmDelete,
|
|
885
|
+
onClose: e.onCloseDelete
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
e.archiveConfirming && /* @__PURE__ */ n(
|
|
889
|
+
Re,
|
|
890
|
+
{
|
|
891
|
+
title: t.archiveTitle,
|
|
892
|
+
message: t.archiveMessage,
|
|
893
|
+
confirmLabel: "Archive",
|
|
894
|
+
pending: e.pending,
|
|
895
|
+
onConfirm: e.onConfirmArchive,
|
|
896
|
+
onClose: e.onCloseArchive
|
|
897
|
+
}
|
|
898
|
+
)
|
|
899
|
+
] });
|
|
900
|
+
}
|
|
901
|
+
const gn = { functionsKey: ct, endpointsKey: dt, workflowsKey: kt };
|
|
902
|
+
function Zt({
|
|
903
|
+
ctx: e,
|
|
904
|
+
project: t,
|
|
905
|
+
onNavigate: i,
|
|
906
|
+
open: s
|
|
907
|
+
}) {
|
|
908
|
+
var se, fe;
|
|
909
|
+
const {
|
|
910
|
+
editingSettings: a,
|
|
911
|
+
setEditingSettings: l,
|
|
912
|
+
historyOpen: o,
|
|
913
|
+
setHistoryOpen: c,
|
|
914
|
+
versionListOpen: h,
|
|
915
|
+
setVersionListOpen: d
|
|
916
|
+
} = s, v = Xe(t ?? void 0), b = (e == null ? void 0 : e.kind) === "workflow", m = (e == null ? void 0 : e.id) ?? "", C = pt(m, b), k = vt(t ?? void 0), D = bt(), O = yt(), E = Fe(!1), [R, y] = u(!1), [M, V] = u(!1), [N, p] = u(!1), [P, $] = u(!1), [U, Q] = u(!1), [W, re] = u(null), [_, oe] = u(null), F = $e(je("workflow"), m, N), z = Be("workflow", m, o && b), ne = Je("workflow"), le = qe("workflow"), [ke, G] = u(null), [te, de] = u(null), [ie, ce] = u(
|
|
917
|
+
null
|
|
918
|
+
);
|
|
919
|
+
if (!e || e.kind !== "workflow")
|
|
920
|
+
return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow to see its settings." });
|
|
921
|
+
const I = (se = v.data) == null ? void 0 : se.find((f) => f.id === e.id), ue = I && typeof I.displayName == "string" ? I.displayName : "", H = (I == null ? void 0 : I.tags) ?? [], Y = (I == null ? void 0 : I.status) === "archived";
|
|
922
|
+
async function Z() {
|
|
923
|
+
if (!E.current) {
|
|
924
|
+
E.current = !0, re(null);
|
|
925
|
+
try {
|
|
926
|
+
Y || await D.mutateAsync(m), await O.mutateAsync(m), $(!1), i({ type: "list" });
|
|
927
|
+
} catch (f) {
|
|
928
|
+
$(!1), re(f instanceof L ? f.message : String(f));
|
|
929
|
+
} finally {
|
|
930
|
+
E.current = !1;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function he() {
|
|
935
|
+
oe(null), D.mutate(m, {
|
|
936
|
+
onSuccess: () => {
|
|
937
|
+
Q(!1), i({ type: "list" });
|
|
938
|
+
},
|
|
939
|
+
onError: (f) => {
|
|
940
|
+
Q(!1), oe(f instanceof L ? f.message : String(f));
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
|
|
945
|
+
/* @__PURE__ */ n(ln, { onEdit: () => l(!0) }),
|
|
946
|
+
e.authoringSettings && e.onAuthoringSettingChange && /* @__PURE__ */ r("section", { className: "w6w-stack", "data-testid": "rail-workflow-authoring", children: [
|
|
947
|
+
/* @__PURE__ */ r("label", { children: [
|
|
948
|
+
/* @__PURE__ */ n(
|
|
949
|
+
"input",
|
|
950
|
+
{
|
|
951
|
+
type: "checkbox",
|
|
952
|
+
checked: e.authoringSettings.autoSave,
|
|
953
|
+
onChange: (f) => {
|
|
954
|
+
var A;
|
|
955
|
+
return (A = e.onAuthoringSettingChange) == null ? void 0 : A.call(e, "autoSave", f.target.checked);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
"Auto-save edits"
|
|
960
|
+
] }),
|
|
961
|
+
/* @__PURE__ */ r("label", { children: [
|
|
962
|
+
/* @__PURE__ */ n(
|
|
963
|
+
"input",
|
|
964
|
+
{
|
|
965
|
+
type: "checkbox",
|
|
966
|
+
checked: e.authoringSettings.savePosition,
|
|
967
|
+
onChange: (f) => {
|
|
968
|
+
var A;
|
|
969
|
+
return (A = e.onAuthoringSettingChange) == null ? void 0 : A.call(e, "savePosition", f.target.checked);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
"Save node positions and canvas view"
|
|
974
|
+
] })
|
|
975
|
+
] }),
|
|
976
|
+
/* @__PURE__ */ n(
|
|
977
|
+
dn,
|
|
978
|
+
{
|
|
979
|
+
id: e.id,
|
|
980
|
+
displayName: ue,
|
|
981
|
+
fields: Ve("workflow"),
|
|
982
|
+
row: I,
|
|
983
|
+
tags: H
|
|
984
|
+
}
|
|
985
|
+
),
|
|
986
|
+
/* @__PURE__ */ n(cn, { onOpen: () => y(!0) }),
|
|
987
|
+
/* @__PURE__ */ n(
|
|
988
|
+
hn,
|
|
989
|
+
{
|
|
990
|
+
definitionStatus: e.definitionStatus,
|
|
991
|
+
publishDisabled: e.publishDisabled,
|
|
992
|
+
open: o,
|
|
993
|
+
versions: z.data,
|
|
994
|
+
publishing: ne.isPending,
|
|
995
|
+
togglingEnabled: le.isPending,
|
|
996
|
+
publishError: ke,
|
|
997
|
+
enableError: te,
|
|
998
|
+
onShow: () => {
|
|
999
|
+
c(!0), d(!0);
|
|
1000
|
+
},
|
|
1001
|
+
onPublish: () => {
|
|
1002
|
+
if (e.onPublish) {
|
|
1003
|
+
e.onPublish();
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
G(null), ne.mutate(m, {
|
|
1007
|
+
onError: (f) => G(f instanceof L ? f.message : String(f))
|
|
1008
|
+
});
|
|
1009
|
+
},
|
|
1010
|
+
onToggleEnabled: () => {
|
|
1011
|
+
var f;
|
|
1012
|
+
de(null), le.mutate(
|
|
1013
|
+
{ id: m, enabled: !((f = z.data) != null && f.enabled) },
|
|
1014
|
+
{ onError: (A) => de(A instanceof L ? A.message : String(A)) }
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
h && /* @__PURE__ */ n(
|
|
1020
|
+
fn,
|
|
1021
|
+
{
|
|
1022
|
+
loading: z.isLoading,
|
|
1023
|
+
versions: (fe = z.data) == null ? void 0 : fe.versions,
|
|
1024
|
+
onSelect: (f) => ce({ id: m, versionNumber: f }),
|
|
1025
|
+
onClose: () => d(!1)
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
ie && ie.id === m && /* @__PURE__ */ n(
|
|
1029
|
+
on,
|
|
1030
|
+
{
|
|
1031
|
+
kind: "workflow",
|
|
1032
|
+
id: m,
|
|
1033
|
+
onRestore: e.onRestoreVersion,
|
|
1034
|
+
versionNumber: ie.versionNumber,
|
|
1035
|
+
onClose: () => ce(null)
|
|
1036
|
+
}
|
|
1037
|
+
),
|
|
1038
|
+
R && /* @__PURE__ */ r(
|
|
1039
|
+
un,
|
|
1040
|
+
{
|
|
1041
|
+
kind: "workflow",
|
|
1042
|
+
onClose: () => y(!1),
|
|
1043
|
+
onImport: () => {
|
|
1044
|
+
y(!1), V(!0);
|
|
1045
|
+
},
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts." }),
|
|
1048
|
+
/* @__PURE__ */ n("div", { className: "rail-spec-menu-row", children: /* @__PURE__ */ n(
|
|
1049
|
+
"button",
|
|
1050
|
+
{
|
|
1051
|
+
type: "button",
|
|
1052
|
+
className: "btn ghost",
|
|
1053
|
+
"data-testid": "rail-spec-export",
|
|
1054
|
+
onClick: () => {
|
|
1055
|
+
y(!1), p(!0);
|
|
1056
|
+
},
|
|
1057
|
+
children: "Export"
|
|
1058
|
+
}
|
|
1059
|
+
) })
|
|
1060
|
+
]
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
N && /* @__PURE__ */ r(q, { title: "Export spec document", onClose: () => p(!1), wide: !0, children: [
|
|
1064
|
+
/* @__PURE__ */ n("div", { className: "modal-body", children: F.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : F.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: F.error instanceof Error ? F.error.message : String(F.error) }) : F.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
|
|
1065
|
+
pe,
|
|
1066
|
+
{
|
|
1067
|
+
code: JSON.stringify(F.data, null, 2),
|
|
1068
|
+
language: "json",
|
|
1069
|
+
maxHeight: "420px",
|
|
1070
|
+
copyable: !0
|
|
1071
|
+
}
|
|
1072
|
+
) }) : null }),
|
|
1073
|
+
/* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => p(!1), children: "Close" }) })
|
|
1074
|
+
] }),
|
|
1075
|
+
a && I && /* @__PURE__ */ n(
|
|
1076
|
+
rn,
|
|
1077
|
+
{
|
|
1078
|
+
kind: "workflow",
|
|
1079
|
+
id: m,
|
|
1080
|
+
initial: {
|
|
1081
|
+
displayName: ue,
|
|
1082
|
+
key: I.key ?? null,
|
|
1083
|
+
tags: H
|
|
1084
|
+
},
|
|
1085
|
+
onSave: async (f) => {
|
|
1086
|
+
if (!C.data) throw new Error("Unable to save settings");
|
|
1087
|
+
const A = C.data;
|
|
1088
|
+
return new Promise((me, ae) => {
|
|
1089
|
+
const X = {
|
|
1090
|
+
...A.workflow,
|
|
1091
|
+
displayName: f.displayName
|
|
1092
|
+
};
|
|
1093
|
+
f.key !== void 0 && (X.key = f.key), f.tags !== void 0 && (X.tags = f.tags), k.mutate(
|
|
1094
|
+
{ definition: X, ifUnmodifiedSince: A.updatedAt },
|
|
1095
|
+
{ onSuccess: () => me(), onError: ae }
|
|
1096
|
+
);
|
|
1097
|
+
});
|
|
1098
|
+
},
|
|
1099
|
+
onClose: () => l(!1)
|
|
1100
|
+
},
|
|
1101
|
+
m
|
|
1102
|
+
),
|
|
1103
|
+
/* @__PURE__ */ n(
|
|
1104
|
+
mn,
|
|
1105
|
+
{
|
|
1106
|
+
kind: "workflow",
|
|
1107
|
+
archived: Y,
|
|
1108
|
+
pending: D.isPending || O.isPending,
|
|
1109
|
+
deleteConfirming: P,
|
|
1110
|
+
archiveConfirming: U,
|
|
1111
|
+
deleteError: W,
|
|
1112
|
+
archiveError: _,
|
|
1113
|
+
onRequestDelete: () => $(!0),
|
|
1114
|
+
onRequestArchive: () => Q(!0),
|
|
1115
|
+
onConfirmDelete: Z,
|
|
1116
|
+
onConfirmArchive: he,
|
|
1117
|
+
onCloseDelete: () => $(!1),
|
|
1118
|
+
onCloseArchive: () => Q(!1)
|
|
1119
|
+
}
|
|
1120
|
+
),
|
|
1121
|
+
M && /* @__PURE__ */ n(
|
|
1122
|
+
xe,
|
|
1123
|
+
{
|
|
1124
|
+
kind: "workflow",
|
|
1125
|
+
project: t ?? void 0,
|
|
1126
|
+
listKeys: gn,
|
|
1127
|
+
onOpenImported: (f, A) => i({ type: "imported", kind: f, id: A }),
|
|
1128
|
+
onClose: () => V(!1)
|
|
1129
|
+
}
|
|
1130
|
+
)
|
|
1131
|
+
] });
|
|
1132
|
+
}
|
|
1133
|
+
function Xt({ ctx: e }) {
|
|
1134
|
+
const { project: t, onNavigate: i } = sn(), [s, a] = u(!1), [l, o] = u(!1), [c, h] = u(!1), d = {
|
|
1135
|
+
editingSettings: s,
|
|
1136
|
+
setEditingSettings: a,
|
|
1137
|
+
historyOpen: l,
|
|
1138
|
+
setHistoryOpen: o,
|
|
1139
|
+
versionListOpen: c,
|
|
1140
|
+
setVersionListOpen: h
|
|
1141
|
+
};
|
|
1142
|
+
return (e == null ? void 0 : e.kind) === "workflow" ? /* @__PURE__ */ n(Zt, { ctx: e, project: t, onNavigate: i, open: d }) : /* @__PURE__ */ n(xt, { ctx: e, project: t, onNavigate: i, open: d });
|
|
1143
|
+
}
|
|
1144
|
+
function xt({
|
|
1145
|
+
ctx: e,
|
|
1146
|
+
project: t,
|
|
1147
|
+
onNavigate: i,
|
|
1148
|
+
open: s
|
|
1149
|
+
}) {
|
|
1150
|
+
var Ee, Ae, Pe;
|
|
1151
|
+
const {
|
|
1152
|
+
editingSettings: a,
|
|
1153
|
+
setEditingSettings: l,
|
|
1154
|
+
historyOpen: o,
|
|
1155
|
+
setHistoryOpen: c,
|
|
1156
|
+
versionListOpen: h,
|
|
1157
|
+
setVersionListOpen: d
|
|
1158
|
+
} = s, v = e == null ? void 0 : e.kind, b = ut(v === "endpoint"), m = Ze(v === "function"), [C, k] = u(!1), [D, O] = u(""), [E, R] = u(null), [y, M] = u(null), [V, N] = u(!1), [p, P] = u(!1), [$, U] = u(!1), [Q, W] = u(!1), [re, _] = u(!1), [oe, F] = u(null), [z, ne] = u(null), le = _e((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "function"), ke = ze((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "endpoint"), G = Ge(), te = Ye(), de = ht(), ie = ft(), ce = mt(), I = gt(), ue = e ? je(e.kind) : null, H = $e(ue, (e == null ? void 0 : e.id) ?? "", p), Y = e && De(e.kind) ? e.kind : null, Z = Be(Y, (e == null ? void 0 : e.id) ?? "", o), he = Je(Y ?? "function"), se = qe(Y ?? "function"), [fe, f] = u(null), [A, me] = u(null), [ae, X] = u(
|
|
1159
|
+
null
|
|
1160
|
+
);
|
|
1161
|
+
if (!e || e.kind !== "function" && e.kind !== "endpoint")
|
|
1162
|
+
return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow, function, or endpoint to see its settings." });
|
|
1163
|
+
const S = e.kind, T = e.id, B = S === "function" ? (Ee = m.data) == null ? void 0 : Ee.find((g) => g.id === T) : (Ae = b.data) == null ? void 0 : Ae.find((g) => g.id === T), J = Ue(S, S === "function" ? le.data : ke.data), x = (J == null ? void 0 : J.definition) ?? null, Se = B && typeof B.displayName == "string" ? B.displayName : "", pn = x ? JSON.stringify(x, null, 2) : "";
|
|
1164
|
+
function vn() {
|
|
1165
|
+
R(null), O(pn), M((J == null ? void 0 : J.updatedAt) ?? null), k(!0);
|
|
1166
|
+
}
|
|
1167
|
+
const ee = x ? En(D, { id: String(x.id), key: String(x.key) }) : { parsed: null, blockedReason: "No definition loaded yet." }, Ce = S === "function" ? G.isPending : te.isPending;
|
|
1168
|
+
function bn() {
|
|
1169
|
+
if (!ee.parsed || ee.blockedReason) return;
|
|
1170
|
+
R(null);
|
|
1171
|
+
const g = {
|
|
1172
|
+
onSuccess: () => k(!1),
|
|
1173
|
+
onError: (ge) => R(ge instanceof L ? ge.message : String(ge))
|
|
1174
|
+
}, w = { definition: ee.parsed, ifUnmodifiedSince: y };
|
|
1175
|
+
S === "function" ? G.mutate(w, g) : te.mutate(w, g);
|
|
1176
|
+
}
|
|
1177
|
+
const yn = (B == null ? void 0 : B.archivedAt) != null;
|
|
1178
|
+
function kn() {
|
|
1179
|
+
F(null);
|
|
1180
|
+
const g = {
|
|
1181
|
+
onSuccess: () => {
|
|
1182
|
+
W(!1), i({ type: "list" });
|
|
1183
|
+
},
|
|
1184
|
+
onError: (w) => {
|
|
1185
|
+
W(!1), F(w instanceof L ? w.message : String(w));
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
S === "function" ? de.mutate(T, g) : ie.mutate(T, g);
|
|
1189
|
+
}
|
|
1190
|
+
function wn() {
|
|
1191
|
+
ne(null);
|
|
1192
|
+
const g = {
|
|
1193
|
+
onSuccess: () => {
|
|
1194
|
+
_(!1), i({ type: "list" });
|
|
1195
|
+
},
|
|
1196
|
+
onError: (w) => {
|
|
1197
|
+
_(!1), ne(w instanceof L ? w.message : String(w));
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
S === "function" ? ce.mutate(T, g) : I.mutate(T, g);
|
|
1201
|
+
}
|
|
1202
|
+
return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
|
|
1203
|
+
/* @__PURE__ */ n(ln, { onEdit: () => l(!0) }),
|
|
1204
|
+
/* @__PURE__ */ n(
|
|
1205
|
+
dn,
|
|
1206
|
+
{
|
|
1207
|
+
id: T,
|
|
1208
|
+
displayName: Se,
|
|
1209
|
+
fields: Ve(S),
|
|
1210
|
+
row: B
|
|
1211
|
+
}
|
|
1212
|
+
),
|
|
1213
|
+
Oe(S) && /* @__PURE__ */ n(cn, { onOpen: () => N(!0) }),
|
|
1214
|
+
De(S) && /* @__PURE__ */ n(
|
|
1215
|
+
hn,
|
|
1216
|
+
{
|
|
1217
|
+
open: o,
|
|
1218
|
+
versions: Z.data,
|
|
1219
|
+
publishing: he.isPending,
|
|
1220
|
+
togglingEnabled: se.isPending,
|
|
1221
|
+
publishError: fe,
|
|
1222
|
+
enableError: A,
|
|
1223
|
+
onShow: () => {
|
|
1224
|
+
c(!0), d(!0);
|
|
1225
|
+
},
|
|
1226
|
+
onPublish: () => {
|
|
1227
|
+
f(null), he.mutate(T, {
|
|
1228
|
+
onError: (g) => f(g instanceof L ? g.message : String(g))
|
|
1229
|
+
});
|
|
1230
|
+
},
|
|
1231
|
+
onToggleEnabled: () => {
|
|
1232
|
+
var g;
|
|
1233
|
+
me(null), se.mutate(
|
|
1234
|
+
{ id: T, enabled: !((g = Z.data) != null && g.enabled) },
|
|
1235
|
+
{ onError: (w) => me(w instanceof L ? w.message : String(w)) }
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
h && /* @__PURE__ */ n(
|
|
1241
|
+
fn,
|
|
1242
|
+
{
|
|
1243
|
+
loading: Z.isLoading,
|
|
1244
|
+
versions: (Pe = Z.data) == null ? void 0 : Pe.versions,
|
|
1245
|
+
onSelect: (g) => X({ id: T, versionNumber: g }),
|
|
1246
|
+
onClose: () => d(!1)
|
|
1247
|
+
}
|
|
1248
|
+
),
|
|
1249
|
+
ae && ae.id === T && /* @__PURE__ */ n(
|
|
1250
|
+
on,
|
|
1251
|
+
{
|
|
1252
|
+
kind: S,
|
|
1253
|
+
id: T,
|
|
1254
|
+
versionNumber: ae.versionNumber,
|
|
1255
|
+
onClose: () => X(null)
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
V && /* @__PURE__ */ n(
|
|
1259
|
+
un,
|
|
1260
|
+
{
|
|
1261
|
+
kind: S,
|
|
1262
|
+
onClose: () => N(!1),
|
|
1263
|
+
onImport: () => {
|
|
1264
|
+
N(!1), U(!0);
|
|
1265
|
+
},
|
|
1266
|
+
children: Oe(S) && /* @__PURE__ */ r(j, { children: [
|
|
1267
|
+
/* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts — or Edit JSON to change what's stored directly." }),
|
|
1268
|
+
/* @__PURE__ */ r("div", { className: "rail-spec-menu-row", children: [
|
|
1269
|
+
/* @__PURE__ */ n(
|
|
1270
|
+
"button",
|
|
1271
|
+
{
|
|
1272
|
+
type: "button",
|
|
1273
|
+
className: "btn ghost",
|
|
1274
|
+
"data-testid": "rail-spec-export",
|
|
1275
|
+
onClick: () => {
|
|
1276
|
+
N(!1), P(!0);
|
|
1277
|
+
},
|
|
1278
|
+
children: "Export"
|
|
1279
|
+
}
|
|
1280
|
+
),
|
|
1281
|
+
" ",
|
|
1282
|
+
/* @__PURE__ */ n(
|
|
1283
|
+
"button",
|
|
1284
|
+
{
|
|
1285
|
+
type: "button",
|
|
1286
|
+
className: "btn ghost",
|
|
1287
|
+
disabled: !x,
|
|
1288
|
+
"data-testid": "rail-json-edit",
|
|
1289
|
+
onClick: () => {
|
|
1290
|
+
N(!1), vn();
|
|
1291
|
+
},
|
|
1292
|
+
children: "Edit JSON"
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] })
|
|
1296
|
+
] })
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
p && /* @__PURE__ */ r(q, { title: "Export spec document", onClose: () => P(!1), wide: !0, children: [
|
|
1300
|
+
/* @__PURE__ */ n("div", { className: "modal-body", children: H.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : H.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: H.error instanceof Error ? H.error.message : String(H.error) }) : H.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
|
|
1301
|
+
pe,
|
|
1302
|
+
{
|
|
1303
|
+
code: JSON.stringify(H.data, null, 2),
|
|
1304
|
+
language: "json",
|
|
1305
|
+
maxHeight: "420px",
|
|
1306
|
+
copyable: !0
|
|
1307
|
+
}
|
|
1308
|
+
) }) : null }),
|
|
1309
|
+
/* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => P(!1), children: "Close" }) })
|
|
1310
|
+
] }),
|
|
1311
|
+
C && /* @__PURE__ */ r(q, { title: "Edit definition", onClose: () => k(!1), wide: !0, children: [
|
|
1312
|
+
/* @__PURE__ */ r("div", { className: "modal-body", children: [
|
|
1313
|
+
/* @__PURE__ */ n(
|
|
1314
|
+
Rn,
|
|
1315
|
+
{
|
|
1316
|
+
value: D,
|
|
1317
|
+
onChange: O,
|
|
1318
|
+
minHeight: "320px",
|
|
1319
|
+
"aria-label": "Edit definition JSON"
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
ee.blockedReason && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-edit-reason", children: ee.blockedReason }),
|
|
1323
|
+
E && /* @__PURE__ */ n("div", { className: "error", children: E })
|
|
1324
|
+
] }),
|
|
1325
|
+
/* @__PURE__ */ r("div", { className: "modal-actions", children: [
|
|
1326
|
+
/* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => k(!1), children: "Cancel" }),
|
|
1327
|
+
/* @__PURE__ */ n(
|
|
1328
|
+
"button",
|
|
1329
|
+
{
|
|
1330
|
+
type: "button",
|
|
1331
|
+
className: "btn",
|
|
1332
|
+
disabled: ee.blockedReason !== null || Ce,
|
|
1333
|
+
"data-testid": "rail-json-save",
|
|
1334
|
+
onClick: bn,
|
|
1335
|
+
children: Ce ? "Saving…" : "Save"
|
|
1336
|
+
}
|
|
1337
|
+
)
|
|
1338
|
+
] })
|
|
1339
|
+
] }),
|
|
1340
|
+
a && B && /* @__PURE__ */ n(
|
|
1341
|
+
rn,
|
|
1342
|
+
{
|
|
1343
|
+
kind: S,
|
|
1344
|
+
id: T,
|
|
1345
|
+
initial: {
|
|
1346
|
+
displayName: Se,
|
|
1347
|
+
key: B.key ?? null,
|
|
1348
|
+
tags: []
|
|
1349
|
+
},
|
|
1350
|
+
onSave: async (g) => {
|
|
1351
|
+
if (!J) throw new Error("Unable to save settings");
|
|
1352
|
+
const w = J.definition, Ie = { definition: S === "function" ? (
|
|
1353
|
+
// `canEditKey: true` for function (`callable-descriptors.ts`): `data.key` must
|
|
1354
|
+
// reach the server (the modal falls back to `initial.key` when unchanged).
|
|
1355
|
+
{ ...w, displayName: g.displayName, key: g.key ?? w.key }
|
|
1356
|
+
) : { ...w, displayName: g.displayName }, ifUnmodifiedSince: J.updatedAt };
|
|
1357
|
+
return new Promise((Nn, Sn) => {
|
|
1358
|
+
const Te = { onSuccess: () => Nn(), onError: Sn };
|
|
1359
|
+
S === "function" ? G.mutate(Ie, Te) : te.mutate(Ie, Te);
|
|
1360
|
+
});
|
|
1361
|
+
},
|
|
1362
|
+
onClose: () => l(!1)
|
|
1363
|
+
},
|
|
1364
|
+
T
|
|
1365
|
+
),
|
|
1366
|
+
An(S) && /* @__PURE__ */ n(
|
|
1367
|
+
mn,
|
|
1368
|
+
{
|
|
1369
|
+
kind: S,
|
|
1370
|
+
archived: yn,
|
|
1371
|
+
deleteConfirming: Q,
|
|
1372
|
+
archiveConfirming: re,
|
|
1373
|
+
deleteError: oe,
|
|
1374
|
+
archiveError: z,
|
|
1375
|
+
onRequestDelete: () => W(!0),
|
|
1376
|
+
onRequestArchive: () => _(!0),
|
|
1377
|
+
onConfirmDelete: kn,
|
|
1378
|
+
onConfirmArchive: wn,
|
|
1379
|
+
onCloseDelete: () => W(!1),
|
|
1380
|
+
onCloseArchive: () => _(!1)
|
|
1381
|
+
}
|
|
1382
|
+
),
|
|
1383
|
+
$ && /* @__PURE__ */ n(
|
|
1384
|
+
xe,
|
|
1385
|
+
{
|
|
1386
|
+
kind: S,
|
|
1387
|
+
project: t ?? void 0,
|
|
1388
|
+
listKeys: gn,
|
|
1389
|
+
onOpenImported: (g, w) => i({ type: "imported", kind: g, id: w }),
|
|
1390
|
+
onClose: () => U(!1)
|
|
1391
|
+
}
|
|
1392
|
+
)
|
|
1393
|
+
] });
|
|
1394
|
+
}
|
|
1395
|
+
function ei() {
|
|
1396
|
+
return /* @__PURE__ */ n(K, { name: "settings" });
|
|
1397
|
+
}
|
|
1398
|
+
const ni = {
|
|
1399
|
+
id: "settings",
|
|
1400
|
+
title: "Settings",
|
|
1401
|
+
rendersHeading: !0,
|
|
1402
|
+
Icon: ei,
|
|
1403
|
+
isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" || (e == null ? void 0 : e.kind) === "function" || (e == null ? void 0 : e.kind) === "endpoint",
|
|
1404
|
+
Panel: Xt
|
|
1405
|
+
}, ti = ["string", "number", "boolean", "object", "array"];
|
|
1406
|
+
function ii({
|
|
1407
|
+
variables: e,
|
|
1408
|
+
onVariablesChange: t
|
|
1409
|
+
}) {
|
|
1410
|
+
const i = Mn().vars ?? [];
|
|
1411
|
+
function s() {
|
|
1412
|
+
t([...e, { key: "" }]);
|
|
1413
|
+
}
|
|
1414
|
+
function a(c, h) {
|
|
1415
|
+
t(e.map((d, v) => v === c ? { ...d, ...h } : d));
|
|
1416
|
+
}
|
|
1417
|
+
function l(c) {
|
|
1418
|
+
t(e.filter((h, d) => d !== c));
|
|
1419
|
+
}
|
|
1420
|
+
const o = Hn(e);
|
|
1421
|
+
return /* @__PURE__ */ r("div", { className: "workflow-variable-fields", children: [
|
|
1422
|
+
/* @__PURE__ */ r("p", { className: "muted small", children: [
|
|
1423
|
+
"Declaring variables here defines this workflow's ",
|
|
1424
|
+
/* @__PURE__ */ n("strong", { children: "public input schema" }),
|
|
1425
|
+
": API and AI (MCP) callers then see exactly these inputs. With none declared, they may send anything."
|
|
1426
|
+
] }),
|
|
1427
|
+
/* @__PURE__ */ r("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
|
|
1428
|
+
/* @__PURE__ */ n("span", { className: "muted small", children: e.length === 0 ? "No variables declared." : `${e.length} variable${e.length === 1 ? "" : "s"} declared.` }),
|
|
1429
|
+
/* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: s, children: "+ Add variable" })
|
|
1430
|
+
] }),
|
|
1431
|
+
e.length > 0 && /* @__PURE__ */ n("ul", { className: "list", "data-testid": "workflow-variables-list", children: e.map((c, h) => /* @__PURE__ */ r(
|
|
1432
|
+
"li",
|
|
1433
|
+
{
|
|
1434
|
+
style: {
|
|
1435
|
+
flexDirection: "column",
|
|
1436
|
+
alignItems: "stretch",
|
|
1437
|
+
gap: "var(--w6w-sp-1)"
|
|
1438
|
+
},
|
|
1439
|
+
children: [
|
|
1440
|
+
/* @__PURE__ */ r("div", { className: "workflow-variable-row", children: [
|
|
1441
|
+
/* @__PURE__ */ n(
|
|
1442
|
+
"input",
|
|
1443
|
+
{
|
|
1444
|
+
type: "text",
|
|
1445
|
+
value: c.key,
|
|
1446
|
+
placeholder: "key",
|
|
1447
|
+
"aria-label": "Variable key",
|
|
1448
|
+
onChange: (d) => a(h, { key: d.target.value })
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
/* @__PURE__ */ r(
|
|
1452
|
+
"select",
|
|
1453
|
+
{
|
|
1454
|
+
value: c.type ?? "",
|
|
1455
|
+
"aria-label": "Variable type",
|
|
1456
|
+
onChange: (d) => a(h, {
|
|
1457
|
+
type: d.target.value || void 0
|
|
1458
|
+
}),
|
|
1459
|
+
children: [
|
|
1460
|
+
/* @__PURE__ */ n("option", { value: "", children: "(unset)" }),
|
|
1461
|
+
ti.map((d) => /* @__PURE__ */ n("option", { value: d, children: d }, d))
|
|
1462
|
+
]
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
/* @__PURE__ */ r("label", { className: "row", style: { gap: "var(--w6w-sp-1)", alignItems: "center" }, children: [
|
|
1466
|
+
/* @__PURE__ */ n(
|
|
1467
|
+
"input",
|
|
1468
|
+
{
|
|
1469
|
+
type: "checkbox",
|
|
1470
|
+
checked: c.required ?? !1,
|
|
1471
|
+
onChange: (d) => a(h, { required: d.target.checked })
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
/* @__PURE__ */ n("span", { className: "muted small", children: "required" })
|
|
1475
|
+
] }),
|
|
1476
|
+
/* @__PURE__ */ n(
|
|
1477
|
+
He,
|
|
1478
|
+
{
|
|
1479
|
+
value: { vars: $n(e, h, i) },
|
|
1480
|
+
children: /* @__PURE__ */ n(
|
|
1481
|
+
Ln,
|
|
1482
|
+
{
|
|
1483
|
+
value: c.default,
|
|
1484
|
+
onChange: (d) => a(h, { default: d }),
|
|
1485
|
+
placeholder: "default",
|
|
1486
|
+
"aria-label": "Variable default"
|
|
1487
|
+
},
|
|
1488
|
+
`${e.length}:${h}`
|
|
1489
|
+
)
|
|
1490
|
+
}
|
|
1491
|
+
),
|
|
1492
|
+
/* @__PURE__ */ n(
|
|
1493
|
+
we,
|
|
1494
|
+
{
|
|
1495
|
+
danger: !0,
|
|
1496
|
+
icon: "close",
|
|
1497
|
+
label: `Remove variable ${c.key || h + 1}`,
|
|
1498
|
+
onClick: () => l(h)
|
|
1499
|
+
}
|
|
1500
|
+
)
|
|
1501
|
+
] }),
|
|
1502
|
+
o.includes(h) && /* @__PURE__ */ n("span", { className: "muted small", "data-testid": "variable-duplicate", children: "Duplicate key — a later row with the same name wins." })
|
|
1503
|
+
]
|
|
1504
|
+
},
|
|
1505
|
+
h
|
|
1506
|
+
)) })
|
|
1507
|
+
] });
|
|
1508
|
+
}
|
|
1509
|
+
function Ne(e) {
|
|
1510
|
+
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
1511
|
+
}
|
|
1512
|
+
function si(e, t) {
|
|
1513
|
+
if (Ne(e)) return e;
|
|
1514
|
+
if (t && t.length > 0) return Pt(t);
|
|
1515
|
+
}
|
|
1516
|
+
function ai(e) {
|
|
1517
|
+
const t = /* @__PURE__ */ new Map(), i = [...e].sort((s, a) => s.seq - a.seq);
|
|
1518
|
+
for (const s of i) {
|
|
1519
|
+
if (s.warning !== void 0 || !Array.isArray(s.path)) continue;
|
|
1520
|
+
const a = s.nodeId ?? null, l = s.new !== void 0 && s.new !== null;
|
|
1521
|
+
if (s.path.length === 0) {
|
|
1522
|
+
if (t.clear(), l && Ne(s.new)) for (const c of Object.keys(s.new)) t.set(c, a);
|
|
1523
|
+
continue;
|
|
1524
|
+
}
|
|
1525
|
+
const o = s.path[0];
|
|
1526
|
+
s.path.length === 1 && !l ? t.delete(o) : t.set(o, a);
|
|
1527
|
+
}
|
|
1528
|
+
return t;
|
|
1529
|
+
}
|
|
1530
|
+
const ri = /\{\{[\s\S]*?\}\}/;
|
|
1531
|
+
function oi(e) {
|
|
1532
|
+
const t = [], i = (s, a) => {
|
|
1533
|
+
if (Ne(s) && Object.keys(s).length > 0) {
|
|
1534
|
+
for (const [l, o] of Object.entries(s)) i(o, a ? `${a}.${l}` : l);
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
if (typeof s == "string" && ri.test(s)) {
|
|
1538
|
+
t.push({ path: a, kind: "reference", text: s });
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
t.push({ path: a, kind: "literal", text: JSON.stringify(s) ?? String(s) });
|
|
1542
|
+
};
|
|
1543
|
+
if (e) for (const [s, a] of Object.entries(e)) i(a, s);
|
|
1544
|
+
return t;
|
|
1545
|
+
}
|
|
1546
|
+
function li(e) {
|
|
1547
|
+
return (e == null ? void 0 : e.kind) === "workflow" ? e.onOpenStartingState : void 0;
|
|
1548
|
+
}
|
|
1549
|
+
function di() {
|
|
1550
|
+
return /* @__PURE__ */ n(K, { name: "database" });
|
|
1551
|
+
}
|
|
1552
|
+
function ci({ ctx: e }) {
|
|
1553
|
+
var k, D, O, E, R;
|
|
1554
|
+
const t = At(), i = wt(e.id), s = (k = i.data) == null ? void 0 : k[0], a = Nt((s == null ? void 0 : s.runId) ?? null), l = ((D = a.data) == null ? void 0 : D.status) ?? (s == null ? void 0 : s.status), o = St((s == null ? void 0 : s.runId) ?? null, l), c = l !== void 0 && !Ct(l), h = Fe(null);
|
|
1555
|
+
if (be(() => {
|
|
1556
|
+
!c || !s || s.finishedAt !== null || h.current !== s.runId && (h.current = s.runId, t.invalidateQueries({ queryKey: Et(e.id) }));
|
|
1557
|
+
}, [c, s, t, e.id]), i.isLoading) return /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" });
|
|
1558
|
+
if (!s)
|
|
1559
|
+
return /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-empty", children: "No run yet. Run the workflow and the state it ends with shows here." });
|
|
1560
|
+
const d = ((O = o.data) == null ? void 0 : O.writes) ?? [], v = (E = a.data) == null ? void 0 : E.state, b = si(v, d), m = ai(d), C = b ? Object.keys(b) : [];
|
|
1561
|
+
return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-current", children: [
|
|
1562
|
+
/* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
|
|
1563
|
+
/* @__PURE__ */ n("dt", { children: "Run" }),
|
|
1564
|
+
/* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("code", { "data-testid": "rail-state-run-id", children: s.runId }) }),
|
|
1565
|
+
/* @__PURE__ */ n("dt", { children: "Started" }),
|
|
1566
|
+
/* @__PURE__ */ n("dd", { children: new Date(s.startedAt).toLocaleString() }),
|
|
1567
|
+
/* @__PURE__ */ n("dt", { children: "Status" }),
|
|
1568
|
+
/* @__PURE__ */ n("dd", { "data-testid": "rail-state-run-status", children: l })
|
|
1569
|
+
] }),
|
|
1570
|
+
e.onOpenRun && /* @__PURE__ */ n(
|
|
1571
|
+
"button",
|
|
1572
|
+
{
|
|
1573
|
+
type: "button",
|
|
1574
|
+
className: "btn ghost",
|
|
1575
|
+
"data-testid": "rail-state-open-run",
|
|
1576
|
+
onClick: () => {
|
|
1577
|
+
var y;
|
|
1578
|
+
return (y = e.onOpenRun) == null ? void 0 : y.call(e, s.runId);
|
|
1579
|
+
},
|
|
1580
|
+
children: "Open this run"
|
|
1581
|
+
}
|
|
1582
|
+
),
|
|
1583
|
+
a.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : C.length === 0 || !b ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-none", children: "This run has no state." }) : /* @__PURE__ */ r(j, { children: [
|
|
1584
|
+
/* @__PURE__ */ n(jn, { value: b }),
|
|
1585
|
+
/* @__PURE__ */ n("ul", { className: "list", "data-testid": "rail-state-writers", children: C.map((y) => {
|
|
1586
|
+
const M = m.get(y);
|
|
1587
|
+
return /* @__PURE__ */ n("li", { "data-testid": "rail-state-writer", children: /* @__PURE__ */ r("span", { className: "list-main", children: [
|
|
1588
|
+
/* @__PURE__ */ n("code", { children: y }),
|
|
1589
|
+
/* @__PURE__ */ n("span", { className: "muted small block", children: M ? /* @__PURE__ */ r(j, { children: [
|
|
1590
|
+
"Last written by ",
|
|
1591
|
+
/* @__PURE__ */ n("code", { children: M })
|
|
1592
|
+
] }) : m.has(y) ? "From the starting state" : "No step wrote it" })
|
|
1593
|
+
] }) }, y);
|
|
1594
|
+
}) }),
|
|
1595
|
+
((R = o.data) == null ? void 0 : R.truncated) && /* @__PURE__ */ n("p", { className: "muted small", children: "The run's state log reached its limit, so later writers aren't shown." })
|
|
1596
|
+
] })
|
|
1597
|
+
] });
|
|
1598
|
+
}
|
|
1599
|
+
function ui({ ctx: e }) {
|
|
1600
|
+
const t = oi(e.startingState), i = Bn(e.startingState, e.variables ?? []);
|
|
1601
|
+
return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-starting", children: [
|
|
1602
|
+
/* @__PURE__ */ n("p", { className: "muted small", children: "Workflow inputs override starting state; starting state overrides project variables with the same name." }),
|
|
1603
|
+
i.length > 0 && /* @__PURE__ */ r("p", { className: "muted small", "data-testid": "starting-data-collision", children: [
|
|
1604
|
+
"Overridden by workflow inputs: ",
|
|
1605
|
+
i.join(", "),
|
|
1606
|
+
"."
|
|
1607
|
+
] }),
|
|
1608
|
+
/* @__PURE__ */ n(
|
|
1609
|
+
"button",
|
|
1610
|
+
{
|
|
1611
|
+
type: "button",
|
|
1612
|
+
className: "btn",
|
|
1613
|
+
"data-testid": "rail-state-edit-starting",
|
|
1614
|
+
onClick: () => {
|
|
1615
|
+
var s;
|
|
1616
|
+
return (s = e.onOpenStartingState) == null ? void 0 : s.call(e);
|
|
1617
|
+
},
|
|
1618
|
+
children: "Edit starting state"
|
|
1619
|
+
}
|
|
1620
|
+
),
|
|
1621
|
+
t.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-starting-empty", children: "No starting state. Every run begins with an empty state." }) : /* @__PURE__ */ n("ul", { className: "list", children: t.map((s) => /* @__PURE__ */ n("li", { "data-testid": "rail-state-starting-row", "data-kind": s.kind, children: /* @__PURE__ */ r("span", { className: "list-main", children: [
|
|
1622
|
+
/* @__PURE__ */ n("code", { children: s.path }),
|
|
1623
|
+
/* @__PURE__ */ n("span", { className: "muted small block", children: s.kind === "reference" ? /* @__PURE__ */ r(j, { children: [
|
|
1624
|
+
"Reference ",
|
|
1625
|
+
/* @__PURE__ */ n("code", { children: s.text }),
|
|
1626
|
+
", resolved when a run starts"
|
|
1627
|
+
] }) : /* @__PURE__ */ n("code", { children: s.text }) })
|
|
1628
|
+
] }) }, s.path)) })
|
|
1629
|
+
] });
|
|
1630
|
+
}
|
|
1631
|
+
function hi({ ctx: e }) {
|
|
1632
|
+
return (e == null ? void 0 : e.kind) !== "workflow" || !e.onOpenStartingState ? null : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-body", children: [
|
|
1633
|
+
/* @__PURE__ */ n("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ n("h3", { children: "Data" }) }),
|
|
1634
|
+
e.onVariablesChange && /* @__PURE__ */ r("section", { "data-testid": "rail-workflow-variables", children: [
|
|
1635
|
+
/* @__PURE__ */ n("h4", { children: "Workflow inputs" }),
|
|
1636
|
+
/* @__PURE__ */ n(
|
|
1637
|
+
ii,
|
|
1638
|
+
{
|
|
1639
|
+
variables: e.variables ?? [],
|
|
1640
|
+
onVariablesChange: e.onVariablesChange
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
] }),
|
|
1644
|
+
/* @__PURE__ */ r("section", { "data-testid": "rail-state-current-section", children: [
|
|
1645
|
+
/* @__PURE__ */ n("h4", { children: "Current state" }),
|
|
1646
|
+
/* @__PURE__ */ n(ci, { ctx: e })
|
|
1647
|
+
] }),
|
|
1648
|
+
/* @__PURE__ */ n("hr", {}),
|
|
1649
|
+
/* @__PURE__ */ r("section", { "data-testid": "rail-state-starting-section", children: [
|
|
1650
|
+
/* @__PURE__ */ n("h4", { children: "Starting state" }),
|
|
1651
|
+
/* @__PURE__ */ n(ui, { ctx: e })
|
|
1652
|
+
] })
|
|
1653
|
+
] });
|
|
1654
|
+
}
|
|
1655
|
+
const fi = {
|
|
1656
|
+
id: "starting-state",
|
|
1657
|
+
title: "Data",
|
|
1658
|
+
rendersHeading: !0,
|
|
1659
|
+
Icon: di,
|
|
1660
|
+
isAvailable: (e) => li(e) !== void 0,
|
|
1661
|
+
Panel: hi,
|
|
1662
|
+
hasIndicator: (e) => (e == null ? void 0 : e.kind) === "workflow" && e.hasStartingState === !0
|
|
1663
|
+
}, Wi = [
|
|
1664
|
+
ni,
|
|
1665
|
+
Lt,
|
|
1666
|
+
Jt,
|
|
1667
|
+
fi,
|
|
1668
|
+
jt,
|
|
1669
|
+
qt
|
|
1670
|
+
];
|
|
1671
|
+
export {
|
|
1672
|
+
Qt as C,
|
|
1673
|
+
Vi as P,
|
|
1674
|
+
Qi as R,
|
|
1675
|
+
Ri as W,
|
|
1676
|
+
sn as a,
|
|
1677
|
+
ji as b,
|
|
1678
|
+
Li as c,
|
|
1679
|
+
Mi as d,
|
|
1680
|
+
Wi as e,
|
|
1681
|
+
It as u
|
|
1682
|
+
};
|
|
1683
|
+
//# sourceMappingURL=editor-tools-BR27RGto.js.map
|