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