@adhd/apigen-base-logical 0.1.1 → 0.1.3
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 +43 -0
- package/index.js +1 -1
- package/index.mjs +851 -881
- package/lib/contracts.d.ts +19 -0
- package/package.json +20 -2
package/index.mjs
CHANGED
|
@@ -1,893 +1,863 @@
|
|
|
1
|
-
|
|
2
|
-
class
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/lib/contracts.ts
|
|
2
|
+
var e = "$apigen", t = class extends Error {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
super(e), this.code = "E_DUP_CODEC", this.name = "CodecRegistryError";
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
function n(e) {
|
|
8
|
+
e?.wellKnown;
|
|
9
|
+
let n = /* @__PURE__ */ new Map();
|
|
10
|
+
return {
|
|
11
|
+
register(e, r) {
|
|
12
|
+
if (n.has(e.id) && !r?.override) throw new t(`E_DUP_CODEC: a codec is already registered for id "${e.id}"`);
|
|
13
|
+
n.set(e.id, e);
|
|
14
|
+
},
|
|
15
|
+
resolve(e) {
|
|
16
|
+
for (let t of n.values()) if (t.matches(e)) return t;
|
|
17
|
+
},
|
|
18
|
+
get(e) {
|
|
19
|
+
return n.get(e);
|
|
20
|
+
},
|
|
21
|
+
ids() {
|
|
22
|
+
return [...n.keys()];
|
|
23
|
+
},
|
|
24
|
+
freeze() {
|
|
25
|
+
let e = new Map(n), r = {
|
|
26
|
+
register() {
|
|
27
|
+
throw new t("E_DUP_CODEC: registry is frozen and cannot accept new codecs");
|
|
28
|
+
},
|
|
29
|
+
resolve(t) {
|
|
30
|
+
for (let n of e.values()) if (n.matches(t)) return n;
|
|
31
|
+
},
|
|
32
|
+
get(t) {
|
|
33
|
+
return e.get(t);
|
|
34
|
+
},
|
|
35
|
+
ids() {
|
|
36
|
+
return [...e.keys()];
|
|
37
|
+
},
|
|
38
|
+
freeze() {
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return r;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
6
45
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
16
|
-
r.set(n.id, n);
|
|
17
|
-
},
|
|
18
|
-
resolve(n) {
|
|
19
|
-
for (const o of r.values())
|
|
20
|
-
if (o.matches(n))
|
|
21
|
-
return o;
|
|
22
|
-
},
|
|
23
|
-
get(n) {
|
|
24
|
-
return r.get(n);
|
|
25
|
-
},
|
|
26
|
-
ids() {
|
|
27
|
-
return [...r.keys()];
|
|
28
|
-
},
|
|
29
|
-
freeze() {
|
|
30
|
-
const n = new Map(r), o = {
|
|
31
|
-
register() {
|
|
32
|
-
throw new C(
|
|
33
|
-
"E_DUP_CODEC: registry is frozen and cannot accept new codecs"
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
resolve(i) {
|
|
37
|
-
for (const c of n.values())
|
|
38
|
-
if (c.matches(i))
|
|
39
|
-
return c;
|
|
40
|
-
},
|
|
41
|
-
get(i) {
|
|
42
|
-
return n.get(i);
|
|
43
|
-
},
|
|
44
|
-
ids() {
|
|
45
|
-
return [...n.keys()];
|
|
46
|
-
},
|
|
47
|
-
freeze() {
|
|
48
|
-
return o;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
return o;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
const R = "x-apigen-logical", P = "x-apigen-codec", ee = "x-apigen-ctor", te = "x-apigen-tojson", re = "0.1.0", M = [
|
|
56
|
-
"scalar",
|
|
57
|
-
"nominal",
|
|
58
|
-
"union",
|
|
59
|
-
"map",
|
|
60
|
-
"set"
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/lib/descriptor-ext.ts
|
|
48
|
+
var r = "x-apigen-logical", i = "x-apigen-codec", a = "x-apigen-ctor", o = "x-apigen-tojson", s = "0.1.0", c = [
|
|
49
|
+
"scalar",
|
|
50
|
+
"nominal",
|
|
51
|
+
"union",
|
|
52
|
+
"map",
|
|
53
|
+
"set"
|
|
61
54
|
];
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
function oe(e) {
|
|
67
|
-
const r = e[P];
|
|
68
|
-
return typeof r == "string" ? r : void 0;
|
|
69
|
-
}
|
|
70
|
-
function h(e, r) {
|
|
71
|
-
return {
|
|
72
|
-
registry: e,
|
|
73
|
-
resolve: (t) => {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`[apigen-logical] $ref "${t}" cannot be resolved in run-mode without a descriptor root. Supply a resolve() in the ctx override to handle $ref.`
|
|
76
|
-
);
|
|
77
|
-
},
|
|
78
|
-
seen: /* @__PURE__ */ new WeakSet(),
|
|
79
|
-
path: "",
|
|
80
|
-
mode: "strict",
|
|
81
|
-
...r
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function _(e, r, t) {
|
|
85
|
-
const n = t.registry.resolve(r);
|
|
86
|
-
if (n)
|
|
87
|
-
return n.encode(e, r, t);
|
|
88
|
-
const o = r.$ref;
|
|
89
|
-
if (typeof o == "string") {
|
|
90
|
-
const s = t.resolve(o);
|
|
91
|
-
return _(e, s, t);
|
|
92
|
-
}
|
|
93
|
-
const i = r.oneOf;
|
|
94
|
-
if (Array.isArray(i)) {
|
|
95
|
-
const s = N(e, i, r);
|
|
96
|
-
return _(e, s, t);
|
|
97
|
-
}
|
|
98
|
-
const c = r.type;
|
|
99
|
-
if (c === "array") {
|
|
100
|
-
if (!Array.isArray(e))
|
|
101
|
-
return E(e, r, t);
|
|
102
|
-
const s = r.items;
|
|
103
|
-
if (!s)
|
|
104
|
-
return e.map((a) => m(a));
|
|
105
|
-
const u = t.path;
|
|
106
|
-
return Array.isArray(s) ? e.map((a, f) => {
|
|
107
|
-
const d = s[f];
|
|
108
|
-
return d === void 0 ? m(a) : _(a, d, { ...t, path: `${u}/${f}` });
|
|
109
|
-
}) : e.map(
|
|
110
|
-
(a, f) => _(a, s, { ...t, path: `${u}/${f}` })
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
if (c === "object") {
|
|
114
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
115
|
-
return E(e, r, t);
|
|
116
|
-
const s = r.properties;
|
|
117
|
-
if (!s)
|
|
118
|
-
return m(e);
|
|
119
|
-
const u = t.path, a = {};
|
|
120
|
-
for (const [f, d] of Object.entries(s)) {
|
|
121
|
-
const p = e[f];
|
|
122
|
-
p !== void 0 && (a[f] = _(p, d, {
|
|
123
|
-
...t,
|
|
124
|
-
path: `${u}/${f}`
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
return a;
|
|
128
|
-
}
|
|
129
|
-
return c == null ? E(e, r, t) : m(e);
|
|
130
|
-
}
|
|
131
|
-
function l(e, r, t) {
|
|
132
|
-
const n = t.registry.resolve(r);
|
|
133
|
-
if (n)
|
|
134
|
-
return n.decode(e, r, t);
|
|
135
|
-
const o = r.$ref;
|
|
136
|
-
if (typeof o == "string") {
|
|
137
|
-
const s = t.resolve(o);
|
|
138
|
-
return l(e, s, t);
|
|
139
|
-
}
|
|
140
|
-
const i = r.oneOf;
|
|
141
|
-
if (Array.isArray(i)) {
|
|
142
|
-
const s = N(e, i, r);
|
|
143
|
-
return l(e, s, t);
|
|
144
|
-
}
|
|
145
|
-
const c = r.type;
|
|
146
|
-
if (c === "array") {
|
|
147
|
-
if (!Array.isArray(e))
|
|
148
|
-
return e;
|
|
149
|
-
const s = r.items;
|
|
150
|
-
if (!s)
|
|
151
|
-
return e;
|
|
152
|
-
const u = t.path;
|
|
153
|
-
return Array.isArray(s) ? e.map((a, f) => {
|
|
154
|
-
const d = s[f];
|
|
155
|
-
return d === void 0 ? a : l(a, d, { ...t, path: `${u}/${f}` });
|
|
156
|
-
}) : e.map(
|
|
157
|
-
(a, f) => l(a, s, { ...t, path: `${u}/${f}` })
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
if (c === "object") {
|
|
161
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
162
|
-
return e;
|
|
163
|
-
const s = r.properties;
|
|
164
|
-
if (!s)
|
|
165
|
-
return e;
|
|
166
|
-
const u = t.path, a = {};
|
|
167
|
-
for (const [f, d] of Object.entries(s)) {
|
|
168
|
-
const p = e[f];
|
|
169
|
-
p !== void 0 && (a[f] = l(p, d, {
|
|
170
|
-
...t,
|
|
171
|
-
path: `${u}/${f}`
|
|
172
|
-
}));
|
|
173
|
-
}
|
|
174
|
-
return a;
|
|
175
|
-
}
|
|
176
|
-
return c == null ? k(e, t) : e;
|
|
177
|
-
}
|
|
178
|
-
function N(e, r, t, n) {
|
|
179
|
-
const o = t.discriminator;
|
|
180
|
-
if (o != null && o.propertyName) {
|
|
181
|
-
const i = e !== null && typeof e == "object" ? e[o.propertyName] : void 0;
|
|
182
|
-
if (typeof i == "string" && o.mapping) {
|
|
183
|
-
const c = o.mapping[i];
|
|
184
|
-
if (c) {
|
|
185
|
-
const s = r.find((u) => u.$ref === c);
|
|
186
|
-
if (s)
|
|
187
|
-
return s;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return r[0] ?? {};
|
|
192
|
-
}
|
|
193
|
-
function E(e, r, t) {
|
|
194
|
-
for (const n of t.registry.ids()) {
|
|
195
|
-
const o = t.registry.get(n);
|
|
196
|
-
if (o)
|
|
197
|
-
try {
|
|
198
|
-
const i = o.encode(e, o.schema, t);
|
|
199
|
-
return { [D]: n, v: i };
|
|
200
|
-
} catch {
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return m(e);
|
|
204
|
-
}
|
|
205
|
-
function k(e, r) {
|
|
206
|
-
if (e !== null && typeof e == "object" && !Array.isArray(e) && D in e) {
|
|
207
|
-
const t = e, n = t[D], o = r.registry.get(n);
|
|
208
|
-
if (o)
|
|
209
|
-
return o.decode(t.v, o.schema, r);
|
|
210
|
-
}
|
|
211
|
-
return e;
|
|
212
|
-
}
|
|
213
|
-
function m(e) {
|
|
214
|
-
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
215
|
-
return e;
|
|
216
|
-
if (Array.isArray(e))
|
|
217
|
-
return e.map(m);
|
|
218
|
-
if (typeof e == "object") {
|
|
219
|
-
const r = {};
|
|
220
|
-
for (const [t, n] of Object.entries(e))
|
|
221
|
-
n !== void 0 && (r[t] = m(n));
|
|
222
|
-
return r;
|
|
223
|
-
}
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
function ie(e, r) {
|
|
227
|
-
const t = /* @__PURE__ */ new Set(), n = [e];
|
|
228
|
-
for (; n.length > 0; ) {
|
|
229
|
-
const o = n.pop();
|
|
230
|
-
if (!o || t.has(o))
|
|
231
|
-
continue;
|
|
232
|
-
t.add(o);
|
|
233
|
-
const i = o.$ref;
|
|
234
|
-
if (typeof i == "string") {
|
|
235
|
-
if (r) {
|
|
236
|
-
const d = r[i];
|
|
237
|
-
if (!d) {
|
|
238
|
-
const p = Object.keys(r).join(", ") || "(none)";
|
|
239
|
-
throw new Error(
|
|
240
|
-
`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${p}`
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
n.push(d);
|
|
244
|
-
}
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
const c = o.oneOf;
|
|
248
|
-
if (Array.isArray(c))
|
|
249
|
-
for (const d of c)
|
|
250
|
-
typeof d == "object" && d !== null && n.push(d);
|
|
251
|
-
const s = o.properties;
|
|
252
|
-
if (s)
|
|
253
|
-
for (const d of Object.values(s))
|
|
254
|
-
n.push(d);
|
|
255
|
-
const u = o.items;
|
|
256
|
-
if (Array.isArray(u))
|
|
257
|
-
for (const d of u)
|
|
258
|
-
typeof d == "object" && d !== null && n.push(d);
|
|
259
|
-
else
|
|
260
|
-
typeof u == "object" && u !== null && n.push(u);
|
|
261
|
-
const a = o.additionalProperties;
|
|
262
|
-
typeof a == "object" && a !== null && n.push(a);
|
|
263
|
-
const f = o.propertyNames;
|
|
264
|
-
typeof f == "object" && f !== null && n.push(f);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function se(e) {
|
|
268
|
-
return {
|
|
269
|
-
encode(r, t, n) {
|
|
270
|
-
const o = h(e, n);
|
|
271
|
-
return _(r, t, o);
|
|
272
|
-
},
|
|
273
|
-
decode(r, t, n) {
|
|
274
|
-
const o = h(e, n);
|
|
275
|
-
return l(r, t, o);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function ce(e, r, t) {
|
|
280
|
-
try {
|
|
281
|
-
const n = t();
|
|
282
|
-
e.register(n);
|
|
283
|
-
} catch (n) {
|
|
284
|
-
if (G(n))
|
|
285
|
-
return;
|
|
286
|
-
throw n;
|
|
287
|
-
}
|
|
55
|
+
function l(e) {
|
|
56
|
+
let t = e[r];
|
|
57
|
+
return typeof t == "string" && c.includes(t) ? t : void 0;
|
|
288
58
|
}
|
|
289
|
-
function
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
59
|
+
function u(e) {
|
|
60
|
+
let t = e[i];
|
|
61
|
+
return typeof t == "string" ? t : void 0;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/lib/runmode.ts
|
|
65
|
+
function d(e, t) {
|
|
66
|
+
return {
|
|
67
|
+
registry: e,
|
|
68
|
+
resolve: (e) => {
|
|
69
|
+
throw Error(`[apigen-logical] $ref "${e}" cannot be resolved in run-mode without a descriptor root. Supply a resolve() in the ctx override to handle $ref.`);
|
|
70
|
+
},
|
|
71
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
72
|
+
path: "",
|
|
73
|
+
mode: "strict",
|
|
74
|
+
...t
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function f(e, t, n) {
|
|
78
|
+
let r = n.registry.resolve(t);
|
|
79
|
+
if (r) return r.encode(e, t, n);
|
|
80
|
+
let i = t.$ref;
|
|
81
|
+
if (typeof i == "string") return f(e, n.resolve(i), n);
|
|
82
|
+
let a = t.oneOf;
|
|
83
|
+
if (Array.isArray(a)) return f(e, m(e, a, t, n), n);
|
|
84
|
+
let o = t.type;
|
|
85
|
+
if (o === "array") {
|
|
86
|
+
if (!Array.isArray(e)) return b(e, t, n);
|
|
87
|
+
let r = t.items;
|
|
88
|
+
if (!r) return e.map((e) => C(e));
|
|
89
|
+
let i = n.path;
|
|
90
|
+
return Array.isArray(r) ? e.map((e, t) => {
|
|
91
|
+
let a = r[t];
|
|
92
|
+
return a === void 0 ? C(e) : f(e, a, {
|
|
93
|
+
...n,
|
|
94
|
+
path: `${i}/${t}`
|
|
95
|
+
});
|
|
96
|
+
}) : e.map((e, t) => f(e, r, {
|
|
97
|
+
...n,
|
|
98
|
+
path: `${i}/${t}`
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
if (o === "object") {
|
|
102
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return b(e, t, n);
|
|
103
|
+
let r = t.properties;
|
|
104
|
+
if (!r) return C(e);
|
|
105
|
+
let i = n.path, a = {};
|
|
106
|
+
for (let [t, o] of Object.entries(r)) {
|
|
107
|
+
let r = e[t];
|
|
108
|
+
r !== void 0 && (a[t] = f(r, o, {
|
|
109
|
+
...n,
|
|
110
|
+
path: `${i}/${t}`
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
return a;
|
|
114
|
+
}
|
|
115
|
+
return o == null ? b(e, t, n) : C(e);
|
|
116
|
+
}
|
|
117
|
+
function p(e, t, n) {
|
|
118
|
+
let r = n.registry.resolve(t);
|
|
119
|
+
if (r) return r.decode(e, t, n);
|
|
120
|
+
let i = t.$ref;
|
|
121
|
+
if (typeof i == "string") return p(e, n.resolve(i), n);
|
|
122
|
+
let a = t.oneOf;
|
|
123
|
+
if (Array.isArray(a)) return p(e, m(e, a, t, n), n);
|
|
124
|
+
let o = t.type;
|
|
125
|
+
if (o === "array") {
|
|
126
|
+
if (!Array.isArray(e)) return e;
|
|
127
|
+
let r = t.items;
|
|
128
|
+
if (!r) return e;
|
|
129
|
+
let i = n.path;
|
|
130
|
+
return Array.isArray(r) ? e.map((e, t) => {
|
|
131
|
+
let a = r[t];
|
|
132
|
+
return a === void 0 ? e : p(e, a, {
|
|
133
|
+
...n,
|
|
134
|
+
path: `${i}/${t}`
|
|
135
|
+
});
|
|
136
|
+
}) : e.map((e, t) => p(e, r, {
|
|
137
|
+
...n,
|
|
138
|
+
path: `${i}/${t}`
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
if (o === "object") {
|
|
142
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
143
|
+
let r = t.properties;
|
|
144
|
+
if (!r) return e;
|
|
145
|
+
let i = n.path, a = {};
|
|
146
|
+
for (let [t, o] of Object.entries(r)) {
|
|
147
|
+
let r = e[t];
|
|
148
|
+
r !== void 0 && (a[t] = p(r, o, {
|
|
149
|
+
...n,
|
|
150
|
+
path: `${i}/${t}`
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
for (let [t, n] of Object.entries(e)) !(t in r) && n !== void 0 && (a[t] = n);
|
|
154
|
+
return a;
|
|
155
|
+
}
|
|
156
|
+
return o == null ? S(e, n) : e;
|
|
157
|
+
}
|
|
158
|
+
function m(e, t, n, r) {
|
|
159
|
+
let i = n.discriminator;
|
|
160
|
+
if (i?.propertyName) {
|
|
161
|
+
let n = i.propertyName, a = typeof e == "object" && e ? e[n] : void 0;
|
|
162
|
+
if (typeof a == "string") {
|
|
163
|
+
if (i.mapping) {
|
|
164
|
+
let e = i.mapping[a];
|
|
165
|
+
if (e) {
|
|
166
|
+
let n = t.find((t) => t.$ref === e);
|
|
167
|
+
if (n) return n;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
for (let e of t) {
|
|
171
|
+
let t = h(e, r).properties?.[n];
|
|
172
|
+
if (!t) continue;
|
|
173
|
+
let i = t.enum;
|
|
174
|
+
if (t.const === a || Array.isArray(i) && i.includes(a)) return e;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
let a = _(e, t, r);
|
|
179
|
+
if (a) return a;
|
|
180
|
+
let o, s = -1;
|
|
181
|
+
for (let n of t) {
|
|
182
|
+
let t = y(e, h(n, r), r);
|
|
183
|
+
t !== null && t > s && (s = t, o = n);
|
|
184
|
+
}
|
|
185
|
+
return o === void 0 ? t[0] ?? {} : o;
|
|
186
|
+
}
|
|
187
|
+
function h(e, t) {
|
|
188
|
+
let n = e.$ref;
|
|
189
|
+
return typeof n == "string" ? t.resolve(n) : e;
|
|
190
|
+
}
|
|
191
|
+
function g(e) {
|
|
192
|
+
if ("const" in e) return e.const;
|
|
193
|
+
let t = e.enum;
|
|
194
|
+
if (Array.isArray(t) && t.length === 1) return t[0];
|
|
195
|
+
}
|
|
196
|
+
function _(e, t, n) {
|
|
197
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return;
|
|
198
|
+
let r = e, i = t.map((e) => h(e, n)), a = /* @__PURE__ */ new Set();
|
|
199
|
+
for (let e of i) {
|
|
200
|
+
let t = e.properties;
|
|
201
|
+
if (t) for (let [e, n] of Object.entries(t)) g(n) !== void 0 && a.add(e);
|
|
202
|
+
}
|
|
203
|
+
for (let o of a) {
|
|
204
|
+
let a = i.map((e) => {
|
|
205
|
+
let t = e.properties?.[o];
|
|
206
|
+
return t ? g(t) : void 0;
|
|
207
|
+
}), s = a.filter((e) => e !== void 0), c = new Set(s);
|
|
208
|
+
if (s.length < 2 || c.size !== s.length) continue;
|
|
209
|
+
let l = r[o];
|
|
210
|
+
if (l === void 0) continue;
|
|
211
|
+
let u = a.findIndex((e) => e === l);
|
|
212
|
+
if (u !== -1 && y(e, i[u], n) !== null) return t[u];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function v(e) {
|
|
216
|
+
if (e === null) return "null";
|
|
217
|
+
if (Array.isArray(e)) return "array";
|
|
218
|
+
let t = typeof e;
|
|
219
|
+
return t === "number" ? Number.isInteger(e) ? "integer" : "number" : t;
|
|
220
|
+
}
|
|
221
|
+
function y(e, t, n) {
|
|
222
|
+
let r = t.oneOf;
|
|
223
|
+
if (Array.isArray(r)) {
|
|
224
|
+
let t = null;
|
|
225
|
+
for (let i of r) {
|
|
226
|
+
let r = y(e, h(i, n), n);
|
|
227
|
+
r !== null && (t === null || r > t) && (t = r);
|
|
228
|
+
}
|
|
229
|
+
return t;
|
|
230
|
+
}
|
|
231
|
+
let i = t.type, a = v(e);
|
|
232
|
+
if (typeof i == "string") {
|
|
233
|
+
if (!(i === a || i === "number" && a === "integer")) return null;
|
|
234
|
+
} else if (Array.isArray(i) && !i.some((e) => e === a || e === "number" && a === "integer")) return null;
|
|
235
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return +(typeof i == "string");
|
|
236
|
+
let o = e, s = t.required, c = 0;
|
|
237
|
+
if (Array.isArray(s)) {
|
|
238
|
+
for (let e of s) if (typeof e == "string") {
|
|
239
|
+
if (o[e] === void 0) return null;
|
|
240
|
+
c += 2;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
let l = t.properties;
|
|
244
|
+
if (l) {
|
|
245
|
+
for (let e of Object.keys(l)) o[e] !== void 0 && (c += 1);
|
|
246
|
+
for (let e of Object.keys(o)) l[e] === void 0 && --c;
|
|
247
|
+
}
|
|
248
|
+
return c;
|
|
249
|
+
}
|
|
250
|
+
function b(t, n, r) {
|
|
251
|
+
for (let n of r.registry.ids()) {
|
|
252
|
+
let i = r.registry.get(n);
|
|
253
|
+
if (i?.ownsValue?.(t)) return {
|
|
254
|
+
[e]: n,
|
|
255
|
+
v: i.encode(t, i.schema, r)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (Array.isArray(t)) return t.map((e) => b(e, {}, r));
|
|
259
|
+
if (x(t)) {
|
|
260
|
+
let e = {};
|
|
261
|
+
for (let [n, i] of Object.entries(t)) i !== void 0 && (e[n] = b(i, {}, r));
|
|
262
|
+
return e;
|
|
263
|
+
}
|
|
264
|
+
return C(t);
|
|
265
|
+
}
|
|
266
|
+
function x(e) {
|
|
267
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
268
|
+
let t = Object.getPrototypeOf(e);
|
|
269
|
+
return t === Object.prototype || t === null;
|
|
270
|
+
}
|
|
271
|
+
function S(t, n) {
|
|
272
|
+
if (typeof t == "object" && t && !Array.isArray(t) && "$apigen" in t) {
|
|
273
|
+
let r = t, i = r[e], a = n.registry.get(i);
|
|
274
|
+
if (a) return a.decode(r.v, a.schema, n);
|
|
275
|
+
}
|
|
276
|
+
if (Array.isArray(t)) return t.map((e) => S(e, n));
|
|
277
|
+
if (x(t)) {
|
|
278
|
+
let e = {};
|
|
279
|
+
for (let [r, i] of Object.entries(t)) e[r] = S(i, n);
|
|
280
|
+
return e;
|
|
281
|
+
}
|
|
282
|
+
return t;
|
|
283
|
+
}
|
|
284
|
+
function C(e) {
|
|
285
|
+
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
|
|
286
|
+
if (Array.isArray(e)) return e.map(C);
|
|
287
|
+
if (typeof e == "object") {
|
|
288
|
+
let t = {};
|
|
289
|
+
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = C(r));
|
|
290
|
+
return t;
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
function w(e, t) {
|
|
295
|
+
let n = /* @__PURE__ */ new Set(), r = [e];
|
|
296
|
+
for (; r.length > 0;) {
|
|
297
|
+
let e = r.pop();
|
|
298
|
+
if (!e || n.has(e)) continue;
|
|
299
|
+
n.add(e);
|
|
300
|
+
let i = e.$ref;
|
|
301
|
+
if (typeof i == "string") {
|
|
302
|
+
if (t) {
|
|
303
|
+
let e = t[i];
|
|
304
|
+
if (!e) {
|
|
305
|
+
let e = Object.keys(t).join(", ") || "(none)";
|
|
306
|
+
throw Error(`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${e}`);
|
|
307
|
+
}
|
|
308
|
+
r.push(e);
|
|
309
|
+
}
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
let a = e.oneOf;
|
|
313
|
+
if (Array.isArray(a)) for (let e of a) typeof e == "object" && e && r.push(e);
|
|
314
|
+
let o = e.properties;
|
|
315
|
+
if (o) for (let e of Object.values(o)) r.push(e);
|
|
316
|
+
let s = e.items;
|
|
317
|
+
if (Array.isArray(s)) for (let e of s) typeof e == "object" && e && r.push(e);
|
|
318
|
+
else typeof s == "object" && s && r.push(s);
|
|
319
|
+
let c = e.additionalProperties;
|
|
320
|
+
typeof c == "object" && c && r.push(c);
|
|
321
|
+
let l = e.propertyNames;
|
|
322
|
+
typeof l == "object" && l && r.push(l);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function T(e) {
|
|
326
|
+
return {
|
|
327
|
+
encode(t, n, r) {
|
|
328
|
+
return f(t, n, d(e, r));
|
|
329
|
+
},
|
|
330
|
+
decode(t, n, r) {
|
|
331
|
+
return p(t, n, d(e, r));
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function E(e, t, n) {
|
|
336
|
+
try {
|
|
337
|
+
let t = n();
|
|
338
|
+
e.register(t);
|
|
339
|
+
} catch (e) {
|
|
340
|
+
if (D(e)) return;
|
|
341
|
+
throw e;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function D(e) {
|
|
345
|
+
return typeof e != "object" || !e ? !1 : e.code === "MODULE_NOT_FOUND";
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/lib/codecs/date-time.ts
|
|
349
|
+
var O = {
|
|
350
|
+
id: "date-time",
|
|
351
|
+
kind: "scalar",
|
|
352
|
+
schema: {
|
|
353
|
+
type: "string",
|
|
354
|
+
format: "date-time"
|
|
355
|
+
},
|
|
356
|
+
matches(e) {
|
|
357
|
+
return e.type === "string" && e.format === "date-time";
|
|
358
|
+
},
|
|
359
|
+
ownsValue(e) {
|
|
360
|
+
return e instanceof Date;
|
|
361
|
+
},
|
|
362
|
+
encode(e, t, n) {
|
|
363
|
+
return e.toISOString();
|
|
364
|
+
},
|
|
365
|
+
decode(e, t, n) {
|
|
366
|
+
if (typeof e != "string") {
|
|
367
|
+
if (n.mode === "strict") throw TypeError(`[date-time] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
368
|
+
return new Date(String(e));
|
|
369
|
+
}
|
|
370
|
+
if (n.mode === "strict" && Number.isNaN(new Date(e).getTime())) throw TypeError(`[date-time] invalid date-time string at "${n.path}": ${JSON.stringify(e)}`);
|
|
371
|
+
return new Date(e);
|
|
372
|
+
}
|
|
373
|
+
}, k = {
|
|
374
|
+
id: "int64",
|
|
375
|
+
kind: "scalar",
|
|
376
|
+
schema: {
|
|
377
|
+
type: "string",
|
|
378
|
+
format: "int64"
|
|
379
|
+
},
|
|
380
|
+
matches(e) {
|
|
381
|
+
return e.type === "string" && e.format === "int64";
|
|
382
|
+
},
|
|
383
|
+
ownsValue(e) {
|
|
384
|
+
return typeof e == "bigint";
|
|
385
|
+
},
|
|
386
|
+
encode(e, t, n) {
|
|
387
|
+
return String(e);
|
|
388
|
+
},
|
|
389
|
+
decode(e, t, n) {
|
|
390
|
+
if (typeof e != "string") {
|
|
391
|
+
if (n.mode === "strict") throw TypeError(`[int64] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
392
|
+
try {
|
|
393
|
+
return BigInt(Math.trunc(Number(e)));
|
|
394
|
+
} catch {
|
|
395
|
+
return BigInt(0);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (n.mode === "strict") return BigInt(e);
|
|
399
|
+
if (/^-?\d+$/.test(e)) try {
|
|
400
|
+
return BigInt(e);
|
|
401
|
+
} catch {
|
|
402
|
+
return BigInt(0);
|
|
403
|
+
}
|
|
404
|
+
return BigInt(0);
|
|
405
|
+
}
|
|
348
406
|
};
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (!Number.isNaN(n))
|
|
450
|
-
return n;
|
|
451
|
-
}
|
|
452
|
-
if (t.mode === "strict")
|
|
453
|
-
throw new TypeError(
|
|
454
|
-
`[number-special] unrecognized wire value at "${t.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...z].join(", ")}.`
|
|
455
|
-
);
|
|
456
|
-
return NaN;
|
|
457
|
-
}
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/lib/codecs/decimal.ts
|
|
409
|
+
function A(e) {
|
|
410
|
+
return e;
|
|
411
|
+
}
|
|
412
|
+
var j = {
|
|
413
|
+
id: "decimal",
|
|
414
|
+
kind: "scalar",
|
|
415
|
+
schema: {
|
|
416
|
+
type: "string",
|
|
417
|
+
format: "decimal"
|
|
418
|
+
},
|
|
419
|
+
matches(e) {
|
|
420
|
+
return e.type === "string" && e.format === "decimal";
|
|
421
|
+
},
|
|
422
|
+
encode(e, t, n) {
|
|
423
|
+
return e;
|
|
424
|
+
},
|
|
425
|
+
decode(e, t, n) {
|
|
426
|
+
if (typeof e != "string") {
|
|
427
|
+
if (n.mode === "strict") throw TypeError(`[decimal] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
428
|
+
return A(String(e));
|
|
429
|
+
}
|
|
430
|
+
if (n.mode === "strict" && !/^-?\d+(\.\d+)?$/.test(e)) throw TypeError(`[decimal] wire value "${e}" at "${n.path}" is not a valid decimal string`);
|
|
431
|
+
return A(e);
|
|
432
|
+
}
|
|
433
|
+
}, M = {
|
|
434
|
+
id: "byte",
|
|
435
|
+
kind: "scalar",
|
|
436
|
+
schema: {
|
|
437
|
+
type: "string",
|
|
438
|
+
format: "byte"
|
|
439
|
+
},
|
|
440
|
+
matches(e) {
|
|
441
|
+
return e.type === "string" && e.format === "byte";
|
|
442
|
+
},
|
|
443
|
+
ownsValue(e) {
|
|
444
|
+
return e instanceof Uint8Array;
|
|
445
|
+
},
|
|
446
|
+
encode(e, t, n) {
|
|
447
|
+
return Buffer.from(e).toString("base64");
|
|
448
|
+
},
|
|
449
|
+
decode(e, t, n) {
|
|
450
|
+
if (typeof e != "string") {
|
|
451
|
+
if (n.mode === "strict") throw TypeError(`[byte] expected a base64 string on the wire at "${n.path}", got ${typeof e}`);
|
|
452
|
+
return /* @__PURE__ */ new Uint8Array();
|
|
453
|
+
}
|
|
454
|
+
if (n.mode === "strict" && !/^[A-Za-z0-9+/]*={0,2}$/.test(e)) throw TypeError(`[byte] wire value at "${n.path}" is not standard base64 (format:byte): "${e}"`);
|
|
455
|
+
return new Uint8Array(Buffer.from(e, "base64"));
|
|
456
|
+
}
|
|
457
|
+
}, N = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, P = {
|
|
458
|
+
id: "uuid",
|
|
459
|
+
kind: "scalar",
|
|
460
|
+
schema: {
|
|
461
|
+
type: "string",
|
|
462
|
+
format: "uuid"
|
|
463
|
+
},
|
|
464
|
+
matches(e) {
|
|
465
|
+
return e.type === "string" && e.format === "uuid";
|
|
466
|
+
},
|
|
467
|
+
encode(e, t, n) {
|
|
468
|
+
return e.toLowerCase();
|
|
469
|
+
},
|
|
470
|
+
decode(e, t, n) {
|
|
471
|
+
if (typeof e != "string") {
|
|
472
|
+
if (n.mode === "strict") throw TypeError(`[uuid] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
473
|
+
return String(e).toLowerCase();
|
|
474
|
+
}
|
|
475
|
+
if (n.mode === "strict" && !N.test(e)) throw TypeError(`[uuid] wire value "${e}" at "${n.path}" is not a lowercase-hyphenated RFC 4122 UUID`);
|
|
476
|
+
return e;
|
|
477
|
+
}
|
|
478
|
+
}, F = "NaN", I = "Infinity", L = "-Infinity", R = /* @__PURE__ */ new Set([
|
|
479
|
+
F,
|
|
480
|
+
I,
|
|
481
|
+
L
|
|
482
|
+
]), z = {
|
|
483
|
+
id: "number-special",
|
|
484
|
+
kind: "scalar",
|
|
485
|
+
schema: { type: "number" },
|
|
486
|
+
matches(e) {
|
|
487
|
+
return e.type === "number" && e.format === void 0;
|
|
488
|
+
},
|
|
489
|
+
ownsValue(e) {
|
|
490
|
+
return typeof e == "number" && !Number.isFinite(e);
|
|
491
|
+
},
|
|
492
|
+
encode(e, t, n) {
|
|
493
|
+
return Number.isNaN(e) ? F : e === Infinity ? I : e === -Infinity ? L : e;
|
|
494
|
+
},
|
|
495
|
+
decode(e, t, n) {
|
|
496
|
+
if (typeof e == "number") return e;
|
|
497
|
+
if (typeof e == "string") {
|
|
498
|
+
if (e === F) return NaN;
|
|
499
|
+
if (e === I) return Infinity;
|
|
500
|
+
if (e === L) return -Infinity;
|
|
501
|
+
let t = Number(e);
|
|
502
|
+
if (!Number.isNaN(t)) return t;
|
|
503
|
+
}
|
|
504
|
+
if (n.mode === "strict") throw TypeError(`[number-special] unrecognized wire value at "${n.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...R].join(", ")}.`);
|
|
505
|
+
return NaN;
|
|
506
|
+
}
|
|
458
507
|
}, B = [
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
508
|
+
O,
|
|
509
|
+
k,
|
|
510
|
+
j,
|
|
511
|
+
M,
|
|
512
|
+
P,
|
|
513
|
+
z
|
|
465
514
|
];
|
|
466
|
-
function
|
|
467
|
-
|
|
468
|
-
e.register(t, { override: r.override ?? !1 });
|
|
469
|
-
}
|
|
470
|
-
const J = 12;
|
|
471
|
-
function Y(e, r) {
|
|
472
|
-
const t = /^#\/(definitions|\$defs)\/(.+)$/.exec(e);
|
|
473
|
-
if (!t)
|
|
474
|
-
return;
|
|
475
|
-
const [, n, o] = t, i = n === "$defs" ? r.$defs : r.definitions;
|
|
476
|
-
return i == null ? void 0 : i[decodeURIComponent(o)];
|
|
515
|
+
function V(e, t = {}) {
|
|
516
|
+
for (let n of B) e.register(n, { override: t.override ?? !1 });
|
|
477
517
|
}
|
|
478
|
-
|
|
479
|
-
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/lib/example.ts
|
|
520
|
+
var H = 12;
|
|
521
|
+
function U(e, t) {
|
|
522
|
+
let n = /^#\/(definitions|\$defs)\/(.+)$/.exec(e);
|
|
523
|
+
if (!n) return;
|
|
524
|
+
let [, r, i] = n;
|
|
525
|
+
return (r === "$defs" ? t.$defs : t.definitions)?.[decodeURIComponent(i)];
|
|
480
526
|
}
|
|
481
527
|
function W(e) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
528
|
+
return Array.isArray(e) && e.length > 0 ? e[0] : void 0;
|
|
529
|
+
}
|
|
530
|
+
function G(e) {
|
|
531
|
+
if (Array.isArray(e.type)) return e.type.find((e) => e !== "null") ?? e.type[0];
|
|
532
|
+
if (typeof e.type == "string") return e.type;
|
|
533
|
+
if (e.properties) return "object";
|
|
488
534
|
}
|
|
489
535
|
function K(e) {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
decode: "new BigDecimal($)",
|
|
789
|
-
imports: [
|
|
790
|
-
"import java.math.BigDecimal;",
|
|
791
|
-
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
792
|
-
"import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;"
|
|
793
|
-
],
|
|
794
|
-
mode: "native"
|
|
795
|
-
},
|
|
796
|
-
byte: {
|
|
797
|
-
// byte[] <-> base64 String is Jackson's built-in default codec — no
|
|
798
|
-
// annotation, no wrapping expression. The dispatcher glue passes the
|
|
799
|
-
// value through unchanged; Jackson's ObjectMapper performs the base64
|
|
800
|
-
// transcoding when the JsonNode tree is built/read.
|
|
801
|
-
encode: "$",
|
|
802
|
-
decode: "$",
|
|
803
|
-
mode: "native"
|
|
804
|
-
},
|
|
805
|
-
uuid: {
|
|
806
|
-
// UUID.toString() / UUID.fromString($) — stdlib Java, no Jackson module.
|
|
807
|
-
encode: "$.toString()",
|
|
808
|
-
decode: "UUID.fromString($)",
|
|
809
|
-
imports: ["import java.util.UUID;"],
|
|
810
|
-
mode: "native"
|
|
811
|
-
},
|
|
812
|
-
"number-special": {
|
|
813
|
-
// NaN/Infinity/-Infinity have no native JSON representation; mirrors the
|
|
814
|
-
// TS numToWire/wireToNum inline helpers with a small custom Jackson
|
|
815
|
-
// StdSerializer/StdDeserializer pair, generated inline by
|
|
816
|
-
// renderDispatcherJava (class names below are the fixed contract the
|
|
817
|
-
// generator emits — apigen-plugin-java-javalin/src/lib/dispatcher-template.ts).
|
|
818
|
-
encode: "@JsonSerialize(using = NumberSpecialSerializer.class)",
|
|
819
|
-
decode: "@JsonDeserialize(using = NumberSpecialDeserializer.class)",
|
|
820
|
-
imports: [
|
|
821
|
-
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
822
|
-
"import com.fasterxml.jackson.databind.annotation.JsonDeserialize;"
|
|
823
|
-
],
|
|
824
|
-
mode: "native"
|
|
825
|
-
}
|
|
826
|
-
}, g = Object.freeze({
|
|
827
|
-
typescript: X,
|
|
828
|
-
python: V,
|
|
829
|
-
rust: Z,
|
|
830
|
-
go: H,
|
|
831
|
-
java: Q
|
|
536
|
+
switch (e.format) {
|
|
537
|
+
case "date-time": return "1970-01-01T00:00:00.000Z";
|
|
538
|
+
case "date": return "1970-01-01";
|
|
539
|
+
case "time": return "00:00:00Z";
|
|
540
|
+
case "uuid": return "00000000-0000-0000-0000-000000000000";
|
|
541
|
+
case "email": return "user@example.com";
|
|
542
|
+
case "uri":
|
|
543
|
+
case "url":
|
|
544
|
+
case "uri-reference": return "https://example.com";
|
|
545
|
+
case "hostname": return "example.com";
|
|
546
|
+
case "ipv4": return "127.0.0.1";
|
|
547
|
+
case "ipv6": return "::1";
|
|
548
|
+
case "decimal": return "0";
|
|
549
|
+
case "int64": return "0";
|
|
550
|
+
case "byte": return "";
|
|
551
|
+
default: return "<string>";
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function q(e, t, n) {
|
|
555
|
+
let r = e.properties ?? {}, i = e.required ?? [], a = {};
|
|
556
|
+
for (let e of i) {
|
|
557
|
+
let i = r[e];
|
|
558
|
+
a[e] = i === void 0 ? `<${e}>` : Y(i, t, n + 1);
|
|
559
|
+
}
|
|
560
|
+
return a;
|
|
561
|
+
}
|
|
562
|
+
function J(e, t, n) {
|
|
563
|
+
let r = Array.isArray(e.items) ? e.items[0] : e.items;
|
|
564
|
+
return r ? [Y(r, t, n + 1)] : [];
|
|
565
|
+
}
|
|
566
|
+
function Y(e, t = e ?? {}, n = 0) {
|
|
567
|
+
if (!e || n > H) return null;
|
|
568
|
+
if (typeof e.$ref == "string") {
|
|
569
|
+
let r = U(e.$ref, t);
|
|
570
|
+
return r === void 0 ? null : Y(r, t, n + 1);
|
|
571
|
+
}
|
|
572
|
+
if (e.const !== void 0) return e.const;
|
|
573
|
+
if (Array.isArray(e.enum) && e.enum.length > 0) return e.enum[0];
|
|
574
|
+
if (Array.isArray(e.allOf) && e.allOf.length > 0) {
|
|
575
|
+
let r = {}, i = [];
|
|
576
|
+
for (let t of e.allOf) {
|
|
577
|
+
Object.assign(r, t.properties ?? {});
|
|
578
|
+
for (let e of t.required ?? []) i.includes(e) || i.push(e);
|
|
579
|
+
}
|
|
580
|
+
return q({
|
|
581
|
+
...e,
|
|
582
|
+
properties: r,
|
|
583
|
+
required: i
|
|
584
|
+
}, t, n);
|
|
585
|
+
}
|
|
586
|
+
let r = W(e.oneOf) ?? W(e.anyOf);
|
|
587
|
+
if (r) return Y(r, t, n + 1);
|
|
588
|
+
switch (G(e)) {
|
|
589
|
+
case "object": return q(e, t, n);
|
|
590
|
+
case "array": return J(e, t, n);
|
|
591
|
+
case "string": return K(e);
|
|
592
|
+
case "integer":
|
|
593
|
+
case "number": return 0;
|
|
594
|
+
case "boolean": return !1;
|
|
595
|
+
case "null": return null;
|
|
596
|
+
default: return null;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function X(e) {
|
|
600
|
+
if (!e) return;
|
|
601
|
+
let t = Y(e);
|
|
602
|
+
return `Example: ${JSON.stringify(t)}`;
|
|
603
|
+
}
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/lib/hints.ts
|
|
606
|
+
var Z = [
|
|
607
|
+
O.id,
|
|
608
|
+
k.id,
|
|
609
|
+
j.id,
|
|
610
|
+
M.id,
|
|
611
|
+
P.id,
|
|
612
|
+
z.id
|
|
613
|
+
], Q = Object.freeze({
|
|
614
|
+
typescript: {
|
|
615
|
+
"date-time": {
|
|
616
|
+
encode: "$.toISOString()",
|
|
617
|
+
decode: "new Date($)",
|
|
618
|
+
mode: "native"
|
|
619
|
+
},
|
|
620
|
+
int64: {
|
|
621
|
+
encode: "String($)",
|
|
622
|
+
decode: "BigInt($)",
|
|
623
|
+
mode: "native"
|
|
624
|
+
},
|
|
625
|
+
decimal: {
|
|
626
|
+
encode: "$.toString()",
|
|
627
|
+
decode: "new Decimal($)",
|
|
628
|
+
imports: [],
|
|
629
|
+
dep: {
|
|
630
|
+
name: "decimal.js",
|
|
631
|
+
version: "^10"
|
|
632
|
+
},
|
|
633
|
+
mode: "branded"
|
|
634
|
+
},
|
|
635
|
+
byte: {
|
|
636
|
+
encode: "Buffer.from($).toString('base64')",
|
|
637
|
+
decode: "new Uint8Array(Buffer.from($, 'base64'))",
|
|
638
|
+
mode: "native"
|
|
639
|
+
},
|
|
640
|
+
uuid: {
|
|
641
|
+
encode: "$.toLowerCase()",
|
|
642
|
+
decode: "$",
|
|
643
|
+
mode: "native"
|
|
644
|
+
},
|
|
645
|
+
"number-special": {
|
|
646
|
+
encode: "numToWire($)",
|
|
647
|
+
decode: "wireToNum($)",
|
|
648
|
+
mode: "native"
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
python: {
|
|
652
|
+
"date-time": {
|
|
653
|
+
encode: "$.isoformat()",
|
|
654
|
+
decode: "datetime.fromisoformat($)",
|
|
655
|
+
imports: ["from datetime import datetime"],
|
|
656
|
+
mode: "native"
|
|
657
|
+
},
|
|
658
|
+
int64: {
|
|
659
|
+
encode: "str($)",
|
|
660
|
+
decode: "int($)",
|
|
661
|
+
mode: "native"
|
|
662
|
+
},
|
|
663
|
+
decimal: {
|
|
664
|
+
encode: "str($)",
|
|
665
|
+
decode: "Decimal($)",
|
|
666
|
+
imports: ["from decimal import Decimal"],
|
|
667
|
+
mode: "native"
|
|
668
|
+
},
|
|
669
|
+
byte: {
|
|
670
|
+
encode: "b64encode($).decode()",
|
|
671
|
+
decode: "b64decode($)",
|
|
672
|
+
imports: ["from base64 import b64encode, b64decode"],
|
|
673
|
+
mode: "native"
|
|
674
|
+
},
|
|
675
|
+
uuid: {
|
|
676
|
+
encode: "str($)",
|
|
677
|
+
decode: "UUID($)",
|
|
678
|
+
imports: ["from uuid import UUID"],
|
|
679
|
+
mode: "native"
|
|
680
|
+
},
|
|
681
|
+
"number-special": {
|
|
682
|
+
encode: "num_to_wire($)",
|
|
683
|
+
decode: "wire_to_num($)",
|
|
684
|
+
mode: "native"
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
rust: {
|
|
688
|
+
"date-time": {
|
|
689
|
+
encode: "__SCAFFOLD_RUST_DATETIME_ENCODE__",
|
|
690
|
+
decode: "__SCAFFOLD_RUST_DATETIME_DECODE__",
|
|
691
|
+
imports: ["use chrono::{DateTime, Utc};"],
|
|
692
|
+
dep: {
|
|
693
|
+
name: "chrono",
|
|
694
|
+
version: "^0.4"
|
|
695
|
+
},
|
|
696
|
+
mode: "lib"
|
|
697
|
+
},
|
|
698
|
+
int64: {
|
|
699
|
+
encode: "__SCAFFOLD_RUST_INT64_ENCODE__",
|
|
700
|
+
decode: "__SCAFFOLD_RUST_INT64_DECODE__",
|
|
701
|
+
imports: ["use serde_with::DisplayFromStr;"],
|
|
702
|
+
dep: {
|
|
703
|
+
name: "serde_with",
|
|
704
|
+
version: "^3"
|
|
705
|
+
},
|
|
706
|
+
mode: "lib"
|
|
707
|
+
},
|
|
708
|
+
decimal: {
|
|
709
|
+
encode: "__SCAFFOLD_RUST_DECIMAL_ENCODE__",
|
|
710
|
+
decode: "__SCAFFOLD_RUST_DECIMAL_DECODE__",
|
|
711
|
+
imports: ["use rust_decimal::Decimal;"],
|
|
712
|
+
dep: {
|
|
713
|
+
name: "rust_decimal",
|
|
714
|
+
version: "^1"
|
|
715
|
+
},
|
|
716
|
+
mode: "lib"
|
|
717
|
+
},
|
|
718
|
+
byte: {
|
|
719
|
+
encode: "__SCAFFOLD_RUST_BYTE_ENCODE__",
|
|
720
|
+
decode: "__SCAFFOLD_RUST_BYTE_DECODE__",
|
|
721
|
+
imports: ["use serde_with::base64::Base64;"],
|
|
722
|
+
dep: {
|
|
723
|
+
name: "serde_with",
|
|
724
|
+
version: "^3"
|
|
725
|
+
},
|
|
726
|
+
mode: "lib"
|
|
727
|
+
},
|
|
728
|
+
uuid: {
|
|
729
|
+
encode: "__SCAFFOLD_RUST_UUID_ENCODE__",
|
|
730
|
+
decode: "__SCAFFOLD_RUST_UUID_DECODE__",
|
|
731
|
+
imports: ["use uuid::Uuid;"],
|
|
732
|
+
dep: {
|
|
733
|
+
name: "uuid",
|
|
734
|
+
version: "^1"
|
|
735
|
+
},
|
|
736
|
+
mode: "lib"
|
|
737
|
+
},
|
|
738
|
+
"number-special": {
|
|
739
|
+
encode: "__SCAFFOLD_RUST_NUMSPECIAL_ENCODE__",
|
|
740
|
+
decode: "__SCAFFOLD_RUST_NUMSPECIAL_DECODE__",
|
|
741
|
+
mode: "native"
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
go: {
|
|
745
|
+
"date-time": {
|
|
746
|
+
encode: "__SCAFFOLD_GO_DATETIME_ENCODE__",
|
|
747
|
+
decode: "__SCAFFOLD_GO_DATETIME_DECODE__",
|
|
748
|
+
imports: ["\"time\""],
|
|
749
|
+
mode: "native"
|
|
750
|
+
},
|
|
751
|
+
int64: {
|
|
752
|
+
encode: "__SCAFFOLD_GO_INT64_ENCODE__",
|
|
753
|
+
decode: "__SCAFFOLD_GO_INT64_DECODE__",
|
|
754
|
+
imports: ["\"strconv\""],
|
|
755
|
+
mode: "native"
|
|
756
|
+
},
|
|
757
|
+
decimal: {
|
|
758
|
+
encode: "__SCAFFOLD_GO_DECIMAL_ENCODE__",
|
|
759
|
+
decode: "__SCAFFOLD_GO_DECIMAL_DECODE__",
|
|
760
|
+
imports: ["\"github.com/shopspring/decimal\""],
|
|
761
|
+
dep: {
|
|
762
|
+
name: "github.com/shopspring/decimal",
|
|
763
|
+
version: "v1"
|
|
764
|
+
},
|
|
765
|
+
mode: "lib"
|
|
766
|
+
},
|
|
767
|
+
byte: {
|
|
768
|
+
encode: "__SCAFFOLD_GO_BYTE_ENCODE__",
|
|
769
|
+
decode: "__SCAFFOLD_GO_BYTE_DECODE__",
|
|
770
|
+
imports: ["\"encoding/base64\""],
|
|
771
|
+
mode: "native"
|
|
772
|
+
},
|
|
773
|
+
uuid: {
|
|
774
|
+
encode: "__SCAFFOLD_GO_UUID_ENCODE__",
|
|
775
|
+
decode: "__SCAFFOLD_GO_UUID_DECODE__",
|
|
776
|
+
imports: ["\"github.com/google/uuid\""],
|
|
777
|
+
dep: {
|
|
778
|
+
name: "github.com/google/uuid",
|
|
779
|
+
version: "v1"
|
|
780
|
+
},
|
|
781
|
+
mode: "lib"
|
|
782
|
+
},
|
|
783
|
+
"number-special": {
|
|
784
|
+
encode: "__SCAFFOLD_GO_NUMSPECIAL_ENCODE__",
|
|
785
|
+
decode: "__SCAFFOLD_GO_NUMSPECIAL_DECODE__",
|
|
786
|
+
mode: "native"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
java: {
|
|
790
|
+
"date-time": {
|
|
791
|
+
encode: "$.toString()",
|
|
792
|
+
decode: "Instant.parse($)",
|
|
793
|
+
imports: ["import java.time.Instant;"],
|
|
794
|
+
dep: {
|
|
795
|
+
name: "jackson-datatype-jsr310",
|
|
796
|
+
version: "2.x"
|
|
797
|
+
},
|
|
798
|
+
mode: "lib"
|
|
799
|
+
},
|
|
800
|
+
int64: {
|
|
801
|
+
encode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
802
|
+
decode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
803
|
+
imports: ["import com.fasterxml.jackson.annotation.JsonFormat;"],
|
|
804
|
+
mode: "native"
|
|
805
|
+
},
|
|
806
|
+
decimal: {
|
|
807
|
+
encode: "@JsonSerialize(using = ToStringSerializer.class)",
|
|
808
|
+
decode: "new BigDecimal($)",
|
|
809
|
+
imports: [
|
|
810
|
+
"import java.math.BigDecimal;",
|
|
811
|
+
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
812
|
+
"import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;"
|
|
813
|
+
],
|
|
814
|
+
mode: "native"
|
|
815
|
+
},
|
|
816
|
+
byte: {
|
|
817
|
+
encode: "$",
|
|
818
|
+
decode: "$",
|
|
819
|
+
mode: "native"
|
|
820
|
+
},
|
|
821
|
+
uuid: {
|
|
822
|
+
encode: "$.toString()",
|
|
823
|
+
decode: "UUID.fromString($)",
|
|
824
|
+
imports: ["import java.util.UUID;"],
|
|
825
|
+
mode: "native"
|
|
826
|
+
},
|
|
827
|
+
"number-special": {
|
|
828
|
+
encode: "@JsonSerialize(using = NumberSpecialSerializer.class)",
|
|
829
|
+
decode: "@JsonDeserialize(using = NumberSpecialDeserializer.class)",
|
|
830
|
+
imports: ["import com.fasterxml.jackson.databind.annotation.JsonSerialize;", "import com.fasterxml.jackson.databind.annotation.JsonDeserialize;"],
|
|
831
|
+
mode: "native"
|
|
832
|
+
}
|
|
833
|
+
}
|
|
832
834
|
});
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
}
|
|
836
|
-
function
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}
|
|
863
|
-
export {
|
|
864
|
-
j as CANONICAL_LOGICAL_TYPE_IDS,
|
|
865
|
-
C as CodecRegistryError,
|
|
866
|
-
D as ENVELOPE_KEY,
|
|
867
|
-
re as LOGICAL_TYPE_VERSION,
|
|
868
|
-
g as TEMPLATE_CELLS,
|
|
869
|
-
P as X_APIGEN_CODEC,
|
|
870
|
-
ee as X_APIGEN_CTOR,
|
|
871
|
-
R as X_APIGEN_LOGICAL,
|
|
872
|
-
te as X_APIGEN_TOJSON,
|
|
873
|
-
_e as assertNoEmptyCells,
|
|
874
|
-
se as buildTranscoder,
|
|
875
|
-
F as byteCodec,
|
|
876
|
-
ue as cellsFor,
|
|
877
|
-
oe as codecIdOf,
|
|
878
|
-
x as createRegistry,
|
|
879
|
-
v as dateTimeCodec,
|
|
880
|
-
T as decimalCodec,
|
|
881
|
-
pe as depsForLogicalTypes,
|
|
882
|
-
I as int64Codec,
|
|
883
|
-
ne as logicalKindOf,
|
|
884
|
-
de as makeDecimal,
|
|
885
|
-
U as numberSpecialCodec,
|
|
886
|
-
ae as registerWellKnown,
|
|
887
|
-
fe as renderExampleNote,
|
|
888
|
-
y as synthesizeExample,
|
|
889
|
-
ce as tryRegister,
|
|
890
|
-
me as tsDepMap,
|
|
891
|
-
L as uuidCodec,
|
|
892
|
-
ie as validateSchemaRefs
|
|
893
|
-
};
|
|
835
|
+
function $(e) {
|
|
836
|
+
return Q[e];
|
|
837
|
+
}
|
|
838
|
+
function ee(e, t) {
|
|
839
|
+
let n = Q[t], r = [];
|
|
840
|
+
for (let t of e) {
|
|
841
|
+
let e = n[t];
|
|
842
|
+
e?.dep && r.push({
|
|
843
|
+
id: t,
|
|
844
|
+
dep: e.dep
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
return r;
|
|
848
|
+
}
|
|
849
|
+
function te() {
|
|
850
|
+
let e = Q.typescript, t = {};
|
|
851
|
+
for (let n of Z) {
|
|
852
|
+
let r = e[n].dep;
|
|
853
|
+
r && (t[n] = r);
|
|
854
|
+
}
|
|
855
|
+
return Object.freeze(t);
|
|
856
|
+
}
|
|
857
|
+
function ne(e, t) {
|
|
858
|
+
let n = t ?? Q[e], r = [];
|
|
859
|
+
for (let e of Z) n[e] || r.push(e);
|
|
860
|
+
if (r.length > 0) throw Error(`[hints] assertNoEmptyCells: language "${e}" is missing cells for: ${r.join(", ")}`);
|
|
861
|
+
}
|
|
862
|
+
//#endregion
|
|
863
|
+
export { Z as CANONICAL_LOGICAL_TYPE_IDS, t as CodecRegistryError, e as ENVELOPE_KEY, s as LOGICAL_TYPE_VERSION, Q as TEMPLATE_CELLS, i as X_APIGEN_CODEC, a as X_APIGEN_CTOR, r as X_APIGEN_LOGICAL, o as X_APIGEN_TOJSON, ne as assertNoEmptyCells, T as buildTranscoder, M as byteCodec, $ as cellsFor, u as codecIdOf, n as createRegistry, O as dateTimeCodec, j as decimalCodec, ee as depsForLogicalTypes, k as int64Codec, l as logicalKindOf, A as makeDecimal, z as numberSpecialCodec, V as registerWellKnown, X as renderExampleNote, Y as synthesizeExample, E as tryRegister, te as tsDepMap, P as uuidCodec, w as validateSchemaRefs };
|