dsh-autotier 0.2.18 → 0.2.20
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 +12 -0
- package/README-es.md +199 -78
- package/README-hi.md +203 -80
- package/README-pt.md +201 -80
- package/README-zh.md +172 -52
- package/README.md +204 -84
- package/docs/assets/dsh-autotier-flow.svg +19 -0
- package/lib/client.js +583 -357
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/typert.host.js +1 -1
- package/lib/{wire-BxsY8BiN.js → wire-DHFKQqYR.js} +583 -357
- package/package.json +11 -11
|
@@ -53,7 +53,7 @@ const COST_MODES = [
|
|
|
53
53
|
"balanced"
|
|
54
54
|
];
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region node_modules/.pnpm/zod@4.
|
|
56
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
|
|
57
57
|
function getEnumValues(entries) {
|
|
58
58
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
59
59
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -65,14 +65,22 @@ function jsonStringifyReplacer(_, value) {
|
|
|
65
65
|
if (typeof value === "bigint") return value.toString();
|
|
66
66
|
return value;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
var Cached = class {
|
|
69
|
+
constructor(getter) {
|
|
70
|
+
this._getter = getter;
|
|
71
|
+
this._value = void 0;
|
|
72
|
+
}
|
|
73
|
+
get value() {
|
|
74
|
+
const getter = this._getter;
|
|
75
|
+
if (getter !== void 0) {
|
|
76
|
+
this._value = getter();
|
|
77
|
+
this._getter = void 0;
|
|
74
78
|
}
|
|
75
|
-
|
|
79
|
+
return this._value;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function cached(getter) {
|
|
83
|
+
return new Cached(getter);
|
|
76
84
|
}
|
|
77
85
|
function nullish(input) {
|
|
78
86
|
return input === null || input === void 0;
|
|
@@ -97,6 +105,58 @@ function assignProp(target, prop, value) {
|
|
|
97
105
|
configurable: true
|
|
98
106
|
});
|
|
99
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
110
|
+
*
|
|
111
|
+
* Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
|
|
112
|
+
*/
|
|
113
|
+
function rawShape(def) {
|
|
114
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
115
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
116
|
+
}
|
|
117
|
+
function sourceShape(schema) {
|
|
118
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
119
|
+
}
|
|
120
|
+
function deferProp(target, key, getter) {
|
|
121
|
+
Object.defineProperty(target, key, {
|
|
122
|
+
get() {
|
|
123
|
+
const value = getter();
|
|
124
|
+
assignProp(this, key, value);
|
|
125
|
+
return value;
|
|
126
|
+
},
|
|
127
|
+
enumerable: true,
|
|
128
|
+
configurable: true
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function putProp(target, key, value) {
|
|
132
|
+
if (key in target) assignProp(target, key, value);
|
|
133
|
+
else target[key] = value;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
137
|
+
*
|
|
138
|
+
* A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
|
|
139
|
+
*/
|
|
140
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
141
|
+
const raw = sourceShape(source);
|
|
142
|
+
for (const key of keys) {
|
|
143
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
144
|
+
if (!desc.enumerable) continue;
|
|
145
|
+
if (desc.get) deferProp(target, key, () => {
|
|
146
|
+
const value = source._zod.def.shape[key];
|
|
147
|
+
return wrap ? wrap(value, key) : value;
|
|
148
|
+
});
|
|
149
|
+
else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function mirrorProps(target, source) {
|
|
153
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
154
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
155
|
+
if (!desc.enumerable) continue;
|
|
156
|
+
if (desc.get) deferProp(target, key, () => source[key]);
|
|
157
|
+
else putProp(target, key, desc.value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
100
160
|
function mergeDefs(...defs) {
|
|
101
161
|
const mergedDescriptors = {};
|
|
102
162
|
for (const def of defs) {
|
|
@@ -187,39 +247,39 @@ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
|
187
247
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
188
248
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
189
249
|
}))();
|
|
250
|
+
const BIGINT_FORMAT_RANGES = {
|
|
251
|
+
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
252
|
+
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
|
|
253
|
+
};
|
|
190
254
|
function pick(schema, mask) {
|
|
191
255
|
const currDef = schema._zod.def;
|
|
192
256
|
const checks = currDef.checks;
|
|
193
257
|
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
199
|
-
if (!mask[key]) continue;
|
|
200
|
-
assignProp(newShape, key, currDef.shape[key]);
|
|
201
|
-
}
|
|
202
|
-
assignProp(this, "shape", newShape);
|
|
203
|
-
return newShape;
|
|
204
|
-
},
|
|
258
|
+
const newShape = {};
|
|
259
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
260
|
+
return clone(schema, mergeDefs(currDef, {
|
|
261
|
+
shape: newShape,
|
|
205
262
|
checks: []
|
|
206
263
|
}));
|
|
207
264
|
}
|
|
265
|
+
function maskedKeys(schema, mask) {
|
|
266
|
+
const raw = sourceShape(schema);
|
|
267
|
+
const keys = [];
|
|
268
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
269
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
270
|
+
if (mask[key]) keys.push(key);
|
|
271
|
+
}
|
|
272
|
+
return keys;
|
|
273
|
+
}
|
|
208
274
|
function omit(schema, mask) {
|
|
209
275
|
const currDef = schema._zod.def;
|
|
210
276
|
const checks = currDef.checks;
|
|
211
277
|
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (!mask[key]) continue;
|
|
218
|
-
delete newShape[key];
|
|
219
|
-
}
|
|
220
|
-
assignProp(this, "shape", newShape);
|
|
221
|
-
return newShape;
|
|
222
|
-
},
|
|
278
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
279
|
+
const newShape = {};
|
|
280
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
281
|
+
return clone(schema, mergeDefs(currDef, {
|
|
282
|
+
shape: newShape,
|
|
223
283
|
checks: []
|
|
224
284
|
}));
|
|
225
285
|
}
|
|
@@ -227,41 +287,29 @@ function extend(schema, shape) {
|
|
|
227
287
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
228
288
|
const checks = schema._zod.def.checks;
|
|
229
289
|
if (checks && checks.length > 0) {
|
|
230
|
-
const existingShape = schema
|
|
290
|
+
const existingShape = sourceShape(schema);
|
|
231
291
|
for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
232
292
|
}
|
|
233
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
} }));
|
|
293
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
294
|
+
}
|
|
295
|
+
function extended(schema, shape) {
|
|
296
|
+
const newShape = {};
|
|
297
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
298
|
+
mirrorProps(newShape, shape);
|
|
299
|
+
return newShape;
|
|
241
300
|
}
|
|
242
301
|
function safeExtend(schema, shape) {
|
|
243
302
|
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
244
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
245
|
-
const _shape = {
|
|
246
|
-
...schema._zod.def.shape,
|
|
247
|
-
...shape
|
|
248
|
-
};
|
|
249
|
-
assignProp(this, "shape", _shape);
|
|
250
|
-
return _shape;
|
|
251
|
-
} }));
|
|
303
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
252
304
|
}
|
|
253
305
|
function merge(a, b) {
|
|
254
306
|
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
255
307
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
308
|
+
const newShape = {};
|
|
309
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
310
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
256
311
|
return clone(a, mergeDefs(a._zod.def, {
|
|
257
|
-
|
|
258
|
-
const _shape = {
|
|
259
|
-
...a._zod.def.shape,
|
|
260
|
-
...b._zod.def.shape
|
|
261
|
-
};
|
|
262
|
-
assignProp(this, "shape", _shape);
|
|
263
|
-
return _shape;
|
|
264
|
-
},
|
|
312
|
+
shape: newShape,
|
|
265
313
|
get catchall() {
|
|
266
314
|
return b._zod.def.catchall;
|
|
267
315
|
},
|
|
@@ -271,47 +319,25 @@ function merge(a, b) {
|
|
|
271
319
|
function partial(Class, schema, mask, name = "partial") {
|
|
272
320
|
const checks = schema._zod.def.checks;
|
|
273
321
|
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
322
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
323
|
+
const newShape = {};
|
|
324
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
|
|
325
|
+
type: "optional",
|
|
326
|
+
innerType: value
|
|
327
|
+
})));
|
|
274
328
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
275
|
-
|
|
276
|
-
const oldShape = schema._zod.def.shape;
|
|
277
|
-
const shape = { ...oldShape };
|
|
278
|
-
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
279
|
-
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
280
|
-
if (!mask[key]) continue;
|
|
281
|
-
shape[key] = Class ? new Class({
|
|
282
|
-
type: "optional",
|
|
283
|
-
innerType: oldShape[key]
|
|
284
|
-
}) : oldShape[key];
|
|
285
|
-
}
|
|
286
|
-
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
287
|
-
type: "optional",
|
|
288
|
-
innerType: oldShape[key]
|
|
289
|
-
}) : oldShape[key];
|
|
290
|
-
assignProp(this, "shape", shape);
|
|
291
|
-
return shape;
|
|
292
|
-
},
|
|
329
|
+
shape: newShape,
|
|
293
330
|
checks: []
|
|
294
331
|
}));
|
|
295
332
|
}
|
|
296
333
|
function required(Class, schema, mask) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
type: "nonoptional",
|
|
305
|
-
innerType: oldShape[key]
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
309
|
-
type: "nonoptional",
|
|
310
|
-
innerType: oldShape[key]
|
|
311
|
-
});
|
|
312
|
-
assignProp(this, "shape", shape);
|
|
313
|
-
return shape;
|
|
314
|
-
} }));
|
|
334
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
335
|
+
const newShape = {};
|
|
336
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
|
|
337
|
+
type: "nonoptional",
|
|
338
|
+
innerType: value
|
|
339
|
+
}));
|
|
340
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
315
341
|
}
|
|
316
342
|
function aborted(x, startIndex = 0) {
|
|
317
343
|
if (x.aborted === true) return true;
|
|
@@ -334,6 +360,17 @@ function prefixIssues(path, issues) {
|
|
|
334
360
|
function unwrapMessage(message) {
|
|
335
361
|
return typeof message === "string" ? message : message?.message;
|
|
336
362
|
}
|
|
363
|
+
/** The leading size checks of `defChecks` that set an upper bound, each paired with it. */
|
|
364
|
+
function sizeCaps(defChecks) {
|
|
365
|
+
const caps = [];
|
|
366
|
+
for (const ch of defChecks ?? []) {
|
|
367
|
+
const d = ch._zod.def;
|
|
368
|
+
if (!/_(length|size)$|_equals$/.test(d.check)) break;
|
|
369
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
370
|
+
if (max >= 0) caps.push([max, ch]);
|
|
371
|
+
}
|
|
372
|
+
return caps;
|
|
373
|
+
}
|
|
337
374
|
function attachSchema(issues, start, inst) {
|
|
338
375
|
var _a;
|
|
339
376
|
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
@@ -347,11 +384,15 @@ function finalizeIssue(iss, ctx, config) {
|
|
|
347
384
|
}
|
|
348
385
|
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
349
386
|
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
387
|
+
const full = {};
|
|
388
|
+
for (const k of Object.keys(iss)) {
|
|
389
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
390
|
+
full[k] = iss[k];
|
|
391
|
+
}
|
|
392
|
+
full.path ?? (full.path = []);
|
|
393
|
+
full.message = message;
|
|
394
|
+
if (ctx?.reportInput) full.input = iss.input;
|
|
395
|
+
return full;
|
|
355
396
|
}
|
|
356
397
|
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
357
398
|
function codePointLength(str) {
|
|
@@ -421,6 +462,24 @@ function own(inst, key, value, enumerable = true) {
|
|
|
421
462
|
function hide(inst, key, value) {
|
|
422
463
|
return own(inst, key, value, false);
|
|
423
464
|
}
|
|
465
|
+
/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
|
|
466
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
467
|
+
function derived(computes, table) {
|
|
468
|
+
for (const key in computes) {
|
|
469
|
+
const compute = computes[key];
|
|
470
|
+
Object.defineProperty(table, key, {
|
|
471
|
+
configurable: true,
|
|
472
|
+
enumerable: true,
|
|
473
|
+
get() {
|
|
474
|
+
return own(this, key, compute(this));
|
|
475
|
+
},
|
|
476
|
+
set(value) {
|
|
477
|
+
own(this, key, value);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
return table;
|
|
482
|
+
}
|
|
424
483
|
function defineBound(proto, key, fn) {
|
|
425
484
|
Object.defineProperty(proto, key, {
|
|
426
485
|
configurable: true,
|
|
@@ -529,9 +588,9 @@ function constantCatch(value) {
|
|
|
529
588
|
return fn;
|
|
530
589
|
}
|
|
531
590
|
//#endregion
|
|
532
|
-
//#region node_modules/.pnpm/zod@4.
|
|
591
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
|
|
533
592
|
var _a$1;
|
|
534
|
-
const _zodDesc
|
|
593
|
+
const _zodDesc = {
|
|
535
594
|
value: void 0,
|
|
536
595
|
enumerable: false
|
|
537
596
|
};
|
|
@@ -556,6 +615,7 @@ function newError(Definition) {
|
|
|
556
615
|
}
|
|
557
616
|
return new Definition();
|
|
558
617
|
}
|
|
618
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
559
619
|
function $constructor(name, initializer, proto, params) {
|
|
560
620
|
const zodProto = {};
|
|
561
621
|
function Internals(def) {
|
|
@@ -568,14 +628,13 @@ function $constructor(name, initializer, proto, params) {
|
|
|
568
628
|
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
569
629
|
function init(inst, def) {
|
|
570
630
|
if (!inst._zod) {
|
|
571
|
-
_zodDesc
|
|
631
|
+
_zodDesc.value = new Internals(def);
|
|
572
632
|
try {
|
|
573
|
-
Object.defineProperty(inst, "_zod", _zodDesc
|
|
633
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
574
634
|
} finally {
|
|
575
|
-
_zodDesc
|
|
635
|
+
_zodDesc.value = void 0;
|
|
576
636
|
}
|
|
577
|
-
}
|
|
578
|
-
if (inst._zod.traits.has(name)) return;
|
|
637
|
+
} else if (inst._zod.traits.has(name)) return;
|
|
579
638
|
inst._zod.traits.add(name);
|
|
580
639
|
initializer(inst, def);
|
|
581
640
|
if (initialized) {
|
|
@@ -636,7 +695,7 @@ function config(newConfig) {
|
|
|
636
695
|
return globalConfig;
|
|
637
696
|
}
|
|
638
697
|
//#endregion
|
|
639
|
-
//#region node_modules/.pnpm/zod@4.
|
|
698
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js
|
|
640
699
|
function _getMessage() {
|
|
641
700
|
const internals = this._zod;
|
|
642
701
|
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
@@ -651,10 +710,6 @@ const _messageDesc = {
|
|
|
651
710
|
enumerable: true,
|
|
652
711
|
configurable: true
|
|
653
712
|
};
|
|
654
|
-
const _zodDesc = {
|
|
655
|
-
value: void 0,
|
|
656
|
-
enumerable: false
|
|
657
|
-
};
|
|
658
713
|
const _issuesDesc = {
|
|
659
714
|
value: void 0,
|
|
660
715
|
enumerable: false
|
|
@@ -662,11 +717,8 @@ const _issuesDesc = {
|
|
|
662
717
|
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
663
718
|
const initializer$1 = (inst, def) => {
|
|
664
719
|
inst.name = "$ZodError";
|
|
665
|
-
_zodDesc.value = inst._zod;
|
|
666
|
-
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
667
720
|
_issuesDesc.value = def;
|
|
668
721
|
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
669
|
-
_zodDesc.value = void 0;
|
|
670
722
|
_issuesDesc.value = void 0;
|
|
671
723
|
Object.defineProperty(inst, "message", _messageDesc);
|
|
672
724
|
const proto = Object.getPrototypeOf(inst);
|
|
@@ -694,8 +746,7 @@ const initializer$1 = (inst, def) => {
|
|
|
694
746
|
});
|
|
695
747
|
}
|
|
696
748
|
};
|
|
697
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
698
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
749
|
+
const $ZodError = /* @__PURE__ */ $constructor("$ZodError", initializer$1);
|
|
699
750
|
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
700
751
|
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
701
752
|
* "__proto__" would hit the setter instead of creating a key. */
|
|
@@ -759,7 +810,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
759
810
|
return fieldErrors;
|
|
760
811
|
}
|
|
761
812
|
//#endregion
|
|
762
|
-
//#region node_modules/.pnpm/zod@4.
|
|
813
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.js
|
|
763
814
|
function finalizeParams(callee, params) {
|
|
764
815
|
return {
|
|
765
816
|
callee: params?.callee ?? callee,
|
|
@@ -816,15 +867,30 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
816
867
|
issues: []
|
|
817
868
|
}, ctx);
|
|
818
869
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
819
|
-
return result.issues.length ? {
|
|
820
|
-
success: false,
|
|
821
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
822
|
-
} : {
|
|
870
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
823
871
|
success: true,
|
|
824
872
|
data: result.value
|
|
825
873
|
};
|
|
826
874
|
};
|
|
827
|
-
|
|
875
|
+
function failure(Err, issues, ctx) {
|
|
876
|
+
let error;
|
|
877
|
+
return {
|
|
878
|
+
success: false,
|
|
879
|
+
get error() {
|
|
880
|
+
if (!error) {
|
|
881
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
882
|
+
issues = void 0;
|
|
883
|
+
ctx = void 0;
|
|
884
|
+
}
|
|
885
|
+
return error;
|
|
886
|
+
},
|
|
887
|
+
set error(e) {
|
|
888
|
+
error = e;
|
|
889
|
+
issues = void 0;
|
|
890
|
+
ctx = void 0;
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
}
|
|
828
894
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
829
895
|
const ctx = _ctx ? {
|
|
830
896
|
..._ctx,
|
|
@@ -835,15 +901,61 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
835
901
|
issues: []
|
|
836
902
|
}, ctx);
|
|
837
903
|
if (result instanceof Promise) result = await result;
|
|
838
|
-
return result.issues.length ? {
|
|
839
|
-
success: false,
|
|
840
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
841
|
-
} : {
|
|
904
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
842
905
|
success: true,
|
|
843
906
|
data: result.value
|
|
844
907
|
};
|
|
845
908
|
};
|
|
846
|
-
const
|
|
909
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
910
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
911
|
+
const validate = ((schema, value, _ctx) => {
|
|
912
|
+
const validator = schema._zod.bag.validator;
|
|
913
|
+
if (validator !== void 0) {
|
|
914
|
+
if (validator(value) !== COMPILE_INVALID) return true;
|
|
915
|
+
if (validator.definite === true && _ctx === void 0) return false;
|
|
916
|
+
}
|
|
917
|
+
return validateFallback(schema, value, _ctx);
|
|
918
|
+
});
|
|
919
|
+
function validateFallback(schema, value, _ctx) {
|
|
920
|
+
const ctx = _ctx ? {
|
|
921
|
+
..._ctx,
|
|
922
|
+
async: false,
|
|
923
|
+
abortEarly: true
|
|
924
|
+
} : {
|
|
925
|
+
async: false,
|
|
926
|
+
abortEarly: true
|
|
927
|
+
};
|
|
928
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
929
|
+
let result;
|
|
930
|
+
if (fallbackRun) {
|
|
931
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
932
|
+
result = fallbackRun({
|
|
933
|
+
value,
|
|
934
|
+
issues: []
|
|
935
|
+
}, ctx);
|
|
936
|
+
} else result = schema._zod.run({
|
|
937
|
+
value,
|
|
938
|
+
issues: []
|
|
939
|
+
}, ctx);
|
|
940
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
941
|
+
return result.issues.length === 0;
|
|
942
|
+
}
|
|
943
|
+
const validateAsync$1 = async (schema, value, _ctx) => {
|
|
944
|
+
const ctx = _ctx ? {
|
|
945
|
+
..._ctx,
|
|
946
|
+
async: true,
|
|
947
|
+
abortEarly: true
|
|
948
|
+
} : {
|
|
949
|
+
async: true,
|
|
950
|
+
abortEarly: true
|
|
951
|
+
};
|
|
952
|
+
let result = schema._zod.run({
|
|
953
|
+
value,
|
|
954
|
+
issues: []
|
|
955
|
+
}, ctx);
|
|
956
|
+
if (result instanceof Promise) result = await result;
|
|
957
|
+
return result.issues.length === 0;
|
|
958
|
+
};
|
|
847
959
|
const _encode = (_Err) => {
|
|
848
960
|
const parse = _parse(_Err);
|
|
849
961
|
const fn = (schema, value, _ctx, _params) => {
|
|
@@ -901,7 +1013,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
901
1013
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
902
1014
|
};
|
|
903
1015
|
//#endregion
|
|
904
|
-
//#region node_modules/.pnpm/zod@4.
|
|
1016
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.js
|
|
905
1017
|
/**
|
|
906
1018
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
907
1019
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -928,8 +1040,8 @@ const uuid = (version) => {
|
|
|
928
1040
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
929
1041
|
};
|
|
930
1042
|
/** Practical email validation */
|
|
931
|
-
const email = /^(
|
|
932
|
-
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
1043
|
+
const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1044
|
+
const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
933
1045
|
function emoji() {
|
|
934
1046
|
return new RegExp(_emoji$1, "u");
|
|
935
1047
|
}
|
|
@@ -938,7 +1050,7 @@ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:
|
|
|
938
1050
|
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
939
1051
|
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
940
1052
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
941
|
-
const base64url = /^[A-Za-z0-9_-]
|
|
1053
|
+
const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
942
1054
|
const httpProtocol = /^https?$/;
|
|
943
1055
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
944
1056
|
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
@@ -966,17 +1078,13 @@ function datetime(args) {
|
|
|
966
1078
|
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
967
1079
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
968
1080
|
}
|
|
969
|
-
const
|
|
970
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
971
|
-
return new RegExp(`^${regex}$`);
|
|
972
|
-
};
|
|
973
|
-
const integer = /^-?\d+$/;
|
|
1081
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
974
1082
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
975
1083
|
const boolean$1 = /^(?:true|false)$/i;
|
|
976
1084
|
const lowercase = /^[^A-Z]*$/;
|
|
977
1085
|
const uppercase = /^[^a-z]*$/;
|
|
978
1086
|
//#endregion
|
|
979
|
-
//#region node_modules/.pnpm/zod@4.
|
|
1087
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.js
|
|
980
1088
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
981
1089
|
var _a;
|
|
982
1090
|
inst._zod ?? (inst._zod = {});
|
|
@@ -996,14 +1104,6 @@ const numericOriginMap = {
|
|
|
996
1104
|
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
997
1105
|
$ZodCheck.init(inst, def);
|
|
998
1106
|
const origin = numericOriginMap[typeof def.value];
|
|
999
|
-
inst._zod.onattach.push((inst) => {
|
|
1000
|
-
const bag = inst._zod.bag;
|
|
1001
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1002
|
-
if (def.value < curr) {
|
|
1003
|
-
if (def.inclusive) bag.maximum = def.value;
|
|
1004
|
-
else bag.exclusiveMaximum = def.value;
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1007
1107
|
inst._zod.check = (payload) => {
|
|
1008
1108
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
1009
1109
|
payload.issues.push({
|
|
@@ -1020,14 +1120,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
|
|
|
1020
1120
|
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1021
1121
|
$ZodCheck.init(inst, def);
|
|
1022
1122
|
const origin = numericOriginMap[typeof def.value];
|
|
1023
|
-
inst._zod.onattach.push((inst) => {
|
|
1024
|
-
const bag = inst._zod.bag;
|
|
1025
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1026
|
-
if (def.value > curr) {
|
|
1027
|
-
if (def.inclusive) bag.minimum = def.value;
|
|
1028
|
-
else bag.exclusiveMinimum = def.value;
|
|
1029
|
-
}
|
|
1030
|
-
});
|
|
1031
1123
|
inst._zod.check = (payload) => {
|
|
1032
1124
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
1033
1125
|
payload.issues.push({
|
|
@@ -1043,10 +1135,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
|
|
|
1043
1135
|
});
|
|
1044
1136
|
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
1045
1137
|
$ZodCheck.init(inst, def);
|
|
1046
|
-
inst._zod.onattach.push((inst) => {
|
|
1047
|
-
var _a;
|
|
1048
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
1049
|
-
});
|
|
1050
1138
|
inst._zod.check = (payload) => {
|
|
1051
1139
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1052
1140
|
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
@@ -1066,13 +1154,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
1066
1154
|
const isInt = def.format?.includes("int");
|
|
1067
1155
|
const origin = isInt ? "int" : "number";
|
|
1068
1156
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1069
|
-
inst._zod.onattach.push((inst) => {
|
|
1070
|
-
const bag = inst._zod.bag;
|
|
1071
|
-
bag.format = def.format;
|
|
1072
|
-
bag.minimum = minimum;
|
|
1073
|
-
bag.maximum = maximum;
|
|
1074
|
-
if (isInt) bag.pattern = integer;
|
|
1075
|
-
});
|
|
1076
1157
|
inst._zod.check = (payload) => {
|
|
1077
1158
|
const input = payload.value;
|
|
1078
1159
|
if (isInt) {
|
|
@@ -1135,10 +1216,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
1135
1216
|
var _a;
|
|
1136
1217
|
$ZodCheck.init(inst, def);
|
|
1137
1218
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1138
|
-
inst._zod.onattach.push((inst) => {
|
|
1139
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1140
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
1141
|
-
});
|
|
1142
1219
|
inst._zod.check = (payload) => {
|
|
1143
1220
|
const input = payload.value;
|
|
1144
1221
|
const units = input.length;
|
|
@@ -1159,10 +1236,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
1159
1236
|
var _a;
|
|
1160
1237
|
$ZodCheck.init(inst, def);
|
|
1161
1238
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1162
|
-
inst._zod.onattach.push((inst) => {
|
|
1163
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1164
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
1165
|
-
});
|
|
1166
1239
|
inst._zod.check = (payload) => {
|
|
1167
1240
|
const input = payload.value;
|
|
1168
1241
|
const units = input.length;
|
|
@@ -1183,12 +1256,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
1183
1256
|
var _a;
|
|
1184
1257
|
$ZodCheck.init(inst, def);
|
|
1185
1258
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1186
|
-
inst._zod.onattach.push((inst) => {
|
|
1187
|
-
const bag = inst._zod.bag;
|
|
1188
|
-
bag.minimum = def.length;
|
|
1189
|
-
bag.maximum = def.length;
|
|
1190
|
-
bag.length = def.length;
|
|
1191
|
-
});
|
|
1192
1259
|
inst._zod.check = (payload) => {
|
|
1193
1260
|
const input = payload.value;
|
|
1194
1261
|
const units = input.length;
|
|
@@ -1216,14 +1283,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
1216
1283
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1217
1284
|
var _a, _b;
|
|
1218
1285
|
$ZodCheck.init(inst, def);
|
|
1219
|
-
inst._zod.onattach.push((inst) => {
|
|
1220
|
-
const bag = inst._zod.bag;
|
|
1221
|
-
bag.format = def.format;
|
|
1222
|
-
if (def.pattern) {
|
|
1223
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1224
|
-
bag.patterns.add(def.pattern);
|
|
1225
|
-
}
|
|
1226
|
-
});
|
|
1227
1286
|
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1228
1287
|
def.pattern.lastIndex = 0;
|
|
1229
1288
|
if (def.pattern.test(payload.value)) return;
|
|
@@ -1266,13 +1325,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1266
1325
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1267
1326
|
$ZodCheck.init(inst, def);
|
|
1268
1327
|
const escapedRegex = escapeRegex(def.includes);
|
|
1269
|
-
|
|
1270
|
-
def.pattern = pattern;
|
|
1271
|
-
inst._zod.onattach.push((inst) => {
|
|
1272
|
-
const bag = inst._zod.bag;
|
|
1273
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1274
|
-
bag.patterns.add(pattern);
|
|
1275
|
-
});
|
|
1328
|
+
def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1276
1329
|
inst._zod.check = (payload) => {
|
|
1277
1330
|
if (payload.value.includes(def.includes, def.position)) return;
|
|
1278
1331
|
payload.issues.push({
|
|
@@ -1290,11 +1343,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
|
|
|
1290
1343
|
$ZodCheck.init(inst, def);
|
|
1291
1344
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1292
1345
|
def.pattern ?? (def.pattern = pattern);
|
|
1293
|
-
inst._zod.onattach.push((inst) => {
|
|
1294
|
-
const bag = inst._zod.bag;
|
|
1295
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1296
|
-
bag.patterns.add(pattern);
|
|
1297
|
-
});
|
|
1298
1346
|
inst._zod.check = (payload) => {
|
|
1299
1347
|
if (payload.value.startsWith(def.prefix)) return;
|
|
1300
1348
|
payload.issues.push({
|
|
@@ -1312,11 +1360,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
1312
1360
|
$ZodCheck.init(inst, def);
|
|
1313
1361
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1314
1362
|
def.pattern ?? (def.pattern = pattern);
|
|
1315
|
-
inst._zod.onattach.push((inst) => {
|
|
1316
|
-
const bag = inst._zod.bag;
|
|
1317
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1318
|
-
bag.patterns.add(pattern);
|
|
1319
|
-
});
|
|
1320
1363
|
inst._zod.check = (payload) => {
|
|
1321
1364
|
if (payload.value.endsWith(def.suffix)) return;
|
|
1322
1365
|
payload.issues.push({
|
|
@@ -1337,7 +1380,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1337
1380
|
};
|
|
1338
1381
|
});
|
|
1339
1382
|
//#endregion
|
|
1340
|
-
//#region node_modules/.pnpm/zod@4.
|
|
1383
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.js
|
|
1341
1384
|
var Doc = class {
|
|
1342
1385
|
constructor(args = [], closed = {}) {
|
|
1343
1386
|
this.content = [];
|
|
@@ -1347,8 +1390,11 @@ var Doc = class {
|
|
|
1347
1390
|
}
|
|
1348
1391
|
indented(fn) {
|
|
1349
1392
|
this.indent += 1;
|
|
1350
|
-
|
|
1351
|
-
|
|
1393
|
+
try {
|
|
1394
|
+
fn(this);
|
|
1395
|
+
} finally {
|
|
1396
|
+
this.indent -= 1;
|
|
1397
|
+
}
|
|
1352
1398
|
}
|
|
1353
1399
|
write(arg) {
|
|
1354
1400
|
if (typeof arg === "function") {
|
|
@@ -1368,14 +1414,14 @@ var Doc = class {
|
|
|
1368
1414
|
}
|
|
1369
1415
|
};
|
|
1370
1416
|
//#endregion
|
|
1371
|
-
//#region node_modules/.pnpm/zod@4.
|
|
1417
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.js
|
|
1372
1418
|
const version = {
|
|
1373
1419
|
major: 4,
|
|
1374
|
-
minor:
|
|
1375
|
-
patch:
|
|
1420
|
+
minor: 6,
|
|
1421
|
+
patch: 7
|
|
1376
1422
|
};
|
|
1377
1423
|
//#endregion
|
|
1378
|
-
//#region node_modules/.pnpm/zod@4.
|
|
1424
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.js
|
|
1379
1425
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1380
1426
|
var _a;
|
|
1381
1427
|
inst ?? (inst = {});
|
|
@@ -1464,15 +1510,26 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1464
1510
|
}
|
|
1465
1511
|
});
|
|
1466
1512
|
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1467
|
-
const toStandardResult = (r) => r.
|
|
1513
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1514
|
+
async function validateAsync(inst, value) {
|
|
1515
|
+
const ctx = { async: true };
|
|
1516
|
+
return toStandardResult(await inst._zod.run({
|
|
1517
|
+
value,
|
|
1518
|
+
issues: []
|
|
1519
|
+
}, ctx), ctx);
|
|
1520
|
+
}
|
|
1468
1521
|
function standardProps(inst) {
|
|
1469
1522
|
return {
|
|
1470
1523
|
validate: (value) => {
|
|
1524
|
+
const ctx = { async: false };
|
|
1471
1525
|
try {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1526
|
+
const r = inst._zod.run({
|
|
1527
|
+
value,
|
|
1528
|
+
issues: []
|
|
1529
|
+
}, ctx);
|
|
1530
|
+
if (!(r instanceof Promise)) return toStandardResult(r, ctx);
|
|
1531
|
+
} catch (_) {}
|
|
1532
|
+
return validateAsync(inst, value);
|
|
1476
1533
|
},
|
|
1477
1534
|
vendor: "zod",
|
|
1478
1535
|
version: 1
|
|
@@ -1480,7 +1537,7 @@ function standardProps(inst) {
|
|
|
1480
1537
|
}
|
|
1481
1538
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1482
1539
|
$ZodType.init(inst, def);
|
|
1483
|
-
inst._zod.pattern =
|
|
1540
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
1484
1541
|
inst._zod.parse = (payload, _) => {
|
|
1485
1542
|
if (def.coerce) try {
|
|
1486
1543
|
payload.value = String(payload.value);
|
|
@@ -1524,10 +1581,27 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1524
1581
|
def.pattern ?? (def.pattern = email);
|
|
1525
1582
|
$ZodStringFormat.init(inst, def);
|
|
1526
1583
|
});
|
|
1527
|
-
|
|
1584
|
+
function canParseURL(input) {
|
|
1585
|
+
try {
|
|
1586
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
|
|
1587
|
+
new URL(input);
|
|
1588
|
+
return true;
|
|
1589
|
+
} catch {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
function validateURL(trimmed, def) {
|
|
1594
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
|
|
1595
|
+
return parseURLObject(trimmed, def);
|
|
1596
|
+
}
|
|
1597
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
1528
1598
|
function parseURLObject(trimmed, def) {
|
|
1529
1599
|
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1530
1600
|
try {
|
|
1601
|
+
if (typeof URL !== "undefined") {
|
|
1602
|
+
const URLStatic = URL;
|
|
1603
|
+
if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
|
|
1604
|
+
}
|
|
1531
1605
|
return new URL(trimmed);
|
|
1532
1606
|
} catch {
|
|
1533
1607
|
return 2;
|
|
@@ -1551,7 +1625,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1551
1625
|
inst._zod.check = (payload) => {
|
|
1552
1626
|
try {
|
|
1553
1627
|
const trimmed = payload.value.trim();
|
|
1554
|
-
const url =
|
|
1628
|
+
const url = validateURL(trimmed, def);
|
|
1555
1629
|
if (url === 1) {
|
|
1556
1630
|
payload.issues.push({
|
|
1557
1631
|
code: "invalid_format",
|
|
@@ -1573,6 +1647,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1573
1647
|
});
|
|
1574
1648
|
return;
|
|
1575
1649
|
}
|
|
1650
|
+
if (url === true) {
|
|
1651
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1576
1654
|
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1577
1655
|
code: "invalid_format",
|
|
1578
1656
|
format: "url",
|
|
@@ -1641,12 +1719,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1641
1719
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1642
1720
|
def.pattern ?? (def.pattern = datetime(def));
|
|
1643
1721
|
$ZodStringFormat.init(inst, def);
|
|
1644
|
-
if (def.local || def.precision === -1) {
|
|
1645
|
-
inst._zod.bag.laxFormat = true;
|
|
1646
|
-
inst._zod.onattach.push((s) => {
|
|
1647
|
-
s._zod.bag.laxFormat = true;
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
1722
|
});
|
|
1651
1723
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1652
1724
|
def.pattern ?? (def.pattern = date);
|
|
@@ -1663,23 +1735,16 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
|
|
|
1663
1735
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1664
1736
|
def.pattern ?? (def.pattern = ipv4);
|
|
1665
1737
|
$ZodStringFormat.init(inst, def);
|
|
1666
|
-
inst._zod.bag.format = `ipv4`;
|
|
1667
1738
|
});
|
|
1668
1739
|
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
1669
1740
|
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1670
1741
|
function isValidIPv6(value) {
|
|
1671
1742
|
if (!ipv6Alphabet.test(value)) return false;
|
|
1672
|
-
|
|
1673
|
-
new URL(`http://[${value}]`);
|
|
1674
|
-
return true;
|
|
1675
|
-
} catch {
|
|
1676
|
-
return false;
|
|
1677
|
-
}
|
|
1743
|
+
return canParseURL(`http://[${value}]`);
|
|
1678
1744
|
}
|
|
1679
1745
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1680
1746
|
def.pattern ?? (def.pattern = ipv6);
|
|
1681
1747
|
$ZodStringFormat.init(inst, def);
|
|
1682
|
-
inst._zod.bag.format = `ipv6`;
|
|
1683
1748
|
inst._zod.check = (payload) => {
|
|
1684
1749
|
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1685
1750
|
code: "invalid_format",
|
|
@@ -1728,10 +1793,10 @@ function isValidBase64(data) {
|
|
|
1728
1793
|
return false;
|
|
1729
1794
|
}
|
|
1730
1795
|
}
|
|
1796
|
+
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1731
1797
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1732
|
-
def.pattern ?? (def.pattern =
|
|
1798
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
1733
1799
|
$ZodStringFormat.init(inst, def);
|
|
1734
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1735
1800
|
inst._zod.check = (payload) => {
|
|
1736
1801
|
if (isValidBase64(payload.value)) return;
|
|
1737
1802
|
payload.issues.push({
|
|
@@ -1743,15 +1808,15 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
|
1743
1808
|
});
|
|
1744
1809
|
};
|
|
1745
1810
|
});
|
|
1811
|
+
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1746
1812
|
function isValidBase64URL(data) {
|
|
1747
|
-
if (!
|
|
1813
|
+
if (!base64urlCharset.test(data)) return false;
|
|
1748
1814
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1749
1815
|
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1750
1816
|
}
|
|
1751
1817
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1752
|
-
def.pattern ?? (def.pattern =
|
|
1818
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
1753
1819
|
$ZodStringFormat.init(inst, def);
|
|
1754
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1755
1820
|
inst._zod.check = (payload) => {
|
|
1756
1821
|
if (isValidBase64URL(payload.value)) return;
|
|
1757
1822
|
payload.issues.push({
|
|
@@ -1797,7 +1862,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1797
1862
|
});
|
|
1798
1863
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1799
1864
|
$ZodType.init(inst, def);
|
|
1800
|
-
inst._zod.pattern =
|
|
1865
|
+
inst._zod.pattern = number$1;
|
|
1801
1866
|
inst._zod.parse = (payload, _ctx) => {
|
|
1802
1867
|
if (def.coerce) try {
|
|
1803
1868
|
payload.value = Number(payload.value);
|
|
@@ -1853,6 +1918,26 @@ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
|
1853
1918
|
return payload;
|
|
1854
1919
|
};
|
|
1855
1920
|
});
|
|
1921
|
+
function capSize(inst, size) {
|
|
1922
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
1923
|
+
if (!caps.length) return;
|
|
1924
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
1925
|
+
const parse = inst._zod.parse;
|
|
1926
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1927
|
+
const n = size(payload.value);
|
|
1928
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
1929
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) if (n > max && ch._zod.def.when(payload)) {
|
|
1930
|
+
const start = payload.issues.length;
|
|
1931
|
+
ch._zod.check(payload);
|
|
1932
|
+
payload.issues[start].continue = false;
|
|
1933
|
+
attachSchema(payload.issues, start, inst);
|
|
1934
|
+
return payload;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return parse(payload, ctx);
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
const arraySize = (input) => Array.isArray(input) ? input.length : -1;
|
|
1856
1941
|
function handleArrayResult(result, final, index) {
|
|
1857
1942
|
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1858
1943
|
final.value[index] = result.value;
|
|
@@ -1874,6 +1959,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1874
1959
|
}
|
|
1875
1960
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1876
1961
|
const proms = [];
|
|
1962
|
+
const abortEarly = ctx?.abortEarly;
|
|
1877
1963
|
for (let i = 0; i < input.length; i++) {
|
|
1878
1964
|
const item = input[i];
|
|
1879
1965
|
const result = def.element._zod.run({
|
|
@@ -1881,11 +1967,15 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1881
1967
|
issues: []
|
|
1882
1968
|
}, ctx);
|
|
1883
1969
|
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1884
|
-
else
|
|
1970
|
+
else {
|
|
1971
|
+
handleArrayResult(result, payload, i);
|
|
1972
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
|
|
1973
|
+
}
|
|
1885
1974
|
}
|
|
1886
1975
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1887
1976
|
return payload;
|
|
1888
1977
|
};
|
|
1978
|
+
capSize(inst, arraySize);
|
|
1889
1979
|
});
|
|
1890
1980
|
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1891
1981
|
const isPresent = key in input;
|
|
@@ -1905,7 +1995,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
1905
1995
|
return;
|
|
1906
1996
|
}
|
|
1907
1997
|
if (result.value === void 0) {
|
|
1908
|
-
if (isPresent) final.value[key] = void 0;
|
|
1998
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
|
|
1909
1999
|
} else final.value[key] = result.value;
|
|
1910
2000
|
}
|
|
1911
2001
|
const NO_SYMBOL_KEYS = [];
|
|
@@ -1925,14 +2015,19 @@ function normalizeDef(def) {
|
|
|
1925
2015
|
optionalKeys: new Set(okeys)
|
|
1926
2016
|
};
|
|
1927
2017
|
}
|
|
1928
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2018
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
1929
2019
|
const unrecognized = [];
|
|
1930
2020
|
const keySet = def.keySet;
|
|
1931
2021
|
const _catchall = def.catchall._zod;
|
|
1932
2022
|
const t = _catchall.def.type;
|
|
1933
2023
|
const optin = _catchall.optin;
|
|
1934
2024
|
const optout = _catchall.optout;
|
|
2025
|
+
let seen = 0;
|
|
1935
2026
|
for (const key in input) {
|
|
2027
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2028
|
+
if (aborted(payload, seen)) break;
|
|
2029
|
+
seen = payload.issues.length;
|
|
2030
|
+
}
|
|
1936
2031
|
if (keySet.has(key)) continue;
|
|
1937
2032
|
if (key === "__proto__") {
|
|
1938
2033
|
if (t === "never") unrecognized.push(key);
|
|
@@ -1961,18 +2056,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1961
2056
|
return payload;
|
|
1962
2057
|
});
|
|
1963
2058
|
}
|
|
1964
|
-
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
1965
2059
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1966
2060
|
$ZodType.init(inst, def);
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2061
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
2062
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
2063
|
+
if (sh) {
|
|
2064
|
+
const get = () => {
|
|
1971
2065
|
const newSh = { ...sh };
|
|
1972
2066
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
1973
|
-
|
|
2067
|
+
get.raw = newSh;
|
|
1974
2068
|
return newSh;
|
|
1975
|
-
}
|
|
2069
|
+
};
|
|
2070
|
+
get.raw = sh;
|
|
2071
|
+
Object.defineProperty(def, "shape", { get });
|
|
1976
2072
|
}
|
|
1977
2073
|
const _normalized = cached(() => normalizeDef(def));
|
|
1978
2074
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -2008,7 +2104,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
2008
2104
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
2009
2105
|
const proms = [];
|
|
2010
2106
|
const shape = value.shape;
|
|
2107
|
+
const abortEarly = ctx?.abortEarly;
|
|
2108
|
+
let seen = payload.issues.length;
|
|
2011
2109
|
for (const key of value.allKeys) {
|
|
2110
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2111
|
+
if (aborted(payload, seen)) break;
|
|
2112
|
+
seen = payload.issues.length;
|
|
2113
|
+
}
|
|
2012
2114
|
if (key === "__proto__") continue;
|
|
2013
2115
|
const el = shape[key];
|
|
2014
2116
|
const optin = el._zod.optin;
|
|
@@ -2021,7 +2123,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
2021
2123
|
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
2022
2124
|
}
|
|
2023
2125
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2024
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2126
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
2025
2127
|
};
|
|
2026
2128
|
});
|
|
2027
2129
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -2040,10 +2142,16 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2040
2142
|
});
|
|
2041
2143
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2042
2144
|
const prefixStr = (id, k) => `
|
|
2145
|
+
let ${id}_ab = false;
|
|
2043
2146
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2044
2147
|
const iss = ${id}.issues[i];
|
|
2045
2148
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2046
2149
|
payload.issues.push(iss);
|
|
2150
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
2151
|
+
}
|
|
2152
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2153
|
+
payload.value = newResult;
|
|
2154
|
+
return payload;
|
|
2047
2155
|
}`;
|
|
2048
2156
|
doc.write(`const input = payload.value;`);
|
|
2049
2157
|
const ids = Object.create(null);
|
|
@@ -2085,6 +2193,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2085
2193
|
input: undefined,
|
|
2086
2194
|
path: [${k}]
|
|
2087
2195
|
});
|
|
2196
|
+
if (ctx && ctx.abortEarly) {
|
|
2197
|
+
payload.value = newResult;
|
|
2198
|
+
return payload;
|
|
2199
|
+
}
|
|
2088
2200
|
}
|
|
2089
2201
|
|
|
2090
2202
|
if (${id}_present) {
|
|
@@ -2092,19 +2204,18 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2092
2204
|
}
|
|
2093
2205
|
|
|
2094
2206
|
`);
|
|
2095
|
-
else
|
|
2207
|
+
else {
|
|
2208
|
+
doc.write(`
|
|
2096
2209
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2097
2210
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
}
|
|
2103
|
-
} else {
|
|
2211
|
+
`);
|
|
2212
|
+
if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
|
|
2213
|
+
else doc.write(`
|
|
2214
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
2104
2215
|
newResult[${k}] = ${id}.value;
|
|
2105
2216
|
}
|
|
2106
|
-
|
|
2107
2217
|
`);
|
|
2218
|
+
}
|
|
2108
2219
|
}
|
|
2109
2220
|
doc.write(`payload.value = newResult;`);
|
|
2110
2221
|
doc.write(`return payload;`);
|
|
@@ -2132,7 +2243,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2132
2243
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
2133
2244
|
payload = fastpass(payload, ctx);
|
|
2134
2245
|
if (!catchall) return payload;
|
|
2135
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2246
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
2136
2247
|
}
|
|
2137
2248
|
return superParse(payload, ctx);
|
|
2138
2249
|
};
|
|
@@ -2311,8 +2422,10 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2311
2422
|
const values = getEnumValues(def.entries);
|
|
2312
2423
|
const valuesSet = new Set(values);
|
|
2313
2424
|
inst._zod.values = valuesSet;
|
|
2314
|
-
|
|
2315
|
-
|
|
2425
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2426
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2427
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2428
|
+
});
|
|
2316
2429
|
inst._zod.parse = (payload, _ctx) => {
|
|
2317
2430
|
const input = payload.value;
|
|
2318
2431
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2547,7 +2660,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2547
2660
|
}
|
|
2548
2661
|
}
|
|
2549
2662
|
//#endregion
|
|
2550
|
-
//#region node_modules/.pnpm/zod@4.
|
|
2663
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.js
|
|
2551
2664
|
var $ZodCyclicError = class extends Error {
|
|
2552
2665
|
constructor() {
|
|
2553
2666
|
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
@@ -2557,6 +2670,9 @@ var $ZodCyclicError = class extends Error {
|
|
|
2557
2670
|
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2558
2671
|
const STATE = "~memo";
|
|
2559
2672
|
const NO_ISSUES = [];
|
|
2673
|
+
function isRef(value) {
|
|
2674
|
+
return value !== null && typeof value === "object";
|
|
2675
|
+
}
|
|
2560
2676
|
function cloneIssues(issues) {
|
|
2561
2677
|
return issues.map((iss) => iss.path ? {
|
|
2562
2678
|
...iss,
|
|
@@ -2564,22 +2680,44 @@ function cloneIssues(issues) {
|
|
|
2564
2680
|
} : { ...iss });
|
|
2565
2681
|
}
|
|
2566
2682
|
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2683
|
+
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
2684
|
+
const NONE = 0;
|
|
2685
|
+
const ASSUMED = 1;
|
|
2686
|
+
const PROVEN = 2;
|
|
2567
2687
|
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2568
|
-
function isRecursive(inst, stack) {
|
|
2688
|
+
function isRecursive(inst, stack, resolve) {
|
|
2569
2689
|
const cached = recursive.get(inst);
|
|
2570
|
-
if (cached !== void 0) return cached;
|
|
2571
|
-
if (stack.has(inst)) return
|
|
2690
|
+
if (cached !== void 0) return cached ? PROVEN : NONE;
|
|
2691
|
+
if (stack.has(inst)) return PROVEN;
|
|
2572
2692
|
stack.add(inst);
|
|
2573
|
-
let result =
|
|
2693
|
+
let result = NONE;
|
|
2574
2694
|
const check = (child) => {
|
|
2575
|
-
if (
|
|
2695
|
+
if (result !== PROVEN && child?._zod) {
|
|
2696
|
+
const answer = isRecursive(child, stack, resolve);
|
|
2697
|
+
if (answer > result) result = answer;
|
|
2698
|
+
}
|
|
2699
|
+
};
|
|
2700
|
+
const shape = (sh, spread) => {
|
|
2701
|
+
let answer = NONE;
|
|
2702
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
2703
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
2704
|
+
if (spread && !desc.enumerable) continue;
|
|
2705
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
2706
|
+
if (child > answer) answer = child;
|
|
2707
|
+
}
|
|
2708
|
+
return answer;
|
|
2709
|
+
};
|
|
2710
|
+
const merge = (answer) => {
|
|
2711
|
+
if (answer > result) result = answer;
|
|
2576
2712
|
};
|
|
2577
2713
|
const def = inst._zod.def;
|
|
2578
2714
|
switch (def.type) {
|
|
2579
|
-
case "object":
|
|
2580
|
-
|
|
2715
|
+
case "object": {
|
|
2716
|
+
const raw = rawShape(def);
|
|
2717
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
2581
2718
|
check(def.catchall);
|
|
2582
2719
|
break;
|
|
2720
|
+
}
|
|
2583
2721
|
case "array":
|
|
2584
2722
|
check(def.element);
|
|
2585
2723
|
break;
|
|
@@ -2621,9 +2759,11 @@ function isRecursive(inst, stack) {
|
|
|
2621
2759
|
check(def.input);
|
|
2622
2760
|
check(def.output);
|
|
2623
2761
|
break;
|
|
2624
|
-
case "lazy":
|
|
2625
|
-
|
|
2762
|
+
case "lazy": {
|
|
2763
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
2764
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
2626
2765
|
break;
|
|
2766
|
+
}
|
|
2627
2767
|
case "template_literal":
|
|
2628
2768
|
case "string":
|
|
2629
2769
|
case "number":
|
|
@@ -2654,13 +2794,17 @@ function isRecursive(inst, stack) {
|
|
|
2654
2794
|
}
|
|
2655
2795
|
}
|
|
2656
2796
|
stack.delete(inst);
|
|
2657
|
-
|
|
2658
|
-
|
|
2797
|
+
return settle(inst, result);
|
|
2798
|
+
}
|
|
2799
|
+
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
2800
|
+
function settle(inst, answer) {
|
|
2801
|
+
if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
|
|
2802
|
+
return answer;
|
|
2659
2803
|
}
|
|
2660
2804
|
function bucketFor(state, inst) {
|
|
2661
2805
|
let bucket = state.buckets.get(inst);
|
|
2662
2806
|
if (!bucket) {
|
|
2663
|
-
bucket = /* @__PURE__ */ new
|
|
2807
|
+
bucket = /* @__PURE__ */ new WeakMap();
|
|
2664
2808
|
state.buckets.set(inst, bucket);
|
|
2665
2809
|
}
|
|
2666
2810
|
return bucket;
|
|
@@ -2696,6 +2840,7 @@ const memo = {
|
|
|
2696
2840
|
attach(inst) {
|
|
2697
2841
|
var _a;
|
|
2698
2842
|
let isRecursiveInst;
|
|
2843
|
+
let rechecked = false;
|
|
2699
2844
|
let lastCtx;
|
|
2700
2845
|
let lastBucket;
|
|
2701
2846
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -2703,19 +2848,21 @@ const memo = {
|
|
|
2703
2848
|
const base = inst._zod.parse;
|
|
2704
2849
|
const wrapped = (payload, ctx) => {
|
|
2705
2850
|
if (isRecursiveInst === void 0) {
|
|
2706
|
-
|
|
2707
|
-
if (
|
|
2851
|
+
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
2852
|
+
if (walked === NONE) {
|
|
2708
2853
|
inst._zod.parse = base;
|
|
2709
2854
|
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2710
2855
|
return base(payload, ctx);
|
|
2711
2856
|
}
|
|
2857
|
+
if (walked === PROVEN || rechecked) isRecursiveInst = true;
|
|
2858
|
+
else rechecked = true;
|
|
2712
2859
|
}
|
|
2713
2860
|
const input = payload.value;
|
|
2714
|
-
if (input
|
|
2861
|
+
if (!isRef(input)) return base(payload, ctx);
|
|
2715
2862
|
let state = ctx[STATE];
|
|
2716
2863
|
if (!state) {
|
|
2717
2864
|
state = {
|
|
2718
|
-
buckets: /* @__PURE__ */ new
|
|
2865
|
+
buckets: /* @__PURE__ */ new WeakMap(),
|
|
2719
2866
|
backEdges: void 0
|
|
2720
2867
|
};
|
|
2721
2868
|
ctx[STATE] = state;
|
|
@@ -2734,7 +2881,7 @@ const memo = {
|
|
|
2734
2881
|
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2735
2882
|
} else {
|
|
2736
2883
|
payload.memo = true;
|
|
2737
|
-
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new
|
|
2884
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
2738
2885
|
state.backEdges.add(hit.value);
|
|
2739
2886
|
}
|
|
2740
2887
|
return payload;
|
|
@@ -2763,10 +2910,10 @@ function memoizer() {
|
|
|
2763
2910
|
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2764
2911
|
function isBackEdge(ctx, value) {
|
|
2765
2912
|
const backEdges = ctx[STATE]?.backEdges;
|
|
2766
|
-
return backEdges !== void 0 && value
|
|
2913
|
+
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
2767
2914
|
}
|
|
2768
2915
|
//#endregion
|
|
2769
|
-
//#region node_modules/.pnpm/zod@4.
|
|
2916
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.js
|
|
2770
2917
|
const error = () => {
|
|
2771
2918
|
const Sizable = {
|
|
2772
2919
|
string: {
|
|
@@ -2821,7 +2968,9 @@ const error = () => {
|
|
|
2821
2968
|
base64url: "base64url-encoded string",
|
|
2822
2969
|
json_string: "JSON string",
|
|
2823
2970
|
e164: "E.164 number",
|
|
2971
|
+
currency_code: "currency code",
|
|
2824
2972
|
credit_card: "credit card number",
|
|
2973
|
+
iban: "IBAN",
|
|
2825
2974
|
jwt: "JWT",
|
|
2826
2975
|
template_literal: "input"
|
|
2827
2976
|
};
|
|
@@ -2872,7 +3021,7 @@ function en_default() {
|
|
|
2872
3021
|
return { localeError: error() };
|
|
2873
3022
|
}
|
|
2874
3023
|
//#endregion
|
|
2875
|
-
//#region node_modules/.pnpm/zod@4.
|
|
3024
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.js
|
|
2876
3025
|
var _a;
|
|
2877
3026
|
var $ZodRegistry = class {
|
|
2878
3027
|
constructor() {
|
|
@@ -2919,13 +3068,17 @@ function registry() {
|
|
|
2919
3068
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2920
3069
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2921
3070
|
//#endregion
|
|
2922
|
-
//#region node_modules/.pnpm/zod@4.
|
|
3071
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js
|
|
3072
|
+
function snapshotChecks(def) {
|
|
3073
|
+
if (def.checks) def.checks = [...def.checks];
|
|
3074
|
+
return def;
|
|
3075
|
+
}
|
|
2923
3076
|
// @__NO_SIDE_EFFECTS__
|
|
2924
3077
|
function _string(Class, params) {
|
|
2925
|
-
return new Class({
|
|
3078
|
+
return new Class(snapshotChecks({
|
|
2926
3079
|
type: "string",
|
|
2927
3080
|
...normalizeParams(params)
|
|
2928
|
-
});
|
|
3081
|
+
}));
|
|
2929
3082
|
}
|
|
2930
3083
|
// @__NO_SIDE_EFFECTS__
|
|
2931
3084
|
function _email(Class, params) {
|
|
@@ -3197,11 +3350,11 @@ function _isoDuration(Class, params) {
|
|
|
3197
3350
|
}
|
|
3198
3351
|
// @__NO_SIDE_EFFECTS__
|
|
3199
3352
|
function _number(Class, params) {
|
|
3200
|
-
return new Class({
|
|
3353
|
+
return new Class(snapshotChecks({
|
|
3201
3354
|
type: "number",
|
|
3202
3355
|
checks: [],
|
|
3203
3356
|
...normalizeParams(params)
|
|
3204
|
-
});
|
|
3357
|
+
}));
|
|
3205
3358
|
}
|
|
3206
3359
|
// @__NO_SIDE_EFFECTS__
|
|
3207
3360
|
function _int(Class, params) {
|
|
@@ -3424,7 +3577,7 @@ function _check(fn, params) {
|
|
|
3424
3577
|
return ch;
|
|
3425
3578
|
}
|
|
3426
3579
|
//#endregion
|
|
3427
|
-
//#region node_modules/.pnpm/zod@4.
|
|
3580
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js
|
|
3428
3581
|
function assignProps(target, ...sources) {
|
|
3429
3582
|
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3430
3583
|
return target;
|
|
@@ -3467,7 +3620,7 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
|
3467
3620
|
Object.assign(json, result);
|
|
3468
3621
|
return true;
|
|
3469
3622
|
}
|
|
3470
|
-
function
|
|
3623
|
+
function processSchema(schema, ctx, _params = {
|
|
3471
3624
|
path: [],
|
|
3472
3625
|
schemaPath: []
|
|
3473
3626
|
}) {
|
|
@@ -3506,7 +3659,7 @@ function process(schema, ctx, _params = {
|
|
|
3506
3659
|
const parent = schema._zod.parent;
|
|
3507
3660
|
if (parent) {
|
|
3508
3661
|
if (!result.ref) result.ref = parent;
|
|
3509
|
-
|
|
3662
|
+
processSchema(parent, ctx, params);
|
|
3510
3663
|
ctx.seen.get(parent).isParent = true;
|
|
3511
3664
|
}
|
|
3512
3665
|
}
|
|
@@ -3596,10 +3749,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3596
3749
|
continue;
|
|
3597
3750
|
}
|
|
3598
3751
|
if (seen.count > 1) {
|
|
3599
|
-
if (ctx.reused === "ref")
|
|
3600
|
-
extractToDef(entry);
|
|
3601
|
-
continue;
|
|
3602
|
-
}
|
|
3752
|
+
if (ctx.reused === "ref") extractToDef(entry);
|
|
3603
3753
|
}
|
|
3604
3754
|
}
|
|
3605
3755
|
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
@@ -3854,7 +4004,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
3854
4004
|
...params,
|
|
3855
4005
|
processors
|
|
3856
4006
|
});
|
|
3857
|
-
|
|
4007
|
+
processSchema(schema, ctx);
|
|
3858
4008
|
extractDefs(ctx, schema);
|
|
3859
4009
|
return finalize(ctx, schema);
|
|
3860
4010
|
};
|
|
@@ -3866,12 +4016,84 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3866
4016
|
io,
|
|
3867
4017
|
processors
|
|
3868
4018
|
});
|
|
3869
|
-
|
|
4019
|
+
processSchema(schema, ctx);
|
|
3870
4020
|
extractDefs(ctx, schema);
|
|
3871
4021
|
return finalize(ctx, schema);
|
|
3872
4022
|
};
|
|
3873
4023
|
//#endregion
|
|
3874
|
-
//#region node_modules/.pnpm/zod@4.
|
|
4024
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js
|
|
4025
|
+
const narrowMin = (agg, key, value) => {
|
|
4026
|
+
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4027
|
+
};
|
|
4028
|
+
const narrowMax = (agg, key, value) => {
|
|
4029
|
+
if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
|
|
4030
|
+
};
|
|
4031
|
+
const narrowBoth = (agg, value) => {
|
|
4032
|
+
narrowMin(agg, "minimum", value);
|
|
4033
|
+
narrowMax(agg, "maximum", value);
|
|
4034
|
+
};
|
|
4035
|
+
const addDivisor = (agg, value) => {
|
|
4036
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4037
|
+
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
|
|
4038
|
+
};
|
|
4039
|
+
const addPattern = (agg, pattern) => {
|
|
4040
|
+
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4041
|
+
agg.patterns.add(pattern);
|
|
4042
|
+
};
|
|
4043
|
+
const intersectMime = (agg, mime) => {
|
|
4044
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4045
|
+
};
|
|
4046
|
+
const setFormat = (agg, format) => {
|
|
4047
|
+
agg.format = format;
|
|
4048
|
+
if (format.includes("int")) agg.isInt = true;
|
|
4049
|
+
};
|
|
4050
|
+
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4051
|
+
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4052
|
+
const formatContributor = (ranges) => (agg, def) => {
|
|
4053
|
+
setFormat(agg, def.format);
|
|
4054
|
+
const [minimum, maximum] = ranges[def.format];
|
|
4055
|
+
narrowMin(agg, "minimum", minimum);
|
|
4056
|
+
narrowMax(agg, "maximum", maximum);
|
|
4057
|
+
};
|
|
4058
|
+
const contributors = {
|
|
4059
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4060
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4061
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4062
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4063
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4064
|
+
min_length: minContributor,
|
|
4065
|
+
max_length: maxContributor,
|
|
4066
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4067
|
+
min_size: minContributor,
|
|
4068
|
+
max_size: maxContributor,
|
|
4069
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4070
|
+
string_format: (agg, def) => {
|
|
4071
|
+
setFormat(agg, def.format);
|
|
4072
|
+
if (def.pattern) addPattern(agg, def.pattern);
|
|
4073
|
+
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
|
|
4074
|
+
if (def.local || def.precision === -1) agg.laxFormat = true;
|
|
4075
|
+
},
|
|
4076
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4077
|
+
};
|
|
4078
|
+
function aggregateChecks(schema) {
|
|
4079
|
+
const agg = {};
|
|
4080
|
+
const def = schema._zod.def;
|
|
4081
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4082
|
+
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4083
|
+
const bag = schema._zod.bag;
|
|
4084
|
+
if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
|
|
4085
|
+
if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4086
|
+
if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
|
|
4087
|
+
if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4088
|
+
if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
|
|
4089
|
+
if (bag.format !== void 0) {
|
|
4090
|
+
agg.format ?? (agg.format = bag.format);
|
|
4091
|
+
if (bag.format.includes("int")) agg.isInt = true;
|
|
4092
|
+
}
|
|
4093
|
+
if (bag.mime) intersectMime(agg, bag.mime);
|
|
4094
|
+
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
|
|
4095
|
+
return agg;
|
|
4096
|
+
}
|
|
3875
4097
|
const formatMap = {
|
|
3876
4098
|
guid: "uuid",
|
|
3877
4099
|
url: "uri",
|
|
@@ -3879,10 +4101,12 @@ const formatMap = {
|
|
|
3879
4101
|
json_string: "json-string",
|
|
3880
4102
|
regex: ""
|
|
3881
4103
|
};
|
|
4104
|
+
const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
|
|
4105
|
+
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
3882
4106
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3883
4107
|
const json = _json;
|
|
3884
4108
|
json.type = "string";
|
|
3885
|
-
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema
|
|
4109
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
3886
4110
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
3887
4111
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3888
4112
|
if (format) {
|
|
@@ -3892,7 +4116,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3892
4116
|
}
|
|
3893
4117
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3894
4118
|
if (patterns && patterns.size > 0) {
|
|
3895
|
-
const patternList = [...patterns];
|
|
4119
|
+
const patternList = [...patterns].map(exactPattern);
|
|
3896
4120
|
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
3897
4121
|
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
3898
4122
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
@@ -3902,9 +4126,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3902
4126
|
};
|
|
3903
4127
|
const numberProcessor = (schema, ctx, _json, params) => {
|
|
3904
4128
|
const json = _json;
|
|
3905
|
-
const { minimum, maximum,
|
|
3906
|
-
|
|
3907
|
-
else json.type = "number";
|
|
4129
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
4130
|
+
json.type = isInt ? "integer" : "number";
|
|
3908
4131
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3909
4132
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3910
4133
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -3920,9 +4143,13 @@ const numberProcessor = (schema, ctx, _json, params) => {
|
|
|
3920
4143
|
json.exclusiveMaximum = true;
|
|
3921
4144
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3922
4145
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
3923
|
-
if (
|
|
3924
|
-
|
|
3925
|
-
|
|
4146
|
+
if (multipleOf) {
|
|
4147
|
+
const divisors = /* @__PURE__ */ new Set();
|
|
4148
|
+
for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
|
|
4149
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
4150
|
+
const [first, ...rest] = divisors;
|
|
4151
|
+
if (first !== void 0) json.multipleOf = first;
|
|
4152
|
+
if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
3926
4153
|
}
|
|
3927
4154
|
};
|
|
3928
4155
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
@@ -3951,11 +4178,11 @@ const transformProcessor = (schema, ctx, json, params) => {
|
|
|
3951
4178
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3952
4179
|
const json = _json;
|
|
3953
4180
|
const def = schema._zod.def;
|
|
3954
|
-
const { minimum, maximum } = schema
|
|
4181
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
3955
4182
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
3956
4183
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3957
4184
|
json.type = "array";
|
|
3958
|
-
json.items =
|
|
4185
|
+
json.items = processSchema(def.element, ctx, {
|
|
3959
4186
|
...params,
|
|
3960
4187
|
path: [...params.path, "items"]
|
|
3961
4188
|
});
|
|
@@ -3973,7 +4200,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3973
4200
|
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3974
4201
|
json.type = "object";
|
|
3975
4202
|
json.properties = {};
|
|
3976
|
-
for (const key in shape) assignProp(json.properties, key,
|
|
4203
|
+
for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
3977
4204
|
...params,
|
|
3978
4205
|
path: [
|
|
3979
4206
|
...params.path,
|
|
@@ -3981,17 +4208,16 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3981
4208
|
key
|
|
3982
4209
|
]
|
|
3983
4210
|
}));
|
|
3984
|
-
const
|
|
3985
|
-
const
|
|
4211
|
+
const requiredKeys = [];
|
|
4212
|
+
for (const key of Object.keys(shape)) {
|
|
3986
4213
|
const field = def.shape[key];
|
|
3987
|
-
if (ctx.io === "input"
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
4214
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
|
|
4215
|
+
}
|
|
4216
|
+
if (requiredKeys.length > 0) json.required = requiredKeys;
|
|
3991
4217
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3992
4218
|
else if (!def.catchall) {
|
|
3993
4219
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
3994
|
-
} else if (def.catchall) json.additionalProperties =
|
|
4220
|
+
} else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
3995
4221
|
...params,
|
|
3996
4222
|
path: [...params.path, "additionalProperties"]
|
|
3997
4223
|
});
|
|
@@ -3999,7 +4225,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3999
4225
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
4000
4226
|
const def = schema._zod.def;
|
|
4001
4227
|
const isExclusive = def.inclusive === false;
|
|
4002
|
-
const options = def.options.map((x, i) =>
|
|
4228
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
4003
4229
|
...params,
|
|
4004
4230
|
path: [
|
|
4005
4231
|
...params.path,
|
|
@@ -4012,7 +4238,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
4012
4238
|
};
|
|
4013
4239
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
4014
4240
|
const def = schema._zod.def;
|
|
4015
|
-
const a =
|
|
4241
|
+
const a = processSchema(def.left, ctx, {
|
|
4016
4242
|
...params,
|
|
4017
4243
|
path: [
|
|
4018
4244
|
...params.path,
|
|
@@ -4020,7 +4246,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
4020
4246
|
0
|
|
4021
4247
|
]
|
|
4022
4248
|
});
|
|
4023
|
-
const b =
|
|
4249
|
+
const b = processSchema(def.right, ctx, {
|
|
4024
4250
|
...params,
|
|
4025
4251
|
path: [
|
|
4026
4252
|
...params.path,
|
|
@@ -4035,7 +4261,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
4035
4261
|
};
|
|
4036
4262
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4037
4263
|
const def = schema._zod.def;
|
|
4038
|
-
const inner =
|
|
4264
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
4039
4265
|
const seen = ctx.seen.get(schema);
|
|
4040
4266
|
if (ctx.target === "openapi-3.0") {
|
|
4041
4267
|
seen.ref = def.innerType;
|
|
@@ -4044,7 +4270,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
4044
4270
|
};
|
|
4045
4271
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
4046
4272
|
const def = schema._zod.def;
|
|
4047
|
-
|
|
4273
|
+
processSchema(def.innerType, ctx, params);
|
|
4048
4274
|
const seen = ctx.seen.get(schema);
|
|
4049
4275
|
seen.ref = def.innerType;
|
|
4050
4276
|
};
|
|
@@ -4065,7 +4291,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
|
4065
4291
|
}
|
|
4066
4292
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
4067
4293
|
const def = schema._zod.def;
|
|
4068
|
-
|
|
4294
|
+
processSchema(def.innerType, ctx, params);
|
|
4069
4295
|
const seen = ctx.seen.get(schema);
|
|
4070
4296
|
seen.ref = def.innerType;
|
|
4071
4297
|
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -4073,7 +4299,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
|
|
|
4073
4299
|
};
|
|
4074
4300
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
4075
4301
|
const def = schema._zod.def;
|
|
4076
|
-
|
|
4302
|
+
processSchema(def.innerType, ctx, params);
|
|
4077
4303
|
const seen = ctx.seen.get(schema);
|
|
4078
4304
|
seen.ref = def.innerType;
|
|
4079
4305
|
if (ctx.io !== "input") return;
|
|
@@ -4082,7 +4308,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
|
|
|
4082
4308
|
};
|
|
4083
4309
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
4084
4310
|
const def = schema._zod.def;
|
|
4085
|
-
|
|
4311
|
+
processSchema(def.innerType, ctx, params);
|
|
4086
4312
|
const seen = ctx.seen.get(schema);
|
|
4087
4313
|
seen.ref = def.innerType;
|
|
4088
4314
|
let catchValue;
|
|
@@ -4098,25 +4324,25 @@ const pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
4098
4324
|
const def = schema._zod.def;
|
|
4099
4325
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
4100
4326
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
4101
|
-
|
|
4327
|
+
processSchema(innerType, ctx, params);
|
|
4102
4328
|
const seen = ctx.seen.get(schema);
|
|
4103
4329
|
seen.ref = innerType;
|
|
4104
4330
|
};
|
|
4105
4331
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
4106
4332
|
const def = schema._zod.def;
|
|
4107
|
-
|
|
4333
|
+
processSchema(def.innerType, ctx, params);
|
|
4108
4334
|
const seen = ctx.seen.get(schema);
|
|
4109
4335
|
seen.ref = def.innerType;
|
|
4110
4336
|
json.readOnly = true;
|
|
4111
4337
|
};
|
|
4112
4338
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
4113
4339
|
const def = schema._zod.def;
|
|
4114
|
-
|
|
4340
|
+
processSchema(def.innerType, ctx, params);
|
|
4115
4341
|
const seen = ctx.seen.get(schema);
|
|
4116
4342
|
seen.ref = def.innerType;
|
|
4117
4343
|
};
|
|
4118
4344
|
//#endregion
|
|
4119
|
-
//#region node_modules/.pnpm/zod@4.
|
|
4345
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.js
|
|
4120
4346
|
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4121
4347
|
function _lazyMethod(proto, key, make) {
|
|
4122
4348
|
Object.defineProperty(proto, key, {
|
|
@@ -4166,7 +4392,7 @@ const initializer = (inst, issues) => {
|
|
|
4166
4392
|
};
|
|
4167
4393
|
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
4168
4394
|
//#endregion
|
|
4169
|
-
//#region node_modules/.pnpm/zod@4.
|
|
4395
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.js
|
|
4170
4396
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4171
4397
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4172
4398
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -4180,7 +4406,7 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
4180
4406
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4181
4407
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4182
4408
|
//#endregion
|
|
4183
|
-
//#region node_modules/.pnpm/zod@4.
|
|
4409
|
+
//#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
|
|
4184
4410
|
function _ensureDefaultLocale() {
|
|
4185
4411
|
if (!globalConfig.localeError) config(en_default());
|
|
4186
4412
|
}
|
|
@@ -4316,6 +4542,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
4316
4542
|
set spa(value) {
|
|
4317
4543
|
own(this, "spa", value);
|
|
4318
4544
|
},
|
|
4545
|
+
validate(data, params) {
|
|
4546
|
+
return validate(this, data, params);
|
|
4547
|
+
},
|
|
4548
|
+
validateAsync(data, params) {
|
|
4549
|
+
return validateAsync$1(this, data, params);
|
|
4550
|
+
},
|
|
4319
4551
|
encode: function _encode(data, params) {
|
|
4320
4552
|
return encode(this, data, params, { callee: _encode });
|
|
4321
4553
|
},
|
|
@@ -4355,10 +4587,10 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
4355
4587
|
$ZodString.init(inst, def);
|
|
4356
4588
|
ZodType.init(inst, def);
|
|
4357
4589
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4590
|
+
}, /*@__PURE__*/ derived({
|
|
4591
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
4592
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
4593
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
4362
4594
|
}, {
|
|
4363
4595
|
regex(...args) {
|
|
4364
4596
|
return this.check(/* @__PURE__ */ _regex(...args));
|
|
@@ -4405,7 +4637,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
4405
4637
|
slugify() {
|
|
4406
4638
|
return this.check(/* @__PURE__ */ _slugify());
|
|
4407
4639
|
}
|
|
4408
|
-
});
|
|
4640
|
+
}));
|
|
4409
4641
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
4410
4642
|
$ZodString.init(inst, def);
|
|
4411
4643
|
_ZodString.init(inst, def);
|
|
@@ -4597,12 +4829,21 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
4597
4829
|
$ZodNumber.init(inst, def);
|
|
4598
4830
|
ZodType.init(inst, def);
|
|
4599
4831
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
4600
|
-
const bag = inst._zod.bag;
|
|
4601
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
4602
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
4603
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
4604
4832
|
inst.isFinite = true;
|
|
4605
|
-
|
|
4833
|
+
}, /*@__PURE__*/ derived({
|
|
4834
|
+
minValue: (inst) => {
|
|
4835
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
4836
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
4837
|
+
},
|
|
4838
|
+
maxValue: (inst) => {
|
|
4839
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
4840
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
4841
|
+
},
|
|
4842
|
+
isInt: (inst) => {
|
|
4843
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
4844
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
4845
|
+
},
|
|
4846
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
4606
4847
|
}, {
|
|
4607
4848
|
gt(value, params) {
|
|
4608
4849
|
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
@@ -4649,7 +4890,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
4649
4890
|
finite() {
|
|
4650
4891
|
return this;
|
|
4651
4892
|
}
|
|
4652
|
-
});
|
|
4893
|
+
}));
|
|
4653
4894
|
function number(params) {
|
|
4654
4895
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
4655
4896
|
}
|
|
@@ -4721,34 +4962,19 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
|
4721
4962
|
return _enum(Object.keys(this._zod.def.shape));
|
|
4722
4963
|
},
|
|
4723
4964
|
catchall(catchall) {
|
|
4724
|
-
return this.clone({
|
|
4725
|
-
...this._zod.def,
|
|
4726
|
-
catchall
|
|
4727
|
-
});
|
|
4965
|
+
return this.clone(mergeDefs(this._zod.def, { catchall }));
|
|
4728
4966
|
},
|
|
4729
4967
|
passthrough() {
|
|
4730
|
-
return this.clone({
|
|
4731
|
-
...this._zod.def,
|
|
4732
|
-
catchall: unknown()
|
|
4733
|
-
});
|
|
4968
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
4734
4969
|
},
|
|
4735
4970
|
loose() {
|
|
4736
|
-
return this.clone({
|
|
4737
|
-
...this._zod.def,
|
|
4738
|
-
catchall: unknown()
|
|
4739
|
-
});
|
|
4971
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
4740
4972
|
},
|
|
4741
4973
|
strict() {
|
|
4742
|
-
return this.clone({
|
|
4743
|
-
...this._zod.def,
|
|
4744
|
-
catchall: never()
|
|
4745
|
-
});
|
|
4974
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
4746
4975
|
},
|
|
4747
4976
|
strip() {
|
|
4748
|
-
return this.clone({
|
|
4749
|
-
...this._zod.def,
|
|
4750
|
-
catchall: void 0
|
|
4751
|
-
});
|
|
4977
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
|
|
4752
4978
|
},
|
|
4753
4979
|
extend(incoming) {
|
|
4754
4980
|
return extend(this, incoming);
|
|
@@ -4813,7 +5039,7 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
|
4813
5039
|
ZodType.init(inst, def);
|
|
4814
5040
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
4815
5041
|
inst.enum = def.entries;
|
|
4816
|
-
inst.options =
|
|
5042
|
+
inst.options = [...inst._zod.values];
|
|
4817
5043
|
const keys = new Set(Object.keys(def.entries));
|
|
4818
5044
|
inst.extract = (values, params) => {
|
|
4819
5045
|
const newEntries = {};
|