@w6w/embed 0.2.29 → 0.2.31

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 (76) 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-CCIgA7pR.js → DocumentFormModal-Cw85R4wk.js} +2 -2
  4. package/dist/{DocumentFormModal-CCIgA7pR.js.map → DocumentFormModal-Cw85R4wk.js.map} +1 -1
  5. package/dist/{ImportSpecModal-DoxsVxru.js → ImportSpecModal-fU5RsVTa.js} +2 -2
  6. package/dist/{ImportSpecModal-DoxsVxru.js.map → ImportSpecModal-fU5RsVTa.js.map} +1 -1
  7. package/dist/WorkflowEditor-B-Wc_r4X.js +1140 -0
  8. package/dist/WorkflowEditor-B-Wc_r4X.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/WorkflowInputsModal.d.ts +12 -0
  17. package/dist/editor/WorkflowVariablesEditor.d.ts +1 -1
  18. package/dist/{editor-tools--Y3wlBZE.js → editor-tools-Ch1cAE4F.js} +434 -377
  19. package/dist/editor-tools-Ch1cAE4F.js.map +1 -0
  20. package/dist/editor.mjs +1 -1
  21. package/dist/editors.mjs +85 -85
  22. package/dist/endpoints-zOuwci2U.js +136 -0
  23. package/dist/endpoints-zOuwci2U.js.map +1 -0
  24. package/dist/fields-CXHRR5eK.js +28 -0
  25. package/dist/fields-CXHRR5eK.js.map +1 -0
  26. package/dist/forms.mjs +1 -1
  27. package/dist/index.mjs +91 -91
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/lib/callable-duplicate.d.ts +26 -0
  30. package/dist/lib/recent-activity.d.ts +2 -2
  31. package/dist/lib/variable-preview.d.ts +6 -0
  32. package/dist/lib/workflow-version.d.ts +19 -2
  33. package/dist/lib.mjs +41 -40
  34. package/dist/lib.mjs.map +1 -1
  35. package/dist/lists/AiKeyCreate.d.ts +20 -0
  36. package/dist/lists/CallableKindList.d.ts +21 -2
  37. package/dist/lists/CallableRowParts.d.ts +38 -0
  38. package/dist/lists/CredentialCreate.d.ts +17 -17
  39. package/dist/lists/CredentialDetail.d.ts +2 -0
  40. package/dist/lists/CredentialFields.d.ts +18 -0
  41. package/dist/lists/CredentialList.d.ts +35 -3
  42. package/dist/lists/EndpointList.d.ts +2 -1
  43. package/dist/lists/WorkflowList.d.ts +2 -1
  44. package/dist/lists.d.ts +2 -0
  45. package/dist/lists.mjs +2185 -1615
  46. package/dist/lists.mjs.map +1 -1
  47. package/dist/rail.mjs +1 -1
  48. package/dist/repos/callables.d.ts +23 -0
  49. package/dist/repos/fields.d.ts +4 -1
  50. package/dist/repos.mjs +287 -284
  51. package/dist/settings-rail-BjsTjg2u.js +22 -0
  52. package/dist/settings-rail-BjsTjg2u.js.map +1 -0
  53. package/dist/spec-export-BtnoV0ex.js +33 -0
  54. package/dist/spec-export-BtnoV0ex.js.map +1 -0
  55. package/dist/spec-import-CGPqUUjN.js +272 -0
  56. package/dist/spec-import-CGPqUUjN.js.map +1 -0
  57. package/dist/{use-callable-draft-DCauHt5o.js → use-callable-draft-DjW7_9qb.js} +8 -7
  58. package/dist/{use-callable-draft-DCauHt5o.js.map → use-callable-draft-DjW7_9qb.js.map} +1 -1
  59. package/package.json +5 -5
  60. package/src/styles.css +221 -10
  61. package/dist/WorkflowEditor-CBUwh85L.js +0 -1117
  62. package/dist/WorkflowEditor-CBUwh85L.js.map +0 -1
  63. package/dist/callables-tOlflvbl.js +0 -151
  64. package/dist/callables-tOlflvbl.js.map +0 -1
  65. package/dist/document-sources-DNmBojx6.js.map +0 -1
  66. package/dist/editor-tools--Y3wlBZE.js.map +0 -1
  67. package/dist/endpoints-DArAqoLT.js +0 -233
  68. package/dist/endpoints-DArAqoLT.js.map +0 -1
  69. package/dist/fields-DvS8XZFc.js +0 -21
  70. package/dist/fields-DvS8XZFc.js.map +0 -1
  71. package/dist/settings-rail--GdRMusb.js +0 -33
  72. package/dist/settings-rail--GdRMusb.js.map +0 -1
  73. package/dist/spec-export-DMMET5VM.js +0 -189
  74. package/dist/spec-export-DMMET5VM.js.map +0 -1
  75. package/dist/spec-import-0B6oUewa.js +0 -116
  76. package/dist/spec-import-0B6oUewa.js.map +0 -1
package/dist/editors.mjs CHANGED
@@ -2,24 +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-CBUwh85L.js";
6
- import { W as Wt } from "./WorkflowEditor-CBUwh85L.js";
5
+ import { H as sn, E as on, B as rn, a as Re, J as xe, b as De } from "./WorkflowEditor-B-Wc_r4X.js";
6
+ import { W as Wt } from "./WorkflowEditor-B-Wc_r4X.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-CCIgA7pR.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 } from "./spec-import-0B6oUewa.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
- import { k as kn, i as wn } from "./apps-FMcQfyL2.js";
16
- import { C as Nn, c as Ae } from "./editor-tools--Y3wlBZE.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-CCYi9deY.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-DArAqoLT.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";
15
+ import { k as Nn, i as Cn } from "./apps-FMcQfyL2.js";
16
+ import { C as Sn, c as Ae } from "./editor-tools-Ch1cAE4F.js";
17
+ import { a as En, b as In } from "./use-callable-draft-DjW7_9qb.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 { h as qe, b as jn, e as Mn } from "./spec-export-DMMET5VM.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";
23
23
  import { useQueryClient as we } from "@tanstack/react-query";
24
24
  import { o as $e, a1 as Jn, a0 as Ln } from "./workflows-Dz8LMjnt.js";
25
25
  import { SECRET_MASK as Wn } from "@w6w/sdk/console";
@@ -41,7 +41,7 @@ function Hn(t) {
41
41
  return "plaintext";
42
42
  }
43
43
  }
44
- function Ot({
44
+ function At({
45
45
  documentId: t,
46
46
  project: i,
47
47
  onDeleted: a,
@@ -159,7 +159,7 @@ function Ve({
159
159
  );
160
160
  }
161
161
  function _n({ kind: t, id: i, onOpenRun: a }) {
162
- const { hasExecuted: h } = kn(i), [d, n] = g(!1), c = _(null), I = _(!1);
162
+ const { hasExecuted: h } = Nn(i), [d, n] = g(!1), c = _(null), I = _(!1);
163
163
  return se(() => {
164
164
  var v;
165
165
  I.current && !d && ((v = c.current) == null || v.focus()), I.current = d;
@@ -206,18 +206,18 @@ function be(t) {
206
206
  ...h,
207
207
  key: String(t.key ?? "").trim()
208
208
  };
209
- xn(i) && (d.target = i);
210
- const n = Je(a ?? [], { emptyMeansPassthrough: !0 });
209
+ Bn(i) && (d.target = i);
210
+ const n = Me(a ?? [], { emptyMeansPassthrough: !0 });
211
211
  return n !== void 0 && (d.input = n), d;
212
212
  }
213
- function ze(t) {
213
+ function Ge(t) {
214
214
  return t && t.length > 1 ? t : void 0;
215
215
  }
216
- function zn(t, i) {
217
- const a = ze(t);
216
+ function Gn(t, i) {
217
+ const a = Ge(t);
218
218
  return a ? a.find((h) => h.domain === i) ?? a.find((h) => h.default) ?? a[0] : null;
219
219
  }
220
- function Gn(t, i, a) {
220
+ function zn(t, i, a) {
221
221
  return t ?? {
222
222
  url: i ?? "",
223
223
  urlByKey: a,
@@ -227,7 +227,7 @@ function Gn(t, i, a) {
227
227
  const Xn = (t) => t instanceof Error ? t.message : String(t);
228
228
  function Zn(t) {
229
229
  var y;
230
- const { kind: i, id: a, onError: h } = t, d = qe(i, a, !0), n = jn(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";
231
231
  async function m() {
232
232
  h(null), I(!0);
233
233
  try {
@@ -257,8 +257,8 @@ function Zn(t) {
257
257
  }
258
258
  );
259
259
  }
260
- function Ge(t) {
261
- const i = Oe(t.kind), [a, h] = g(null), d = t.slots, n = (d == null ? void 0 : d.backLabel) ?? i.editor.backLabel, c = () => t.onNavigate({ type: "list" });
260
+ function ze(t) {
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" });
262
262
  return t.notFound ? /* @__PURE__ */ o("div", { children: [
263
263
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: c, children: n }),
264
264
  /* @__PURE__ */ o("div", { className: "card", children: [
@@ -469,10 +469,10 @@ function ge(t) {
469
469
  ] });
470
470
  }
471
471
  function tt(t) {
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 = Fn(), 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 () => {
473
473
  const u = {};
474
474
  for (const r of a) {
475
- const b = Le(r.type, h[r.key] ?? "");
475
+ const b = Je(r.type, h[r.key] ?? "");
476
476
  b !== void 0 && (u[r.key] = b);
477
477
  }
478
478
  m(!0);
@@ -597,7 +597,7 @@ function Xe(t) {
597
597
  value: m.type,
598
598
  "aria-label": "Input type",
599
599
  onChange: (s) => v(y, { type: s.target.value }),
600
- children: Dn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
600
+ children: Rn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
601
601
  }
602
602
  ),
603
603
  /* @__PURE__ */ o("label", { className: "row", style: { gap: 4, alignItems: "center" }, children: [
@@ -639,7 +639,7 @@ const at = ["action", "function", "workflow", "endpoint"], it = {
639
639
  };
640
640
  function Ze(t) {
641
641
  var F;
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 = 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(
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(
643
643
  [{ id: "target", uses: h }],
644
644
  () => y ? { state: "ready", ids: s } : void 0
645
645
  ).length, u = _({ id: a, had: !1 });
@@ -667,7 +667,7 @@ function Ze(t) {
667
667
  ) : null;
668
668
  }
669
669
  function en(t) {
670
- var G, q, le;
670
+ var z, q, le;
671
671
  const {
672
672
  allowedKinds: i,
673
673
  excludeCallableIds: a,
@@ -681,7 +681,7 @@ function en(t) {
681
681
  function u(l) {
682
682
  d(l);
683
683
  }
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 = Kn(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);
685
685
  se(() => {
686
686
  let l = !1;
687
687
  return import("@w6w/ui/flow").then((E) => {
@@ -690,31 +690,31 @@ function en(t) {
690
690
  l = !0;
691
691
  };
692
692
  }, []);
693
- const Q = wn(b, b !== ""), K = _e(b, b !== ""), oe = He(
693
+ const Q = Cn(b, b !== ""), K = _e(b, b !== ""), oe = He(
694
694
  [{ id: "target", uses: r == null ? void 0 : r.uses }],
695
695
  () => K.isSuccess && !K.isFetching ? { state: "ready", ids: new Set((K.data ?? []).map((l) => l.id)) } : void 0
696
696
  ).length > 0, R = L(
697
697
  () => (Q.data ?? []).find((l) => l.key === F),
698
698
  [Q.data, F]
699
- ), $ = ["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(() => {
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(() => {
700
700
  var l, E, w;
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 ? Tn(
702
- (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,
703
703
  W
704
704
  ) : [] : s === "endpoint" ? ve(((w = Z.data) == null ? void 0 : w.endpoint.input) ?? []) : [];
705
705
  }, [
706
706
  s,
707
707
  R,
708
708
  Y.data,
709
- z.data,
709
+ G.data,
710
710
  Z.data,
711
711
  W
712
712
  ]);
713
713
  se(() => {
714
- n == null || n({ meta: { kind: s, ref: s === "action" ? b : k }, kind: s, fields: O });
715
- }, [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]);
716
716
  function X(l) {
717
- if (l.uses.app === Nn) {
717
+ if (l.uses.app === Sn) {
718
718
  const T = l.with ?? {}, M = T.targetKind === "workflow" ? "workflow" : "function", p = typeof T.targetId == "string" ? T.targetId : "";
719
719
  if (!p) return;
720
720
  u(
@@ -759,8 +759,8 @@ function en(t) {
759
759
  const l = (R == null ? void 0 : R.params) ?? [], E = (r == null ? void 0 : r.with) ?? {};
760
760
  return l.filter((w) => {
761
761
  if (w.showIf) {
762
- const { field: T, equals: M, in: p, notIn: A, truthy: ue } = w.showIf, ie = E[T];
763
- 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;
764
764
  }
765
765
  const J = w.key in E && E[w.key] !== "" && E[w.key] !== void 0;
766
766
  return w.required || J;
@@ -788,7 +788,7 @@ function en(t) {
788
788
  /* @__PURE__ */ e("strong", { children: (R == null ? void 0 : R.title) ?? F }),
789
789
  " ",
790
790
  /* @__PURE__ */ e("code", { className: "muted", children: b }),
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 = (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" })
792
792
  ] }),
793
793
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
794
794
  ] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () => m(!0), children: "+ Choose an action" }),
@@ -913,7 +913,7 @@ function jt(t) {
913
913
  }
914
914
  function ot(t) {
915
915
  var Ne;
916
- const { id: i, onNavigate: a, slots: h } = t, d = Oe("endpoint"), n = Me(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);
917
917
  v.current = c;
918
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) => {
919
919
  const H = ce(C), j = Ee({
@@ -922,7 +922,7 @@ function ot(t) {
922
922
  fields: v.current
923
923
  });
924
924
  return j.length > 0 ? `The target needs: ${j.join(", ")}` : null;
925
- }, []), S = Cn({ id: i, saveGuard: re }), f = L(
925
+ }, []), S = En({ id: i, saveGuard: re }), f = L(
926
926
  () => S.definition ? ce(S.definition) : null,
927
927
  [S.definition]
928
928
  ), x = (f == null ? void 0 : f.input) ?? [], Y = Ze({
@@ -930,16 +930,16 @@ function ot(t) {
930
930
  id: i,
931
931
  uses: (f == null ? void 0 : f.target.kind) === "action" ? f.target.uses : void 0,
932
932
  dirty: S.dirty
933
- }), 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) ?? {
934
934
  auth: "platform"
935
- }, Z = ze(n == null ? void 0 : n.invokeUrls), O = zn(n == null ? void 0 : n.invokeUrls, P);
935
+ }, Z = Ge(n == null ? void 0 : n.invokeUrls), A = Gn(n == null ? void 0 : n.invokeUrls, P);
936
936
  Ae({
937
937
  kind: "endpoint",
938
938
  id: i,
939
939
  label: (f == null ? void 0 : f.displayName) || void 0,
940
940
  key: (f == null ? void 0 : f.key.trim()) || void 0,
941
- invokeUrl: O ? O.url : n == null ? void 0 : n.invokeUrl,
942
- 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,
943
943
  urlForm: y,
944
944
  inputs: c.map((C) => C.key),
945
945
  policy: S.policy,
@@ -968,33 +968,33 @@ function ot(t) {
968
968
  }
969
969
  se(() => {
970
970
  if (N.current) {
971
- if (!We({ rows: x, touched: m.current })) {
971
+ if (!Le({ rows: x, touched: m.current })) {
972
972
  N.current = !1;
973
973
  return;
974
974
  }
975
- c.length !== 0 && (U({ input: Qe(x, c) }), N.current = !1);
975
+ c.length !== 0 && (U({ input: We(x, c) }), N.current = !1);
976
976
  }
977
977
  }, [c]);
978
978
  const te = L(
979
979
  () => ({ inputs: x.map((C) => C.key).filter(Boolean) }),
980
980
  [x]
981
981
  ), ae = L(
982
- () => Ue(x, c),
982
+ () => Qe(x, c),
983
983
  [x, c]
984
- ), G = L(
984
+ ), z = L(
985
985
  () => f ? Ee({
986
986
  target: f.target,
987
987
  rows: x,
988
988
  fields: c
989
989
  }) : [],
990
990
  [f, x, c]
991
- ), 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: [
992
992
  "Can’t save yet — the target needs",
993
993
  " ",
994
994
  f.target.kind === "action" ? "these required params mapped under Input mapping" : "these required keys declared under Input",
995
995
  ": ",
996
- /* @__PURE__ */ e("strong", { children: G.join(", ") })
997
- ] }) : 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;
998
998
  async function E() {
999
999
  if (!f) return;
1000
1000
  const C = await S.commit(be(f));
@@ -1023,16 +1023,16 @@ function ot(t) {
1023
1023
  return /* @__PURE__ */ e("div", { className: "error", role: "alert", children: de(M) });
1024
1024
  if (!p) return /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" });
1025
1025
  }
1026
- 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: [
1027
1027
  S.stale ? de(S.error) : "This endpoint was changed elsewhere. Reload to see the new version (your edits will be discarded).",
1028
1028
  " ",
1029
1029
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => void S.reload(), children: "Reload" })
1030
1030
  ] }) : null;
1031
1031
  return /* @__PURE__ */ e(Te, { value: te, children: /* @__PURE__ */ e(
1032
- Ge,
1032
+ ze,
1033
1033
  {
1034
1034
  kind: "endpoint",
1035
- title: A,
1035
+ title: O,
1036
1036
  incomplete: !1,
1037
1037
  canSave: l,
1038
1038
  isSaving: S.saving,
@@ -1081,9 +1081,9 @@ function ot(t) {
1081
1081
  /* @__PURE__ */ e(
1082
1082
  et,
1083
1083
  {
1084
- 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),
1085
1085
  domainOptions: Z,
1086
- urlDomain: (O == null ? void 0 : O.domain) ?? null,
1086
+ urlDomain: (A == null ? void 0 : A.domain) ?? null,
1087
1087
  onUrlDomain: u,
1088
1088
  urlForm: y,
1089
1089
  onUrlForm: s
@@ -1122,7 +1122,7 @@ function ot(t) {
1122
1122
  onResolved: (C) => I(C.fields)
1123
1123
  }
1124
1124
  ),
1125
- /* @__PURE__ */ e(nt, { security: z, onPatch: ee }),
1125
+ /* @__PURE__ */ e(nt, { security: G, onPatch: ee }),
1126
1126
  /* @__PURE__ */ e(tt, { id: i, inputs: x, saveFirst: w }),
1127
1127
  /* @__PURE__ */ o(
1128
1128
  "div",
@@ -1150,7 +1150,7 @@ function ot(t) {
1150
1150
  }
1151
1151
  ),
1152
1152
  r && /* @__PURE__ */ e(
1153
- En,
1153
+ Fn,
1154
1154
  {
1155
1155
  initial: {
1156
1156
  key: f.key,
@@ -1171,7 +1171,7 @@ function ot(t) {
1171
1171
  {
1172
1172
  open: B,
1173
1173
  onClose: () => W(!1),
1174
- title: `JSON — ${A}`,
1174
+ title: `JSON — ${O}`,
1175
1175
  mode: "disconnected",
1176
1176
  value: V,
1177
1177
  onChange: Q,
@@ -1210,12 +1210,12 @@ function Mt(t) {
1210
1210
  );
1211
1211
  }
1212
1212
  function lt(t) {
1213
- const i = Sn({ id: t.functionId });
1213
+ const i = In({ id: t.functionId });
1214
1214
  return /* @__PURE__ */ e(dt, { ...t, draft: i }, t.functionId);
1215
1215
  }
1216
1216
  function dt(t) {
1217
1217
  var M;
1218
- 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({
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({
1219
1219
  kind: "function",
1220
1220
  id: i,
1221
1221
  uses: (m == null ? void 0 : m.kind) === "action" ? m.uses : void 0,
@@ -1230,59 +1230,59 @@ function dt(t) {
1230
1230
  policy: a.policy,
1231
1231
  onPolicyChange: a.onPolicyChange
1232
1232
  });
1233
- 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);
1234
1234
  se(() => {
1235
1235
  if (R.current) {
1236
- if (!We({ rows: c, touched: $.current })) {
1236
+ if (!Le({ rows: c, touched: $.current })) {
1237
1237
  R.current = !1;
1238
1238
  return;
1239
1239
  }
1240
- K.length !== 0 && (Q({ inputs: Qe(c, K) }), R.current = !1);
1240
+ K.length !== 0 && (Q({ inputs: We(c, K) }), R.current = !1);
1241
1241
  }
1242
1242
  }, [K]);
1243
1243
  const re = L(
1244
- () => Ue(c, K),
1244
+ () => Qe(c, K),
1245
1245
  [c, K]
1246
1246
  ), S = L(
1247
1247
  () => ({ inputs: c.map((p) => p.key).filter(Boolean) }),
1248
1248
  [c]
1249
1249
  );
1250
1250
  function f(p) {
1251
- R.current = !0, Q({ impl: On(n == null ? void 0 : n.impl, p) });
1251
+ R.current = !0, Q({ impl: Tn(n == null ? void 0 : n.impl, p) });
1252
1252
  }
1253
1253
  const x = L(
1254
- () => An({ impl: n == null ? void 0 : n.impl, fields: K }),
1254
+ () => Kn({ impl: n == null ? void 0 : n.impl, fields: K }),
1255
1255
  [n == null ? void 0 : n.impl, K]
1256
1256
  ), Y = !!V && x.length === 0 && a.canSave;
1257
- function z() {
1257
+ function G() {
1258
1258
  return {
1259
1259
  ...n,
1260
1260
  key: V,
1261
- inputs: Je(c, { emptyMeansPassthrough: !1 })
1261
+ inputs: Me(c, { emptyMeansPassthrough: !1 })
1262
1262
  };
1263
1263
  }
1264
1264
  async function Z() {
1265
1265
  b(null), k(!1);
1266
- const p = await a.commit(z());
1266
+ const p = await a.commit(G());
1267
1267
  p.status === "saved" || p.status === "clean" ? k(!0) : p.status === "blocked" && b(p.reason);
1268
1268
  }
1269
- async function O() {
1270
- return a.dirty ? Y ? a.commit(z()) : {
1269
+ async function A() {
1270
+ return a.dirty ? Y ? a.commit(G()) : {
1271
1271
  status: "blocked",
1272
1272
  reason: "Fix the highlighted problems, then save, to test this Function."
1273
1273
  } : { status: "clean" };
1274
1274
  }
1275
- 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);
1276
1276
  function le() {
1277
- const p = z();
1277
+ const p = G();
1278
1278
  ne(JSON.stringify(p, null, 2)), ae({ id: String(p.id), key: String(p.key) }), q(null), U(!0);
1279
1279
  }
1280
1280
  async function l() {
1281
1281
  const p = me(ee, te);
1282
1282
  if (!p.parsed || p.blockedReason) return;
1283
1283
  k(!1);
1284
- const A = await a.commit(p.parsed);
1285
- 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));
1286
1286
  }
1287
1287
  const E = he(async () => {
1288
1288
  W(!0);
@@ -1293,7 +1293,7 @@ function dt(t) {
1293
1293
  }
1294
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";
1295
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(
1296
- Ge,
1296
+ ze,
1297
1297
  {
1298
1298
  kind: "function",
1299
1299
  title: T,
@@ -1305,7 +1305,7 @@ function dt(t) {
1305
1305
  notFound: s,
1306
1306
  onNavigate: h,
1307
1307
  slots: d,
1308
- publish: { id: i, saveFirst: O, disabled: !Y || !v },
1308
+ publish: { id: i, saveFirst: A, disabled: !Y || !v },
1309
1309
  headerActions: n && /* @__PURE__ */ o(D, { children: [
1310
1310
  /* @__PURE__ */ e(Ye, { kind: "function", id: i }),
1311
1311
  /* @__PURE__ */ e(De, { onClick: le })
@@ -1394,11 +1394,11 @@ function dt(t) {
1394
1394
  inputs: c,
1395
1395
  disabled: !v,
1396
1396
  invalid: !v,
1397
- saveFirst: O
1397
+ saveFirst: A
1398
1398
  }
1399
1399
  ),
1400
1400
  P && /* @__PURE__ */ e(
1401
- In,
1401
+ Pn,
1402
1402
  {
1403
1403
  initial: {
1404
1404
  key: n.key,
@@ -1423,7 +1423,7 @@ function dt(t) {
1423
1423
  guard: (p) => me(p, te).blockedReason,
1424
1424
  onSave: () => void l(),
1425
1425
  saving: a.saving,
1426
- error: G,
1426
+ error: z,
1427
1427
  editorLabel: "Function definition JSON"
1428
1428
  }
1429
1429
  )
@@ -1432,11 +1432,11 @@ function dt(t) {
1432
1432
  ) }) });
1433
1433
  }
1434
1434
  function ct(t) {
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 = Rn();
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();
1436
1436
  async function P() {
1437
1437
  const u = {};
1438
1438
  for (const r of a) {
1439
- const b = Le(r.type, h[r.key] ?? "");
1439
+ const b = Je(r.type, h[r.key] ?? "");
1440
1440
  b !== void 0 && (u[r.key] = b);
1441
1441
  }
1442
1442
  m(!0);
@@ -1517,7 +1517,7 @@ function ct(t) {
1517
1517
  ] });
1518
1518
  }
1519
1519
  export {
1520
- Ot as DocumentEditor,
1520
+ At as DocumentEditor,
1521
1521
  jt as EndpointEditor,
1522
1522
  Mt as FunctionEditor,
1523
1523
  Wt as WorkflowEditor
@@ -0,0 +1,136 @@
1
+ import { useQueryClient as c, useMutation as s } from "@tanstack/react-query";
2
+ import { path as d } from "@w6w/sdk";
3
+ import { u as a } from "./client-context-CX61Bgw-.js";
4
+ import { a as l, c as f, p, r as m, u as b, q as F, i as r, v as M } from "./callables-B49tS2vv.js";
5
+ import "@w6w/sdk/console";
6
+ const h = f("function"), w = "2";
7
+ function Q(n) {
8
+ return n.console.functions.list();
9
+ }
10
+ function K(n = !0) {
11
+ return F("function", n);
12
+ }
13
+ const v = (n) => l("function", n);
14
+ function O(n, t) {
15
+ return n.console.functions.get(t);
16
+ }
17
+ function T(n, t = !0) {
18
+ return b("function", n, t);
19
+ }
20
+ function g() {
21
+ return M("function");
22
+ }
23
+ function A() {
24
+ const n = a(), t = c();
25
+ return s({
26
+ mutationFn: (i) => n.console.functions.upsert(i.definition, {
27
+ ifUnmodifiedSince: i.ifUnmodifiedSince
28
+ }),
29
+ onSuccess: (i) => r(t, h, v(i.id))
30
+ });
31
+ }
32
+ function E(n, t, i, e) {
33
+ const u = { inputs: i };
34
+ return (e == null ? void 0 : e.allowUnpublished) === !0 && (u.allowUnpublished = !0), n.request({
35
+ method: "POST",
36
+ path: d`/functions/${t}/invoke`,
37
+ body: u
38
+ }).then(({ body: o }) => ({
39
+ output: o.output,
40
+ invocationId: o.invocationId,
41
+ status: o.status,
42
+ durationMs: o.durationMs
43
+ }));
44
+ }
45
+ function D() {
46
+ const n = a();
47
+ return s({
48
+ mutationFn: (t) => E(n, t.id, t.inputs, { allowUnpublished: !0 })
49
+ });
50
+ }
51
+ function _() {
52
+ return p("function");
53
+ }
54
+ function P() {
55
+ return m("function");
56
+ }
57
+ function x(n) {
58
+ return n.status !== void 0 ? n.status !== "ready" : n.incomplete === !0;
59
+ }
60
+ const G = "2", S = f("endpoint");
61
+ function L(n = !0) {
62
+ return F("endpoint", n);
63
+ }
64
+ function R(n, t) {
65
+ return n.console.endpoints.get(t);
66
+ }
67
+ const y = (n) => l("endpoint", n);
68
+ function V(n, t = !0) {
69
+ return b("endpoint", n, t);
70
+ }
71
+ function $() {
72
+ const n = a(), t = c();
73
+ return s({
74
+ // Same widening as `getEndpoint` — the save's 201 carries `invokeUrls[]` too.
75
+ mutationFn: (i) => n.console.endpoints.upsert(i),
76
+ onSuccess: (i) => r(t, S, y(i.endpoint.id))
77
+ });
78
+ }
79
+ function j() {
80
+ const n = a(), t = c();
81
+ return s({
82
+ mutationFn: (i) => n.console.endpoints.upsert(i.definition, {
83
+ ifUnmodifiedSince: i.ifUnmodifiedSince
84
+ }),
85
+ onSuccess: (i) => r(t, S, y(i.endpoint.id))
86
+ });
87
+ }
88
+ function C(n, t, i, e) {
89
+ const u = { input: i };
90
+ return (e == null ? void 0 : e.allowUnpublished) === !0 && (u.allowUnpublished = !0), n.request({
91
+ method: "POST",
92
+ path: d`/endpoints/${t}/invoke`,
93
+ body: u
94
+ }).then((o) => o.body);
95
+ }
96
+ function z() {
97
+ const n = a();
98
+ return s({
99
+ mutationFn: (t) => C(n, t.id, t.input, { allowUnpublished: !0 })
100
+ });
101
+ }
102
+ function B() {
103
+ return p("endpoint");
104
+ }
105
+ function H() {
106
+ return m("endpoint");
107
+ }
108
+ export {
109
+ G as E,
110
+ w as F,
111
+ $ as a,
112
+ K as b,
113
+ g as c,
114
+ S as d,
115
+ y as e,
116
+ v as f,
117
+ h as g,
118
+ R as h,
119
+ O as i,
120
+ C as j,
121
+ E as k,
122
+ x as l,
123
+ Q as m,
124
+ B as n,
125
+ _ as o,
126
+ H as p,
127
+ P as q,
128
+ V as r,
129
+ T as s,
130
+ j as t,
131
+ L as u,
132
+ A as v,
133
+ z as w,
134
+ D as x
135
+ };
136
+ //# sourceMappingURL=endpoints-zOuwci2U.js.map