@w6w/embed 0.2.0 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
  2. package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
  3. package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
  4. package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
  5. package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
  6. package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
  7. package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
  8. package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
  9. package/dist/ModelRoutesManager-BGESQahw.js +345 -0
  10. package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
  11. package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
  12. package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
  13. package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
  14. package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
  15. package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
  16. package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
  17. package/dist/chrome/ConfirmModal.d.ts +4 -1
  18. package/dist/chrome/workspace.d.ts +4 -0
  19. package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
  20. package/dist/coerce-input-DttlcSdO.js.map +1 -0
  21. package/dist/connections-D7cgXhDS.js +119 -0
  22. package/dist/connections-D7cgXhDS.js.map +1 -0
  23. package/dist/credentials-DaQU3Ca_.js +171 -0
  24. package/dist/credentials-DaQU3Ca_.js.map +1 -0
  25. package/dist/document-sources-UCwe8x77.js +91 -0
  26. package/dist/document-sources-UCwe8x77.js.map +1 -0
  27. package/dist/draft.mjs +1 -1
  28. package/dist/editor/BindingBanner.d.ts +13 -0
  29. package/dist/editor/CallableEditorFrame.d.ts +7 -0
  30. package/dist/editor/EndpointCards.d.ts +4 -1
  31. package/dist/editor/PublishControl.d.ts +19 -0
  32. package/dist/editor/TargetSelector.d.ts +15 -0
  33. package/dist/editor/TargetSelector.types.d.ts +2 -0
  34. package/dist/editor/definition.d.ts +2 -0
  35. package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
  36. package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
  37. package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
  38. package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
  39. package/dist/editor.mjs +1 -1
  40. package/dist/editors.mjs +769 -622
  41. package/dist/editors.mjs.map +1 -1
  42. package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
  43. package/dist/endpoints-DSRo1Lc5.js.map +1 -0
  44. package/dist/fields-DvS8XZFc.js +21 -0
  45. package/dist/fields-DvS8XZFc.js.map +1 -0
  46. package/dist/forms/ModelBudgetsManager.d.ts +9 -0
  47. package/dist/forms/ModelRoutesManager.d.ts +14 -0
  48. package/dist/forms.d.ts +4 -0
  49. package/dist/forms.mjs +611 -212
  50. package/dist/forms.mjs.map +1 -1
  51. package/dist/index.mjs +119 -112
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/lib/binding-problems.d.ts +38 -0
  54. package/dist/lib/code-rail.d.ts +4 -2
  55. package/dist/lib/index.d.ts +1 -0
  56. package/dist/lib/invoke-error.d.ts +1 -0
  57. package/dist/lib/sdk-snippets.d.ts +1 -1
  58. package/dist/lib/target-fields.d.ts +8 -0
  59. package/dist/lib/trigger-preview.d.ts +1 -0
  60. package/dist/lib/workflow-live-run.d.ts +9 -2
  61. package/dist/lib/workflow-nodes.d.ts +5 -0
  62. package/dist/lib/workflow-validity.d.ts +1 -0
  63. package/dist/lib.mjs +72 -70
  64. package/dist/lists/ConnectionDependents.d.ts +31 -0
  65. package/dist/lists/ConnectionDetail.d.ts +4 -1
  66. package/dist/lists/ConnectionList.d.ts +4 -1
  67. package/dist/lists/CredentialDetail.d.ts +15 -0
  68. package/dist/lists/CredentialList.d.ts +14 -0
  69. package/dist/lists/ModelCatalog.d.ts +12 -0
  70. package/dist/lists/ModelUsage.d.ts +12 -0
  71. package/dist/lists.d.ts +8 -0
  72. package/dist/lists.mjs +1322 -604
  73. package/dist/lists.mjs.map +1 -1
  74. package/dist/models-bAayQPJ_.js +270 -0
  75. package/dist/models-bAayQPJ_.js.map +1 -0
  76. package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
  77. package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
  78. package/dist/rail.mjs +4 -4
  79. package/dist/repos/agents-studio-agents.d.ts +52 -0
  80. package/dist/repos/agents-studio-assets.d.ts +68 -0
  81. package/dist/repos/connections.d.ts +30 -12
  82. package/dist/repos/credentials.d.ts +83 -0
  83. package/dist/repos/endpoints.d.ts +9 -3
  84. package/dist/repos/fields.d.ts +34 -0
  85. package/dist/repos/functions.d.ts +7 -5
  86. package/dist/repos/index.d.ts +5 -0
  87. package/dist/repos/models.d.ts +289 -0
  88. package/dist/repos.mjs +613 -176
  89. package/dist/repos.mjs.map +1 -1
  90. package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
  91. package/dist/slug-BVdgiP_L.js.map +1 -0
  92. package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
  93. package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
  94. package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
  95. package/dist/spec-import-CW6R_Wk1.js.map +1 -0
  96. package/dist/theme-context-E2ZhlXDX.js +6 -0
  97. package/dist/theme-context-E2ZhlXDX.js.map +1 -0
  98. package/dist/theme-context.d.ts +2 -0
  99. package/dist/trigger-preview-DKxfjzUY.js +145 -0
  100. package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
  101. package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
  102. package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
  103. package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
  104. package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
  105. package/package.json +1 -1
  106. package/src/styles.css +2 -6
  107. package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
  108. package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
  109. package/dist/coerce-input-BicYr7nc.js.map +0 -1
  110. package/dist/connections-CjjYeRqb.js +0 -78
  111. package/dist/connections-CjjYeRqb.js.map +0 -1
  112. package/dist/document-sources-C0grrtdq.js +0 -86
  113. package/dist/document-sources-C0grrtdq.js.map +0 -1
  114. package/dist/editor-tools-RxmY5iyi.js.map +0 -1
  115. package/dist/endpoints-B2ynbZo-.js.map +0 -1
  116. package/dist/slug-C4ktDPdy.js.map +0 -1
  117. package/dist/spec-import-CjmxyZDR.js.map +0 -1
  118. package/dist/trigger-preview-VPkrryDl.js +0 -120
  119. package/dist/trigger-preview-VPkrryDl.js.map +0 -1
@@ -1,16 +1,27 @@
1
1
  function y(n) {
2
2
  return n.kind === "action" ? "" : n.kind === "endpoint" ? n.endpoint : n.kind === "function" ? n.function : n.workflow;
3
3
  }
4
- function q(n) {
4
+ function F(n) {
5
5
  return n.kind === "action" ? !!(n.uses.app && n.uses.action) : !!y(n);
6
6
  }
7
- function I(n) {
7
+ function S(n) {
8
8
  return n ? n.kind === "function" ? { kind: "function", function: n.function } : n.kind === "workflow" ? { kind: "workflow", workflow: n.workflow } : { kind: "action", uses: n.uses, with: n.with } : { kind: "action", uses: { app: "", action: "", connection: null }, with: {} };
9
9
  }
10
- function F(n) {
10
+ function k(n) {
11
11
  return n.kind === "action" ? { uses: n.uses, with: n.with ?? {} } : { ...n, with: {} };
12
12
  }
13
- function g(n) {
13
+ function T(n, e) {
14
+ const t = k(e);
15
+ if (!(n != null && n.outputMap)) return t;
16
+ const i = n.kind ?? "action";
17
+ let o = !1;
18
+ if (i === "action" && e.kind === "action") {
19
+ const u = n;
20
+ o = u.uses.app === e.uses.app && u.uses.action === e.uses.action;
21
+ } else i === "function" && e.kind === "function" ? o = n.function === e.function : i === "workflow" && e.kind === "workflow" && (o = n.workflow === e.workflow);
22
+ return o ? { ...t, outputMap: n.outputMap } : t;
23
+ }
24
+ function N(n) {
14
25
  return n.map((e) => {
15
26
  const t = {
16
27
  key: e.key,
@@ -22,86 +33,86 @@ function g(n) {
22
33
  return e.showIf !== void 0 && (t.showIf = e.showIf), t;
23
34
  });
24
35
  }
25
- function S(n, e) {
26
- var u, s;
27
- const t = Array.isArray(n == null ? void 0 : n.steps) ? n.steps : [], i = /* @__PURE__ */ new Set(), r = [];
28
- for (const o of t) {
29
- const c = (u = o == null ? void 0 : o.uses) == null ? void 0 : u.app;
30
- if (typeof c != "string" || !e.isTriggerApp(c)) continue;
31
- const p = e.asFieldDefs((s = o == null ? void 0 : o.with) == null ? void 0 : s.fields);
32
- for (const d of p) {
33
- const f = d.key;
34
- typeof f != "string" || f.trim() === "" || i.has(f) || (i.add(f), r.push({ key: f, label: f, type: d.type ?? "string", required: d.required }));
36
+ function j(n, e) {
37
+ var r, s;
38
+ const t = (n == null ? void 0 : n.nodes) ?? (n == null ? void 0 : n.steps), i = Array.isArray(t) ? t : [], o = /* @__PURE__ */ new Set(), u = [];
39
+ for (const f of i) {
40
+ const l = (r = f == null ? void 0 : f.uses) == null ? void 0 : r.app;
41
+ if (typeof l != "string" || !e.isTriggerApp(l)) continue;
42
+ const h = e.asFieldDefs((s = f == null ? void 0 : f.with) == null ? void 0 : s.fields);
43
+ for (const d of h) {
44
+ const c = d.key;
45
+ typeof c != "string" || c.trim() === "" || o.has(c) || (o.add(c), u.push({ key: c, label: c, type: d.type ?? "string", required: d.required }));
35
46
  }
36
47
  }
37
- return r;
48
+ return u;
38
49
  }
39
- const h = ["string", "text", "number", "boolean", "json", "secret"];
40
- function T(n) {
50
+ const m = ["string", "text", "number", "boolean", "json", "secret"];
51
+ function A(n) {
41
52
  return n.rows.length === 0 && !n.touched;
42
53
  }
43
- function k(n) {
44
- return h.includes(n) ? n : "string";
54
+ function b(n) {
55
+ return m.includes(n) ? n : "string";
45
56
  }
46
- function N(n, e) {
47
- const t = new Set(n.map((r) => r.key)), i = [];
48
- for (const r of e) {
49
- const u = r.key;
57
+ function M(n, e) {
58
+ const t = new Set(n.map((o) => o.key)), i = [];
59
+ for (const o of e) {
60
+ const u = o.key;
50
61
  typeof u != "string" || u.trim() === "" || t.has(u) || (t.add(u), i.push({
51
62
  key: u,
52
- label: r.label ?? u,
53
- type: k(r.type),
54
- required: !!r.required
63
+ label: o.label ?? u,
64
+ type: b(o.type),
65
+ required: !!o.required
55
66
  }));
56
67
  }
57
68
  return i.length === 0 ? n : [...n, ...i];
58
69
  }
59
- function m(n, e) {
70
+ function w(n, e) {
60
71
  const t = n.showIf;
61
72
  if (!t) return !0;
62
73
  const i = e(t.field);
63
- return t.equals !== void 0 ? i === t.equals : t.in ? t.in.some((r) => r === i) : t.notIn ? !t.notIn.some((r) => r === i) : t.truthy !== void 0 ? t.truthy ? !!i : !i : !0;
74
+ return t.equals !== void 0 ? i === t.equals : t.in ? t.in.some((o) => o === i) : t.notIn ? !t.notIn.some((o) => o === i) : t.truthy !== void 0 ? t.truthy ? !!i : !i : !0;
64
75
  }
65
- function b(n) {
76
+ function q(n) {
66
77
  return n == null ? !1 : typeof n == "string" ? n.trim() !== "" : !0;
67
78
  }
68
79
  function a(n, e, t) {
69
- const i = new Set(n.map((s) => s.key)), r = (s) => {
70
- var o;
71
- return (t == null ? void 0 : t[s]) !== void 0 ? t[s] : (o = e.find((c) => c.key === s)) == null ? void 0 : o.default;
80
+ const i = new Set(n.map((r) => r.key)), o = (r) => {
81
+ var s;
82
+ return (t == null ? void 0 : t[r]) !== void 0 ? t[r] : (s = e.find((f) => f.key === r)) == null ? void 0 : s.default;
72
83
  }, u = [];
73
- for (const s of e) {
74
- if (!s.required) continue;
75
- const o = s.key;
76
- typeof o != "string" || o.trim() === "" || i.has(o) || u.includes(o) || m(s, r) && (b(s.default) || u.push(o));
84
+ for (const r of e) {
85
+ if (!r.required) continue;
86
+ const s = r.key;
87
+ typeof s != "string" || s.trim() === "" || i.has(s) || u.includes(s) || w(r, o) && (q(r.default) || u.push(s));
77
88
  }
78
89
  return u;
79
90
  }
80
- function j(n, e) {
91
+ function R(n, e) {
81
92
  if (!(e.emptyMeansPassthrough && n.length === 0))
82
93
  return n;
83
94
  }
84
- function w(n) {
95
+ function I(n) {
85
96
  return n == null ? !1 : typeof n == "string" ? n.trim() !== "" : typeof n == "object" && "type" in n && n.type === "expr" ? !0 : typeof n == "object";
86
97
  }
87
- function l(n) {
98
+ function p(n) {
88
99
  const e = [];
89
100
  for (const t of Object.keys(n))
90
- w(n[t]) && e.push({ key: t, label: t, type: "string" });
101
+ I(n[t]) && e.push({ key: t, label: t, type: "string" });
91
102
  return e;
92
103
  }
93
- function v(n) {
104
+ function x(n) {
94
105
  const { target: e, rows: t, fields: i } = n;
95
- return e.kind === "action" ? e.with === void 0 ? [] : a(l(e.with), i, e.with) : t.length === 0 ? [] : a(t, i);
106
+ return e.kind === "action" ? e.with === void 0 ? [] : a(p(e.with), i, e.with) : t.length === 0 ? [] : a(t, i);
96
107
  }
97
- function A(n) {
108
+ function B(n) {
98
109
  return n.impl ? a(
99
- l(n.impl.with ?? {}),
110
+ p(n.impl.with ?? {}),
100
111
  n.fields,
101
112
  n.impl.with ?? {}
102
113
  ) : n.fields.filter((e) => e.required).map((e) => e.key);
103
114
  }
104
- function B(n, e) {
115
+ function P(n, e) {
105
116
  if (e !== "")
106
117
  switch (n) {
107
118
  case "number": {
@@ -121,19 +132,20 @@ function B(n, e) {
121
132
  }
122
133
  }
123
134
  export {
124
- h as I,
125
- j as a,
135
+ m as I,
136
+ R as a,
126
137
  y as b,
127
- B as c,
128
- F as d,
129
- A as e,
130
- S as f,
138
+ P as c,
139
+ k as d,
140
+ B as e,
141
+ j as f,
131
142
  a as g,
132
- I as i,
133
- N as m,
134
- g as p,
135
- T as s,
136
- q as t,
137
- v as u
143
+ T as h,
144
+ S as i,
145
+ M as m,
146
+ N as p,
147
+ A as s,
148
+ F as t,
149
+ x as u
138
150
  };
139
- //# sourceMappingURL=coerce-input-BicYr7nc.js.map
151
+ //# sourceMappingURL=coerce-input-DttlcSdO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-input-DttlcSdO.js","sources":["../src/lib/target-fields.ts","../src/lib/input-seeding.ts","../src/lib/input-coverage.ts","../src/lib/coerce-input.ts"],"sourcesContent":["/**\n * Pure helpers shared by `TargetSelector`'s three arms (rfcs/endpoint.md\n * :339-347 — `EndpointTarget = CallableRef | ActionTarget`) and by\n * `EndpointsPage`'s save gate.\n *\n * Pure and testable by design, mirroring `workflow-validity.ts`'s shape:\n * `@w6w/ui`'s `package.json` `exports[\".\"]` resolves to raw `./src/index.ts`,\n * which re-exports `.tsx` files, so `node --test` throws\n * `ERR_UNKNOWN_FILE_EXTENSION` the moment anything here imports `@w6w/ui` or\n * `@w6w/ui/flow` — even type-only. So this module declares its own local\n * structural (`*Like`) types instead of importing the real ones from\n * `../api/types.ts`, and `isTriggerApp`/`asFieldDefs` (the workflow arm's only\n * dependency on `@w6w/ui/flow`) are **caller-injected** — `TargetSelector.tsx`\n * (unaffected by the JSX constraint) imports the real ones and passes them in.\n */\n\n/** The four arms `EndpointTarget` can take; a Function's `impl` takes the\n * first three (D-8) — `\"endpoint\"` is alias-only, never legal for `Fn.impl`. */\nexport type TargetKind = \"action\" | \"function\" | \"workflow\" | \"endpoint\";\n\n/** The `action` arm — same `{ uses, with }` shape a Function's `impl` carries. */\nexport interface ActionTargetLike {\n kind: \"action\";\n uses: { app: string; action: string; connection?: string | null };\n with?: Record<string, unknown>;\n}\n\n/** The `function`/`workflow` arms — a bare ref, one hop to a CallableRef. */\nexport type CallableTargetLike =\n | { kind: \"function\"; function: string }\n | { kind: \"workflow\"; workflow: string };\n\n/** The `endpoint` arm — a bare ref to another Endpoint. Alias-only (plan.md\n * §2a): legal for `AliasDef.target`, never for an Endpoint's own `target`\n * (the server refuses it — `admin/endpoints.ts`'s `validateDefinition`). */\nexport interface EndpointRefTargetLike {\n kind: \"endpoint\";\n endpoint: string;\n}\n\n/** The full local mirror of `EndpointTarget` this module operates on. */\nexport type TargetLike = ActionTargetLike | CallableTargetLike | EndpointRefTargetLike;\n\n/**\n * The action arm of a Function's `impl` — today's `FunctionImplLike` shape,\n * plus the two fields D-8 adds: `kind?: \"action\"` (absent means \"action\",\n * unchanged for every Function stored before the union existed) and\n * `outputMap?` (mirrors the action arm's own adapter-out pass, already on\n * `FnActionImpl`/`FunctionActionImpl`).\n */\nexport interface ActionImplLike {\n kind?: \"action\";\n uses: { app: string; action: string; connection?: string | null };\n with?: Record<string, unknown>;\n outputMap?: Record<string, unknown>;\n}\n\n/**\n * A Function's `impl` (D-8, `rfcs/function.md` as amended by TC2) — bound to\n * one app Action, or to another Function/Workflow via `CallableTargetLike`\n * (reused verbatim, never a fourth local mirror), intersected with the same\n * `with`/`outputMap` adapter pair the action arm carries — field-for-field\n * `FnCallableImpl = CallableRef & {with?; outputMap?}` (TC2's pinned type).\n */\nexport type FunctionImplLike =\n | ActionImplLike\n | (CallableTargetLike & { with?: Record<string, unknown>; outputMap?: Record<string, unknown> });\n\n/** A declared action/function param, just enough of it for the projector. */\nexport interface ParamLike {\n key: string;\n label?: string;\n type?: string;\n required?: boolean;\n default?: unknown;\n showIf?: ShowIfPredicate;\n}\n\n/** Visibility predicate — mirroring ActionParam.showIf from @w6w/ui. */\nexport interface ShowIfPredicate {\n field: string;\n equals?: unknown;\n in?: unknown[];\n notIn?: unknown[];\n truthy?: boolean;\n}\n\n/** One field of a manual/webhook trigger's `with.fields` (`@w6w/ui/flow`'s `TriggerFieldDef`). */\nexport interface TriggerFieldDefLike {\n key?: string;\n type?: string;\n default?: unknown;\n required?: boolean;\n}\n\n/** A workflow graph step, just enough of it for the trigger-field union (A6). */\nexport interface WorkflowStepLike {\n uses?: { app?: string };\n with?: Record<string, unknown>;\n}\n\n/** A workflow definition, just enough of it for the trigger-field union. */\nexport interface WorkflowLike {\n nodes?: unknown;\n steps?: unknown;\n}\n\n/** Everything `fieldsFromWorkflow` needs from `@w6w/ui/flow` but cannot import itself. */\nexport interface WorkflowFieldCtx {\n /** `@w6w/ui/flow`'s `isTriggerApp`, injected by the JSX caller. */\n isTriggerApp: (app: string) => boolean;\n /** `@w6w/ui/flow`'s `asFieldDefs`, injected by the JSX caller. */\n asFieldDefs: (fields: unknown) => TriggerFieldDefLike[];\n}\n\n/** One field of the normalized list `TargetSelector` resolves to (A5). */\nexport interface TargetField {\n key: string;\n label: string;\n type: string;\n required?: boolean;\n default?: unknown;\n showIf?: ShowIfPredicate;\n}\n\n/** One row of an input-contract list (`FunctionInput`/`EndpointInput`'s common shape). */\nexport interface InputRowLike {\n key: string;\n label: string;\n type: string;\n required?: boolean;\n}\n\n/** The concrete ref (`fn_…` / `wf_…` / `ep_…`) a CallableRef/endpoint target\n * currently points at, `\"\"` for `action`. */\nexport function targetRef(target: TargetLike): string {\n if (target.kind === \"action\") return \"\";\n if (target.kind === \"endpoint\") return target.endpoint;\n return target.kind === \"function\" ? target.function : target.workflow;\n}\n\n/** Is the target fully chosen? An action needs both halves of its `uses` pair (A9). */\nexport function targetIsBound(target: TargetLike): boolean {\n if (target.kind === \"action\") return Boolean(target.uses.app && target.uses.action);\n return Boolean(targetRef(target));\n}\n\n/**\n * Adapt a Function's `impl` into the shape `TargetSelector` consumes (D-8):\n * an action impl to the `action` arm exactly as before; a CallableRef impl maps\n * its `kind`/`function`|`workflow` across UNCHANGED — deliberately dropping\n * `with`/`outputMap`, which `TargetLike`'s CallableRef arm has no slot for (they\n * survive on `draft.impl` itself; `targetToImpl` restores a default `with` on\n * the way back, so `implToTarget(targetToImpl(x))` round-trips `x`). An\n * absent impl still yields the empty action target.\n */\nexport function implToTarget(\n impl: FunctionImplLike | undefined,\n): ActionTargetLike | CallableTargetLike {\n // Draft functions have no impl yet; return an empty target\n if (!impl) {\n return { kind: \"action\", uses: { app: \"\", action: \"\", connection: null }, with: {} };\n }\n if (impl.kind === \"function\") return { kind: \"function\", function: impl.function };\n if (impl.kind === \"workflow\") return { kind: \"workflow\", workflow: impl.workflow };\n return { kind: \"action\", uses: impl.uses, with: impl.with };\n}\n\n/**\n * Inverse of {@link implToTarget}, over the widened D-8 domain. Never yields\n * `with: undefined` on EITHER arm — A10: `invoke-function.ts`'s\n * `resolveWith(impl.with, …)` call is unconditional and shared by both arms\n * (the CallableRef arm has its own `with` adapter pass onto the callee's inputs,\n * unlike `uncoveredForEndpoint`'s P3), so an unmapped `with` must still be\n * `{}`, not absent, on a CallableRef impl too.\n */\nexport function targetToImpl(target: ActionTargetLike | CallableTargetLike): FunctionImplLike {\n if (target.kind === \"action\") {\n return { uses: target.uses, with: target.with ?? {} };\n }\n return { ...target, with: {} };\n}\n\n/**\n * The `impl` a re-pick produces. `outputMap` adapts ONE binding's vendor response, so it survives\n * only while the binding identity is unchanged: the same `uses.app` + `uses.action` (action arm),\n * or the same callable kind + id (ref arm). Connection and `with` edits keep it; a different\n * action or callee drops it (rfcs/function.md: switching provider replaces `impl` wholesale).\n */\nexport function implAfterRebind(\n prev: FunctionImplLike | undefined,\n target: ActionTargetLike | CallableTargetLike,\n): FunctionImplLike {\n const next = targetToImpl(target);\n if (!prev?.outputMap) return next;\n const prevKind = prev.kind ?? \"action\";\n let same = false;\n if (prevKind === \"action\" && target.kind === \"action\") {\n const p = prev as ActionImplLike;\n same = p.uses.app === target.uses.app && p.uses.action === target.uses.action;\n } else if (prevKind === \"function\" && target.kind === \"function\") {\n same = (prev as { function: string }).function === target.function;\n } else if (prevKind === \"workflow\" && target.kind === \"workflow\") {\n same = (prev as { workflow: string }).workflow === target.workflow;\n }\n return same ? { ...next, outputMap: prev.outputMap } : next;\n}\n\n/** Project a list of action/function params into the normalized `TargetField[]` (A5). */\nexport function paramsToFields(params: ParamLike[]): TargetField[] {\n return params.map((p) => {\n const field: TargetField = {\n key: p.key,\n label: p.label ?? p.key,\n type: p.type ?? \"string\",\n required: p.required,\n default: p.default,\n };\n if (p.showIf !== undefined) {\n field.showIf = p.showIf;\n }\n return field;\n });\n}\n\n/**\n * A6: project every manual/webhook-trigger step's `with.fields` from a raw\n * workflow graph into the union of `TargetField`s, keyed by `key`, first\n * occurrence wins, order stable (planner D-2: the server broadcasts one\n * `input` object to every trigger identically). A webhook/scheduler step that\n * declares `methods`/`auth` but no `fields` contributes nothing — by reading\n * `with.fields`, not a special case. Unnamed/blank keys are skipped. `default`\n * is not carried for this arm (A5). A missing/garbage graph, or one whose\n * `isTriggerApp` predicate matches nothing, yields `[]` — never a throw.\n */\nexport function fieldsFromWorkflow(\n workflow: WorkflowLike | null | undefined,\n ctx: WorkflowFieldCtx,\n): TargetField[] {\n const rawNodes = workflow?.nodes ?? workflow?.steps;\n const steps = Array.isArray(rawNodes) ? (rawNodes as WorkflowStepLike[]) : [];\n const seen = new Set<string>();\n const out: TargetField[] = [];\n for (const step of steps) {\n const app = step?.uses?.app;\n if (typeof app !== \"string\" || !ctx.isTriggerApp(app)) continue;\n const defs = ctx.asFieldDefs(step?.with?.fields);\n for (const def of defs) {\n const key = def.key;\n if (typeof key !== \"string\" || key.trim() === \"\" || seen.has(key)) continue;\n seen.add(key);\n out.push({ key, label: key, type: def.type ?? \"string\", required: def.required });\n }\n }\n return out;\n}\n","/**\n * The seeding/coverage logic behind the shared `InputListEditor` (T3.2.1):\n * filling a Function/Endpoint's declared input list from the picked target's\n * resolved fields (`TargetSelector`'s A5/A7, `target-fields.ts`), and\n * flagging what a later target change no longer covers.\n *\n * **The policy (HITL-1, pinned).** Seed only when the input list is empty\n * AND the user has not touched it; once touched (any add/update/remove via\n * the row editor), a later target change never rewrites the list — it only\n * flags the required keys the new target no longer covers. This is the only\n * policy that cannot destroy typed work, and the flag is what T3.2.2's save\n * gate consumes.\n *\n * **Supersedes `target-fields.ts`'s `seedRowsFromFields`** — T3.1.1's\n * declared v1 stopgap (seed-a-wholly-empty-list-once, no touched/merge\n * concept). That symbol is deleted from `target-fields.ts`, not duplicated;\n * this module is its one home.\n *\n * **The pass-through guard** (the finding most likely to cause a silent\n * regression): the server dispatches an Endpoint's `action` arm on\n * `target.with === undefined` (`invoke-endpoint.ts:136-143`) — `{}` is\n * truthy, so an empty `with` does NOT pass through. `EndpointDef.input` (the\n * declared list this module seeds) is a SEPARATE field the server never\n * reads for dispatch at all, but the round-trip must still agree:\n * {@link inputsForSave} returns `undefined` (never `[]`) for an empty,\n * pass-through-mode list, so a previously authored pass-through Endpoint\n * opens and re-saves unchanged. A Function has no pass-through mode —\n * `emptyMeansPassthrough: false` never returns `undefined`, matching\n * `FunctionDef.inputs`'s non-nullable wire type (`draft.inputs.map` would\n * throw on `undefined`).\n *\n * Pure, React-free, `.ts`, no value import of `@w6w/ui` — mirrors\n * `workflow-validity.ts`/`target-fields.ts`'s shape so `node --test` can\n * load it directly (`@w6w/ui`'s barrel re-exports `.tsx`, which Node's\n * type-stripping cannot parse). `INPUT_TYPES` lives here rather than in\n * `InputListEditor.tsx` because this module's own seeding logic needs it.\n */\n\nimport type { TargetField } from \"./target-fields.ts\";\n\n/** The input-row types the two builders offer (`ActionParam`'s subset). */\nexport const INPUT_TYPES = [\"string\", \"text\", \"number\", \"boolean\", \"json\", \"secret\"] as const;\n\n/**\n * One row of an input-contract list — `FunctionInput`/`EndpointInput`'s\n * common shape (`../api/types.ts`), mirrored locally so this pure module\n * never imports a value from a `.tsx`-reexporting barrel. Structurally\n * identical to both wire types, so a page's `draft.inputs`/`draft.input`\n * needs no cast at the `InputListEditor` boundary in either direction.\n */\nexport interface InputRow {\n key: string;\n label: string;\n type: string;\n required?: boolean;\n default?: unknown;\n hint?: string;\n}\n\n/**\n * Is there a wholly empty, still-untouched list to seed? Any manual edit —\n * add, update or remove, via the row editor's own `onChange` — makes the\n * list the user's forever after (HITL-1); the seeding effect itself must\n * never be what sets `touched`.\n */\nexport function shouldSeed(args: { rows: InputRow[]; touched: boolean }): boolean {\n return args.rows.length === 0 && !args.touched;\n}\n\n/**\n * `type` is the field's own type when {@link INPUT_TYPES} declares it,\n * otherwise `\"string\"` — an unlisted type (`section`, `select`, …) would\n * otherwise render a `<select>` with no matching `<option>` and silently\n * change the value.\n */\nfunction normalizeType(type: string): string {\n return (INPUT_TYPES as readonly string[]).includes(type) ? type : \"string\";\n}\n\n/**\n * `rows` plus one appended row per `fields` key not already present, in\n * field order. **Never modifies or removes an existing row, never\n * re-orders.** A seeded row is\n * `{ key, label: field.label ?? field.key, type, required: Boolean(field.required) }`\n * and nothing else — `default`/`hint` are deliberately not copied, because\n * the row editor cannot show or remove them and they would become invisible\n * state on the saved definition. Fields with a missing/blank key are\n * skipped; a duplicate key (in `fields`, or already present in `rows`)\n * seeds once.\n */\nexport function mergeSeed(rows: InputRow[], fields: TargetField[]): InputRow[] {\n const seen = new Set(rows.map((r) => r.key));\n const appended: InputRow[] = [];\n for (const field of fields) {\n const key = field.key;\n if (typeof key !== \"string\" || key.trim() === \"\" || seen.has(key)) continue;\n seen.add(key);\n appended.push({\n key,\n label: field.label ?? key,\n type: normalizeType(field.type),\n required: Boolean(field.required),\n });\n }\n return appended.length === 0 ? rows : [...rows, ...appended];\n}\n\n/**\n * Is `field` visible under the given effective-value lookup?\n * Implements `packages/ui/src/ParamsForm.tsx:20-29`'s `isParamVisible`\n * predicate, honouring all four arms (`equals`, `in`, `notIn`, `truthy`).\n */\nfunction isFieldVisible(field: TargetField, effective: (key: string) => unknown): boolean {\n const c = field.showIf;\n if (!c) return true;\n const v = effective(c.field);\n if (c.equals !== undefined) return v === c.equals;\n if (c.in) return c.in.some((x) => x === v);\n if (c.notIn) return !c.notIn.some((x) => x === v);\n if (c.truthy !== undefined) return c.truthy ? !!v : !v;\n return true;\n}\n\n/**\n * Does `default` satisfy \"usable\"? A usable default can stand in for an\n * explicitly mapped value — `false` and `0` are usable, `undefined`/`null`\n * and whitespace-only strings are not.\n * Implements the `v === undefined || v === null` / `v.trim() !== \"\"`\n * rejection from `packages/ui/src/StepBuilderModal.tsx:706-707`.\n */\nfunction hasUsableDefault(d: unknown): boolean {\n if (d === undefined || d === null) return false;\n if (typeof d === \"string\") return d.trim() !== \"\";\n return true;\n}\n\n/**\n * The required field keys `fields` declares that no row in `rows` covers,\n * in field order — what a target change leaves for the operator to notice\n * once the list is the user's (HITL-1) and can no longer be auto-filled.\n * Informational here: T3.2.2's save gate is what turns this into a block,\n * and imports this same predicate rather than forking a second copy of it.\n *\n * Skips a required field that is currently hidden by its own `showIf` or\n * that declares a usable `default` — mirroring\n * `packages/ui/src/StepBuilderModal.tsx:686-711`'s `requiredParamsFilled`.\n * `values` is the `with` mapping; omitting it leaves existing callers'\n * behaviour unchanged apart from the two new skips.\n */\nexport function uncoveredRequiredKeys(\n rows: InputRow[],\n fields: TargetField[],\n values?: Record<string, unknown>,\n): string[] {\n const covered = new Set(rows.map((r) => r.key));\n const effective = (key: string) =>\n values?.[key] !== undefined ? values[key] : fields.find((f) => f.key === key)?.default;\n const out: string[] = [];\n for (const field of fields) {\n if (!field.required) continue;\n const key = field.key;\n if (typeof key !== \"string\" || key.trim() === \"\" || covered.has(key) || out.includes(key)) {\n continue;\n }\n if (!isFieldVisible(field, effective)) continue;\n if (hasUsableDefault(field.default)) continue;\n out.push(key);\n }\n return out;\n}\n\n/**\n * The write-back both pages route their input list through (see the module\n * docstring's pass-through guard). The overloads let a call site that\n * passes the literal `emptyMeansPassthrough: false` (every Function save)\n * keep a non-nullable return type at compile time, matching\n * `FunctionDef.inputs`'s wire shape without a cast.\n */\nexport function inputsForSave(rows: InputRow[], opts: { emptyMeansPassthrough: false }): InputRow[];\nexport function inputsForSave(\n rows: InputRow[],\n opts: { emptyMeansPassthrough: boolean },\n): InputRow[] | undefined;\nexport function inputsForSave(\n rows: InputRow[],\n opts: { emptyMeansPassthrough: boolean },\n): InputRow[] | undefined {\n if (opts.emptyMeansPassthrough && rows.length === 0) return undefined;\n return rows;\n}\n","/**\n * The **save gate**'s arm dispatch (T3.2.2): given a picked target, decide\n * *which* key set counts as \"feeding\" its required fields — and when the\n * question does not apply at all — then hand the actual set difference to\n * {@link uncoveredRequiredKeys}.\n *\n * **This module deliberately owns no coverage rule of its own.**\n * `uncoveredRequiredKeys` lives in `./input-seeding.ts` because T3.2.1's\n * `InputListEditor` *renders* the uncovered-required flag from it. Two copies\n * of one coverage rule would drift, and the user would see a flag with no\n * block or a block with no flag. Everything below is dispatch: pick the\n * covered set, or skip.\n *\n * ## The five cases, each anchored to the line that decides it at runtime\n *\n * | # | case | gate |\n * |---|---|---|\n * | P1 | Endpoint, `action` arm, `target.with === undefined` | **skipped** — pass-through |\n * | P2 | Endpoint, `action` arm, `target.with` is an object (**incl. `{}`**) | required params must be non-blank cells of `with` |\n * | P3 | Endpoint, `function`/`workflow` arm, declared `input` list empty | **skipped** — no `with` mechanism exists on these arms |\n * | P4 | Endpoint, `function`/`workflow` arm, declared list non-empty | required target keys must appear as declared row keys |\n * | P5 | **Function**, always | required params must be non-blank cells of `impl.with` |\n *\n * P1 is `=== undefined` **only**. `bll/invoke-endpoint.ts:136-143` dispatches\n * `target.with ? resolveWith(…) : input.input`, and `{}` is truthy — so an\n * empty object does **not** pass through, and treating it as if it did would\n * ship exactly the unfed-required-field bug this gate exists to block. The\n * consequence, stated rather than fixed: `EndpointsPage`'s picker writes\n * `with: built.with ?? {}`, so an action-arm **pass-through Endpoint can no\n * longer be authored through the UI at all** — it can only be opened and\n * re-saved. That was already true server-side before this gate existed\n * (`FOLLOWUPS.md`).\n *\n * P1/P2 key on `target.with` and **never** on the declared list. That matters\n * because T3.2.1 made a deliberately emptied Endpoint list save `input`\n * *absent* rather than `[]` — so \"emptied\" and \"never declared\" are\n * indistinguishable on the wire, and a gate that read pass-through off the\n * list's emptiness would misread one for the other. P3's skip is justified by\n * the *absence of a `with` mechanism* on the callable arms, where the payload\n * always passes through by key identity, not by the list being empty.\n *\n * P5 has no skip: `bll/invoke-function.ts:101-107` calls\n * `resolveWith(impl.with, …)` unconditionally, so a Function has no\n * pass-through mode. With **no action chosen** the field list is empty and\n * coverage is vacuously satisfied, which is what preserves the deliberate\n * save-gate asymmetry — `FunctionsPage` stays saveable incomplete (its\n * `valid`/incomplete badge is the signal), while `EndpointsPage` keeps its\n * separate `targetIsBound` term.\n *\n * ## Known limitation — this gate is CLIENT-SIDE ONLY\n *\n * A determined API caller can still `POST /functions` or `POST /endpoints`\n * with a malformed definition. Both server `validateDefinition`s are\n * structural only (`api/functions.ts:26-37` checks the *types* of\n * `impl.uses.app`/`action`; `api/endpoints.ts:109-154` checks `target.kind`\n * plus its ref/uses fields and the `exposure.security` shape) — neither\n * invokes anything nor looks at coverage, so a dangling ref or an unmapped\n * required param stores fine and fails only at invoke time. Closing that is a\n * server-side write, a boundary expansion out of scope for this node; it is\n * stated here rather than papered over.\n *\n * Pure, React-free, `.ts`, no import of `@w6w/ui` — directly or transitively.\n * `./target-fields.ts`, `./input-seeding.ts` and `./with-mapping.ts` are all\n * `@w6w/ui`-free by the same design (`workflow-validity.ts`'s header explains\n * the wall: the barrel re-exports `.tsx`, which `node --test` cannot parse).\n * The normalized field list therefore arrives as a plain array parameter,\n * resolved by the caller — `TargetSelector`'s `onResolved` — exactly as\n * `workflow-validity.ts:69`'s injected `ValidityContext` does.\n */\n\nimport { type InputRow, uncoveredRequiredKeys } from \"./input-seeding.ts\";\nimport type { FunctionImplLike, TargetField, TargetLike } from \"./target-fields.ts\";\n\n/**\n * Check if a `with` mapping value is considered \"fed\" (non-empty).\n * A cell is \"fed\" when it contains a non-empty value:\n * - ExprValue objects are always considered fed (they have meaningful content)\n * - Strings are fed if non-blank after trimming\n * - Everything else (null, undefined, empty string) is not fed\n */\nfunction isFedValue(v: unknown): boolean {\n if (v == null) return false;\n if (typeof v === \"string\") return v.trim() !== \"\";\n if (typeof v === \"object\" && \"type\" in v && v.type === \"expr\") return true;\n // Legacy `{ \"$\": path }` format or any other object is considered fed\n return typeof v === \"object\";\n}\n\n/**\n * The mapping cells that actually feed something, shaped as the covered rows\n * {@link uncoveredRequiredKeys} diffs against. A cell is \"fed\" when it\n * contains a non-empty value — a whitespace-only literal maps nothing, and\n * `updateWith` deletes a cleared key outright.\n */\nfunction coveredRowsFromWith(withBlock: Record<string, unknown>): InputRow[] {\n const rows: InputRow[] = [];\n for (const key of Object.keys(withBlock)) {\n if (!isFedValue(withBlock[key])) continue;\n rows.push({ key, label: key, type: \"string\" });\n }\n return rows;\n}\n\n/**\n * The required target-field keys an Endpoint does **not** feed — P1–P4 above.\n * Empty means saveable as far as coverage is concerned; `EndpointsPage`'s own\n * `targetIsBound`/`key` terms are separate and survive unchanged.\n *\n * `fields` is the target's normalized field list as `TargetSelector` resolved\n * it. While a target's detail is still loading it is `[]`, so the gate is\n * vacuous until the fields arrive — this fails **open**, deliberately: an\n * unresolvable target (a deleted app, a failed fetch) must never trap an\n * author in a form they cannot save.\n */\nexport function uncoveredForEndpoint(args: {\n target: TargetLike;\n rows: InputRow[];\n fields: TargetField[];\n}): string[] {\n const { target, rows, fields } = args;\n if (target.kind === \"action\") {\n if (target.with === undefined) return []; // P1 — pass-through, nothing to check\n return uncoveredRequiredKeys(coveredRowsFromWith(target.with), fields, target.with); // P2\n }\n if (rows.length === 0) return []; // P3 — the callable arms have no `with` mechanism\n return uncoveredRequiredKeys(rows, fields); // P4 — key-name identity\n}\n\n/**\n * The required action-param keys a Function's `impl.with` does not map — P5.\n * No skip arm: a Function has no pass-through mode. An unbound Function\n * resolves to an empty `fields`, so this returns `[]` and the Functions save\n * gate keeps allowing a deliberately incomplete save.\n */\nexport function uncoveredForFunction(args: {\n impl: FunctionImplLike | undefined;\n fields: TargetField[];\n}): string[] {\n // Draft functions have no impl yet; no fields are covered\n if (!args.impl) {\n return args.fields.filter((f) => f.required).map((f) => f.key);\n }\n return uncoveredRequiredKeys(\n coveredRowsFromWith(args.impl.with ?? {}),\n args.fields,\n args.impl.with ?? {},\n );\n}\n","/**\n * Coerce a text field's value to the canonical input's declared type, for a callable's test-invoke\n * form. Empty ⇒ undefined (the field is omitted from the payload). Unparseable `number`/`json` text\n * is passed through raw, so the server's own validation names the problem.\n */\nexport function coerceInput(type: string, raw: string): unknown {\n if (raw === \"\") return undefined;\n switch (type) {\n case \"number\": {\n const n = Number(raw);\n return Number.isNaN(n) ? raw : n;\n }\n case \"boolean\":\n return raw === \"true\";\n case \"json\":\n try {\n return JSON.parse(raw);\n } catch {\n return raw;\n }\n default:\n return raw;\n }\n}\n"],"names":["targetRef","target","targetIsBound","implToTarget","impl","targetToImpl","implAfterRebind","prev","next","prevKind","same","p","paramsToFields","params","field","fieldsFromWorkflow","workflow","ctx","_a","_b","rawNodes","steps","seen","out","step","app","defs","def","key","INPUT_TYPES","shouldSeed","args","normalizeType","type","mergeSeed","rows","fields","r","appended","isFieldVisible","effective","c","v","x","hasUsableDefault","d","uncoveredRequiredKeys","values","covered","inputsForSave","opts","isFedValue","coveredRowsFromWith","withBlock","uncoveredForEndpoint","uncoveredForFunction","f","coerceInput","raw","n"],"mappings":"AAuIO,SAASA,EAAUC,GAA4B;AACpD,SAAIA,EAAO,SAAS,WAAiB,KACjCA,EAAO,SAAS,aAAmBA,EAAO,WACvCA,EAAO,SAAS,aAAaA,EAAO,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BX,GAAMC,CAAM;AAC3C;AAQO,SAASmB,EAAqBxB,GAGxB;AAEX,SAAKA,EAAK,OAGHe;AAAA,IACLM,EAAoBrB,EAAK,KAAK,QAAQ,CAAA,CAAE;AAAA,IACxCA,EAAK;AAAA,IACLA,EAAK,KAAK,QAAQ,CAAA;AAAA,EAAC,IALZA,EAAK,OAAO,OAAO,CAACyB,MAAMA,EAAE,QAAQ,EAAE,IAAI,CAACA,MAAMA,EAAE,GAAG;AAOjE;AC9IO,SAASC,EAAYxB,GAAcyB,GAAsB;AAC9D,MAAIA,MAAQ;AACZ,YAAQzB,GAAA;AAAA,MACN,KAAK,UAAU;AACb,cAAM0B,IAAI,OAAOD,CAAG;AACpB,eAAO,OAAO,MAAMC,CAAC,IAAID,IAAMC;AAAA,MACjC;AAAA,MACA,KAAK;AACH,eAAOD,MAAQ;AAAA,MACjB,KAAK;AACH,YAAI;AACF,iBAAO,KAAK,MAAMA,CAAG;AAAA,QACvB,QAAQ;AACN,iBAAOA;AAAA,QACT;AAAA,MACF;AACE,eAAOA;AAAA,IAAA;AAEb;"}
@@ -0,0 +1,119 @@
1
+ import { useQuery as u, useQueryClient as a, useMutation as l } from "@tanstack/react-query";
2
+ import { u as o } from "./client-context-CX61Bgw-.js";
3
+ const p = (n) => ["app-connections", n];
4
+ function d(n, e) {
5
+ return n.console.connections.listForApp(e);
6
+ }
7
+ function w(n, e = !0) {
8
+ const t = o();
9
+ return u({
10
+ queryKey: p(n),
11
+ queryFn: () => d(t, n),
12
+ enabled: e
13
+ });
14
+ }
15
+ const r = ["connections"];
16
+ function q(n) {
17
+ return n.connections.list();
18
+ }
19
+ function g() {
20
+ const n = o();
21
+ return u({ queryKey: r, queryFn: () => q(n) });
22
+ }
23
+ const y = (n) => ["connection", n];
24
+ function C(n, e) {
25
+ return n.console.connections.get(e);
26
+ }
27
+ function A(n) {
28
+ const e = o();
29
+ return u({ queryKey: y(n), queryFn: () => C(e, n) });
30
+ }
31
+ function D(n, e, t) {
32
+ return n.console.connections.create(e, t);
33
+ }
34
+ function K(n, e, t) {
35
+ return n.console.connections.update(e, t);
36
+ }
37
+ function M(n) {
38
+ const e = o(), t = a();
39
+ return l({
40
+ mutationFn: (c) => K(e, n, c),
41
+ onSuccess: () => {
42
+ t.invalidateQueries({ queryKey: r }), t.invalidateQueries({ queryKey: y(n) });
43
+ }
44
+ });
45
+ }
46
+ function h(n) {
47
+ const e = o(), t = a();
48
+ return l({
49
+ mutationFn: () => e.console.connections.test(n),
50
+ onSuccess: () => {
51
+ t.invalidateQueries({ queryKey: y(n) }), t.invalidateQueries({ queryKey: r });
52
+ }
53
+ });
54
+ }
55
+ const f = (n) => ["connection-dependents", n];
56
+ function Q(n, e) {
57
+ return n.console.connections.dependents(e);
58
+ }
59
+ function k(n, e = !0) {
60
+ const t = o();
61
+ return u({
62
+ queryKey: f(n),
63
+ queryFn: () => Q(t, n),
64
+ enabled: e,
65
+ // The answer must be fresh each time the confirm opens.
66
+ staleTime: 0,
67
+ gcTime: 0,
68
+ retry: !1
69
+ });
70
+ }
71
+ async function m(n, e) {
72
+ var t;
73
+ try {
74
+ return await n.console.connections.delete(e.id, { force: e.force === !0 }), { ok: !0 };
75
+ } catch (c) {
76
+ const i = c;
77
+ if ((i == null ? void 0 : i.status) === 409 && i.code === "connection_in_use") {
78
+ const s = (t = (i.raw ?? {}).error) == null ? void 0 : t.dependents;
79
+ return {
80
+ ok: !1,
81
+ dependents: {
82
+ callables: (s == null ? void 0 : s.callables) ?? [],
83
+ subscriptions: (s == null ? void 0 : s.subscriptions) ?? []
84
+ }
85
+ };
86
+ }
87
+ throw c;
88
+ }
89
+ }
90
+ function S() {
91
+ const n = o(), e = a();
92
+ return l({
93
+ mutationFn: (t) => m(n, t),
94
+ onSuccess: (t, { id: c }) => {
95
+ e.invalidateQueries({ queryKey: r }), e.invalidateQueries({ queryKey: f(c) });
96
+ }
97
+ });
98
+ }
99
+ export {
100
+ K as a,
101
+ f as b,
102
+ r as c,
103
+ y as d,
104
+ p as e,
105
+ D as f,
106
+ m as g,
107
+ C as h,
108
+ Q as i,
109
+ d as j,
110
+ k,
111
+ q as l,
112
+ A as m,
113
+ w as n,
114
+ S as o,
115
+ h as p,
116
+ M as q,
117
+ g as u
118
+ };
119
+ //# sourceMappingURL=connections-D7cgXhDS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections-D7cgXhDS.js","sources":["../src/repos/connections.ts"],"sourcesContent":["/**\n * The connections-for-one-app repo — the Target selector's connection picker.\n *\n * Moved from Studio's `repos/connections.ts` (B-3a); the Studio file re-exports these names. The\n * client comes from `useEmbedClient()`. D-12e moved the rest of the file here (list, single,\n * create, update, test, delete); Studio's `repos/connections.ts` is now a pure re-export shim.\n */\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { ConnectionSummary, W6WClient } from \"@w6w/sdk\";\nimport type { ConnectionDependents, ConnectionTestResult } from \"@w6w/sdk/console\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n\nexport type { ConnectionSummary } from \"@w6w/sdk\";\n\n// The bodies are the SDK's (this module may not import @w6w/ui, see repos-graph.test.ts); they are\n// forwarded verbatim and the ui adapter's `CreateConnectionBody` / `updateConnection` bodies must\n// stay assignable to them (the hosts' tsc enforces it).\nexport type CreateConnectionBody = Parameters<W6WClient[\"console\"][\"connections\"][\"create\"]>[1];\nexport type UpdateConnectionBody = Parameters<W6WClient[\"console\"][\"connections\"][\"update\"]>[1];\n\nexport const connectionsForAppKey = (appId: string) => [\"app-connections\", appId] as const;\n\nexport function listConnectionsForApp(\n client: W6WClient,\n appId: string,\n): Promise<ConnectionSummary[]> {\n return client.console.connections.listForApp(appId);\n}\n\n/**\n * `enabled` defaults to `true`. `TargetSelector` passes `app !== \"\"` — its original\n * pre-migration guard, preserved exactly.\n */\nexport function useConnectionsForAppQuery(appId: string, enabled = true) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: connectionsForAppKey(appId),\n queryFn: () => listConnectionsForApp(client, appId),\n enabled,\n });\n}\n\n// ── connections (list, all apps) ──────────────────────────────────────\n// BASE partner surface — client.connections.list() already exists. There is no\n// console.connections.list(); do NOT route this one through client.console.connections.\n\nexport const connectionsKey = [\"connections\"] as const;\n\nexport function listConnections(client: W6WClient): Promise<ConnectionSummary[]> {\n return client.connections.list();\n}\n\nexport function useConnectionsQuery() {\n const client = useEmbedClient();\n return useQuery({ queryKey: connectionsKey, queryFn: () => listConnections(client) });\n}\n\n// ── connection (single) ───────────────────────────────────────────────\n\nexport const connectionKey = (id: string) => [\"connection\", id] as const;\n\nexport function getConnection(client: W6WClient, id: string): Promise<ConnectionSummary> {\n return client.console.connections.get(id);\n}\n\nexport function useConnectionQuery(id: string) {\n const client = useEmbedClient();\n return useQuery({ queryKey: connectionKey(id), queryFn: () => getConnection(client, id) });\n}\n\n// ── create / update (plain fetchers) ──────────────────────────────────\n\nexport function createConnection(\n client: W6WClient,\n appId: string,\n body: CreateConnectionBody,\n): Promise<ConnectionSummary> {\n return client.console.connections.create(appId, body);\n}\n\n/** The write `W6WEmbedProvider` hands the ui adapter as `updateConnection` (the SDK adapter has none). */\nexport function updateConnection(\n client: W6WClient,\n id: string,\n body: UpdateConnectionBody,\n): Promise<ConnectionSummary> {\n return client.console.connections.update(id, body);\n}\n\n// ── mutations ────────────────────────────────────────────────────────\n\nexport function useUpdateConnectionMutation(connectionId: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (body: UpdateConnectionBody) => updateConnection(client, connectionId, body),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: connectionsKey });\n qc.invalidateQueries({ queryKey: connectionKey(connectionId) });\n },\n });\n}\n\nexport function useTestConnectionMutation(connectionId: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (): Promise<ConnectionTestResult> => client.console.connections.test(connectionId),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: connectionKey(connectionId) });\n qc.invalidateQueries({ queryKey: connectionsKey });\n },\n });\n}\n\n// ── dependents / delete ──────────────────────────────────────────────\n\nexport type { ConnectionDependents } from \"@w6w/sdk/console\";\n\nexport const connectionDependentsKey = (id: string) => [\"connection-dependents\", id] as const;\n\nexport function getConnectionDependents(\n client: W6WClient,\n id: string,\n): Promise<ConnectionDependents> {\n return client.console.connections.dependents(id);\n}\n\n/** What a delete would disable. `enabled` gates the fetch (the modal is closed → no request). */\nexport function useConnectionDependentsQuery(id: string, enabled = true) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: connectionDependentsKey(id),\n queryFn: () => getConnectionDependents(client, id),\n enabled,\n // The answer must be fresh each time the confirm opens.\n staleTime: 0,\n gcTime: 0,\n retry: false,\n });\n}\n\nexport type DeleteConnectionResult = { ok: true } | { ok: false; dependents: ConnectionDependents };\n\n/**\n * Delete with an optional `force`. A 409 `connection_in_use` is data — `{ ok: false, dependents }`\n * — not a thrown error; every other failure rejects.\n */\nexport async function deleteConnection(\n client: W6WClient,\n args: { id: string; force?: boolean },\n): Promise<DeleteConnectionResult> {\n try {\n await client.console.connections.delete(args.id, { force: args.force === true });\n return { ok: true };\n } catch (e) {\n const err = e as { status?: unknown; code?: unknown; raw?: unknown };\n if (err?.status === 409 && err.code === \"connection_in_use\") {\n // Wire: { error: { code, message, dependents } } — see wrappers/node/src/connections.ts.\n const raw = (err.raw ?? {}) as { error?: { dependents?: Partial<ConnectionDependents> } };\n const deps = raw.error?.dependents;\n return {\n ok: false,\n dependents: {\n callables: deps?.callables ?? [],\n subscriptions: deps?.subscriptions ?? [],\n },\n };\n }\n throw e;\n }\n}\n\nexport function useDeleteConnectionMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (args: { id: string; force?: boolean }) => deleteConnection(client, args),\n onSuccess: (_r, { id }) => {\n qc.invalidateQueries({ queryKey: connectionsKey });\n qc.invalidateQueries({ queryKey: connectionDependentsKey(id) });\n },\n });\n}\n"],"names":["connectionsForAppKey","appId","listConnectionsForApp","client","useConnectionsForAppQuery","enabled","useEmbedClient","useQuery","connectionsKey","listConnections","useConnectionsQuery","connectionKey","id","getConnection","useConnectionQuery","createConnection","body","updateConnection","useUpdateConnectionMutation","connectionId","qc","useQueryClient","useMutation","useTestConnectionMutation","connectionDependentsKey","getConnectionDependents","useConnectionDependentsQuery","deleteConnection","args","e","err","deps","_a","useDeleteConnectionMutation","_r"],"mappings":";;AAoBO,MAAMA,IAAuB,CAACC,MAAkB,CAAC,mBAAmBA,CAAK;AAEzE,SAASC,EACdC,GACAF,GAC8B;AAC9B,SAAOE,EAAO,QAAQ,YAAY,WAAWF,CAAK;AACpD;AAMO,SAASG,EAA0BH,GAAeI,IAAU,IAAM;AACvE,QAAMF,IAASG,EAAA;AACf,SAAOC,EAAS;AAAA,IACd,UAAUP,EAAqBC,CAAK;AAAA,IACpC,SAAS,MAAMC,EAAsBC,GAAQF,CAAK;AAAA,IAClD,SAAAI;AAAA,EAAA,CACD;AACH;AAMO,MAAMG,IAAiB,CAAC,aAAa;AAErC,SAASC,EAAgBN,GAAiD;AAC/E,SAAOA,EAAO,YAAY,KAAA;AAC5B;AAEO,SAASO,IAAsB;AACpC,QAAMP,IAASG,EAAA;AACf,SAAOC,EAAS,EAAE,UAAUC,GAAgB,SAAS,MAAMC,EAAgBN,CAAM,GAAG;AACtF;AAIO,MAAMQ,IAAgB,CAACC,MAAe,CAAC,cAAcA,CAAE;AAEvD,SAASC,EAAcV,GAAmBS,GAAwC;AACvF,SAAOT,EAAO,QAAQ,YAAY,IAAIS,CAAE;AAC1C;AAEO,SAASE,EAAmBF,GAAY;AAC7C,QAAMT,IAASG,EAAA;AACf,SAAOC,EAAS,EAAE,UAAUI,EAAcC,CAAE,GAAG,SAAS,MAAMC,EAAcV,GAAQS,CAAE,EAAA,CAAG;AAC3F;AAIO,SAASG,EACdZ,GACAF,GACAe,GAC4B;AAC5B,SAAOb,EAAO,QAAQ,YAAY,OAAOF,GAAOe,CAAI;AACtD;AAGO,SAASC,EACdd,GACA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AI,EAAE,OAAOA,EAAK,UAAU,GAAA,CAAM,GACxE,EAAE,IAAI,GAAA;AAAA,EACf,SAASC,GAAG;AACV,UAAMC,IAAMD;AACZ,SAAIC,KAAA,gBAAAA,EAAK,YAAW,OAAOA,EAAI,SAAS,qBAAqB;AAG3D,YAAMC,KAAOC,KADAF,EAAI,OAAO,CAAA,GACP,UAAJ,gBAAAE,EAAW;AACxB,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,YAAY;AAAA,UACV,YAAWD,KAAA,gBAAAA,EAAM,cAAa,CAAA;AAAA,UAC9B,gBAAeA,KAAA,gBAAAA,EAAM,kBAAiB,CAAA;AAAA,QAAC;AAAA,MACzC;AAAA,IAEJ;AACA,UAAMF;AAAA,EACR;AACF;AAEO,SAASI,IAA8B;AAC5C,QAAM9B,IAASG,EAAA,GACTc,IAAKC,EAAA;AACX,SAAOC,EAAY;AAAA,IACjB,YAAY,CAACM,MAA0CD,EAAiBxB,GAAQyB,CAAI;AAAA,IACpF,WAAW,CAACM,GAAI,EAAE,IAAAtB,QAAS;AACzB,MAAAQ,EAAG,kBAAkB,EAAE,UAAUZ,EAAA,CAAgB,GACjDY,EAAG,kBAAkB,EAAE,UAAUI,EAAwBZ,CAAE,GAAG;AAAA,IAChE;AAAA,EAAA,CACD;AACH;"}
@@ -0,0 +1,171 @@
1
+ import { useQueryClient as c, useMutation as i, useQuery as l } from "@tanstack/react-query";
2
+ import { u as a } from "./client-context-CX61Bgw-.js";
3
+ import { c as w } from "./connections-D7cgXhDS.js";
4
+ const u = ["credentials"], d = (e) => ["credential", e], S = (e) => ["credential-dependents", e];
5
+ function y(e, t) {
6
+ e.invalidateQueries({ queryKey: u }), e.invalidateQueries({ queryKey: d(t) }), e.invalidateQueries({ queryKey: w }), e.invalidateQueries({ queryKey: ["connection"] }), e.invalidateQueries({ queryKey: ["app-connections"] });
7
+ }
8
+ function C(e, t) {
9
+ return e.console.credentials.list(t);
10
+ }
11
+ function f(e, t) {
12
+ return e.console.credentials.get(t);
13
+ }
14
+ function p(e, t) {
15
+ return e.console.credentials.create(t);
16
+ }
17
+ function v(e, t, n) {
18
+ return e.console.credentials.update(t, n);
19
+ }
20
+ function q(e, t, n) {
21
+ return e.console.credentials.rotate(t, n);
22
+ }
23
+ function m(e, t, n) {
24
+ return n === "disabled" ? e.console.credentials.disable(t) : e.console.credentials.enable(t);
25
+ }
26
+ function K(e, t) {
27
+ return e.console.credentials.test(t);
28
+ }
29
+ function Q(e, t) {
30
+ return e.console.credentials.dependents(t);
31
+ }
32
+ async function M(e, t) {
33
+ var n, r;
34
+ try {
35
+ return await e.console.credentials.delete(t), { ok: !0 };
36
+ } catch (s) {
37
+ const o = s;
38
+ if ((o == null ? void 0 : o.status) === 409 && o.code === "credential_in_use")
39
+ return {
40
+ ok: !1,
41
+ dependents: { connections: ((r = (n = (o.raw ?? {}).error) == null ? void 0 : n.dependents) == null ? void 0 : r.connections) ?? [] }
42
+ };
43
+ throw s;
44
+ }
45
+ }
46
+ function E(e) {
47
+ const t = a();
48
+ return l({
49
+ queryKey: e ? [...u, e] : u,
50
+ queryFn: () => C(t, e)
51
+ });
52
+ }
53
+ function T(e) {
54
+ const t = a();
55
+ return l({ queryKey: d(e), queryFn: () => f(t, e) });
56
+ }
57
+ function _(e, t = !0) {
58
+ const n = a();
59
+ return l({
60
+ queryKey: S(e),
61
+ queryFn: () => Q(n, e),
62
+ enabled: t,
63
+ retry: !1
64
+ });
65
+ }
66
+ function j() {
67
+ const e = a(), t = c();
68
+ return i({
69
+ mutationFn: (n) => p(e, n),
70
+ onSuccess: () => t.invalidateQueries({ queryKey: u })
71
+ });
72
+ }
73
+ function x(e) {
74
+ const t = a(), n = c();
75
+ return i({
76
+ mutationFn: (r) => v(t, e, r),
77
+ onSuccess: () => {
78
+ n.invalidateQueries({ queryKey: u }), n.invalidateQueries({ queryKey: d(e) });
79
+ }
80
+ });
81
+ }
82
+ function A(e) {
83
+ const t = a(), n = c();
84
+ return i({
85
+ mutationFn: (r) => q(t, e, r),
86
+ onSuccess: () => y(n, e)
87
+ });
88
+ }
89
+ function R(e) {
90
+ const t = a(), n = c();
91
+ return i({
92
+ mutationFn: (r) => m(t, e, r),
93
+ onSuccess: () => y(n, e)
94
+ });
95
+ }
96
+ function U(e) {
97
+ const t = a();
98
+ return i({
99
+ mutationFn: () => K(t, e)
100
+ });
101
+ }
102
+ function H() {
103
+ const e = a(), t = c();
104
+ return i({
105
+ mutationFn: (n) => M(e, n),
106
+ onSuccess: (n, r) => {
107
+ n.ok && y(t, r);
108
+ }
109
+ });
110
+ }
111
+ const F = [
112
+ "listCredentials",
113
+ "createCredential",
114
+ "getCredential",
115
+ "rotateCredential",
116
+ "setCredentialStatus",
117
+ "testCredential",
118
+ "credentialDependents",
119
+ "deleteCredential"
120
+ ];
121
+ function h(e) {
122
+ return {
123
+ listCredentials: (t) => C(e, t),
124
+ createCredential: (t) => p(e, t),
125
+ getCredential: (t) => f(e, t),
126
+ rotateCredential: (t, n) => q(e, t, n),
127
+ setCredentialStatus: (t, n) => m(e, t, n),
128
+ testCredential: (t) => K(e, t),
129
+ credentialDependents: (t) => Q(e, t),
130
+ deleteCredential: async (t) => {
131
+ try {
132
+ await e.console.credentials.delete(t);
133
+ } catch (n) {
134
+ throw n && typeof n == "object" && "raw" in n && (n.body = n.raw), n;
135
+ }
136
+ }
137
+ };
138
+ }
139
+ function I(e, t) {
140
+ const n = h(t), r = e;
141
+ for (const s of F)
142
+ typeof r[s] != "function" && (r[s] = n[s]);
143
+ return e;
144
+ }
145
+ export {
146
+ S as a,
147
+ d as b,
148
+ p as c,
149
+ h as d,
150
+ u as e,
151
+ M as f,
152
+ f as g,
153
+ Q as h,
154
+ y as i,
155
+ j,
156
+ _ as k,
157
+ C as l,
158
+ T as m,
159
+ E as n,
160
+ H as o,
161
+ A as p,
162
+ R as q,
163
+ q as r,
164
+ m as s,
165
+ K as t,
166
+ v as u,
167
+ U as v,
168
+ I as w,
169
+ x
170
+ };
171
+ //# sourceMappingURL=credentials-DaQU3Ca_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials-DaQU3Ca_.js","sources":["../src/repos/credentials.ts"],"sourcesContent":["/**\n * The stored-credentials repo — list, single, create, rename, rotate, enable/disable, test,\n * dependents and delete, over `client.console.credentials.*`. Mirrors `connections.ts`.\n *\n * `invalidateAfterCredentialWrite` is the one place that knows a credential write can change what\n * a connection shows (its status, its untested flag), so it also stales every cached connection.\n * `credentialUiMethods` / `withCredentialMethods` are how both hosts (`W6WEmbedProvider` and\n * Studio's facade) supply the eight optional `W6WApi` credential methods from one implementation.\n */\nimport { type QueryClient, useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { W6WClient } from \"@w6w/sdk\";\nimport type {\n CredentialDependents,\n CredentialListFilter,\n CredentialSummary,\n CredentialTestResult,\n} from \"@w6w/sdk/console\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\nimport { connectionsKey } from \"./connections.ts\";\n\nexport type {\n CredentialDependents,\n CredentialListFilter,\n CredentialSummary,\n CredentialTestResult,\n} from \"@w6w/sdk/console\";\n\n// ── keys ──────────────────────────────────────────────────────────────\n\nexport const credentialsKey = [\"credentials\"] as const;\nexport const credentialKey = (id: string) => [\"credential\", id] as const;\nexport const credentialDependentsKey = (id: string) => [\"credential-dependents\", id] as const;\n\n/**\n * A credential write (rotate, enable/disable, delete) changes what every connection on it\n * reports, so the credential keys AND every cached connection (single and per-app) go stale.\n */\nexport function invalidateAfterCredentialWrite(qc: QueryClient, id: string): void {\n qc.invalidateQueries({ queryKey: credentialsKey });\n qc.invalidateQueries({ queryKey: credentialKey(id) });\n qc.invalidateQueries({ queryKey: connectionsKey });\n qc.invalidateQueries({ queryKey: [\"connection\"] });\n qc.invalidateQueries({ queryKey: [\"app-connections\"] });\n}\n\n// ── fetchers ──────────────────────────────────────────────────────────\n\nexport function listCredentials(\n client: W6WClient,\n filter?: CredentialListFilter,\n): Promise<CredentialSummary[]> {\n return client.console.credentials.list(filter);\n}\n\nexport function getCredential(client: W6WClient, id: string): Promise<CredentialSummary> {\n return client.console.credentials.get(id);\n}\n\nexport function createCredential(\n client: W6WClient,\n body: { name: string; contract: string; source: Record<string, unknown> },\n): Promise<CredentialSummary> {\n return client.console.credentials.create(body);\n}\n\n/** Rename. */\nexport function updateCredential(\n client: W6WClient,\n id: string,\n body: { name: string },\n): Promise<CredentialSummary> {\n return client.console.credentials.update(id, body);\n}\n\nexport function rotateCredential(\n client: W6WClient,\n id: string,\n body: { source: Record<string, unknown> },\n): Promise<CredentialSummary> {\n return client.console.credentials.rotate(id, body);\n}\n\nexport function setCredentialStatus(\n client: W6WClient,\n id: string,\n status: \"active\" | \"disabled\",\n): Promise<CredentialSummary> {\n return status === \"disabled\"\n ? client.console.credentials.disable(id)\n : client.console.credentials.enable(id);\n}\n\nexport function testCredential(client: W6WClient, id: string): Promise<CredentialTestResult> {\n return client.console.credentials.test(id);\n}\n\nexport function getCredentialDependents(\n client: W6WClient,\n id: string,\n): Promise<CredentialDependents> {\n return client.console.credentials.dependents(id);\n}\n\nexport type DeleteCredentialResult = { ok: true } | { ok: false; dependents: CredentialDependents };\n\n/**\n * Delete. A 409 `credential_in_use` is data — `{ ok: false, dependents }` — not a thrown error;\n * every other failure rejects. There is no `force`: a credential in use is never deleted.\n * Wire (RECONCILE R-11): `{ error: { code, message, dependents: { connections } } }`.\n */\nexport async function deleteCredential(\n client: W6WClient,\n id: string,\n): Promise<DeleteCredentialResult> {\n try {\n await client.console.credentials.delete(id);\n return { ok: true };\n } catch (e) {\n const err = e as { status?: unknown; code?: unknown; raw?: unknown };\n if (err?.status === 409 && err.code === \"credential_in_use\") {\n const raw = (err.raw ?? {}) as {\n error?: { dependents?: Partial<CredentialDependents> };\n };\n return {\n ok: false,\n dependents: { connections: raw.error?.dependents?.connections ?? [] },\n };\n }\n throw e;\n }\n}\n\n// ── hooks ─────────────────────────────────────────────────────────────\n\nexport function useCredentialsQuery(filter?: CredentialListFilter) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: filter ? [...credentialsKey, filter] : credentialsKey,\n queryFn: () => listCredentials(client, filter),\n });\n}\n\nexport function useCredentialQuery(id: string) {\n const client = useEmbedClient();\n return useQuery({ queryKey: credentialKey(id), queryFn: () => getCredential(client, id) });\n}\n\nexport function useCredentialDependentsQuery(id: string, enabled = true) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: credentialDependentsKey(id),\n queryFn: () => getCredentialDependents(client, id),\n enabled,\n retry: false,\n });\n}\n\nexport function useCreateCredentialMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (body: { name: string; contract: string; source: Record<string, unknown> }) =>\n createCredential(client, body),\n onSuccess: () => qc.invalidateQueries({ queryKey: credentialsKey }),\n });\n}\n\n/** Rename touches only the credential keys: no connection's state changes. */\nexport function useUpdateCredentialMutation(id: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (body: { name: string }) => updateCredential(client, id, body),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: credentialsKey });\n qc.invalidateQueries({ queryKey: credentialKey(id) });\n },\n });\n}\n\nexport function useRotateCredentialMutation(id: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (body: { source: Record<string, unknown> }) => rotateCredential(client, id, body),\n onSuccess: () => invalidateAfterCredentialWrite(qc, id),\n });\n}\n\nexport function useSetCredentialStatusMutation(id: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (status: \"active\" | \"disabled\") => setCredentialStatus(client, id, status),\n onSuccess: () => invalidateAfterCredentialWrite(qc, id),\n });\n}\n\nexport function useTestCredentialMutation(id: string) {\n const client = useEmbedClient();\n return useMutation({\n mutationFn: (): Promise<CredentialTestResult> => testCredential(client, id),\n });\n}\n\nexport function useDeleteCredentialMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => deleteCredential(client, id),\n onSuccess: (r, id) => {\n if (r.ok) invalidateAfterCredentialWrite(qc, id);\n },\n });\n}\n\n// ── W6WApi bridge ─────────────────────────────────────────────────────\n\ntype CredentialMethodName =\n | \"listCredentials\"\n | \"createCredential\"\n | \"getCredential\"\n | \"rotateCredential\"\n | \"setCredentialStatus\"\n | \"testCredential\"\n | \"credentialDependents\"\n | \"deleteCredential\";\n\nconst CREDENTIAL_METHODS: readonly CredentialMethodName[] = [\n \"listCredentials\",\n \"createCredential\",\n \"getCredential\",\n \"rotateCredential\",\n \"setCredentialStatus\",\n \"testCredential\",\n \"credentialDependents\",\n \"deleteCredential\",\n];\n\n/**\n * The eight optional `W6WApi` credential methods over `client` (this module may not import\n * `@w6w/ui`, so the signatures are checked where they are spread into a `W6WApi`: Studio's\n * facade, and `W6WEmbedProvider`'s bridge). `deleteCredential` rejects on a\n * 409 with the response body attached as `.body` (as `withApiErrorBody` does in the react adapter).\n */\nexport function credentialUiMethods(client: W6WClient) {\n return {\n listCredentials: (filter?: CredentialListFilter) => listCredentials(client, filter),\n createCredential: (body: { name: string; contract: string; source: Record<string, unknown> }) =>\n createCredential(client, body),\n getCredential: (id: string) => getCredential(client, id),\n rotateCredential: (id: string, body: { source: Record<string, unknown> }) =>\n rotateCredential(client, id, body),\n setCredentialStatus: (id: string, status: \"active\" | \"disabled\") =>\n setCredentialStatus(client, id, status),\n testCredential: (id: string) => testCredential(client, id),\n credentialDependents: (id: string) => getCredentialDependents(client, id),\n deleteCredential: async (id: string) => {\n try {\n await client.console.credentials.delete(id);\n } catch (e) {\n if (e && typeof e === \"object\" && \"raw\" in e) {\n (e as { body?: unknown }).body = (e as { raw?: unknown }).raw;\n }\n throw e;\n }\n },\n };\n}\n\n/** Fills ONLY the credential methods that are not functions on `adapter`; keeps the rest. */\nexport function withCredentialMethods<T extends object>(adapter: T, client: W6WClient): T {\n const ours = credentialUiMethods(client);\n const target = adapter as Record<string, unknown>;\n for (const name of CREDENTIAL_METHODS) {\n if (typeof target[name] !== \"function\") target[name] = ours[name];\n }\n return adapter;\n}\n"],"names":["credentialsKey","credentialKey","id","credentialDependentsKey","invalidateAfterCredentialWrite","qc","connectionsKey","listCredentials","client","filter","getCredential","createCredential","body","updateCredential","rotateCredential","setCredentialStatus","status","testCredential","getCredentialDependents","deleteCredential","e","err","_b","_a","useCredentialsQuery","useEmbedClient","useQuery","useCredentialQuery","useCredentialDependentsQuery","enabled","useCreateCredentialMutation","useQueryClient","useMutation","useUpdateCredentialMutation","useRotateCredentialMutation","useSetCredentialStatusMutation","useTestCredentialMutation","useDeleteCredentialMutation","r","CREDENTIAL_METHODS","credentialUiMethods","withCredentialMethods","adapter","ours","target","name"],"mappings":";;;AA6BO,MAAMA,IAAiB,CAAC,aAAa,GAC/BC,IAAgB,CAACC,MAAe,CAAC,cAAcA,CAAE,GACjDC,IAA0B,CAACD,MAAe,CAAC,yBAAyBA,CAAE;AAM5E,SAASE,EAA+BC,GAAiBH,GAAkB;AAChF,EAAAG,EAAG,kBAAkB,EAAE,UAAUL,EAAA,CAAgB,GACjDK,EAAG,kBAAkB,EAAE,UAAUJ,EAAcC,CAAE,GAAG,GACpDG,EAAG,kBAAkB,EAAE,UAAUC,EAAA,CAAgB,GACjDD,EAAG,kBAAkB,EAAE,UAAU,CAAC,YAAY,GAAG,GACjDA,EAAG,kBAAkB,EAAE,UAAU,CAAC,iBAAiB,GAAG;AACxD;AAIO,SAASE,EACdC,GACAC,GAC8B;AAC9B,SAAOD,EAAO,QAAQ,YAAY,KAAKC,CAAM;AAC/C;AAEO,SAASC,EAAcF,GAAmBN,GAAwC;AACvF,SAAOM,EAAO,QAAQ,YAAY,IAAIN,CAAE;AAC1C;AAEO,SAASS,EACdH,GACAI,GAC4B;AAC5B,SAAOJ,EAAO,QAAQ,YAAY,OAAOI,CAAI;AAC/C;AAGO,SAASC,EACdL,GACAN,GACAU,GAC4B;AAC5B,SAAOJ,EAAO,QAAQ,YAAY,OAAON,GAAIU,CAAI;AACnD;AAEO,SAASE,EACdN,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