@adhd/apigen-engine-runtime 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/index.d.ts +28 -0
- package/index.js +1 -0
- package/index.mjs +1398 -0
- package/lib/api-package.d.ts +4 -0
- package/lib/apigen-runtime.d.ts +1 -0
- package/lib/build-context.d.ts +4 -0
- package/lib/coerce-query.d.ts +38 -0
- package/lib/define-middleware.d.ts +5 -0
- package/lib/describe-params.d.ts +18 -0
- package/lib/dispatch.d.ts +23 -0
- package/lib/event-bus.d.ts +19 -0
- package/lib/fn-table.d.ts +16 -0
- package/lib/instance-registry.d.ts +104 -0
- package/lib/invoke.d.ts +112 -0
- package/lib/logger.d.ts +29 -0
- package/lib/logical/host-ts.d.ts +41 -0
- package/lib/logical/nominal-codec.d.ts +73 -0
- package/lib/logical/union-codec.d.ts +63 -0
- package/lib/mcp-output-schema.d.ts +21 -0
- package/lib/stream.d.ts +88 -0
- package/lib/tool-description.d.ts +18 -0
- package/lib/types.d.ts +35 -0
- package/lib/validate-layer.d.ts +54 -0
- package/package.json +19 -0
package/index.mjs
ADDED
|
@@ -0,0 +1,1398 @@
|
|
|
1
|
+
import "ts-morph";
|
|
2
|
+
import "node:fs";
|
|
3
|
+
import "node:path";
|
|
4
|
+
import "ts-json-schema-generator";
|
|
5
|
+
import N from "pino";
|
|
6
|
+
import ae from "ajv";
|
|
7
|
+
import ce from "ajv-formats";
|
|
8
|
+
const I = "$apigen";
|
|
9
|
+
class K extends Error {
|
|
10
|
+
constructor(t) {
|
|
11
|
+
super(t), this.code = "E_DUP_CODEC", this.name = "CodecRegistryError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function fe(e) {
|
|
15
|
+
const t = /* @__PURE__ */ new Map();
|
|
16
|
+
return {
|
|
17
|
+
register(r, n) {
|
|
18
|
+
if (t.has(r.id) && !(n != null && n.override))
|
|
19
|
+
throw new K(
|
|
20
|
+
`E_DUP_CODEC: a codec is already registered for id "${r.id}"`
|
|
21
|
+
);
|
|
22
|
+
t.set(r.id, r);
|
|
23
|
+
},
|
|
24
|
+
resolve(r) {
|
|
25
|
+
for (const n of t.values())
|
|
26
|
+
if (n.matches(r))
|
|
27
|
+
return n;
|
|
28
|
+
},
|
|
29
|
+
get(r) {
|
|
30
|
+
return t.get(r);
|
|
31
|
+
},
|
|
32
|
+
ids() {
|
|
33
|
+
return [...t.keys()];
|
|
34
|
+
},
|
|
35
|
+
freeze() {
|
|
36
|
+
const r = new Map(t), n = {
|
|
37
|
+
register() {
|
|
38
|
+
throw new K(
|
|
39
|
+
"E_DUP_CODEC: registry is frozen and cannot accept new codecs"
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
resolve(o) {
|
|
43
|
+
for (const i of r.values())
|
|
44
|
+
if (i.matches(o))
|
|
45
|
+
return i;
|
|
46
|
+
},
|
|
47
|
+
get(o) {
|
|
48
|
+
return r.get(o);
|
|
49
|
+
},
|
|
50
|
+
ids() {
|
|
51
|
+
return [...r.keys()];
|
|
52
|
+
},
|
|
53
|
+
freeze() {
|
|
54
|
+
return n;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return n;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const U = "x-apigen-logical", L = "x-apigen-codec", k = "x-apigen-ctor", x = "x-apigen-tojson", ue = "0.1.0";
|
|
62
|
+
function V(e, t) {
|
|
63
|
+
return {
|
|
64
|
+
registry: e,
|
|
65
|
+
resolve: (r) => {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`[apigen-logical] $ref "${r}" cannot be resolved in run-mode without a descriptor root. Supply a resolve() in the ctx override to handle $ref.`
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
71
|
+
path: "",
|
|
72
|
+
mode: "strict",
|
|
73
|
+
...t
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function b(e, t, r) {
|
|
77
|
+
const n = r.registry.resolve(t);
|
|
78
|
+
if (n)
|
|
79
|
+
return n.encode(e, t, r);
|
|
80
|
+
const o = t.$ref;
|
|
81
|
+
if (typeof o == "string") {
|
|
82
|
+
const s = r.resolve(o);
|
|
83
|
+
return b(e, s, r);
|
|
84
|
+
}
|
|
85
|
+
const i = t.oneOf;
|
|
86
|
+
if (Array.isArray(i)) {
|
|
87
|
+
const s = te(e, i, t);
|
|
88
|
+
return b(e, s, r);
|
|
89
|
+
}
|
|
90
|
+
const a = t.type;
|
|
91
|
+
if (a === "array") {
|
|
92
|
+
if (!Array.isArray(e))
|
|
93
|
+
return j(e, t, r);
|
|
94
|
+
const s = t.items;
|
|
95
|
+
if (!s)
|
|
96
|
+
return e.map((c) => g(c));
|
|
97
|
+
const u = r.path;
|
|
98
|
+
return Array.isArray(s) ? e.map((c, f) => {
|
|
99
|
+
const d = s[f];
|
|
100
|
+
return d === void 0 ? g(c) : b(c, d, { ...r, path: `${u}/${f}` });
|
|
101
|
+
}) : e.map(
|
|
102
|
+
(c, f) => b(c, s, { ...r, path: `${u}/${f}` })
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
if (a === "object") {
|
|
106
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
107
|
+
return j(e, t, r);
|
|
108
|
+
const s = t.properties;
|
|
109
|
+
if (!s)
|
|
110
|
+
return g(e);
|
|
111
|
+
const u = r.path, c = {};
|
|
112
|
+
for (const [f, d] of Object.entries(s)) {
|
|
113
|
+
const p = e[f];
|
|
114
|
+
p !== void 0 && (c[f] = b(p, d, {
|
|
115
|
+
...r,
|
|
116
|
+
path: `${u}/${f}`
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
return c;
|
|
120
|
+
}
|
|
121
|
+
return a == null ? j(e, t, r) : g(e);
|
|
122
|
+
}
|
|
123
|
+
function v(e, t, r) {
|
|
124
|
+
const n = r.registry.resolve(t);
|
|
125
|
+
if (n)
|
|
126
|
+
return n.decode(e, t, r);
|
|
127
|
+
const o = t.$ref;
|
|
128
|
+
if (typeof o == "string") {
|
|
129
|
+
const s = r.resolve(o);
|
|
130
|
+
return v(e, s, r);
|
|
131
|
+
}
|
|
132
|
+
const i = t.oneOf;
|
|
133
|
+
if (Array.isArray(i)) {
|
|
134
|
+
const s = te(e, i, t);
|
|
135
|
+
return v(e, s, r);
|
|
136
|
+
}
|
|
137
|
+
const a = t.type;
|
|
138
|
+
if (a === "array") {
|
|
139
|
+
if (!Array.isArray(e))
|
|
140
|
+
return e;
|
|
141
|
+
const s = t.items;
|
|
142
|
+
if (!s)
|
|
143
|
+
return e;
|
|
144
|
+
const u = r.path;
|
|
145
|
+
return Array.isArray(s) ? e.map((c, f) => {
|
|
146
|
+
const d = s[f];
|
|
147
|
+
return d === void 0 ? c : v(c, d, { ...r, path: `${u}/${f}` });
|
|
148
|
+
}) : e.map(
|
|
149
|
+
(c, f) => v(c, s, { ...r, path: `${u}/${f}` })
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
if (a === "object") {
|
|
153
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
154
|
+
return e;
|
|
155
|
+
const s = t.properties;
|
|
156
|
+
if (!s)
|
|
157
|
+
return e;
|
|
158
|
+
const u = r.path, c = {};
|
|
159
|
+
for (const [f, d] of Object.entries(s)) {
|
|
160
|
+
const p = e[f];
|
|
161
|
+
p !== void 0 && (c[f] = v(p, d, {
|
|
162
|
+
...r,
|
|
163
|
+
path: `${u}/${f}`
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
return c;
|
|
167
|
+
}
|
|
168
|
+
return a == null ? de(e, r) : e;
|
|
169
|
+
}
|
|
170
|
+
function te(e, t, r, n) {
|
|
171
|
+
const o = r.discriminator;
|
|
172
|
+
if (o != null && o.propertyName) {
|
|
173
|
+
const i = e !== null && typeof e == "object" ? e[o.propertyName] : void 0;
|
|
174
|
+
if (typeof i == "string" && o.mapping) {
|
|
175
|
+
const a = o.mapping[i];
|
|
176
|
+
if (a) {
|
|
177
|
+
const s = t.find((u) => u.$ref === a);
|
|
178
|
+
if (s)
|
|
179
|
+
return s;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return t[0] ?? {};
|
|
184
|
+
}
|
|
185
|
+
function j(e, t, r) {
|
|
186
|
+
for (const n of r.registry.ids()) {
|
|
187
|
+
const o = r.registry.get(n);
|
|
188
|
+
if (o)
|
|
189
|
+
try {
|
|
190
|
+
const i = o.encode(e, o.schema, r);
|
|
191
|
+
return { [I]: n, v: i };
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return g(e);
|
|
196
|
+
}
|
|
197
|
+
function de(e, t) {
|
|
198
|
+
if (e !== null && typeof e == "object" && !Array.isArray(e) && I in e) {
|
|
199
|
+
const r = e, n = r[I], o = t.registry.get(n);
|
|
200
|
+
if (o)
|
|
201
|
+
return o.decode(r.v, o.schema, t);
|
|
202
|
+
}
|
|
203
|
+
return e;
|
|
204
|
+
}
|
|
205
|
+
function g(e) {
|
|
206
|
+
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
207
|
+
return e;
|
|
208
|
+
if (Array.isArray(e))
|
|
209
|
+
return e.map(g);
|
|
210
|
+
if (typeof e == "object") {
|
|
211
|
+
const t = {};
|
|
212
|
+
for (const [r, n] of Object.entries(e))
|
|
213
|
+
n !== void 0 && (t[r] = g(n));
|
|
214
|
+
return t;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
function pe(e) {
|
|
219
|
+
return {
|
|
220
|
+
encode(t, r, n) {
|
|
221
|
+
const o = V(e, n);
|
|
222
|
+
return b(t, r, o);
|
|
223
|
+
},
|
|
224
|
+
decode(t, r, n) {
|
|
225
|
+
const o = V(e, n);
|
|
226
|
+
return v(t, r, o);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const R = {
|
|
231
|
+
id: "date-time",
|
|
232
|
+
kind: "scalar",
|
|
233
|
+
schema: { type: "string", format: "date-time" },
|
|
234
|
+
matches(e) {
|
|
235
|
+
return e.type === "string" && e.format === "date-time";
|
|
236
|
+
},
|
|
237
|
+
encode(e, t, r) {
|
|
238
|
+
return e.toISOString();
|
|
239
|
+
},
|
|
240
|
+
decode(e, t, r) {
|
|
241
|
+
if (typeof e != "string") {
|
|
242
|
+
if (r.mode === "strict")
|
|
243
|
+
throw new TypeError(
|
|
244
|
+
`[date-time] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
245
|
+
);
|
|
246
|
+
return new Date(String(e));
|
|
247
|
+
}
|
|
248
|
+
if (r.mode === "strict" && Number.isNaN(new Date(e).getTime()))
|
|
249
|
+
throw new TypeError(
|
|
250
|
+
`[date-time] invalid date-time string at "${r.path}": ${JSON.stringify(e)}`
|
|
251
|
+
);
|
|
252
|
+
return new Date(e);
|
|
253
|
+
}
|
|
254
|
+
}, P = {
|
|
255
|
+
id: "int64",
|
|
256
|
+
kind: "scalar",
|
|
257
|
+
schema: { type: "string", format: "int64" },
|
|
258
|
+
matches(e) {
|
|
259
|
+
return e.type === "string" && e.format === "int64";
|
|
260
|
+
},
|
|
261
|
+
encode(e, t, r) {
|
|
262
|
+
return String(e);
|
|
263
|
+
},
|
|
264
|
+
decode(e, t, r) {
|
|
265
|
+
if (typeof e != "string") {
|
|
266
|
+
if (r.mode === "strict")
|
|
267
|
+
throw new TypeError(
|
|
268
|
+
`[int64] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
269
|
+
);
|
|
270
|
+
try {
|
|
271
|
+
return BigInt(Math.trunc(Number(e)));
|
|
272
|
+
} catch {
|
|
273
|
+
return BigInt(0);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (r.mode === "strict")
|
|
277
|
+
return BigInt(e);
|
|
278
|
+
if (/^-?\d+$/.test(e))
|
|
279
|
+
try {
|
|
280
|
+
return BigInt(e);
|
|
281
|
+
} catch {
|
|
282
|
+
return BigInt(0);
|
|
283
|
+
}
|
|
284
|
+
return BigInt(0);
|
|
285
|
+
}
|
|
286
|
+
}, B = {
|
|
287
|
+
id: "decimal",
|
|
288
|
+
kind: "scalar",
|
|
289
|
+
schema: { type: "string", format: "decimal" },
|
|
290
|
+
matches(e) {
|
|
291
|
+
return e.type === "string" && e.format === "decimal";
|
|
292
|
+
},
|
|
293
|
+
encode(e, t, r) {
|
|
294
|
+
return e;
|
|
295
|
+
},
|
|
296
|
+
decode(e, t, r) {
|
|
297
|
+
if (typeof e != "string") {
|
|
298
|
+
if (r.mode === "strict")
|
|
299
|
+
throw new TypeError(
|
|
300
|
+
`[decimal] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
301
|
+
);
|
|
302
|
+
return String(e);
|
|
303
|
+
}
|
|
304
|
+
if (r.mode === "strict" && !/^-?\d+(\.\d+)?$/.test(e))
|
|
305
|
+
throw new TypeError(
|
|
306
|
+
`[decimal] wire value "${e}" at "${r.path}" is not a valid decimal string`
|
|
307
|
+
);
|
|
308
|
+
return e;
|
|
309
|
+
}
|
|
310
|
+
}, q = {
|
|
311
|
+
id: "byte",
|
|
312
|
+
kind: "scalar",
|
|
313
|
+
schema: { type: "string", format: "byte" },
|
|
314
|
+
matches(e) {
|
|
315
|
+
return e.type === "string" && e.format === "byte";
|
|
316
|
+
},
|
|
317
|
+
encode(e, t, r) {
|
|
318
|
+
return Buffer.from(e).toString("base64");
|
|
319
|
+
},
|
|
320
|
+
decode(e, t, r) {
|
|
321
|
+
if (typeof e != "string") {
|
|
322
|
+
if (r.mode === "strict")
|
|
323
|
+
throw new TypeError(
|
|
324
|
+
`[byte] expected a base64 string on the wire at "${r.path}", got ${typeof e}`
|
|
325
|
+
);
|
|
326
|
+
return new Uint8Array(0);
|
|
327
|
+
}
|
|
328
|
+
if (r.mode === "strict" && !/^[A-Za-z0-9+/]*={0,2}$/.test(e))
|
|
329
|
+
throw new TypeError(
|
|
330
|
+
`[byte] wire value at "${r.path}" is not standard base64 (format:byte): "${e}"`
|
|
331
|
+
);
|
|
332
|
+
return new Uint8Array(Buffer.from(e, "base64"));
|
|
333
|
+
}
|
|
334
|
+
}, le = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, z = {
|
|
335
|
+
id: "uuid",
|
|
336
|
+
kind: "scalar",
|
|
337
|
+
schema: { type: "string", format: "uuid" },
|
|
338
|
+
matches(e) {
|
|
339
|
+
return e.type === "string" && e.format === "uuid";
|
|
340
|
+
},
|
|
341
|
+
encode(e, t, r) {
|
|
342
|
+
return e.toLowerCase();
|
|
343
|
+
},
|
|
344
|
+
decode(e, t, r) {
|
|
345
|
+
if (typeof e != "string") {
|
|
346
|
+
if (r.mode === "strict")
|
|
347
|
+
throw new TypeError(
|
|
348
|
+
`[uuid] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
349
|
+
);
|
|
350
|
+
return String(e).toLowerCase();
|
|
351
|
+
}
|
|
352
|
+
if (r.mode === "strict" && !le.test(e))
|
|
353
|
+
throw new TypeError(
|
|
354
|
+
`[uuid] wire value "${e}" at "${r.path}" is not a lowercase-hyphenated RFC 4122 UUID`
|
|
355
|
+
);
|
|
356
|
+
return e;
|
|
357
|
+
}
|
|
358
|
+
}, C = "NaN", T = "Infinity", M = "-Infinity", ye = /* @__PURE__ */ new Set([
|
|
359
|
+
C,
|
|
360
|
+
T,
|
|
361
|
+
M
|
|
362
|
+
]), F = {
|
|
363
|
+
id: "number-special",
|
|
364
|
+
kind: "scalar",
|
|
365
|
+
schema: { type: "number" },
|
|
366
|
+
matches(e) {
|
|
367
|
+
return e.type === "number" && e.format === void 0;
|
|
368
|
+
},
|
|
369
|
+
encode(e, t, r) {
|
|
370
|
+
return Number.isNaN(e) ? C : e === 1 / 0 ? T : e === -1 / 0 ? M : e;
|
|
371
|
+
},
|
|
372
|
+
decode(e, t, r) {
|
|
373
|
+
if (typeof e == "number")
|
|
374
|
+
return e;
|
|
375
|
+
if (typeof e == "string") {
|
|
376
|
+
if (e === C)
|
|
377
|
+
return NaN;
|
|
378
|
+
if (e === T)
|
|
379
|
+
return 1 / 0;
|
|
380
|
+
if (e === M)
|
|
381
|
+
return -1 / 0;
|
|
382
|
+
const n = Number(e);
|
|
383
|
+
if (!Number.isNaN(n))
|
|
384
|
+
return n;
|
|
385
|
+
}
|
|
386
|
+
if (r.mode === "strict")
|
|
387
|
+
throw new TypeError(
|
|
388
|
+
`[number-special] unrecognized wire value at "${r.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...ye].join(", ")}.`
|
|
389
|
+
);
|
|
390
|
+
return NaN;
|
|
391
|
+
}
|
|
392
|
+
}, he = [
|
|
393
|
+
R,
|
|
394
|
+
P,
|
|
395
|
+
B,
|
|
396
|
+
q,
|
|
397
|
+
z,
|
|
398
|
+
F
|
|
399
|
+
];
|
|
400
|
+
function me(e, t = {}) {
|
|
401
|
+
for (const r of he)
|
|
402
|
+
e.register(r, { override: t.override ?? !1 });
|
|
403
|
+
}
|
|
404
|
+
R.id, // 'date-time'
|
|
405
|
+
P.id, // 'int64'
|
|
406
|
+
B.id, // 'decimal'
|
|
407
|
+
q.id, // 'byte'
|
|
408
|
+
z.id, // 'uuid'
|
|
409
|
+
F.id;
|
|
410
|
+
const re = fe();
|
|
411
|
+
me(re);
|
|
412
|
+
const ne = pe(re.freeze());
|
|
413
|
+
function ge(e, t) {
|
|
414
|
+
var n;
|
|
415
|
+
const r = ((n = e.input) == null ? void 0 : n.properties) ?? {};
|
|
416
|
+
return t in r;
|
|
417
|
+
}
|
|
418
|
+
function we(e) {
|
|
419
|
+
var r, n;
|
|
420
|
+
const t = (n = (r = e.input) == null ? void 0 : r.properties) == null ? void 0 : n.data;
|
|
421
|
+
return Object.keys((t == null ? void 0 : t.properties) ?? {});
|
|
422
|
+
}
|
|
423
|
+
function be(e, t) {
|
|
424
|
+
var o, i, a;
|
|
425
|
+
const r = (a = (i = (o = e.input) == null ? void 0 : o.properties) == null ? void 0 : i.data) == null ? void 0 : a.properties, n = r == null ? void 0 : r[t];
|
|
426
|
+
return n !== void 0 ? n : void 0;
|
|
427
|
+
}
|
|
428
|
+
function ve(e, t) {
|
|
429
|
+
return t === void 0 || e === void 0 ? e : ne.decode(e, t);
|
|
430
|
+
}
|
|
431
|
+
function _(e, t) {
|
|
432
|
+
const r = t.output;
|
|
433
|
+
return !r || Object.keys(r).length === 0 ? e : ne.encode(e, r);
|
|
434
|
+
}
|
|
435
|
+
async function $e(e, t, r, n, o, i) {
|
|
436
|
+
const s = we(r).map(
|
|
437
|
+
(c) => ve(i[c], be(r, c))
|
|
438
|
+
);
|
|
439
|
+
if (ge(r, "session") && t) {
|
|
440
|
+
const c = await t({ session: o.session }), f = await e[n](c, ...s);
|
|
441
|
+
return _(f, r);
|
|
442
|
+
}
|
|
443
|
+
if (r.hasCtx) {
|
|
444
|
+
const c = t ? await t(o) : void 0, f = await e[n](c, ...s);
|
|
445
|
+
return _(f, r);
|
|
446
|
+
}
|
|
447
|
+
const u = await e[n](...s);
|
|
448
|
+
return _(u, r);
|
|
449
|
+
}
|
|
450
|
+
class nt {
|
|
451
|
+
constructor() {
|
|
452
|
+
this._map = /* @__PURE__ */ new Map();
|
|
453
|
+
}
|
|
454
|
+
set(t, r) {
|
|
455
|
+
this._map.set(t, r);
|
|
456
|
+
}
|
|
457
|
+
get(t) {
|
|
458
|
+
return this._map.get(t);
|
|
459
|
+
}
|
|
460
|
+
/** Returns true when the token has a stored value. */
|
|
461
|
+
has(t) {
|
|
462
|
+
return this._map.has(t);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function ot(e = []) {
|
|
466
|
+
return async function(r, n, o) {
|
|
467
|
+
const i = o.schemas[r];
|
|
468
|
+
if (!i)
|
|
469
|
+
throw new Error(
|
|
470
|
+
`apigen/invoke: no schema found for operation "${r}"`
|
|
471
|
+
);
|
|
472
|
+
const a = () => $e(
|
|
473
|
+
o.fns,
|
|
474
|
+
o.createClient,
|
|
475
|
+
i,
|
|
476
|
+
r,
|
|
477
|
+
n.envelope,
|
|
478
|
+
n.domainArgs
|
|
479
|
+
);
|
|
480
|
+
return e.reduceRight(
|
|
481
|
+
(u, c) => () => c(n, u),
|
|
482
|
+
a
|
|
483
|
+
)();
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function it(e) {
|
|
487
|
+
return e;
|
|
488
|
+
}
|
|
489
|
+
class Ne {
|
|
490
|
+
constructor() {
|
|
491
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Register a handler. Returns an unsubscribe function — handlers registered
|
|
495
|
+
* per-request/per-package MUST be removed (via the returned fn, {@link off},
|
|
496
|
+
* or {@link clear}) or they accumulate for the bus's lifetime.
|
|
497
|
+
*/
|
|
498
|
+
on(t, r) {
|
|
499
|
+
const n = this.handlers.get(t) ?? [];
|
|
500
|
+
return this.handlers.set(t, [...n, r]), () => this.off(t, r);
|
|
501
|
+
}
|
|
502
|
+
/** Remove a previously registered handler (no-op if absent). */
|
|
503
|
+
off(t, r) {
|
|
504
|
+
const n = this.handlers.get(t);
|
|
505
|
+
if (!n)
|
|
506
|
+
return;
|
|
507
|
+
const o = n.filter((i) => i !== r);
|
|
508
|
+
o.length === 0 ? this.handlers.delete(t) : this.handlers.set(t, o);
|
|
509
|
+
}
|
|
510
|
+
/** Remove every handler — call on package/server teardown. */
|
|
511
|
+
clear() {
|
|
512
|
+
this.handlers.clear();
|
|
513
|
+
}
|
|
514
|
+
async emit(t) {
|
|
515
|
+
for (const [r, n] of this.handlers)
|
|
516
|
+
if (Ae(r, t))
|
|
517
|
+
for (const o of n)
|
|
518
|
+
await o(t);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function Ae(e, t) {
|
|
522
|
+
const [r, n, o] = e.split(":");
|
|
523
|
+
return !(r !== "*" && r !== t.module || n && n !== "*" && n !== t.method || o && o !== "*" && o !== t.lifecycle);
|
|
524
|
+
}
|
|
525
|
+
function Oe(e, t) {
|
|
526
|
+
for (const r of e)
|
|
527
|
+
if (r.eventMapping)
|
|
528
|
+
for (const [n, o] of Object.entries(r.eventMapping))
|
|
529
|
+
t.on(n, o);
|
|
530
|
+
}
|
|
531
|
+
async function je(e, t, r) {
|
|
532
|
+
let n = { ...t };
|
|
533
|
+
for (const o of e)
|
|
534
|
+
if (o.createContext) {
|
|
535
|
+
await r.emit({
|
|
536
|
+
module: o.id,
|
|
537
|
+
method: "createContext",
|
|
538
|
+
lifecycle: "start",
|
|
539
|
+
ctx: n
|
|
540
|
+
});
|
|
541
|
+
try {
|
|
542
|
+
const i = await o.createContext(n);
|
|
543
|
+
n = { ...n, ...i }, await r.emit({
|
|
544
|
+
module: o.id,
|
|
545
|
+
method: "createContext",
|
|
546
|
+
lifecycle: "complete",
|
|
547
|
+
ctx: n
|
|
548
|
+
});
|
|
549
|
+
} catch (i) {
|
|
550
|
+
throw await r.emit({
|
|
551
|
+
module: o.id,
|
|
552
|
+
method: "createContext",
|
|
553
|
+
lifecycle: "error",
|
|
554
|
+
ctx: n,
|
|
555
|
+
error: i
|
|
556
|
+
}), i;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return n;
|
|
560
|
+
}
|
|
561
|
+
function J(e, t) {
|
|
562
|
+
const r = /* @__PURE__ */ new Set(), n = [e];
|
|
563
|
+
for (; n.length > 0; ) {
|
|
564
|
+
const o = n.pop();
|
|
565
|
+
if (!o || r.has(o))
|
|
566
|
+
continue;
|
|
567
|
+
r.add(o);
|
|
568
|
+
const i = o.$ref;
|
|
569
|
+
if (typeof i == "string") {
|
|
570
|
+
if (t) {
|
|
571
|
+
const d = t[i];
|
|
572
|
+
if (!d) {
|
|
573
|
+
const p = Object.keys(t).join(", ") || "(none)";
|
|
574
|
+
throw new Error(
|
|
575
|
+
`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${p}`
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
n.push(d);
|
|
579
|
+
}
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
const a = o.oneOf;
|
|
583
|
+
if (Array.isArray(a))
|
|
584
|
+
for (const d of a)
|
|
585
|
+
typeof d == "object" && d !== null && n.push(d);
|
|
586
|
+
const s = o.properties;
|
|
587
|
+
if (s)
|
|
588
|
+
for (const d of Object.values(s))
|
|
589
|
+
n.push(d);
|
|
590
|
+
const u = o.items;
|
|
591
|
+
if (Array.isArray(u))
|
|
592
|
+
for (const d of u)
|
|
593
|
+
typeof d == "object" && d !== null && n.push(d);
|
|
594
|
+
else
|
|
595
|
+
typeof u == "object" && u !== null && n.push(u);
|
|
596
|
+
const c = o.additionalProperties;
|
|
597
|
+
typeof c == "object" && c !== null && n.push(c);
|
|
598
|
+
const f = o.propertyNames;
|
|
599
|
+
typeof f == "object" && f !== null && n.push(f);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const H = /* @__PURE__ */ new Set(["string", "number", "boolean", "integer"]);
|
|
603
|
+
function _e(e) {
|
|
604
|
+
if (typeof e != "object" || e === null)
|
|
605
|
+
return !1;
|
|
606
|
+
const t = e;
|
|
607
|
+
if (t.$ref !== void 0 || t.oneOf || t.anyOf || t.allOf)
|
|
608
|
+
return !1;
|
|
609
|
+
const { type: r } = t;
|
|
610
|
+
return typeof r == "string" ? H.has(r) : Array.isArray(r) ? r.every((n) => H.has(n) || n === "null") : Array.isArray(t.enum) && t.enum.length > 0 ? t.enum.every((n) => ["string", "number", "boolean"].includes(typeof n)) : !1;
|
|
611
|
+
}
|
|
612
|
+
function Ee(e) {
|
|
613
|
+
if (!e || typeof e != "object")
|
|
614
|
+
return !1;
|
|
615
|
+
const t = e.properties;
|
|
616
|
+
return t === void 0 || typeof t != "object" || t === null ? !1 : Object.values(t).every(
|
|
617
|
+
_e
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
function Se(e) {
|
|
621
|
+
const t = {}, r = (n) => {
|
|
622
|
+
for (const o of ["definitions", "$defs"]) {
|
|
623
|
+
const i = n[o];
|
|
624
|
+
if (i)
|
|
625
|
+
for (const [a, s] of Object.entries(i)) {
|
|
626
|
+
const u = a.startsWith("#/") ? a : `#/${o}/${a}`;
|
|
627
|
+
t[u] = s;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
for (const n of Object.values(e.schemas))
|
|
632
|
+
r(n.input), r(n.output);
|
|
633
|
+
if (Object.keys(t).length !== 0)
|
|
634
|
+
for (const [n, o] of Object.entries(e.schemas))
|
|
635
|
+
try {
|
|
636
|
+
J(o.input, t), J(o.output, t);
|
|
637
|
+
} catch (i) {
|
|
638
|
+
throw new Error(
|
|
639
|
+
`[apigen-core-client] Schema validation failed for function "${n}": ${i.message}`
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function Ie(e, t) {
|
|
644
|
+
const r = [
|
|
645
|
+
'apigen calling convention: all domain parameters go inside a "data" envelope — e.g. { "data": { ... } }' + (t ? "." : " (an empty object for this zero-parameter tool).")
|
|
646
|
+
];
|
|
647
|
+
return e.length > 0 && r.push(
|
|
648
|
+
`Field(s) ${e.map((n) => `"${n}"`).join(", ")} are transport-level envelope metadata, NOT domain data — do not nest them under "data". Over MCP they are read from arguments._meta["x-<pluginId>-<field>"] (default pluginId "adhd"); see @adhd/apigen-naming's envelopeMetaKey/envelopeCliFlag/envelopeEnvVar for the HTTP-header / CLI-flag / env-var equivalents.`
|
|
649
|
+
), r.join(" ");
|
|
650
|
+
}
|
|
651
|
+
function ke(e, t, r) {
|
|
652
|
+
Se(e);
|
|
653
|
+
const n = {};
|
|
654
|
+
for (const [o, i] of Object.entries(e.schemas)) {
|
|
655
|
+
const a = (r == null ? void 0 : r[o]) ?? {}, s = i.input.properties ?? {}, u = i.input.required ?? [], c = {}, f = [];
|
|
656
|
+
for (const y of t)
|
|
657
|
+
if (y.envelope && a[y.id] !== !1)
|
|
658
|
+
for (const [h, O] of Object.entries(y.envelope))
|
|
659
|
+
c[h] = O, f.includes(h) || f.push(h);
|
|
660
|
+
const d = {
|
|
661
|
+
type: "object",
|
|
662
|
+
properties: s,
|
|
663
|
+
additionalProperties: !1,
|
|
664
|
+
...u.length > 0 ? { required: u } : {}
|
|
665
|
+
}, p = i.safe === !0 || Ee(i.input), w = i.input.definitions, l = i.input.$defs;
|
|
666
|
+
n[o] = {
|
|
667
|
+
input: {
|
|
668
|
+
type: "object",
|
|
669
|
+
properties: { ...c, data: d },
|
|
670
|
+
required: [
|
|
671
|
+
...f,
|
|
672
|
+
...u.length > 0 ? ["data"] : []
|
|
673
|
+
],
|
|
674
|
+
// BUG-APIGEN-017: reject any property that isn't a declared envelope
|
|
675
|
+
// field or the "data" wrapper — no silently-ignored junk params.
|
|
676
|
+
additionalProperties: !1,
|
|
677
|
+
// BUG-APIGEN-020: document the envelope/data calling convention inline.
|
|
678
|
+
description: Ie(
|
|
679
|
+
Object.keys(c),
|
|
680
|
+
Object.keys(s).length > 0
|
|
681
|
+
),
|
|
682
|
+
...w ? { definitions: w } : {},
|
|
683
|
+
...l ? { $defs: l } : {}
|
|
684
|
+
},
|
|
685
|
+
output: i.output,
|
|
686
|
+
// Carry the ctx-param flag through to dispatch (BUG-APIGEN-001).
|
|
687
|
+
...i.hasCtx ? { hasCtx: !0 } : {},
|
|
688
|
+
"x-apigen-safe": p
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
return n;
|
|
692
|
+
}
|
|
693
|
+
const xe = {
|
|
694
|
+
"decimal.js": "Decimal"
|
|
695
|
+
};
|
|
696
|
+
function Ce(e) {
|
|
697
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
698
|
+
}
|
|
699
|
+
Object.entries(xe).map(([e, t]) => ({
|
|
700
|
+
// Matches: import("...{modSpec}...").<anyMemberName> (single or double quotes)
|
|
701
|
+
// The module specifier appears inside an absolute path, so we allow any
|
|
702
|
+
// characters between the quote and the specifier, and between the specifier
|
|
703
|
+
// and the closing quote. The trailing member accessor (`.default`, `.Decimal`,
|
|
704
|
+
// …) is matched generically (`\w+`) rather than anchored to one spelling —
|
|
705
|
+
// see the doc comment above for why.
|
|
706
|
+
pattern: new RegExp(
|
|
707
|
+
`import\\(["'][^"']*${Ce(e)}[^"']*["']\\)\\.\\w+`,
|
|
708
|
+
"g"
|
|
709
|
+
),
|
|
710
|
+
key: t
|
|
711
|
+
}));
|
|
712
|
+
class D extends Error {
|
|
713
|
+
constructor(t) {
|
|
714
|
+
super(t), this.name = "ConfigurationError";
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function Te(e) {
|
|
718
|
+
for (const t of e)
|
|
719
|
+
for (const r of Object.keys(t.eventMapping ?? {})) {
|
|
720
|
+
const [n] = r.split(":");
|
|
721
|
+
if (n !== "*" && n === t.id)
|
|
722
|
+
throw new D(
|
|
723
|
+
`Middleware "${t.id}" subscribes to its own events via "${r}". This would cause infinite recursion.`
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
function st(e) {
|
|
728
|
+
const {
|
|
729
|
+
domainSchemas: t,
|
|
730
|
+
middlewares: r,
|
|
731
|
+
overrides: n = {},
|
|
732
|
+
strict: o = !1
|
|
733
|
+
} = e;
|
|
734
|
+
Te(r);
|
|
735
|
+
for (const c of Object.keys(n))
|
|
736
|
+
if (!(c in t.schemas)) {
|
|
737
|
+
const f = `Override key "${c}" not found in domain schemas.`;
|
|
738
|
+
if (o)
|
|
739
|
+
throw new D(f);
|
|
740
|
+
console.warn("[apigen-runtime]", f);
|
|
741
|
+
}
|
|
742
|
+
const i = new Set(r.map((c) => c.id));
|
|
743
|
+
for (const [c, f] of Object.entries(n))
|
|
744
|
+
for (const d of Object.keys(f ?? {}))
|
|
745
|
+
if (!i.has(d)) {
|
|
746
|
+
const p = `Override key "${c}.${d}" does not match any declared middleware id.`;
|
|
747
|
+
if (o)
|
|
748
|
+
throw new D(p);
|
|
749
|
+
console.warn("[apigen-runtime]", p);
|
|
750
|
+
}
|
|
751
|
+
const a = ke(
|
|
752
|
+
t,
|
|
753
|
+
r,
|
|
754
|
+
n
|
|
755
|
+
), s = new Ne();
|
|
756
|
+
return Oe(r, s), { schemas: a, createClient: async (c) => je(r, c, s), dispose: () => s.clear() };
|
|
757
|
+
}
|
|
758
|
+
function at(e = {}) {
|
|
759
|
+
const t = e.level ?? "info", r = typeof e.destination == "string" && e.destination.length > 0, n = !r && !!process.stderr.isTTY, o = e.format ?? (n ? "pretty" : "json"), i = { level: t };
|
|
760
|
+
if (o === "pretty")
|
|
761
|
+
return i.transport = {
|
|
762
|
+
target: "pino-pretty",
|
|
763
|
+
options: {
|
|
764
|
+
colorize: !r,
|
|
765
|
+
translateTime: "SYS:HH:MM:ss.l",
|
|
766
|
+
ignore: "pid,hostname",
|
|
767
|
+
...r ? { destination: e.destination, mkdir: !0 } : { destination: 2 }
|
|
768
|
+
}
|
|
769
|
+
}, N(i);
|
|
770
|
+
const a = r ? N.destination({ dest: e.destination, mkdir: !0, sync: !0 }) : N.destination(2);
|
|
771
|
+
return N(i, a);
|
|
772
|
+
}
|
|
773
|
+
function oe(e) {
|
|
774
|
+
return e ? e.type === "array" ? `${oe(e.items)}[]` : e.enum ? "enum" : e.$ref ? String(e.$ref).split("/").pop() || "object" : e.anyOf || e.oneOf ? "union" : e.type ?? "object" : "unknown";
|
|
775
|
+
}
|
|
776
|
+
function ct(e) {
|
|
777
|
+
var s;
|
|
778
|
+
const r = (s = ((e == null ? void 0 : e.input) ?? {}).properties) == null ? void 0 : s.data, n = (r == null ? void 0 : r.properties) ?? {}, o = new Set((r == null ? void 0 : r.required) ?? []), i = Object.entries(n).map(([u, c]) => ({
|
|
779
|
+
name: u,
|
|
780
|
+
type: oe(c),
|
|
781
|
+
required: o.has(u)
|
|
782
|
+
})), a = i.map((u) => `${u.name}${u.required ? "" : "?"}: ${u.type}`).join(", ");
|
|
783
|
+
return { params: i, text: a };
|
|
784
|
+
}
|
|
785
|
+
function Me(e) {
|
|
786
|
+
let t;
|
|
787
|
+
return Array.isArray(e) ? t = e : e ? t = [e] : t = [], t.find((r) => r === "number" || r === "integer" || r === "boolean");
|
|
788
|
+
}
|
|
789
|
+
function ft(e, t) {
|
|
790
|
+
var i, a;
|
|
791
|
+
const n = ((a = (i = ((t == null ? void 0 : t.input) ?? {}).properties) == null ? void 0 : i.data) == null ? void 0 : a.properties) ?? {}, o = { ...e };
|
|
792
|
+
for (const [s, u] of Object.entries(n)) {
|
|
793
|
+
const c = o[s];
|
|
794
|
+
if (typeof c != "string")
|
|
795
|
+
continue;
|
|
796
|
+
const f = Me(u == null ? void 0 : u.type);
|
|
797
|
+
if (f === "number" || f === "integer") {
|
|
798
|
+
const d = Number(c);
|
|
799
|
+
!Number.isNaN(d) && c.trim() !== "" && (o[s] = d);
|
|
800
|
+
} else
|
|
801
|
+
f === "boolean" && (c === "true" ? o[s] = !0 : c === "false" && (o[s] = !1));
|
|
802
|
+
}
|
|
803
|
+
return o;
|
|
804
|
+
}
|
|
805
|
+
const G = /* @__PURE__ */ new Set(["default", "module.exports", "__esModule"]);
|
|
806
|
+
function ut(e) {
|
|
807
|
+
const t = {}, r = (n, o) => {
|
|
808
|
+
for (const [i, a] of Object.entries(n))
|
|
809
|
+
if (typeof a == "function") {
|
|
810
|
+
!G.has(i) && !(i in t) && (t[i] = a);
|
|
811
|
+
const s = a.name;
|
|
812
|
+
s && !(s in t) && (t[s] = a);
|
|
813
|
+
} else
|
|
814
|
+
a && typeof a == "object" && o < 2 && G.has(i) && r(a, o + 1);
|
|
815
|
+
};
|
|
816
|
+
return r(e, 0), t;
|
|
817
|
+
}
|
|
818
|
+
const De = [
|
|
819
|
+
"invalid_argument",
|
|
820
|
+
"unauthenticated",
|
|
821
|
+
"permission_denied",
|
|
822
|
+
"not_found",
|
|
823
|
+
"internal"
|
|
824
|
+
];
|
|
825
|
+
class W extends Error {
|
|
826
|
+
constructor(t, r, n) {
|
|
827
|
+
super(r), this.name = "ApiError", this.code = t, this.details = n, Object.setPrototypeOf(this, new.target.prototype);
|
|
828
|
+
}
|
|
829
|
+
/** Serialise to a plain object suitable for JSON transport. */
|
|
830
|
+
toJSON() {
|
|
831
|
+
const t = {
|
|
832
|
+
code: this.code,
|
|
833
|
+
message: this.message
|
|
834
|
+
};
|
|
835
|
+
return this.details !== void 0 && (t.details = this.details), t;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
function Ue(e) {
|
|
839
|
+
return typeof e == "object" && e !== null && e.name === "ApiError" && De.includes(e.code) && typeof e.toJSON == "function";
|
|
840
|
+
}
|
|
841
|
+
function Y(e, t, r = 0) {
|
|
842
|
+
return e === "before-first-chunk" ? { phase: e, error: t } : { phase: e, error: t, chunksDelivered: r };
|
|
843
|
+
}
|
|
844
|
+
const $ = new ae({ allErrors: !0 });
|
|
845
|
+
ce($);
|
|
846
|
+
for (const e of [
|
|
847
|
+
U,
|
|
848
|
+
L,
|
|
849
|
+
k,
|
|
850
|
+
x,
|
|
851
|
+
"discriminator"
|
|
852
|
+
])
|
|
853
|
+
$.addKeyword({ keyword: e, valid: !0 });
|
|
854
|
+
$.addFormat("decimal", /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/);
|
|
855
|
+
function ie(e) {
|
|
856
|
+
return e.map(
|
|
857
|
+
(t) => `${t.instancePath || "(root)"} ${t.message ?? "failed schema check"}`
|
|
858
|
+
).join("; ");
|
|
859
|
+
}
|
|
860
|
+
const dt = async (e, t) => {
|
|
861
|
+
const r = e.ctx.get(Le);
|
|
862
|
+
if (r === void 0)
|
|
863
|
+
return t();
|
|
864
|
+
const n = e.operation.id, o = r[n];
|
|
865
|
+
if (o === void 0)
|
|
866
|
+
return t();
|
|
867
|
+
const i = {
|
|
868
|
+
data: e.domainArgs,
|
|
869
|
+
...e.envelope
|
|
870
|
+
}, a = $.compile(o.input);
|
|
871
|
+
if (!a(i)) {
|
|
872
|
+
const u = a.errors ?? [];
|
|
873
|
+
throw new W(
|
|
874
|
+
"invalid_argument",
|
|
875
|
+
`Validation failed: ${ie(u)}`,
|
|
876
|
+
u
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
return t();
|
|
880
|
+
}, Le = Symbol("ValidateSchemasToken");
|
|
881
|
+
function pt(e) {
|
|
882
|
+
return async function(r, n) {
|
|
883
|
+
const o = r.operation.id, i = e[o];
|
|
884
|
+
if (i === void 0)
|
|
885
|
+
return n();
|
|
886
|
+
const a = {
|
|
887
|
+
data: r.domainArgs,
|
|
888
|
+
...r.envelope
|
|
889
|
+
}, s = $.compile(i.input);
|
|
890
|
+
if (!s(a)) {
|
|
891
|
+
const c = s.errors ?? [];
|
|
892
|
+
throw new W(
|
|
893
|
+
"invalid_argument",
|
|
894
|
+
`Validation failed: ${ie(c)}`,
|
|
895
|
+
c
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
return n();
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
function Re() {
|
|
902
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
903
|
+
const t = Math.random() * 16 | 0;
|
|
904
|
+
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
class lt {
|
|
908
|
+
constructor(t = {}) {
|
|
909
|
+
var n, o;
|
|
910
|
+
this._store = /* @__PURE__ */ new Map(), this._sweeper = null, this._defaultTtlMs = t.defaultTtlMs;
|
|
911
|
+
let r = null;
|
|
912
|
+
t.sweepIntervalMs === 0 ? r = null : t.sweepIntervalMs !== void 0 ? r = t.sweepIntervalMs : this._defaultTtlMs !== void 0 ? r = Math.max(1e3, Math.floor(this._defaultTtlMs / 4)) : r = null, r !== null && r > 0 && (this._sweeper = setInterval(() => this._sweep(), r), (o = (n = this._sweeper).unref) == null || o.call(n));
|
|
913
|
+
}
|
|
914
|
+
// ---------------------------------------------------------------------------
|
|
915
|
+
// create — construct + register
|
|
916
|
+
// ---------------------------------------------------------------------------
|
|
917
|
+
/**
|
|
918
|
+
* Construct an instance of `Ctor` with `args` and store it in the registry.
|
|
919
|
+
*
|
|
920
|
+
* @param Ctor - The class to instantiate.
|
|
921
|
+
* @param args - Constructor arguments (positional).
|
|
922
|
+
* @param ttlMs - Per-entry TTL override. Falls back to `defaultTtlMs`.
|
|
923
|
+
* @returns `{ instanceId }` — pass this to `dispatch()` / `get()`.
|
|
924
|
+
*/
|
|
925
|
+
create(t, r = [], n) {
|
|
926
|
+
const o = new t(...r), i = Re(), a = n ?? this._defaultTtlMs, s = a !== void 0 ? Date.now() + a : null;
|
|
927
|
+
return this._store.set(i, { instance: o, expiresAt: s }), { instanceId: i };
|
|
928
|
+
}
|
|
929
|
+
// ---------------------------------------------------------------------------
|
|
930
|
+
// get — retrieve a live instance
|
|
931
|
+
// ---------------------------------------------------------------------------
|
|
932
|
+
/**
|
|
933
|
+
* Retrieve the instance stored under `instanceId`.
|
|
934
|
+
*
|
|
935
|
+
* @throws When `instanceId` is unknown or the entry has expired.
|
|
936
|
+
*/
|
|
937
|
+
get(t) {
|
|
938
|
+
const r = this._store.get(t);
|
|
939
|
+
if (!r)
|
|
940
|
+
throw new Error(
|
|
941
|
+
`[instance-registry] Unknown instanceId: "${t}"`
|
|
942
|
+
);
|
|
943
|
+
if (r.expiresAt !== null && Date.now() > r.expiresAt)
|
|
944
|
+
throw this._evict(t, r), new Error(
|
|
945
|
+
`[instance-registry] Instance "${t}" has expired`
|
|
946
|
+
);
|
|
947
|
+
return r.instance;
|
|
948
|
+
}
|
|
949
|
+
// ---------------------------------------------------------------------------
|
|
950
|
+
// dispatch — call a method on a live instance
|
|
951
|
+
// ---------------------------------------------------------------------------
|
|
952
|
+
/**
|
|
953
|
+
* Look up `instanceId` and call `method` on it with `args`.
|
|
954
|
+
*
|
|
955
|
+
* @throws When `instanceId` is unknown/expired, or `method` is not a function
|
|
956
|
+
* on the instance.
|
|
957
|
+
*/
|
|
958
|
+
async dispatch(t, r, n = []) {
|
|
959
|
+
const o = this.get(t), i = o[r];
|
|
960
|
+
if (typeof i != "function")
|
|
961
|
+
throw new Error(
|
|
962
|
+
`[instance-registry] Method "${r}" not found on instance "${t}"`
|
|
963
|
+
);
|
|
964
|
+
return i.call(o, ...n);
|
|
965
|
+
}
|
|
966
|
+
// ---------------------------------------------------------------------------
|
|
967
|
+
// dispose — explicit teardown
|
|
968
|
+
// ---------------------------------------------------------------------------
|
|
969
|
+
/**
|
|
970
|
+
* Remove `instanceId` from the registry and call `instance.dispose()` if the
|
|
971
|
+
* instance exposes one (opt-in lifecycle hook).
|
|
972
|
+
*/
|
|
973
|
+
async dispose(t) {
|
|
974
|
+
const r = this._store.get(t);
|
|
975
|
+
r && (this._store.delete(t), await E(r.instance));
|
|
976
|
+
}
|
|
977
|
+
// ---------------------------------------------------------------------------
|
|
978
|
+
// disposeAll — full teardown
|
|
979
|
+
// ---------------------------------------------------------------------------
|
|
980
|
+
/**
|
|
981
|
+
* Dispose every live instance and stop the background sweeper. Call this
|
|
982
|
+
* when the server is shutting down.
|
|
983
|
+
*/
|
|
984
|
+
async disposeAll() {
|
|
985
|
+
this._sweeper !== null && (clearInterval(this._sweeper), this._sweeper = null);
|
|
986
|
+
const t = [...this._store.entries()];
|
|
987
|
+
this._store.clear(), await Promise.all(t.map(([, r]) => E(r.instance)));
|
|
988
|
+
}
|
|
989
|
+
// ---------------------------------------------------------------------------
|
|
990
|
+
// size — diagnostic helper
|
|
991
|
+
// ---------------------------------------------------------------------------
|
|
992
|
+
/** Number of live (non-expired) entries currently in the registry. */
|
|
993
|
+
get size() {
|
|
994
|
+
return this._store.size;
|
|
995
|
+
}
|
|
996
|
+
// ---------------------------------------------------------------------------
|
|
997
|
+
// Internal sweeper
|
|
998
|
+
// ---------------------------------------------------------------------------
|
|
999
|
+
_sweep() {
|
|
1000
|
+
const t = Date.now();
|
|
1001
|
+
for (const [r, n] of this._store)
|
|
1002
|
+
n.expiresAt !== null && t > n.expiresAt && this._evict(r, n);
|
|
1003
|
+
}
|
|
1004
|
+
_evict(t, r) {
|
|
1005
|
+
this._store.delete(t), E(r.instance);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
async function E(e) {
|
|
1009
|
+
if (e !== null && typeof e == "object" && "dispose" in e) {
|
|
1010
|
+
const t = e.dispose;
|
|
1011
|
+
typeof t == "function" && await t.call(e);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function yt(e) {
|
|
1015
|
+
const { produce: t, signal: r } = e, n = r ?? new AbortController().signal;
|
|
1016
|
+
return {
|
|
1017
|
+
[Symbol.asyncIterator]() {
|
|
1018
|
+
const o = t(n);
|
|
1019
|
+
return {
|
|
1020
|
+
async next() {
|
|
1021
|
+
return n.aborted ? (await o.return(void 0), { done: !0, value: void 0 }) : o.next();
|
|
1022
|
+
},
|
|
1023
|
+
async return(i) {
|
|
1024
|
+
return await o.return(i), { done: !0, value: void 0 };
|
|
1025
|
+
},
|
|
1026
|
+
async throw(i) {
|
|
1027
|
+
return await o.throw(i), { done: !0, value: void 0 };
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
async function ht(e) {
|
|
1034
|
+
const t = [];
|
|
1035
|
+
for await (const r of e)
|
|
1036
|
+
t.push(r);
|
|
1037
|
+
return t;
|
|
1038
|
+
}
|
|
1039
|
+
async function mt(e) {
|
|
1040
|
+
const t = [];
|
|
1041
|
+
try {
|
|
1042
|
+
for await (const r of e)
|
|
1043
|
+
t.push(r);
|
|
1044
|
+
return { ok: !0, chunks: t };
|
|
1045
|
+
} catch (r) {
|
|
1046
|
+
const n = Ue(r) ? r : new W(
|
|
1047
|
+
"internal",
|
|
1048
|
+
r instanceof Error ? r.message : String(r)
|
|
1049
|
+
);
|
|
1050
|
+
return t.length === 0 ? {
|
|
1051
|
+
ok: !1,
|
|
1052
|
+
carrier: Y("before-first-chunk", n)
|
|
1053
|
+
} : {
|
|
1054
|
+
ok: !1,
|
|
1055
|
+
carrier: Y("after-first-chunk", n, t.length)
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
function gt(e) {
|
|
1060
|
+
return e !== null && typeof e == "object" && Symbol.asyncIterator in e;
|
|
1061
|
+
}
|
|
1062
|
+
class m extends Error {
|
|
1063
|
+
constructor(t, r) {
|
|
1064
|
+
super(r), this.name = "UnionCodecError", this.code = t;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
function S(e) {
|
|
1068
|
+
const t = e.discriminator;
|
|
1069
|
+
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
1070
|
+
return;
|
|
1071
|
+
const r = t;
|
|
1072
|
+
if (typeof r.propertyName != "string")
|
|
1073
|
+
return;
|
|
1074
|
+
const n = r.mapping;
|
|
1075
|
+
if (!(n === null || typeof n != "object" || Array.isArray(n)))
|
|
1076
|
+
return {
|
|
1077
|
+
propertyName: r.propertyName,
|
|
1078
|
+
mapping: n
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
function se(e, t) {
|
|
1082
|
+
const r = e[L];
|
|
1083
|
+
if (typeof r == "string") {
|
|
1084
|
+
const n = t.registry.get(r);
|
|
1085
|
+
if (n)
|
|
1086
|
+
return n;
|
|
1087
|
+
}
|
|
1088
|
+
return t.registry.resolve(e);
|
|
1089
|
+
}
|
|
1090
|
+
function Pe(e, t, r) {
|
|
1091
|
+
const n = se(t, r);
|
|
1092
|
+
return n ? n.encode(e, t, r) : e;
|
|
1093
|
+
}
|
|
1094
|
+
function Be(e, t, r) {
|
|
1095
|
+
const n = se(t, r);
|
|
1096
|
+
return n ? n.decode(e, t, r) : e;
|
|
1097
|
+
}
|
|
1098
|
+
function qe(e) {
|
|
1099
|
+
const { id: t, schema: r } = e;
|
|
1100
|
+
return {
|
|
1101
|
+
id: t,
|
|
1102
|
+
kind: "union",
|
|
1103
|
+
schema: r,
|
|
1104
|
+
/**
|
|
1105
|
+
* Structural ownership test: the node carries both `oneOf` (non-empty array)
|
|
1106
|
+
* and `discriminator.propertyName`. The `x-apigen-logical:"union"` hint
|
|
1107
|
+
* accelerates the match but is advisory — the structure is authoritative.
|
|
1108
|
+
*/
|
|
1109
|
+
matches(n) {
|
|
1110
|
+
if (n[U] === "union")
|
|
1111
|
+
return !0;
|
|
1112
|
+
const o = n.oneOf;
|
|
1113
|
+
return !Array.isArray(o) || o.length === 0 ? !1 : S(n) !== void 0;
|
|
1114
|
+
},
|
|
1115
|
+
encode(n, o, i) {
|
|
1116
|
+
const a = S(o);
|
|
1117
|
+
if (!a)
|
|
1118
|
+
throw new m(
|
|
1119
|
+
"E_UNION_NO_DISCRIMINATOR",
|
|
1120
|
+
`[${t}] schema node at "${i.path}" has no discriminator.propertyName; cannot dispatch union branch.`
|
|
1121
|
+
);
|
|
1122
|
+
const { propertyName: s, mapping: u } = a, c = n[s];
|
|
1123
|
+
if (c == null)
|
|
1124
|
+
throw new m(
|
|
1125
|
+
"E_UNION_NO_DISCRIMINATOR",
|
|
1126
|
+
`[${t}] value at "${i.path}" is missing the discriminator property "${s}".`
|
|
1127
|
+
);
|
|
1128
|
+
const f = String(c), d = u[f];
|
|
1129
|
+
if (!d)
|
|
1130
|
+
throw new m(
|
|
1131
|
+
"E_UNION_UNKNOWN_TAG",
|
|
1132
|
+
`[${t}] discriminator tag "${f}" at "${i.path}" is not in the mapping (known: ${Object.keys(u).join(", ")}).`
|
|
1133
|
+
);
|
|
1134
|
+
const p = i.resolve(d);
|
|
1135
|
+
return Pe(n, p, {
|
|
1136
|
+
...i,
|
|
1137
|
+
path: `${i.path}[${f}]`
|
|
1138
|
+
});
|
|
1139
|
+
},
|
|
1140
|
+
decode(n, o, i) {
|
|
1141
|
+
if (n === null || typeof n != "object" || Array.isArray(n)) {
|
|
1142
|
+
let l;
|
|
1143
|
+
throw n === null ? l = "null" : Array.isArray(n) ? l = "array" : l = typeof n, new m(
|
|
1144
|
+
"E_UNION_INVALID_WIRE",
|
|
1145
|
+
`[${t}] expected a JSON object on the wire at "${i.path}", got ${l}.`
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
const a = n, s = S(o);
|
|
1149
|
+
if (!s)
|
|
1150
|
+
throw new m(
|
|
1151
|
+
"E_UNION_NO_DISCRIMINATOR",
|
|
1152
|
+
`[${t}] schema node at "${i.path}" has no discriminator.propertyName; cannot dispatch union branch.`
|
|
1153
|
+
);
|
|
1154
|
+
const { propertyName: u, mapping: c } = s, f = a[u];
|
|
1155
|
+
if (f == null)
|
|
1156
|
+
throw new m(
|
|
1157
|
+
"E_UNION_NO_DISCRIMINATOR",
|
|
1158
|
+
`[${t}] wire object at "${i.path}" is missing the discriminator property "${u}".`
|
|
1159
|
+
);
|
|
1160
|
+
const d = String(f), p = c[d];
|
|
1161
|
+
if (!p)
|
|
1162
|
+
throw new m(
|
|
1163
|
+
"E_UNION_UNKNOWN_TAG",
|
|
1164
|
+
`[${t}] discriminator tag "${d}" on the wire at "${i.path}" is not in the mapping (known: ${Object.keys(c).join(", ")}).`
|
|
1165
|
+
);
|
|
1166
|
+
const w = i.resolve(p);
|
|
1167
|
+
return Be(n, w, {
|
|
1168
|
+
...i,
|
|
1169
|
+
path: `${i.path}[${d}]`
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
const ze = "x-apigen-instances";
|
|
1175
|
+
class A extends Error {
|
|
1176
|
+
constructor(t, r) {
|
|
1177
|
+
super(r), this.name = "NominalCodecError", this.code = t;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function Q(e) {
|
|
1181
|
+
const t = e.properties;
|
|
1182
|
+
return t && typeof t == "object" && !Array.isArray(t) ? t : {};
|
|
1183
|
+
}
|
|
1184
|
+
function Fe(e) {
|
|
1185
|
+
const t = e.required;
|
|
1186
|
+
return Array.isArray(t) ? t.filter((r) => typeof r == "string") : [];
|
|
1187
|
+
}
|
|
1188
|
+
function X(e, t, r) {
|
|
1189
|
+
if (t) {
|
|
1190
|
+
const n = r.registry.resolve(t);
|
|
1191
|
+
if (n)
|
|
1192
|
+
return n.encode(e, t, r);
|
|
1193
|
+
}
|
|
1194
|
+
return e;
|
|
1195
|
+
}
|
|
1196
|
+
function We(e, t, r) {
|
|
1197
|
+
if (t) {
|
|
1198
|
+
const n = r.registry.resolve(t);
|
|
1199
|
+
if (n)
|
|
1200
|
+
return n.decode(e, t, r);
|
|
1201
|
+
}
|
|
1202
|
+
return e;
|
|
1203
|
+
}
|
|
1204
|
+
function Ke(e) {
|
|
1205
|
+
const { id: t, schema: r, ctor: n } = e;
|
|
1206
|
+
return {
|
|
1207
|
+
id: t,
|
|
1208
|
+
kind: "nominal",
|
|
1209
|
+
schema: r,
|
|
1210
|
+
/**
|
|
1211
|
+
* Structural ownership test: the node advertises `x-apigen-logical:'nominal'`
|
|
1212
|
+
* or carries an `x-apigen-codec` matching this codec's id. Per
|
|
1213
|
+
* `[inv:hints-advisory]` these are accelerators; a later structural fallback
|
|
1214
|
+
* (object `$def` with `properties`) is the authoritative signal and is
|
|
1215
|
+
* handled by the transcoder walk, not by this cheap test.
|
|
1216
|
+
*/
|
|
1217
|
+
matches(o) {
|
|
1218
|
+
return o[U] === "nominal" ? !0 : o[L] === t;
|
|
1219
|
+
},
|
|
1220
|
+
encode(o, i, a) {
|
|
1221
|
+
if (o === null || typeof o != "object")
|
|
1222
|
+
return o;
|
|
1223
|
+
if (a.seen.has(o)) {
|
|
1224
|
+
if (a.mode === "strict")
|
|
1225
|
+
throw new A(
|
|
1226
|
+
"E_NOMINAL_CYCLE",
|
|
1227
|
+
`[${t}] cycle detected at "${a.path}": a nominal instance references itself. Strict mode rejects cycles (DESIGN §8.3); break the cycle or use 'lossy' mode.`
|
|
1228
|
+
);
|
|
1229
|
+
return null;
|
|
1230
|
+
}
|
|
1231
|
+
a.seen.add(o);
|
|
1232
|
+
try {
|
|
1233
|
+
const s = Q(i), u = typeof i[x] == "string" ? i[x] : "toJSON", c = o[u];
|
|
1234
|
+
if (typeof c == "function") {
|
|
1235
|
+
const l = c.call(o);
|
|
1236
|
+
if (l !== null && typeof l == "object" && !Array.isArray(l)) {
|
|
1237
|
+
const y = {};
|
|
1238
|
+
for (const [h, O] of Object.entries(
|
|
1239
|
+
l
|
|
1240
|
+
))
|
|
1241
|
+
y[h] = X(O, s[h], {
|
|
1242
|
+
...a,
|
|
1243
|
+
path: `${a.path}/${h}`
|
|
1244
|
+
});
|
|
1245
|
+
return y;
|
|
1246
|
+
}
|
|
1247
|
+
return l;
|
|
1248
|
+
}
|
|
1249
|
+
const f = {}, d = Object.keys(s), p = o, w = d.length > 0 ? d : Object.keys(p);
|
|
1250
|
+
for (const l of w) {
|
|
1251
|
+
const y = p[l];
|
|
1252
|
+
y !== void 0 && (f[l] = X(y, s[l], {
|
|
1253
|
+
...a,
|
|
1254
|
+
path: `${a.path}/${l}`
|
|
1255
|
+
}));
|
|
1256
|
+
}
|
|
1257
|
+
return f;
|
|
1258
|
+
} finally {
|
|
1259
|
+
a.seen.delete(o);
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
decode(o, i, a) {
|
|
1263
|
+
if (o === null || typeof o != "object" || Array.isArray(o)) {
|
|
1264
|
+
let f;
|
|
1265
|
+
throw o === null ? f = "null" : Array.isArray(o) ? f = "array" : f = typeof o, new A(
|
|
1266
|
+
"E_NOMINAL_INVALID_WIRE",
|
|
1267
|
+
`[${t}] expected a JSON object on the wire at "${a.path}", got ${f}.`
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
const s = o;
|
|
1271
|
+
for (const f of Fe(i))
|
|
1272
|
+
if (!(f in s))
|
|
1273
|
+
throw new A(
|
|
1274
|
+
"E_NOMINAL_INVALID_WIRE",
|
|
1275
|
+
`[${t}] required field "${f}" missing on the wire at "${a.path}".`
|
|
1276
|
+
);
|
|
1277
|
+
if (i[ze] === !1)
|
|
1278
|
+
throw new A(
|
|
1279
|
+
"E_NOMINAL_NONRECONSTRUCTABLE",
|
|
1280
|
+
`[${t}] is encode-only: the extractor marked it non-reconstructable (x-apigen-instances:false). It cannot be decoded back to a live instance.`
|
|
1281
|
+
);
|
|
1282
|
+
const u = Q(i), c = {};
|
|
1283
|
+
for (const [f, d] of Object.entries(s))
|
|
1284
|
+
c[f] = We(d, u[f], {
|
|
1285
|
+
...a,
|
|
1286
|
+
path: `${a.path}/${f}`
|
|
1287
|
+
});
|
|
1288
|
+
if (n) {
|
|
1289
|
+
const f = typeof i[k] == "string" ? i[k] : "fromJSON", d = n[f];
|
|
1290
|
+
if (typeof d == "function")
|
|
1291
|
+
return d.call(
|
|
1292
|
+
n,
|
|
1293
|
+
c
|
|
1294
|
+
);
|
|
1295
|
+
const p = n;
|
|
1296
|
+
return new p(c);
|
|
1297
|
+
}
|
|
1298
|
+
return c;
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
const Ve = [
|
|
1303
|
+
R,
|
|
1304
|
+
P,
|
|
1305
|
+
B,
|
|
1306
|
+
q,
|
|
1307
|
+
z,
|
|
1308
|
+
F
|
|
1309
|
+
], Je = {
|
|
1310
|
+
type: "object",
|
|
1311
|
+
"x-apigen-logical": "nominal",
|
|
1312
|
+
"x-apigen-codec": "ts.NominalSentinel"
|
|
1313
|
+
}, Z = Ke({
|
|
1314
|
+
id: "ts.NominalSentinel",
|
|
1315
|
+
schema: Je
|
|
1316
|
+
}), He = {
|
|
1317
|
+
oneOf: [],
|
|
1318
|
+
discriminator: { propertyName: "kind", mapping: {} },
|
|
1319
|
+
"x-apigen-logical": "union",
|
|
1320
|
+
"x-apigen-codec": "ts.UnionSentinel"
|
|
1321
|
+
}, ee = qe({
|
|
1322
|
+
id: "ts.UnionSentinel",
|
|
1323
|
+
schema: He
|
|
1324
|
+
});
|
|
1325
|
+
function Ge() {
|
|
1326
|
+
const e = [
|
|
1327
|
+
// 6 well-known scalars
|
|
1328
|
+
...Ve.map((t) => [
|
|
1329
|
+
t.id,
|
|
1330
|
+
t
|
|
1331
|
+
]),
|
|
1332
|
+
// nominal kind sentinel
|
|
1333
|
+
[Z.id, Z],
|
|
1334
|
+
// union kind sentinel
|
|
1335
|
+
[ee.id, ee]
|
|
1336
|
+
];
|
|
1337
|
+
return Object.freeze(new Map(e));
|
|
1338
|
+
}
|
|
1339
|
+
const wt = Object.freeze({
|
|
1340
|
+
host: "ts",
|
|
1341
|
+
logicalTypeVersion: ue,
|
|
1342
|
+
codecs: Ge()
|
|
1343
|
+
});
|
|
1344
|
+
function bt(e, t, r) {
|
|
1345
|
+
var i;
|
|
1346
|
+
const n = typeof ((i = t == null ? void 0 : t.input) == null ? void 0 : i.description) == "string" ? t.input.description : void 0, o = [r, n].filter(
|
|
1347
|
+
(a) => typeof a == "string" && a.length > 0
|
|
1348
|
+
);
|
|
1349
|
+
return o.length > 0 ? o.join(" — ") : e;
|
|
1350
|
+
}
|
|
1351
|
+
function vt(e) {
|
|
1352
|
+
if (!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).length === 0)
|
|
1353
|
+
return { outputSchema: void 0, wrapped: !1 };
|
|
1354
|
+
const t = e;
|
|
1355
|
+
return t.type === "object" ? { outputSchema: t, wrapped: !1 } : {
|
|
1356
|
+
outputSchema: {
|
|
1357
|
+
type: "object",
|
|
1358
|
+
properties: { result: t },
|
|
1359
|
+
required: ["result"]
|
|
1360
|
+
},
|
|
1361
|
+
wrapped: !0
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
function $t(e, t) {
|
|
1365
|
+
return e ? { result: t } : t && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1366
|
+
}
|
|
1367
|
+
export {
|
|
1368
|
+
Ne as EventBus,
|
|
1369
|
+
lt as InstanceRegistry,
|
|
1370
|
+
nt as LayerContext,
|
|
1371
|
+
m as UnionCodecError,
|
|
1372
|
+
Le as ValidateSchemasToken,
|
|
1373
|
+
Ve as WELL_KNOWN_TS_CODECS,
|
|
1374
|
+
Te as assertNoSelfSubscription,
|
|
1375
|
+
je as buildContext,
|
|
1376
|
+
ut as buildFnTable,
|
|
1377
|
+
vt as buildMcpOutputSchema,
|
|
1378
|
+
bt as buildToolDescription,
|
|
1379
|
+
ft as coerceQueryParams,
|
|
1380
|
+
mt as collectWithPhase,
|
|
1381
|
+
st as createApiPackage,
|
|
1382
|
+
ot as createInvoker,
|
|
1383
|
+
at as createLogger,
|
|
1384
|
+
yt as createStream,
|
|
1385
|
+
qe as createUnionCodec,
|
|
1386
|
+
we as dataParamNames,
|
|
1387
|
+
it as defineMiddleware,
|
|
1388
|
+
ct as describeParams,
|
|
1389
|
+
$e as dispatch,
|
|
1390
|
+
ht as drainStream,
|
|
1391
|
+
gt as isApiStream,
|
|
1392
|
+
pt as makeValidateLayer,
|
|
1393
|
+
ge as needsEnvelopeField,
|
|
1394
|
+
wt as tsHostBinding,
|
|
1395
|
+
dt as validateLayer,
|
|
1396
|
+
Oe as wireObservers,
|
|
1397
|
+
$t as wrapMcpStructuredContent
|
|
1398
|
+
};
|