@adhd/apigen-engine-runtime 0.2.3 → 0.2.4
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/CHANGELOG.md +25 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +682 -509
- package/lib/describe-params.d.ts +12 -1
- package/lib/op-plan.d.ts +7 -0
- package/lib/package-invoker.d.ts +17 -0
- package/package.json +25 -5
package/index.mjs
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import "ts-morph";
|
|
2
1
|
import "node:fs";
|
|
2
|
+
import { createRequire as he } from "node:module";
|
|
3
3
|
import "node:path";
|
|
4
|
-
import "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class J extends Error {
|
|
4
|
+
import N from "pino";
|
|
5
|
+
import _e from "ajv";
|
|
6
|
+
import ke from "ajv-formats";
|
|
7
|
+
const M = "$apigen";
|
|
8
|
+
let Z = class extends Error {
|
|
10
9
|
constructor(t) {
|
|
11
10
|
super(t), this.code = "E_DUP_CODEC", this.name = "CodecRegistryError";
|
|
12
11
|
}
|
|
13
|
-
}
|
|
14
|
-
function
|
|
12
|
+
};
|
|
13
|
+
function Ie(e) {
|
|
15
14
|
const t = /* @__PURE__ */ new Map();
|
|
16
15
|
return {
|
|
17
16
|
register(n, r) {
|
|
18
17
|
if (t.has(n.id) && !(r != null && r.override))
|
|
19
|
-
throw new
|
|
18
|
+
throw new Z(
|
|
20
19
|
`E_DUP_CODEC: a codec is already registered for id "${n.id}"`
|
|
21
20
|
);
|
|
22
21
|
t.set(n.id, n);
|
|
@@ -35,7 +34,7 @@ function Oe(e) {
|
|
|
35
34
|
freeze() {
|
|
36
35
|
const n = new Map(t), r = {
|
|
37
36
|
register() {
|
|
38
|
-
throw new
|
|
37
|
+
throw new Z(
|
|
39
38
|
"E_DUP_CODEC: registry is frozen and cannot accept new codecs"
|
|
40
39
|
);
|
|
41
40
|
},
|
|
@@ -58,8 +57,8 @@ function Oe(e) {
|
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
|
-
const
|
|
62
|
-
function
|
|
60
|
+
const F = "x-apigen-logical", V = "x-apigen-codec", T = "x-apigen-ctor", P = "x-apigen-tojson", Ce = "0.1.0";
|
|
61
|
+
function Q(e, t) {
|
|
63
62
|
return {
|
|
64
63
|
registry: e,
|
|
65
64
|
resolve: (n) => {
|
|
@@ -84,41 +83,41 @@ function v(e, t, n) {
|
|
|
84
83
|
}
|
|
85
84
|
const i = t.oneOf;
|
|
86
85
|
if (Array.isArray(i)) {
|
|
87
|
-
const a =
|
|
86
|
+
const a = ge(e, i, t, n);
|
|
88
87
|
return v(e, a, n);
|
|
89
88
|
}
|
|
90
89
|
const s = t.type;
|
|
91
90
|
if (s === "array") {
|
|
92
91
|
if (!Array.isArray(e))
|
|
93
|
-
return
|
|
92
|
+
return A(e, t, n);
|
|
94
93
|
const a = t.items;
|
|
95
94
|
if (!a)
|
|
96
|
-
return e.map((
|
|
95
|
+
return e.map((u) => w(u));
|
|
97
96
|
const f = n.path;
|
|
98
|
-
return Array.isArray(a) ? e.map((
|
|
99
|
-
const
|
|
100
|
-
return
|
|
97
|
+
return Array.isArray(a) ? e.map((u, c) => {
|
|
98
|
+
const l = a[c];
|
|
99
|
+
return l === void 0 ? w(u) : v(u, l, { ...n, path: `${f}/${c}` });
|
|
101
100
|
}) : e.map(
|
|
102
|
-
(
|
|
101
|
+
(u, c) => v(u, a, { ...n, path: `${f}/${c}` })
|
|
103
102
|
);
|
|
104
103
|
}
|
|
105
104
|
if (s === "object") {
|
|
106
105
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
107
|
-
return
|
|
106
|
+
return A(e, t, n);
|
|
108
107
|
const a = t.properties;
|
|
109
108
|
if (!a)
|
|
110
109
|
return w(e);
|
|
111
|
-
const f = n.path,
|
|
112
|
-
for (const [
|
|
113
|
-
const
|
|
114
|
-
|
|
110
|
+
const f = n.path, u = {};
|
|
111
|
+
for (const [c, l] of Object.entries(a)) {
|
|
112
|
+
const p = e[c];
|
|
113
|
+
p !== void 0 && (u[c] = v(p, l, {
|
|
115
114
|
...n,
|
|
116
|
-
path: `${f}/${
|
|
115
|
+
path: `${f}/${c}`
|
|
117
116
|
}));
|
|
118
117
|
}
|
|
119
|
-
return
|
|
118
|
+
return u;
|
|
120
119
|
}
|
|
121
|
-
return s == null ?
|
|
120
|
+
return s == null ? A(e, t, n) : w(e);
|
|
122
121
|
}
|
|
123
122
|
function $(e, t, n) {
|
|
124
123
|
const r = n.registry.resolve(t);
|
|
@@ -131,7 +130,7 @@ function $(e, t, n) {
|
|
|
131
130
|
}
|
|
132
131
|
const i = t.oneOf;
|
|
133
132
|
if (Array.isArray(i)) {
|
|
134
|
-
const a =
|
|
133
|
+
const a = ge(e, i, t, n);
|
|
135
134
|
return $(e, a, n);
|
|
136
135
|
}
|
|
137
136
|
const s = t.type;
|
|
@@ -142,11 +141,11 @@ function $(e, t, n) {
|
|
|
142
141
|
if (!a)
|
|
143
142
|
return e;
|
|
144
143
|
const f = n.path;
|
|
145
|
-
return Array.isArray(a) ? e.map((
|
|
146
|
-
const
|
|
147
|
-
return
|
|
144
|
+
return Array.isArray(a) ? e.map((u, c) => {
|
|
145
|
+
const l = a[c];
|
|
146
|
+
return l === void 0 ? u : $(u, l, { ...n, path: `${f}/${c}` });
|
|
148
147
|
}) : e.map(
|
|
149
|
-
(
|
|
148
|
+
(u, c) => $(u, a, { ...n, path: `${f}/${c}` })
|
|
150
149
|
);
|
|
151
150
|
}
|
|
152
151
|
if (s === "object") {
|
|
@@ -155,51 +154,177 @@ function $(e, t, n) {
|
|
|
155
154
|
const a = t.properties;
|
|
156
155
|
if (!a)
|
|
157
156
|
return e;
|
|
158
|
-
const f = n.path,
|
|
159
|
-
for (const [
|
|
160
|
-
const
|
|
161
|
-
|
|
157
|
+
const f = n.path, u = {};
|
|
158
|
+
for (const [c, l] of Object.entries(a)) {
|
|
159
|
+
const p = e[c];
|
|
160
|
+
p !== void 0 && (u[c] = $(p, l, {
|
|
162
161
|
...n,
|
|
163
|
-
path: `${f}/${
|
|
162
|
+
path: `${f}/${c}`
|
|
164
163
|
}));
|
|
165
164
|
}
|
|
166
|
-
|
|
165
|
+
for (const [c, l] of Object.entries(e))
|
|
166
|
+
!(c in a) && l !== void 0 && (u[c] = l);
|
|
167
|
+
return u;
|
|
167
168
|
}
|
|
168
|
-
return s == null ?
|
|
169
|
-
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
|
|
169
|
+
return s == null ? D(e, n) : e;
|
|
170
|
+
}
|
|
171
|
+
function ge(e, t, n, r) {
|
|
172
|
+
var o;
|
|
173
|
+
const i = n.discriminator;
|
|
174
|
+
if (i != null && i.propertyName) {
|
|
175
|
+
const u = i.propertyName, c = e !== null && typeof e == "object" ? e[u] : void 0;
|
|
176
|
+
if (typeof c == "string") {
|
|
177
|
+
if (i.mapping) {
|
|
178
|
+
const l = i.mapping[c];
|
|
179
|
+
if (l) {
|
|
180
|
+
const p = t.find((y) => y.$ref === l);
|
|
181
|
+
if (p)
|
|
182
|
+
return p;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
for (const l of t) {
|
|
186
|
+
const p = (o = _(l, r).properties) == null ? void 0 : o[u];
|
|
187
|
+
if (!p)
|
|
188
|
+
continue;
|
|
189
|
+
const y = p.enum;
|
|
190
|
+
if (p.const === c || Array.isArray(y) && y.includes(c))
|
|
191
|
+
return l;
|
|
180
192
|
}
|
|
181
193
|
}
|
|
182
194
|
}
|
|
183
|
-
|
|
195
|
+
const s = xe(e, t, r);
|
|
196
|
+
if (s)
|
|
197
|
+
return s;
|
|
198
|
+
let a, f = -1;
|
|
199
|
+
for (const u of t) {
|
|
200
|
+
const c = _(u, r), l = we(e, c, r);
|
|
201
|
+
l !== null && l > f && (f = l, a = u);
|
|
202
|
+
}
|
|
203
|
+
return a !== void 0 ? a : t[0] ?? {};
|
|
184
204
|
}
|
|
185
|
-
function _(e, t
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
205
|
+
function _(e, t) {
|
|
206
|
+
const n = e.$ref;
|
|
207
|
+
return typeof n == "string" ? t.resolve(n) : e;
|
|
208
|
+
}
|
|
209
|
+
function X(e) {
|
|
210
|
+
if ("const" in e)
|
|
211
|
+
return e.const;
|
|
212
|
+
const t = e.enum;
|
|
213
|
+
if (Array.isArray(t) && t.length === 1)
|
|
214
|
+
return t[0];
|
|
215
|
+
}
|
|
216
|
+
function xe(e, t, n) {
|
|
217
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
218
|
+
return;
|
|
219
|
+
const r = e, o = t.map((s) => _(s, n)), i = /* @__PURE__ */ new Set();
|
|
220
|
+
for (const s of o) {
|
|
221
|
+
const a = s.properties;
|
|
222
|
+
if (a)
|
|
223
|
+
for (const [f, u] of Object.entries(a))
|
|
224
|
+
X(u) !== void 0 && i.add(f);
|
|
225
|
+
}
|
|
226
|
+
for (const s of i) {
|
|
227
|
+
const a = o.map((p) => {
|
|
228
|
+
const y = p.properties, d = y == null ? void 0 : y[s];
|
|
229
|
+
return d ? X(d) : void 0;
|
|
230
|
+
}), f = a.filter((p) => p !== void 0), u = new Set(f);
|
|
231
|
+
if (f.length < 2 || u.size !== f.length)
|
|
232
|
+
continue;
|
|
233
|
+
const c = r[s];
|
|
234
|
+
if (c === void 0)
|
|
235
|
+
continue;
|
|
236
|
+
const l = a.findIndex((p) => p === c);
|
|
237
|
+
if (l !== -1)
|
|
238
|
+
return t[l];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function Se(e) {
|
|
242
|
+
if (e === null)
|
|
243
|
+
return "null";
|
|
244
|
+
if (Array.isArray(e))
|
|
245
|
+
return "array";
|
|
246
|
+
const t = typeof e;
|
|
247
|
+
return t === "number" ? Number.isInteger(e) ? "integer" : "number" : t;
|
|
248
|
+
}
|
|
249
|
+
function we(e, t, n) {
|
|
250
|
+
const r = t.oneOf;
|
|
251
|
+
if (Array.isArray(r)) {
|
|
252
|
+
let c = null;
|
|
253
|
+
for (const l of r) {
|
|
254
|
+
const p = we(e, _(l, n), n);
|
|
255
|
+
p !== null && (c === null || p > c) && (c = p);
|
|
256
|
+
}
|
|
257
|
+
return c;
|
|
258
|
+
}
|
|
259
|
+
const o = t.type, i = Se(e);
|
|
260
|
+
if (typeof o == "string") {
|
|
261
|
+
if (!(o === i || o === "number" && i === "integer"))
|
|
262
|
+
return null;
|
|
263
|
+
} else if (Array.isArray(o) && !o.some(
|
|
264
|
+
(c) => c === i || c === "number" && i === "integer"
|
|
265
|
+
))
|
|
266
|
+
return null;
|
|
267
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
268
|
+
return typeof o == "string" ? 1 : 0;
|
|
269
|
+
const s = e, a = t.required;
|
|
270
|
+
let f = 0;
|
|
271
|
+
if (Array.isArray(a)) {
|
|
272
|
+
for (const c of a)
|
|
273
|
+
if (typeof c == "string") {
|
|
274
|
+
if (s[c] === void 0)
|
|
275
|
+
return null;
|
|
276
|
+
f += 2;
|
|
193
277
|
}
|
|
194
278
|
}
|
|
279
|
+
const u = t.properties;
|
|
280
|
+
if (u) {
|
|
281
|
+
for (const c of Object.keys(u))
|
|
282
|
+
s[c] !== void 0 && (f += 1);
|
|
283
|
+
for (const c of Object.keys(s))
|
|
284
|
+
u[c] === void 0 && (f -= 1);
|
|
285
|
+
}
|
|
286
|
+
return f;
|
|
287
|
+
}
|
|
288
|
+
function A(e, t, n) {
|
|
289
|
+
var r;
|
|
290
|
+
for (const o of n.registry.ids()) {
|
|
291
|
+
const i = n.registry.get(o);
|
|
292
|
+
if ((r = i == null ? void 0 : i.ownsValue) != null && r.call(i, e))
|
|
293
|
+
return {
|
|
294
|
+
[M]: o,
|
|
295
|
+
v: i.encode(e, i.schema, n)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
if (Array.isArray(e))
|
|
299
|
+
return e.map((o) => A(o, {}, n));
|
|
300
|
+
if (be(e)) {
|
|
301
|
+
const o = {};
|
|
302
|
+
for (const [i, s] of Object.entries(e))
|
|
303
|
+
s !== void 0 && (o[i] = A(s, {}, n));
|
|
304
|
+
return o;
|
|
305
|
+
}
|
|
195
306
|
return w(e);
|
|
196
307
|
}
|
|
197
|
-
function
|
|
198
|
-
if (e
|
|
199
|
-
|
|
308
|
+
function be(e) {
|
|
309
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
310
|
+
return !1;
|
|
311
|
+
const t = Object.getPrototypeOf(e);
|
|
312
|
+
return t === Object.prototype || t === null;
|
|
313
|
+
}
|
|
314
|
+
function D(e, t) {
|
|
315
|
+
if (e !== null && typeof e == "object" && !Array.isArray(e) && M in e) {
|
|
316
|
+
const n = e, r = n[M], o = t.registry.get(r);
|
|
200
317
|
if (o)
|
|
201
318
|
return o.decode(n.v, o.schema, t);
|
|
202
319
|
}
|
|
320
|
+
if (Array.isArray(e))
|
|
321
|
+
return e.map((n) => D(n, t));
|
|
322
|
+
if (be(e)) {
|
|
323
|
+
const n = {};
|
|
324
|
+
for (const [r, o] of Object.entries(e))
|
|
325
|
+
n[r] = D(o, t);
|
|
326
|
+
return n;
|
|
327
|
+
}
|
|
203
328
|
return e;
|
|
204
329
|
}
|
|
205
330
|
function w(e) {
|
|
@@ -215,25 +340,28 @@ function w(e) {
|
|
|
215
340
|
}
|
|
216
341
|
return null;
|
|
217
342
|
}
|
|
218
|
-
function
|
|
343
|
+
function Me(e) {
|
|
219
344
|
return {
|
|
220
345
|
encode(t, n, r) {
|
|
221
|
-
const o =
|
|
346
|
+
const o = Q(e, r);
|
|
222
347
|
return v(t, n, o);
|
|
223
348
|
},
|
|
224
349
|
decode(t, n, r) {
|
|
225
|
-
const o =
|
|
350
|
+
const o = Q(e, r);
|
|
226
351
|
return $(t, n, o);
|
|
227
352
|
}
|
|
228
353
|
};
|
|
229
354
|
}
|
|
230
|
-
const
|
|
355
|
+
const H = {
|
|
231
356
|
id: "date-time",
|
|
232
357
|
kind: "scalar",
|
|
233
358
|
schema: { type: "string", format: "date-time" },
|
|
234
359
|
matches(e) {
|
|
235
360
|
return e.type === "string" && e.format === "date-time";
|
|
236
361
|
},
|
|
362
|
+
ownsValue(e) {
|
|
363
|
+
return e instanceof Date;
|
|
364
|
+
},
|
|
237
365
|
encode(e, t, n) {
|
|
238
366
|
return e.toISOString();
|
|
239
367
|
},
|
|
@@ -251,13 +379,16 @@ const F = {
|
|
|
251
379
|
);
|
|
252
380
|
return new Date(e);
|
|
253
381
|
}
|
|
254
|
-
},
|
|
382
|
+
}, K = {
|
|
255
383
|
id: "int64",
|
|
256
384
|
kind: "scalar",
|
|
257
385
|
schema: { type: "string", format: "int64" },
|
|
258
386
|
matches(e) {
|
|
259
387
|
return e.type === "string" && e.format === "int64";
|
|
260
388
|
},
|
|
389
|
+
ownsValue(e) {
|
|
390
|
+
return typeof e == "bigint";
|
|
391
|
+
},
|
|
261
392
|
encode(e, t, n) {
|
|
262
393
|
return String(e);
|
|
263
394
|
},
|
|
@@ -283,7 +414,7 @@ const F = {
|
|
|
283
414
|
}
|
|
284
415
|
return BigInt(0);
|
|
285
416
|
}
|
|
286
|
-
},
|
|
417
|
+
}, z = {
|
|
287
418
|
id: "decimal",
|
|
288
419
|
kind: "scalar",
|
|
289
420
|
schema: { type: "string", format: "decimal" },
|
|
@@ -307,13 +438,16 @@ const F = {
|
|
|
307
438
|
);
|
|
308
439
|
return e;
|
|
309
440
|
}
|
|
310
|
-
},
|
|
441
|
+
}, J = {
|
|
311
442
|
id: "byte",
|
|
312
443
|
kind: "scalar",
|
|
313
444
|
schema: { type: "string", format: "byte" },
|
|
314
445
|
matches(e) {
|
|
315
446
|
return e.type === "string" && e.format === "byte";
|
|
316
447
|
},
|
|
448
|
+
ownsValue(e) {
|
|
449
|
+
return e instanceof Uint8Array;
|
|
450
|
+
},
|
|
317
451
|
encode(e, t, n) {
|
|
318
452
|
return Buffer.from(e).toString("base64");
|
|
319
453
|
},
|
|
@@ -331,7 +465,7 @@ const F = {
|
|
|
331
465
|
);
|
|
332
466
|
return new Uint8Array(Buffer.from(e, "base64"));
|
|
333
467
|
}
|
|
334
|
-
},
|
|
468
|
+
}, Te = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, W = {
|
|
335
469
|
id: "uuid",
|
|
336
470
|
kind: "scalar",
|
|
337
471
|
schema: { type: "string", format: "uuid" },
|
|
@@ -349,35 +483,38 @@ const F = {
|
|
|
349
483
|
);
|
|
350
484
|
return String(e).toLowerCase();
|
|
351
485
|
}
|
|
352
|
-
if (n.mode === "strict" && !
|
|
486
|
+
if (n.mode === "strict" && !Te.test(e))
|
|
353
487
|
throw new TypeError(
|
|
354
488
|
`[uuid] wire value "${e}" at "${n.path}" is not a lowercase-hyphenated RFC 4122 UUID`
|
|
355
489
|
);
|
|
356
490
|
return e;
|
|
357
491
|
}
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
]),
|
|
492
|
+
}, U = "NaN", R = "Infinity", L = "-Infinity", Pe = /* @__PURE__ */ new Set([
|
|
493
|
+
U,
|
|
494
|
+
R,
|
|
495
|
+
L
|
|
496
|
+
]), G = {
|
|
363
497
|
id: "number-special",
|
|
364
498
|
kind: "scalar",
|
|
365
499
|
schema: { type: "number" },
|
|
366
500
|
matches(e) {
|
|
367
501
|
return e.type === "number" && e.format === void 0;
|
|
368
502
|
},
|
|
503
|
+
ownsValue(e) {
|
|
504
|
+
return typeof e == "number" && !Number.isFinite(e);
|
|
505
|
+
},
|
|
369
506
|
encode(e, t, n) {
|
|
370
|
-
return Number.isNaN(e) ?
|
|
507
|
+
return Number.isNaN(e) ? U : e === 1 / 0 ? R : e === -1 / 0 ? L : e;
|
|
371
508
|
},
|
|
372
509
|
decode(e, t, n) {
|
|
373
510
|
if (typeof e == "number")
|
|
374
511
|
return e;
|
|
375
512
|
if (typeof e == "string") {
|
|
376
|
-
if (e ===
|
|
513
|
+
if (e === U)
|
|
377
514
|
return NaN;
|
|
378
|
-
if (e ===
|
|
515
|
+
if (e === R)
|
|
379
516
|
return 1 / 0;
|
|
380
|
-
if (e ===
|
|
517
|
+
if (e === L)
|
|
381
518
|
return -1 / 0;
|
|
382
519
|
const r = Number(e);
|
|
383
520
|
if (!Number.isNaN(r))
|
|
@@ -385,34 +522,34 @@ const F = {
|
|
|
385
522
|
}
|
|
386
523
|
if (n.mode === "strict")
|
|
387
524
|
throw new TypeError(
|
|
388
|
-
`[number-special] unrecognized wire value at "${n.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...
|
|
525
|
+
`[number-special] unrecognized wire value at "${n.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...Pe].join(", ")}.`
|
|
389
526
|
);
|
|
390
527
|
return NaN;
|
|
391
528
|
}
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
q,
|
|
529
|
+
}, De = [
|
|
530
|
+
H,
|
|
395
531
|
K,
|
|
396
532
|
z,
|
|
397
|
-
|
|
398
|
-
W
|
|
533
|
+
J,
|
|
534
|
+
W,
|
|
535
|
+
G
|
|
399
536
|
];
|
|
400
|
-
function
|
|
401
|
-
for (const n of
|
|
537
|
+
function Ue(e, t = {}) {
|
|
538
|
+
for (const n of De)
|
|
402
539
|
e.register(n, { override: t.override ?? !1 });
|
|
403
540
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
541
|
+
const Re = 12;
|
|
542
|
+
function Le(e, t) {
|
|
406
543
|
const n = /^#\/(definitions|\$defs)\/(.+)$/.exec(e);
|
|
407
544
|
if (!n)
|
|
408
545
|
return;
|
|
409
546
|
const [, r, o] = n, i = r === "$defs" ? t.$defs : t.definitions;
|
|
410
547
|
return i == null ? void 0 : i[decodeURIComponent(o)];
|
|
411
548
|
}
|
|
412
|
-
function
|
|
549
|
+
function ee(e) {
|
|
413
550
|
return Array.isArray(e) && e.length > 0 ? e[0] : void 0;
|
|
414
551
|
}
|
|
415
|
-
function
|
|
552
|
+
function Be(e) {
|
|
416
553
|
if (Array.isArray(e.type))
|
|
417
554
|
return e.type.find((t) => t !== "null") ?? e.type[0];
|
|
418
555
|
if (typeof e.type == "string")
|
|
@@ -420,7 +557,7 @@ function Me(e) {
|
|
|
420
557
|
if (e.properties)
|
|
421
558
|
return "object";
|
|
422
559
|
}
|
|
423
|
-
function
|
|
560
|
+
function qe(e) {
|
|
424
561
|
switch (e.format) {
|
|
425
562
|
case "date-time":
|
|
426
563
|
return "1970-01-01T00:00:00.000Z";
|
|
@@ -452,24 +589,24 @@ function Te(e) {
|
|
|
452
589
|
return "<string>";
|
|
453
590
|
}
|
|
454
591
|
}
|
|
455
|
-
function
|
|
592
|
+
function te(e, t, n) {
|
|
456
593
|
const r = e.properties ?? {}, o = e.required ?? [], i = {};
|
|
457
594
|
for (const s of o) {
|
|
458
595
|
const a = r[s];
|
|
459
|
-
i[s] = a !== void 0 ?
|
|
596
|
+
i[s] = a !== void 0 ? j(a, t, n + 1) : `<${s}>`;
|
|
460
597
|
}
|
|
461
598
|
return i;
|
|
462
599
|
}
|
|
463
|
-
function
|
|
600
|
+
function Fe(e, t, n) {
|
|
464
601
|
const r = Array.isArray(e.items) ? e.items[0] : e.items;
|
|
465
|
-
return r ? [
|
|
602
|
+
return r ? [j(r, t, n + 1)] : [];
|
|
466
603
|
}
|
|
467
|
-
function
|
|
468
|
-
if (!e || n >
|
|
604
|
+
function j(e, t = e ?? {}, n = 0) {
|
|
605
|
+
if (!e || n > Re)
|
|
469
606
|
return null;
|
|
470
607
|
if (typeof e.$ref == "string") {
|
|
471
|
-
const o =
|
|
472
|
-
return o !== void 0 ?
|
|
608
|
+
const o = Le(e.$ref, t);
|
|
609
|
+
return o !== void 0 ? j(o, t, n + 1) : null;
|
|
473
610
|
}
|
|
474
611
|
if (e.const !== void 0)
|
|
475
612
|
return e.const;
|
|
@@ -482,22 +619,22 @@ function A(e, t = e ?? {}, n = 0) {
|
|
|
482
619
|
for (const a of s.required ?? [])
|
|
483
620
|
i.includes(a) || i.push(a);
|
|
484
621
|
}
|
|
485
|
-
return
|
|
622
|
+
return te(
|
|
486
623
|
{ ...e, properties: o, required: i },
|
|
487
624
|
t,
|
|
488
625
|
n
|
|
489
626
|
);
|
|
490
627
|
}
|
|
491
|
-
const r =
|
|
628
|
+
const r = ee(e.oneOf) ?? ee(e.anyOf);
|
|
492
629
|
if (r)
|
|
493
|
-
return
|
|
494
|
-
switch (
|
|
630
|
+
return j(r, t, n + 1);
|
|
631
|
+
switch (Be(e)) {
|
|
495
632
|
case "object":
|
|
496
|
-
return
|
|
633
|
+
return te(e, t, n);
|
|
497
634
|
case "array":
|
|
498
|
-
return
|
|
635
|
+
return Fe(e, t, n);
|
|
499
636
|
case "string":
|
|
500
|
-
return
|
|
637
|
+
return qe(e);
|
|
501
638
|
case "integer":
|
|
502
639
|
case "number":
|
|
503
640
|
return 0;
|
|
@@ -509,59 +646,59 @@ function A(e, t = e ?? {}, n = 0) {
|
|
|
509
646
|
return null;
|
|
510
647
|
}
|
|
511
648
|
}
|
|
512
|
-
function
|
|
649
|
+
function ve(e) {
|
|
513
650
|
if (!e)
|
|
514
651
|
return;
|
|
515
|
-
const t =
|
|
652
|
+
const t = j(e);
|
|
516
653
|
return `Example: ${JSON.stringify(t)}`;
|
|
517
654
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
function
|
|
655
|
+
H.id, // 'date-time'
|
|
656
|
+
K.id, // 'int64'
|
|
657
|
+
z.id, // 'decimal'
|
|
658
|
+
J.id, // 'byte'
|
|
659
|
+
W.id, // 'uuid'
|
|
660
|
+
G.id;
|
|
661
|
+
const $e = Ie();
|
|
662
|
+
Ue($e);
|
|
663
|
+
const Ae = Me($e.freeze());
|
|
664
|
+
function Ve(e, t) {
|
|
528
665
|
var r;
|
|
529
666
|
const n = ((r = e.input) == null ? void 0 : r.properties) ?? {};
|
|
530
667
|
return t in n;
|
|
531
668
|
}
|
|
532
|
-
function
|
|
669
|
+
function He(e) {
|
|
533
670
|
var n, r;
|
|
534
671
|
const t = (r = (n = e.input) == null ? void 0 : n.properties) == null ? void 0 : r.data;
|
|
535
672
|
return Object.keys((t == null ? void 0 : t.properties) ?? {});
|
|
536
673
|
}
|
|
537
|
-
function
|
|
674
|
+
function Ke(e, t) {
|
|
538
675
|
var o, i, s;
|
|
539
676
|
const n = (s = (i = (o = e.input) == null ? void 0 : o.properties) == null ? void 0 : i.data) == null ? void 0 : s.properties, r = n == null ? void 0 : n[t];
|
|
540
677
|
return r !== void 0 ? r : void 0;
|
|
541
678
|
}
|
|
542
|
-
function
|
|
543
|
-
return t === void 0 || e === void 0 ? e :
|
|
679
|
+
function ze(e, t) {
|
|
680
|
+
return t === void 0 || e === void 0 ? e : Ae.decode(e, t);
|
|
544
681
|
}
|
|
545
|
-
function
|
|
682
|
+
function C(e, t) {
|
|
546
683
|
const n = t.output;
|
|
547
|
-
return !n || Object.keys(n).length === 0 ? e :
|
|
684
|
+
return !n || Object.keys(n).length === 0 ? e : Ae.encode(e, n);
|
|
548
685
|
}
|
|
549
|
-
async function
|
|
550
|
-
const a =
|
|
551
|
-
(
|
|
686
|
+
async function Je(e, t, n, r, o, i) {
|
|
687
|
+
const a = He(n).map(
|
|
688
|
+
(u) => ze(i[u], Ke(n, u))
|
|
552
689
|
);
|
|
553
|
-
if (
|
|
554
|
-
const
|
|
555
|
-
return
|
|
690
|
+
if (Ve(n, "session") && t) {
|
|
691
|
+
const u = await t({ session: o.session }), c = await e[r](u, ...a);
|
|
692
|
+
return C(c, n);
|
|
556
693
|
}
|
|
557
694
|
if (n.hasCtx) {
|
|
558
|
-
const
|
|
559
|
-
return
|
|
695
|
+
const u = t ? await t(o) : void 0, c = await e[r](u, ...a);
|
|
696
|
+
return C(c, n);
|
|
560
697
|
}
|
|
561
698
|
const f = await e[r](...a);
|
|
562
|
-
return
|
|
699
|
+
return C(f, n);
|
|
563
700
|
}
|
|
564
|
-
class
|
|
701
|
+
class We {
|
|
565
702
|
constructor() {
|
|
566
703
|
this._map = /* @__PURE__ */ new Map();
|
|
567
704
|
}
|
|
@@ -576,14 +713,14 @@ class Fe {
|
|
|
576
713
|
return this._map.has(t);
|
|
577
714
|
}
|
|
578
715
|
}
|
|
579
|
-
function
|
|
716
|
+
function Ge(e = []) {
|
|
580
717
|
return async function(n, r, o) {
|
|
581
718
|
const i = o.schemas[n];
|
|
582
719
|
if (!i)
|
|
583
720
|
throw new Error(
|
|
584
721
|
`apigen/invoke: no schema found for operation "${n}"`
|
|
585
722
|
);
|
|
586
|
-
const s = () =>
|
|
723
|
+
const s = () => Je(
|
|
587
724
|
o.fns,
|
|
588
725
|
o.createClient,
|
|
589
726
|
i,
|
|
@@ -592,15 +729,15 @@ function qe(e = []) {
|
|
|
592
729
|
r.domainArgs
|
|
593
730
|
);
|
|
594
731
|
return e.reduceRight(
|
|
595
|
-
(f,
|
|
732
|
+
(f, u) => () => u(r, f),
|
|
596
733
|
s
|
|
597
734
|
)();
|
|
598
735
|
};
|
|
599
736
|
}
|
|
600
|
-
function
|
|
737
|
+
function ln(e) {
|
|
601
738
|
return e;
|
|
602
739
|
}
|
|
603
|
-
class
|
|
740
|
+
class Ye {
|
|
604
741
|
constructor() {
|
|
605
742
|
this.handlers = /* @__PURE__ */ new Map();
|
|
606
743
|
}
|
|
@@ -627,22 +764,22 @@ class Ke {
|
|
|
627
764
|
}
|
|
628
765
|
async emit(t) {
|
|
629
766
|
for (const [n, r] of this.handlers)
|
|
630
|
-
if (
|
|
767
|
+
if (Ze(n, t))
|
|
631
768
|
for (const o of r)
|
|
632
769
|
await o(t);
|
|
633
770
|
}
|
|
634
771
|
}
|
|
635
|
-
function
|
|
772
|
+
function Ze(e, t) {
|
|
636
773
|
const [n, r, o] = e.split(":");
|
|
637
774
|
return !(n !== "*" && n !== t.module || r && r !== "*" && r !== t.method || o && o !== "*" && o !== t.lifecycle);
|
|
638
775
|
}
|
|
639
|
-
function
|
|
776
|
+
function Qe(e, t) {
|
|
640
777
|
for (const n of e)
|
|
641
778
|
if (n.eventMapping)
|
|
642
779
|
for (const [r, o] of Object.entries(n.eventMapping))
|
|
643
780
|
t.on(r, o);
|
|
644
781
|
}
|
|
645
|
-
async function
|
|
782
|
+
async function Xe(e, t, n) {
|
|
646
783
|
let r = { ...t };
|
|
647
784
|
for (const o of e)
|
|
648
785
|
if (o.createContext) {
|
|
@@ -672,7 +809,8 @@ async function We(e, t, n) {
|
|
|
672
809
|
}
|
|
673
810
|
return r;
|
|
674
811
|
}
|
|
675
|
-
|
|
812
|
+
he(import.meta.url);
|
|
813
|
+
function ne(e, t) {
|
|
676
814
|
const n = /* @__PURE__ */ new Set(), r = [e];
|
|
677
815
|
for (; r.length > 0; ) {
|
|
678
816
|
const o = r.pop();
|
|
@@ -682,56 +820,56 @@ function X(e, t) {
|
|
|
682
820
|
const i = o.$ref;
|
|
683
821
|
if (typeof i == "string") {
|
|
684
822
|
if (t) {
|
|
685
|
-
const
|
|
686
|
-
if (!
|
|
687
|
-
const
|
|
823
|
+
const l = t[i];
|
|
824
|
+
if (!l) {
|
|
825
|
+
const p = Object.keys(t).join(", ") || "(none)";
|
|
688
826
|
throw new Error(
|
|
689
|
-
`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${
|
|
827
|
+
`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${p}`
|
|
690
828
|
);
|
|
691
829
|
}
|
|
692
|
-
r.push(
|
|
830
|
+
r.push(l);
|
|
693
831
|
}
|
|
694
832
|
continue;
|
|
695
833
|
}
|
|
696
834
|
const s = o.oneOf;
|
|
697
835
|
if (Array.isArray(s))
|
|
698
|
-
for (const
|
|
699
|
-
typeof
|
|
836
|
+
for (const l of s)
|
|
837
|
+
typeof l == "object" && l !== null && r.push(l);
|
|
700
838
|
const a = o.properties;
|
|
701
839
|
if (a)
|
|
702
|
-
for (const
|
|
703
|
-
r.push(
|
|
840
|
+
for (const l of Object.values(a))
|
|
841
|
+
r.push(l);
|
|
704
842
|
const f = o.items;
|
|
705
843
|
if (Array.isArray(f))
|
|
706
|
-
for (const
|
|
707
|
-
typeof
|
|
844
|
+
for (const l of f)
|
|
845
|
+
typeof l == "object" && l !== null && r.push(l);
|
|
708
846
|
else
|
|
709
847
|
typeof f == "object" && f !== null && r.push(f);
|
|
710
|
-
const
|
|
711
|
-
typeof c == "object" && c !== null && r.push(c);
|
|
712
|
-
const u = o.propertyNames;
|
|
848
|
+
const u = o.additionalProperties;
|
|
713
849
|
typeof u == "object" && u !== null && r.push(u);
|
|
850
|
+
const c = o.propertyNames;
|
|
851
|
+
typeof c == "object" && c !== null && r.push(c);
|
|
714
852
|
}
|
|
715
853
|
}
|
|
716
|
-
const
|
|
717
|
-
function
|
|
854
|
+
const re = /* @__PURE__ */ new Set(["string", "number", "boolean", "integer"]);
|
|
855
|
+
function et(e) {
|
|
718
856
|
if (typeof e != "object" || e === null)
|
|
719
857
|
return !1;
|
|
720
858
|
const t = e;
|
|
721
859
|
if (t.$ref !== void 0 || t.oneOf || t.anyOf || t.allOf)
|
|
722
860
|
return !1;
|
|
723
861
|
const { type: n } = t;
|
|
724
|
-
return typeof n == "string" ?
|
|
862
|
+
return typeof n == "string" ? re.has(n) : Array.isArray(n) ? n.every((r) => re.has(r) || r === "null") : Array.isArray(t.enum) && t.enum.length > 0 ? t.enum.every((r) => ["string", "number", "boolean"].includes(typeof r)) : !1;
|
|
725
863
|
}
|
|
726
|
-
function
|
|
864
|
+
function tt(e) {
|
|
727
865
|
if (!e || typeof e != "object")
|
|
728
866
|
return !1;
|
|
729
867
|
const t = e.properties;
|
|
730
868
|
return t === void 0 || typeof t != "object" || t === null ? !1 : Object.values(t).every(
|
|
731
|
-
|
|
869
|
+
et
|
|
732
870
|
);
|
|
733
871
|
}
|
|
734
|
-
function
|
|
872
|
+
function nt(e) {
|
|
735
873
|
const t = {}, n = (r) => {
|
|
736
874
|
for (const o of ["definitions", "$defs"]) {
|
|
737
875
|
const i = r[o];
|
|
@@ -747,14 +885,14 @@ function Ge(e) {
|
|
|
747
885
|
if (Object.keys(t).length !== 0)
|
|
748
886
|
for (const [r, o] of Object.entries(e.schemas))
|
|
749
887
|
try {
|
|
750
|
-
|
|
888
|
+
ne(o.input, t), ne(o.output, t);
|
|
751
889
|
} catch (i) {
|
|
752
890
|
throw new Error(
|
|
753
891
|
`[apigen-core-client] Schema validation failed for function "${r}": ${i.message}`
|
|
754
892
|
);
|
|
755
893
|
}
|
|
756
894
|
}
|
|
757
|
-
function
|
|
895
|
+
function rt(e, t) {
|
|
758
896
|
const n = [
|
|
759
897
|
'apigen calling convention: all domain parameters go inside a "data" envelope — e.g. { "data": { ... } }' + (t ? "." : " (an empty object for this zero-parameter tool).")
|
|
760
898
|
];
|
|
@@ -762,60 +900,60 @@ function Ye(e, t) {
|
|
|
762
900
|
`Field(s) ${e.map((r) => `"${r}"`).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-engine-naming's envelopeMetaKey/envelopeCliFlag/envelopeEnvVar for the HTTP-header / CLI-flag / env-var equivalents.`
|
|
763
901
|
), n.join(" ");
|
|
764
902
|
}
|
|
765
|
-
function
|
|
766
|
-
|
|
903
|
+
function ot(e, t, n) {
|
|
904
|
+
nt(e);
|
|
767
905
|
const r = {};
|
|
768
906
|
for (const [o, i] of Object.entries(e.schemas)) {
|
|
769
|
-
const s = (n == null ? void 0 : n[o]) ?? {}, a = i.input.properties ?? {}, f = i.input.required ?? [],
|
|
907
|
+
const s = (n == null ? void 0 : n[o]) ?? {}, a = i.input.properties ?? {}, f = i.input.required ?? [], u = {}, c = [], l = {};
|
|
770
908
|
for (const h of t)
|
|
771
909
|
if (h.envelope && s[h.id] !== !1)
|
|
772
|
-
for (const [b,
|
|
773
|
-
|
|
774
|
-
const
|
|
910
|
+
for (const [b, Ee] of Object.entries(h.envelope))
|
|
911
|
+
u[b] = Ee, l[b] = h.id, c.includes(b) || c.push(b);
|
|
912
|
+
const p = {
|
|
775
913
|
type: "object",
|
|
776
914
|
properties: a,
|
|
777
915
|
additionalProperties: !1,
|
|
778
916
|
...f.length > 0 ? { required: f } : {}
|
|
779
|
-
},
|
|
917
|
+
}, y = i.safe === !0 || tt(i.input), d = i.input.definitions, m = i.input.$defs;
|
|
780
918
|
r[o] = {
|
|
781
919
|
input: {
|
|
782
920
|
type: "object",
|
|
783
|
-
properties: { ...
|
|
921
|
+
properties: { ...u, data: p },
|
|
784
922
|
required: [
|
|
785
|
-
...
|
|
923
|
+
...c,
|
|
786
924
|
...f.length > 0 ? ["data"] : []
|
|
787
925
|
],
|
|
788
926
|
// BUG-APIGEN-017: reject any property that isn't a declared envelope
|
|
789
927
|
// field or the "data" wrapper — no silently-ignored junk params.
|
|
790
928
|
additionalProperties: !1,
|
|
791
929
|
// BUG-APIGEN-020: document the envelope/data calling convention inline.
|
|
792
|
-
description:
|
|
793
|
-
Object.keys(
|
|
930
|
+
description: rt(
|
|
931
|
+
Object.keys(u),
|
|
794
932
|
Object.keys(a).length > 0
|
|
795
933
|
),
|
|
796
|
-
...
|
|
797
|
-
...
|
|
934
|
+
...d ? { definitions: d } : {},
|
|
935
|
+
...m ? { $defs: m } : {}
|
|
798
936
|
},
|
|
799
937
|
output: i.output,
|
|
800
938
|
// Carry the ctx-param flag through to dispatch (BUG-APIGEN-001).
|
|
801
939
|
...i.hasCtx ? { hasCtx: !0 } : {},
|
|
802
|
-
"x-apigen-safe":
|
|
940
|
+
"x-apigen-safe": y,
|
|
803
941
|
// DEBT-APIGEN-ENVELOPE-CAPABILITY-UNWIRED-001: field → pluginId map,
|
|
804
942
|
// read by `op-plan.ts`'s `computeEnvelopeFields`. Omitted (not an empty
|
|
805
943
|
// object) when no middleware contributed an envelope field, matching
|
|
806
944
|
// `x-apigen-safe`'s own "absent means nothing to report" convention.
|
|
807
|
-
...Object.keys(
|
|
945
|
+
...Object.keys(l).length > 0 ? { "x-apigen-envelope": l } : {}
|
|
808
946
|
};
|
|
809
947
|
}
|
|
810
948
|
return r;
|
|
811
949
|
}
|
|
812
|
-
const
|
|
950
|
+
const it = {
|
|
813
951
|
"decimal.js": "Decimal"
|
|
814
952
|
};
|
|
815
|
-
function
|
|
953
|
+
function st(e) {
|
|
816
954
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
817
955
|
}
|
|
818
|
-
Object.entries(
|
|
956
|
+
Object.entries(it).map(([e, t]) => ({
|
|
819
957
|
// Matches: import("...{modSpec}...").<anyMemberName> (single or double quotes)
|
|
820
958
|
// The module specifier appears inside an absolute path, so we allow any
|
|
821
959
|
// characters between the quote and the specifier, and between the specifier
|
|
@@ -823,58 +961,58 @@ Object.entries(Xe).map(([e, t]) => ({
|
|
|
823
961
|
// …) is matched generically (`\w+`) rather than anchored to one spelling —
|
|
824
962
|
// see the doc comment above for why.
|
|
825
963
|
pattern: new RegExp(
|
|
826
|
-
`import\\(["'][^"']*${
|
|
964
|
+
`import\\(["'][^"']*${st(e)}[^"']*["']\\)\\.\\w+`,
|
|
827
965
|
"g"
|
|
828
966
|
),
|
|
829
967
|
key: t
|
|
830
968
|
}));
|
|
831
|
-
class
|
|
969
|
+
class B extends Error {
|
|
832
970
|
constructor(t) {
|
|
833
971
|
super(t), this.name = "ConfigurationError";
|
|
834
972
|
}
|
|
835
973
|
}
|
|
836
|
-
function
|
|
974
|
+
function at(e) {
|
|
837
975
|
for (const t of e)
|
|
838
976
|
for (const n of Object.keys(t.eventMapping ?? {})) {
|
|
839
977
|
const [r] = n.split(":");
|
|
840
978
|
if (r !== "*" && r === t.id)
|
|
841
|
-
throw new
|
|
979
|
+
throw new B(
|
|
842
980
|
`Middleware "${t.id}" subscribes to its own events via "${n}". This would cause infinite recursion.`
|
|
843
981
|
);
|
|
844
982
|
}
|
|
845
983
|
}
|
|
846
|
-
function
|
|
984
|
+
function pn(e) {
|
|
847
985
|
const {
|
|
848
986
|
domainSchemas: t,
|
|
849
987
|
middlewares: n,
|
|
850
988
|
overrides: r = {},
|
|
851
989
|
strict: o = !1
|
|
852
990
|
} = e;
|
|
853
|
-
|
|
854
|
-
for (const
|
|
855
|
-
if (!(
|
|
856
|
-
const
|
|
991
|
+
at(n);
|
|
992
|
+
for (const u of Object.keys(r))
|
|
993
|
+
if (!(u in t.schemas)) {
|
|
994
|
+
const c = `Override key "${u}" not found in domain schemas.`;
|
|
857
995
|
if (o)
|
|
858
|
-
throw new
|
|
859
|
-
console.warn("[apigen-runtime]",
|
|
996
|
+
throw new B(c);
|
|
997
|
+
console.warn("[apigen-runtime]", c);
|
|
860
998
|
}
|
|
861
|
-
const i = new Set(n.map((
|
|
862
|
-
for (const [
|
|
863
|
-
for (const
|
|
864
|
-
if (!i.has(
|
|
865
|
-
const
|
|
999
|
+
const i = new Set(n.map((u) => u.id));
|
|
1000
|
+
for (const [u, c] of Object.entries(r))
|
|
1001
|
+
for (const l of Object.keys(c ?? {}))
|
|
1002
|
+
if (!i.has(l)) {
|
|
1003
|
+
const p = `Override key "${u}.${l}" does not match any declared middleware id.`;
|
|
866
1004
|
if (o)
|
|
867
|
-
throw new
|
|
868
|
-
console.warn("[apigen-runtime]",
|
|
1005
|
+
throw new B(p);
|
|
1006
|
+
console.warn("[apigen-runtime]", p);
|
|
869
1007
|
}
|
|
870
|
-
const s =
|
|
1008
|
+
const s = ot(
|
|
871
1009
|
t,
|
|
872
1010
|
n,
|
|
873
1011
|
r
|
|
874
|
-
), a = new
|
|
875
|
-
return
|
|
1012
|
+
), a = new Ye();
|
|
1013
|
+
return Qe(n, a), { schemas: s, createClient: async (u) => Xe(n, u, a), dispose: () => a.clear() };
|
|
876
1014
|
}
|
|
877
|
-
function
|
|
1015
|
+
function dn(e = {}) {
|
|
878
1016
|
const t = e.level ?? "info", n = typeof e.destination == "string" && e.destination.length > 0, r = !n && !!process.stderr.isTTY, o = e.format ?? (r ? "pretty" : "json"), i = { level: t };
|
|
879
1017
|
if (o === "pretty")
|
|
880
1018
|
return i.transport = {
|
|
@@ -885,63 +1023,91 @@ function en(e = {}) {
|
|
|
885
1023
|
ignore: "pid,hostname",
|
|
886
1024
|
...n ? { destination: e.destination, mkdir: !0 } : { destination: 2 }
|
|
887
1025
|
}
|
|
888
|
-
},
|
|
889
|
-
const s = n ?
|
|
890
|
-
return
|
|
1026
|
+
}, N(i);
|
|
1027
|
+
const s = n ? N.destination({ dest: e.destination, mkdir: !0, sync: !0 }) : N.destination(2);
|
|
1028
|
+
return N(i, s);
|
|
891
1029
|
}
|
|
892
|
-
function
|
|
893
|
-
|
|
1030
|
+
function ct(e) {
|
|
1031
|
+
if (!e || e.type !== "object" || !e.properties)
|
|
1032
|
+
return;
|
|
1033
|
+
const t = Object.entries(e.properties);
|
|
1034
|
+
if (t.length === 0)
|
|
1035
|
+
return;
|
|
1036
|
+
const n = new Set(e.required ?? []);
|
|
1037
|
+
return `{ ${t.map(([o, i]) => `${o}${n.has(o) ? "" : "?"}: ${k(i)}`).join(", ")} }`;
|
|
894
1038
|
}
|
|
895
|
-
function
|
|
1039
|
+
function ut(e) {
|
|
1040
|
+
return typeof e == "string" ? `'${e}'` : JSON.stringify(e);
|
|
1041
|
+
}
|
|
1042
|
+
function ft(e) {
|
|
1043
|
+
const t = e.enum ?? [];
|
|
1044
|
+
return t.length === 0 ? "unknown" : t.map(ut).join("|");
|
|
1045
|
+
}
|
|
1046
|
+
function lt(e, t) {
|
|
1047
|
+
return e.map((n) => k(n, t)).join(" | ");
|
|
1048
|
+
}
|
|
1049
|
+
function k(e, t = 0) {
|
|
1050
|
+
if (!e)
|
|
1051
|
+
return "unknown";
|
|
1052
|
+
if (e.type === "array")
|
|
1053
|
+
return `${k(e.items, 0)}[]`;
|
|
1054
|
+
if (e.enum)
|
|
1055
|
+
return ft(e);
|
|
1056
|
+
if (e.$ref)
|
|
1057
|
+
return String(e.$ref).split("/").pop() || "object";
|
|
1058
|
+
const n = e.anyOf ?? e.oneOf;
|
|
1059
|
+
return n ? n.length === 0 ? "unknown" : t >= 2 ? lt(n, t - 1) : "union" : t >= 1 && e.type === "object" ? ct(e) ?? "object" : e.type ?? "object";
|
|
1060
|
+
}
|
|
1061
|
+
function pt(e) {
|
|
896
1062
|
var a;
|
|
897
|
-
const n = (a = ((e == null ? void 0 : e.input) ?? {}).properties) == null ? void 0 : a.data, r = (n == null ? void 0 : n.properties) ?? {}, o = new Set((n == null ? void 0 : n.required) ?? []), i = Object.entries(r).map(([f,
|
|
1063
|
+
const n = (a = ((e == null ? void 0 : e.input) ?? {}).properties) == null ? void 0 : a.data, r = (n == null ? void 0 : n.properties) ?? {}, o = new Set((n == null ? void 0 : n.required) ?? []), i = Object.entries(r).map(([f, u]) => ({
|
|
898
1064
|
name: f,
|
|
899
|
-
type:
|
|
1065
|
+
type: k(u, 2),
|
|
900
1066
|
required: o.has(f)
|
|
901
1067
|
})), s = i.map((f) => `${f.name}${f.required ? "" : "?"}: ${f.type}`).join(", ");
|
|
902
1068
|
return { params: i, text: s };
|
|
903
1069
|
}
|
|
904
|
-
function
|
|
1070
|
+
function dt(e) {
|
|
905
1071
|
let t;
|
|
906
1072
|
return Array.isArray(e) ? t = e : e ? t = [e] : t = [], t.find((n) => n === "number" || n === "integer" || n === "boolean");
|
|
907
1073
|
}
|
|
908
|
-
function
|
|
1074
|
+
function yn(e, t) {
|
|
909
1075
|
var i, s;
|
|
910
1076
|
const r = ((s = (i = ((t == null ? void 0 : t.input) ?? {}).properties) == null ? void 0 : i.data) == null ? void 0 : s.properties) ?? {}, o = { ...e };
|
|
911
1077
|
for (const [a, f] of Object.entries(r)) {
|
|
912
|
-
const
|
|
913
|
-
if (typeof
|
|
1078
|
+
const u = o[a];
|
|
1079
|
+
if (typeof u != "string")
|
|
914
1080
|
continue;
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
const
|
|
918
|
-
!Number.isNaN(
|
|
1081
|
+
const c = dt(f == null ? void 0 : f.type);
|
|
1082
|
+
if (c === "number" || c === "integer") {
|
|
1083
|
+
const l = Number(u);
|
|
1084
|
+
!Number.isNaN(l) && u.trim() !== "" && (o[a] = l);
|
|
919
1085
|
} else
|
|
920
|
-
|
|
1086
|
+
c === "boolean" && (u === "true" ? o[a] = !0 : u === "false" && (o[a] = !1));
|
|
921
1087
|
}
|
|
922
1088
|
return o;
|
|
923
1089
|
}
|
|
924
|
-
const
|
|
925
|
-
function
|
|
1090
|
+
const oe = /* @__PURE__ */ new Set(["default", "module.exports", "__esModule"]);
|
|
1091
|
+
function mn(e) {
|
|
926
1092
|
const t = {}, n = (r, o) => {
|
|
927
1093
|
for (const [i, s] of Object.entries(r))
|
|
928
1094
|
if (typeof s == "function") {
|
|
929
|
-
!
|
|
1095
|
+
!oe.has(i) && !(i in t) && (t[i] = s);
|
|
930
1096
|
const a = s.name;
|
|
931
1097
|
a && !(a in t) && (t[a] = s);
|
|
932
1098
|
} else
|
|
933
|
-
s && typeof s == "object" && o < 2 &&
|
|
1099
|
+
s && typeof s == "object" && o < 2 && oe.has(i) && n(s, o + 1);
|
|
934
1100
|
};
|
|
935
1101
|
return n(e, 0), t;
|
|
936
1102
|
}
|
|
937
|
-
const
|
|
1103
|
+
const yt = [
|
|
938
1104
|
"invalid_argument",
|
|
939
1105
|
"unauthenticated",
|
|
940
1106
|
"permission_denied",
|
|
941
1107
|
"not_found",
|
|
942
1108
|
"internal"
|
|
943
1109
|
];
|
|
944
|
-
class
|
|
1110
|
+
class I extends Error {
|
|
945
1111
|
constructor(t, n, r) {
|
|
946
1112
|
super(n), this.name = "ApiError", this.code = t, this.details = r, Object.setPrototypeOf(this, new.target.prototype);
|
|
947
1113
|
}
|
|
@@ -954,34 +1120,34 @@ class E extends Error {
|
|
|
954
1120
|
return this.details !== void 0 && (t.details = this.details), t;
|
|
955
1121
|
}
|
|
956
1122
|
}
|
|
957
|
-
function
|
|
958
|
-
return typeof e == "object" && e !== null && e.name === "ApiError" &&
|
|
1123
|
+
function je(e) {
|
|
1124
|
+
return typeof e == "object" && e !== null && e.name === "ApiError" && yt.includes(e.code) && typeof e.toJSON == "function";
|
|
959
1125
|
}
|
|
960
|
-
function
|
|
1126
|
+
function ie(e, t, n = 0) {
|
|
961
1127
|
return e === "before-first-chunk" ? { phase: e, error: t } : { phase: e, error: t, chunksDelivered: n };
|
|
962
1128
|
}
|
|
963
|
-
const O = new
|
|
964
|
-
|
|
1129
|
+
const O = new _e({ allErrors: !0 });
|
|
1130
|
+
ke(O);
|
|
965
1131
|
for (const e of [
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1132
|
+
F,
|
|
1133
|
+
V,
|
|
1134
|
+
T,
|
|
1135
|
+
P,
|
|
970
1136
|
"discriminator"
|
|
971
1137
|
])
|
|
972
1138
|
O.addKeyword({ keyword: e, valid: !0 });
|
|
973
1139
|
O.addFormat("decimal", /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/);
|
|
974
|
-
function
|
|
1140
|
+
function mt(e) {
|
|
975
1141
|
return e.map(
|
|
976
1142
|
(t) => `${t.instancePath || "(root)"} ${t.message ?? "failed schema check"}`
|
|
977
1143
|
).join("; ");
|
|
978
1144
|
}
|
|
979
|
-
function
|
|
980
|
-
const n =
|
|
1145
|
+
function Oe(e, t) {
|
|
1146
|
+
const n = ve(t), r = [`Validation failed: ${mt(e)}`];
|
|
981
1147
|
return n && r.push(n), r.join(" — ");
|
|
982
1148
|
}
|
|
983
|
-
const
|
|
984
|
-
const n = e.ctx.get(
|
|
1149
|
+
const hn = async (e, t) => {
|
|
1150
|
+
const n = e.ctx.get(ht);
|
|
985
1151
|
if (n === void 0)
|
|
986
1152
|
return t();
|
|
987
1153
|
const r = e.operation.id, o = n[r];
|
|
@@ -993,15 +1159,15 @@ const rn = async (e, t) => {
|
|
|
993
1159
|
}, s = O.compile(o.input);
|
|
994
1160
|
if (!s(i)) {
|
|
995
1161
|
const f = s.errors ?? [];
|
|
996
|
-
throw new
|
|
1162
|
+
throw new I(
|
|
997
1163
|
"invalid_argument",
|
|
998
|
-
|
|
1164
|
+
Oe(f, o.input),
|
|
999
1165
|
f
|
|
1000
1166
|
);
|
|
1001
1167
|
}
|
|
1002
1168
|
return t();
|
|
1003
|
-
},
|
|
1004
|
-
function
|
|
1169
|
+
}, ht = Symbol("ValidateSchemasToken");
|
|
1170
|
+
function gt(e) {
|
|
1005
1171
|
return async function(n, r) {
|
|
1006
1172
|
const o = n.operation.id, i = e[o];
|
|
1007
1173
|
if (i === void 0)
|
|
@@ -1011,23 +1177,23 @@ function st(e) {
|
|
|
1011
1177
|
...n.envelope
|
|
1012
1178
|
}, a = O.compile(i.input);
|
|
1013
1179
|
if (!a(s)) {
|
|
1014
|
-
const
|
|
1015
|
-
throw new
|
|
1180
|
+
const u = a.errors ?? [];
|
|
1181
|
+
throw new I(
|
|
1016
1182
|
"invalid_argument",
|
|
1017
|
-
|
|
1018
|
-
|
|
1183
|
+
Oe(u, i.input),
|
|
1184
|
+
u
|
|
1019
1185
|
);
|
|
1020
1186
|
}
|
|
1021
1187
|
return r();
|
|
1022
1188
|
};
|
|
1023
1189
|
}
|
|
1024
|
-
function
|
|
1190
|
+
function wt() {
|
|
1025
1191
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
1026
1192
|
const t = Math.random() * 16 | 0;
|
|
1027
1193
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
1028
1194
|
});
|
|
1029
1195
|
}
|
|
1030
|
-
class
|
|
1196
|
+
class gn {
|
|
1031
1197
|
constructor(t = {}) {
|
|
1032
1198
|
var r, o;
|
|
1033
1199
|
this._store = /* @__PURE__ */ new Map(), this._sweeper = null, this._defaultTtlMs = t.defaultTtlMs;
|
|
@@ -1046,7 +1212,7 @@ class on {
|
|
|
1046
1212
|
* @returns `{ instanceId }` — pass this to `dispatch()` / `get()`.
|
|
1047
1213
|
*/
|
|
1048
1214
|
create(t, n = [], r) {
|
|
1049
|
-
const o = new t(...n), i =
|
|
1215
|
+
const o = new t(...n), i = wt(), s = r ?? this._defaultTtlMs, a = s !== void 0 ? Date.now() + s : null;
|
|
1050
1216
|
return this._store.set(i, { instance: o, expiresAt: a }), { instanceId: i };
|
|
1051
1217
|
}
|
|
1052
1218
|
// ---------------------------------------------------------------------------
|
|
@@ -1095,7 +1261,7 @@ class on {
|
|
|
1095
1261
|
*/
|
|
1096
1262
|
async dispose(t) {
|
|
1097
1263
|
const n = this._store.get(t);
|
|
1098
|
-
n && (this._store.delete(t), await
|
|
1264
|
+
n && (this._store.delete(t), await x(n.instance));
|
|
1099
1265
|
}
|
|
1100
1266
|
// ---------------------------------------------------------------------------
|
|
1101
1267
|
// disposeAll — full teardown
|
|
@@ -1107,7 +1273,7 @@ class on {
|
|
|
1107
1273
|
async disposeAll() {
|
|
1108
1274
|
this._sweeper !== null && (clearInterval(this._sweeper), this._sweeper = null);
|
|
1109
1275
|
const t = [...this._store.entries()];
|
|
1110
|
-
this._store.clear(), await Promise.all(t.map(([, n]) =>
|
|
1276
|
+
this._store.clear(), await Promise.all(t.map(([, n]) => x(n.instance)));
|
|
1111
1277
|
}
|
|
1112
1278
|
// ---------------------------------------------------------------------------
|
|
1113
1279
|
// size — diagnostic helper
|
|
@@ -1125,16 +1291,16 @@ class on {
|
|
|
1125
1291
|
r.expiresAt !== null && t > r.expiresAt && this._evict(n, r);
|
|
1126
1292
|
}
|
|
1127
1293
|
_evict(t, n) {
|
|
1128
|
-
this._store.delete(t),
|
|
1294
|
+
this._store.delete(t), x(n.instance);
|
|
1129
1295
|
}
|
|
1130
1296
|
}
|
|
1131
|
-
async function
|
|
1297
|
+
async function x(e) {
|
|
1132
1298
|
if (e !== null && typeof e == "object" && "dispose" in e) {
|
|
1133
1299
|
const t = e.dispose;
|
|
1134
1300
|
typeof t == "function" && await t.call(e);
|
|
1135
1301
|
}
|
|
1136
1302
|
}
|
|
1137
|
-
function
|
|
1303
|
+
function wn(e) {
|
|
1138
1304
|
const { produce: t, signal: n } = e, r = n ?? new AbortController().signal;
|
|
1139
1305
|
return {
|
|
1140
1306
|
[Symbol.asyncIterator]() {
|
|
@@ -1153,33 +1319,33 @@ function sn(e) {
|
|
|
1153
1319
|
}
|
|
1154
1320
|
};
|
|
1155
1321
|
}
|
|
1156
|
-
async function
|
|
1322
|
+
async function bn(e) {
|
|
1157
1323
|
const t = [];
|
|
1158
1324
|
for await (const n of e)
|
|
1159
1325
|
t.push(n);
|
|
1160
1326
|
return t;
|
|
1161
1327
|
}
|
|
1162
|
-
async function
|
|
1328
|
+
async function bt(e) {
|
|
1163
1329
|
const t = [];
|
|
1164
1330
|
try {
|
|
1165
1331
|
for await (const n of e)
|
|
1166
1332
|
t.push(n);
|
|
1167
1333
|
return { ok: !0, chunks: t };
|
|
1168
1334
|
} catch (n) {
|
|
1169
|
-
const r =
|
|
1335
|
+
const r = je(n) ? n : new I(
|
|
1170
1336
|
"internal",
|
|
1171
1337
|
n instanceof Error ? n.message : String(n)
|
|
1172
1338
|
);
|
|
1173
1339
|
return t.length === 0 ? {
|
|
1174
1340
|
ok: !1,
|
|
1175
|
-
carrier:
|
|
1341
|
+
carrier: ie("before-first-chunk", r)
|
|
1176
1342
|
} : {
|
|
1177
1343
|
ok: !1,
|
|
1178
|
-
carrier:
|
|
1344
|
+
carrier: ie("after-first-chunk", r, t.length)
|
|
1179
1345
|
};
|
|
1180
1346
|
}
|
|
1181
1347
|
}
|
|
1182
|
-
function
|
|
1348
|
+
function vt(e) {
|
|
1183
1349
|
return e !== null && typeof e == "object" && Symbol.asyncIterator in e;
|
|
1184
1350
|
}
|
|
1185
1351
|
class g extends Error {
|
|
@@ -1187,7 +1353,7 @@ class g extends Error {
|
|
|
1187
1353
|
super(n), this.name = "UnionCodecError", this.code = t;
|
|
1188
1354
|
}
|
|
1189
1355
|
}
|
|
1190
|
-
function
|
|
1356
|
+
function S(e) {
|
|
1191
1357
|
const t = e.discriminator;
|
|
1192
1358
|
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
1193
1359
|
return;
|
|
@@ -1201,8 +1367,8 @@ function C(e) {
|
|
|
1201
1367
|
mapping: r
|
|
1202
1368
|
};
|
|
1203
1369
|
}
|
|
1204
|
-
function
|
|
1205
|
-
const n = e[
|
|
1370
|
+
function Ne(e, t) {
|
|
1371
|
+
const n = e[V];
|
|
1206
1372
|
if (typeof n == "string") {
|
|
1207
1373
|
const r = t.registry.get(n);
|
|
1208
1374
|
if (r)
|
|
@@ -1210,15 +1376,15 @@ function be(e, t) {
|
|
|
1210
1376
|
}
|
|
1211
1377
|
return t.registry.resolve(e);
|
|
1212
1378
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const r =
|
|
1379
|
+
function $t(e, t, n) {
|
|
1380
|
+
const r = Ne(t, n);
|
|
1215
1381
|
return r ? r.encode(e, t, n) : e;
|
|
1216
1382
|
}
|
|
1217
|
-
function
|
|
1218
|
-
const r =
|
|
1383
|
+
function At(e, t, n) {
|
|
1384
|
+
const r = Ne(t, n);
|
|
1219
1385
|
return r ? r.decode(e, t, n) : e;
|
|
1220
1386
|
}
|
|
1221
|
-
function
|
|
1387
|
+
function jt(e) {
|
|
1222
1388
|
const { id: t, schema: n } = e;
|
|
1223
1389
|
return {
|
|
1224
1390
|
id: t,
|
|
@@ -1230,85 +1396,85 @@ function lt(e) {
|
|
|
1230
1396
|
* accelerates the match but is advisory — the structure is authoritative.
|
|
1231
1397
|
*/
|
|
1232
1398
|
matches(r) {
|
|
1233
|
-
if (r[
|
|
1399
|
+
if (r[F] === "union")
|
|
1234
1400
|
return !0;
|
|
1235
1401
|
const o = r.oneOf;
|
|
1236
|
-
return !Array.isArray(o) || o.length === 0 ? !1 :
|
|
1402
|
+
return !Array.isArray(o) || o.length === 0 ? !1 : S(r) !== void 0;
|
|
1237
1403
|
},
|
|
1238
1404
|
encode(r, o, i) {
|
|
1239
|
-
const s =
|
|
1405
|
+
const s = S(o);
|
|
1240
1406
|
if (!s)
|
|
1241
1407
|
throw new g(
|
|
1242
1408
|
"E_UNION_NO_DISCRIMINATOR",
|
|
1243
1409
|
`[${t}] schema node at "${i.path}" has no discriminator.propertyName; cannot dispatch union branch.`
|
|
1244
1410
|
);
|
|
1245
|
-
const { propertyName: a, mapping: f } = s,
|
|
1246
|
-
if (
|
|
1411
|
+
const { propertyName: a, mapping: f } = s, u = r[a];
|
|
1412
|
+
if (u == null)
|
|
1247
1413
|
throw new g(
|
|
1248
1414
|
"E_UNION_NO_DISCRIMINATOR",
|
|
1249
1415
|
`[${t}] value at "${i.path}" is missing the discriminator property "${a}".`
|
|
1250
1416
|
);
|
|
1251
|
-
const
|
|
1252
|
-
if (!
|
|
1417
|
+
const c = String(u), l = f[c];
|
|
1418
|
+
if (!l)
|
|
1253
1419
|
throw new g(
|
|
1254
1420
|
"E_UNION_UNKNOWN_TAG",
|
|
1255
|
-
`[${t}] discriminator tag "${
|
|
1421
|
+
`[${t}] discriminator tag "${c}" at "${i.path}" is not in the mapping (known: ${Object.keys(f).join(", ")}).`
|
|
1256
1422
|
);
|
|
1257
|
-
const
|
|
1258
|
-
return
|
|
1423
|
+
const p = i.resolve(l);
|
|
1424
|
+
return $t(r, p, {
|
|
1259
1425
|
...i,
|
|
1260
|
-
path: `${i.path}[${
|
|
1426
|
+
path: `${i.path}[${c}]`
|
|
1261
1427
|
});
|
|
1262
1428
|
},
|
|
1263
1429
|
decode(r, o, i) {
|
|
1264
1430
|
if (r === null || typeof r != "object" || Array.isArray(r)) {
|
|
1265
|
-
let
|
|
1266
|
-
throw r === null ?
|
|
1431
|
+
let d;
|
|
1432
|
+
throw r === null ? d = "null" : Array.isArray(r) ? d = "array" : d = typeof r, new g(
|
|
1267
1433
|
"E_UNION_INVALID_WIRE",
|
|
1268
|
-
`[${t}] expected a JSON object on the wire at "${i.path}", got ${
|
|
1434
|
+
`[${t}] expected a JSON object on the wire at "${i.path}", got ${d}.`
|
|
1269
1435
|
);
|
|
1270
1436
|
}
|
|
1271
|
-
const s = r, a =
|
|
1437
|
+
const s = r, a = S(o);
|
|
1272
1438
|
if (!a)
|
|
1273
1439
|
throw new g(
|
|
1274
1440
|
"E_UNION_NO_DISCRIMINATOR",
|
|
1275
1441
|
`[${t}] schema node at "${i.path}" has no discriminator.propertyName; cannot dispatch union branch.`
|
|
1276
1442
|
);
|
|
1277
|
-
const { propertyName: f, mapping:
|
|
1278
|
-
if (
|
|
1443
|
+
const { propertyName: f, mapping: u } = a, c = s[f];
|
|
1444
|
+
if (c == null)
|
|
1279
1445
|
throw new g(
|
|
1280
1446
|
"E_UNION_NO_DISCRIMINATOR",
|
|
1281
1447
|
`[${t}] wire object at "${i.path}" is missing the discriminator property "${f}".`
|
|
1282
1448
|
);
|
|
1283
|
-
const
|
|
1284
|
-
if (!
|
|
1449
|
+
const l = String(c), p = u[l];
|
|
1450
|
+
if (!p)
|
|
1285
1451
|
throw new g(
|
|
1286
1452
|
"E_UNION_UNKNOWN_TAG",
|
|
1287
|
-
`[${t}] discriminator tag "${
|
|
1453
|
+
`[${t}] discriminator tag "${l}" on the wire at "${i.path}" is not in the mapping (known: ${Object.keys(u).join(", ")}).`
|
|
1288
1454
|
);
|
|
1289
|
-
const
|
|
1290
|
-
return
|
|
1455
|
+
const y = i.resolve(p);
|
|
1456
|
+
return At(r, y, {
|
|
1291
1457
|
...i,
|
|
1292
|
-
path: `${i.path}[${
|
|
1458
|
+
path: `${i.path}[${l}]`
|
|
1293
1459
|
});
|
|
1294
1460
|
}
|
|
1295
1461
|
};
|
|
1296
1462
|
}
|
|
1297
|
-
const
|
|
1298
|
-
class
|
|
1463
|
+
const Ot = "x-apigen-instances";
|
|
1464
|
+
class E extends Error {
|
|
1299
1465
|
constructor(t, n) {
|
|
1300
1466
|
super(n), this.name = "NominalCodecError", this.code = t;
|
|
1301
1467
|
}
|
|
1302
1468
|
}
|
|
1303
|
-
function
|
|
1469
|
+
function se(e) {
|
|
1304
1470
|
const t = e.properties;
|
|
1305
1471
|
return t && typeof t == "object" && !Array.isArray(t) ? t : {};
|
|
1306
1472
|
}
|
|
1307
|
-
function
|
|
1473
|
+
function Nt(e) {
|
|
1308
1474
|
const t = e.required;
|
|
1309
1475
|
return Array.isArray(t) ? t.filter((n) => typeof n == "string") : [];
|
|
1310
1476
|
}
|
|
1311
|
-
function
|
|
1477
|
+
function ae(e, t, n) {
|
|
1312
1478
|
if (t) {
|
|
1313
1479
|
const r = n.registry.resolve(t);
|
|
1314
1480
|
if (r)
|
|
@@ -1316,7 +1482,7 @@ function re(e, t, n) {
|
|
|
1316
1482
|
}
|
|
1317
1483
|
return e;
|
|
1318
1484
|
}
|
|
1319
|
-
function
|
|
1485
|
+
function Et(e, t, n) {
|
|
1320
1486
|
if (t) {
|
|
1321
1487
|
const r = n.registry.resolve(t);
|
|
1322
1488
|
if (r)
|
|
@@ -1324,7 +1490,7 @@ function mt(e, t, n) {
|
|
|
1324
1490
|
}
|
|
1325
1491
|
return e;
|
|
1326
1492
|
}
|
|
1327
|
-
function
|
|
1493
|
+
function _t(e) {
|
|
1328
1494
|
const { id: t, schema: n, ctor: r } = e;
|
|
1329
1495
|
return {
|
|
1330
1496
|
id: t,
|
|
@@ -1338,14 +1504,14 @@ function ht(e) {
|
|
|
1338
1504
|
* handled by the transcoder walk, not by this cheap test.
|
|
1339
1505
|
*/
|
|
1340
1506
|
matches(o) {
|
|
1341
|
-
return o[
|
|
1507
|
+
return o[F] === "nominal" ? !0 : o[V] === t;
|
|
1342
1508
|
},
|
|
1343
1509
|
encode(o, i, s) {
|
|
1344
1510
|
if (o === null || typeof o != "object")
|
|
1345
1511
|
return o;
|
|
1346
1512
|
if (s.seen.has(o)) {
|
|
1347
1513
|
if (s.mode === "strict")
|
|
1348
|
-
throw new
|
|
1514
|
+
throw new E(
|
|
1349
1515
|
"E_NOMINAL_CYCLE",
|
|
1350
1516
|
`[${t}] cycle detected at "${s.path}": a nominal instance references itself. Strict mode rejects cycles (DESIGN §8.3); break the cycle or use 'lossy' mode.`
|
|
1351
1517
|
);
|
|
@@ -1353,125 +1519,125 @@ function ht(e) {
|
|
|
1353
1519
|
}
|
|
1354
1520
|
s.seen.add(o);
|
|
1355
1521
|
try {
|
|
1356
|
-
const a =
|
|
1357
|
-
if (typeof
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1360
|
-
const
|
|
1522
|
+
const a = se(i), f = typeof i[P] == "string" ? i[P] : "toJSON", u = o[f];
|
|
1523
|
+
if (typeof u == "function") {
|
|
1524
|
+
const d = u.call(o);
|
|
1525
|
+
if (d !== null && typeof d == "object" && !Array.isArray(d)) {
|
|
1526
|
+
const m = {};
|
|
1361
1527
|
for (const [h, b] of Object.entries(
|
|
1362
|
-
|
|
1528
|
+
d
|
|
1363
1529
|
))
|
|
1364
|
-
|
|
1530
|
+
m[h] = ae(b, a[h], {
|
|
1365
1531
|
...s,
|
|
1366
1532
|
path: `${s.path}/${h}`
|
|
1367
1533
|
});
|
|
1368
|
-
return
|
|
1534
|
+
return m;
|
|
1369
1535
|
}
|
|
1370
|
-
return
|
|
1536
|
+
return d;
|
|
1371
1537
|
}
|
|
1372
|
-
const
|
|
1373
|
-
for (const
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1538
|
+
const c = {}, l = Object.keys(a), p = o, y = l.length > 0 ? l : Object.keys(p);
|
|
1539
|
+
for (const d of y) {
|
|
1540
|
+
const m = p[d];
|
|
1541
|
+
m !== void 0 && (c[d] = ae(m, a[d], {
|
|
1376
1542
|
...s,
|
|
1377
|
-
path: `${s.path}/${
|
|
1543
|
+
path: `${s.path}/${d}`
|
|
1378
1544
|
}));
|
|
1379
1545
|
}
|
|
1380
|
-
return
|
|
1546
|
+
return c;
|
|
1381
1547
|
} finally {
|
|
1382
1548
|
s.seen.delete(o);
|
|
1383
1549
|
}
|
|
1384
1550
|
},
|
|
1385
1551
|
decode(o, i, s) {
|
|
1386
1552
|
if (o === null || typeof o != "object" || Array.isArray(o)) {
|
|
1387
|
-
let
|
|
1388
|
-
throw o === null ?
|
|
1553
|
+
let c;
|
|
1554
|
+
throw o === null ? c = "null" : Array.isArray(o) ? c = "array" : c = typeof o, new E(
|
|
1389
1555
|
"E_NOMINAL_INVALID_WIRE",
|
|
1390
|
-
`[${t}] expected a JSON object on the wire at "${s.path}", got ${
|
|
1556
|
+
`[${t}] expected a JSON object on the wire at "${s.path}", got ${c}.`
|
|
1391
1557
|
);
|
|
1392
1558
|
}
|
|
1393
1559
|
const a = o;
|
|
1394
|
-
for (const
|
|
1395
|
-
if (!(
|
|
1396
|
-
throw new
|
|
1560
|
+
for (const c of Nt(i))
|
|
1561
|
+
if (!(c in a))
|
|
1562
|
+
throw new E(
|
|
1397
1563
|
"E_NOMINAL_INVALID_WIRE",
|
|
1398
|
-
`[${t}] required field "${
|
|
1564
|
+
`[${t}] required field "${c}" missing on the wire at "${s.path}".`
|
|
1399
1565
|
);
|
|
1400
|
-
if (i[
|
|
1401
|
-
throw new
|
|
1566
|
+
if (i[Ot] === !1)
|
|
1567
|
+
throw new E(
|
|
1402
1568
|
"E_NOMINAL_NONRECONSTRUCTABLE",
|
|
1403
1569
|
`[${t}] is encode-only: the extractor marked it non-reconstructable (x-apigen-instances:false). It cannot be decoded back to a live instance.`
|
|
1404
1570
|
);
|
|
1405
|
-
const f =
|
|
1406
|
-
for (const [
|
|
1407
|
-
c
|
|
1571
|
+
const f = se(i), u = {};
|
|
1572
|
+
for (const [c, l] of Object.entries(a))
|
|
1573
|
+
u[c] = Et(l, f[c], {
|
|
1408
1574
|
...s,
|
|
1409
|
-
path: `${s.path}/${
|
|
1575
|
+
path: `${s.path}/${c}`
|
|
1410
1576
|
});
|
|
1411
1577
|
if (r) {
|
|
1412
|
-
const
|
|
1413
|
-
if (typeof
|
|
1414
|
-
return
|
|
1578
|
+
const c = typeof i[T] == "string" ? i[T] : "fromJSON", l = r[c];
|
|
1579
|
+
if (typeof l == "function")
|
|
1580
|
+
return l.call(
|
|
1415
1581
|
r,
|
|
1416
|
-
|
|
1582
|
+
u
|
|
1417
1583
|
);
|
|
1418
|
-
const
|
|
1419
|
-
return new
|
|
1584
|
+
const p = r;
|
|
1585
|
+
return new p(u);
|
|
1420
1586
|
}
|
|
1421
|
-
return
|
|
1587
|
+
return u;
|
|
1422
1588
|
}
|
|
1423
1589
|
};
|
|
1424
1590
|
}
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
q,
|
|
1591
|
+
const kt = [
|
|
1592
|
+
H,
|
|
1428
1593
|
K,
|
|
1429
1594
|
z,
|
|
1430
|
-
|
|
1431
|
-
W
|
|
1432
|
-
|
|
1595
|
+
J,
|
|
1596
|
+
W,
|
|
1597
|
+
G
|
|
1598
|
+
], It = {
|
|
1433
1599
|
type: "object",
|
|
1434
1600
|
"x-apigen-logical": "nominal",
|
|
1435
1601
|
"x-apigen-codec": "ts.NominalSentinel"
|
|
1436
|
-
},
|
|
1602
|
+
}, ce = _t({
|
|
1437
1603
|
id: "ts.NominalSentinel",
|
|
1438
|
-
schema:
|
|
1439
|
-
}),
|
|
1604
|
+
schema: It
|
|
1605
|
+
}), Ct = {
|
|
1440
1606
|
oneOf: [],
|
|
1441
1607
|
discriminator: { propertyName: "kind", mapping: {} },
|
|
1442
1608
|
"x-apigen-logical": "union",
|
|
1443
1609
|
"x-apigen-codec": "ts.UnionSentinel"
|
|
1444
|
-
},
|
|
1610
|
+
}, ue = jt({
|
|
1445
1611
|
id: "ts.UnionSentinel",
|
|
1446
|
-
schema:
|
|
1612
|
+
schema: Ct
|
|
1447
1613
|
});
|
|
1448
|
-
function
|
|
1614
|
+
function xt() {
|
|
1449
1615
|
const e = [
|
|
1450
1616
|
// 6 well-known scalars
|
|
1451
|
-
...
|
|
1617
|
+
...kt.map((t) => [
|
|
1452
1618
|
t.id,
|
|
1453
1619
|
t
|
|
1454
1620
|
]),
|
|
1455
1621
|
// nominal kind sentinel
|
|
1456
|
-
[
|
|
1622
|
+
[ce.id, ce],
|
|
1457
1623
|
// union kind sentinel
|
|
1458
|
-
[
|
|
1624
|
+
[ue.id, ue]
|
|
1459
1625
|
];
|
|
1460
1626
|
return Object.freeze(new Map(e));
|
|
1461
1627
|
}
|
|
1462
|
-
const
|
|
1628
|
+
const vn = Object.freeze({
|
|
1463
1629
|
host: "ts",
|
|
1464
|
-
logicalTypeVersion:
|
|
1465
|
-
codecs:
|
|
1630
|
+
logicalTypeVersion: Ce,
|
|
1631
|
+
codecs: xt()
|
|
1466
1632
|
});
|
|
1467
|
-
function
|
|
1633
|
+
function $n(e, t, n) {
|
|
1468
1634
|
var s;
|
|
1469
|
-
const r = typeof ((s = t == null ? void 0 : t.input) == null ? void 0 : s.description) == "string" ? t.input.description : void 0, o =
|
|
1635
|
+
const r = typeof ((s = t == null ? void 0 : t.input) == null ? void 0 : s.description) == "string" ? t.input.description : void 0, o = ve(t == null ? void 0 : t.input), i = [n, r, o].filter(
|
|
1470
1636
|
(a) => typeof a == "string" && a.length > 0
|
|
1471
1637
|
);
|
|
1472
1638
|
return i.length > 0 ? i.join(" — ") : e;
|
|
1473
1639
|
}
|
|
1474
|
-
function
|
|
1640
|
+
function An(e) {
|
|
1475
1641
|
if (!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).length === 0)
|
|
1476
1642
|
return { outputSchema: void 0, wrapped: !1 };
|
|
1477
1643
|
const t = e;
|
|
@@ -1484,25 +1650,25 @@ function fn(e) {
|
|
|
1484
1650
|
wrapped: !0
|
|
1485
1651
|
};
|
|
1486
1652
|
}
|
|
1487
|
-
function
|
|
1653
|
+
function jn(e, t) {
|
|
1488
1654
|
return e ? { result: t } : t && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
1489
1655
|
}
|
|
1490
|
-
const
|
|
1491
|
-
function
|
|
1492
|
-
return
|
|
1656
|
+
const St = 4, Mt = 32;
|
|
1657
|
+
function q(e) {
|
|
1658
|
+
return je(e) ? e : e instanceof Error ? new I("internal", e.message) : e;
|
|
1493
1659
|
}
|
|
1494
|
-
function
|
|
1660
|
+
function Tt(e, t) {
|
|
1495
1661
|
if (e === "serial" || e === "chained")
|
|
1496
1662
|
return 1;
|
|
1497
|
-
const n = t ??
|
|
1498
|
-
return !Number.isFinite(n) || n < 1 ? 1 : Math.min(Math.floor(n),
|
|
1663
|
+
const n = t ?? St;
|
|
1664
|
+
return !Number.isFinite(n) || n < 1 ? 1 : Math.min(Math.floor(n), Mt);
|
|
1499
1665
|
}
|
|
1500
|
-
function
|
|
1666
|
+
function Pt() {
|
|
1501
1667
|
}
|
|
1502
|
-
function
|
|
1668
|
+
function Dt(e, t) {
|
|
1503
1669
|
var i;
|
|
1504
1670
|
if (!e && !t)
|
|
1505
|
-
return { signal: void 0, dispose:
|
|
1671
|
+
return { signal: void 0, dispose: Pt };
|
|
1506
1672
|
const n = new AbortController(), r = () => {
|
|
1507
1673
|
n.abort(e == null ? void 0 : e.reason);
|
|
1508
1674
|
};
|
|
@@ -1522,106 +1688,107 @@ function Nt(e, t) {
|
|
|
1522
1688
|
}
|
|
1523
1689
|
};
|
|
1524
1690
|
}
|
|
1525
|
-
async function
|
|
1526
|
-
const s =
|
|
1691
|
+
async function fe(e, t, n, r, o, i) {
|
|
1692
|
+
const s = Dt(r.signal, i);
|
|
1527
1693
|
try {
|
|
1528
1694
|
const a = s.signal ? { ...r, signal: s.signal } : r, f = await e(t, a, o);
|
|
1529
|
-
if (
|
|
1530
|
-
const
|
|
1531
|
-
if (
|
|
1532
|
-
return { index: n, status: "fulfilled", chunks:
|
|
1533
|
-
const
|
|
1695
|
+
if (vt(f)) {
|
|
1696
|
+
const u = await bt(f);
|
|
1697
|
+
if (u.ok)
|
|
1698
|
+
return { index: n, status: "fulfilled", chunks: u.chunks };
|
|
1699
|
+
const c = u.carrier;
|
|
1534
1700
|
return {
|
|
1535
1701
|
index: n,
|
|
1536
1702
|
status: "rejected",
|
|
1537
|
-
reason:
|
|
1538
|
-
...
|
|
1703
|
+
reason: q(c.error),
|
|
1704
|
+
...c.phase === "after-first-chunk" ? { chunksDelivered: c.chunksDelivered } : {}
|
|
1539
1705
|
};
|
|
1540
1706
|
}
|
|
1541
1707
|
return { index: n, status: "fulfilled", value: f };
|
|
1542
1708
|
} catch (a) {
|
|
1543
|
-
return { index: n, status: "rejected", reason:
|
|
1709
|
+
return { index: n, status: "rejected", reason: q(a) };
|
|
1544
1710
|
} finally {
|
|
1545
1711
|
s.dispose();
|
|
1546
1712
|
}
|
|
1547
1713
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
const i = o.mode ?? "parallel", s = o.onItemError ?? "continue", a =
|
|
1550
|
-
index:
|
|
1714
|
+
async function On(e, t, n, r, o = {}) {
|
|
1715
|
+
const i = o.mode ?? "parallel", s = o.onItemError ?? "continue", a = Tt(i, o.concurrency), f = new Array(n.length), u = (d) => ({
|
|
1716
|
+
index: d,
|
|
1551
1717
|
status: "rejected",
|
|
1552
|
-
reason:
|
|
1718
|
+
reason: q(
|
|
1553
1719
|
new Error(
|
|
1554
1720
|
"apigen/invokeBatch: not attempted — an earlier item failed and " + (i === "chained" ? 'mode is "chained"' : 'onItemError is "abort"')
|
|
1555
1721
|
)
|
|
1556
1722
|
)
|
|
1557
1723
|
});
|
|
1558
1724
|
if (i === "serial" || i === "chained") {
|
|
1559
|
-
let
|
|
1560
|
-
for (let
|
|
1561
|
-
if (
|
|
1562
|
-
f[
|
|
1725
|
+
let d = !1;
|
|
1726
|
+
for (let m = 0; m < n.length; m++) {
|
|
1727
|
+
if (d) {
|
|
1728
|
+
f[m] = u(m);
|
|
1563
1729
|
continue;
|
|
1564
1730
|
}
|
|
1565
|
-
const h = await
|
|
1731
|
+
const h = await fe(
|
|
1566
1732
|
e,
|
|
1567
1733
|
t,
|
|
1568
|
-
|
|
1569
|
-
n[
|
|
1734
|
+
m,
|
|
1735
|
+
n[m],
|
|
1570
1736
|
r,
|
|
1571
1737
|
o.itemTimeoutMs
|
|
1572
1738
|
);
|
|
1573
|
-
f[
|
|
1739
|
+
f[m] = h, h.status === "rejected" && (i === "chained" || s === "abort") && (d = !0);
|
|
1574
1740
|
}
|
|
1575
1741
|
return f;
|
|
1576
1742
|
}
|
|
1577
|
-
let
|
|
1578
|
-
const
|
|
1743
|
+
let c = 0, l = !1;
|
|
1744
|
+
const p = Math.max(1, Math.min(a, n.length)), y = Array.from({ length: p }, async () => {
|
|
1579
1745
|
for (; ; ) {
|
|
1580
|
-
const
|
|
1581
|
-
if (
|
|
1746
|
+
const d = c++;
|
|
1747
|
+
if (d >= n.length)
|
|
1582
1748
|
return;
|
|
1583
|
-
if (
|
|
1584
|
-
f[
|
|
1749
|
+
if (l) {
|
|
1750
|
+
f[d] = u(d);
|
|
1585
1751
|
continue;
|
|
1586
1752
|
}
|
|
1587
|
-
const
|
|
1753
|
+
const m = await fe(
|
|
1588
1754
|
e,
|
|
1589
1755
|
t,
|
|
1590
|
-
|
|
1591
|
-
n[
|
|
1756
|
+
d,
|
|
1757
|
+
n[d],
|
|
1592
1758
|
r,
|
|
1593
1759
|
o.itemTimeoutMs
|
|
1594
1760
|
);
|
|
1595
|
-
f[
|
|
1761
|
+
f[d] = m, m.status === "rejected" && s === "abort" && (l = !0);
|
|
1596
1762
|
}
|
|
1597
1763
|
});
|
|
1598
|
-
return await Promise.all(
|
|
1764
|
+
return await Promise.all(y), f;
|
|
1599
1765
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1766
|
+
he(import.meta.url);
|
|
1767
|
+
const le = /* @__PURE__ */ new Set(["string", "number", "boolean", "integer"]);
|
|
1768
|
+
function Ut(e) {
|
|
1602
1769
|
if (typeof e != "object" || e === null)
|
|
1603
1770
|
return !1;
|
|
1604
1771
|
const t = e;
|
|
1605
1772
|
if (t.$ref !== void 0 || t.oneOf || t.anyOf || t.allOf)
|
|
1606
1773
|
return !1;
|
|
1607
1774
|
const { type: n } = t;
|
|
1608
|
-
return typeof n == "string" ?
|
|
1775
|
+
return typeof n == "string" ? le.has(n) : Array.isArray(n) ? n.every((r) => le.has(r) || r === "null") : Array.isArray(t.enum) && t.enum.length > 0 ? t.enum.every((r) => ["string", "number", "boolean"].includes(typeof r)) : !1;
|
|
1609
1776
|
}
|
|
1610
|
-
function
|
|
1777
|
+
function Rt(e) {
|
|
1611
1778
|
if (!e || typeof e != "object")
|
|
1612
1779
|
return !1;
|
|
1613
1780
|
const t = e.properties;
|
|
1614
1781
|
return t === void 0 || typeof t != "object" || t === null ? !1 : Object.values(t).every(
|
|
1615
|
-
|
|
1782
|
+
Ut
|
|
1616
1783
|
);
|
|
1617
1784
|
}
|
|
1618
|
-
const
|
|
1785
|
+
const Lt = {
|
|
1619
1786
|
"decimal.js": "Decimal"
|
|
1620
1787
|
};
|
|
1621
|
-
function
|
|
1788
|
+
function Bt(e) {
|
|
1622
1789
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1623
1790
|
}
|
|
1624
|
-
Object.entries(
|
|
1791
|
+
Object.entries(Lt).map(([e, t]) => ({
|
|
1625
1792
|
// Matches: import("...{modSpec}...").<anyMemberName> (single or double quotes)
|
|
1626
1793
|
// The module specifier appears inside an absolute path, so we allow any
|
|
1627
1794
|
// characters between the quote and the specifier, and between the specifier
|
|
@@ -1629,134 +1796,135 @@ Object.entries(kt).map(([e, t]) => ({
|
|
|
1629
1796
|
// …) is matched generically (`\w+`) rather than anchored to one spelling —
|
|
1630
1797
|
// see the doc comment above for why.
|
|
1631
1798
|
pattern: new RegExp(
|
|
1632
|
-
`import\\(["'][^"']*${
|
|
1799
|
+
`import\\(["'][^"']*${Bt(e)}[^"']*["']\\)\\.\\w+`,
|
|
1633
1800
|
"g"
|
|
1634
1801
|
),
|
|
1635
1802
|
key: t
|
|
1636
1803
|
}));
|
|
1637
|
-
function
|
|
1804
|
+
function pe(e) {
|
|
1638
1805
|
return e.words.join("-");
|
|
1639
1806
|
}
|
|
1640
|
-
function
|
|
1641
|
-
return e.words.map(
|
|
1807
|
+
function de(e) {
|
|
1808
|
+
return e.words.map(Kt).join("");
|
|
1642
1809
|
}
|
|
1643
|
-
function
|
|
1810
|
+
function ye(e) {
|
|
1644
1811
|
return e.words.join("_");
|
|
1645
1812
|
}
|
|
1646
|
-
function
|
|
1813
|
+
function qt(e, t = {}) {
|
|
1647
1814
|
var n, r;
|
|
1648
|
-
const o = [e.namespace, ...e.path], i = e.safe ||
|
|
1815
|
+
const o = [e.namespace, ...e.path], i = e.safe || Rt(e.input) ? "GET" : "POST", s = ((r = (n = t.http) == null ? void 0 : n.verb) == null ? void 0 : r[e.id]) ?? i, a = "/" + o.map((y) => pe(y)).join("/"), f = o.map((y) => ye(y)).join("_"), u = o.map((y) => ye(y)).slice(0, -1).join("."), c = de(o[o.length - 2] ?? o[0]), l = de(o[o.length - 1]), p = o.map((y) => pe(y));
|
|
1649
1816
|
return {
|
|
1650
1817
|
http: { verb: s, route: a },
|
|
1651
1818
|
mcp: { name: f },
|
|
1652
|
-
grpc: { package:
|
|
1653
|
-
cli: { path:
|
|
1819
|
+
grpc: { package: u, service: c, method: l },
|
|
1820
|
+
cli: { path: p }
|
|
1654
1821
|
};
|
|
1655
1822
|
}
|
|
1656
|
-
function
|
|
1823
|
+
function Ft(e, t) {
|
|
1657
1824
|
return `x-${e}-${t}`;
|
|
1658
1825
|
}
|
|
1659
|
-
function
|
|
1826
|
+
function Vt(e, t) {
|
|
1660
1827
|
return `--${e}-${t}`;
|
|
1661
1828
|
}
|
|
1662
|
-
function
|
|
1829
|
+
function Ht(e, t) {
|
|
1663
1830
|
const n = (r) => r.toUpperCase().replace(/-/g, "_");
|
|
1664
1831
|
return e === "adhd" ? `APIGEN_${n(t)}` : `APIGEN_${n(e)}_${n(t)}`;
|
|
1665
1832
|
}
|
|
1666
|
-
function
|
|
1833
|
+
function Kt(e) {
|
|
1667
1834
|
return e.length === 0 ? e : e[0].toUpperCase() + e.slice(1);
|
|
1668
1835
|
}
|
|
1669
|
-
function
|
|
1836
|
+
function Y(e) {
|
|
1670
1837
|
return e.anyOf ?? e.oneOf;
|
|
1671
1838
|
}
|
|
1672
|
-
function
|
|
1839
|
+
function zt(e) {
|
|
1673
1840
|
if (!e)
|
|
1674
1841
|
return !1;
|
|
1675
1842
|
if (e.type === "array" || e.type === "object")
|
|
1676
1843
|
return !0;
|
|
1677
|
-
const t =
|
|
1844
|
+
const t = Y(e);
|
|
1678
1845
|
if (t) {
|
|
1679
1846
|
const n = t.filter((r) => r.type !== "null");
|
|
1680
1847
|
return n.length > 0 && n.every((r) => r.type === "array" || r.type === "object");
|
|
1681
1848
|
}
|
|
1682
1849
|
return !1;
|
|
1683
1850
|
}
|
|
1684
|
-
function
|
|
1851
|
+
function Jt(e) {
|
|
1685
1852
|
if (!e)
|
|
1686
1853
|
return !1;
|
|
1687
1854
|
if (e.type === "boolean")
|
|
1688
1855
|
return !0;
|
|
1689
|
-
const t =
|
|
1856
|
+
const t = Y(e);
|
|
1690
1857
|
if (t) {
|
|
1691
1858
|
const n = t.filter((r) => r.type !== "null");
|
|
1692
1859
|
return n.length > 0 && n.every((r) => r.type === "boolean");
|
|
1693
1860
|
}
|
|
1694
1861
|
return !1;
|
|
1695
1862
|
}
|
|
1696
|
-
function
|
|
1863
|
+
function Wt(e) {
|
|
1697
1864
|
if (!e)
|
|
1698
1865
|
return !1;
|
|
1699
1866
|
if (e.type === "number" || e.type === "integer")
|
|
1700
1867
|
return !0;
|
|
1701
|
-
const t =
|
|
1868
|
+
const t = Y(e);
|
|
1702
1869
|
if (t) {
|
|
1703
1870
|
const n = t.filter((r) => r.type !== "null");
|
|
1704
1871
|
return n.length > 0 && n.every((r) => r.type === "number" || r.type === "integer");
|
|
1705
1872
|
}
|
|
1706
1873
|
return !1;
|
|
1707
1874
|
}
|
|
1708
|
-
function
|
|
1875
|
+
function Gt(e) {
|
|
1709
1876
|
return e.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
|
|
1710
1877
|
}
|
|
1711
|
-
function
|
|
1878
|
+
function Yt(e) {
|
|
1712
1879
|
var o, i;
|
|
1713
1880
|
const t = (i = (o = e.input) == null ? void 0 : o.properties) == null ? void 0 : i.data, n = (t == null ? void 0 : t.properties) ?? {}, r = (t == null ? void 0 : t.required) ?? [];
|
|
1714
1881
|
return { props: n, required: r };
|
|
1715
1882
|
}
|
|
1716
|
-
function
|
|
1883
|
+
function me(e) {
|
|
1717
1884
|
return typeof e.handler == "function";
|
|
1718
1885
|
}
|
|
1719
|
-
function
|
|
1886
|
+
function Zt(e) {
|
|
1720
1887
|
var o;
|
|
1721
1888
|
const t = ((o = e.input) == null ? void 0 : o.properties) ?? {}, n = e["x-apigen-envelope"], r = [];
|
|
1722
1889
|
for (const i of Object.keys(t)) {
|
|
1723
1890
|
if (i === "data")
|
|
1724
1891
|
continue;
|
|
1725
|
-
const s = (n == null ? void 0 : n[i]) ?? "adhd", a =
|
|
1892
|
+
const s = (n == null ? void 0 : n[i]) ?? "adhd", a = Ft(s, i);
|
|
1726
1893
|
r.push({
|
|
1727
1894
|
field: i,
|
|
1728
1895
|
pluginId: s,
|
|
1729
1896
|
httpHeader: a,
|
|
1730
1897
|
mcpMetaKey: a,
|
|
1731
|
-
cliFlag:
|
|
1732
|
-
envVar:
|
|
1898
|
+
cliFlag: Vt(s, i),
|
|
1899
|
+
envVar: Ht(s, i)
|
|
1733
1900
|
});
|
|
1734
1901
|
}
|
|
1735
1902
|
return r;
|
|
1736
1903
|
}
|
|
1737
|
-
function
|
|
1738
|
-
|
|
1904
|
+
function Qt(e, t, n, r) {
|
|
1905
|
+
t === n || e.has(t) || e.set(t, { ...r, aliasOf: n });
|
|
1906
|
+
}
|
|
1907
|
+
function Xt(e, t) {
|
|
1908
|
+
const n = /* @__PURE__ */ new Map(), { props: r } = Yt(e);
|
|
1739
1909
|
for (const [o, i] of Object.entries(r)) {
|
|
1740
1910
|
let s = "string";
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
valueKind: s
|
|
1745
|
-
});
|
|
1911
|
+
Jt(i) ? s = "boolean" : (zt(i) || Wt(i)) && (s = "json");
|
|
1912
|
+
const a = Gt(o), f = { camelKey: o, kind: "domain", valueKind: s };
|
|
1913
|
+
n.set(a, f), Qt(n, o, a, f);
|
|
1746
1914
|
}
|
|
1747
1915
|
for (const o of t) {
|
|
1748
|
-
const i = o.cliFlag.replace(/^--/, "")
|
|
1749
|
-
n.set(i, {
|
|
1916
|
+
const i = o.cliFlag.replace(/^--/, ""), s = {
|
|
1750
1917
|
camelKey: o.field,
|
|
1751
1918
|
kind: "envelope",
|
|
1752
1919
|
valueKind: "string",
|
|
1753
1920
|
envVar: o.envVar
|
|
1754
|
-
}
|
|
1921
|
+
};
|
|
1922
|
+
n.set(i, s);
|
|
1755
1923
|
}
|
|
1756
1924
|
return n;
|
|
1757
1925
|
}
|
|
1758
|
-
function
|
|
1759
|
-
const { op: t, schema: n, transport: r, projection: o } = e, i =
|
|
1926
|
+
function Nn(e) {
|
|
1927
|
+
const { op: t, schema: n, transport: r, projection: o } = e, i = qt(t, o), s = n ? Zt(n) : [], a = n ? Xt(n, s) : /* @__PURE__ */ new Map(), f = n ? pt(n).params : void 0, u = {
|
|
1760
1928
|
op: t,
|
|
1761
1929
|
transport: r,
|
|
1762
1930
|
http: i.http,
|
|
@@ -1767,38 +1935,42 @@ function dn(e) {
|
|
|
1767
1935
|
envelope: s,
|
|
1768
1936
|
cliFlags: a,
|
|
1769
1937
|
streaming: t.streaming,
|
|
1770
|
-
isMount:
|
|
1938
|
+
isMount: me(t)
|
|
1771
1939
|
};
|
|
1772
|
-
if (
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1940
|
+
if (me(t)) {
|
|
1941
|
+
const c = t.handler;
|
|
1942
|
+
u.mountHandler = async (l) => c(l);
|
|
1775
1943
|
}
|
|
1776
|
-
return
|
|
1944
|
+
return u;
|
|
1777
1945
|
}
|
|
1778
|
-
function
|
|
1946
|
+
function En(e) {
|
|
1779
1947
|
const t = e.usePlugins;
|
|
1780
1948
|
return Array.isArray(t) ? t : [];
|
|
1781
1949
|
}
|
|
1782
|
-
function
|
|
1950
|
+
function _n(e) {
|
|
1951
|
+
const t = e.exitCode;
|
|
1952
|
+
return typeof t == "function" ? t : void 0;
|
|
1953
|
+
}
|
|
1954
|
+
function kn(e) {
|
|
1783
1955
|
const t = e.useOptions;
|
|
1784
1956
|
return t && typeof t == "object" ? t : {};
|
|
1785
1957
|
}
|
|
1786
|
-
function
|
|
1958
|
+
function en(e) {
|
|
1787
1959
|
return async function(n, r) {
|
|
1788
1960
|
const o = Object.assign(n, { data: n.domainArgs });
|
|
1789
1961
|
return await e.layer(o, r);
|
|
1790
1962
|
};
|
|
1791
1963
|
}
|
|
1792
|
-
function
|
|
1964
|
+
function In(e, t) {
|
|
1793
1965
|
var r;
|
|
1794
1966
|
const n = [];
|
|
1795
1967
|
for (const o of t) {
|
|
1796
1968
|
const i = (r = o.capabilities) == null ? void 0 : r.layer;
|
|
1797
|
-
i && n.push(
|
|
1969
|
+
i && n.push(en(i));
|
|
1798
1970
|
}
|
|
1799
|
-
return n.push(
|
|
1971
|
+
return n.push(gt(e)), Ge(n);
|
|
1800
1972
|
}
|
|
1801
|
-
function
|
|
1973
|
+
function tn() {
|
|
1802
1974
|
const e = /* @__PURE__ */ new Map();
|
|
1803
1975
|
return {
|
|
1804
1976
|
get: (t) => e.get(t),
|
|
@@ -1807,18 +1979,18 @@ function Kt() {
|
|
|
1807
1979
|
}
|
|
1808
1980
|
};
|
|
1809
1981
|
}
|
|
1810
|
-
const
|
|
1982
|
+
const nn = {
|
|
1811
1983
|
input: {
|
|
1812
1984
|
type: "object",
|
|
1813
1985
|
properties: { data: { type: "object", properties: {} } }
|
|
1814
1986
|
},
|
|
1815
1987
|
output: {}
|
|
1816
1988
|
};
|
|
1817
|
-
async function
|
|
1989
|
+
async function Cn(e, t, n, r) {
|
|
1818
1990
|
const o = {
|
|
1819
1991
|
...n,
|
|
1820
1992
|
operation: { id: e.op.id },
|
|
1821
|
-
ctx: new
|
|
1993
|
+
ctx: new We()
|
|
1822
1994
|
};
|
|
1823
1995
|
if (e.isMount) {
|
|
1824
1996
|
const i = e.mountHandler;
|
|
@@ -1830,56 +2002,57 @@ async function gn(e, t, n, r) {
|
|
|
1830
2002
|
operation: e.op,
|
|
1831
2003
|
data: n.domainArgs,
|
|
1832
2004
|
envelope: n.envelope,
|
|
1833
|
-
ctx:
|
|
2005
|
+
ctx: tn(),
|
|
1834
2006
|
transport: e.transport,
|
|
1835
2007
|
signal: n.signal ?? new AbortController().signal
|
|
1836
2008
|
}, a = {
|
|
1837
2009
|
...r,
|
|
1838
2010
|
fns: { [e.op.id]: () => i(s) },
|
|
1839
|
-
schemas: { [e.op.id]:
|
|
2011
|
+
schemas: { [e.op.id]: nn }
|
|
1840
2012
|
};
|
|
1841
2013
|
return t(e.op.id, o, a);
|
|
1842
2014
|
}
|
|
1843
2015
|
return t(e.op.id, o, r);
|
|
1844
2016
|
}
|
|
1845
2017
|
export {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
2018
|
+
St as BATCH_DEFAULT_CONCURRENCY,
|
|
2019
|
+
Mt as BATCH_MAX_CONCURRENCY,
|
|
2020
|
+
Ye as EventBus,
|
|
2021
|
+
gn as InstanceRegistry,
|
|
2022
|
+
We as LayerContext,
|
|
1851
2023
|
g as UnionCodecError,
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2024
|
+
ht as ValidateSchemasToken,
|
|
2025
|
+
kt as WELL_KNOWN_TS_CODECS,
|
|
2026
|
+
en as adaptCoreLayer,
|
|
2027
|
+
at as assertNoSelfSubscription,
|
|
2028
|
+
Xe as buildContext,
|
|
2029
|
+
mn as buildFnTable,
|
|
2030
|
+
An as buildMcpOutputSchema,
|
|
2031
|
+
Nn as buildOpPlan,
|
|
2032
|
+
$n as buildToolDescription,
|
|
2033
|
+
yn as coerceQueryParams,
|
|
2034
|
+
bt as collectWithPhase,
|
|
2035
|
+
pn as createApiPackage,
|
|
2036
|
+
Ge as createInvoker,
|
|
2037
|
+
dn as createLogger,
|
|
2038
|
+
In as createPackageInvoker,
|
|
2039
|
+
wn as createStream,
|
|
2040
|
+
jt as createUnionCodec,
|
|
2041
|
+
He as dataParamNames,
|
|
2042
|
+
ln as defineMiddleware,
|
|
2043
|
+
pt as describeParams,
|
|
2044
|
+
Je as dispatch,
|
|
2045
|
+
Cn as dispatchForPlan,
|
|
2046
|
+
bn as drainStream,
|
|
2047
|
+
On as invokeBatch,
|
|
2048
|
+
vt as isApiStream,
|
|
2049
|
+
gt as makeValidateLayer,
|
|
2050
|
+
Ve as needsEnvelopeField,
|
|
2051
|
+
_n as readExitCodeHook,
|
|
2052
|
+
kn as readUseOptions,
|
|
2053
|
+
En as readUsePlugins,
|
|
2054
|
+
vn as tsHostBinding,
|
|
2055
|
+
hn as validateLayer,
|
|
2056
|
+
Qe as wireObservers,
|
|
2057
|
+
jn as wrapMcpStructuredContent
|
|
1885
2058
|
};
|