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