@w6w/embed 0.2.30 → 0.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/{CreateFunctionModal-CCYi9deY.js → CreateFunctionModal-glk2zg1r.js} +28 -27
  2. package/dist/{CreateFunctionModal-CCYi9deY.js.map → CreateFunctionModal-glk2zg1r.js.map} +1 -1
  3. package/dist/{DocumentFormModal-B3VudaLb.js → DocumentFormModal-Cw85R4wk.js} +2 -2
  4. package/dist/{DocumentFormModal-B3VudaLb.js.map → DocumentFormModal-Cw85R4wk.js.map} +1 -1
  5. package/dist/{ImportSpecModal-C-B8Jwxk.js → ImportSpecModal-fU5RsVTa.js} +2 -2
  6. package/dist/{ImportSpecModal-C-B8Jwxk.js.map → ImportSpecModal-fU5RsVTa.js.map} +1 -1
  7. package/dist/WorkflowEditor-C7oudiIb.js +1169 -0
  8. package/dist/WorkflowEditor-C7oudiIb.js.map +1 -0
  9. package/dist/callable-record-Bhxim8C1.js +14 -0
  10. package/dist/callable-record-Bhxim8C1.js.map +1 -0
  11. package/dist/callables-B49tS2vv.js +297 -0
  12. package/dist/callables-B49tS2vv.js.map +1 -0
  13. package/dist/{document-sources-DNmBojx6.js → document-sources-Khcw2zB5.js} +16 -16
  14. package/dist/document-sources-Khcw2zB5.js.map +1 -0
  15. package/dist/draft.mjs +1 -1
  16. package/dist/editor/WorkflowEditor.d.ts +2 -1
  17. package/dist/editor/WorkflowInputsModal.d.ts +12 -0
  18. package/dist/editor/WorkflowVariablesEditor.d.ts +1 -1
  19. package/dist/{editor-tools-BIAW-wzt.js → editor-tools-Dn7TgCP4.js} +566 -486
  20. package/dist/editor-tools-Dn7TgCP4.js.map +1 -0
  21. package/dist/editor.mjs +1 -1
  22. package/dist/editors.mjs +81 -80
  23. package/dist/editors.mjs.map +1 -1
  24. package/dist/endpoints-zOuwci2U.js +136 -0
  25. package/dist/endpoints-zOuwci2U.js.map +1 -0
  26. package/dist/fields-CXHRR5eK.js +28 -0
  27. package/dist/fields-CXHRR5eK.js.map +1 -0
  28. package/dist/forms.mjs +1 -1
  29. package/dist/index.mjs +91 -91
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/lib/callable-duplicate.d.ts +26 -0
  32. package/dist/lib/settings-rail.d.ts +12 -0
  33. package/dist/lib/variable-preview.d.ts +6 -0
  34. package/dist/lib.mjs +41 -40
  35. package/dist/lib.mjs.map +1 -1
  36. package/dist/lists/CallableKindList.d.ts +4 -1
  37. package/dist/lists/CallableRowParts.d.ts +5 -0
  38. package/dist/lists/CredentialDetail.d.ts +2 -0
  39. package/dist/lists/CredentialFields.d.ts +1 -1
  40. package/dist/lists/EndpointList.d.ts +2 -1
  41. package/dist/lists/WorkflowList.d.ts +2 -1
  42. package/dist/lists.mjs +1509 -1421
  43. package/dist/lists.mjs.map +1 -1
  44. package/dist/rail.mjs +1 -1
  45. package/dist/repos/callables.d.ts +23 -0
  46. package/dist/repos/fields.d.ts +4 -1
  47. package/dist/repos.mjs +242 -239
  48. package/dist/settings-rail-gUU2ZbSw.js +36 -0
  49. package/dist/settings-rail-gUU2ZbSw.js.map +1 -0
  50. package/dist/{spec-import-FygyV8sy.js → spec-import-CGPqUUjN.js} +2 -2
  51. package/dist/{spec-import-FygyV8sy.js.map → spec-import-CGPqUUjN.js.map} +1 -1
  52. package/dist/{use-callable-draft-DCauHt5o.js → use-callable-draft-w4tDTYcb.js} +8 -7
  53. package/dist/{use-callable-draft-DCauHt5o.js.map → use-callable-draft-w4tDTYcb.js.map} +1 -1
  54. package/package.json +3 -3
  55. package/src/styles.css +174 -40
  56. package/dist/WorkflowEditor-8NAcpjO_.js +0 -1140
  57. package/dist/WorkflowEditor-8NAcpjO_.js.map +0 -1
  58. package/dist/callables-tOlflvbl.js +0 -151
  59. package/dist/callables-tOlflvbl.js.map +0 -1
  60. package/dist/document-sources-DNmBojx6.js.map +0 -1
  61. package/dist/editor-tools-BIAW-wzt.js.map +0 -1
  62. package/dist/endpoints-DArAqoLT.js +0 -233
  63. package/dist/endpoints-DArAqoLT.js.map +0 -1
  64. package/dist/fields-DvS8XZFc.js +0 -21
  65. package/dist/fields-DvS8XZFc.js.map +0 -1
  66. package/dist/settings-rail--GdRMusb.js +0 -33
  67. package/dist/settings-rail--GdRMusb.js.map +0 -1
package/dist/editors.mjs CHANGED
@@ -2,23 +2,24 @@
2
2
  var tn = Object.defineProperty;
3
3
  var an = (t, i, a) => i in t ? tn(t, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[i] = a;
4
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-8NAcpjO_.js";
6
- import { W as Lt } from "./WorkflowEditor-8NAcpjO_.js";
5
+ import { H as sn, E as on, B as rn, a as Re, J as xe, b as De } from "./WorkflowEditor-C7oudiIb.js";
6
+ import { W as Wt } from "./WorkflowEditor-C7oudiIb.js";
7
7
  import { jsx as e, jsxs as o, Fragment as D } from "react/jsx-runtime";
8
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
9
  import { useState as g, Component as fn, useRef as _, useEffect as se, useMemo as L, useCallback as he } from "react";
10
10
  import { b as pn, C as yn } from "./ConfirmModal-WqBfWftD.js";
11
- import { D as vn } from "./DocumentFormModal-B3VudaLb.js";
11
+ import { D as vn } from "./DocumentFormModal-Cw85R4wk.js";
12
12
  import { u as ke } from "./project-context-Tvp-La7A.js";
13
- import { j as bn, i as gn, r as Ae, m as kn, o as wn } from "./spec-import-FygyV8sy.js";
13
+ import { j as bn, i as gn, r as Oe, m as kn, o as wn } from "./spec-import-CGPqUUjN.js";
14
14
  import { ApiError as ye } from "@w6w/sdk";
15
15
  import { k as Nn, i as Cn } from "./apps-FMcQfyL2.js";
16
- import { C as Sn, c as Oe } from "./editor-tools-BIAW-wzt.js";
17
- import { a as En, b as In } from "./use-callable-draft-DCauHt5o.js";
18
- import { E as Fn, F as Pn } from "./CreateFunctionModal-CCYi9deY.js";
19
- import { d as je, z as Bn, b as Rn, u as xn, w as Me, v as Je, A as Dn } from "./endpoints-DArAqoLT.js";
20
- import { t as Kn, a as Le, c as We, I as Tn, b as An, p as ve, f as On, u as Ee, s as Qe, m as Ue, g as qe, i as Ie, e as jn, h as Mn } from "./coerce-input-DFJ4n_wc.js";
16
+ import { C as Sn, c as Ae } from "./editor-tools-Dn7TgCP4.js";
17
+ import { a as En, b as In } from "./use-callable-draft-w4tDTYcb.js";
18
+ import { E as Fn, F as Pn } from "./CreateFunctionModal-glk2zg1r.js";
19
+ import { j as je } from "./callables-B49tS2vv.js";
20
+ import { t as Bn, a as Me, c as Je, I as Rn, b as xn, p as ve, f as Dn, u as Ee, s as Le, m as We, g as Qe, i as Ie, e as Kn, h as Tn } from "./coerce-input-DFJ4n_wc.js";
21
21
  import { e as me } from "./import-bindings-EUtxZ9Ti.js";
22
+ import { w as On, b as An, u as jn, s as Ue, r as qe, x as Mn } from "./endpoints-zOuwci2U.js";
22
23
  import { useQueryClient as we } from "@tanstack/react-query";
23
24
  import { o as $e, a1 as Jn, a0 as Ln } from "./workflows-Dz8LMjnt.js";
24
25
  import { SECRET_MASK as Wn } from "@w6w/sdk/console";
@@ -205,18 +206,18 @@ function be(t) {
205
206
  ...h,
206
207
  key: String(t.key ?? "").trim()
207
208
  };
208
- Kn(i) && (d.target = i);
209
- const n = Le(a ?? [], { emptyMeansPassthrough: !0 });
209
+ Bn(i) && (d.target = i);
210
+ const n = Me(a ?? [], { emptyMeansPassthrough: !0 });
210
211
  return n !== void 0 && (d.input = n), d;
211
212
  }
212
- function ze(t) {
213
+ function Ge(t) {
213
214
  return t && t.length > 1 ? t : void 0;
214
215
  }
215
- function zn(t, i) {
216
- const a = ze(t);
216
+ function Gn(t, i) {
217
+ const a = Ge(t);
217
218
  return a ? a.find((h) => h.domain === i) ?? a.find((h) => h.default) ?? a[0] : null;
218
219
  }
219
- function Gn(t, i, a) {
220
+ function zn(t, i, a) {
220
221
  return t ?? {
221
222
  url: i ?? "",
222
223
  urlByKey: a,
@@ -226,7 +227,7 @@ function Gn(t, i, a) {
226
227
  const Xn = (t) => t instanceof Error ? t.message : String(t);
227
228
  function Zn(t) {
228
229
  var y;
229
- const { kind: i, id: a, onError: h } = t, d = Ae(i, a, !0), n = kn(i), [c, I] = g(!1), v = ((y = d.data) == null ? void 0 : y.currentPublishedVersion) != null, N = i === "function" ? "fn-publish" : "ep-publish";
230
+ const { kind: i, id: a, onError: h } = t, d = Oe(i, a, !0), n = kn(i), [c, I] = g(!1), v = ((y = d.data) == null ? void 0 : y.currentPublishedVersion) != null, N = i === "function" ? "fn-publish" : "ep-publish";
230
231
  async function m() {
231
232
  h(null), I(!0);
232
233
  try {
@@ -256,7 +257,7 @@ function Zn(t) {
256
257
  }
257
258
  );
258
259
  }
259
- function Ge(t) {
260
+ function ze(t) {
260
261
  const i = je(t.kind), [a, h] = g(null), d = t.slots, n = (d == null ? void 0 : d.backLabel) ?? i.editor.backLabel, c = () => t.onNavigate({ type: "list" });
261
262
  return t.notFound ? /* @__PURE__ */ o("div", { children: [
262
263
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: c, children: n }),
@@ -468,10 +469,10 @@ function ge(t) {
468
469
  ] });
469
470
  }
470
471
  function tt(t) {
471
- const { id: i, inputs: a } = t, [h, d] = g({}), [n, c] = g(void 0), [I, v] = g(null), [N, m] = g(!1), y = we(), s = Bn(), P = async () => {
472
+ const { id: i, inputs: a } = t, [h, d] = g({}), [n, c] = g(void 0), [I, v] = g(null), [N, m] = g(!1), y = we(), s = On(), P = async () => {
472
473
  const u = {};
473
474
  for (const r of a) {
474
- const b = We(r.type, h[r.key] ?? "");
475
+ const b = Je(r.type, h[r.key] ?? "");
475
476
  b !== void 0 && (u[r.key] = b);
476
477
  }
477
478
  m(!0);
@@ -596,7 +597,7 @@ function Xe(t) {
596
597
  value: m.type,
597
598
  "aria-label": "Input type",
598
599
  onChange: (s) => v(y, { type: s.target.value }),
599
- children: Tn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
600
+ children: Rn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
600
601
  }
601
602
  ),
602
603
  /* @__PURE__ */ o("label", { className: "row", style: { gap: 4, alignItems: "center" }, children: [
@@ -638,7 +639,7 @@ const at = ["action", "function", "workflow", "endpoint"], it = {
638
639
  };
639
640
  function Ze(t) {
640
641
  var F;
641
- 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 = Ae(i, a, !0).data) == null ? void 0 : F.enabled, m = wn(i), y = v.isSuccess && !v.isFetching, s = L(() => new Set((v.data ?? []).map((k) => k.id)), [v.data]), P = He(
642
+ 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 = Oe(i, a, !0).data) == null ? void 0 : F.enabled, m = wn(i), y = v.isSuccess && !v.isFetching, s = L(() => new Set((v.data ?? []).map((k) => k.id)), [v.data]), P = He(
642
643
  [{ id: "target", uses: h }],
643
644
  () => y ? { state: "ready", ids: s } : void 0
644
645
  ).length, u = _({ id: a, had: !1 });
@@ -666,7 +667,7 @@ function Ze(t) {
666
667
  ) : null;
667
668
  }
668
669
  function en(t) {
669
- var G, q, le;
670
+ var z, q, le;
670
671
  const {
671
672
  allowedKinds: i,
672
673
  excludeCallableIds: a,
@@ -680,7 +681,7 @@ function en(t) {
680
681
  function u(l) {
681
682
  d(l);
682
683
  }
683
- const r = y.kind === "action" ? y : void 0, b = (r == null ? void 0 : r.uses.app) ?? "", F = (r == null ? void 0 : r.uses.action) ?? "", k = An(y), B = qn(b), [W, V] = g(null);
684
+ const r = y.kind === "action" ? y : void 0, b = (r == null ? void 0 : r.uses.app) ?? "", F = (r == null ? void 0 : r.uses.action) ?? "", k = xn(y), B = qn(b), [W, V] = g(null);
684
685
  se(() => {
685
686
  let l = !1;
686
687
  return import("@w6w/ui/flow").then((E) => {
@@ -695,23 +696,23 @@ function en(t) {
695
696
  ).length > 0, R = L(
696
697
  () => (Q.data ?? []).find((l) => l.key === F),
697
698
  [Q.data, F]
698
- ), $ = ["function", "workflow"].filter(P), re = `Choose ${c.charAt(0).toLowerCase()}${c.slice(1)}`, S = Rn(P("function")), f = Jn(void 0, P("workflow")), x = xn(P("endpoint")), Y = Me(k, s === "function" && k !== ""), z = Ln(k, s === "workflow" && k !== ""), Z = Je(k, s === "endpoint" && k !== ""), O = L(() => {
699
+ ), $ = ["function", "workflow"].filter(P), re = `Choose ${c.charAt(0).toLowerCase()}${c.slice(1)}`, S = An(P("function")), f = Jn(void 0, P("workflow")), x = jn(P("endpoint")), Y = Ue(k, s === "function" && k !== ""), G = Ln(k, s === "workflow" && k !== ""), Z = qe(k, s === "endpoint" && k !== ""), A = L(() => {
699
700
  var l, E, w;
700
- return s === "action" ? ve((R == null ? void 0 : R.params) ?? []) : s === "function" ? ve(((l = Y.data) == null ? void 0 : l.inputs) ?? []) : s === "workflow" ? W ? On(
701
- (E = z.data) == null ? void 0 : E.workflow,
701
+ return s === "action" ? ve((R == null ? void 0 : R.params) ?? []) : s === "function" ? ve(((l = Y.data) == null ? void 0 : l.inputs) ?? []) : s === "workflow" ? W ? Dn(
702
+ (E = G.data) == null ? void 0 : E.workflow,
702
703
  W
703
704
  ) : [] : s === "endpoint" ? ve(((w = Z.data) == null ? void 0 : w.endpoint.input) ?? []) : [];
704
705
  }, [
705
706
  s,
706
707
  R,
707
708
  Y.data,
708
- z.data,
709
+ G.data,
709
710
  Z.data,
710
711
  W
711
712
  ]);
712
713
  se(() => {
713
- n == null || n({ meta: { kind: s, ref: s === "action" ? b : k }, kind: s, fields: O });
714
- }, [s, b, k, O, n]);
714
+ n == null || n({ meta: { kind: s, ref: s === "action" ? b : k }, kind: s, fields: A });
715
+ }, [s, b, k, A, n]);
715
716
  function X(l) {
716
717
  if (l.uses.app === Sn) {
717
718
  const T = l.with ?? {}, M = T.targetKind === "workflow" ? "workflow" : "function", p = typeof T.targetId == "string" ? T.targetId : "";
@@ -758,8 +759,8 @@ function en(t) {
758
759
  const l = (R == null ? void 0 : R.params) ?? [], E = (r == null ? void 0 : r.with) ?? {};
759
760
  return l.filter((w) => {
760
761
  if (w.showIf) {
761
- const { field: T, equals: M, in: p, notIn: A, truthy: ue } = w.showIf, ie = E[T];
762
- if (M !== void 0 && ie !== M || p !== void 0 && !p.includes(ie) || A != null && A.includes(ie) || ue !== void 0 && !!ie !== ue) return !1;
762
+ const { field: T, equals: M, in: p, notIn: O, truthy: ue } = w.showIf, ie = E[T];
763
+ if (M !== void 0 && ie !== M || p !== void 0 && !p.includes(ie) || O != null && O.includes(ie) || ue !== void 0 && !!ie !== ue) return !1;
763
764
  }
764
765
  const J = w.key in E && E[w.key] !== "" && E[w.key] !== void 0;
765
766
  return w.required || J;
@@ -787,7 +788,7 @@ function en(t) {
787
788
  /* @__PURE__ */ e("strong", { children: (R == null ? void 0 : R.title) ?? F }),
788
789
  " ",
789
790
  /* @__PURE__ */ e("code", { className: "muted", children: b }),
790
- /* @__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" })
791
+ /* @__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 = (z = K.data) == null ? void 0 : z.find((l) => l.id === r.uses.connection)) == null ? void 0 : q.displayName) ?? r.uses.connection}` : "no connection" })
791
792
  ] }),
792
793
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
793
794
  ] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () => m(!0), children: "+ Choose an action" }),
@@ -878,7 +879,7 @@ const st = () => {
878
879
  function de(t) {
879
880
  return t instanceof ye || t instanceof Error ? t.message : String(t);
880
881
  }
881
- function Ot(t) {
882
+ function jt(t) {
882
883
  const { endpointId: i, onNavigate: a = st, slots: h, tools: d } = t, n = ke(t.project), c = he(
883
884
  (I) => a(I),
884
885
  [a]
@@ -912,7 +913,7 @@ function Ot(t) {
912
913
  }
913
914
  function ot(t) {
914
915
  var Ne;
915
- const { id: i, onNavigate: a, slots: h } = t, d = je("endpoint"), n = Je(i).data, [c, I] = g([]), v = _(c);
916
+ const { id: i, onNavigate: a, slots: h } = t, d = je("endpoint"), n = qe(i).data, [c, I] = g([]), v = _(c);
916
917
  v.current = c;
917
918
  const N = _(!1), m = _(!1), [y, s] = g("id"), [P, u] = g(null), [r, b] = g(!1), [F, k] = g(!1), [B, W] = g(!1), [V, Q] = g(""), [K, oe] = g({ id: i, key: "" }), [R, $] = g(null), re = he((C) => {
918
919
  const H = ce(C), j = Ee({
@@ -929,16 +930,16 @@ function ot(t) {
929
930
  id: i,
930
931
  uses: (f == null ? void 0 : f.target.kind) === "action" ? f.target.uses : void 0,
931
932
  dirty: S.dirty
932
- }), z = ((Ne = f == null ? void 0 : f.exposure) == null ? void 0 : Ne.security) ?? {
933
+ }), G = ((Ne = f == null ? void 0 : f.exposure) == null ? void 0 : Ne.security) ?? {
933
934
  auth: "platform"
934
- }, Z = ze(n == null ? void 0 : n.invokeUrls), O = zn(n == null ? void 0 : n.invokeUrls, P);
935
- Oe({
935
+ }, Z = Ge(n == null ? void 0 : n.invokeUrls), A = Gn(n == null ? void 0 : n.invokeUrls, P);
936
+ Ae({
936
937
  kind: "endpoint",
937
938
  id: i,
938
939
  label: (f == null ? void 0 : f.displayName) || void 0,
939
940
  key: (f == null ? void 0 : f.key.trim()) || void 0,
940
- invokeUrl: O ? O.url : n == null ? void 0 : n.invokeUrl,
941
- invokeUrlByKey: O ? O.urlByKey : n == null ? void 0 : n.invokeUrlByKey,
941
+ invokeUrl: A ? A.url : n == null ? void 0 : n.invokeUrl,
942
+ invokeUrlByKey: A ? A.urlByKey : n == null ? void 0 : n.invokeUrlByKey,
942
943
  urlForm: y,
943
944
  inputs: c.map((C) => C.key),
944
945
  policy: S.policy,
@@ -967,33 +968,33 @@ function ot(t) {
967
968
  }
968
969
  se(() => {
969
970
  if (N.current) {
970
- if (!Qe({ rows: x, touched: m.current })) {
971
+ if (!Le({ rows: x, touched: m.current })) {
971
972
  N.current = !1;
972
973
  return;
973
974
  }
974
- c.length !== 0 && (U({ input: Ue(x, c) }), N.current = !1);
975
+ c.length !== 0 && (U({ input: We(x, c) }), N.current = !1);
975
976
  }
976
977
  }, [c]);
977
978
  const te = L(
978
979
  () => ({ inputs: x.map((C) => C.key).filter(Boolean) }),
979
980
  [x]
980
981
  ), ae = L(
981
- () => qe(x, c),
982
+ () => Qe(x, c),
982
983
  [x, c]
983
- ), G = L(
984
+ ), z = L(
984
985
  () => f ? Ee({
985
986
  target: f.target,
986
987
  rows: x,
987
988
  fields: c
988
989
  }) : [],
989
990
  [f, x, c]
990
- ), q = f && G.length > 0 ? /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
991
+ ), q = f && z.length > 0 ? /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
991
992
  "Can’t save yet — the target needs",
992
993
  " ",
993
994
  f.target.kind === "action" ? "these required params mapped under Input mapping" : "these required keys declared under Input",
994
995
  ": ",
995
- /* @__PURE__ */ e("strong", { children: G.join(", ") })
996
- ] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") && G.length === 0 && S.canSave;
996
+ /* @__PURE__ */ e("strong", { children: z.join(", ") })
997
+ ] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") && z.length === 0 && S.canSave;
997
998
  async function E() {
998
999
  if (!f) return;
999
1000
  const C = await S.commit(be(f));
@@ -1022,16 +1023,16 @@ function ot(t) {
1022
1023
  return /* @__PURE__ */ e("div", { className: "error", role: "alert", children: de(M) });
1023
1024
  if (!p) return /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" });
1024
1025
  }
1025
- 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: [
1026
+ const O = 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: [
1026
1027
  S.stale ? de(S.error) : "This endpoint was changed elsewhere. Reload to see the new version (your edits will be discarded).",
1027
1028
  " ",
1028
1029
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => void S.reload(), children: "Reload" })
1029
1030
  ] }) : null;
1030
1031
  return /* @__PURE__ */ e(Te, { value: te, children: /* @__PURE__ */ e(
1031
- Ge,
1032
+ ze,
1032
1033
  {
1033
1034
  kind: "endpoint",
1034
- title: A,
1035
+ title: O,
1035
1036
  incomplete: !1,
1036
1037
  canSave: l,
1037
1038
  isSaving: S.saving,
@@ -1080,9 +1081,9 @@ function ot(t) {
1080
1081
  /* @__PURE__ */ e(
1081
1082
  et,
1082
1083
  {
1083
- entry: Gn(O, n == null ? void 0 : n.invokeUrl, n == null ? void 0 : n.invokeUrlByKey),
1084
+ entry: zn(A, n == null ? void 0 : n.invokeUrl, n == null ? void 0 : n.invokeUrlByKey),
1084
1085
  domainOptions: Z,
1085
- urlDomain: (O == null ? void 0 : O.domain) ?? null,
1086
+ urlDomain: (A == null ? void 0 : A.domain) ?? null,
1086
1087
  onUrlDomain: u,
1087
1088
  urlForm: y,
1088
1089
  onUrlForm: s
@@ -1121,7 +1122,7 @@ function ot(t) {
1121
1122
  onResolved: (C) => I(C.fields)
1122
1123
  }
1123
1124
  ),
1124
- /* @__PURE__ */ e(nt, { security: z, onPatch: ee }),
1125
+ /* @__PURE__ */ e(nt, { security: G, onPatch: ee }),
1125
1126
  /* @__PURE__ */ e(tt, { id: i, inputs: x, saveFirst: w }),
1126
1127
  /* @__PURE__ */ o(
1127
1128
  "div",
@@ -1170,7 +1171,7 @@ function ot(t) {
1170
1171
  {
1171
1172
  open: B,
1172
1173
  onClose: () => W(!1),
1173
- title: `JSON — ${A}`,
1174
+ title: `JSON — ${O}`,
1174
1175
  mode: "disconnected",
1175
1176
  value: V,
1176
1177
  onChange: Q,
@@ -1187,7 +1188,7 @@ function ot(t) {
1187
1188
  }
1188
1189
  const rt = () => {
1189
1190
  }, Be = (t) => t instanceof Error ? t.message : String(t);
1190
- function jt(t) {
1191
+ function Mt(t) {
1191
1192
  const { functionId: i, onNavigate: a = rt, slots: h, tools: d } = t, n = ke(t.project);
1192
1193
  return /* @__PURE__ */ e(
1193
1194
  "div",
@@ -1214,13 +1215,13 @@ function lt(t) {
1214
1215
  }
1215
1216
  function dt(t) {
1216
1217
  var M;
1217
- const { functionId: i, draft: a, onNavigate: h, slots: d } = t, n = a.definition, c = (n == null ? void 0 : n.inputs) ?? [], v = ((M = Me(i).data) == null ? void 0 : M.valid) === !0, N = a.loadError, m = n ? Ie(n.impl) : void 0, y = Ze({
1218
+ const { functionId: i, draft: a, onNavigate: h, slots: d } = t, n = a.definition, c = (n == null ? void 0 : n.inputs) ?? [], v = ((M = Ue(i).data) == null ? void 0 : M.valid) === !0, N = a.loadError, m = n ? Ie(n.impl) : void 0, y = Ze({
1218
1219
  kind: "function",
1219
1220
  id: i,
1220
1221
  uses: (m == null ? void 0 : m.kind) === "action" ? m.uses : void 0,
1221
1222
  dirty: a.dirty
1222
1223
  }), s = N instanceof ye && N.status === 404, [P, u] = g(!1), [r, b] = g(null), [F, k] = g(!1), [B, W] = g(!1), V = ((n == null ? void 0 : n.key) ?? "").trim() || $n((n == null ? void 0 : n.displayName) ?? "");
1223
- Oe({
1224
+ Ae({
1224
1225
  kind: "function",
1225
1226
  id: i,
1226
1227
  label: (n == null ? void 0 : n.displayName) || void 0,
@@ -1229,59 +1230,59 @@ function dt(t) {
1229
1230
  policy: a.policy,
1230
1231
  onPolicyChange: a.onPolicyChange
1231
1232
  });
1232
- const Q = (p) => a.setDefinition((A) => ({ ...A, ...p })), [K, oe] = g([]), R = _(!1), $ = _(!1);
1233
+ const Q = (p) => a.setDefinition((O) => ({ ...O, ...p })), [K, oe] = g([]), R = _(!1), $ = _(!1);
1233
1234
  se(() => {
1234
1235
  if (R.current) {
1235
- if (!Qe({ rows: c, touched: $.current })) {
1236
+ if (!Le({ rows: c, touched: $.current })) {
1236
1237
  R.current = !1;
1237
1238
  return;
1238
1239
  }
1239
- K.length !== 0 && (Q({ inputs: Ue(c, K) }), R.current = !1);
1240
+ K.length !== 0 && (Q({ inputs: We(c, K) }), R.current = !1);
1240
1241
  }
1241
1242
  }, [K]);
1242
1243
  const re = L(
1243
- () => qe(c, K),
1244
+ () => Qe(c, K),
1244
1245
  [c, K]
1245
1246
  ), S = L(
1246
1247
  () => ({ inputs: c.map((p) => p.key).filter(Boolean) }),
1247
1248
  [c]
1248
1249
  );
1249
1250
  function f(p) {
1250
- R.current = !0, Q({ impl: Mn(n == null ? void 0 : n.impl, p) });
1251
+ R.current = !0, Q({ impl: Tn(n == null ? void 0 : n.impl, p) });
1251
1252
  }
1252
1253
  const x = L(
1253
- () => jn({ impl: n == null ? void 0 : n.impl, fields: K }),
1254
+ () => Kn({ impl: n == null ? void 0 : n.impl, fields: K }),
1254
1255
  [n == null ? void 0 : n.impl, K]
1255
1256
  ), Y = !!V && x.length === 0 && a.canSave;
1256
- function z() {
1257
+ function G() {
1257
1258
  return {
1258
1259
  ...n,
1259
1260
  key: V,
1260
- inputs: Le(c, { emptyMeansPassthrough: !1 })
1261
+ inputs: Me(c, { emptyMeansPassthrough: !1 })
1261
1262
  };
1262
1263
  }
1263
1264
  async function Z() {
1264
1265
  b(null), k(!1);
1265
- const p = await a.commit(z());
1266
+ const p = await a.commit(G());
1266
1267
  p.status === "saved" || p.status === "clean" ? k(!0) : p.status === "blocked" && b(p.reason);
1267
1268
  }
1268
- async function O() {
1269
- return a.dirty ? Y ? a.commit(z()) : {
1269
+ async function A() {
1270
+ return a.dirty ? Y ? a.commit(G()) : {
1270
1271
  status: "blocked",
1271
1272
  reason: "Fix the highlighted problems, then save, to test this Function."
1272
1273
  } : { status: "clean" };
1273
1274
  }
1274
- const [X, U] = g(!1), [ee, ne] = g(""), [te, ae] = g({ id: i, key: "" }), [G, q] = g(null);
1275
+ const [X, U] = g(!1), [ee, ne] = g(""), [te, ae] = g({ id: i, key: "" }), [z, q] = g(null);
1275
1276
  function le() {
1276
- const p = z();
1277
+ const p = G();
1277
1278
  ne(JSON.stringify(p, null, 2)), ae({ id: String(p.id), key: String(p.key) }), q(null), U(!0);
1278
1279
  }
1279
1280
  async function l() {
1280
1281
  const p = me(ee, te);
1281
1282
  if (!p.parsed || p.blockedReason) return;
1282
1283
  k(!1);
1283
- const A = await a.commit(p.parsed);
1284
- 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));
1284
+ const O = await a.commit(p.parsed);
1285
+ O.status === "saved" || O.status === "clean" ? (q(null), U(!1), k(!0)) : O.status === "blocked" ? q(O.reason) : O.status === "failed" && q(Be(O.error));
1285
1286
  }
1286
1287
  const E = he(async () => {
1287
1288
  W(!0);
@@ -1292,7 +1293,7 @@ function dt(t) {
1292
1293
  }
1293
1294
  }, [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";
1294
1295
  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(
1295
- Ge,
1296
+ ze,
1296
1297
  {
1297
1298
  kind: "function",
1298
1299
  title: T,
@@ -1304,7 +1305,7 @@ function dt(t) {
1304
1305
  notFound: s,
1305
1306
  onNavigate: h,
1306
1307
  slots: d,
1307
- publish: { id: i, saveFirst: O, disabled: !Y || !v },
1308
+ publish: { id: i, saveFirst: A, disabled: !Y || !v },
1308
1309
  headerActions: n && /* @__PURE__ */ o(D, { children: [
1309
1310
  /* @__PURE__ */ e(Ye, { kind: "function", id: i }),
1310
1311
  /* @__PURE__ */ e(De, { onClick: le })
@@ -1393,7 +1394,7 @@ function dt(t) {
1393
1394
  inputs: c,
1394
1395
  disabled: !v,
1395
1396
  invalid: !v,
1396
- saveFirst: O
1397
+ saveFirst: A
1397
1398
  }
1398
1399
  ),
1399
1400
  P && /* @__PURE__ */ e(
@@ -1422,7 +1423,7 @@ function dt(t) {
1422
1423
  guard: (p) => me(p, te).blockedReason,
1423
1424
  onSave: () => void l(),
1424
1425
  saving: a.saving,
1425
- error: G,
1426
+ error: z,
1426
1427
  editorLabel: "Function definition JSON"
1427
1428
  }
1428
1429
  )
@@ -1431,11 +1432,11 @@ function dt(t) {
1431
1432
  ) }) });
1432
1433
  }
1433
1434
  function ct(t) {
1434
- const { id: i, inputs: a } = t, [h, d] = g({}), [n, c] = g(void 0), [I, v] = g(null), [N, m] = g(!1), y = we(), s = Dn();
1435
+ const { id: i, inputs: a } = t, [h, d] = g({}), [n, c] = g(void 0), [I, v] = g(null), [N, m] = g(!1), y = we(), s = Mn();
1435
1436
  async function P() {
1436
1437
  const u = {};
1437
1438
  for (const r of a) {
1438
- const b = We(r.type, h[r.key] ?? "");
1439
+ const b = Je(r.type, h[r.key] ?? "");
1439
1440
  b !== void 0 && (u[r.key] = b);
1440
1441
  }
1441
1442
  m(!0);
@@ -1517,8 +1518,8 @@ function ct(t) {
1517
1518
  }
1518
1519
  export {
1519
1520
  At as DocumentEditor,
1520
- Ot as EndpointEditor,
1521
- jt as FunctionEditor,
1522
- Lt as WorkflowEditor
1521
+ jt as EndpointEditor,
1522
+ Mt as FunctionEditor,
1523
+ Wt as WorkflowEditor
1523
1524
  };
1524
1525
  //# sourceMappingURL=editors.mjs.map