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