@w6w/embed 0.2.11 → 0.2.19
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/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 +3 -2
- 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
package/dist/editors.mjs
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
var tn = Object.defineProperty;
|
|
3
|
+
var an = (t, i, a) => i in t ? tn(t, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[i] = a;
|
|
4
|
+
var Se = (t, i, a) => an(t, typeof i != "symbol" ? i + "" : i, a);
|
|
5
|
+
import { H as sn, E as on, B as rn, a as Re, J as xe, b as De } from "./WorkflowEditor-CmhXHRxi.js";
|
|
6
|
+
import { W as Wt } from "./WorkflowEditor-CmhXHRxi.js";
|
|
7
|
+
import { jsx as e, jsxs as o, Fragment as D } from "react/jsx-runtime";
|
|
8
|
+
import { EditButton as ln, DeleteButton as dn, Copyable as Ke, CodeBlock as cn, IconButton as pe, AppIcon as un, ExpressionInput as hn, StepBuilderModal as mn, ExpressionOptionsProvider as Te } from "@w6w/ui";
|
|
9
|
+
import { useState as b, Component as fn, useRef as _, useEffect as se, useMemo as L, useCallback as he } from "react";
|
|
10
|
+
import { a as pn, C as yn } from "./ConfirmModal-Pv2-A_3U.js";
|
|
11
|
+
import { D as vn } from "./DocumentFormModal-Br4s8wmi.js";
|
|
9
12
|
import { u as ke } from "./project-context-Tvp-La7A.js";
|
|
10
|
-
import {
|
|
11
|
-
import { ApiError as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { e as
|
|
18
|
-
import {
|
|
13
|
+
import { j as gn, i as bn } from "./spec-import-SWOonsNr.js";
|
|
14
|
+
import { ApiError as ye } from "@w6w/sdk";
|
|
15
|
+
import { k as kn, i as wn } from "./apps-ItBvnWX3.js";
|
|
16
|
+
import { C as Nn, c as Ae } from "./editor-tools-BR27RGto.js";
|
|
17
|
+
import { a as Cn, b as Sn } from "./use-callable-draft-DCauHt5o.js";
|
|
18
|
+
import { E as En, F as In } from "./CreateFunctionModal-DScxp_LN.js";
|
|
19
|
+
import { d as Oe, z as Fn, b as Pn, u as Bn, w as je, v as Me, A as Rn } from "./endpoints-DSRo1Lc5.js";
|
|
20
|
+
import { t as xn, a as Je, c as Le, I as Dn, b as Kn, p as ve, f as Tn, u as Ee, s as We, m as Qe, g as Ue, i as Ie, e as An, h as On } from "./coerce-input-DFJ4n_wc.js";
|
|
21
|
+
import { e as me } from "./import-bindings-EUtxZ9Ti.js";
|
|
22
|
+
import { h as qe, b as jn, e as Mn } from "./spec-export-DGy5ijps.js";
|
|
19
23
|
import { useQueryClient as we } from "@tanstack/react-query";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { f as
|
|
23
|
-
import { n as _e,
|
|
24
|
-
import {
|
|
25
|
-
import { s as
|
|
26
|
-
function
|
|
24
|
+
import { o as $e, a1 as Jn, a0 as Ln } from "./workflows-BZN4Hyz1.js";
|
|
25
|
+
import { SECRET_MASK as Wn } from "@w6w/sdk/console";
|
|
26
|
+
import { f as He, d as Qn } from "./setup-incomplete-BHs3Lpfy.js";
|
|
27
|
+
import { n as _e, d as Un } from "./connections-CzsCyIxY.js";
|
|
28
|
+
import { u as qn } from "./editor-apps-DkkC7wOQ.js";
|
|
29
|
+
import { s as $n } from "./slug-BVdgiP_L.js";
|
|
30
|
+
function Hn(t) {
|
|
27
31
|
switch (t) {
|
|
28
32
|
case "yaml":
|
|
29
33
|
return "yaml";
|
|
@@ -37,29 +41,29 @@ function Jn(t) {
|
|
|
37
41
|
return "plaintext";
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
function
|
|
44
|
+
function Ot({
|
|
41
45
|
documentId: t,
|
|
42
|
-
project:
|
|
46
|
+
project: i,
|
|
43
47
|
onDeleted: a,
|
|
44
|
-
onBack:
|
|
45
|
-
slots:
|
|
48
|
+
onBack: h,
|
|
49
|
+
slots: d
|
|
46
50
|
}) {
|
|
47
|
-
const n = ke(
|
|
48
|
-
if (
|
|
51
|
+
const n = ke(i), c = gn(t, n ?? void 0, n != null), I = bn(), [v, N] = b(!1), [m, y] = b(!1);
|
|
52
|
+
if (c.isPending)
|
|
49
53
|
return /* @__PURE__ */ e("div", { className: "w6w-embed-root", children: /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) });
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
const r = (
|
|
54
|
+
const s = c.data;
|
|
55
|
+
if (!s) {
|
|
56
|
+
const r = (d == null ? void 0 : d.empty) === void 0 ? /* @__PURE__ */ o(D, { children: [
|
|
53
57
|
/* @__PURE__ */ e("h3", { children: "Document not found" }),
|
|
54
|
-
|
|
55
|
-
] }) :
|
|
58
|
+
h && /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: h, children: "Back to documents" })
|
|
59
|
+
] }) : d.empty;
|
|
56
60
|
return /* @__PURE__ */ e("div", { className: "w6w-embed-root", children: r });
|
|
57
61
|
}
|
|
58
|
-
const P = (
|
|
59
|
-
/* @__PURE__ */ e(
|
|
60
|
-
!
|
|
62
|
+
const P = (d == null ? void 0 : d.header) === void 0 ? /* @__PURE__ */ e("h3", { children: s.key }) : d.header, u = (d == null ? void 0 : d.actions) === void 0 ? /* @__PURE__ */ e("div", { className: "card", children: /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
|
|
63
|
+
/* @__PURE__ */ e(pn, { resource: { kind: "document", key: s.key } }),
|
|
64
|
+
!s.shared && /* @__PURE__ */ o(D, { children: [
|
|
61
65
|
/* @__PURE__ */ e(
|
|
62
|
-
|
|
66
|
+
ln,
|
|
63
67
|
{
|
|
64
68
|
label: "Edit",
|
|
65
69
|
onClick: () => N(!0),
|
|
@@ -67,7 +71,7 @@ function Et({
|
|
|
67
71
|
}
|
|
68
72
|
),
|
|
69
73
|
/* @__PURE__ */ e(
|
|
70
|
-
|
|
74
|
+
dn,
|
|
71
75
|
{
|
|
72
76
|
label: "Delete",
|
|
73
77
|
onClick: () => y(!0),
|
|
@@ -76,13 +80,13 @@ function Et({
|
|
|
76
80
|
}
|
|
77
81
|
)
|
|
78
82
|
] })
|
|
79
|
-
] }) }) :
|
|
83
|
+
] }) }) : d.actions;
|
|
80
84
|
return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-doc-editor", children: [
|
|
81
85
|
P,
|
|
82
86
|
u,
|
|
83
87
|
/* @__PURE__ */ o("div", { className: "card", children: [
|
|
84
88
|
/* @__PURE__ */ e("h3", { children: "Key" }),
|
|
85
|
-
/* @__PURE__ */ e(
|
|
89
|
+
/* @__PURE__ */ e(Ke, { value: s.key, readOnly: !0, children: /* @__PURE__ */ e(
|
|
86
90
|
"code",
|
|
87
91
|
{
|
|
88
92
|
style: {
|
|
@@ -93,7 +97,7 @@ function Et({
|
|
|
93
97
|
textOverflow: "ellipsis",
|
|
94
98
|
flex: 1
|
|
95
99
|
},
|
|
96
|
-
children:
|
|
100
|
+
children: s.key
|
|
97
101
|
}
|
|
98
102
|
) })
|
|
99
103
|
] }),
|
|
@@ -101,87 +105,141 @@ function Et({
|
|
|
101
105
|
/* @__PURE__ */ e("h3", { children: "Content" }),
|
|
102
106
|
/* @__PURE__ */ o("p", { className: "muted small", children: [
|
|
103
107
|
"Format ",
|
|
104
|
-
/* @__PURE__ */ e("code", { children:
|
|
108
|
+
/* @__PURE__ */ e("code", { children: s.format }),
|
|
105
109
|
". Stored verbatim — this is a read-only view, not a rendered preview."
|
|
106
110
|
] }),
|
|
107
111
|
/* @__PURE__ */ e(
|
|
108
|
-
|
|
112
|
+
cn,
|
|
109
113
|
{
|
|
110
|
-
code:
|
|
111
|
-
language:
|
|
114
|
+
code: s.content,
|
|
115
|
+
language: Hn(s.format),
|
|
112
116
|
showLineNumbers: !0
|
|
113
117
|
}
|
|
114
118
|
)
|
|
115
119
|
] }),
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
v && /* @__PURE__ */ e(
|
|
121
|
+
vn,
|
|
118
122
|
{
|
|
119
|
-
initial:
|
|
123
|
+
initial: s,
|
|
120
124
|
project: n,
|
|
121
125
|
onClose: () => N(!1),
|
|
122
126
|
onSaved: () => N(!1)
|
|
123
127
|
}
|
|
124
128
|
),
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
m && /* @__PURE__ */ e(
|
|
130
|
+
yn,
|
|
127
131
|
{
|
|
128
132
|
title: "Delete document",
|
|
129
|
-
message: `Delete the document "${
|
|
133
|
+
message: `Delete the document "${s.key}"? This cannot be undone.`,
|
|
130
134
|
confirmLabel: "Delete",
|
|
131
135
|
onConfirm: () => {
|
|
132
|
-
y(!1), n != null && I.mutate({ id:
|
|
136
|
+
y(!1), n != null && I.mutate({ id: s.id, project: n }, { onSuccess: () => a == null ? void 0 : a() });
|
|
133
137
|
},
|
|
134
138
|
onClose: () => y(!1)
|
|
135
139
|
}
|
|
136
140
|
)
|
|
137
141
|
] });
|
|
138
142
|
}
|
|
139
|
-
|
|
143
|
+
function Ve({
|
|
144
|
+
hasExecuted: t,
|
|
145
|
+
onClick: i,
|
|
146
|
+
buttonRef: a
|
|
147
|
+
}) {
|
|
148
|
+
return /* @__PURE__ */ e(
|
|
149
|
+
pe,
|
|
150
|
+
{
|
|
151
|
+
ref: a,
|
|
152
|
+
icon: "history",
|
|
153
|
+
"data-testid": "history-button",
|
|
154
|
+
label: "Execution history",
|
|
155
|
+
title: t ? "Execution history" : "No executions yet",
|
|
156
|
+
disabled: !t,
|
|
157
|
+
onClick: i
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function _n({ kind: t, id: i, onOpenRun: a }) {
|
|
162
|
+
const { hasExecuted: h } = kn(i), [d, n] = b(!1), c = _(null), I = _(!1);
|
|
163
|
+
return se(() => {
|
|
164
|
+
var v;
|
|
165
|
+
I.current && !d && ((v = c.current) == null || v.focus()), I.current = d;
|
|
166
|
+
}, [d]), /* @__PURE__ */ o(D, { children: [
|
|
167
|
+
/* @__PURE__ */ e(
|
|
168
|
+
Ve,
|
|
169
|
+
{
|
|
170
|
+
hasExecuted: h,
|
|
171
|
+
buttonRef: c,
|
|
172
|
+
onClick: () => n(!0)
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
d && /* @__PURE__ */ e(sn, { kind: t, id: i, onClose: () => n(!1), onOpenRun: a })
|
|
176
|
+
] });
|
|
177
|
+
}
|
|
178
|
+
class Vn extends fn {
|
|
179
|
+
constructor() {
|
|
180
|
+
super(...arguments);
|
|
181
|
+
Se(this, "state", { failed: !1 });
|
|
182
|
+
}
|
|
183
|
+
static getDerivedStateFromError() {
|
|
184
|
+
return { failed: !0 };
|
|
185
|
+
}
|
|
186
|
+
componentDidCatch(a) {
|
|
187
|
+
console.error("history probe answer was unreadable; disabling the button", a);
|
|
188
|
+
}
|
|
189
|
+
render() {
|
|
190
|
+
return this.state.failed ? /* @__PURE__ */ e(Ve, { hasExecuted: !1, onClick: () => {
|
|
191
|
+
} }) : this.props.children;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function Ye(t) {
|
|
195
|
+
return /* @__PURE__ */ e(Vn, { children: /* @__PURE__ */ e(_n, { ...t }) });
|
|
196
|
+
}
|
|
197
|
+
const Yn = {
|
|
140
198
|
kind: "action",
|
|
141
199
|
uses: { app: "", action: "", connection: null }
|
|
142
200
|
};
|
|
143
|
-
function
|
|
144
|
-
return { input: [], ...t, target: t.target ??
|
|
201
|
+
function ce(t) {
|
|
202
|
+
return { input: [], ...t, target: t.target ?? Yn };
|
|
145
203
|
}
|
|
146
|
-
function
|
|
147
|
-
const { target:
|
|
148
|
-
...
|
|
204
|
+
function ge(t) {
|
|
205
|
+
const { target: i, input: a, ...h } = ce(t), d = {
|
|
206
|
+
...h,
|
|
149
207
|
key: String(t.key ?? "").trim()
|
|
150
208
|
};
|
|
151
|
-
|
|
152
|
-
const n =
|
|
153
|
-
return n !== void 0 && (
|
|
209
|
+
xn(i) && (d.target = i);
|
|
210
|
+
const n = Je(a ?? [], { emptyMeansPassthrough: !0 });
|
|
211
|
+
return n !== void 0 && (d.input = n), d;
|
|
154
212
|
}
|
|
155
|
-
function
|
|
213
|
+
function ze(t) {
|
|
156
214
|
return t && t.length > 1 ? t : void 0;
|
|
157
215
|
}
|
|
158
|
-
function
|
|
159
|
-
const a =
|
|
160
|
-
return a ? a.find((
|
|
216
|
+
function zn(t, i) {
|
|
217
|
+
const a = ze(t);
|
|
218
|
+
return a ? a.find((h) => h.domain === i) ?? a.find((h) => h.default) ?? a[0] : null;
|
|
161
219
|
}
|
|
162
|
-
function
|
|
220
|
+
function Gn(t, i, a) {
|
|
163
221
|
return t ?? {
|
|
164
|
-
url:
|
|
222
|
+
url: i ?? "",
|
|
165
223
|
urlByKey: a,
|
|
166
224
|
resolves: !0
|
|
167
225
|
};
|
|
168
226
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
227
|
+
const Xn = (t) => t instanceof Error ? t.message : String(t);
|
|
228
|
+
function Zn(t) {
|
|
171
229
|
var y;
|
|
172
|
-
const { kind:
|
|
173
|
-
async function
|
|
174
|
-
|
|
230
|
+
const { kind: i, id: a, onError: h } = t, d = qe(i, a, !0), n = jn(i), [c, I] = b(!1), v = ((y = d.data) == null ? void 0 : y.currentPublishedVersion) != null, N = i === "function" ? "fn-publish" : "ep-publish";
|
|
231
|
+
async function m() {
|
|
232
|
+
h(null), I(!0);
|
|
175
233
|
try {
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
|
|
234
|
+
const s = await t.saveFirst();
|
|
235
|
+
if (s.status === "blocked") {
|
|
236
|
+
h(s.reason);
|
|
179
237
|
return;
|
|
180
238
|
}
|
|
181
|
-
if (
|
|
239
|
+
if (s.status === "failed") return;
|
|
182
240
|
await n.mutateAsync(a);
|
|
183
|
-
} catch (
|
|
184
|
-
|
|
241
|
+
} catch (s) {
|
|
242
|
+
h(Xn(s));
|
|
185
243
|
} finally {
|
|
186
244
|
I(!1);
|
|
187
245
|
}
|
|
@@ -190,34 +248,34 @@ function qn(t) {
|
|
|
190
248
|
"button",
|
|
191
249
|
{
|
|
192
250
|
type: "button",
|
|
193
|
-
className: `btn ghost wf-publish${
|
|
251
|
+
className: `btn ghost wf-publish${v ? " active" : ""}`,
|
|
194
252
|
"data-testid": N,
|
|
195
|
-
onClick: () => void
|
|
196
|
-
disabled: t.disabled ||
|
|
197
|
-
title:
|
|
198
|
-
children:
|
|
253
|
+
onClick: () => void m(),
|
|
254
|
+
disabled: t.disabled || c || n.isPending,
|
|
255
|
+
title: v ? "Published — click to publish a new version" : "Never published — click to publish",
|
|
256
|
+
children: c || n.isPending ? "Publishing…" : v ? "● Published" : "Publish"
|
|
199
257
|
}
|
|
200
258
|
);
|
|
201
259
|
}
|
|
202
|
-
function
|
|
203
|
-
const
|
|
260
|
+
function Ge(t) {
|
|
261
|
+
const i = Oe(t.kind), [a, h] = b(null), d = t.slots, n = (d == null ? void 0 : d.backLabel) ?? i.editor.backLabel, c = () => t.onNavigate({ type: "list" });
|
|
204
262
|
return t.notFound ? /* @__PURE__ */ o("div", { children: [
|
|
205
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick:
|
|
263
|
+
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: c, children: n }),
|
|
206
264
|
/* @__PURE__ */ o("div", { className: "card", children: [
|
|
207
|
-
/* @__PURE__ */ e("h3", { children:
|
|
265
|
+
/* @__PURE__ */ e("h3", { children: i.editor.notFoundTitle }),
|
|
208
266
|
/* @__PURE__ */ e("p", { className: "error", children: t.error })
|
|
209
267
|
] })
|
|
210
268
|
] }) : /* @__PURE__ */ o("div", { className: "exec-profile-editor", children: [
|
|
211
|
-
(
|
|
212
|
-
|
|
269
|
+
(d == null ? void 0 : d.header) ?? /* @__PURE__ */ e(
|
|
270
|
+
on,
|
|
213
271
|
{
|
|
214
|
-
onBack:
|
|
272
|
+
onBack: c,
|
|
215
273
|
backLabel: n,
|
|
216
274
|
title: { editable: !1, value: t.title },
|
|
217
275
|
titleAdornment: t.incomplete && /* @__PURE__ */ e("span", { className: "badge status-failed", children: "incomplete" }),
|
|
218
|
-
actions: /* @__PURE__ */ o(
|
|
276
|
+
actions: /* @__PURE__ */ o(D, { children: [
|
|
219
277
|
t.headerActions,
|
|
220
|
-
t.publish && t.kind !== "workflow" && /* @__PURE__ */ e(
|
|
278
|
+
t.publish && t.kind !== "workflow" && /* @__PURE__ */ e(Zn, { kind: t.kind, ...t.publish, onError: h }),
|
|
221
279
|
/* @__PURE__ */ e(
|
|
222
280
|
"button",
|
|
223
281
|
{
|
|
@@ -225,22 +283,22 @@ function Ye(t) {
|
|
|
225
283
|
className: "btn",
|
|
226
284
|
disabled: !t.canSave,
|
|
227
285
|
onClick: t.onSave,
|
|
228
|
-
children: t.isSaving ? "Saving…" :
|
|
286
|
+
children: t.isSaving ? "Saving…" : i.editor.saveLabel
|
|
229
287
|
}
|
|
230
288
|
),
|
|
231
|
-
|
|
289
|
+
d == null ? void 0 : d.headerActions
|
|
232
290
|
] })
|
|
233
291
|
}
|
|
234
292
|
),
|
|
235
293
|
/* @__PURE__ */ o("div", { className: "exec-profile-body w6w-card-stack", children: [
|
|
236
294
|
t.error && /* @__PURE__ */ e("div", { className: "error", children: t.error }),
|
|
237
|
-
a && !(
|
|
295
|
+
a && !(d != null && d.header) && /* @__PURE__ */ e("div", { className: "error", children: a }),
|
|
238
296
|
t.banners,
|
|
239
297
|
t.children
|
|
240
298
|
] })
|
|
241
299
|
] });
|
|
242
300
|
}
|
|
243
|
-
const
|
|
301
|
+
const Fe = {
|
|
244
302
|
function_not_published: "This Function has never been published, so callers outside the editor cannot run it yet. Publish it with the Publish button next to Save.",
|
|
245
303
|
endpoint_not_published: "This Endpoint has never been published, so its public URL will not answer yet. Publish it with the Publish button next to Save.",
|
|
246
304
|
function_disabled: "This Function is disabled. Enable it in Settings, then try again.",
|
|
@@ -249,9 +307,9 @@ const Ie = {
|
|
|
249
307
|
endpoint_incomplete: "This Endpoint has no usable Target yet. Pick what it should dispatch to, then try again."
|
|
250
308
|
};
|
|
251
309
|
function fe(t) {
|
|
252
|
-
return t instanceof
|
|
310
|
+
return t instanceof ye ? Object.hasOwn(Fe, t.code) ? Fe[t.code] : t.message : t instanceof Error ? t.message : String(t);
|
|
253
311
|
}
|
|
254
|
-
const
|
|
312
|
+
const Pe = [
|
|
255
313
|
{
|
|
256
314
|
value: "platform",
|
|
257
315
|
label: "Platform auth (default)",
|
|
@@ -278,9 +336,9 @@ const Fe = [
|
|
|
278
336
|
hint: "A Bearer JWT, verified HS256 against the shared secret below."
|
|
279
337
|
}
|
|
280
338
|
];
|
|
281
|
-
function
|
|
339
|
+
function et(t) {
|
|
282
340
|
var N;
|
|
283
|
-
const { entry:
|
|
341
|
+
const { entry: i, domainOptions: a, urlDomain: h, onUrlDomain: d, urlForm: n, onUrlForm: c } = t, I = i.urlByKey !== void 0 && i.urlByKey !== "", v = n === "key" && i.urlByKey ? i.urlByKey : i.url;
|
|
284
342
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
285
343
|
/* @__PURE__ */ e("h3", { children: "URL" }),
|
|
286
344
|
a && /* @__PURE__ */ o("label", { className: "field", children: [
|
|
@@ -289,40 +347,40 @@ function $n(t) {
|
|
|
289
347
|
"select",
|
|
290
348
|
{
|
|
291
349
|
"data-testid": "url-domain",
|
|
292
|
-
value:
|
|
293
|
-
onChange: (
|
|
294
|
-
children: a.map((
|
|
350
|
+
value: h ?? ((N = a[0]) == null ? void 0 : N.domain),
|
|
351
|
+
onChange: (m) => d(m.target.value),
|
|
352
|
+
children: a.map((m) => /* @__PURE__ */ e("option", { value: m.domain, children: m.domain + (m.default ? " · default" : "") + (m.resolves ? "" : " · not routable yet") }, m.domain))
|
|
295
353
|
}
|
|
296
354
|
)
|
|
297
355
|
] }),
|
|
298
356
|
I && /* @__PURE__ */ e("fieldset", { className: "seg", "aria-label": "URL form", children: [
|
|
299
357
|
["id", "By id", "The stable, host-issued address. Never changes."],
|
|
300
358
|
["key", "By key", "The readable address, built from the account and this key."]
|
|
301
|
-
].map(([
|
|
359
|
+
].map(([m, y, s]) => /* @__PURE__ */ e(
|
|
302
360
|
"button",
|
|
303
361
|
{
|
|
304
362
|
type: "button",
|
|
305
|
-
className: `seg-btn${n ===
|
|
306
|
-
"aria-pressed": n ===
|
|
307
|
-
"data-testid": `url-form-${
|
|
308
|
-
title:
|
|
309
|
-
onClick: () =>
|
|
363
|
+
className: `seg-btn${n === m ? " active" : ""}`,
|
|
364
|
+
"aria-pressed": n === m,
|
|
365
|
+
"data-testid": `url-form-${m}`,
|
|
366
|
+
title: s,
|
|
367
|
+
onClick: () => c(m),
|
|
310
368
|
children: y
|
|
311
369
|
},
|
|
312
|
-
|
|
370
|
+
m
|
|
313
371
|
)) }),
|
|
314
|
-
/* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: /* @__PURE__ */ e(
|
|
372
|
+
/* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: /* @__PURE__ */ e(Ke, { value: v, readOnly: !0, children: /* @__PURE__ */ o("code", { style: { overflowWrap: "anywhere" }, children: [
|
|
315
373
|
/* @__PURE__ */ e("strong", { children: "POST" }),
|
|
316
374
|
" ",
|
|
317
|
-
/* @__PURE__ */ e("span", { "data-testid": "invoke-url", children:
|
|
375
|
+
/* @__PURE__ */ e("span", { "data-testid": "invoke-url", children: v || "…" })
|
|
318
376
|
] }) }) }),
|
|
319
|
-
!
|
|
377
|
+
!i.resolves && /* @__PURE__ */ e("p", { className: "muted small", "data-testid": "url-unroutable", children: "Not routable yet — this domain has no DNS or TLS behind it, so a call to this address will not answer." }),
|
|
320
378
|
/* @__PURE__ */ e("p", { className: "muted small", style: { marginTop: "var(--w6w-sp-2)" }, children: "Send the declared input as a JSON body." })
|
|
321
379
|
] });
|
|
322
380
|
}
|
|
323
|
-
function
|
|
324
|
-
var
|
|
325
|
-
const { security:
|
|
381
|
+
function nt(t) {
|
|
382
|
+
var d;
|
|
383
|
+
const { security: i, onPatch: a } = t, h = i.auth;
|
|
326
384
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
327
385
|
/* @__PURE__ */ e("h3", { children: "Security" }),
|
|
328
386
|
/* @__PURE__ */ o("label", { className: "field", children: [
|
|
@@ -330,39 +388,39 @@ function Hn(t) {
|
|
|
330
388
|
/* @__PURE__ */ e(
|
|
331
389
|
"select",
|
|
332
390
|
{
|
|
333
|
-
value:
|
|
391
|
+
value: h,
|
|
334
392
|
onChange: (n) => a({ auth: n.target.value }),
|
|
335
|
-
children:
|
|
393
|
+
children: Pe.map((n) => /* @__PURE__ */ e("option", { value: n.value, children: n.label }, n.value))
|
|
336
394
|
}
|
|
337
395
|
),
|
|
338
|
-
/* @__PURE__ */ e("span", { className: "hint", children: (
|
|
396
|
+
/* @__PURE__ */ e("span", { className: "hint", children: (d = Pe.find((n) => n.value === h)) == null ? void 0 : d.hint })
|
|
339
397
|
] }),
|
|
340
|
-
|
|
398
|
+
h !== "platform" && /* @__PURE__ */ o("p", { className: "muted small", children: [
|
|
341
399
|
/* @__PURE__ */ e("strong", { children: "Runs as this Endpoint's owner." }),
|
|
342
400
|
" A caller authenticated by the policy above carries no w6w identity, so the target runs with the connections and data of whoever owns this Endpoint."
|
|
343
401
|
] }),
|
|
344
|
-
|
|
402
|
+
h === "basic" && /* @__PURE__ */ o(D, { children: [
|
|
345
403
|
/* @__PURE__ */ o("label", { className: "field", children: [
|
|
346
404
|
/* @__PURE__ */ e("span", { children: "Username" }),
|
|
347
405
|
/* @__PURE__ */ e(
|
|
348
406
|
"input",
|
|
349
407
|
{
|
|
350
408
|
type: "text",
|
|
351
|
-
value:
|
|
409
|
+
value: i.basicUser ?? "",
|
|
352
410
|
onChange: (n) => a({ basicUser: n.target.value })
|
|
353
411
|
}
|
|
354
412
|
)
|
|
355
413
|
] }),
|
|
356
414
|
/* @__PURE__ */ e(
|
|
357
|
-
|
|
415
|
+
be,
|
|
358
416
|
{
|
|
359
417
|
label: "Password",
|
|
360
|
-
value:
|
|
418
|
+
value: i.basicPassword,
|
|
361
419
|
onChange: (n) => a({ basicPassword: n })
|
|
362
420
|
}
|
|
363
421
|
)
|
|
364
422
|
] }),
|
|
365
|
-
|
|
423
|
+
h === "header" && /* @__PURE__ */ o(D, { children: [
|
|
366
424
|
/* @__PURE__ */ o("label", { className: "field", children: [
|
|
367
425
|
/* @__PURE__ */ e("span", { children: "Header name" }),
|
|
368
426
|
/* @__PURE__ */ e(
|
|
@@ -370,70 +428,70 @@ function Hn(t) {
|
|
|
370
428
|
{
|
|
371
429
|
type: "text",
|
|
372
430
|
placeholder: "X-API-Key",
|
|
373
|
-
value:
|
|
431
|
+
value: i.headerName ?? "",
|
|
374
432
|
onChange: (n) => a({ headerName: n.target.value })
|
|
375
433
|
}
|
|
376
434
|
)
|
|
377
435
|
] }),
|
|
378
436
|
/* @__PURE__ */ e(
|
|
379
|
-
|
|
437
|
+
be,
|
|
380
438
|
{
|
|
381
439
|
label: "Header value",
|
|
382
|
-
value:
|
|
440
|
+
value: i.headerValue,
|
|
383
441
|
onChange: (n) => a({ headerValue: n })
|
|
384
442
|
}
|
|
385
443
|
)
|
|
386
444
|
] }),
|
|
387
|
-
|
|
388
|
-
|
|
445
|
+
h === "jwt" && /* @__PURE__ */ e(
|
|
446
|
+
be,
|
|
389
447
|
{
|
|
390
448
|
label: "JWT secret (HS256)",
|
|
391
|
-
value:
|
|
449
|
+
value: i.jwtSecret,
|
|
392
450
|
onChange: (n) => a({ jwtSecret: n })
|
|
393
451
|
}
|
|
394
452
|
)
|
|
395
453
|
] });
|
|
396
454
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
455
|
+
function be(t) {
|
|
456
|
+
const i = t.value === Wn;
|
|
399
457
|
return /* @__PURE__ */ o("label", { className: "field", children: [
|
|
400
458
|
/* @__PURE__ */ e("span", { children: t.label }),
|
|
401
459
|
/* @__PURE__ */ e(
|
|
402
460
|
"input",
|
|
403
461
|
{
|
|
404
462
|
type: "password",
|
|
405
|
-
value:
|
|
406
|
-
placeholder:
|
|
463
|
+
value: i ? "" : t.value ?? "",
|
|
464
|
+
placeholder: i ? "•••••••• (stored — type to replace)" : "",
|
|
407
465
|
onChange: (a) => t.onChange(a.target.value)
|
|
408
466
|
}
|
|
409
467
|
),
|
|
410
|
-
|
|
468
|
+
i && /* @__PURE__ */ e("span", { className: "hint", children: "A secret is stored — type to replace it." })
|
|
411
469
|
] });
|
|
412
470
|
}
|
|
413
|
-
function
|
|
414
|
-
const { id:
|
|
471
|
+
function tt(t) {
|
|
472
|
+
const { id: i, inputs: a } = t, [h, d] = b({}), [n, c] = b(void 0), [I, v] = b(null), [N, m] = b(!1), y = we(), s = Fn(), P = async () => {
|
|
415
473
|
const u = {};
|
|
416
474
|
for (const r of a) {
|
|
417
|
-
const
|
|
418
|
-
|
|
475
|
+
const g = Le(r.type, h[r.key] ?? "");
|
|
476
|
+
g !== void 0 && (u[r.key] = g);
|
|
419
477
|
}
|
|
420
|
-
|
|
478
|
+
m(!0);
|
|
421
479
|
try {
|
|
422
480
|
const r = await t.saveFirst();
|
|
423
481
|
if (r.status === "blocked") {
|
|
424
|
-
|
|
482
|
+
c(void 0), v(r.reason);
|
|
425
483
|
return;
|
|
426
484
|
}
|
|
427
485
|
if (r.status === "failed") {
|
|
428
|
-
|
|
486
|
+
c(void 0), v(fe(r.error));
|
|
429
487
|
return;
|
|
430
488
|
}
|
|
431
|
-
const
|
|
432
|
-
|
|
489
|
+
const g = await s.mutateAsync({ id: i, input: u });
|
|
490
|
+
v(null), c(g);
|
|
433
491
|
} catch (r) {
|
|
434
|
-
|
|
492
|
+
c(void 0), v(fe(r));
|
|
435
493
|
} finally {
|
|
436
|
-
|
|
494
|
+
m(!1), y.invalidateQueries({ queryKey: $e.root });
|
|
437
495
|
}
|
|
438
496
|
};
|
|
439
497
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
@@ -441,7 +499,7 @@ function _n(t) {
|
|
|
441
499
|
/* @__PURE__ */ e("p", { className: "muted small", children: "Dispatches the saved draft to its target — no need to publish first. Unsaved edits are saved first. An Action or Function target returns a value; a Workflow target returns a run id to poll." }),
|
|
442
500
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: "No declared inputs — the payload is passed through." }),
|
|
443
501
|
a.map((u) => {
|
|
444
|
-
const r = `ep-invoke-${
|
|
502
|
+
const r = `ep-invoke-${i}-${u.key || u.label}`;
|
|
445
503
|
return /* @__PURE__ */ o("div", { className: "field", children: [
|
|
446
504
|
/* @__PURE__ */ o("label", { htmlFor: r, children: [
|
|
447
505
|
u.label || u.key,
|
|
@@ -451,8 +509,8 @@ function _n(t) {
|
|
|
451
509
|
"select",
|
|
452
510
|
{
|
|
453
511
|
id: r,
|
|
454
|
-
value:
|
|
455
|
-
onChange: (
|
|
512
|
+
value: h[u.key] ?? "",
|
|
513
|
+
onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value })),
|
|
456
514
|
children: [
|
|
457
515
|
/* @__PURE__ */ e("option", { value: "", children: "—" }),
|
|
458
516
|
/* @__PURE__ */ e("option", { value: "true", children: "true" }),
|
|
@@ -464,9 +522,9 @@ function _n(t) {
|
|
|
464
522
|
{
|
|
465
523
|
id: r,
|
|
466
524
|
type: u.type === "number" ? "number" : "text",
|
|
467
|
-
value:
|
|
525
|
+
value: h[u.key] ?? "",
|
|
468
526
|
placeholder: u.type === "json" ? "{ }" : u.hint ?? "",
|
|
469
|
-
onChange: (
|
|
527
|
+
onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value }))
|
|
470
528
|
}
|
|
471
529
|
)
|
|
472
530
|
] }, u.key || u.label);
|
|
@@ -476,63 +534,63 @@ function _n(t) {
|
|
|
476
534
|
{
|
|
477
535
|
type: "button",
|
|
478
536
|
className: "btn",
|
|
479
|
-
disabled: N ||
|
|
537
|
+
disabled: N || s.isPending,
|
|
480
538
|
onClick: () => void P(),
|
|
481
|
-
children: N ||
|
|
539
|
+
children: N || s.isPending ? "Invoking…" : "Invoke"
|
|
482
540
|
}
|
|
483
541
|
) }),
|
|
484
542
|
I && /* @__PURE__ */ e("div", { className: "result error", children: I }),
|
|
485
543
|
n !== void 0 && /* @__PURE__ */ e("pre", { className: "result", style: { overflow: "auto" }, children: JSON.stringify(n, null, 2) })
|
|
486
544
|
] });
|
|
487
545
|
}
|
|
488
|
-
function
|
|
489
|
-
const { rows:
|
|
546
|
+
function Xe(t) {
|
|
547
|
+
const { rows: i, onChange: a, title: h, description: d, emptyMeansPassthrough: n, uncoveredKeys: c } = t;
|
|
490
548
|
function I() {
|
|
491
|
-
a([...
|
|
549
|
+
a([...i, { key: "", label: "", type: "string" }]);
|
|
492
550
|
}
|
|
493
|
-
function
|
|
494
|
-
a(
|
|
551
|
+
function v(m, y) {
|
|
552
|
+
a(i.map((s, P) => P === m ? { ...s, ...y } : s));
|
|
495
553
|
}
|
|
496
|
-
function N(
|
|
497
|
-
a(
|
|
554
|
+
function N(m) {
|
|
555
|
+
a(i.filter((y, s) => s !== m));
|
|
498
556
|
}
|
|
499
557
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
500
558
|
/* @__PURE__ */ o("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
|
|
501
|
-
/* @__PURE__ */ e("h3", { children:
|
|
559
|
+
/* @__PURE__ */ e("h3", { children: h }),
|
|
502
560
|
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: I, children: "+ Add input" })
|
|
503
561
|
] }),
|
|
504
|
-
/* @__PURE__ */ e("p", { className: "muted small", children:
|
|
505
|
-
|
|
506
|
-
/* @__PURE__ */ e("ul", { className: "list", "data-testid": "input-list", children:
|
|
562
|
+
/* @__PURE__ */ e("p", { className: "muted small", children: d }),
|
|
563
|
+
i.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: n ? "No inputs — payload is passed through." : "No inputs yet." }),
|
|
564
|
+
/* @__PURE__ */ e("ul", { className: "list", "data-testid": "input-list", children: i.map((m, y) => (
|
|
507
565
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and reorderable
|
|
508
566
|
/* @__PURE__ */ o("li", { style: { alignItems: "center", gap: 8 }, children: [
|
|
509
567
|
/* @__PURE__ */ e(
|
|
510
568
|
"input",
|
|
511
569
|
{
|
|
512
570
|
type: "text",
|
|
513
|
-
value:
|
|
571
|
+
value: m.key,
|
|
514
572
|
placeholder: "key",
|
|
515
573
|
"aria-label": "Input key",
|
|
516
|
-
onChange: (
|
|
574
|
+
onChange: (s) => v(y, { key: s.target.value })
|
|
517
575
|
}
|
|
518
576
|
),
|
|
519
577
|
/* @__PURE__ */ e(
|
|
520
578
|
"input",
|
|
521
579
|
{
|
|
522
580
|
type: "text",
|
|
523
|
-
value:
|
|
581
|
+
value: m.label,
|
|
524
582
|
placeholder: "Label",
|
|
525
583
|
"aria-label": "Input label",
|
|
526
|
-
onChange: (
|
|
584
|
+
onChange: (s) => v(y, { label: s.target.value })
|
|
527
585
|
}
|
|
528
586
|
),
|
|
529
587
|
/* @__PURE__ */ e(
|
|
530
588
|
"select",
|
|
531
589
|
{
|
|
532
|
-
value:
|
|
590
|
+
value: m.type,
|
|
533
591
|
"aria-label": "Input type",
|
|
534
|
-
onChange: (
|
|
535
|
-
children:
|
|
592
|
+
onChange: (s) => v(y, { type: s.target.value }),
|
|
593
|
+
children: Dn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
|
|
536
594
|
}
|
|
537
595
|
),
|
|
538
596
|
/* @__PURE__ */ o("label", { className: "row", style: { gap: 4, alignItems: "center" }, children: [
|
|
@@ -540,133 +598,133 @@ function ze(t) {
|
|
|
540
598
|
"input",
|
|
541
599
|
{
|
|
542
600
|
type: "checkbox",
|
|
543
|
-
checked:
|
|
544
|
-
onChange: (
|
|
601
|
+
checked: m.required ?? !1,
|
|
602
|
+
onChange: (s) => v(y, { required: s.target.checked })
|
|
545
603
|
}
|
|
546
604
|
),
|
|
547
605
|
/* @__PURE__ */ e("span", { className: "muted small", children: "required" })
|
|
548
606
|
] }),
|
|
549
607
|
/* @__PURE__ */ e(
|
|
550
|
-
|
|
608
|
+
pe,
|
|
551
609
|
{
|
|
552
610
|
danger: !0,
|
|
553
611
|
icon: "close",
|
|
554
|
-
label: `Remove input ${
|
|
612
|
+
label: `Remove input ${m.key || y + 1}`,
|
|
555
613
|
onClick: () => N(y)
|
|
556
614
|
}
|
|
557
615
|
)
|
|
558
616
|
] }, y)
|
|
559
617
|
)) }),
|
|
560
|
-
|
|
618
|
+
c && c.length > 0 && /* @__PURE__ */ o("p", { className: "muted small", "data-testid": "input-uncovered", children: [
|
|
561
619
|
"Missing required field",
|
|
562
|
-
|
|
620
|
+
c.length > 1 ? "s" : "",
|
|
563
621
|
" for the current target:",
|
|
564
622
|
" ",
|
|
565
|
-
|
|
623
|
+
c.join(", ")
|
|
566
624
|
] })
|
|
567
625
|
] });
|
|
568
626
|
}
|
|
569
|
-
const
|
|
627
|
+
const at = ["action", "function", "workflow", "endpoint"], it = {
|
|
570
628
|
action: "Action (synchronous)",
|
|
571
629
|
function: "Function (synchronous)",
|
|
572
630
|
workflow: "Workflow (asynchronous)",
|
|
573
631
|
endpoint: "Endpoint (dispatches to another Endpoint)"
|
|
574
632
|
};
|
|
575
|
-
function
|
|
633
|
+
function Ze(t) {
|
|
576
634
|
var F;
|
|
577
|
-
const { kind:
|
|
578
|
-
[{ id: "target", uses:
|
|
579
|
-
() => y ? { state: "ready", ids:
|
|
580
|
-
).length, u =
|
|
635
|
+
const { kind: i, id: a, uses: h, dirty: d } = t, n = (h == null ? void 0 : h.app) ?? "", c = (h == null ? void 0 : h.connection) ?? "", I = we(), v = _e(n, n !== ""), N = (F = qe(i, a, !0).data) == null ? void 0 : F.enabled, m = Mn(i), y = v.isSuccess && !v.isFetching, s = L(() => new Set((v.data ?? []).map((k) => k.id)), [v.data]), P = He(
|
|
636
|
+
[{ id: "target", uses: h }],
|
|
637
|
+
() => y ? { state: "ready", ids: s } : void 0
|
|
638
|
+
).length, u = _({ id: a, had: !1 });
|
|
581
639
|
u.current.id !== a && (u.current = { id: a, had: !1 }), P > 0 && (u.current.had = !0);
|
|
582
|
-
const r =
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
r.current =
|
|
586
|
-
}, [n,
|
|
587
|
-
const
|
|
640
|
+
const r = _(null);
|
|
641
|
+
se(() => {
|
|
642
|
+
const k = `${n}|${c}`, B = r.current;
|
|
643
|
+
r.current = k, B !== null && B !== k && y && c && !s.has(c) && I.invalidateQueries({ queryKey: Un(n) });
|
|
644
|
+
}, [n, c, y, s, I]);
|
|
645
|
+
const g = Qn({
|
|
588
646
|
enabled: N,
|
|
589
647
|
problemCount: P,
|
|
590
|
-
dirty:
|
|
648
|
+
dirty: d,
|
|
591
649
|
hadProblems: u.current.had
|
|
592
650
|
});
|
|
593
|
-
return
|
|
594
|
-
|
|
651
|
+
return g.show ? /* @__PURE__ */ e(
|
|
652
|
+
rn,
|
|
595
653
|
{
|
|
596
|
-
kind:
|
|
597
|
-
problemCount:
|
|
598
|
-
canEnable:
|
|
599
|
-
pending:
|
|
600
|
-
onEnable: () =>
|
|
654
|
+
kind: i,
|
|
655
|
+
problemCount: g.problemCount,
|
|
656
|
+
canEnable: g.canEnable,
|
|
657
|
+
pending: m.isPending,
|
|
658
|
+
onEnable: () => m.mutate({ id: a, enabled: !0 })
|
|
601
659
|
}
|
|
602
660
|
) : null;
|
|
603
661
|
}
|
|
604
|
-
function
|
|
605
|
-
var
|
|
662
|
+
function en(t) {
|
|
663
|
+
var G, q, le;
|
|
606
664
|
const {
|
|
607
|
-
allowedKinds:
|
|
665
|
+
allowedKinds: i,
|
|
608
666
|
excludeCallableIds: a,
|
|
609
|
-
value:
|
|
610
|
-
onChange:
|
|
667
|
+
value: h,
|
|
668
|
+
onChange: d,
|
|
611
669
|
onResolved: n,
|
|
612
|
-
title:
|
|
670
|
+
title: c,
|
|
613
671
|
description: I,
|
|
614
|
-
passthroughHint:
|
|
615
|
-
} = t, [N,
|
|
672
|
+
passthroughHint: v
|
|
673
|
+
} = t, [N, m] = b(!1), y = h, s = y.kind, P = (l) => i.includes(l);
|
|
616
674
|
function u(l) {
|
|
617
|
-
|
|
675
|
+
d(l);
|
|
618
676
|
}
|
|
619
|
-
const r = y.kind === "action" ? y : void 0,
|
|
620
|
-
|
|
677
|
+
const r = y.kind === "action" ? y : void 0, g = (r == null ? void 0 : r.uses.app) ?? "", F = (r == null ? void 0 : r.uses.action) ?? "", k = Kn(y), B = qn(g), [W, V] = b(null);
|
|
678
|
+
se(() => {
|
|
621
679
|
let l = !1;
|
|
622
680
|
return import("@w6w/ui/flow").then((E) => {
|
|
623
|
-
l ||
|
|
681
|
+
l || V({ isTriggerApp: E.isTriggerApp, asFieldDefs: E.asFieldDefs });
|
|
624
682
|
}), () => {
|
|
625
683
|
l = !0;
|
|
626
684
|
};
|
|
627
685
|
}, []);
|
|
628
|
-
const Q =
|
|
686
|
+
const Q = wn(g, g !== ""), K = _e(g, g !== ""), oe = He(
|
|
629
687
|
[{ id: "target", uses: r == null ? void 0 : r.uses }],
|
|
630
|
-
() =>
|
|
688
|
+
() => K.isSuccess && !K.isFetching ? { state: "ready", ids: new Set((K.data ?? []).map((l) => l.id)) } : void 0
|
|
631
689
|
).length > 0, R = L(
|
|
632
690
|
() => (Q.data ?? []).find((l) => l.key === F),
|
|
633
691
|
[Q.data, F]
|
|
634
|
-
), $ = ["function", "workflow"].filter(P),
|
|
635
|
-
var l, E,
|
|
636
|
-
return
|
|
637
|
-
(E =
|
|
692
|
+
), $ = ["function", "workflow"].filter(P), re = `Choose ${c.charAt(0).toLowerCase()}${c.slice(1)}`, S = Pn(P("function")), f = Jn(void 0, P("workflow")), x = Bn(P("endpoint")), Y = je(k, s === "function" && k !== ""), z = Ln(k, s === "workflow" && k !== ""), Z = Me(k, s === "endpoint" && k !== ""), O = L(() => {
|
|
693
|
+
var l, E, w;
|
|
694
|
+
return s === "action" ? ve((R == null ? void 0 : R.params) ?? []) : s === "function" ? ve(((l = Y.data) == null ? void 0 : l.inputs) ?? []) : s === "workflow" ? W ? Tn(
|
|
695
|
+
(E = z.data) == null ? void 0 : E.workflow,
|
|
638
696
|
W
|
|
639
|
-
) : [] :
|
|
697
|
+
) : [] : s === "endpoint" ? ve(((w = Z.data) == null ? void 0 : w.endpoint.input) ?? []) : [];
|
|
640
698
|
}, [
|
|
641
|
-
|
|
699
|
+
s,
|
|
642
700
|
R,
|
|
643
|
-
V.data,
|
|
644
701
|
Y.data,
|
|
702
|
+
z.data,
|
|
645
703
|
Z.data,
|
|
646
704
|
W
|
|
647
705
|
]);
|
|
648
|
-
|
|
649
|
-
n == null || n({ meta: { kind:
|
|
650
|
-
}, [
|
|
651
|
-
function
|
|
652
|
-
if (l.uses.app ===
|
|
653
|
-
const
|
|
706
|
+
se(() => {
|
|
707
|
+
n == null || n({ meta: { kind: s, ref: s === "action" ? g : k }, kind: s, fields: O });
|
|
708
|
+
}, [s, g, k, O, n]);
|
|
709
|
+
function X(l) {
|
|
710
|
+
if (l.uses.app === Nn) {
|
|
711
|
+
const T = l.with ?? {}, M = T.targetKind === "workflow" ? "workflow" : "function", p = typeof T.targetId == "string" ? T.targetId : "";
|
|
654
712
|
if (!p) return;
|
|
655
713
|
u(
|
|
656
714
|
M === "workflow" ? { kind: "workflow", workflow: p } : { kind: "function", function: p }
|
|
657
|
-
),
|
|
715
|
+
), m(!1);
|
|
658
716
|
return;
|
|
659
717
|
}
|
|
660
718
|
if (l.uses.app.startsWith("@w6w/")) return;
|
|
661
|
-
const E = y.kind === "action" ? y.with ?? {} : {},
|
|
662
|
-
for (const
|
|
663
|
-
J[
|
|
664
|
-
u({ kind: "action", uses: l.uses, with: J }),
|
|
719
|
+
const E = y.kind === "action" ? y.with ?? {} : {}, w = l.with ?? {}, J = {};
|
|
720
|
+
for (const T of Object.keys(w))
|
|
721
|
+
J[T] = T in E ? E[T] : w[T];
|
|
722
|
+
u({ kind: "action", uses: l.uses, with: J }), m(!1);
|
|
665
723
|
}
|
|
666
724
|
function U(l, E) {
|
|
667
725
|
if (y.kind !== "action") return;
|
|
668
|
-
const
|
|
669
|
-
E === "" || E === void 0 ? delete
|
|
726
|
+
const w = { ...y.with ?? {} };
|
|
727
|
+
E === "" || E === void 0 ? delete w[l] : w[l] = E, u({ ...y, with: w });
|
|
670
728
|
}
|
|
671
729
|
function ee(l) {
|
|
672
730
|
u(
|
|
@@ -675,58 +733,58 @@ function Xe(t) {
|
|
|
675
733
|
}
|
|
676
734
|
function ne(l) {
|
|
677
735
|
u(
|
|
678
|
-
|
|
736
|
+
s === "function" ? { kind: "function", function: l } : s === "workflow" ? { kind: "workflow", workflow: l } : { kind: "endpoint", endpoint: l }
|
|
679
737
|
);
|
|
680
738
|
}
|
|
681
739
|
const te = L(() => {
|
|
682
740
|
var l, E;
|
|
683
|
-
if (
|
|
684
|
-
if (
|
|
685
|
-
const
|
|
686
|
-
return
|
|
741
|
+
if (k) {
|
|
742
|
+
if (s === "function") {
|
|
743
|
+
const w = (l = S.data) == null ? void 0 : l.find((J) => J.id === k);
|
|
744
|
+
return w ? w.displayName || w.key : void 0;
|
|
687
745
|
}
|
|
688
|
-
if (
|
|
689
|
-
const
|
|
690
|
-
return
|
|
746
|
+
if (s === "workflow") {
|
|
747
|
+
const w = (E = f.data) == null ? void 0 : E.find((J) => J.id === k);
|
|
748
|
+
return w ? w.displayName || w.name : void 0;
|
|
691
749
|
}
|
|
692
750
|
}
|
|
693
|
-
}, [
|
|
751
|
+
}, [s, k, S.data, f.data]), ae = L(() => {
|
|
694
752
|
const l = (R == null ? void 0 : R.params) ?? [], E = (r == null ? void 0 : r.with) ?? {};
|
|
695
|
-
return l.filter((
|
|
696
|
-
if (
|
|
697
|
-
const { field:
|
|
753
|
+
return l.filter((w) => {
|
|
754
|
+
if (w.showIf) {
|
|
755
|
+
const { field: T, equals: M, in: p, notIn: A, truthy: ue } = w.showIf, ie = E[T];
|
|
698
756
|
if (M !== void 0 && ie !== M || p !== void 0 && !p.includes(ie) || A != null && A.includes(ie) || ue !== void 0 && !!ie !== ue) return !1;
|
|
699
757
|
}
|
|
700
|
-
const J =
|
|
701
|
-
return
|
|
758
|
+
const J = w.key in E && E[w.key] !== "" && E[w.key] !== void 0;
|
|
759
|
+
return w.required || J;
|
|
702
760
|
});
|
|
703
761
|
}, [R, r == null ? void 0 : r.with]);
|
|
704
762
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
705
|
-
/* @__PURE__ */ e("h3", { children:
|
|
763
|
+
/* @__PURE__ */ e("h3", { children: c }),
|
|
706
764
|
/* @__PURE__ */ e("p", { className: "muted small", children: I }),
|
|
707
|
-
|
|
765
|
+
i.length > 1 && /* @__PURE__ */ o("label", { className: "field", children: [
|
|
708
766
|
/* @__PURE__ */ e("span", { children: "Kind" }),
|
|
709
|
-
/* @__PURE__ */ e("select", { value:
|
|
767
|
+
/* @__PURE__ */ e("select", { value: s, onChange: (l) => ee(l.target.value), children: at.filter(P).map((l) => /* @__PURE__ */ e("option", { value: l, children: it[l] }, l)) })
|
|
710
768
|
] }),
|
|
711
|
-
|
|
712
|
-
|
|
769
|
+
s === "action" && /* @__PURE__ */ o(D, { children: [
|
|
770
|
+
g && F ? /* @__PURE__ */ o("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
|
|
713
771
|
/* @__PURE__ */ e(
|
|
714
|
-
|
|
772
|
+
un,
|
|
715
773
|
{
|
|
716
774
|
src: B == null ? void 0 : B.iconSvg,
|
|
717
775
|
srcDark: B == null ? void 0 : B.iconSvgDark,
|
|
718
776
|
brandColor: B == null ? void 0 : B.brandColor,
|
|
719
|
-
name:
|
|
777
|
+
name: g
|
|
720
778
|
}
|
|
721
779
|
),
|
|
722
780
|
/* @__PURE__ */ o("span", { className: "list-main", children: [
|
|
723
781
|
/* @__PURE__ */ e("strong", { children: (R == null ? void 0 : R.title) ?? F }),
|
|
724
782
|
" ",
|
|
725
|
-
/* @__PURE__ */ e("code", { className: "muted", children:
|
|
726
|
-
/* @__PURE__ */ e("span", { className: "muted small block", children:
|
|
783
|
+
/* @__PURE__ */ e("code", { className: "muted", children: g }),
|
|
784
|
+
/* @__PURE__ */ e("span", { className: "muted small block", children: oe ? /* @__PURE__ */ e("span", { className: "error", "data-testid": "binding-missing", children: "Missing connection — choose another" }) : r != null && r.uses.connection ? `via ${((q = (G = K.data) == null ? void 0 : G.find((l) => l.id === r.uses.connection)) == null ? void 0 : q.displayName) ?? r.uses.connection}` : "no connection" })
|
|
727
785
|
] }),
|
|
728
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () =>
|
|
729
|
-
] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () =>
|
|
786
|
+
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
|
|
787
|
+
] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () => m(!0), children: "+ Choose an action" }),
|
|
730
788
|
F && /* @__PURE__ */ o("div", { style: { marginTop: 12 }, children: [
|
|
731
789
|
/* @__PURE__ */ e("h4", { children: "Input mapping" }),
|
|
732
790
|
/* @__PURE__ */ o("p", { className: "muted small", children: [
|
|
@@ -734,7 +792,7 @@ function Xe(t) {
|
|
|
734
792
|
" ",
|
|
735
793
|
/* @__PURE__ */ e("code", { children: "inputs.<key>" }),
|
|
736
794
|
"; anything else is a literal.",
|
|
737
|
-
|
|
795
|
+
v && " Leave every cell blank to pass the inbound payload through as the action's params."
|
|
738
796
|
] }),
|
|
739
797
|
ae.length === 0 ? /* @__PURE__ */ e("p", { className: "muted small", children: "This action declares no params." }) : /* @__PURE__ */ e("ul", { className: "list", children: ae.map((l) => {
|
|
740
798
|
var E;
|
|
@@ -744,10 +802,10 @@ function Xe(t) {
|
|
|
744
802
|
l.required && /* @__PURE__ */ e("span", { className: "muted small", children: " · required" })
|
|
745
803
|
] }),
|
|
746
804
|
/* @__PURE__ */ e("div", { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
747
|
-
|
|
805
|
+
hn,
|
|
748
806
|
{
|
|
749
807
|
value: (E = r == null ? void 0 : r.with) == null ? void 0 : E[l.key],
|
|
750
|
-
onChange: (
|
|
808
|
+
onChange: (w) => U(l.key, w),
|
|
751
809
|
placeholder: `inputs.${l.key}`,
|
|
752
810
|
"aria-label": `Mapping for ${l.key}`
|
|
753
811
|
}
|
|
@@ -756,17 +814,17 @@ function Xe(t) {
|
|
|
756
814
|
}) })
|
|
757
815
|
] })
|
|
758
816
|
] }),
|
|
759
|
-
(
|
|
817
|
+
(s === "function" || s === "workflow") && /* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: k ? /* @__PURE__ */ o(D, { children: [
|
|
760
818
|
/* @__PURE__ */ o("span", { className: "list-main", children: [
|
|
761
|
-
/* @__PURE__ */ e("strong", { children: te ??
|
|
819
|
+
/* @__PURE__ */ e("strong", { children: te ?? k }),
|
|
762
820
|
" ",
|
|
763
|
-
/* @__PURE__ */ e("code", { className: "muted", children:
|
|
764
|
-
/* @__PURE__ */ e("span", { className: "muted small block", children:
|
|
821
|
+
/* @__PURE__ */ e("code", { className: "muted", children: k }),
|
|
822
|
+
/* @__PURE__ */ e("span", { className: "muted small block", children: s === "function" ? "Function (synchronous)" : "Workflow (asynchronous)" })
|
|
765
823
|
] }),
|
|
766
|
-
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () =>
|
|
767
|
-
] }) : /* @__PURE__ */ o("button", { type: "button", className: "btn", onClick: () =>
|
|
824
|
+
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
|
|
825
|
+
] }) : /* @__PURE__ */ o("button", { type: "button", className: "btn", onClick: () => m(!0), children: [
|
|
768
826
|
"+ Choose a ",
|
|
769
|
-
|
|
827
|
+
s
|
|
770
828
|
] }) }),
|
|
771
829
|
N && /* No provider here. The scope this modal needs is INHERITED from
|
|
772
830
|
the page (which contributes its `inputs`) over the app shell
|
|
@@ -780,26 +838,26 @@ function Xe(t) {
|
|
|
780
838
|
kind this card allows, so which arm is showing decides only which
|
|
781
839
|
tab it OPENS on, never whether it renders. */
|
|
782
840
|
/* @__PURE__ */ e(
|
|
783
|
-
|
|
841
|
+
mn,
|
|
784
842
|
{
|
|
785
843
|
appsOnly: !0,
|
|
786
844
|
callables: $,
|
|
787
845
|
excludeCallableIds: a,
|
|
788
|
-
initialTab:
|
|
789
|
-
title:
|
|
790
|
-
onClose: () =>
|
|
791
|
-
onAdd:
|
|
792
|
-
initialApp: r &&
|
|
846
|
+
initialTab: s === "function" || s === "workflow" ? `${s}s` : "connected",
|
|
847
|
+
title: re,
|
|
848
|
+
onClose: () => m(!1),
|
|
849
|
+
onAdd: X,
|
|
850
|
+
initialApp: r && g ? B : void 0,
|
|
793
851
|
initialAction: r ? F : void 0,
|
|
794
852
|
initialConnection: (r == null ? void 0 : r.uses.connection) ?? void 0,
|
|
795
853
|
initialWith: r == null ? void 0 : r.with
|
|
796
854
|
}
|
|
797
855
|
),
|
|
798
|
-
|
|
856
|
+
s === "endpoint" && /* @__PURE__ */ o("label", { className: "field", children: [
|
|
799
857
|
/* @__PURE__ */ e("span", { children: "Endpoint" }),
|
|
800
|
-
/* @__PURE__ */ o("select", { value:
|
|
858
|
+
/* @__PURE__ */ o("select", { value: k, onChange: (l) => ne(l.target.value), children: [
|
|
801
859
|
/* @__PURE__ */ e("option", { value: "", children: "— pick an endpoint —" }),
|
|
802
|
-
(
|
|
860
|
+
(le = x.data) == null ? void 0 : le.map((l) => /* @__PURE__ */ o("option", { value: l.id, children: [
|
|
803
861
|
l.displayName || l.key,
|
|
804
862
|
" (",
|
|
805
863
|
l.id,
|
|
@@ -809,13 +867,13 @@ function Xe(t) {
|
|
|
809
867
|
] })
|
|
810
868
|
] });
|
|
811
869
|
}
|
|
812
|
-
const
|
|
870
|
+
const st = () => {
|
|
813
871
|
};
|
|
814
|
-
function
|
|
815
|
-
return t instanceof
|
|
872
|
+
function de(t) {
|
|
873
|
+
return t instanceof ye || t instanceof Error ? t.message : String(t);
|
|
816
874
|
}
|
|
817
|
-
function
|
|
818
|
-
const { endpointId:
|
|
875
|
+
function jt(t) {
|
|
876
|
+
const { endpointId: i, onNavigate: a = st, slots: h, tools: d } = t, n = ke(t.project), c = he(
|
|
819
877
|
(I) => a(I),
|
|
820
878
|
[a]
|
|
821
879
|
);
|
|
@@ -825,146 +883,146 @@ function It(t) {
|
|
|
825
883
|
className: "w6w-embed-root",
|
|
826
884
|
style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
|
|
827
885
|
children: /* @__PURE__ */ e(
|
|
828
|
-
|
|
886
|
+
Re,
|
|
829
887
|
{
|
|
830
888
|
project: n,
|
|
831
|
-
onNavigate:
|
|
889
|
+
onNavigate: c,
|
|
832
890
|
rail: t.rail,
|
|
833
|
-
tools:
|
|
891
|
+
tools: d,
|
|
834
892
|
storageKey: n === null ? null : `w6w.rail.embed.${n}`,
|
|
835
893
|
children: /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(
|
|
836
|
-
|
|
894
|
+
ot,
|
|
837
895
|
{
|
|
838
|
-
id:
|
|
896
|
+
id: i,
|
|
839
897
|
onNavigate: a,
|
|
840
|
-
slots:
|
|
898
|
+
slots: h
|
|
841
899
|
},
|
|
842
|
-
|
|
900
|
+
i
|
|
843
901
|
) })
|
|
844
902
|
}
|
|
845
903
|
)
|
|
846
904
|
}
|
|
847
905
|
);
|
|
848
906
|
}
|
|
849
|
-
function
|
|
907
|
+
function ot(t) {
|
|
850
908
|
var Ne;
|
|
851
|
-
const { id:
|
|
852
|
-
|
|
853
|
-
const N =
|
|
854
|
-
const H =
|
|
909
|
+
const { id: i, onNavigate: a, slots: h } = t, d = Oe("endpoint"), n = Me(i).data, [c, I] = b([]), v = _(c);
|
|
910
|
+
v.current = c;
|
|
911
|
+
const N = _(!1), m = _(!1), [y, s] = b("id"), [P, u] = b(null), [r, g] = b(!1), [F, k] = b(!1), [B, W] = b(!1), [V, Q] = b(""), [K, oe] = b({ id: i, key: "" }), [R, $] = b(null), re = he((C) => {
|
|
912
|
+
const H = ce(C), j = Ee({
|
|
855
913
|
target: H.target,
|
|
856
914
|
rows: H.input ?? [],
|
|
857
|
-
fields:
|
|
915
|
+
fields: v.current
|
|
858
916
|
});
|
|
859
917
|
return j.length > 0 ? `The target needs: ${j.join(", ")}` : null;
|
|
860
|
-
}, []), S =
|
|
861
|
-
() => S.definition ?
|
|
918
|
+
}, []), S = Cn({ id: i, saveGuard: re }), f = L(
|
|
919
|
+
() => S.definition ? ce(S.definition) : null,
|
|
862
920
|
[S.definition]
|
|
863
|
-
),
|
|
921
|
+
), x = (f == null ? void 0 : f.input) ?? [], Y = Ze({
|
|
864
922
|
kind: "endpoint",
|
|
865
|
-
id:
|
|
923
|
+
id: i,
|
|
866
924
|
uses: (f == null ? void 0 : f.target.kind) === "action" ? f.target.uses : void 0,
|
|
867
925
|
dirty: S.dirty
|
|
868
|
-
}),
|
|
926
|
+
}), z = ((Ne = f == null ? void 0 : f.exposure) == null ? void 0 : Ne.security) ?? {
|
|
869
927
|
auth: "platform"
|
|
870
|
-
}, Z =
|
|
871
|
-
|
|
928
|
+
}, Z = ze(n == null ? void 0 : n.invokeUrls), O = zn(n == null ? void 0 : n.invokeUrls, P);
|
|
929
|
+
Ae({
|
|
872
930
|
kind: "endpoint",
|
|
873
|
-
id:
|
|
931
|
+
id: i,
|
|
874
932
|
label: (f == null ? void 0 : f.displayName) || void 0,
|
|
875
933
|
key: (f == null ? void 0 : f.key.trim()) || void 0,
|
|
876
934
|
invokeUrl: O ? O.url : n == null ? void 0 : n.invokeUrl,
|
|
877
935
|
invokeUrlByKey: O ? O.urlByKey : n == null ? void 0 : n.invokeUrlByKey,
|
|
878
936
|
urlForm: y,
|
|
879
|
-
inputs:
|
|
937
|
+
inputs: c.map((C) => C.key),
|
|
880
938
|
policy: S.policy,
|
|
881
939
|
onPolicyChange: S.onPolicyChange
|
|
882
940
|
});
|
|
883
|
-
const { setDefinition:
|
|
941
|
+
const { setDefinition: X } = S, U = he(
|
|
884
942
|
(C) => {
|
|
885
|
-
|
|
886
|
-
...
|
|
943
|
+
k(!1), X((H) => ({
|
|
944
|
+
...ce(H),
|
|
887
945
|
...C
|
|
888
946
|
}));
|
|
889
947
|
},
|
|
890
|
-
[
|
|
948
|
+
[X]
|
|
891
949
|
), ee = (C) => {
|
|
892
|
-
|
|
950
|
+
k(!1), X((H) => {
|
|
893
951
|
var Ce;
|
|
894
|
-
const j =
|
|
952
|
+
const j = ce(H), nn = {
|
|
895
953
|
...((Ce = j.exposure) == null ? void 0 : Ce.security) ?? { auth: "platform" },
|
|
896
954
|
...C
|
|
897
955
|
};
|
|
898
|
-
return { ...j, exposure: { ...j.exposure, security:
|
|
956
|
+
return { ...j, exposure: { ...j.exposure, security: nn } };
|
|
899
957
|
});
|
|
900
958
|
};
|
|
901
959
|
function ne(C) {
|
|
902
960
|
N.current = !0, U({ target: C });
|
|
903
961
|
}
|
|
904
|
-
|
|
962
|
+
se(() => {
|
|
905
963
|
if (N.current) {
|
|
906
|
-
if (!
|
|
964
|
+
if (!We({ rows: x, touched: m.current })) {
|
|
907
965
|
N.current = !1;
|
|
908
966
|
return;
|
|
909
967
|
}
|
|
910
|
-
|
|
968
|
+
c.length !== 0 && (U({ input: Qe(x, c) }), N.current = !1);
|
|
911
969
|
}
|
|
912
|
-
}, [
|
|
970
|
+
}, [c]);
|
|
913
971
|
const te = L(
|
|
914
|
-
() => ({ inputs:
|
|
915
|
-
[
|
|
972
|
+
() => ({ inputs: x.map((C) => C.key).filter(Boolean) }),
|
|
973
|
+
[x]
|
|
916
974
|
), ae = L(
|
|
917
|
-
() =>
|
|
918
|
-
[
|
|
919
|
-
),
|
|
920
|
-
() => f ?
|
|
975
|
+
() => Ue(x, c),
|
|
976
|
+
[x, c]
|
|
977
|
+
), G = L(
|
|
978
|
+
() => f ? Ee({
|
|
921
979
|
target: f.target,
|
|
922
|
-
rows:
|
|
923
|
-
fields:
|
|
980
|
+
rows: x,
|
|
981
|
+
fields: c
|
|
924
982
|
}) : [],
|
|
925
|
-
[f,
|
|
926
|
-
), q = f &&
|
|
983
|
+
[f, x, c]
|
|
984
|
+
), q = f && G.length > 0 ? /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
|
|
927
985
|
"Can’t save yet — the target needs",
|
|
928
986
|
" ",
|
|
929
987
|
f.target.kind === "action" ? "these required params mapped under Input mapping" : "these required keys declared under Input",
|
|
930
988
|
": ",
|
|
931
|
-
/* @__PURE__ */ e("strong", { children:
|
|
932
|
-
] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") &&
|
|
989
|
+
/* @__PURE__ */ e("strong", { children: G.join(", ") })
|
|
990
|
+
] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") && G.length === 0 && S.canSave;
|
|
933
991
|
async function E() {
|
|
934
992
|
if (!f) return;
|
|
935
|
-
const C = await S.commit(
|
|
936
|
-
|
|
993
|
+
const C = await S.commit(ge(f));
|
|
994
|
+
k(C.status === "saved" || C.status === "clean");
|
|
937
995
|
}
|
|
938
|
-
async function
|
|
939
|
-
return !f || !S.dirty ? { status: "clean" } : l ? S.commit(
|
|
996
|
+
async function w() {
|
|
997
|
+
return !f || !S.dirty ? { status: "clean" } : l ? S.commit(ge(f)) : {
|
|
940
998
|
status: "blocked",
|
|
941
999
|
reason: "Fix the highlighted problems, then save, to test this Endpoint."
|
|
942
1000
|
};
|
|
943
1001
|
}
|
|
944
1002
|
function J() {
|
|
945
1003
|
if (!f) return;
|
|
946
|
-
const C =
|
|
947
|
-
Q(JSON.stringify(C, null, 2)),
|
|
1004
|
+
const C = ge(f);
|
|
1005
|
+
Q(JSON.stringify(C, null, 2)), oe({ id: String(C.id), key: String(C.key) }), $(null), W(!0);
|
|
948
1006
|
}
|
|
949
|
-
async function
|
|
950
|
-
const C = me(
|
|
1007
|
+
async function T() {
|
|
1008
|
+
const C = me(V, K), H = C.parsed;
|
|
951
1009
|
if (!H || C.blockedReason) return;
|
|
952
1010
|
const j = await S.commit(H);
|
|
953
|
-
j.status === "saved" || j.status === "clean" ? ($(null), W(!1),
|
|
1011
|
+
j.status === "saved" || j.status === "clean" ? ($(null), W(!1), k(j.status === "saved" || j.status === "clean")) : j.status === "failed" ? $(de(j.error)) : $(j.reason);
|
|
954
1012
|
}
|
|
955
|
-
const M = S.loadError, p = M instanceof
|
|
1013
|
+
const M = S.loadError, p = M instanceof ye && M.status === 404;
|
|
956
1014
|
if (!f) {
|
|
957
1015
|
if (M !== null && !p)
|
|
958
|
-
return /* @__PURE__ */ e("div", { className: "error", role: "alert", children:
|
|
1016
|
+
return /* @__PURE__ */ e("div", { className: "error", role: "alert", children: de(M) });
|
|
959
1017
|
if (!p) return /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" });
|
|
960
1018
|
}
|
|
961
|
-
const A = f && (f.displayName || f.key) ||
|
|
962
|
-
S.stale ?
|
|
1019
|
+
const A = f && (f.displayName || f.key) || d.editor.newTitle, ue = S.error !== null && !S.stale ? de(S.error) : null, ie = S.stale || S.changedElsewhere ? /* @__PURE__ */ o("div", { className: "error", role: "alert", "data-testid": "endpoint-stale", children: [
|
|
1020
|
+
S.stale ? de(S.error) : "This endpoint was changed elsewhere. Reload to see the new version (your edits will be discarded).",
|
|
963
1021
|
" ",
|
|
964
1022
|
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => void S.reload(), children: "Reload" })
|
|
965
1023
|
] }) : null;
|
|
966
|
-
return /* @__PURE__ */ e(
|
|
967
|
-
|
|
1024
|
+
return /* @__PURE__ */ e(Te, { value: te, children: /* @__PURE__ */ e(
|
|
1025
|
+
Ge,
|
|
968
1026
|
{
|
|
969
1027
|
kind: "endpoint",
|
|
970
1028
|
title: A,
|
|
@@ -972,31 +1030,31 @@ function Gn(t) {
|
|
|
972
1030
|
canSave: l,
|
|
973
1031
|
isSaving: S.saving,
|
|
974
1032
|
onSave: () => void E(),
|
|
975
|
-
error: p ?
|
|
1033
|
+
error: p ? de(M) : ue,
|
|
976
1034
|
notFound: p,
|
|
977
1035
|
onNavigate: a,
|
|
978
|
-
slots:
|
|
979
|
-
publish: { id:
|
|
980
|
-
headerActions: /* @__PURE__ */ o(
|
|
981
|
-
/* @__PURE__ */ e(
|
|
982
|
-
/* @__PURE__ */ e(
|
|
1036
|
+
slots: h,
|
|
1037
|
+
publish: { id: i, saveFirst: w, disabled: !l },
|
|
1038
|
+
headerActions: /* @__PURE__ */ o(D, { children: [
|
|
1039
|
+
/* @__PURE__ */ e(Ye, { kind: "endpoint", id: i }),
|
|
1040
|
+
/* @__PURE__ */ e(De, { onClick: J })
|
|
983
1041
|
] }),
|
|
984
|
-
banners: /* @__PURE__ */ o(
|
|
985
|
-
|
|
1042
|
+
banners: /* @__PURE__ */ o(D, { children: [
|
|
1043
|
+
Y,
|
|
986
1044
|
ie,
|
|
987
1045
|
q,
|
|
988
1046
|
F && /* @__PURE__ */ e("span", { className: "ok", children: "Saved." })
|
|
989
1047
|
] }),
|
|
990
|
-
children: f && /* @__PURE__ */ o(
|
|
1048
|
+
children: f && /* @__PURE__ */ o(D, { children: [
|
|
991
1049
|
/* @__PURE__ */ o("div", { className: "card", children: [
|
|
992
1050
|
/* @__PURE__ */ o("div", { className: "section-head", children: [
|
|
993
1051
|
/* @__PURE__ */ e("h3", { children: "Identity" }),
|
|
994
1052
|
/* @__PURE__ */ e(
|
|
995
|
-
|
|
1053
|
+
pe,
|
|
996
1054
|
{
|
|
997
1055
|
icon: "edit-2",
|
|
998
1056
|
label: "Edit name, key, and description",
|
|
999
|
-
onClick: () =>
|
|
1057
|
+
onClick: () => g(!0)
|
|
1000
1058
|
}
|
|
1001
1059
|
)
|
|
1002
1060
|
] }),
|
|
@@ -1014,35 +1072,35 @@ function Gn(t) {
|
|
|
1014
1072
|
] })
|
|
1015
1073
|
] }),
|
|
1016
1074
|
/* @__PURE__ */ e(
|
|
1017
|
-
|
|
1075
|
+
et,
|
|
1018
1076
|
{
|
|
1019
|
-
entry:
|
|
1077
|
+
entry: Gn(O, n == null ? void 0 : n.invokeUrl, n == null ? void 0 : n.invokeUrlByKey),
|
|
1020
1078
|
domainOptions: Z,
|
|
1021
1079
|
urlDomain: (O == null ? void 0 : O.domain) ?? null,
|
|
1022
1080
|
onUrlDomain: u,
|
|
1023
1081
|
urlForm: y,
|
|
1024
|
-
onUrlForm:
|
|
1082
|
+
onUrlForm: s
|
|
1025
1083
|
}
|
|
1026
1084
|
),
|
|
1027
1085
|
/* @__PURE__ */ e(
|
|
1028
|
-
|
|
1086
|
+
Xe,
|
|
1029
1087
|
{
|
|
1030
1088
|
title: "Input",
|
|
1031
1089
|
description: "The declared inbound contract. Reuses core Param fields. Leave empty to pass the raw request payload through to the target unchanged.",
|
|
1032
1090
|
emptyMeansPassthrough: !0,
|
|
1033
|
-
rows:
|
|
1091
|
+
rows: x,
|
|
1034
1092
|
onChange: (C) => {
|
|
1035
|
-
|
|
1093
|
+
m.current = !0, U({ input: C });
|
|
1036
1094
|
},
|
|
1037
1095
|
uncoveredKeys: ae
|
|
1038
1096
|
}
|
|
1039
1097
|
),
|
|
1040
1098
|
/* @__PURE__ */ e(
|
|
1041
|
-
|
|
1099
|
+
en,
|
|
1042
1100
|
{
|
|
1043
1101
|
allowedKinds: ["action", "function", "workflow"],
|
|
1044
1102
|
title: "Target",
|
|
1045
|
-
description: /* @__PURE__ */ o(
|
|
1103
|
+
description: /* @__PURE__ */ o(D, { children: [
|
|
1046
1104
|
"The single thing this Endpoint dispatches to. An ",
|
|
1047
1105
|
/* @__PURE__ */ e("strong", { children: "Action" }),
|
|
1048
1106
|
" target runs one app action directly and a ",
|
|
@@ -1057,8 +1115,8 @@ function Gn(t) {
|
|
|
1057
1115
|
onResolved: (C) => I(C.fields)
|
|
1058
1116
|
}
|
|
1059
1117
|
),
|
|
1060
|
-
/* @__PURE__ */ e(
|
|
1061
|
-
/* @__PURE__ */ e(
|
|
1118
|
+
/* @__PURE__ */ e(nt, { security: z, onPatch: ee }),
|
|
1119
|
+
/* @__PURE__ */ e(tt, { id: i, inputs: x, saveFirst: w }),
|
|
1062
1120
|
/* @__PURE__ */ o(
|
|
1063
1121
|
"div",
|
|
1064
1122
|
{
|
|
@@ -1085,33 +1143,33 @@ function Gn(t) {
|
|
|
1085
1143
|
}
|
|
1086
1144
|
),
|
|
1087
1145
|
r && /* @__PURE__ */ e(
|
|
1088
|
-
|
|
1146
|
+
En,
|
|
1089
1147
|
{
|
|
1090
1148
|
initial: {
|
|
1091
1149
|
key: f.key,
|
|
1092
1150
|
displayName: f.displayName ?? "",
|
|
1093
1151
|
description: f.description ?? ""
|
|
1094
1152
|
},
|
|
1095
|
-
onClose: () =>
|
|
1153
|
+
onClose: () => g(!1),
|
|
1096
1154
|
onSaved: (C) => {
|
|
1097
1155
|
U({
|
|
1098
1156
|
displayName: C.displayName,
|
|
1099
1157
|
description: C.description
|
|
1100
|
-
}),
|
|
1158
|
+
}), g(!1);
|
|
1101
1159
|
}
|
|
1102
1160
|
}
|
|
1103
1161
|
),
|
|
1104
1162
|
/* @__PURE__ */ e(
|
|
1105
|
-
|
|
1163
|
+
xe,
|
|
1106
1164
|
{
|
|
1107
1165
|
open: B,
|
|
1108
1166
|
onClose: () => W(!1),
|
|
1109
1167
|
title: `JSON — ${A}`,
|
|
1110
1168
|
mode: "disconnected",
|
|
1111
|
-
value:
|
|
1169
|
+
value: V,
|
|
1112
1170
|
onChange: Q,
|
|
1113
|
-
guard: (C) => me(C,
|
|
1114
|
-
onSave: () => void
|
|
1171
|
+
guard: (C) => me(C, K).blockedReason,
|
|
1172
|
+
onSave: () => void T(),
|
|
1115
1173
|
saving: S.saving,
|
|
1116
1174
|
error: R,
|
|
1117
1175
|
editorLabel: "Endpoint definition JSON"
|
|
@@ -1121,131 +1179,131 @@ function Gn(t) {
|
|
|
1121
1179
|
}
|
|
1122
1180
|
) });
|
|
1123
1181
|
}
|
|
1124
|
-
const
|
|
1125
|
-
},
|
|
1126
|
-
function
|
|
1127
|
-
const { functionId:
|
|
1182
|
+
const rt = () => {
|
|
1183
|
+
}, Be = (t) => t instanceof Error ? t.message : String(t);
|
|
1184
|
+
function Mt(t) {
|
|
1185
|
+
const { functionId: i, onNavigate: a = rt, slots: h, tools: d } = t, n = ke(t.project);
|
|
1128
1186
|
return /* @__PURE__ */ e(
|
|
1129
1187
|
"div",
|
|
1130
1188
|
{
|
|
1131
1189
|
className: "w6w-embed-root",
|
|
1132
1190
|
style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
|
|
1133
1191
|
children: /* @__PURE__ */ e(
|
|
1134
|
-
|
|
1192
|
+
Re,
|
|
1135
1193
|
{
|
|
1136
1194
|
project: n,
|
|
1137
1195
|
onNavigate: a,
|
|
1138
1196
|
rail: t.rail,
|
|
1139
|
-
tools:
|
|
1197
|
+
tools: d,
|
|
1140
1198
|
storageKey: n === null ? null : `w6w.rail.embed.${n}`,
|
|
1141
|
-
children: /* @__PURE__ */ e(
|
|
1199
|
+
children: /* @__PURE__ */ e(lt, { functionId: i, onNavigate: a, slots: h })
|
|
1142
1200
|
}
|
|
1143
1201
|
)
|
|
1144
1202
|
}
|
|
1145
1203
|
);
|
|
1146
1204
|
}
|
|
1147
|
-
function
|
|
1148
|
-
const
|
|
1149
|
-
return /* @__PURE__ */ e(
|
|
1205
|
+
function lt(t) {
|
|
1206
|
+
const i = Sn({ id: t.functionId });
|
|
1207
|
+
return /* @__PURE__ */ e(dt, { ...t, draft: i }, t.functionId);
|
|
1150
1208
|
}
|
|
1151
|
-
function
|
|
1209
|
+
function dt(t) {
|
|
1152
1210
|
var M;
|
|
1153
|
-
const { functionId:
|
|
1211
|
+
const { functionId: i, draft: a, onNavigate: h, slots: d } = t, n = a.definition, c = (n == null ? void 0 : n.inputs) ?? [], v = ((M = je(i).data) == null ? void 0 : M.valid) === !0, N = a.loadError, m = n ? Ie(n.impl) : void 0, y = Ze({
|
|
1154
1212
|
kind: "function",
|
|
1155
|
-
id:
|
|
1156
|
-
uses: (
|
|
1213
|
+
id: i,
|
|
1214
|
+
uses: (m == null ? void 0 : m.kind) === "action" ? m.uses : void 0,
|
|
1157
1215
|
dirty: a.dirty
|
|
1158
|
-
}),
|
|
1159
|
-
|
|
1216
|
+
}), s = N instanceof ye && N.status === 404, [P, u] = b(!1), [r, g] = b(null), [F, k] = b(!1), [B, W] = b(!1), V = ((n == null ? void 0 : n.key) ?? "").trim() || $n((n == null ? void 0 : n.displayName) ?? "");
|
|
1217
|
+
Ae({
|
|
1160
1218
|
kind: "function",
|
|
1161
|
-
id:
|
|
1219
|
+
id: i,
|
|
1162
1220
|
label: (n == null ? void 0 : n.displayName) || void 0,
|
|
1163
|
-
key:
|
|
1164
|
-
inputs:
|
|
1221
|
+
key: V || void 0,
|
|
1222
|
+
inputs: c.filter((p) => !!p.key).map((p) => ({ key: p.key, required: p.required === !0 })),
|
|
1165
1223
|
policy: a.policy,
|
|
1166
1224
|
onPolicyChange: a.onPolicyChange
|
|
1167
1225
|
});
|
|
1168
|
-
const Q = (p) => a.setDefinition((A) => ({ ...A, ...p })), [
|
|
1169
|
-
|
|
1226
|
+
const Q = (p) => a.setDefinition((A) => ({ ...A, ...p })), [K, oe] = b([]), R = _(!1), $ = _(!1);
|
|
1227
|
+
se(() => {
|
|
1170
1228
|
if (R.current) {
|
|
1171
|
-
if (!
|
|
1229
|
+
if (!We({ rows: c, touched: $.current })) {
|
|
1172
1230
|
R.current = !1;
|
|
1173
1231
|
return;
|
|
1174
1232
|
}
|
|
1175
|
-
|
|
1233
|
+
K.length !== 0 && (Q({ inputs: Qe(c, K) }), R.current = !1);
|
|
1176
1234
|
}
|
|
1177
|
-
}, [
|
|
1178
|
-
const
|
|
1179
|
-
() =>
|
|
1180
|
-
[
|
|
1235
|
+
}, [K]);
|
|
1236
|
+
const re = L(
|
|
1237
|
+
() => Ue(c, K),
|
|
1238
|
+
[c, K]
|
|
1181
1239
|
), S = L(
|
|
1182
|
-
() => ({ inputs:
|
|
1183
|
-
[
|
|
1240
|
+
() => ({ inputs: c.map((p) => p.key).filter(Boolean) }),
|
|
1241
|
+
[c]
|
|
1184
1242
|
);
|
|
1185
1243
|
function f(p) {
|
|
1186
|
-
R.current = !0, Q({ impl:
|
|
1244
|
+
R.current = !0, Q({ impl: On(n == null ? void 0 : n.impl, p) });
|
|
1187
1245
|
}
|
|
1188
|
-
const
|
|
1189
|
-
() =>
|
|
1190
|
-
[n == null ? void 0 : n.impl,
|
|
1191
|
-
),
|
|
1192
|
-
function
|
|
1246
|
+
const x = L(
|
|
1247
|
+
() => An({ impl: n == null ? void 0 : n.impl, fields: K }),
|
|
1248
|
+
[n == null ? void 0 : n.impl, K]
|
|
1249
|
+
), Y = !!V && x.length === 0 && a.canSave;
|
|
1250
|
+
function z() {
|
|
1193
1251
|
return {
|
|
1194
1252
|
...n,
|
|
1195
|
-
key:
|
|
1196
|
-
inputs:
|
|
1253
|
+
key: V,
|
|
1254
|
+
inputs: Je(c, { emptyMeansPassthrough: !1 })
|
|
1197
1255
|
};
|
|
1198
1256
|
}
|
|
1199
1257
|
async function Z() {
|
|
1200
|
-
|
|
1201
|
-
const p = await a.commit(
|
|
1202
|
-
p.status === "saved" || p.status === "clean" ?
|
|
1258
|
+
g(null), k(!1);
|
|
1259
|
+
const p = await a.commit(z());
|
|
1260
|
+
p.status === "saved" || p.status === "clean" ? k(!0) : p.status === "blocked" && g(p.reason);
|
|
1203
1261
|
}
|
|
1204
1262
|
async function O() {
|
|
1205
|
-
return a.dirty ?
|
|
1263
|
+
return a.dirty ? Y ? a.commit(z()) : {
|
|
1206
1264
|
status: "blocked",
|
|
1207
1265
|
reason: "Fix the highlighted problems, then save, to test this Function."
|
|
1208
1266
|
} : { status: "clean" };
|
|
1209
1267
|
}
|
|
1210
|
-
const [
|
|
1211
|
-
function
|
|
1212
|
-
const p =
|
|
1268
|
+
const [X, U] = b(!1), [ee, ne] = b(""), [te, ae] = b({ id: i, key: "" }), [G, q] = b(null);
|
|
1269
|
+
function le() {
|
|
1270
|
+
const p = z();
|
|
1213
1271
|
ne(JSON.stringify(p, null, 2)), ae({ id: String(p.id), key: String(p.key) }), q(null), U(!0);
|
|
1214
1272
|
}
|
|
1215
1273
|
async function l() {
|
|
1216
1274
|
const p = me(ee, te);
|
|
1217
1275
|
if (!p.parsed || p.blockedReason) return;
|
|
1218
|
-
|
|
1276
|
+
k(!1);
|
|
1219
1277
|
const A = await a.commit(p.parsed);
|
|
1220
|
-
A.status === "saved" || A.status === "clean" ? (q(null), U(!1),
|
|
1278
|
+
A.status === "saved" || A.status === "clean" ? (q(null), U(!1), k(!0)) : A.status === "blocked" ? q(A.reason) : A.status === "failed" && q(Be(A.error));
|
|
1221
1279
|
}
|
|
1222
1280
|
const E = he(async () => {
|
|
1223
1281
|
W(!0);
|
|
1224
1282
|
try {
|
|
1225
|
-
await a.reload(),
|
|
1283
|
+
await a.reload(), g(null), k(!1);
|
|
1226
1284
|
} finally {
|
|
1227
1285
|
W(!1);
|
|
1228
1286
|
}
|
|
1229
|
-
}, [a.reload]),
|
|
1230
|
-
return a.loading || n === null && N === null ? /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(
|
|
1231
|
-
|
|
1287
|
+
}, [a.reload]), w = a.stale ? null : a.error ?? N, J = r ?? (w === null ? null : Be(w)), T = (n == null ? void 0 : n.displayName) || (n == null ? void 0 : n.key) || "New function";
|
|
1288
|
+
return a.loading || n === null && N === null ? /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(Te, { value: S, children: /* @__PURE__ */ e(
|
|
1289
|
+
Ge,
|
|
1232
1290
|
{
|
|
1233
1291
|
kind: "function",
|
|
1234
|
-
title:
|
|
1235
|
-
incomplete: n !== null && !
|
|
1236
|
-
canSave:
|
|
1292
|
+
title: T,
|
|
1293
|
+
incomplete: n !== null && !v,
|
|
1294
|
+
canSave: Y,
|
|
1237
1295
|
isSaving: a.saving,
|
|
1238
1296
|
onSave: () => void Z(),
|
|
1239
1297
|
error: J,
|
|
1240
|
-
notFound:
|
|
1241
|
-
onNavigate:
|
|
1242
|
-
slots:
|
|
1243
|
-
publish: { id:
|
|
1244
|
-
headerActions: n && /* @__PURE__ */ o(
|
|
1245
|
-
/* @__PURE__ */ e(
|
|
1246
|
-
/* @__PURE__ */ e(
|
|
1298
|
+
notFound: s,
|
|
1299
|
+
onNavigate: h,
|
|
1300
|
+
slots: d,
|
|
1301
|
+
publish: { id: i, saveFirst: O, disabled: !Y || !v },
|
|
1302
|
+
headerActions: n && /* @__PURE__ */ o(D, { children: [
|
|
1303
|
+
/* @__PURE__ */ e(Ye, { kind: "function", id: i }),
|
|
1304
|
+
/* @__PURE__ */ e(De, { onClick: le })
|
|
1247
1305
|
] }),
|
|
1248
|
-
banners: /* @__PURE__ */ o(
|
|
1306
|
+
banners: /* @__PURE__ */ o(D, { children: [
|
|
1249
1307
|
y,
|
|
1250
1308
|
a.stale && /* @__PURE__ */ o("div", { className: "error", role: "alert", "data-testid": "save-stale", children: [
|
|
1251
1309
|
/* @__PURE__ */ e("p", { children: "This function changed on the server after you opened it. Your save was refused, so their work is intact." }),
|
|
@@ -1255,24 +1313,24 @@ function et(t) {
|
|
|
1255
1313
|
/* @__PURE__ */ e("p", { children: "This function was changed elsewhere. Reloading replaces your unsaved edits with the saved copy." }),
|
|
1256
1314
|
/* @__PURE__ */ e("button", { type: "button", className: "btn ghost", disabled: B, onClick: E, children: B ? "Reloading…" : "Reload from server" })
|
|
1257
1315
|
] }),
|
|
1258
|
-
|
|
1316
|
+
x.length > 0 && /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
|
|
1259
1317
|
"Can’t save yet — map ",
|
|
1260
|
-
|
|
1318
|
+
x.length > 1 ? "these" : "this",
|
|
1261
1319
|
" required action",
|
|
1262
1320
|
" ",
|
|
1263
|
-
|
|
1321
|
+
x.length > 1 ? "params" : "param",
|
|
1264
1322
|
" under Input mapping above:",
|
|
1265
1323
|
" ",
|
|
1266
|
-
/* @__PURE__ */ e("strong", { children:
|
|
1324
|
+
/* @__PURE__ */ e("strong", { children: x.join(", ") })
|
|
1267
1325
|
] }),
|
|
1268
1326
|
F && /* @__PURE__ */ e("span", { className: "ok", children: "Saved." })
|
|
1269
1327
|
] }),
|
|
1270
|
-
children: n && /* @__PURE__ */ o(
|
|
1328
|
+
children: n && /* @__PURE__ */ o(D, { children: [
|
|
1271
1329
|
/* @__PURE__ */ o("div", { className: "card", children: [
|
|
1272
1330
|
/* @__PURE__ */ o("div", { className: "section-head", children: [
|
|
1273
1331
|
/* @__PURE__ */ e("h3", { children: "Interface" }),
|
|
1274
1332
|
/* @__PURE__ */ e(
|
|
1275
|
-
|
|
1333
|
+
pe,
|
|
1276
1334
|
{
|
|
1277
1335
|
icon: "edit-2",
|
|
1278
1336
|
label: "Edit name, key, and description",
|
|
@@ -1294,46 +1352,46 @@ function et(t) {
|
|
|
1294
1352
|
] })
|
|
1295
1353
|
] }),
|
|
1296
1354
|
/* @__PURE__ */ e(
|
|
1297
|
-
|
|
1355
|
+
Xe,
|
|
1298
1356
|
{
|
|
1299
1357
|
title: "Inputs",
|
|
1300
1358
|
description: "The canonical, vendor-stable interface a caller binds to. Reuses core Param fields.",
|
|
1301
1359
|
emptyMeansPassthrough: !1,
|
|
1302
|
-
rows:
|
|
1360
|
+
rows: c,
|
|
1303
1361
|
onChange: (p) => {
|
|
1304
1362
|
$.current = !0, Q({ inputs: p });
|
|
1305
1363
|
},
|
|
1306
|
-
uncoveredKeys:
|
|
1364
|
+
uncoveredKeys: re
|
|
1307
1365
|
}
|
|
1308
1366
|
),
|
|
1309
1367
|
/* @__PURE__ */ e(
|
|
1310
|
-
|
|
1368
|
+
en,
|
|
1311
1369
|
{
|
|
1312
1370
|
allowedKinds: ["action", "function", "workflow"],
|
|
1313
|
-
excludeCallableIds: [
|
|
1371
|
+
excludeCallableIds: [i],
|
|
1314
1372
|
title: "Implementation",
|
|
1315
|
-
description: /* @__PURE__ */ o(
|
|
1373
|
+
description: /* @__PURE__ */ o(D, { children: [
|
|
1316
1374
|
'Bind the interface to one concrete app action, another Function, or a Workflow. Switching the provider here (a "re-bind") rewrites only ',
|
|
1317
1375
|
/* @__PURE__ */ e("code", { children: "impl" }),
|
|
1318
1376
|
"'s target fields - the interface above, and every caller, is untouched."
|
|
1319
1377
|
] }),
|
|
1320
|
-
value:
|
|
1378
|
+
value: Ie(n.impl),
|
|
1321
1379
|
onChange: f,
|
|
1322
|
-
onResolved: (p) =>
|
|
1380
|
+
onResolved: (p) => oe(p.fields)
|
|
1323
1381
|
}
|
|
1324
1382
|
),
|
|
1325
1383
|
/* @__PURE__ */ e(
|
|
1326
|
-
|
|
1384
|
+
ct,
|
|
1327
1385
|
{
|
|
1328
|
-
id:
|
|
1329
|
-
inputs:
|
|
1330
|
-
disabled: !
|
|
1331
|
-
invalid: !
|
|
1386
|
+
id: i,
|
|
1387
|
+
inputs: c,
|
|
1388
|
+
disabled: !v,
|
|
1389
|
+
invalid: !v,
|
|
1332
1390
|
saveFirst: O
|
|
1333
1391
|
}
|
|
1334
1392
|
),
|
|
1335
1393
|
P && /* @__PURE__ */ e(
|
|
1336
|
-
|
|
1394
|
+
In,
|
|
1337
1395
|
{
|
|
1338
1396
|
initial: {
|
|
1339
1397
|
key: n.key,
|
|
@@ -1347,18 +1405,18 @@ function et(t) {
|
|
|
1347
1405
|
}
|
|
1348
1406
|
),
|
|
1349
1407
|
/* @__PURE__ */ e(
|
|
1350
|
-
|
|
1408
|
+
xe,
|
|
1351
1409
|
{
|
|
1352
|
-
open:
|
|
1410
|
+
open: X,
|
|
1353
1411
|
onClose: () => U(!1),
|
|
1354
|
-
title: `JSON — ${
|
|
1412
|
+
title: `JSON — ${T}`,
|
|
1355
1413
|
mode: "disconnected",
|
|
1356
1414
|
value: ee,
|
|
1357
1415
|
onChange: ne,
|
|
1358
1416
|
guard: (p) => me(p, te).blockedReason,
|
|
1359
1417
|
onSave: () => void l(),
|
|
1360
1418
|
saving: a.saving,
|
|
1361
|
-
error:
|
|
1419
|
+
error: G,
|
|
1362
1420
|
editorLabel: "Function definition JSON"
|
|
1363
1421
|
}
|
|
1364
1422
|
)
|
|
@@ -1366,31 +1424,31 @@ function et(t) {
|
|
|
1366
1424
|
}
|
|
1367
1425
|
) }) });
|
|
1368
1426
|
}
|
|
1369
|
-
function
|
|
1370
|
-
const { id:
|
|
1427
|
+
function ct(t) {
|
|
1428
|
+
const { id: i, inputs: a } = t, [h, d] = b({}), [n, c] = b(void 0), [I, v] = b(null), [N, m] = b(!1), y = we(), s = Rn();
|
|
1371
1429
|
async function P() {
|
|
1372
1430
|
const u = {};
|
|
1373
1431
|
for (const r of a) {
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1432
|
+
const g = Le(r.type, h[r.key] ?? "");
|
|
1433
|
+
g !== void 0 && (u[r.key] = g);
|
|
1376
1434
|
}
|
|
1377
|
-
|
|
1435
|
+
m(!0);
|
|
1378
1436
|
try {
|
|
1379
1437
|
const r = await t.saveFirst();
|
|
1380
1438
|
if (r.status === "blocked") {
|
|
1381
|
-
|
|
1439
|
+
c(void 0), v(r.reason);
|
|
1382
1440
|
return;
|
|
1383
1441
|
}
|
|
1384
1442
|
if (r.status === "failed") {
|
|
1385
|
-
|
|
1443
|
+
c(void 0), v(fe(r.error));
|
|
1386
1444
|
return;
|
|
1387
1445
|
}
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1446
|
+
const g = await s.mutateAsync({ id: i, inputs: u });
|
|
1447
|
+
v(null), c(g);
|
|
1390
1448
|
} catch (r) {
|
|
1391
|
-
|
|
1449
|
+
c(void 0), v(fe(r));
|
|
1392
1450
|
} finally {
|
|
1393
|
-
|
|
1451
|
+
m(!1), y.invalidateQueries({ queryKey: $e.root });
|
|
1394
1452
|
}
|
|
1395
1453
|
}
|
|
1396
1454
|
return /* @__PURE__ */ o("div", { className: "card", children: [
|
|
@@ -1409,8 +1467,8 @@ function nt(t) {
|
|
|
1409
1467
|
"select",
|
|
1410
1468
|
{
|
|
1411
1469
|
id: r,
|
|
1412
|
-
value:
|
|
1413
|
-
onChange: (
|
|
1470
|
+
value: h[u.key] ?? "",
|
|
1471
|
+
onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value })),
|
|
1414
1472
|
children: [
|
|
1415
1473
|
/* @__PURE__ */ e("option", { value: "", children: "—" }),
|
|
1416
1474
|
/* @__PURE__ */ e("option", { value: "true", children: "true" }),
|
|
@@ -1422,9 +1480,9 @@ function nt(t) {
|
|
|
1422
1480
|
{
|
|
1423
1481
|
id: r,
|
|
1424
1482
|
type: u.type === "number" ? "number" : "text",
|
|
1425
|
-
value:
|
|
1483
|
+
value: h[u.key] ?? "",
|
|
1426
1484
|
placeholder: u.type === "json" ? "{ }" : u.hint ?? "",
|
|
1427
|
-
onChange: (
|
|
1485
|
+
onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value }))
|
|
1428
1486
|
}
|
|
1429
1487
|
)
|
|
1430
1488
|
] }, u.key || u.label);
|
|
@@ -1434,13 +1492,13 @@ function nt(t) {
|
|
|
1434
1492
|
{
|
|
1435
1493
|
type: "button",
|
|
1436
1494
|
className: "btn",
|
|
1437
|
-
disabled: t.disabled || N ||
|
|
1495
|
+
disabled: t.disabled || N || s.isPending,
|
|
1438
1496
|
onClick: () => void P(),
|
|
1439
|
-
children: N ||
|
|
1497
|
+
children: N || s.isPending ? "Invoking…" : "Invoke"
|
|
1440
1498
|
}
|
|
1441
1499
|
) }),
|
|
1442
1500
|
I && /* @__PURE__ */ e("div", { className: "result error", children: I }),
|
|
1443
|
-
n !== void 0 && /* @__PURE__ */ o(
|
|
1501
|
+
n !== void 0 && /* @__PURE__ */ o(D, { children: [
|
|
1444
1502
|
n.invocationId && /* @__PURE__ */ o("p", { className: "muted small", children: [
|
|
1445
1503
|
n.status ?? "done",
|
|
1446
1504
|
n.durationMs !== void 0 ? ` · ${n.durationMs} ms` : "",
|
|
@@ -1452,9 +1510,9 @@ function nt(t) {
|
|
|
1452
1510
|
] });
|
|
1453
1511
|
}
|
|
1454
1512
|
export {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1513
|
+
Ot as DocumentEditor,
|
|
1514
|
+
jt as EndpointEditor,
|
|
1515
|
+
Mt as FunctionEditor,
|
|
1516
|
+
Wt as WorkflowEditor
|
|
1459
1517
|
};
|
|
1460
1518
|
//# sourceMappingURL=editors.mjs.map
|