@adhd/apigen-base-logical 0.1.0 → 0.1.2
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 +49 -0
- package/README.md +36 -0
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/index.mjs +590 -310
- package/lib/contracts.d.ts +19 -0
- package/lib/example.d.ts +35 -0
- package/lib/hints.d.ts +11 -7
- package/package.json +20 -2
package/index.mjs
CHANGED
|
@@ -1,333 +1,465 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
3
|
-
constructor(
|
|
4
|
-
super(
|
|
1
|
+
const D = "$apigen";
|
|
2
|
+
class N extends Error {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
super(t), this.code = "E_DUP_CODEC", this.name = "CodecRegistryError";
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function de(e) {
|
|
8
8
|
e == null || e.wellKnown;
|
|
9
|
-
const
|
|
9
|
+
const t = /* @__PURE__ */ new Map();
|
|
10
10
|
return {
|
|
11
|
-
register(n,
|
|
12
|
-
if (
|
|
13
|
-
throw new
|
|
11
|
+
register(n, o) {
|
|
12
|
+
if (t.has(n.id) && !(o != null && o.override))
|
|
13
|
+
throw new N(
|
|
14
14
|
`E_DUP_CODEC: a codec is already registered for id "${n.id}"`
|
|
15
15
|
);
|
|
16
|
-
|
|
16
|
+
t.set(n.id, n);
|
|
17
17
|
},
|
|
18
18
|
resolve(n) {
|
|
19
|
-
for (const
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
19
|
+
for (const o of t.values())
|
|
20
|
+
if (o.matches(n))
|
|
21
|
+
return o;
|
|
22
22
|
},
|
|
23
23
|
get(n) {
|
|
24
|
-
return
|
|
24
|
+
return t.get(n);
|
|
25
25
|
},
|
|
26
26
|
ids() {
|
|
27
|
-
return [...
|
|
27
|
+
return [...t.keys()];
|
|
28
28
|
},
|
|
29
29
|
freeze() {
|
|
30
|
-
const n = new Map(
|
|
30
|
+
const n = new Map(t), o = {
|
|
31
31
|
register() {
|
|
32
|
-
throw new
|
|
32
|
+
throw new N(
|
|
33
33
|
"E_DUP_CODEC: registry is frozen and cannot accept new codecs"
|
|
34
34
|
);
|
|
35
35
|
},
|
|
36
|
-
resolve(
|
|
36
|
+
resolve(i) {
|
|
37
37
|
for (const a of n.values())
|
|
38
|
-
if (a.matches(
|
|
38
|
+
if (a.matches(i))
|
|
39
39
|
return a;
|
|
40
40
|
},
|
|
41
|
-
get(
|
|
42
|
-
return n.get(
|
|
41
|
+
get(i) {
|
|
42
|
+
return n.get(i);
|
|
43
43
|
},
|
|
44
44
|
ids() {
|
|
45
45
|
return [...n.keys()];
|
|
46
46
|
},
|
|
47
47
|
freeze() {
|
|
48
|
-
return
|
|
48
|
+
return o;
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return o;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const z = "x-apigen-logical", J = "x-apigen-codec", ae = "x-apigen-ctor", fe = "x-apigen-tojson", ue = "0.1.0", V = [
|
|
56
56
|
"scalar",
|
|
57
57
|
"nominal",
|
|
58
58
|
"union",
|
|
59
59
|
"map",
|
|
60
60
|
"set"
|
|
61
61
|
];
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
return typeof
|
|
62
|
+
function pe(e) {
|
|
63
|
+
const t = e[z];
|
|
64
|
+
return typeof t == "string" && V.includes(t) ? t : void 0;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
return typeof
|
|
66
|
+
function me(e) {
|
|
67
|
+
const t = e[J];
|
|
68
|
+
return typeof t == "string" ? t : void 0;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function v(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
registry: e,
|
|
73
|
-
resolve: (
|
|
73
|
+
resolve: (r) => {
|
|
74
74
|
throw new Error(
|
|
75
|
-
`[apigen-logical] $ref "${
|
|
75
|
+
`[apigen-logical] $ref "${r}" cannot be resolved in run-mode without a descriptor root. Supply a resolve() in the ctx override to handle $ref.`
|
|
76
76
|
);
|
|
77
77
|
},
|
|
78
78
|
seen: /* @__PURE__ */ new WeakSet(),
|
|
79
79
|
path: "",
|
|
80
80
|
mode: "strict",
|
|
81
|
-
...
|
|
81
|
+
...t
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
const n =
|
|
84
|
+
function l(e, t, r) {
|
|
85
|
+
const n = r.registry.resolve(t);
|
|
86
86
|
if (n)
|
|
87
|
-
return n.encode(e,
|
|
88
|
-
const
|
|
89
|
-
if (typeof
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
const
|
|
94
|
-
if (Array.isArray(
|
|
95
|
-
const
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
const a =
|
|
87
|
+
return n.encode(e, t, r);
|
|
88
|
+
const o = t.$ref;
|
|
89
|
+
if (typeof o == "string") {
|
|
90
|
+
const c = r.resolve(o);
|
|
91
|
+
return l(e, c, r);
|
|
92
|
+
}
|
|
93
|
+
const i = t.oneOf;
|
|
94
|
+
if (Array.isArray(i)) {
|
|
95
|
+
const c = L(e, i, t, r);
|
|
96
|
+
return l(e, c, r);
|
|
97
|
+
}
|
|
98
|
+
const a = t.type;
|
|
99
99
|
if (a === "array") {
|
|
100
100
|
if (!Array.isArray(e))
|
|
101
|
-
return
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
104
|
-
return e.map((
|
|
105
|
-
const
|
|
106
|
-
return Array.isArray(
|
|
107
|
-
const
|
|
108
|
-
return
|
|
101
|
+
return b(e, t, r);
|
|
102
|
+
const c = t.items;
|
|
103
|
+
if (!c)
|
|
104
|
+
return e.map((f) => _(f));
|
|
105
|
+
const u = r.path;
|
|
106
|
+
return Array.isArray(c) ? e.map((f, s) => {
|
|
107
|
+
const d = c[s];
|
|
108
|
+
return d === void 0 ? _(f) : l(f, d, { ...r, path: `${u}/${s}` });
|
|
109
109
|
}) : e.map(
|
|
110
|
-
(
|
|
110
|
+
(f, s) => l(f, c, { ...r, path: `${u}/${s}` })
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
if (a === "object") {
|
|
114
114
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
115
|
-
return
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
118
|
-
return
|
|
119
|
-
const
|
|
120
|
-
for (const [
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
...
|
|
124
|
-
path: `${
|
|
115
|
+
return b(e, t, r);
|
|
116
|
+
const c = t.properties;
|
|
117
|
+
if (!c)
|
|
118
|
+
return _(e);
|
|
119
|
+
const u = r.path, f = {};
|
|
120
|
+
for (const [s, d] of Object.entries(c)) {
|
|
121
|
+
const p = e[s];
|
|
122
|
+
p !== void 0 && (f[s] = l(p, d, {
|
|
123
|
+
...r,
|
|
124
|
+
path: `${u}/${s}`
|
|
125
125
|
}));
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return f;
|
|
128
128
|
}
|
|
129
|
-
return a == null ?
|
|
129
|
+
return a == null ? b(e, t, r) : _(e);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const n =
|
|
131
|
+
function y(e, t, r) {
|
|
132
|
+
const n = r.registry.resolve(t);
|
|
133
133
|
if (n)
|
|
134
|
-
return n.decode(e,
|
|
135
|
-
const
|
|
136
|
-
if (typeof
|
|
137
|
-
const
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
const
|
|
141
|
-
if (Array.isArray(
|
|
142
|
-
const
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
const a =
|
|
134
|
+
return n.decode(e, t, r);
|
|
135
|
+
const o = t.$ref;
|
|
136
|
+
if (typeof o == "string") {
|
|
137
|
+
const c = r.resolve(o);
|
|
138
|
+
return y(e, c, r);
|
|
139
|
+
}
|
|
140
|
+
const i = t.oneOf;
|
|
141
|
+
if (Array.isArray(i)) {
|
|
142
|
+
const c = L(e, i, t, r);
|
|
143
|
+
return y(e, c, r);
|
|
144
|
+
}
|
|
145
|
+
const a = t.type;
|
|
146
146
|
if (a === "array") {
|
|
147
147
|
if (!Array.isArray(e))
|
|
148
148
|
return e;
|
|
149
|
-
const
|
|
150
|
-
if (!
|
|
149
|
+
const c = t.items;
|
|
150
|
+
if (!c)
|
|
151
151
|
return e;
|
|
152
|
-
const
|
|
153
|
-
return Array.isArray(
|
|
154
|
-
const
|
|
155
|
-
return
|
|
152
|
+
const u = r.path;
|
|
153
|
+
return Array.isArray(c) ? e.map((f, s) => {
|
|
154
|
+
const d = c[s];
|
|
155
|
+
return d === void 0 ? f : y(f, d, { ...r, path: `${u}/${s}` });
|
|
156
156
|
}) : e.map(
|
|
157
|
-
(
|
|
157
|
+
(f, s) => y(f, c, { ...r, path: `${u}/${s}` })
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
if (a === "object") {
|
|
161
161
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
162
162
|
return e;
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
163
|
+
const c = t.properties;
|
|
164
|
+
if (!c)
|
|
165
165
|
return e;
|
|
166
|
-
const
|
|
167
|
-
for (const [
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
...
|
|
171
|
-
path: `${
|
|
166
|
+
const u = r.path, f = {};
|
|
167
|
+
for (const [s, d] of Object.entries(c)) {
|
|
168
|
+
const p = e[s];
|
|
169
|
+
p !== void 0 && (f[s] = y(p, d, {
|
|
170
|
+
...r,
|
|
171
|
+
path: `${u}/${s}`
|
|
172
172
|
}));
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
for (const [s, d] of Object.entries(e))
|
|
175
|
+
!(s in c) && d !== void 0 && (f[s] = d);
|
|
176
|
+
return f;
|
|
177
|
+
}
|
|
178
|
+
return a == null ? S(e, r) : e;
|
|
179
|
+
}
|
|
180
|
+
function L(e, t, r, n) {
|
|
181
|
+
var u;
|
|
182
|
+
const o = r.discriminator;
|
|
183
|
+
if (o != null && o.propertyName) {
|
|
184
|
+
const f = o.propertyName, s = e !== null && typeof e == "object" ? e[f] : void 0;
|
|
185
|
+
if (typeof s == "string") {
|
|
186
|
+
if (o.mapping) {
|
|
187
|
+
const d = o.mapping[s];
|
|
188
|
+
if (d) {
|
|
189
|
+
const p = t.find((m) => m.$ref === d);
|
|
190
|
+
if (p)
|
|
191
|
+
return p;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
for (const d of t) {
|
|
195
|
+
const m = (u = O(d, n).properties) == null ? void 0 : u[f];
|
|
196
|
+
if (!m)
|
|
197
|
+
continue;
|
|
198
|
+
const g = m.enum;
|
|
199
|
+
if (m.const === s || Array.isArray(g) && g.includes(s))
|
|
200
|
+
return d;
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
|
-
|
|
204
|
+
const i = Y(e, t, n);
|
|
205
|
+
if (i)
|
|
206
|
+
return i;
|
|
207
|
+
let a, c = -1;
|
|
208
|
+
for (const f of t) {
|
|
209
|
+
const s = O(f, n), d = U(e, s, n);
|
|
210
|
+
d !== null && d > c && (c = d, a = f);
|
|
211
|
+
}
|
|
212
|
+
return a !== void 0 ? a : t[0] ?? {};
|
|
192
213
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
function O(e, t) {
|
|
215
|
+
const r = e.$ref;
|
|
216
|
+
return typeof r == "string" ? t.resolve(r) : e;
|
|
217
|
+
}
|
|
218
|
+
function I(e) {
|
|
219
|
+
if ("const" in e)
|
|
220
|
+
return e.const;
|
|
221
|
+
const t = e.enum;
|
|
222
|
+
if (Array.isArray(t) && t.length === 1)
|
|
223
|
+
return t[0];
|
|
224
|
+
}
|
|
225
|
+
function Y(e, t, r) {
|
|
226
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
227
|
+
return;
|
|
228
|
+
const n = e, o = t.map((a) => O(a, r)), i = /* @__PURE__ */ new Set();
|
|
229
|
+
for (const a of o) {
|
|
230
|
+
const c = a.properties;
|
|
231
|
+
if (c)
|
|
232
|
+
for (const [u, f] of Object.entries(c))
|
|
233
|
+
I(f) !== void 0 && i.add(u);
|
|
234
|
+
}
|
|
235
|
+
for (const a of i) {
|
|
236
|
+
const c = o.map((p) => {
|
|
237
|
+
const m = p.properties, g = m == null ? void 0 : m[a];
|
|
238
|
+
return g ? I(g) : void 0;
|
|
239
|
+
}), u = c.filter((p) => p !== void 0), f = new Set(u);
|
|
240
|
+
if (u.length < 2 || f.size !== u.length)
|
|
241
|
+
continue;
|
|
242
|
+
const s = n[a];
|
|
243
|
+
if (s === void 0)
|
|
244
|
+
continue;
|
|
245
|
+
const d = c.findIndex((p) => p === s);
|
|
246
|
+
if (d !== -1)
|
|
247
|
+
return t[d];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function W(e) {
|
|
251
|
+
if (e === null)
|
|
252
|
+
return "null";
|
|
253
|
+
if (Array.isArray(e))
|
|
254
|
+
return "array";
|
|
255
|
+
const t = typeof e;
|
|
256
|
+
return t === "number" ? Number.isInteger(e) ? "integer" : "number" : t;
|
|
257
|
+
}
|
|
258
|
+
function U(e, t, r) {
|
|
259
|
+
const n = t.oneOf;
|
|
260
|
+
if (Array.isArray(n)) {
|
|
261
|
+
let s = null;
|
|
262
|
+
for (const d of n) {
|
|
263
|
+
const p = U(e, O(d, r), r);
|
|
264
|
+
p !== null && (s === null || p > s) && (s = p);
|
|
265
|
+
}
|
|
266
|
+
return s;
|
|
267
|
+
}
|
|
268
|
+
const o = t.type, i = W(e);
|
|
269
|
+
if (typeof o == "string") {
|
|
270
|
+
if (!(o === i || o === "number" && i === "integer"))
|
|
271
|
+
return null;
|
|
272
|
+
} else if (Array.isArray(o) && !o.some(
|
|
273
|
+
(d) => d === i || d === "number" && i === "integer"
|
|
274
|
+
))
|
|
275
|
+
return null;
|
|
276
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
277
|
+
return typeof o == "string" ? 1 : 0;
|
|
278
|
+
const a = e, c = t.required;
|
|
279
|
+
let u = 0;
|
|
280
|
+
if (Array.isArray(c)) {
|
|
281
|
+
for (const s of c)
|
|
282
|
+
if (typeof s == "string") {
|
|
283
|
+
if (a[s] === void 0)
|
|
284
|
+
return null;
|
|
285
|
+
u += 2;
|
|
201
286
|
}
|
|
202
287
|
}
|
|
203
|
-
|
|
288
|
+
const f = t.properties;
|
|
289
|
+
if (f) {
|
|
290
|
+
for (const s of Object.keys(f))
|
|
291
|
+
a[s] !== void 0 && (u += 1);
|
|
292
|
+
for (const s of Object.keys(a))
|
|
293
|
+
f[s] === void 0 && (u -= 1);
|
|
294
|
+
}
|
|
295
|
+
return u;
|
|
296
|
+
}
|
|
297
|
+
function b(e, t, r) {
|
|
298
|
+
var n;
|
|
299
|
+
for (const o of r.registry.ids()) {
|
|
300
|
+
const i = r.registry.get(o);
|
|
301
|
+
if ((n = i == null ? void 0 : i.ownsValue) != null && n.call(i, e))
|
|
302
|
+
return {
|
|
303
|
+
[D]: o,
|
|
304
|
+
v: i.encode(e, i.schema, r)
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
if (Array.isArray(e))
|
|
308
|
+
return e.map((o) => b(o, {}, r));
|
|
309
|
+
if (j(e)) {
|
|
310
|
+
const o = {};
|
|
311
|
+
for (const [i, a] of Object.entries(e))
|
|
312
|
+
a !== void 0 && (o[i] = b(a, {}, r));
|
|
313
|
+
return o;
|
|
314
|
+
}
|
|
315
|
+
return _(e);
|
|
204
316
|
}
|
|
205
|
-
function
|
|
206
|
-
if (e
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
317
|
+
function j(e) {
|
|
318
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
319
|
+
return !1;
|
|
320
|
+
const t = Object.getPrototypeOf(e);
|
|
321
|
+
return t === Object.prototype || t === null;
|
|
322
|
+
}
|
|
323
|
+
function S(e, t) {
|
|
324
|
+
if (e !== null && typeof e == "object" && !Array.isArray(e) && D in e) {
|
|
325
|
+
const r = e, n = r[D], o = t.registry.get(n);
|
|
326
|
+
if (o)
|
|
327
|
+
return o.decode(r.v, o.schema, t);
|
|
328
|
+
}
|
|
329
|
+
if (Array.isArray(e))
|
|
330
|
+
return e.map((r) => S(r, t));
|
|
331
|
+
if (j(e)) {
|
|
332
|
+
const r = {};
|
|
333
|
+
for (const [n, o] of Object.entries(e))
|
|
334
|
+
r[n] = S(o, t);
|
|
335
|
+
return r;
|
|
210
336
|
}
|
|
211
337
|
return e;
|
|
212
338
|
}
|
|
213
|
-
function
|
|
339
|
+
function _(e) {
|
|
214
340
|
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
215
341
|
return e;
|
|
216
342
|
if (Array.isArray(e))
|
|
217
|
-
return e.map(
|
|
343
|
+
return e.map(_);
|
|
218
344
|
if (typeof e == "object") {
|
|
219
|
-
const
|
|
220
|
-
for (const [
|
|
221
|
-
n !== void 0 && (
|
|
222
|
-
return
|
|
345
|
+
const t = {};
|
|
346
|
+
for (const [r, n] of Object.entries(e))
|
|
347
|
+
n !== void 0 && (t[r] = _(n));
|
|
348
|
+
return t;
|
|
223
349
|
}
|
|
224
350
|
return null;
|
|
225
351
|
}
|
|
226
|
-
function
|
|
227
|
-
const
|
|
352
|
+
function _e(e, t) {
|
|
353
|
+
const r = /* @__PURE__ */ new Set(), n = [e];
|
|
228
354
|
for (; n.length > 0; ) {
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
355
|
+
const o = n.pop();
|
|
356
|
+
if (!o || r.has(o))
|
|
231
357
|
continue;
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
if (typeof
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
238
|
-
const
|
|
358
|
+
r.add(o);
|
|
359
|
+
const i = o.$ref;
|
|
360
|
+
if (typeof i == "string") {
|
|
361
|
+
if (t) {
|
|
362
|
+
const d = t[i];
|
|
363
|
+
if (!d) {
|
|
364
|
+
const p = Object.keys(t).join(", ") || "(none)";
|
|
239
365
|
throw new Error(
|
|
240
|
-
`[apigen-logical] $ref "${
|
|
366
|
+
`[apigen-logical] $ref "${i}" cannot be resolved. Available $defs: ${p}`
|
|
241
367
|
);
|
|
242
368
|
}
|
|
243
|
-
n.push(
|
|
369
|
+
n.push(d);
|
|
244
370
|
}
|
|
245
371
|
continue;
|
|
246
372
|
}
|
|
247
|
-
const a =
|
|
373
|
+
const a = o.oneOf;
|
|
248
374
|
if (Array.isArray(a))
|
|
249
|
-
for (const
|
|
250
|
-
typeof
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
for (const
|
|
254
|
-
n.push(
|
|
255
|
-
const
|
|
256
|
-
if (Array.isArray(
|
|
257
|
-
for (const
|
|
258
|
-
typeof
|
|
375
|
+
for (const d of a)
|
|
376
|
+
typeof d == "object" && d !== null && n.push(d);
|
|
377
|
+
const c = o.properties;
|
|
378
|
+
if (c)
|
|
379
|
+
for (const d of Object.values(c))
|
|
380
|
+
n.push(d);
|
|
381
|
+
const u = o.items;
|
|
382
|
+
if (Array.isArray(u))
|
|
383
|
+
for (const d of u)
|
|
384
|
+
typeof d == "object" && d !== null && n.push(d);
|
|
259
385
|
else
|
|
260
|
-
typeof
|
|
261
|
-
const
|
|
262
|
-
typeof
|
|
263
|
-
const
|
|
264
|
-
typeof
|
|
386
|
+
typeof u == "object" && u !== null && n.push(u);
|
|
387
|
+
const f = o.additionalProperties;
|
|
388
|
+
typeof f == "object" && f !== null && n.push(f);
|
|
389
|
+
const s = o.propertyNames;
|
|
390
|
+
typeof s == "object" && s !== null && n.push(s);
|
|
265
391
|
}
|
|
266
392
|
}
|
|
267
|
-
function
|
|
393
|
+
function le(e) {
|
|
268
394
|
return {
|
|
269
|
-
encode(
|
|
270
|
-
const
|
|
271
|
-
return
|
|
395
|
+
encode(t, r, n) {
|
|
396
|
+
const o = v(e, n);
|
|
397
|
+
return l(t, r, o);
|
|
272
398
|
},
|
|
273
|
-
decode(
|
|
274
|
-
const
|
|
275
|
-
return
|
|
399
|
+
decode(t, r, n) {
|
|
400
|
+
const o = v(e, n);
|
|
401
|
+
return y(t, r, o);
|
|
276
402
|
}
|
|
277
403
|
};
|
|
278
404
|
}
|
|
279
|
-
function
|
|
405
|
+
function ye(e, t, r) {
|
|
280
406
|
try {
|
|
281
|
-
const n =
|
|
407
|
+
const n = r();
|
|
282
408
|
e.register(n);
|
|
283
409
|
} catch (n) {
|
|
284
|
-
if (
|
|
410
|
+
if (q(n))
|
|
285
411
|
return;
|
|
286
412
|
throw n;
|
|
287
413
|
}
|
|
288
414
|
}
|
|
289
|
-
function
|
|
415
|
+
function q(e) {
|
|
290
416
|
return e === null || typeof e != "object" ? !1 : e.code === "MODULE_NOT_FOUND";
|
|
291
417
|
}
|
|
292
|
-
const
|
|
418
|
+
const k = {
|
|
293
419
|
id: "date-time",
|
|
294
420
|
kind: "scalar",
|
|
295
421
|
schema: { type: "string", format: "date-time" },
|
|
296
422
|
matches(e) {
|
|
297
423
|
return e.type === "string" && e.format === "date-time";
|
|
298
424
|
},
|
|
299
|
-
|
|
425
|
+
ownsValue(e) {
|
|
426
|
+
return e instanceof Date;
|
|
427
|
+
},
|
|
428
|
+
encode(e, t, r) {
|
|
300
429
|
return e.toISOString();
|
|
301
430
|
},
|
|
302
|
-
decode(e,
|
|
431
|
+
decode(e, t, r) {
|
|
303
432
|
if (typeof e != "string") {
|
|
304
|
-
if (
|
|
433
|
+
if (r.mode === "strict")
|
|
305
434
|
throw new TypeError(
|
|
306
|
-
`[date-time] expected a string on the wire at "${
|
|
435
|
+
`[date-time] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
307
436
|
);
|
|
308
437
|
return new Date(String(e));
|
|
309
438
|
}
|
|
310
|
-
if (
|
|
439
|
+
if (r.mode === "strict" && Number.isNaN(new Date(e).getTime()))
|
|
311
440
|
throw new TypeError(
|
|
312
|
-
`[date-time] invalid date-time string at "${
|
|
441
|
+
`[date-time] invalid date-time string at "${r.path}": ${JSON.stringify(e)}`
|
|
313
442
|
);
|
|
314
443
|
return new Date(e);
|
|
315
444
|
}
|
|
316
|
-
},
|
|
445
|
+
}, R = {
|
|
317
446
|
id: "int64",
|
|
318
447
|
kind: "scalar",
|
|
319
448
|
schema: { type: "string", format: "int64" },
|
|
320
449
|
matches(e) {
|
|
321
450
|
return e.type === "string" && e.format === "int64";
|
|
322
451
|
},
|
|
323
|
-
|
|
452
|
+
ownsValue(e) {
|
|
453
|
+
return typeof e == "bigint";
|
|
454
|
+
},
|
|
455
|
+
encode(e, t, r) {
|
|
324
456
|
return String(e);
|
|
325
457
|
},
|
|
326
|
-
decode(e,
|
|
458
|
+
decode(e, t, r) {
|
|
327
459
|
if (typeof e != "string") {
|
|
328
|
-
if (
|
|
460
|
+
if (r.mode === "strict")
|
|
329
461
|
throw new TypeError(
|
|
330
|
-
`[int64] expected a string on the wire at "${
|
|
462
|
+
`[int64] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
331
463
|
);
|
|
332
464
|
try {
|
|
333
465
|
return BigInt(Math.trunc(Number(e)));
|
|
@@ -335,7 +467,7 @@ const b = {
|
|
|
335
467
|
return BigInt(0);
|
|
336
468
|
}
|
|
337
469
|
}
|
|
338
|
-
if (
|
|
470
|
+
if (r.mode === "strict")
|
|
339
471
|
return BigInt(e);
|
|
340
472
|
if (/^-?\d+$/.test(e))
|
|
341
473
|
try {
|
|
@@ -346,141 +478,261 @@ const b = {
|
|
|
346
478
|
return BigInt(0);
|
|
347
479
|
}
|
|
348
480
|
};
|
|
349
|
-
function
|
|
481
|
+
function ge(e) {
|
|
350
482
|
return e;
|
|
351
483
|
}
|
|
352
|
-
const
|
|
484
|
+
const P = {
|
|
353
485
|
id: "decimal",
|
|
354
486
|
kind: "scalar",
|
|
355
487
|
schema: { type: "string", format: "decimal" },
|
|
356
488
|
matches(e) {
|
|
357
489
|
return e.type === "string" && e.format === "decimal";
|
|
358
490
|
},
|
|
359
|
-
encode(e,
|
|
491
|
+
encode(e, t, r) {
|
|
360
492
|
return e;
|
|
361
493
|
},
|
|
362
|
-
decode(e,
|
|
494
|
+
decode(e, t, r) {
|
|
363
495
|
if (typeof e != "string") {
|
|
364
|
-
if (
|
|
496
|
+
if (r.mode === "strict")
|
|
365
497
|
throw new TypeError(
|
|
366
|
-
`[decimal] expected a string on the wire at "${
|
|
498
|
+
`[decimal] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
367
499
|
);
|
|
368
500
|
return String(e);
|
|
369
501
|
}
|
|
370
|
-
if (
|
|
502
|
+
if (r.mode === "strict" && !/^-?\d+(\.\d+)?$/.test(e))
|
|
371
503
|
throw new TypeError(
|
|
372
|
-
`[decimal] wire value "${e}" at "${
|
|
504
|
+
`[decimal] wire value "${e}" at "${r.path}" is not a valid decimal string`
|
|
373
505
|
);
|
|
374
506
|
return e;
|
|
375
507
|
}
|
|
376
|
-
},
|
|
508
|
+
}, B = {
|
|
377
509
|
id: "byte",
|
|
378
510
|
kind: "scalar",
|
|
379
511
|
schema: { type: "string", format: "byte" },
|
|
380
512
|
matches(e) {
|
|
381
513
|
return e.type === "string" && e.format === "byte";
|
|
382
514
|
},
|
|
383
|
-
|
|
515
|
+
ownsValue(e) {
|
|
516
|
+
return e instanceof Uint8Array;
|
|
517
|
+
},
|
|
518
|
+
encode(e, t, r) {
|
|
384
519
|
return Buffer.from(e).toString("base64");
|
|
385
520
|
},
|
|
386
|
-
decode(e,
|
|
521
|
+
decode(e, t, r) {
|
|
387
522
|
if (typeof e != "string") {
|
|
388
|
-
if (
|
|
523
|
+
if (r.mode === "strict")
|
|
389
524
|
throw new TypeError(
|
|
390
|
-
`[byte] expected a base64 string on the wire at "${
|
|
525
|
+
`[byte] expected a base64 string on the wire at "${r.path}", got ${typeof e}`
|
|
391
526
|
);
|
|
392
527
|
return new Uint8Array(0);
|
|
393
528
|
}
|
|
394
|
-
if (
|
|
529
|
+
if (r.mode === "strict" && !/^[A-Za-z0-9+/]*={0,2}$/.test(e))
|
|
395
530
|
throw new TypeError(
|
|
396
|
-
`[byte] wire value at "${
|
|
531
|
+
`[byte] wire value at "${r.path}" is not standard base64 (format:byte): "${e}"`
|
|
397
532
|
);
|
|
398
533
|
return new Uint8Array(Buffer.from(e, "base64"));
|
|
399
534
|
}
|
|
400
|
-
},
|
|
535
|
+
}, K = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, w = {
|
|
401
536
|
id: "uuid",
|
|
402
537
|
kind: "scalar",
|
|
403
538
|
schema: { type: "string", format: "uuid" },
|
|
404
539
|
matches(e) {
|
|
405
540
|
return e.type === "string" && e.format === "uuid";
|
|
406
541
|
},
|
|
407
|
-
encode(e,
|
|
542
|
+
encode(e, t, r) {
|
|
408
543
|
return e.toLowerCase();
|
|
409
544
|
},
|
|
410
|
-
decode(e,
|
|
545
|
+
decode(e, t, r) {
|
|
411
546
|
if (typeof e != "string") {
|
|
412
|
-
if (
|
|
547
|
+
if (r.mode === "strict")
|
|
413
548
|
throw new TypeError(
|
|
414
|
-
`[uuid] expected a string on the wire at "${
|
|
549
|
+
`[uuid] expected a string on the wire at "${r.path}", got ${typeof e}`
|
|
415
550
|
);
|
|
416
551
|
return String(e).toLowerCase();
|
|
417
552
|
}
|
|
418
|
-
if (
|
|
553
|
+
if (r.mode === "strict" && !K.test(e))
|
|
419
554
|
throw new TypeError(
|
|
420
|
-
`[uuid] wire value "${e}" at "${
|
|
555
|
+
`[uuid] wire value "${e}" at "${r.path}" is not a lowercase-hyphenated RFC 4122 UUID`
|
|
421
556
|
);
|
|
422
557
|
return e;
|
|
423
558
|
}
|
|
424
|
-
},
|
|
425
|
-
|
|
559
|
+
}, h = "NaN", C = "Infinity", $ = "-Infinity", X = /* @__PURE__ */ new Set([
|
|
560
|
+
h,
|
|
426
561
|
C,
|
|
427
|
-
|
|
428
|
-
]),
|
|
562
|
+
$
|
|
563
|
+
]), M = {
|
|
429
564
|
id: "number-special",
|
|
430
565
|
kind: "scalar",
|
|
431
566
|
schema: { type: "number" },
|
|
432
567
|
matches(e) {
|
|
433
568
|
return e.type === "number" && e.format === void 0;
|
|
434
569
|
},
|
|
435
|
-
|
|
436
|
-
return
|
|
570
|
+
ownsValue(e) {
|
|
571
|
+
return typeof e == "number" && !Number.isFinite(e);
|
|
572
|
+
},
|
|
573
|
+
encode(e, t, r) {
|
|
574
|
+
return Number.isNaN(e) ? h : e === 1 / 0 ? C : e === -1 / 0 ? $ : e;
|
|
437
575
|
},
|
|
438
|
-
decode(e,
|
|
576
|
+
decode(e, t, r) {
|
|
439
577
|
if (typeof e == "number")
|
|
440
578
|
return e;
|
|
441
579
|
if (typeof e == "string") {
|
|
442
|
-
if (e ===
|
|
580
|
+
if (e === h)
|
|
443
581
|
return NaN;
|
|
444
582
|
if (e === C)
|
|
445
583
|
return 1 / 0;
|
|
446
|
-
if (e ===
|
|
584
|
+
if (e === $)
|
|
447
585
|
return -1 / 0;
|
|
448
586
|
const n = Number(e);
|
|
449
587
|
if (!Number.isNaN(n))
|
|
450
588
|
return n;
|
|
451
589
|
}
|
|
452
|
-
if (
|
|
590
|
+
if (r.mode === "strict")
|
|
453
591
|
throw new TypeError(
|
|
454
|
-
`[number-special] unrecognized wire value at "${
|
|
592
|
+
`[number-special] unrecognized wire value at "${r.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...X].join(", ")}.`
|
|
455
593
|
);
|
|
456
594
|
return NaN;
|
|
457
595
|
}
|
|
458
|
-
},
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
596
|
+
}, Z = [
|
|
597
|
+
k,
|
|
598
|
+
R,
|
|
599
|
+
P,
|
|
600
|
+
B,
|
|
601
|
+
w,
|
|
602
|
+
M
|
|
465
603
|
];
|
|
466
|
-
function
|
|
467
|
-
for (const
|
|
468
|
-
e.register(
|
|
604
|
+
function be(e, t = {}) {
|
|
605
|
+
for (const r of Z)
|
|
606
|
+
e.register(r, { override: t.override ?? !1 });
|
|
607
|
+
}
|
|
608
|
+
const H = 12;
|
|
609
|
+
function Q(e, t) {
|
|
610
|
+
const r = /^#\/(definitions|\$defs)\/(.+)$/.exec(e);
|
|
611
|
+
if (!r)
|
|
612
|
+
return;
|
|
613
|
+
const [, n, o] = r, i = n === "$defs" ? t.$defs : t.definitions;
|
|
614
|
+
return i == null ? void 0 : i[decodeURIComponent(o)];
|
|
615
|
+
}
|
|
616
|
+
function T(e) {
|
|
617
|
+
return Array.isArray(e) && e.length > 0 ? e[0] : void 0;
|
|
618
|
+
}
|
|
619
|
+
function x(e) {
|
|
620
|
+
if (Array.isArray(e.type))
|
|
621
|
+
return e.type.find((t) => t !== "null") ?? e.type[0];
|
|
622
|
+
if (typeof e.type == "string")
|
|
623
|
+
return e.type;
|
|
624
|
+
if (e.properties)
|
|
625
|
+
return "object";
|
|
626
|
+
}
|
|
627
|
+
function ee(e) {
|
|
628
|
+
switch (e.format) {
|
|
629
|
+
case "date-time":
|
|
630
|
+
return "1970-01-01T00:00:00.000Z";
|
|
631
|
+
case "date":
|
|
632
|
+
return "1970-01-01";
|
|
633
|
+
case "time":
|
|
634
|
+
return "00:00:00Z";
|
|
635
|
+
case "uuid":
|
|
636
|
+
return "00000000-0000-0000-0000-000000000000";
|
|
637
|
+
case "email":
|
|
638
|
+
return "user@example.com";
|
|
639
|
+
case "uri":
|
|
640
|
+
case "url":
|
|
641
|
+
case "uri-reference":
|
|
642
|
+
return "https://example.com";
|
|
643
|
+
case "hostname":
|
|
644
|
+
return "example.com";
|
|
645
|
+
case "ipv4":
|
|
646
|
+
return "127.0.0.1";
|
|
647
|
+
case "ipv6":
|
|
648
|
+
return "::1";
|
|
649
|
+
case "decimal":
|
|
650
|
+
return "0";
|
|
651
|
+
case "int64":
|
|
652
|
+
return "0";
|
|
653
|
+
case "byte":
|
|
654
|
+
return "";
|
|
655
|
+
default:
|
|
656
|
+
return "<string>";
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
function F(e, t, r) {
|
|
660
|
+
const n = e.properties ?? {}, o = e.required ?? [], i = {};
|
|
661
|
+
for (const a of o) {
|
|
662
|
+
const c = n[a];
|
|
663
|
+
i[a] = c !== void 0 ? E(c, t, r + 1) : `<${a}>`;
|
|
664
|
+
}
|
|
665
|
+
return i;
|
|
666
|
+
}
|
|
667
|
+
function te(e, t, r) {
|
|
668
|
+
const n = Array.isArray(e.items) ? e.items[0] : e.items;
|
|
669
|
+
return n ? [E(n, t, r + 1)] : [];
|
|
469
670
|
}
|
|
470
|
-
|
|
471
|
-
|
|
671
|
+
function E(e, t = e ?? {}, r = 0) {
|
|
672
|
+
if (!e || r > H)
|
|
673
|
+
return null;
|
|
674
|
+
if (typeof e.$ref == "string") {
|
|
675
|
+
const i = Q(e.$ref, t);
|
|
676
|
+
return i !== void 0 ? E(i, t, r + 1) : null;
|
|
677
|
+
}
|
|
678
|
+
if (e.const !== void 0)
|
|
679
|
+
return e.const;
|
|
680
|
+
if (Array.isArray(e.enum) && e.enum.length > 0)
|
|
681
|
+
return e.enum[0];
|
|
682
|
+
if (Array.isArray(e.allOf) && e.allOf.length > 0) {
|
|
683
|
+
const i = {}, a = [];
|
|
684
|
+
for (const c of e.allOf) {
|
|
685
|
+
Object.assign(i, c.properties ?? {});
|
|
686
|
+
for (const u of c.required ?? [])
|
|
687
|
+
a.includes(u) || a.push(u);
|
|
688
|
+
}
|
|
689
|
+
return F(
|
|
690
|
+
{ ...e, properties: i, required: a },
|
|
691
|
+
t,
|
|
692
|
+
r
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
const n = T(e.oneOf) ?? T(e.anyOf);
|
|
696
|
+
if (n)
|
|
697
|
+
return E(n, t, r + 1);
|
|
698
|
+
switch (x(e)) {
|
|
699
|
+
case "object":
|
|
700
|
+
return F(e, t, r);
|
|
701
|
+
case "array":
|
|
702
|
+
return te(e, t, r);
|
|
703
|
+
case "string":
|
|
704
|
+
return ee(e);
|
|
705
|
+
case "integer":
|
|
706
|
+
case "number":
|
|
707
|
+
return 0;
|
|
708
|
+
case "boolean":
|
|
709
|
+
return !1;
|
|
710
|
+
case "null":
|
|
711
|
+
return null;
|
|
712
|
+
default:
|
|
713
|
+
return null;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function Ee(e) {
|
|
717
|
+
if (!e)
|
|
718
|
+
return;
|
|
719
|
+
const t = E(e);
|
|
720
|
+
return `Example: ${JSON.stringify(t)}`;
|
|
721
|
+
}
|
|
722
|
+
const G = [
|
|
723
|
+
k.id,
|
|
472
724
|
// 'date-time'
|
|
473
|
-
|
|
725
|
+
R.id,
|
|
474
726
|
// 'int64'
|
|
475
|
-
|
|
727
|
+
P.id,
|
|
476
728
|
// 'decimal'
|
|
477
|
-
|
|
729
|
+
B.id,
|
|
478
730
|
// 'byte'
|
|
479
|
-
|
|
731
|
+
w.id,
|
|
480
732
|
// 'uuid'
|
|
481
|
-
|
|
733
|
+
M.id
|
|
482
734
|
// 'number-special'
|
|
483
|
-
],
|
|
735
|
+
], re = {
|
|
484
736
|
"date-time": {
|
|
485
737
|
encode: "$.toISOString()",
|
|
486
738
|
decode: "new Date($)",
|
|
@@ -519,7 +771,7 @@ const T = [
|
|
|
519
771
|
decode: "wireToNum($)",
|
|
520
772
|
mode: "native"
|
|
521
773
|
}
|
|
522
|
-
},
|
|
774
|
+
}, ne = {
|
|
523
775
|
"date-time": {
|
|
524
776
|
encode: "$.isoformat()",
|
|
525
777
|
decode: "datetime.fromisoformat($)",
|
|
@@ -556,7 +808,7 @@ const T = [
|
|
|
556
808
|
decode: "wire_to_num($)",
|
|
557
809
|
mode: "native"
|
|
558
810
|
}
|
|
559
|
-
},
|
|
811
|
+
}, oe = {
|
|
560
812
|
"date-time": {
|
|
561
813
|
// chrono::DateTime<Utc> serialises as RFC3339 via serde.
|
|
562
814
|
encode: "__SCAFFOLD_RUST_DATETIME_ENCODE__",
|
|
@@ -600,7 +852,7 @@ const T = [
|
|
|
600
852
|
decode: "__SCAFFOLD_RUST_NUMSPECIAL_DECODE__",
|
|
601
853
|
mode: "native"
|
|
602
854
|
}
|
|
603
|
-
},
|
|
855
|
+
}, ie = {
|
|
604
856
|
"date-time": {
|
|
605
857
|
// time.Time serialises as RFC3339Nano via MarshalJSON.
|
|
606
858
|
encode: "__SCAFFOLD_GO_DATETIME_ENCODE__",
|
|
@@ -641,78 +893,104 @@ const T = [
|
|
|
641
893
|
decode: "__SCAFFOLD_GO_NUMSPECIAL_DECODE__",
|
|
642
894
|
mode: "native"
|
|
643
895
|
}
|
|
644
|
-
},
|
|
896
|
+
}, se = {
|
|
645
897
|
"date-time": {
|
|
646
|
-
// Instant.toString() / Instant.parse()
|
|
647
|
-
|
|
648
|
-
|
|
898
|
+
// Instant.toString() (RFC-3339/ISO-8601, UTC) / Instant.parse($) — the
|
|
899
|
+
// jackson-datatype-jsr310 module is registered on the shared ObjectMapper
|
|
900
|
+
// so java.time.Instant fields round-trip automatically, but the
|
|
901
|
+
// dispatcher-woven glue (which builds/reads JsonNode by hand rather than
|
|
902
|
+
// going through a field-annotated POJO) uses these expressions directly.
|
|
903
|
+
encode: "$.toString()",
|
|
904
|
+
decode: "Instant.parse($)",
|
|
649
905
|
imports: ["import java.time.Instant;"],
|
|
650
906
|
dep: { name: "jackson-datatype-jsr310", version: "2.x" },
|
|
651
907
|
mode: "lib"
|
|
652
908
|
},
|
|
653
909
|
int64: {
|
|
654
|
-
//
|
|
655
|
-
|
|
656
|
-
|
|
910
|
+
// Declarative, not expression-shaped: Jackson field annotation forces
|
|
911
|
+
// Long/long to serialise as a JSON string (avoids precision loss in
|
|
912
|
+
// JS/JSON-number consumers). mode:'native' — the "encode"/"decode"
|
|
913
|
+
// values below ARE the annotation text (identical on both sides; Jackson
|
|
914
|
+
// applies it symmetrically), not a `$`-substituted call expression.
|
|
915
|
+
encode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
916
|
+
decode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
657
917
|
imports: ["import com.fasterxml.jackson.annotation.JsonFormat;"],
|
|
658
918
|
mode: "native"
|
|
659
919
|
},
|
|
660
920
|
decimal: {
|
|
661
|
-
//
|
|
662
|
-
|
|
663
|
-
decode
|
|
664
|
-
|
|
921
|
+
// Encode is declarative (field annotation forces BigDecimal -> JSON
|
|
922
|
+
// string via Jackson's stdlib ToStringSerializer, so scale/precision
|
|
923
|
+
// survive the wire); decode is a plain expression since BigDecimal has
|
|
924
|
+
// no matching stdlib deserializer-by-annotation for "parse from string".
|
|
925
|
+
encode: "@JsonSerialize(using = ToStringSerializer.class)",
|
|
926
|
+
decode: "new BigDecimal($)",
|
|
927
|
+
imports: [
|
|
928
|
+
"import java.math.BigDecimal;",
|
|
929
|
+
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
930
|
+
"import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;"
|
|
931
|
+
],
|
|
665
932
|
mode: "native"
|
|
666
933
|
},
|
|
667
934
|
byte: {
|
|
668
|
-
// byte[]
|
|
669
|
-
|
|
670
|
-
|
|
935
|
+
// byte[] <-> base64 String is Jackson's built-in default codec — no
|
|
936
|
+
// annotation, no wrapping expression. The dispatcher glue passes the
|
|
937
|
+
// value through unchanged; Jackson's ObjectMapper performs the base64
|
|
938
|
+
// transcoding when the JsonNode tree is built/read.
|
|
939
|
+
encode: "$",
|
|
940
|
+
decode: "$",
|
|
671
941
|
mode: "native"
|
|
672
942
|
},
|
|
673
943
|
uuid: {
|
|
674
|
-
// UUID.toString() / UUID.fromString() — stdlib Java.
|
|
675
|
-
encode: "
|
|
676
|
-
decode: "
|
|
944
|
+
// UUID.toString() / UUID.fromString($) — stdlib Java, no Jackson module.
|
|
945
|
+
encode: "$.toString()",
|
|
946
|
+
decode: "UUID.fromString($)",
|
|
677
947
|
imports: ["import java.util.UUID;"],
|
|
678
948
|
mode: "native"
|
|
679
949
|
},
|
|
680
950
|
"number-special": {
|
|
681
|
-
//
|
|
682
|
-
|
|
683
|
-
|
|
951
|
+
// NaN/Infinity/-Infinity have no native JSON representation; mirrors the
|
|
952
|
+
// TS numToWire/wireToNum inline helpers with a small custom Jackson
|
|
953
|
+
// StdSerializer/StdDeserializer pair, generated inline by
|
|
954
|
+
// renderDispatcherJava (class names below are the fixed contract the
|
|
955
|
+
// generator emits — apigen-plugin-java-javalin/src/lib/dispatcher-template.ts).
|
|
956
|
+
encode: "@JsonSerialize(using = NumberSpecialSerializer.class)",
|
|
957
|
+
decode: "@JsonDeserialize(using = NumberSpecialDeserializer.class)",
|
|
958
|
+
imports: [
|
|
959
|
+
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
960
|
+
"import com.fasterxml.jackson.databind.annotation.JsonDeserialize;"
|
|
961
|
+
],
|
|
684
962
|
mode: "native"
|
|
685
963
|
}
|
|
686
|
-
},
|
|
687
|
-
typescript:
|
|
688
|
-
python:
|
|
689
|
-
rust:
|
|
690
|
-
go:
|
|
691
|
-
java:
|
|
964
|
+
}, A = Object.freeze({
|
|
965
|
+
typescript: re,
|
|
966
|
+
python: ne,
|
|
967
|
+
rust: oe,
|
|
968
|
+
go: ie,
|
|
969
|
+
java: se
|
|
692
970
|
});
|
|
693
|
-
function
|
|
694
|
-
return
|
|
971
|
+
function Oe(e) {
|
|
972
|
+
return A[e];
|
|
695
973
|
}
|
|
696
|
-
function
|
|
697
|
-
const
|
|
698
|
-
for (const
|
|
699
|
-
const
|
|
700
|
-
|
|
974
|
+
function Ae(e, t) {
|
|
975
|
+
const r = A[t], n = [];
|
|
976
|
+
for (const o of e) {
|
|
977
|
+
const i = r[o];
|
|
978
|
+
i != null && i.dep && n.push({ id: o, dep: i.dep });
|
|
701
979
|
}
|
|
702
980
|
return n;
|
|
703
981
|
}
|
|
704
|
-
function
|
|
705
|
-
const e =
|
|
706
|
-
for (const
|
|
707
|
-
const n = e[
|
|
708
|
-
n && (
|
|
982
|
+
function De() {
|
|
983
|
+
const e = A.typescript, t = {};
|
|
984
|
+
for (const r of G) {
|
|
985
|
+
const n = e[r].dep;
|
|
986
|
+
n && (t[r] = n);
|
|
709
987
|
}
|
|
710
|
-
return Object.freeze(
|
|
988
|
+
return Object.freeze(t);
|
|
711
989
|
}
|
|
712
|
-
function
|
|
713
|
-
const
|
|
714
|
-
for (const
|
|
715
|
-
|
|
990
|
+
function Se(e, t) {
|
|
991
|
+
const r = t ?? A[e], n = [];
|
|
992
|
+
for (const o of G)
|
|
993
|
+
r[o] || n.push(o);
|
|
716
994
|
if (n.length > 0)
|
|
717
995
|
throw new Error(
|
|
718
996
|
`[hints] assertNoEmptyCells: language "${e}" is missing cells for: ${n.join(
|
|
@@ -721,31 +999,33 @@ function ie(e, o) {
|
|
|
721
999
|
);
|
|
722
1000
|
}
|
|
723
1001
|
export {
|
|
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
|
-
|
|
1002
|
+
G as CANONICAL_LOGICAL_TYPE_IDS,
|
|
1003
|
+
N as CodecRegistryError,
|
|
1004
|
+
D as ENVELOPE_KEY,
|
|
1005
|
+
ue as LOGICAL_TYPE_VERSION,
|
|
1006
|
+
A as TEMPLATE_CELLS,
|
|
1007
|
+
J as X_APIGEN_CODEC,
|
|
1008
|
+
ae as X_APIGEN_CTOR,
|
|
1009
|
+
z as X_APIGEN_LOGICAL,
|
|
1010
|
+
fe as X_APIGEN_TOJSON,
|
|
1011
|
+
Se as assertNoEmptyCells,
|
|
1012
|
+
le as buildTranscoder,
|
|
1013
|
+
B as byteCodec,
|
|
1014
|
+
Oe as cellsFor,
|
|
1015
|
+
me as codecIdOf,
|
|
1016
|
+
de as createRegistry,
|
|
1017
|
+
k as dateTimeCodec,
|
|
1018
|
+
P as decimalCodec,
|
|
1019
|
+
Ae as depsForLogicalTypes,
|
|
1020
|
+
R as int64Codec,
|
|
1021
|
+
pe as logicalKindOf,
|
|
1022
|
+
ge as makeDecimal,
|
|
1023
|
+
M as numberSpecialCodec,
|
|
1024
|
+
be as registerWellKnown,
|
|
1025
|
+
Ee as renderExampleNote,
|
|
1026
|
+
E as synthesizeExample,
|
|
1027
|
+
ye as tryRegister,
|
|
1028
|
+
De as tsDepMap,
|
|
1029
|
+
w as uuidCodec,
|
|
1030
|
+
_e as validateSchemaRefs
|
|
751
1031
|
};
|