@w6w/embed 0.2.1 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
- package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
- package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
- package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
- package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
- package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
- package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
- package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
- package/dist/ModelRoutesManager-BGESQahw.js +345 -0
- package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
- package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
- package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
- package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
- package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
- package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
- package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
- package/dist/chrome/ConfirmModal.d.ts +4 -1
- package/dist/chrome/workspace.d.ts +4 -0
- package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
- package/dist/coerce-input-DttlcSdO.js.map +1 -0
- package/dist/connections-D7cgXhDS.js +119 -0
- package/dist/connections-D7cgXhDS.js.map +1 -0
- package/dist/credentials-DaQU3Ca_.js +171 -0
- package/dist/credentials-DaQU3Ca_.js.map +1 -0
- package/dist/document-sources-UCwe8x77.js +91 -0
- package/dist/document-sources-UCwe8x77.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/BindingBanner.d.ts +13 -0
- package/dist/editor/CallableEditorFrame.d.ts +7 -0
- package/dist/editor/EndpointCards.d.ts +4 -1
- package/dist/editor/PublishControl.d.ts +19 -0
- package/dist/editor/TargetSelector.d.ts +15 -0
- package/dist/editor/TargetSelector.types.d.ts +2 -0
- package/dist/editor/definition.d.ts +2 -0
- package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
- package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
- package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
- package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +768 -621
- package/dist/editors.mjs.map +1 -1
- package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
- package/dist/endpoints-DSRo1Lc5.js.map +1 -0
- package/dist/fields-DvS8XZFc.js +21 -0
- package/dist/fields-DvS8XZFc.js.map +1 -0
- package/dist/forms/ModelBudgetsManager.d.ts +9 -0
- package/dist/forms/ModelRoutesManager.d.ts +14 -0
- package/dist/forms.d.ts +4 -0
- package/dist/forms.mjs +611 -212
- package/dist/forms.mjs.map +1 -1
- package/dist/index.mjs +119 -112
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +38 -0
- package/dist/lib/code-rail.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/invoke-error.d.ts +1 -0
- package/dist/lib/sdk-snippets.d.ts +1 -1
- package/dist/lib/target-fields.d.ts +8 -0
- package/dist/lib/trigger-preview.d.ts +1 -0
- package/dist/lib/workflow-live-run.d.ts +9 -2
- package/dist/lib/workflow-nodes.d.ts +5 -0
- package/dist/lib/workflow-validity.d.ts +1 -0
- package/dist/lib.mjs +72 -70
- package/dist/lists/ConnectionDependents.d.ts +31 -0
- package/dist/lists/ConnectionDetail.d.ts +4 -1
- package/dist/lists/ConnectionList.d.ts +4 -1
- package/dist/lists/CredentialDetail.d.ts +15 -0
- package/dist/lists/CredentialList.d.ts +14 -0
- package/dist/lists/ModelCatalog.d.ts +12 -0
- package/dist/lists/ModelUsage.d.ts +12 -0
- package/dist/lists.d.ts +8 -0
- package/dist/lists.mjs +1322 -604
- package/dist/lists.mjs.map +1 -1
- package/dist/models-bAayQPJ_.js +270 -0
- package/dist/models-bAayQPJ_.js.map +1 -0
- package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
- package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
- package/dist/rail.mjs +4 -4
- package/dist/repos/agents-studio-agents.d.ts +52 -0
- package/dist/repos/agents-studio-assets.d.ts +68 -0
- package/dist/repos/connections.d.ts +30 -12
- package/dist/repos/credentials.d.ts +83 -0
- package/dist/repos/endpoints.d.ts +9 -3
- package/dist/repos/fields.d.ts +34 -0
- package/dist/repos/functions.d.ts +7 -5
- package/dist/repos/index.d.ts +5 -0
- package/dist/repos/models.d.ts +289 -0
- package/dist/repos.mjs +613 -176
- package/dist/repos.mjs.map +1 -1
- package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
- package/dist/slug-BVdgiP_L.js.map +1 -0
- package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
- package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
- package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
- package/dist/spec-import-CW6R_Wk1.js.map +1 -0
- package/dist/theme-context-E2ZhlXDX.js +6 -0
- package/dist/theme-context-E2ZhlXDX.js.map +1 -0
- package/dist/theme-context.d.ts +2 -0
- package/dist/trigger-preview-DKxfjzUY.js +145 -0
- package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
- package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
- package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
- package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
- package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
- package/package.json +1 -1
- package/src/styles.css +2 -6
- package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
- package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
- package/dist/coerce-input-BicYr7nc.js.map +0 -1
- package/dist/connections-CjjYeRqb.js +0 -78
- package/dist/connections-CjjYeRqb.js.map +0 -1
- package/dist/document-sources-C0grrtdq.js +0 -86
- package/dist/document-sources-C0grrtdq.js.map +0 -1
- package/dist/editor-tools-RxmY5iyi.js.map +0 -1
- package/dist/endpoints-B2ynbZo-.js.map +0 -1
- package/dist/slug-C4ktDPdy.js.map +0 -1
- package/dist/spec-import-CjmxyZDR.js.map +0 -1
- package/dist/trigger-preview-VPkrryDl.js +0 -120
- package/dist/trigger-preview-VPkrryDl.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import {
|
|
3
|
-
import { u
|
|
4
|
-
import {
|
|
1
|
+
import { useQueryClient as r, useMutation as s } from "@tanstack/react-query";
|
|
2
|
+
import { path as d } from "@w6w/sdk";
|
|
3
|
+
import { u } from "./client-context-CX61Bgw-.js";
|
|
4
|
+
import { a as l, c as p, k as f, n as w, u as h, m as b, i as c, o as k } from "./callables-tOlflvbl.js";
|
|
5
5
|
import "@w6w/sdk/console";
|
|
6
|
-
const
|
|
7
|
-
function
|
|
6
|
+
const v = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", T = 248, E = (n) => crypto.getRandomValues(new Uint8Array(n));
|
|
7
|
+
function F(n, e = 16, t = E) {
|
|
8
8
|
let o = "";
|
|
9
|
-
for (; o.length <
|
|
10
|
-
for (const
|
|
11
|
-
if (!(
|
|
9
|
+
for (; o.length < e; )
|
|
10
|
+
for (const i of t(Math.max(e - o.length, 8)))
|
|
11
|
+
if (!(i >= T) && (o += v[i % 62], o.length === e))
|
|
12
12
|
break;
|
|
13
13
|
return `${n}_${o}`;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const S = {
|
|
16
16
|
function: {
|
|
17
17
|
kind: "function",
|
|
18
18
|
listTitle: "Functions",
|
|
@@ -66,7 +66,7 @@ const F = {
|
|
|
66
66
|
workflow: {
|
|
67
67
|
kind: "workflow",
|
|
68
68
|
listTitle: "Workflows",
|
|
69
|
-
listDescription: "A Workflow is a durable, multi-
|
|
69
|
+
listDescription: "A Workflow is a durable, multi-node run: each node calls an app action, a Function, or another Workflow, and a run keeps its own state, history and error handling.",
|
|
70
70
|
emptyCopy: "None yet — click “New workflow” to create one.",
|
|
71
71
|
newLabel: "+ New workflow",
|
|
72
72
|
newIdPrefix: "wf",
|
|
@@ -90,138 +90,144 @@ const F = {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
function I(n) {
|
|
93
|
-
return
|
|
93
|
+
return S[n];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
95
|
+
function x(n) {
|
|
96
|
+
return F(I(n).newIdPrefix);
|
|
97
97
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
98
|
+
const g = p("function"), D = "2";
|
|
99
|
+
function K(n) {
|
|
100
100
|
return n.console.functions.list();
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
102
|
+
function R(n = !0) {
|
|
103
|
+
return b("function", n);
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function Q(n,
|
|
107
|
-
return n.console.functions.get(
|
|
105
|
+
const C = (n) => l("function", n);
|
|
106
|
+
function Q(n, e) {
|
|
107
|
+
return n.console.functions.get(e);
|
|
108
108
|
}
|
|
109
|
-
function W(n,
|
|
110
|
-
return
|
|
109
|
+
function W(n, e = !0) {
|
|
110
|
+
return h("function", n, e);
|
|
111
111
|
}
|
|
112
112
|
function _() {
|
|
113
|
-
return
|
|
113
|
+
return k("function");
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const n =
|
|
117
|
-
return
|
|
118
|
-
mutationFn: (
|
|
119
|
-
ifUnmodifiedSince:
|
|
115
|
+
function q() {
|
|
116
|
+
const n = u(), e = r();
|
|
117
|
+
return s({
|
|
118
|
+
mutationFn: (t) => n.console.functions.upsert(t.definition, {
|
|
119
|
+
ifUnmodifiedSince: t.ifUnmodifiedSince
|
|
120
120
|
}),
|
|
121
|
-
onSuccess: (
|
|
121
|
+
onSuccess: (t) => c(e, g, C(t.id))
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
function M(n, e, t, o) {
|
|
125
|
+
const i = { inputs: t };
|
|
126
|
+
return (o == null ? void 0 : o.allowUnpublished) === !0 && (i.allowUnpublished = !0), n.request({
|
|
127
|
+
method: "POST",
|
|
128
|
+
path: d`/functions/${e}/invoke`,
|
|
129
|
+
body: i
|
|
130
|
+
}).then(({ body: a }) => ({
|
|
131
|
+
output: a.output,
|
|
132
|
+
invocationId: a.invocationId,
|
|
133
|
+
status: a.status,
|
|
134
|
+
durationMs: a.durationMs
|
|
135
|
+
}));
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
const n =
|
|
138
|
-
return
|
|
139
|
-
mutationFn: (
|
|
137
|
+
function B() {
|
|
138
|
+
const n = u();
|
|
139
|
+
return s({
|
|
140
|
+
mutationFn: (e) => M(n, e.id, e.inputs, { allowUnpublished: !0 })
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
|
-
function q() {
|
|
143
|
-
return l("function");
|
|
144
|
-
}
|
|
145
143
|
function H() {
|
|
146
|
-
return
|
|
144
|
+
return f("function");
|
|
147
145
|
}
|
|
148
|
-
function V(
|
|
146
|
+
function V() {
|
|
147
|
+
return w("function");
|
|
148
|
+
}
|
|
149
|
+
function $(n) {
|
|
149
150
|
return n.status !== void 0 ? n.status !== "ready" : n.incomplete === !0;
|
|
150
151
|
}
|
|
151
|
-
const
|
|
152
|
+
const G = "2", m = p("endpoint");
|
|
152
153
|
function j(n = !0) {
|
|
153
|
-
return
|
|
154
|
+
return b("endpoint", n);
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
return n.console.endpoints.get(
|
|
156
|
+
function z(n, e) {
|
|
157
|
+
return n.console.endpoints.get(e);
|
|
157
158
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
return
|
|
159
|
+
const y = (n) => l("endpoint", n);
|
|
160
|
+
function J(n, e = !0) {
|
|
161
|
+
return h("endpoint", n, e);
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
const n =
|
|
164
|
-
return
|
|
163
|
+
function X() {
|
|
164
|
+
const n = u(), e = r();
|
|
165
|
+
return s({
|
|
165
166
|
// Same widening as `getEndpoint` — the save's 201 carries `invokeUrls[]` too.
|
|
166
|
-
mutationFn: (
|
|
167
|
-
onSuccess: (
|
|
167
|
+
mutationFn: (t) => n.console.endpoints.upsert(t),
|
|
168
|
+
onSuccess: (t) => c(e, m, y(t.endpoint.id))
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
-
const n =
|
|
172
|
-
return
|
|
173
|
-
mutationFn: (
|
|
174
|
-
ifUnmodifiedSince:
|
|
171
|
+
function Y() {
|
|
172
|
+
const n = u(), e = r();
|
|
173
|
+
return s({
|
|
174
|
+
mutationFn: (t) => n.console.endpoints.upsert(t.definition, {
|
|
175
|
+
ifUnmodifiedSince: t.ifUnmodifiedSince
|
|
175
176
|
}),
|
|
176
|
-
onSuccess: (
|
|
177
|
+
onSuccess: (t) => c(e, m, y(t.endpoint.id))
|
|
177
178
|
});
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
180
|
+
function N(n, e, t, o) {
|
|
181
|
+
const i = { input: t };
|
|
182
|
+
return (o == null ? void 0 : o.allowUnpublished) === !0 && (i.allowUnpublished = !0), n.request({
|
|
183
|
+
method: "POST",
|
|
184
|
+
path: d`/endpoints/${e}/invoke`,
|
|
185
|
+
body: i
|
|
186
|
+
}).then((a) => a.body);
|
|
187
187
|
}
|
|
188
188
|
function Z() {
|
|
189
|
-
|
|
189
|
+
const n = u();
|
|
190
|
+
return s({
|
|
191
|
+
mutationFn: (e) => N(n, e.id, e.input, { allowUnpublished: !0 })
|
|
192
|
+
});
|
|
190
193
|
}
|
|
191
194
|
function nn() {
|
|
192
|
-
return
|
|
195
|
+
return f("endpoint");
|
|
196
|
+
}
|
|
197
|
+
function en() {
|
|
198
|
+
return w("endpoint");
|
|
193
199
|
}
|
|
194
200
|
export {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
B as A,
|
|
202
|
+
S as C,
|
|
203
|
+
G as E,
|
|
198
204
|
D as F,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
v as I,
|
|
206
|
+
X as a,
|
|
207
|
+
R as b,
|
|
208
|
+
_ as c,
|
|
203
209
|
I as d,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
210
|
+
y as e,
|
|
211
|
+
m as f,
|
|
212
|
+
C as g,
|
|
213
|
+
g as h,
|
|
214
|
+
z as i,
|
|
215
|
+
Q as j,
|
|
216
|
+
N as k,
|
|
217
|
+
M as l,
|
|
218
|
+
$ as m,
|
|
219
|
+
x as n,
|
|
220
|
+
K as o,
|
|
221
|
+
F as p,
|
|
222
|
+
nn as q,
|
|
223
|
+
H as r,
|
|
224
|
+
en as s,
|
|
225
|
+
V as t,
|
|
226
|
+
j as u,
|
|
227
|
+
J as v,
|
|
228
|
+
W as w,
|
|
223
229
|
Y as x,
|
|
224
|
-
|
|
225
|
-
|
|
230
|
+
q as y,
|
|
231
|
+
Z as z
|
|
226
232
|
};
|
|
227
|
-
//# sourceMappingURL=endpoints-
|
|
233
|
+
//# sourceMappingURL=endpoints-DSRo1Lc5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints-DSRo1Lc5.js","sources":["../src/lib/new-id.ts","../src/lib/callable-descriptors.ts","../src/repos/functions.ts","../src/repos/endpoints.ts"],"sourcesContent":["/**\n * Platform id minter (studio copy). Algorithm is byte-identical to the server's\n * `packages/ids/ids.ts`: alphabet base62, drop byte b >= 248 (largest multiple of 62\n * that fits a byte), keep ALPHABET[b % 62]. No modulo bias.\n */\n\nexport const ID_ALPHABET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n/** Largest multiple of 62 <= 256; bytes at or above it are rejected. */\nconst REJECT_AT = 248;\n\n/** Byte source seam; defaults to `crypto.getRandomValues`. */\nexport type ByteSource = (n: number) => Uint8Array;\n\nconst defaultBytes: ByteSource = (n) => crypto.getRandomValues(new Uint8Array(n));\n\n/** `<prefix>_<len chars of base62>`. */\nexport function newId(prefix: string, len = 16, bytes: ByteSource = defaultBytes): string {\n let out = \"\";\n while (out.length < len) {\n for (const b of bytes(Math.max(len - out.length, 8))) {\n if (b >= REJECT_AT) continue;\n out += ID_ALPHABET[b % 62];\n if (out.length === len) break;\n }\n }\n return `${prefix}_${out}`;\n}\n","/**\n * `CALLABLE_DESCRIPTORS` — the ONE place the three resource kinds' chrome copy,\n * their Settings-modal behaviour and their id minting are named (T4.2.1,\n * `building-blocks.F3.md` §F-3).\n *\n * Before this file, every \"is this a workflow?\" branch lived inline at its call\n * site: `CallableSettingsModal.tsx` carried seven `kind ===` conditionals for\n * three different questions (may the key be edited? does this kind have tags?\n * which placeholder does the name field use?), and each list page repeated the\n * same title/description/empty-state/`data-testid` literals. A fourth kind — or\n * a rename — meant finding them all by hand.\n *\n * **Data only, never JSX.** A `Descriptor` holds strings, booleans and the one\n * id prefix; the kind-specific *editor body* stays React code in its own page\n * (`src/pages/FunctionsPage.tsx`), because this file is `.ts` and is loaded by\n * `node --test` (`.tsx` cannot be — `package.json`'s `test:unit` glob), exactly\n * the constraint `src/lib/save-invalidation.ts` and `src/lib/alias-rail.ts`\n * document for themselves. So `kind ===` moves OUT of the modal and the pages\n * and INTO a total `Record`, never into a render function.\n *\n * The wire plumbing these descriptors describe — collection segment, query keys,\n * the SDK call per kind — lives one layer down, in `src/repos/callables.ts`,\n * which owns its own total `Record` per kind (mirroring `src/repos/versions.ts`'s\n * `COLLECTION_PATH`). `callable-descriptors.test.ts` asserts the two tables name\n * the same three kinds and the same three collections, so they cannot drift.\n */\nimport type { CallableKind } from \"./callable-kind.ts\";\nimport { newId } from \"./new-id.ts\";\n\nexport type { CallableKind };\n\n/** The Settings modal's own per-kind behaviour (T4.2.1's formalization of the\n * seven `kind ===` conditionals `CallableSettingsModal.tsx` used to carry). */\nexport interface CallableSettingsDescriptor {\n /** May the `key` be typed here at all? Function/Workflow yes, Endpoint no\n * (`rfcs/endpoint.md` — an Endpoint's address is its identity). */\n canEditKey: boolean;\n /** Does this kind store tags? Workflow only. */\n hasTags: boolean;\n /** Placeholder for the Name field. */\n namePlaceholder: string;\n /** Placeholder for the Key field (read only when {@link canEditKey}). */\n keyPlaceholder: string;\n /** Appended to the shared \"Lowercase, kebab-case, 3–39 characters.\" hint —\n * `\"\"` for a kind that cannot unset its key, the \"Leave empty to unset.\"\n * sentence for the one that can. */\n keyHintSuffix: string;\n}\n\n/** The editor chrome's own per-kind copy. */\nexport interface CallableEditorDescriptor {\n /** The back control's label, e.g. `\"← Functions\"`. */\n backLabel: string;\n /** Heading fallback while the definition is still hydrating. */\n newTitle: string;\n /** Rendered in place of the form when the hydration GET 404s. */\n notFoundTitle: string;\n /** The Save button's idle label. */\n saveLabel: string;\n}\n\nexport interface CallableDescriptor {\n kind: CallableKind;\n /** The list page's `<h2>`, and the editor document title's second segment. */\n listTitle: string;\n /** The list page's explanatory paragraph. */\n listDescription: string;\n /** The empty-state paragraph (verbatim, including its typographic quotes). */\n emptyCopy: string;\n /** The create button's label, e.g. `\"+ New function\"`. */\n newLabel: string;\n /** The synthetic id's own prefix — `fn_…`/`ep_…`/`wf_…`, never user-edited. */\n newIdPrefix: string;\n /** `data-testid` of the list's Import affordance. */\n importOpenTestId: string;\n /** `data-testid` of the list's \"Show archived\" checkbox. */\n showArchivedTestId: string;\n /** `data-testid` of a row's \"archived\" badge. */\n archivedBadgeTestId: string;\n /** The row button's `title` tooltip (T4.2.3 — replaces the shared template literal\n * `` `Open this ${kind} in the editor.` ``, since Workflow's own row opens the visual editor,\n * not \"the editor\"). */\n openRowTitle: string;\n editor: CallableEditorDescriptor;\n settings: CallableSettingsDescriptor;\n}\n\n/**\n * The three kinds, every arm named explicitly — a total `Record<CallableKind,\n * …>`, so a fourth kind fails to compile here rather than silently rendering\n * another kind's copy (the same reasoning `COLLECTION_PATH` gives in\n * `src/repos/versions.ts`).\n *\n * Only the `function` arm is consumed today: Endpoints and Workflows keep their\n * own pages until T4.2.2/T4.2.3. Their arms are filled from those pages'\n * current literals so the later nodes are a deletion, not a re-derivation.\n */\nexport const CALLABLE_DESCRIPTORS: Record<CallableKind, CallableDescriptor> = {\n function: {\n kind: \"function\",\n listTitle: \"Functions\",\n listDescription:\n 'A Function is a reusable, vendor-abstracted operation — \"Send Email\", \"Create Contact\" — ' +\n \"with a stable interface bound to one swappable app action. Switch provider by \" +\n \"re-binding; callers never change.\",\n emptyCopy:\n \"None yet — click “New function” to create one, or “Import” to bring in a spec document.\",\n newLabel: \"+ New function\",\n newIdPrefix: \"fn\",\n importOpenTestId: \"functions-import-open\",\n showArchivedTestId: \"functions-show-archived\",\n archivedBadgeTestId: \"function-archived\",\n openRowTitle: \"Open this function in the editor.\",\n editor: {\n backLabel: \"← Functions\",\n newTitle: \"New function\",\n notFoundTitle: \"Function not found\",\n saveLabel: \"Save\",\n },\n settings: {\n canEditKey: true,\n hasTags: false,\n namePlaceholder: \"Send Email\",\n keyPlaceholder: \"send-email\",\n keyHintSuffix: \"\",\n },\n },\n endpoint: {\n kind: \"endpoint\",\n listTitle: \"Endpoints\",\n listDescription:\n \"An Endpoint is a named, stable entry point that dispatches to one app action, Function, \" +\n \"or Workflow. Callers bind to the Endpoint; the target behind it can change — promote an \" +\n \"action to a Function or a Workflow, or re-bind it — without breaking a single caller.\",\n emptyCopy: \"None yet — click “New endpoint” to create one.\",\n newLabel: \"+ New endpoint\",\n newIdPrefix: \"ep\",\n importOpenTestId: \"endpoints-import-open\",\n showArchivedTestId: \"endpoints-show-archived\",\n archivedBadgeTestId: \"endpoint-archived\",\n openRowTitle: \"Open this endpoint in the editor.\",\n editor: {\n backLabel: \"← Endpoints\",\n newTitle: \"New endpoint\",\n notFoundTitle: \"Endpoint not found\",\n saveLabel: \"Save\",\n },\n settings: {\n canEditKey: false,\n hasTags: false,\n namePlaceholder: \"My endpoint\",\n keyPlaceholder: \"send-email\",\n keyHintSuffix: \"\",\n },\n },\n workflow: {\n kind: \"workflow\",\n listTitle: \"Workflows\",\n listDescription:\n \"A Workflow is a durable, multi-node run: each node calls an app action, a Function, or \" +\n \"another Workflow, and a run keeps its own state, history and error handling.\",\n emptyCopy: \"None yet — click “New workflow” to create one.\",\n newLabel: \"+ New workflow\",\n newIdPrefix: \"wf\",\n importOpenTestId: \"workflows-import-open\",\n showArchivedTestId: \"workflows-show-archived\",\n archivedBadgeTestId: \"workflow-archived\",\n openRowTitle: \"Open this workflow in the visual editor.\",\n editor: {\n backLabel: \"← Workflows\",\n newTitle: \"New workflow\",\n notFoundTitle: \"Workflow not found\",\n saveLabel: \"Save\",\n },\n settings: {\n canEditKey: true,\n hasTags: true,\n namePlaceholder: \"My workflow\",\n keyPlaceholder: \"unset\",\n keyHintSuffix: \" Leave empty to unset.\",\n },\n },\n};\n\n/** Look a descriptor up by kind. A plain index, never a `switch`: the `Record`\n * above already made every arm total. */\nexport function descriptorFor(kind: CallableKind): CallableDescriptor {\n return CALLABLE_DESCRIPTORS[kind];\n}\n\n/**\n * A fresh synthetic id for a create-modal's first POST — `fn_<uuid>` for a\n * Function (verbatim the `newFunctionId` `FunctionsPage.tsx` used to hold),\n * `ep_`/`wf_` for the other two, whose pages mint the same shapes today. The\n * prefix comes from the descriptor, so \"which kind is this?\" is answered by the\n * same table that answers every other kind question.\n */\nexport function newCallableId(kind: CallableKind): string {\n return newId(descriptorFor(kind).newIdPrefix);\n}\n","import { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { path, type W6WClient } from \"@w6w/sdk\";\nimport type { FunctionSummary as SdkFunctionSummary } from \"@w6w/sdk/console\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n/**\n * The Function-bound facade over the kind-parametrised repo (`src/repos/callables.ts`, T4.2.1).\n *\n * Everything here that is not Function-specific is one line delegating to `callables.ts` with\n * `\"function\"` bound in — the list/get queries, the save mutation, archive and delete — so the\n * Function arm of every kind-wide behaviour has exactly ONE implementation to fix. What stays is\n * what only a Function has: the `manifestVersion: \"2\"` literal, the SDK's Function type re-exports,\n * the `valid`-carrying summary widening, and the run-plane invoke (`client.request`)\n * that no other kind's page uses.\n *\n * The delegations keep their original names and call shapes on purpose: `ui/rail/SettingsTool.tsx`,\n * `ui/rail/AliasesTool.tsx`, `ui/rail/ErrorHandlingTool.tsx`, `components/TargetSelector.tsx`,\n * `components/FunctionIdentityModal.tsx` and `api/w6wApiFacade.tsx` all import from here, and this\n * node moves no behaviour — only where the code lives.\n */\nimport { callableKey } from \"../lib/callable-kind.ts\";\nimport { invalidateSavedCallable } from \"../lib/save-invalidation.ts\";\nimport {\n callableListKey,\n useArchiveCallableMutation,\n useCallableListQuery,\n useCallableQuery,\n useDeleteCallableMutation,\n useSaveCallableMutation,\n} from \"./callables.ts\";\n\nexport type {\n FunctionDef,\n FunctionImpl,\n FunctionInput,\n FunctionOutputField,\n} from \"@w6w/sdk/console\";\n\n/** A Function list row — the SDK's own summary (it carries `archivedAt` since W-12). */\nexport type FunctionSummary = SdkFunctionSummary;\n\n/** The list key {@link useFunctionsQuery} reads — `callables.ts`'s own\n * `callableListKey(\"function\")`, kept as a named export because\n * `lib/spec-import-invalidation.ts` invalidates it by value. */\nexport const functionsKey = callableListKey(\"function\");\n\n/** Function definitions carry `manifestVersion: \"2\"` - the one literal, shared\n * by the editor's blank draft and the create modal's first POST. */\nexport const FUNCTION_MANIFEST_VERSION = \"2\";\n\nexport function listFunctions(client: W6WClient) {\n return client.console.functions.list();\n}\n\nexport function useFunctionsQuery(enabled = true) {\n return useCallableListQuery<FunctionSummary>(\"function\", enabled);\n}\n\nexport const functionKey = (id: string) => callableKey(\"function\", id);\n\n/** The Function arm's own reader: the SDK's typed `get`, whose `{...function, valid}` splice is\n * what `FunctionEditor` hydrates its draft from (pin 5 — the server computes `valid`; studio\n * never reimplements the check). */\nexport function getFunction(client: W6WClient, id: string) {\n return client.console.functions.get(id);\n}\n\nexport function useFunctionQuery(id: string, enabled = true) {\n return useCallableQuery<Awaited<ReturnType<typeof getFunction>>>(\"function\", id, enabled);\n}\n\nexport function useSaveFunctionMutation() {\n return useSaveCallableMutation(\"function\");\n}\n\n/**\n * The GUARDED Function save: `console.functions.upsert(definition, {ifUnmodifiedSince})`, so a\n * save made from a stale copy answers `409 function_stale` instead of overwriting the newer one.\n * `ifUnmodifiedSince` is REQUIRED in the variables (pass `null` to opt out explicitly) so a call\n * site cannot forget the token; it is the `updatedAt` of the copy the definition was edited from\n * (`callableRecord(\"function\", …).updatedAt`). Same invalidation as {@link useSaveFunctionMutation}\n * (list + the saved resource's key); resolves `{id, key, updatedAt}`. Additive: the unguarded\n * hook's `mutate(definition)` shape is unchanged.\n */\nexport function useGuardedSaveFunctionMutation() {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (vars: { definition: unknown; ifUnmodifiedSince: string | null }) =>\n apiClient.console.functions.upsert(vars.definition as never, {\n ifUnmodifiedSince: vars.ifUnmodifiedSince,\n }),\n onSuccess: (saved) => invalidateSavedCallable(qc, functionsKey, functionKey(saved.id)),\n });\n}\n\n/**\n * One test invoke's result: the Function's own output, plus the platform's\n * record of the attempt.\n *\n * The two are kept apart rather than merged because they answer different\n * questions, and merging them is what the invocation envelope exists to stop:\n * a vendor payload reading `{\"statusCode\": 202}` is SendGrid describing its own\n * request, while `status` here is whether w6w considered the call a success.\n * The frame fields are optional — an older server sends only the output.\n */\nexport interface FunctionInvokeResult {\n output: unknown;\n invocationId?: string;\n status?: string;\n durationMs?: number;\n}\n\n/**\n * `POST /functions/:id/invoke` through the `client.request` escape hatch (D2: no wrappers change).\n * The route answers the invocation frame `{ kind: \"function\", output, invocationId, status,\n * durationMs }`. `allowUnpublished: true` is sent ONLY when the caller opts in (the editor's Test\n * invoke hook); every other caller keeps the publish gate, so the key is absent otherwise.\n */\nexport function invokeFunction(\n client: W6WClient,\n id: string,\n inputs: Record<string, unknown>,\n opts?: { allowUnpublished?: boolean },\n): Promise<FunctionInvokeResult> {\n const body: Record<string, unknown> = { inputs };\n if (opts?.allowUnpublished === true) body.allowUnpublished = true;\n return client\n .request<Record<string, unknown>>({\n method: \"POST\",\n path: path`/functions/${id}/invoke`,\n body,\n })\n .then(({ body: res }) => ({\n output: res.output,\n invocationId: res.invocationId as string | undefined,\n status: res.status as string | undefined,\n durationMs: res.durationMs as number | undefined,\n }));\n}\n\nexport function useInvokeFunctionMutation() {\n const apiClient = useEmbedClient();\n return useMutation({\n mutationFn: (vars: { id: string; inputs: Record<string, unknown> }) =>\n invokeFunction(apiClient, vars.id, vars.inputs, { allowUnpublished: true }),\n });\n}\n\n/**\n * T4.1.1/A7/D-I0-7: `POST /functions/:id/archive`, `DELETE /functions/:id` — the Function arm of\n * `callables.ts`'s generic pair (the plain `apiClient.request()` escape hatch, NOT a typed\n * `@w6w/sdk` method, which would drag `packages/wrappers` into this task's scope for two internal\n * routes). Both invalidate `functionsKey`, so the list's `archivedAt` refreshes and the rail's\n * Delete control appears in Archive's place.\n */\nexport function useArchiveFunctionMutation() {\n return useArchiveCallableMutation(\"function\");\n}\n\nexport function useDeleteFunctionMutation() {\n return useDeleteCallableMutation(\"function\");\n}\n","import { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { path, type W6WClient } from \"@w6w/sdk\";\nimport type {\n EndpointInvokeResult,\n EndpointDef as SdkEndpointDef,\n EndpointSummary as SdkEndpointSummary,\n EndpointTarget as SdkEndpointTarget,\n} from \"@w6w/sdk/console\";\n/**\n * The Endpoint-bound facade over the kind-parametrised repo (`src/repos/callables.ts`, T4.2.2).\n *\n * Everything here that is not Endpoint-specific is one line delegating to `callables.ts` with\n * `\"endpoint\"` bound in — the list/get queries, archive and delete — so the Endpoint arm of every\n * kind-wide behaviour has exactly ONE implementation to fix (the shape `repos/functions.ts` took in\n * T4.2.1, and the \"keep the facade's exports\" rule that module documents). What stays is what only\n * an Endpoint has: the `manifestVersion: \"2\"` literal, the SDK's Endpoint type re-exports, the\n * `status`/`incomplete`/`archivedAt`-carrying summary widening with its one reader\n * {@link isEndpointDraft}, the server-rendered `invokeUrls[]` widening, the synchronous invoke\n * (`client.console.endpoints.invoke`), and the SAVE — whose 201 carries those `invokeUrls[]` back to\n * the editor's URL card, which is why its `mutationFn` is the one arm the generic `saveCallable`\n * cannot serve.\n *\n * The delegations keep their original names and call shapes on purpose: `ui/rail/SettingsTool.tsx`,\n * `ui/rail/AliasesTool.tsx`, `ui/rail/ErrorHandlingTool.tsx`, `components/TargetSelector.tsx`,\n * `components/EndpointIdentityModal.tsx`, `repos/versions.ts` (the revert arm's `endpointKey`) and\n * `repos/spec-import.ts` (`endpointsKey`) all import from here, and this node moves no behaviour —\n * only where the code lives. The two key exports stay byte-identical because both are the builders\n * `callables.ts` already documents as frozen (`[\"endpoints\"]`, `[\"endpoint\", id]`).\n */\nimport { callableKey } from \"../lib/callable-kind.ts\";\nimport { invalidateSavedCallable } from \"../lib/save-invalidation.ts\";\n\nexport type {\n ActionTarget,\n CallableRef,\n CallableOnError,\n ErrorHandlerTarget,\n EndpointAuthMode,\n EndpointInput,\n EndpointInvokeResult,\n EndpointSecurity,\n EndpointTarget,\n ErrorReroute,\n Exposure,\n RetryPolicy,\n} from \"@w6w/sdk/console\";\nexport { SECRET_MASK } from \"@w6w/sdk/console\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\nimport {\n callableListKey,\n useArchiveCallableMutation,\n useCallableListQuery,\n useCallableQuery,\n useDeleteCallableMutation,\n} from \"./callables.ts\";\n\n/** An Endpoint's OWN target: the alias-only `endpoint` arm excluded, mirroring the\n * server fence in admin/endpoints.ts's validateDefinition. Aliases use the full union\n * (`EndpointTarget`, re-exported above verbatim). */\nexport type EndpointOwnTarget = Exclude<SdkEndpointTarget, { kind: \"endpoint\" }>;\nexport type EndpointDef = Omit<SdkEndpointDef, \"target\"> & { target: EndpointOwnTarget };\n\n/**\n * One entry of the `invokeUrls[]` array the server renders on `GET\n * /endpoints/:id` and the `POST /endpoints` 201 (T3.4.1, `admin/endpoints.ts`'s\n * `InvokeUrlEntry` — the shapes are kept in sync by hand, not shared, because\n * `@w6w/sdk` does not type this field yet: it is server-fresh and\n * `packages/wrappers` publishes in lockstep at one `VERSION` across four\n * languages, outside this project's boundary (HITL-10). `entries[0]` is always\n * the platform entry; every entry after it is one of the tenant's domains.\n * `default` mirrors the tenant's stored default domain and, since D-S1\n * (intake T-0.2), it is what CHOOSES the open-on entry: absent an\n * in-session pick, the URL card opens on whichever entry carries it,\n * falling back to `entries[0]` only when no entry does. `resolves` is a\n * static host comparison the server already made; the client never\n * re-derives it.\n */\nexport interface InvokeUrlOption {\n domain: string;\n default: boolean;\n url: string;\n urlByKey?: string;\n resolves: boolean;\n}\n\n/** The two SDK-typed URL fields, widened with the untyped `invokeUrls[]`\n * array — the ONE seam `getEndpoint`, the save mutation and the editor's own\n * 201 read all widen through, so `EndpointsPage.tsx` never casts. */\ntype WithInvokeUrls = {\n invokeUrl: string;\n invokeUrlByKey?: string;\n invokeUrls?: InvokeUrlOption[];\n};\n\n/** An Endpoint list row — the SDK's own summary (`status`, `incomplete` and `archivedAt` are\n * on it since W-12), read for draft-ness only through {@link isEndpointDraft}. */\nexport type EndpointSummary = SdkEndpointSummary;\n\n/** Is this row a draft — not authorised to dispatch (HITL-7/HITL-8,\n * `rfcs/endpoint.md` § Amendment — 2026-08-14b)? Prefers the server's `status`\n * field (`!== \"ready\"`), falling back to the older `incomplete` boolean only\n * when `status` is absent (a server that has not shipped it yet). The sole\n * reader of both fields in studio; every \"unfinished\" UI decision (the\n * list's tag, and any future one) calls this rather than reading either\n * field inline. */\nexport function isEndpointDraft(ep: Pick<EndpointSummary, \"status\" | \"incomplete\">): boolean {\n return ep.status !== undefined ? ep.status !== \"ready\" : ep.incomplete === true;\n}\n\n/** Endpoint definitions carry `manifestVersion: \"2\"` — the one literal, shared\n * by the editor's blank draft and the create modal's first POST. */\nexport const ENDPOINT_MANIFEST_VERSION = \"2\";\n\n/** The list key {@link useEndpointsQuery} reads — `callables.ts`'s own\n * `callableListKey(\"endpoint\")` (byte-identical `[\"endpoints\"]`), kept as a named export because\n * `repos/spec-import.ts` invalidates it by value. */\nexport const endpointsKey = callableListKey(\"endpoint\");\n\nexport function useEndpointsQuery(enabled = true) {\n return useCallableListQuery<EndpointSummary>(\"endpoint\", enabled);\n}\n\n/** Fetch one Endpoint. Widens the SDK's return once — the server sends\n * `invokeUrls[]` (T3.4.1) that `@w6w/sdk`'s typed `get()` does not know about\n * yet; see {@link WithInvokeUrls}. */\nexport function getEndpoint(\n client: W6WClient,\n id: string,\n): Promise<{ endpoint: EndpointDef } & WithInvokeUrls> {\n return client.console.endpoints.get(id) as Promise<{ endpoint: EndpointDef } & WithInvokeUrls>;\n}\n\n/** The single-resource key — `callables.ts`'s own `callableKey(\"endpoint\", id)` (byte-identical\n * `[\"endpoint\", id]`), kept as a named export because `repos/versions.ts`'s revert arm invalidates\n * it by value. */\nexport const endpointKey = (id: string) => callableKey(\"endpoint\", id);\n\n/** `TargetSelector`'s `endpoint` arm needs one Endpoint's own `input` contract\n * to project into fields — mirrors `useFunctionQuery`/`useWorkflowQuery`\n * (`repos/functions.ts`/`repos/workflows.ts`) exactly. */\nexport function useEndpointQuery(id: string, enabled = true) {\n return useCallableQuery<Awaited<ReturnType<typeof getEndpoint>>>(\"endpoint\", id, enabled);\n}\n\n/**\n * The Endpoint arm's SAVE — the one delegated name whose `mutationFn` is NOT `callables.ts`'s\n * `saveCallable`: that helper normalises every kind's success envelope down to `{id, key}` for the\n * invalidation below, while this kind's 201 also carries the fresh server-rendered `invokeUrl`/\n * `invokeUrlByKey`/`invokeUrls[]` the editor's URL card renders from (`onSaveSuccess` in\n * `EndpointsPage.tsx`). Its KEYS and its invalidation, though, are the generic pair's — so the\n * \"which keys does an Endpoint save refresh\" answer still has one home.\n */\nexport function useSaveEndpointMutation() {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n // Same widening as `getEndpoint` — the save's 201 carries `invokeUrls[]` too.\n mutationFn: (definition: unknown) =>\n apiClient.console.endpoints.upsert(definition as never) as Promise<\n { endpoint: { id: string; key: string } } & WithInvokeUrls\n >,\n onSuccess: (saved) => invalidateSavedCallable(qc, endpointsKey, endpointKey(saved.endpoint.id)),\n });\n}\n\n/**\n * The GUARDED Endpoint save: `console.endpoints.upsert(definition, {ifUnmodifiedSince})`, so a\n * save from a stale copy answers `409 endpoint_stale`. Variables and invalidation as\n * {@link useSaveEndpointMutation}'s, plus the required token (`null` opts out explicitly; it is\n * `callableRecord(\"endpoint\", …).updatedAt`, the envelope's TOP-LEVEL `updatedAt`). Resolves the\n * verbatim upsert body (`{endpoint:{id,key}, invokeUrl, …, updatedAt}`). Additive: the unguarded\n * hook's `mutate(definition)` shape is unchanged.\n */\nexport function useGuardedSaveEndpointMutation() {\n const apiClient = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (vars: { definition: unknown; ifUnmodifiedSince: string | null }) =>\n apiClient.console.endpoints.upsert(vars.definition as never, {\n ifUnmodifiedSince: vars.ifUnmodifiedSince,\n }) as Promise<{ endpoint: { id: string; key: string }; updatedAt: string } & WithInvokeUrls>,\n onSuccess: (saved) => invalidateSavedCallable(qc, endpointsKey, endpointKey(saved.endpoint.id)),\n });\n}\n\n/**\n * `POST /endpoints/:id/invoke` through `client.request` (D2). Answers `{ kind, output }`, or a 202\n * `{ kind: \"workflow\", runId }` (success). `allowUnpublished: true` only when the caller opts in.\n */\nexport function invokeEndpoint(\n client: W6WClient,\n id: string,\n input: Record<string, unknown>,\n opts?: { allowUnpublished?: boolean },\n): Promise<EndpointInvokeResult> {\n const body: Record<string, unknown> = { input };\n if (opts?.allowUnpublished === true) body.allowUnpublished = true;\n return client\n .request<EndpointInvokeResult>({\n method: \"POST\",\n path: path`/endpoints/${id}/invoke`,\n body,\n })\n .then((res) => res.body as EndpointInvokeResult);\n}\n\nexport function useInvokeEndpointMutation() {\n const apiClient = useEmbedClient();\n return useMutation({\n mutationFn: (vars: { id: string; input: Record<string, unknown> }) =>\n invokeEndpoint(apiClient, vars.id, vars.input, { allowUnpublished: true }),\n });\n}\n\n/**\n * T4.1.1/A7/D-I0-7: `POST /endpoints/:id/archive` — the Endpoint arm of `callables.ts`'s generic\n * pair (the plain `apiClient.request()` escape hatch, NOT a typed `@w6w/sdk` method, which would\n * drag `packages/wrappers` into this task's scope for one internal route). Invalidates\n * `endpointsKey`, so the list's `archivedAt` refreshes and the rail's Delete control appears in\n * Archive's place.\n */\nexport function useArchiveEndpointMutation() {\n return useArchiveCallableMutation(\"endpoint\");\n}\n\n/** `DELETE /endpoints/:id` — the Endpoint arm of the same generic pair. */\nexport function useDeleteEndpointMutation() {\n return useDeleteCallableMutation(\"endpoint\");\n}\n"],"names":["ID_ALPHABET","REJECT_AT","defaultBytes","newId","prefix","len","bytes","out","b","CALLABLE_DESCRIPTORS","descriptorFor","kind","newCallableId","functionsKey","callableListKey","FUNCTION_MANIFEST_VERSION","listFunctions","client","useFunctionsQuery","enabled","useCallableListQuery","functionKey","id","callableKey","getFunction","useFunctionQuery","useCallableQuery","useSaveFunctionMutation","useSaveCallableMutation","useGuardedSaveFunctionMutation","apiClient","useEmbedClient","qc","useQueryClient","useMutation","vars","saved","invalidateSavedCallable","invokeFunction","inputs","opts","body","path","res","useInvokeFunctionMutation","useArchiveFunctionMutation","useArchiveCallableMutation","useDeleteFunctionMutation","useDeleteCallableMutation","isEndpointDraft","ep","ENDPOINT_MANIFEST_VERSION","endpointsKey","useEndpointsQuery","getEndpoint","endpointKey","useEndpointQuery","useSaveEndpointMutation","definition","useGuardedSaveEndpointMutation","invokeEndpoint","input","useInvokeEndpointMutation","useArchiveEndpointMutation","useDeleteEndpointMutation"],"mappings":";;;;;AAMO,MAAMA,IAAc,kEAGrBC,IAAY,KAKZC,IAA2B,CAAC,MAAM,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC;AAGzE,SAASC,EAAMC,GAAgBC,IAAM,IAAIC,IAAoBJ,GAAsB;AACxF,MAAIK,IAAM;AACV,SAAOA,EAAI,SAASF;AAClB,eAAWG,KAAKF,EAAM,KAAK,IAAID,IAAME,EAAI,QAAQ,CAAC,CAAC;AACjD,UAAI,EAAAC,KAAKP,OACTM,KAAOP,EAAYQ,IAAI,EAAE,GACrBD,EAAI,WAAWF;AAAK;AAG5B,SAAO,GAAGD,C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AAA,CAC/F;AACH;AAUO,SAASuB,IAAiC;AAC/C,QAAM7B,IAAYC,EAAA,GACZC,IAAKC,EAAA;AACX,SAAOC,EAAY;AAAA,IACjB,YAAY,CAACC,MACXL,EAAU,QAAQ,UAAU,OAAOK,EAAK,YAAqB;AAAA,MAC3D,mBAAmBA,EAAK;AAAA,IAAA,CACzB;AAAA,IACH,WAAW,CAACC,MAAUC,EAAwBL,GAAIoB,GAAcG,EAAYnB,EAAM,SAAS,EAAE,CAAC;AAAA,EAAA,CAC/F;AACH;AAMO,SAASwB,EACd3C,GACAK,GACAuC,GACArB,GAC+B;AAC/B,QAAMC,IAAgC,EAAE,OAAAoB,EAAA;AACxC,UAAIrB,KAAA,gBAAAA,EAAM,sBAAqB,OAAMC,EAAK,mBAAmB,KACtDxB,EACJ,QAA8B;AAAA,IAC7B,QAAQ;AAAA,IACR,MAAMyB,eAAkBpB,CAAE;AAAA,IAC1B,MAAAmB;AAAA,EAAA,CACD,EACA,KAAK,CAACE,MAAQA,EAAI,IAA4B;AACnD;AAEO,SAASmB,IAA4B;AAC1C,QAAMhC,IAAYC,EAAA;AAClB,SAAOG,EAAY;AAAA,IACjB,YAAY,CAACC,MACXyB,EAAe9B,GAAWK,EAAK,IAAIA,EAAK,OAAO,EAAE,kBAAkB,GAAA,CAAM;AAAA,EAAA,CAC5E;AACH;AASO,SAAS4B,KAA6B;AAC3C,SAAOjB,EAA2B,UAAU;AAC9C;AAGO,SAASkB,KAA4B;AAC1C,SAAOhB,EAA0B,UAAU;AAC7C;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { path as o, ApiError as c } from "@w6w/sdk";
|
|
2
|
+
async function l(t, a, i, s, e) {
|
|
3
|
+
try {
|
|
4
|
+
return (await t.request({
|
|
5
|
+
method: "POST",
|
|
6
|
+
path: o`/apps/${a}/actions/${i}/fields`,
|
|
7
|
+
body: s,
|
|
8
|
+
signal: e == null ? void 0 : e.signal
|
|
9
|
+
})).body;
|
|
10
|
+
} catch (r) {
|
|
11
|
+
if (r instanceof c && r.status === 424)
|
|
12
|
+
return {
|
|
13
|
+
fields: Object.fromEntries(s.fields.map((n) => [n, { error: r.message }]))
|
|
14
|
+
};
|
|
15
|
+
throw r;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
l as r
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=fields-DvS8XZFc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields-DvS8XZFc.js","sources":["../src/repos/fields.ts"],"sourcesContent":["import type { W6WClient } from \"@w6w/sdk\";\nimport { path, ApiError } from \"@w6w/sdk\";\n/**\n * Dynamic-field resolution — `POST /apps/:id/actions/:key/fields` over `client.request()`.\n * A 424 (the vendor lookup failed) becomes a per-field error result so one bad lookup does not\n * blank the form; every other failure (400/403/404/network/abort) rethrows for the ui to handle.\n */\n\n/**\n * Structural mirror of ui's `W6WApi.resolveActionFields` shapes (this barrel may not import\n * `@w6w/ui`); the facade/UiBridge assignment typechecks against W6WApi structurally.\n */\nexport interface ResolveActionFieldsBody {\n connectionId: string;\n version?: string;\n reason: \"init\" | \"change\";\n form: Record<string, unknown>;\n previous?: Record<string, unknown>;\n changed?: string[];\n fields: string[];\n unresolved: string[];\n}\nexport interface ResolveActionFieldsResult {\n fields: Record<\n string,\n { options?: { value: string | number; label: string; description?: string }[]; error?: string }\n >;\n}\nexport interface ResolveActionFieldsOpts {\n signal?: AbortSignal;\n}\n\nexport async function resolveActionFields(\n client: W6WClient,\n appId: string,\n actionKey: string,\n body: ResolveActionFieldsBody,\n opts?: ResolveActionFieldsOpts,\n): Promise<ResolveActionFieldsResult> {\n try {\n const res = await client.request<ResolveActionFieldsResult>({\n method: \"POST\",\n path: path`/apps/${appId}/actions/${actionKey}/fields`,\n body,\n signal: opts?.signal,\n });\n return res.body;\n } catch (err) {\n if (err instanceof ApiError && err.status === 424) {\n return {\n fields: Object.fromEntries(body.fields.map((k) => [k, { error: err.message }])),\n };\n }\n throw err;\n }\n}\n"],"names":["resolveActionFields","client","appId","actionKey","body","opts","path","err","ApiError","k"],"mappings":";AAgCA,eAAsBA,EACpBC,GACAC,GACAC,GACAC,GACAC,GACoC;AACpC,MAAI;AAOF,YANY,MAAMJ,EAAO,QAAmC;AAAA,MAC1D,QAAQ;AAAA,MACR,MAAMK,UAAaJ,CAAK,YAAYC,CAAS;AAAA,MAC7C,MAAAC;AAAA,MACA,QAAQC,KAAA,gBAAAA,EAAM;AAAA,IAAA,CACf,GACU;AAAA,EACb,SAASE,GAAK;AACZ,QAAIA,aAAeC,KAAYD,EAAI,WAAW;AAC5C,aAAO;AAAA,QACL,QAAQ,OAAO,YAAYH,EAAK,OAAO,IAAI,CAACK,MAAM,CAACA,GAAG,EAAE,OAAOF,EAAI,QAAA,CAAS,CAAC,CAAC;AAAA,MAAA;AAGlF,UAAMA;AAAA,EACR;AACF;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ModelBudgetsManagerProps {
|
|
3
|
+
/**
|
|
4
|
+
* The project whose budgets are managed. Omitted: the `<W6WEmbedProvider project>`. `null` or
|
|
5
|
+
* `""`: no project — nothing is requested and nothing can be written.
|
|
6
|
+
*/
|
|
7
|
+
projectId?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function ModelBudgetsManager(props: ModelBudgetsManagerProps): ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare function modelRouteErrorCopy(e: unknown): string;
|
|
3
|
+
export interface ModelRoutesManagerProps {
|
|
4
|
+
/**
|
|
5
|
+
* The project whose routes are managed. Omitted: the `<W6WEmbedProvider project>`. `null` or
|
|
6
|
+
* `""`: no project — nothing is requested and nothing can be written.
|
|
7
|
+
*/
|
|
8
|
+
projectId?: string | null;
|
|
9
|
+
/** Open this route's editor on mount (read once). The dependents view's reconnect passes it. */
|
|
10
|
+
initialEditRouteId?: string;
|
|
11
|
+
/** Prefill the editor's connection — a reconnect names the connection that should replace it. */
|
|
12
|
+
initialConnection?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function ModelRoutesManager(props: ModelRoutesManagerProps): ReactNode;
|
package/dist/forms.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export { VarsManager } from './forms/VarsManager.tsx';
|
|
|
4
4
|
export type { ConfigManagerActionsApi, VarsManagerProps, VarsManagerSlots, } from './forms/VarsManager.tsx';
|
|
5
5
|
export { SecretsManager } from './forms/SecretsManager.tsx';
|
|
6
6
|
export type { SecretsManagerProps, SecretsManagerSlots } from './forms/SecretsManager.tsx';
|
|
7
|
+
export { ModelRoutesManager } from './forms/ModelRoutesManager.tsx';
|
|
8
|
+
export type { ModelRoutesManagerProps } from './forms/ModelRoutesManager.tsx';
|
|
9
|
+
export { ModelBudgetsManager } from './forms/ModelBudgetsManager.tsx';
|
|
10
|
+
export type { ModelBudgetsManagerProps } from './forms/ModelBudgetsManager.tsx';
|