@neta-art/cohub-cli 9.1.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/board-kernel.js +583 -382
- package/dist/network-error.d.ts +3 -0
- package/dist/network-error.js +22 -0
- package/dist/output.js +4 -9
- package/dist/runtime/connection.js +2 -1
- package/dist/runtime/native/execution.js +3 -2
- package/dist/safe-remote-image.d.ts +5 -1
- package/dist/safe-remote-image.js +16 -8
- package/package.json +4 -4
package/dist/board-kernel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as groupD8, A as bgr2rgb, B as Bounds, C as Sprite, D as TexturePool, E as RenderGroup, G as TextureStyle, H as Texture, I as BigPool, J as deprecation, K as definedProps, L as GlobalResourceRegistry, M as multiplyHexColors, N as getGlobalBounds, O as InstructionSet, P as FilterEffect, Q as Rectangle, R as warn, S as DOMAdapter, T as Container, U as TextureMatrix, V as updateQuadBounds, W as TextureSource, X as v8_3_4, Y as v8_0_0, Z as uid$1, _ as Cache, a as Geometry, at as extensions, b as ImageSource, c as Filter, d as RendererType, et as Matrix, f as BindGroup, g as getTestContext, h as GlProgram, i as canUseNewCanvasBlendModes, it as ExtensionType, j as multiplyColors, k as getLocalBounds, l as State, m as GpuProgram, n as CanvasPool, nt as eventemitter3_default, o as Buffer$1, p as UniformGroup, q as nextPow2, r as canvasUtils, rt as ObservablePoint, s as BufferUsage, t as getPo2TextureFromSource, tt as Point, u as Shader, v as Ticker, w as ViewContainer, x as CanvasSource, z as Color } from "./board-kernel/getPo2TextureFromSource.js";
|
|
2
2
|
import { Script, createContext } from "node:vm";
|
|
3
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
3
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
|
|
4
4
|
function getEnumValues(entries) {
|
|
5
5
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
6
6
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -12,14 +12,22 @@ function jsonStringifyReplacer(_, value) {
|
|
|
12
12
|
if (typeof value === "bigint") return value.toString();
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
var Cached = class {
|
|
16
|
+
constructor(getter) {
|
|
17
|
+
this._getter = getter;
|
|
18
|
+
this._value = void 0;
|
|
19
|
+
}
|
|
20
|
+
get value() {
|
|
21
|
+
const getter = this._getter;
|
|
22
|
+
if (getter !== void 0) {
|
|
23
|
+
this._value = getter();
|
|
24
|
+
this._getter = void 0;
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
return this._value;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function cached(getter) {
|
|
30
|
+
return new Cached(getter);
|
|
23
31
|
}
|
|
24
32
|
function nullish(input) {
|
|
25
33
|
return input === null || input === void 0;
|
|
@@ -44,6 +52,58 @@ function assignProp(target, prop, value) {
|
|
|
44
52
|
configurable: true
|
|
45
53
|
});
|
|
46
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
57
|
+
*
|
|
58
|
+
* 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.
|
|
59
|
+
*/
|
|
60
|
+
function rawShape(def) {
|
|
61
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
62
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
63
|
+
}
|
|
64
|
+
function sourceShape(schema) {
|
|
65
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
66
|
+
}
|
|
67
|
+
function deferProp(target, key, getter) {
|
|
68
|
+
Object.defineProperty(target, key, {
|
|
69
|
+
get() {
|
|
70
|
+
const value = getter();
|
|
71
|
+
assignProp(this, key, value);
|
|
72
|
+
return value;
|
|
73
|
+
},
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function putProp(target, key, value) {
|
|
79
|
+
if (key in target) assignProp(target, key, value);
|
|
80
|
+
else target[key] = value;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
84
|
+
*
|
|
85
|
+
* 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.
|
|
86
|
+
*/
|
|
87
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
88
|
+
const raw = sourceShape(source);
|
|
89
|
+
for (const key of keys) {
|
|
90
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
91
|
+
if (!desc.enumerable) continue;
|
|
92
|
+
if (desc.get) deferProp(target, key, () => {
|
|
93
|
+
const value = source._zod.def.shape[key];
|
|
94
|
+
return wrap ? wrap(value, key) : value;
|
|
95
|
+
});
|
|
96
|
+
else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function mirrorProps(target, source) {
|
|
100
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
101
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
102
|
+
if (!desc.enumerable) continue;
|
|
103
|
+
if (desc.get) deferProp(target, key, () => source[key]);
|
|
104
|
+
else putProp(target, key, desc.value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
47
107
|
function mergeDefs(...defs) {
|
|
48
108
|
const mergedDescriptors = {};
|
|
49
109
|
for (const def of defs) {
|
|
@@ -134,39 +194,39 @@ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
|
134
194
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
135
195
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
136
196
|
}))();
|
|
197
|
+
const BIGINT_FORMAT_RANGES = {
|
|
198
|
+
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
199
|
+
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
|
|
200
|
+
};
|
|
137
201
|
function pick(schema, mask) {
|
|
138
202
|
const currDef = schema._zod.def;
|
|
139
203
|
const checks = currDef.checks;
|
|
140
204
|
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
146
|
-
if (!mask[key]) continue;
|
|
147
|
-
assignProp(newShape, key, currDef.shape[key]);
|
|
148
|
-
}
|
|
149
|
-
assignProp(this, "shape", newShape);
|
|
150
|
-
return newShape;
|
|
151
|
-
},
|
|
205
|
+
const newShape = {};
|
|
206
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
207
|
+
return clone(schema, mergeDefs(currDef, {
|
|
208
|
+
shape: newShape,
|
|
152
209
|
checks: []
|
|
153
210
|
}));
|
|
154
211
|
}
|
|
212
|
+
function maskedKeys(schema, mask) {
|
|
213
|
+
const raw = sourceShape(schema);
|
|
214
|
+
const keys = [];
|
|
215
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
216
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
217
|
+
if (mask[key]) keys.push(key);
|
|
218
|
+
}
|
|
219
|
+
return keys;
|
|
220
|
+
}
|
|
155
221
|
function omit(schema, mask) {
|
|
156
222
|
const currDef = schema._zod.def;
|
|
157
223
|
const checks = currDef.checks;
|
|
158
224
|
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (!mask[key]) continue;
|
|
165
|
-
delete newShape[key];
|
|
166
|
-
}
|
|
167
|
-
assignProp(this, "shape", newShape);
|
|
168
|
-
return newShape;
|
|
169
|
-
},
|
|
225
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
226
|
+
const newShape = {};
|
|
227
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
228
|
+
return clone(schema, mergeDefs(currDef, {
|
|
229
|
+
shape: newShape,
|
|
170
230
|
checks: []
|
|
171
231
|
}));
|
|
172
232
|
}
|
|
@@ -174,41 +234,29 @@ function extend(schema, shape) {
|
|
|
174
234
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
175
235
|
const checks = schema._zod.def.checks;
|
|
176
236
|
if (checks && checks.length > 0) {
|
|
177
|
-
const existingShape = schema
|
|
237
|
+
const existingShape = sourceShape(schema);
|
|
178
238
|
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.");
|
|
179
239
|
}
|
|
180
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} }));
|
|
240
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
241
|
+
}
|
|
242
|
+
function extended(schema, shape) {
|
|
243
|
+
const newShape = {};
|
|
244
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
245
|
+
mirrorProps(newShape, shape);
|
|
246
|
+
return newShape;
|
|
188
247
|
}
|
|
189
248
|
function safeExtend(schema, shape) {
|
|
190
249
|
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
191
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
192
|
-
const _shape = {
|
|
193
|
-
...schema._zod.def.shape,
|
|
194
|
-
...shape
|
|
195
|
-
};
|
|
196
|
-
assignProp(this, "shape", _shape);
|
|
197
|
-
return _shape;
|
|
198
|
-
} }));
|
|
250
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
199
251
|
}
|
|
200
252
|
function merge(a, b) {
|
|
201
253
|
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
202
254
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
255
|
+
const newShape = {};
|
|
256
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
257
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
203
258
|
return clone(a, mergeDefs(a._zod.def, {
|
|
204
|
-
|
|
205
|
-
const _shape = {
|
|
206
|
-
...a._zod.def.shape,
|
|
207
|
-
...b._zod.def.shape
|
|
208
|
-
};
|
|
209
|
-
assignProp(this, "shape", _shape);
|
|
210
|
-
return _shape;
|
|
211
|
-
},
|
|
259
|
+
shape: newShape,
|
|
212
260
|
get catchall() {
|
|
213
261
|
return b._zod.def.catchall;
|
|
214
262
|
},
|
|
@@ -218,47 +266,25 @@ function merge(a, b) {
|
|
|
218
266
|
function partial(Class, schema, mask, name = "partial") {
|
|
219
267
|
const checks = schema._zod.def.checks;
|
|
220
268
|
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
269
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
270
|
+
const newShape = {};
|
|
271
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
|
|
272
|
+
type: "optional",
|
|
273
|
+
innerType: value
|
|
274
|
+
})));
|
|
221
275
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
222
|
-
|
|
223
|
-
const oldShape = schema._zod.def.shape;
|
|
224
|
-
const shape = { ...oldShape };
|
|
225
|
-
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
226
|
-
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
227
|
-
if (!mask[key]) continue;
|
|
228
|
-
shape[key] = Class ? new Class({
|
|
229
|
-
type: "optional",
|
|
230
|
-
innerType: oldShape[key]
|
|
231
|
-
}) : oldShape[key];
|
|
232
|
-
}
|
|
233
|
-
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
234
|
-
type: "optional",
|
|
235
|
-
innerType: oldShape[key]
|
|
236
|
-
}) : oldShape[key];
|
|
237
|
-
assignProp(this, "shape", shape);
|
|
238
|
-
return shape;
|
|
239
|
-
},
|
|
276
|
+
shape: newShape,
|
|
240
277
|
checks: []
|
|
241
278
|
}));
|
|
242
279
|
}
|
|
243
280
|
function required(Class, schema, mask) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
type: "nonoptional",
|
|
252
|
-
innerType: oldShape[key]
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
256
|
-
type: "nonoptional",
|
|
257
|
-
innerType: oldShape[key]
|
|
258
|
-
});
|
|
259
|
-
assignProp(this, "shape", shape);
|
|
260
|
-
return shape;
|
|
261
|
-
} }));
|
|
281
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
282
|
+
const newShape = {};
|
|
283
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
|
|
284
|
+
type: "nonoptional",
|
|
285
|
+
innerType: value
|
|
286
|
+
}));
|
|
287
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
262
288
|
}
|
|
263
289
|
function aborted(x, startIndex = 0) {
|
|
264
290
|
if (x.aborted === true) return true;
|
|
@@ -294,11 +320,15 @@ function finalizeIssue(iss, ctx, config) {
|
|
|
294
320
|
}
|
|
295
321
|
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
296
322
|
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";
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
323
|
+
const full = {};
|
|
324
|
+
for (const k of Object.keys(iss)) {
|
|
325
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
326
|
+
full[k] = iss[k];
|
|
327
|
+
}
|
|
328
|
+
full.path ?? (full.path = []);
|
|
329
|
+
full.message = message;
|
|
330
|
+
if (ctx?.reportInput) full.input = iss.input;
|
|
331
|
+
return full;
|
|
302
332
|
}
|
|
303
333
|
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
304
334
|
function codePointLength(str) {
|
|
@@ -368,6 +398,23 @@ function own(inst, key, value, enumerable = true) {
|
|
|
368
398
|
function hide(inst, key, value) {
|
|
369
399
|
return own(inst, key, value, false);
|
|
370
400
|
}
|
|
401
|
+
/** 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. */
|
|
402
|
+
function derived(computes, table) {
|
|
403
|
+
for (const key in computes) {
|
|
404
|
+
const compute = computes[key];
|
|
405
|
+
Object.defineProperty(table, key, {
|
|
406
|
+
configurable: true,
|
|
407
|
+
enumerable: true,
|
|
408
|
+
get() {
|
|
409
|
+
return own(this, key, compute(this));
|
|
410
|
+
},
|
|
411
|
+
set(value) {
|
|
412
|
+
own(this, key, value);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return table;
|
|
417
|
+
}
|
|
371
418
|
function defineBound(proto, key, fn) {
|
|
372
419
|
Object.defineProperty(proto, key, {
|
|
373
420
|
configurable: true,
|
|
@@ -476,9 +523,9 @@ function constantCatch(value) {
|
|
|
476
523
|
return fn;
|
|
477
524
|
}
|
|
478
525
|
//#endregion
|
|
479
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
526
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
|
|
480
527
|
var _a$1;
|
|
481
|
-
const _zodDesc
|
|
528
|
+
const _zodDesc = {
|
|
482
529
|
value: void 0,
|
|
483
530
|
enumerable: false
|
|
484
531
|
};
|
|
@@ -515,14 +562,13 @@ function $constructor(name, initializer, proto, params) {
|
|
|
515
562
|
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
516
563
|
function init(inst, def) {
|
|
517
564
|
if (!inst._zod) {
|
|
518
|
-
_zodDesc
|
|
565
|
+
_zodDesc.value = new Internals(def);
|
|
519
566
|
try {
|
|
520
|
-
Object.defineProperty(inst, "_zod", _zodDesc
|
|
567
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
521
568
|
} finally {
|
|
522
|
-
_zodDesc
|
|
569
|
+
_zodDesc.value = void 0;
|
|
523
570
|
}
|
|
524
|
-
}
|
|
525
|
-
if (inst._zod.traits.has(name)) return;
|
|
571
|
+
} else if (inst._zod.traits.has(name)) return;
|
|
526
572
|
inst._zod.traits.add(name);
|
|
527
573
|
initializer(inst, def);
|
|
528
574
|
if (initialized) {
|
|
@@ -583,7 +629,7 @@ function config(newConfig) {
|
|
|
583
629
|
return globalConfig;
|
|
584
630
|
}
|
|
585
631
|
//#endregion
|
|
586
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
632
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
|
|
587
633
|
function _getMessage() {
|
|
588
634
|
const internals = this._zod;
|
|
589
635
|
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
@@ -598,10 +644,6 @@ const _messageDesc = {
|
|
|
598
644
|
enumerable: true,
|
|
599
645
|
configurable: true
|
|
600
646
|
};
|
|
601
|
-
const _zodDesc = {
|
|
602
|
-
value: void 0,
|
|
603
|
-
enumerable: false
|
|
604
|
-
};
|
|
605
647
|
const _issuesDesc = {
|
|
606
648
|
value: void 0,
|
|
607
649
|
enumerable: false
|
|
@@ -609,11 +651,8 @@ const _issuesDesc = {
|
|
|
609
651
|
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
610
652
|
const initializer$1 = (inst, def) => {
|
|
611
653
|
inst.name = "$ZodError";
|
|
612
|
-
_zodDesc.value = inst._zod;
|
|
613
|
-
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
614
654
|
_issuesDesc.value = def;
|
|
615
655
|
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
616
|
-
_zodDesc.value = void 0;
|
|
617
656
|
_issuesDesc.value = void 0;
|
|
618
657
|
Object.defineProperty(inst, "message", _messageDesc);
|
|
619
658
|
const proto = Object.getPrototypeOf(inst);
|
|
@@ -642,7 +681,7 @@ const initializer$1 = (inst, def) => {
|
|
|
642
681
|
}
|
|
643
682
|
};
|
|
644
683
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
645
|
-
|
|
684
|
+
$constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
646
685
|
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
647
686
|
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
648
687
|
* "__proto__" would hit the setter instead of creating a key. */
|
|
@@ -706,7 +745,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
706
745
|
return fieldErrors;
|
|
707
746
|
}
|
|
708
747
|
//#endregion
|
|
709
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
748
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
|
|
710
749
|
function finalizeParams(callee, params) {
|
|
711
750
|
return {
|
|
712
751
|
callee: params?.callee ?? callee,
|
|
@@ -763,15 +802,30 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
763
802
|
issues: []
|
|
764
803
|
}, ctx);
|
|
765
804
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
766
|
-
return result.issues.length ? {
|
|
767
|
-
success: false,
|
|
768
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
769
|
-
} : {
|
|
805
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
770
806
|
success: true,
|
|
771
807
|
data: result.value
|
|
772
808
|
};
|
|
773
809
|
};
|
|
774
|
-
|
|
810
|
+
function failure(Err, issues, ctx) {
|
|
811
|
+
let error;
|
|
812
|
+
return {
|
|
813
|
+
success: false,
|
|
814
|
+
get error() {
|
|
815
|
+
if (!error) {
|
|
816
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
817
|
+
issues = void 0;
|
|
818
|
+
ctx = void 0;
|
|
819
|
+
}
|
|
820
|
+
return error;
|
|
821
|
+
},
|
|
822
|
+
set error(e) {
|
|
823
|
+
error = e;
|
|
824
|
+
issues = void 0;
|
|
825
|
+
ctx = void 0;
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
}
|
|
775
829
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
776
830
|
const ctx = _ctx ? {
|
|
777
831
|
..._ctx,
|
|
@@ -782,15 +836,61 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
782
836
|
issues: []
|
|
783
837
|
}, ctx);
|
|
784
838
|
if (result instanceof Promise) result = await result;
|
|
785
|
-
return result.issues.length ? {
|
|
786
|
-
success: false,
|
|
787
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
788
|
-
} : {
|
|
839
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
789
840
|
success: true,
|
|
790
841
|
data: result.value
|
|
791
842
|
};
|
|
792
843
|
};
|
|
793
|
-
const
|
|
844
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
845
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
846
|
+
const validate = ((schema, value, _ctx) => {
|
|
847
|
+
const validator = schema._zod.bag.validator;
|
|
848
|
+
if (validator !== void 0) {
|
|
849
|
+
if (validator(value) !== COMPILE_INVALID) return true;
|
|
850
|
+
if (validator.definite === true && _ctx === void 0) return false;
|
|
851
|
+
}
|
|
852
|
+
return validateFallback(schema, value, _ctx);
|
|
853
|
+
});
|
|
854
|
+
function validateFallback(schema, value, _ctx) {
|
|
855
|
+
const ctx = _ctx ? {
|
|
856
|
+
..._ctx,
|
|
857
|
+
async: false,
|
|
858
|
+
abortEarly: true
|
|
859
|
+
} : {
|
|
860
|
+
async: false,
|
|
861
|
+
abortEarly: true
|
|
862
|
+
};
|
|
863
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
864
|
+
let result;
|
|
865
|
+
if (fallbackRun) {
|
|
866
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
867
|
+
result = fallbackRun({
|
|
868
|
+
value,
|
|
869
|
+
issues: []
|
|
870
|
+
}, ctx);
|
|
871
|
+
} else result = schema._zod.run({
|
|
872
|
+
value,
|
|
873
|
+
issues: []
|
|
874
|
+
}, ctx);
|
|
875
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
876
|
+
return result.issues.length === 0;
|
|
877
|
+
}
|
|
878
|
+
const validateAsync$1 = async (schema, value, _ctx) => {
|
|
879
|
+
const ctx = _ctx ? {
|
|
880
|
+
..._ctx,
|
|
881
|
+
async: true,
|
|
882
|
+
abortEarly: true
|
|
883
|
+
} : {
|
|
884
|
+
async: true,
|
|
885
|
+
abortEarly: true
|
|
886
|
+
};
|
|
887
|
+
let result = schema._zod.run({
|
|
888
|
+
value,
|
|
889
|
+
issues: []
|
|
890
|
+
}, ctx);
|
|
891
|
+
if (result instanceof Promise) result = await result;
|
|
892
|
+
return result.issues.length === 0;
|
|
893
|
+
};
|
|
794
894
|
const _encode = (_Err) => {
|
|
795
895
|
const parse = _parse(_Err);
|
|
796
896
|
const fn = (schema, value, _ctx, _params) => {
|
|
@@ -848,7 +948,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
848
948
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
849
949
|
};
|
|
850
950
|
//#endregion
|
|
851
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
951
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
|
|
852
952
|
/**
|
|
853
953
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
854
954
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -875,8 +975,8 @@ const uuid = (version) => {
|
|
|
875
975
|
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})$`);
|
|
876
976
|
};
|
|
877
977
|
/** Practical email validation */
|
|
878
|
-
const email = /^(
|
|
879
|
-
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
978
|
+
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,}$/;
|
|
979
|
+
const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
880
980
|
function emoji() {
|
|
881
981
|
return new RegExp(_emoji$1, "u");
|
|
882
982
|
}
|
|
@@ -885,7 +985,7 @@ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:
|
|
|
885
985
|
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])$/;
|
|
886
986
|
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])$/;
|
|
887
987
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
888
|
-
const base64url = /^[A-Za-z0-9_-]
|
|
988
|
+
const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
889
989
|
const httpProtocol = /^https?$/;
|
|
890
990
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
891
991
|
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])))`;
|
|
@@ -913,17 +1013,14 @@ function datetime(args) {
|
|
|
913
1013
|
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
914
1014
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
915
1015
|
}
|
|
916
|
-
const
|
|
917
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
918
|
-
return new RegExp(`^${regex}$`);
|
|
919
|
-
};
|
|
1016
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
920
1017
|
const integer = /^-?\d+$/;
|
|
921
1018
|
const number$2 = /^-?\d+(?:\.\d+)?$/;
|
|
922
1019
|
const boolean$1 = /^(?:true|false)$/i;
|
|
923
1020
|
const lowercase = /^[^A-Z]*$/;
|
|
924
1021
|
const uppercase = /^[^a-z]*$/;
|
|
925
1022
|
//#endregion
|
|
926
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
1023
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
|
|
927
1024
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
928
1025
|
var _a;
|
|
929
1026
|
inst._zod ?? (inst._zod = {});
|
|
@@ -943,14 +1040,6 @@ const numericOriginMap = {
|
|
|
943
1040
|
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
944
1041
|
$ZodCheck.init(inst, def);
|
|
945
1042
|
const origin = numericOriginMap[typeof def.value];
|
|
946
|
-
inst._zod.onattach.push((inst) => {
|
|
947
|
-
const bag = inst._zod.bag;
|
|
948
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
949
|
-
if (def.value < curr) {
|
|
950
|
-
if (def.inclusive) bag.maximum = def.value;
|
|
951
|
-
else bag.exclusiveMaximum = def.value;
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
1043
|
inst._zod.check = (payload) => {
|
|
955
1044
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
956
1045
|
payload.issues.push({
|
|
@@ -967,14 +1056,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
|
|
|
967
1056
|
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
968
1057
|
$ZodCheck.init(inst, def);
|
|
969
1058
|
const origin = numericOriginMap[typeof def.value];
|
|
970
|
-
inst._zod.onattach.push((inst) => {
|
|
971
|
-
const bag = inst._zod.bag;
|
|
972
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
973
|
-
if (def.value > curr) {
|
|
974
|
-
if (def.inclusive) bag.minimum = def.value;
|
|
975
|
-
else bag.exclusiveMinimum = def.value;
|
|
976
|
-
}
|
|
977
|
-
});
|
|
978
1059
|
inst._zod.check = (payload) => {
|
|
979
1060
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
980
1061
|
payload.issues.push({
|
|
@@ -990,10 +1071,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
|
|
|
990
1071
|
});
|
|
991
1072
|
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
992
1073
|
$ZodCheck.init(inst, def);
|
|
993
|
-
inst._zod.onattach.push((inst) => {
|
|
994
|
-
var _a;
|
|
995
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
996
|
-
});
|
|
997
1074
|
inst._zod.check = (payload) => {
|
|
998
1075
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
999
1076
|
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
@@ -1013,13 +1090,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
1013
1090
|
const isInt = def.format?.includes("int");
|
|
1014
1091
|
const origin = isInt ? "int" : "number";
|
|
1015
1092
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1016
|
-
inst._zod.onattach.push((inst) => {
|
|
1017
|
-
const bag = inst._zod.bag;
|
|
1018
|
-
bag.format = def.format;
|
|
1019
|
-
bag.minimum = minimum;
|
|
1020
|
-
bag.maximum = maximum;
|
|
1021
|
-
if (isInt) bag.pattern = integer;
|
|
1022
|
-
});
|
|
1023
1093
|
inst._zod.check = (payload) => {
|
|
1024
1094
|
const input = payload.value;
|
|
1025
1095
|
if (isInt) {
|
|
@@ -1082,10 +1152,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
1082
1152
|
var _a;
|
|
1083
1153
|
$ZodCheck.init(inst, def);
|
|
1084
1154
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1085
|
-
inst._zod.onattach.push((inst) => {
|
|
1086
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1087
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
1088
|
-
});
|
|
1089
1155
|
inst._zod.check = (payload) => {
|
|
1090
1156
|
const input = payload.value;
|
|
1091
1157
|
const units = input.length;
|
|
@@ -1106,10 +1172,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
1106
1172
|
var _a;
|
|
1107
1173
|
$ZodCheck.init(inst, def);
|
|
1108
1174
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1109
|
-
inst._zod.onattach.push((inst) => {
|
|
1110
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1111
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
1112
|
-
});
|
|
1113
1175
|
inst._zod.check = (payload) => {
|
|
1114
1176
|
const input = payload.value;
|
|
1115
1177
|
const units = input.length;
|
|
@@ -1130,12 +1192,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
1130
1192
|
var _a;
|
|
1131
1193
|
$ZodCheck.init(inst, def);
|
|
1132
1194
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
1133
|
-
inst._zod.onattach.push((inst) => {
|
|
1134
|
-
const bag = inst._zod.bag;
|
|
1135
|
-
bag.minimum = def.length;
|
|
1136
|
-
bag.maximum = def.length;
|
|
1137
|
-
bag.length = def.length;
|
|
1138
|
-
});
|
|
1139
1195
|
inst._zod.check = (payload) => {
|
|
1140
1196
|
const input = payload.value;
|
|
1141
1197
|
const units = input.length;
|
|
@@ -1163,14 +1219,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
1163
1219
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1164
1220
|
var _a, _b;
|
|
1165
1221
|
$ZodCheck.init(inst, def);
|
|
1166
|
-
inst._zod.onattach.push((inst) => {
|
|
1167
|
-
const bag = inst._zod.bag;
|
|
1168
|
-
bag.format = def.format;
|
|
1169
|
-
if (def.pattern) {
|
|
1170
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1171
|
-
bag.patterns.add(def.pattern);
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
1222
|
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1175
1223
|
def.pattern.lastIndex = 0;
|
|
1176
1224
|
if (def.pattern.test(payload.value)) return;
|
|
@@ -1213,13 +1261,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1213
1261
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1214
1262
|
$ZodCheck.init(inst, def);
|
|
1215
1263
|
const escapedRegex = escapeRegex(def.includes);
|
|
1216
|
-
|
|
1217
|
-
def.pattern = pattern;
|
|
1218
|
-
inst._zod.onattach.push((inst) => {
|
|
1219
|
-
const bag = inst._zod.bag;
|
|
1220
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1221
|
-
bag.patterns.add(pattern);
|
|
1222
|
-
});
|
|
1264
|
+
def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1223
1265
|
inst._zod.check = (payload) => {
|
|
1224
1266
|
if (payload.value.includes(def.includes, def.position)) return;
|
|
1225
1267
|
payload.issues.push({
|
|
@@ -1237,11 +1279,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
|
|
|
1237
1279
|
$ZodCheck.init(inst, def);
|
|
1238
1280
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1239
1281
|
def.pattern ?? (def.pattern = pattern);
|
|
1240
|
-
inst._zod.onattach.push((inst) => {
|
|
1241
|
-
const bag = inst._zod.bag;
|
|
1242
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1243
|
-
bag.patterns.add(pattern);
|
|
1244
|
-
});
|
|
1245
1282
|
inst._zod.check = (payload) => {
|
|
1246
1283
|
if (payload.value.startsWith(def.prefix)) return;
|
|
1247
1284
|
payload.issues.push({
|
|
@@ -1259,11 +1296,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
1259
1296
|
$ZodCheck.init(inst, def);
|
|
1260
1297
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1261
1298
|
def.pattern ?? (def.pattern = pattern);
|
|
1262
|
-
inst._zod.onattach.push((inst) => {
|
|
1263
|
-
const bag = inst._zod.bag;
|
|
1264
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1265
|
-
bag.patterns.add(pattern);
|
|
1266
|
-
});
|
|
1267
1299
|
inst._zod.check = (payload) => {
|
|
1268
1300
|
if (payload.value.endsWith(def.suffix)) return;
|
|
1269
1301
|
payload.issues.push({
|
|
@@ -1284,7 +1316,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1284
1316
|
};
|
|
1285
1317
|
});
|
|
1286
1318
|
//#endregion
|
|
1287
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
1319
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
|
|
1288
1320
|
var Doc = class {
|
|
1289
1321
|
constructor(args = [], closed = {}) {
|
|
1290
1322
|
this.content = [];
|
|
@@ -1294,8 +1326,11 @@ var Doc = class {
|
|
|
1294
1326
|
}
|
|
1295
1327
|
indented(fn) {
|
|
1296
1328
|
this.indent += 1;
|
|
1297
|
-
|
|
1298
|
-
|
|
1329
|
+
try {
|
|
1330
|
+
fn(this);
|
|
1331
|
+
} finally {
|
|
1332
|
+
this.indent -= 1;
|
|
1333
|
+
}
|
|
1299
1334
|
}
|
|
1300
1335
|
write(arg) {
|
|
1301
1336
|
if (typeof arg === "function") {
|
|
@@ -1315,14 +1350,14 @@ var Doc = class {
|
|
|
1315
1350
|
}
|
|
1316
1351
|
};
|
|
1317
1352
|
//#endregion
|
|
1318
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
1353
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
|
|
1319
1354
|
const version = {
|
|
1320
1355
|
major: 4,
|
|
1321
|
-
minor:
|
|
1322
|
-
patch:
|
|
1356
|
+
minor: 6,
|
|
1357
|
+
patch: 5
|
|
1323
1358
|
};
|
|
1324
1359
|
//#endregion
|
|
1325
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
1360
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
|
|
1326
1361
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1327
1362
|
var _a;
|
|
1328
1363
|
inst ?? (inst = {});
|
|
@@ -1411,15 +1446,26 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1411
1446
|
}
|
|
1412
1447
|
});
|
|
1413
1448
|
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1414
|
-
const toStandardResult = (r) => r.
|
|
1449
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1450
|
+
async function validateAsync(inst, value) {
|
|
1451
|
+
const ctx = { async: true };
|
|
1452
|
+
return toStandardResult(await inst._zod.run({
|
|
1453
|
+
value,
|
|
1454
|
+
issues: []
|
|
1455
|
+
}, ctx), ctx);
|
|
1456
|
+
}
|
|
1415
1457
|
function standardProps(inst) {
|
|
1416
1458
|
return {
|
|
1417
1459
|
validate: (value) => {
|
|
1460
|
+
const ctx = { async: false };
|
|
1418
1461
|
try {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1462
|
+
const r = inst._zod.run({
|
|
1463
|
+
value,
|
|
1464
|
+
issues: []
|
|
1465
|
+
}, ctx);
|
|
1466
|
+
if (!(r instanceof Promise)) return toStandardResult(r, ctx);
|
|
1467
|
+
} catch (_) {}
|
|
1468
|
+
return validateAsync(inst, value);
|
|
1423
1469
|
},
|
|
1424
1470
|
vendor: "zod",
|
|
1425
1471
|
version: 1
|
|
@@ -1427,7 +1473,7 @@ function standardProps(inst) {
|
|
|
1427
1473
|
}
|
|
1428
1474
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1429
1475
|
$ZodType.init(inst, def);
|
|
1430
|
-
inst._zod.pattern =
|
|
1476
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
1431
1477
|
inst._zod.parse = (payload, _) => {
|
|
1432
1478
|
if (def.coerce) try {
|
|
1433
1479
|
payload.value = String(payload.value);
|
|
@@ -1471,10 +1517,27 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1471
1517
|
def.pattern ?? (def.pattern = email);
|
|
1472
1518
|
$ZodStringFormat.init(inst, def);
|
|
1473
1519
|
});
|
|
1474
|
-
|
|
1520
|
+
function canParseURL(input) {
|
|
1521
|
+
try {
|
|
1522
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
|
|
1523
|
+
new URL(input);
|
|
1524
|
+
return true;
|
|
1525
|
+
} catch {
|
|
1526
|
+
return false;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
function validateURL(trimmed, def) {
|
|
1530
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
|
|
1531
|
+
return parseURLObject(trimmed, def);
|
|
1532
|
+
}
|
|
1533
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
1475
1534
|
function parseURLObject(trimmed, def) {
|
|
1476
1535
|
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1477
1536
|
try {
|
|
1537
|
+
if (typeof URL !== "undefined") {
|
|
1538
|
+
const URLStatic = URL;
|
|
1539
|
+
if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
|
|
1540
|
+
}
|
|
1478
1541
|
return new URL(trimmed);
|
|
1479
1542
|
} catch {
|
|
1480
1543
|
return 2;
|
|
@@ -1498,7 +1561,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1498
1561
|
inst._zod.check = (payload) => {
|
|
1499
1562
|
try {
|
|
1500
1563
|
const trimmed = payload.value.trim();
|
|
1501
|
-
const url =
|
|
1564
|
+
const url = validateURL(trimmed, def);
|
|
1502
1565
|
if (url === 1) {
|
|
1503
1566
|
payload.issues.push({
|
|
1504
1567
|
code: "invalid_format",
|
|
@@ -1520,6 +1583,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1520
1583
|
});
|
|
1521
1584
|
return;
|
|
1522
1585
|
}
|
|
1586
|
+
if (url === true) {
|
|
1587
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1523
1590
|
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1524
1591
|
code: "invalid_format",
|
|
1525
1592
|
format: "url",
|
|
@@ -1588,12 +1655,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1588
1655
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1589
1656
|
def.pattern ?? (def.pattern = datetime(def));
|
|
1590
1657
|
$ZodStringFormat.init(inst, def);
|
|
1591
|
-
if (def.local || def.precision === -1) {
|
|
1592
|
-
inst._zod.bag.laxFormat = true;
|
|
1593
|
-
inst._zod.onattach.push((s) => {
|
|
1594
|
-
s._zod.bag.laxFormat = true;
|
|
1595
|
-
});
|
|
1596
|
-
}
|
|
1597
1658
|
});
|
|
1598
1659
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1599
1660
|
def.pattern ?? (def.pattern = date);
|
|
@@ -1610,23 +1671,16 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
|
|
|
1610
1671
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1611
1672
|
def.pattern ?? (def.pattern = ipv4);
|
|
1612
1673
|
$ZodStringFormat.init(inst, def);
|
|
1613
|
-
inst._zod.bag.format = `ipv4`;
|
|
1614
1674
|
});
|
|
1615
1675
|
/** 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`. */
|
|
1616
1676
|
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1617
1677
|
function isValidIPv6(value) {
|
|
1618
1678
|
if (!ipv6Alphabet.test(value)) return false;
|
|
1619
|
-
|
|
1620
|
-
new URL(`http://[${value}]`);
|
|
1621
|
-
return true;
|
|
1622
|
-
} catch {
|
|
1623
|
-
return false;
|
|
1624
|
-
}
|
|
1679
|
+
return canParseURL(`http://[${value}]`);
|
|
1625
1680
|
}
|
|
1626
1681
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1627
1682
|
def.pattern ?? (def.pattern = ipv6);
|
|
1628
1683
|
$ZodStringFormat.init(inst, def);
|
|
1629
|
-
inst._zod.bag.format = `ipv6`;
|
|
1630
1684
|
inst._zod.check = (payload) => {
|
|
1631
1685
|
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1632
1686
|
code: "invalid_format",
|
|
@@ -1675,10 +1729,10 @@ function isValidBase64(data) {
|
|
|
1675
1729
|
return false;
|
|
1676
1730
|
}
|
|
1677
1731
|
}
|
|
1732
|
+
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1678
1733
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1679
|
-
def.pattern ?? (def.pattern =
|
|
1734
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
1680
1735
|
$ZodStringFormat.init(inst, def);
|
|
1681
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1682
1736
|
inst._zod.check = (payload) => {
|
|
1683
1737
|
if (isValidBase64(payload.value)) return;
|
|
1684
1738
|
payload.issues.push({
|
|
@@ -1690,15 +1744,15 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
|
1690
1744
|
});
|
|
1691
1745
|
};
|
|
1692
1746
|
});
|
|
1747
|
+
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1693
1748
|
function isValidBase64URL(data) {
|
|
1694
|
-
if (!
|
|
1749
|
+
if (!base64urlCharset.test(data)) return false;
|
|
1695
1750
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1696
1751
|
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1697
1752
|
}
|
|
1698
1753
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1699
|
-
def.pattern ?? (def.pattern =
|
|
1754
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
1700
1755
|
$ZodStringFormat.init(inst, def);
|
|
1701
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1702
1756
|
inst._zod.check = (payload) => {
|
|
1703
1757
|
if (isValidBase64URL(payload.value)) return;
|
|
1704
1758
|
payload.issues.push({
|
|
@@ -1744,7 +1798,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1744
1798
|
});
|
|
1745
1799
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1746
1800
|
$ZodType.init(inst, def);
|
|
1747
|
-
inst._zod.pattern =
|
|
1801
|
+
inst._zod.pattern = number$2;
|
|
1748
1802
|
inst._zod.parse = (payload, _ctx) => {
|
|
1749
1803
|
if (def.coerce) try {
|
|
1750
1804
|
payload.value = Number(payload.value);
|
|
@@ -1821,6 +1875,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1821
1875
|
}
|
|
1822
1876
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1823
1877
|
const proms = [];
|
|
1878
|
+
const abortEarly = ctx?.abortEarly;
|
|
1824
1879
|
for (let i = 0; i < input.length; i++) {
|
|
1825
1880
|
const item = input[i];
|
|
1826
1881
|
const result = def.element._zod.run({
|
|
@@ -1828,7 +1883,10 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1828
1883
|
issues: []
|
|
1829
1884
|
}, ctx);
|
|
1830
1885
|
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1831
|
-
else
|
|
1886
|
+
else {
|
|
1887
|
+
handleArrayResult(result, payload, i);
|
|
1888
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
|
|
1889
|
+
}
|
|
1832
1890
|
}
|
|
1833
1891
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1834
1892
|
return payload;
|
|
@@ -1852,7 +1910,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
1852
1910
|
return;
|
|
1853
1911
|
}
|
|
1854
1912
|
if (result.value === void 0) {
|
|
1855
|
-
if (isPresent) final.value[key] = void 0;
|
|
1913
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
|
|
1856
1914
|
} else final.value[key] = result.value;
|
|
1857
1915
|
}
|
|
1858
1916
|
const NO_SYMBOL_KEYS = [];
|
|
@@ -1872,14 +1930,19 @@ function normalizeDef(def) {
|
|
|
1872
1930
|
optionalKeys: new Set(okeys)
|
|
1873
1931
|
};
|
|
1874
1932
|
}
|
|
1875
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1933
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
1876
1934
|
const unrecognized = [];
|
|
1877
1935
|
const keySet = def.keySet;
|
|
1878
1936
|
const _catchall = def.catchall._zod;
|
|
1879
1937
|
const t = _catchall.def.type;
|
|
1880
1938
|
const optin = _catchall.optin;
|
|
1881
1939
|
const optout = _catchall.optout;
|
|
1940
|
+
let seen = 0;
|
|
1882
1941
|
for (const key in input) {
|
|
1942
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1943
|
+
if (aborted(payload, seen)) break;
|
|
1944
|
+
seen = payload.issues.length;
|
|
1945
|
+
}
|
|
1883
1946
|
if (keySet.has(key)) continue;
|
|
1884
1947
|
if (key === "__proto__") {
|
|
1885
1948
|
if (t === "never") unrecognized.push(key);
|
|
@@ -1908,18 +1971,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1908
1971
|
return payload;
|
|
1909
1972
|
});
|
|
1910
1973
|
}
|
|
1911
|
-
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
1912
1974
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1913
1975
|
$ZodType.init(inst, def);
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1976
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
1977
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
1978
|
+
if (sh) {
|
|
1979
|
+
const get = () => {
|
|
1918
1980
|
const newSh = { ...sh };
|
|
1919
1981
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
1920
|
-
|
|
1982
|
+
get.raw = newSh;
|
|
1921
1983
|
return newSh;
|
|
1922
|
-
}
|
|
1984
|
+
};
|
|
1985
|
+
get.raw = sh;
|
|
1986
|
+
Object.defineProperty(def, "shape", { get });
|
|
1923
1987
|
}
|
|
1924
1988
|
const _normalized = cached(() => normalizeDef(def));
|
|
1925
1989
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -1935,7 +1999,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1935
1999
|
}
|
|
1936
2000
|
return propValues;
|
|
1937
2001
|
});
|
|
1938
|
-
const isObject$
|
|
2002
|
+
const isObject$2 = isObject;
|
|
1939
2003
|
const catchall = def.catchall;
|
|
1940
2004
|
let value;
|
|
1941
2005
|
const memo = globalConfig.memoizer;
|
|
@@ -1943,7 +2007,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1943
2007
|
inst._zod.parse = (payload, ctx) => {
|
|
1944
2008
|
value ?? (value = _normalized.value);
|
|
1945
2009
|
const input = payload.value;
|
|
1946
|
-
if (!isObject$
|
|
2010
|
+
if (!isObject$2(input)) {
|
|
1947
2011
|
payload.issues.push({
|
|
1948
2012
|
expected: "object",
|
|
1949
2013
|
code: "invalid_type",
|
|
@@ -1955,7 +2019,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1955
2019
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1956
2020
|
const proms = [];
|
|
1957
2021
|
const shape = value.shape;
|
|
2022
|
+
const abortEarly = ctx?.abortEarly;
|
|
2023
|
+
let seen = payload.issues.length;
|
|
1958
2024
|
for (const key of value.allKeys) {
|
|
2025
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2026
|
+
if (aborted(payload, seen)) break;
|
|
2027
|
+
seen = payload.issues.length;
|
|
2028
|
+
}
|
|
1959
2029
|
if (key === "__proto__") continue;
|
|
1960
2030
|
const el = shape[key];
|
|
1961
2031
|
const optin = el._zod.optin;
|
|
@@ -1968,7 +2038,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1968
2038
|
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1969
2039
|
}
|
|
1970
2040
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1971
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2041
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
1972
2042
|
};
|
|
1973
2043
|
});
|
|
1974
2044
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -1987,10 +2057,16 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1987
2057
|
});
|
|
1988
2058
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1989
2059
|
const prefixStr = (id, k) => `
|
|
2060
|
+
let ${id}_ab = false;
|
|
1990
2061
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1991
2062
|
const iss = ${id}.issues[i];
|
|
1992
2063
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1993
2064
|
payload.issues.push(iss);
|
|
2065
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
2066
|
+
}
|
|
2067
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2068
|
+
payload.value = newResult;
|
|
2069
|
+
return payload;
|
|
1994
2070
|
}`;
|
|
1995
2071
|
doc.write(`const input = payload.value;`);
|
|
1996
2072
|
const ids = Object.create(null);
|
|
@@ -2032,6 +2108,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2032
2108
|
input: undefined,
|
|
2033
2109
|
path: [${k}]
|
|
2034
2110
|
});
|
|
2111
|
+
if (ctx && ctx.abortEarly) {
|
|
2112
|
+
payload.value = newResult;
|
|
2113
|
+
return payload;
|
|
2114
|
+
}
|
|
2035
2115
|
}
|
|
2036
2116
|
|
|
2037
2117
|
if (${id}_present) {
|
|
@@ -2039,26 +2119,25 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2039
2119
|
}
|
|
2040
2120
|
|
|
2041
2121
|
`);
|
|
2042
|
-
else
|
|
2122
|
+
else {
|
|
2123
|
+
doc.write(`
|
|
2043
2124
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2044
2125
|
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
}
|
|
2050
|
-
} else {
|
|
2126
|
+
`);
|
|
2127
|
+
if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
|
|
2128
|
+
else doc.write(`
|
|
2129
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
2051
2130
|
newResult[${k}] = ${id}.value;
|
|
2052
2131
|
}
|
|
2053
|
-
|
|
2054
2132
|
`);
|
|
2133
|
+
}
|
|
2055
2134
|
}
|
|
2056
2135
|
doc.write(`payload.value = newResult;`);
|
|
2057
2136
|
doc.write(`return payload;`);
|
|
2058
2137
|
return doc.compile();
|
|
2059
2138
|
};
|
|
2060
2139
|
let fastpass;
|
|
2061
|
-
const isObject$
|
|
2140
|
+
const isObject$1 = isObject;
|
|
2062
2141
|
const jit = !globalConfig.jitless;
|
|
2063
2142
|
const fastEnabled = jit && allowsEval.value;
|
|
2064
2143
|
const catchall = def.catchall;
|
|
@@ -2066,7 +2145,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2066
2145
|
inst._zod.parse = (payload, ctx) => {
|
|
2067
2146
|
value ?? (value = _normalized.value);
|
|
2068
2147
|
const input = payload.value;
|
|
2069
|
-
if (!isObject$
|
|
2148
|
+
if (!isObject$1(input)) {
|
|
2070
2149
|
payload.issues.push({
|
|
2071
2150
|
expected: "object",
|
|
2072
2151
|
code: "invalid_type",
|
|
@@ -2079,7 +2158,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2079
2158
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
2080
2159
|
payload = fastpass(payload, ctx);
|
|
2081
2160
|
if (!catchall) return payload;
|
|
2082
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2161
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
2083
2162
|
}
|
|
2084
2163
|
return superParse(payload, ctx);
|
|
2085
2164
|
};
|
|
@@ -2139,39 +2218,42 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
|
2139
2218
|
});
|
|
2140
2219
|
};
|
|
2141
2220
|
});
|
|
2221
|
+
function discriminatorMap(def) {
|
|
2222
|
+
const map = /* @__PURE__ */ new Map();
|
|
2223
|
+
for (const option of def.options) {
|
|
2224
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
2225
|
+
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
2226
|
+
for (const value of values) if (map.has(value)) {
|
|
2227
|
+
if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
2228
|
+
map.set(value, null);
|
|
2229
|
+
} else map.set(value, option);
|
|
2230
|
+
}
|
|
2231
|
+
return map;
|
|
2232
|
+
}
|
|
2142
2233
|
const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
2143
2234
|
def.inclusive = false;
|
|
2144
2235
|
$ZodUnion.init(inst, def);
|
|
2145
2236
|
const _super = inst._zod.parse;
|
|
2146
2237
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2147
2238
|
const propValues = {};
|
|
2239
|
+
let undefinedCount = 0;
|
|
2148
2240
|
for (const option of zod.def.options) {
|
|
2149
2241
|
const pv = option._zod.propValues;
|
|
2150
2242
|
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
2243
|
+
if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
|
|
2151
2244
|
for (const [k, v] of Object.entries(pv)) {
|
|
2152
2245
|
if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
|
|
2153
2246
|
for (const val of v) propValues[k].add(val);
|
|
2154
2247
|
}
|
|
2155
2248
|
}
|
|
2249
|
+
if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
|
|
2156
2250
|
return propValues;
|
|
2157
2251
|
});
|
|
2158
2252
|
def.options.forEach((option, i) => {
|
|
2159
|
-
const propShape =
|
|
2253
|
+
const propShape = rawShape(option._zod.def);
|
|
2160
2254
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
2161
2255
|
});
|
|
2162
|
-
const disc = cached(() =>
|
|
2163
|
-
const opts = def.options;
|
|
2164
|
-
const map = /* @__PURE__ */ new Map();
|
|
2165
|
-
for (const o of opts) {
|
|
2166
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
2167
|
-
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
2168
|
-
for (const v of values) {
|
|
2169
|
-
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
2170
|
-
map.set(v, o);
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
return map;
|
|
2174
|
-
});
|
|
2256
|
+
const disc = cached(() => discriminatorMap(def));
|
|
2175
2257
|
inst._zod.parse = (payload, ctx) => {
|
|
2176
2258
|
const input = payload.value;
|
|
2177
2259
|
if (!isObject(input)) {
|
|
@@ -2183,15 +2265,16 @@ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnio
|
|
|
2183
2265
|
});
|
|
2184
2266
|
return payload;
|
|
2185
2267
|
}
|
|
2186
|
-
const
|
|
2187
|
-
|
|
2268
|
+
const value = input?.[def.discriminator];
|
|
2269
|
+
const opt = disc.value.get(value);
|
|
2270
|
+
if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
|
|
2188
2271
|
if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
|
|
2189
2272
|
payload.issues.push({
|
|
2190
2273
|
code: "invalid_union",
|
|
2191
2274
|
errors: [],
|
|
2192
2275
|
note: "No matching discriminator",
|
|
2193
2276
|
discriminator: def.discriminator,
|
|
2194
|
-
options: Array.from(disc.value.keys()),
|
|
2277
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
2195
2278
|
input,
|
|
2196
2279
|
path: [def.discriminator],
|
|
2197
2280
|
inst
|
|
@@ -2450,8 +2533,10 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2450
2533
|
const values = getEnumValues(def.entries);
|
|
2451
2534
|
const valuesSet = new Set(values);
|
|
2452
2535
|
inst._zod.values = valuesSet;
|
|
2453
|
-
|
|
2454
|
-
|
|
2536
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2537
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2538
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2539
|
+
});
|
|
2455
2540
|
inst._zod.parse = (payload, _ctx) => {
|
|
2456
2541
|
const input = payload.value;
|
|
2457
2542
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2468,7 +2553,10 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
2468
2553
|
$ZodType.init(inst, def);
|
|
2469
2554
|
const values = new Set(def.values);
|
|
2470
2555
|
inst._zod.values = values;
|
|
2471
|
-
inst
|
|
2556
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2557
|
+
const vals = zod.def.values;
|
|
2558
|
+
return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
2559
|
+
});
|
|
2472
2560
|
inst._zod.parse = (payload, _ctx) => {
|
|
2473
2561
|
const input = payload.value;
|
|
2474
2562
|
if (values.has(input)) return payload;
|
|
@@ -2703,7 +2791,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2703
2791
|
}
|
|
2704
2792
|
}
|
|
2705
2793
|
//#endregion
|
|
2706
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
2794
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
|
|
2707
2795
|
var $ZodCyclicError = class extends Error {
|
|
2708
2796
|
constructor() {
|
|
2709
2797
|
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
@@ -2713,6 +2801,9 @@ var $ZodCyclicError = class extends Error {
|
|
|
2713
2801
|
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2714
2802
|
const STATE = "~memo";
|
|
2715
2803
|
const NO_ISSUES = [];
|
|
2804
|
+
function isRef(value) {
|
|
2805
|
+
return value !== null && typeof value === "object";
|
|
2806
|
+
}
|
|
2716
2807
|
function cloneIssues(issues) {
|
|
2717
2808
|
return issues.map((iss) => iss.path ? {
|
|
2718
2809
|
...iss,
|
|
@@ -2720,22 +2811,44 @@ function cloneIssues(issues) {
|
|
|
2720
2811
|
} : { ...iss });
|
|
2721
2812
|
}
|
|
2722
2813
|
const recursive$2 = /*@__PURE__*/ new WeakMap();
|
|
2814
|
+
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
2815
|
+
const NONE = 0;
|
|
2816
|
+
const ASSUMED = 1;
|
|
2817
|
+
const PROVEN = 2;
|
|
2723
2818
|
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2724
|
-
function isRecursive(inst, stack) {
|
|
2819
|
+
function isRecursive(inst, stack, resolve) {
|
|
2725
2820
|
const cached = recursive$2.get(inst);
|
|
2726
|
-
if (cached !== void 0) return cached;
|
|
2727
|
-
if (stack.has(inst)) return
|
|
2821
|
+
if (cached !== void 0) return cached ? PROVEN : NONE;
|
|
2822
|
+
if (stack.has(inst)) return PROVEN;
|
|
2728
2823
|
stack.add(inst);
|
|
2729
|
-
let result =
|
|
2824
|
+
let result = NONE;
|
|
2730
2825
|
const check = (child) => {
|
|
2731
|
-
if (
|
|
2826
|
+
if (result !== PROVEN && child?._zod) {
|
|
2827
|
+
const answer = isRecursive(child, stack, resolve);
|
|
2828
|
+
if (answer > result) result = answer;
|
|
2829
|
+
}
|
|
2830
|
+
};
|
|
2831
|
+
const shape = (sh, spread) => {
|
|
2832
|
+
let answer = NONE;
|
|
2833
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
2834
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
2835
|
+
if (spread && !desc.enumerable) continue;
|
|
2836
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
2837
|
+
if (child > answer) answer = child;
|
|
2838
|
+
}
|
|
2839
|
+
return answer;
|
|
2840
|
+
};
|
|
2841
|
+
const merge = (answer) => {
|
|
2842
|
+
if (answer > result) result = answer;
|
|
2732
2843
|
};
|
|
2733
2844
|
const def = inst._zod.def;
|
|
2734
2845
|
switch (def.type) {
|
|
2735
|
-
case "object":
|
|
2736
|
-
|
|
2846
|
+
case "object": {
|
|
2847
|
+
const raw = rawShape(def);
|
|
2848
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
2737
2849
|
check(def.catchall);
|
|
2738
2850
|
break;
|
|
2851
|
+
}
|
|
2739
2852
|
case "array":
|
|
2740
2853
|
check(def.element);
|
|
2741
2854
|
break;
|
|
@@ -2777,9 +2890,11 @@ function isRecursive(inst, stack) {
|
|
|
2777
2890
|
check(def.input);
|
|
2778
2891
|
check(def.output);
|
|
2779
2892
|
break;
|
|
2780
|
-
case "lazy":
|
|
2781
|
-
|
|
2893
|
+
case "lazy": {
|
|
2894
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
2895
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
2782
2896
|
break;
|
|
2897
|
+
}
|
|
2783
2898
|
case "template_literal":
|
|
2784
2899
|
case "string":
|
|
2785
2900
|
case "number":
|
|
@@ -2810,13 +2925,17 @@ function isRecursive(inst, stack) {
|
|
|
2810
2925
|
}
|
|
2811
2926
|
}
|
|
2812
2927
|
stack.delete(inst);
|
|
2813
|
-
|
|
2814
|
-
|
|
2928
|
+
return settle(inst, result);
|
|
2929
|
+
}
|
|
2930
|
+
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
2931
|
+
function settle(inst, answer) {
|
|
2932
|
+
if (answer !== ASSUMED) recursive$2.set(inst, answer === PROVEN);
|
|
2933
|
+
return answer;
|
|
2815
2934
|
}
|
|
2816
2935
|
function bucketFor(state, inst) {
|
|
2817
2936
|
let bucket = state.buckets.get(inst);
|
|
2818
2937
|
if (!bucket) {
|
|
2819
|
-
bucket = /* @__PURE__ */ new
|
|
2938
|
+
bucket = /* @__PURE__ */ new WeakMap();
|
|
2820
2939
|
state.buckets.set(inst, bucket);
|
|
2821
2940
|
}
|
|
2822
2941
|
return bucket;
|
|
@@ -2852,6 +2971,7 @@ const memo = {
|
|
|
2852
2971
|
attach(inst) {
|
|
2853
2972
|
var _a;
|
|
2854
2973
|
let isRecursiveInst;
|
|
2974
|
+
let rechecked = false;
|
|
2855
2975
|
let lastCtx;
|
|
2856
2976
|
let lastBucket;
|
|
2857
2977
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -2859,19 +2979,21 @@ const memo = {
|
|
|
2859
2979
|
const base = inst._zod.parse;
|
|
2860
2980
|
const wrapped = (payload, ctx) => {
|
|
2861
2981
|
if (isRecursiveInst === void 0) {
|
|
2862
|
-
|
|
2863
|
-
if (
|
|
2982
|
+
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
2983
|
+
if (walked === NONE) {
|
|
2864
2984
|
inst._zod.parse = base;
|
|
2865
2985
|
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2866
2986
|
return base(payload, ctx);
|
|
2867
2987
|
}
|
|
2988
|
+
if (walked === PROVEN || rechecked) isRecursiveInst = true;
|
|
2989
|
+
else rechecked = true;
|
|
2868
2990
|
}
|
|
2869
2991
|
const input = payload.value;
|
|
2870
|
-
if (input
|
|
2992
|
+
if (!isRef(input)) return base(payload, ctx);
|
|
2871
2993
|
let state = ctx[STATE];
|
|
2872
2994
|
if (!state) {
|
|
2873
2995
|
state = {
|
|
2874
|
-
buckets: /* @__PURE__ */ new
|
|
2996
|
+
buckets: /* @__PURE__ */ new WeakMap(),
|
|
2875
2997
|
backEdges: void 0
|
|
2876
2998
|
};
|
|
2877
2999
|
ctx[STATE] = state;
|
|
@@ -2890,7 +3012,7 @@ const memo = {
|
|
|
2890
3012
|
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2891
3013
|
} else {
|
|
2892
3014
|
payload.memo = true;
|
|
2893
|
-
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new
|
|
3015
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
2894
3016
|
state.backEdges.add(hit.value);
|
|
2895
3017
|
}
|
|
2896
3018
|
return payload;
|
|
@@ -2919,10 +3041,10 @@ function memoizer() {
|
|
|
2919
3041
|
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2920
3042
|
function isBackEdge(ctx, value) {
|
|
2921
3043
|
const backEdges = ctx[STATE]?.backEdges;
|
|
2922
|
-
return backEdges !== void 0 && value
|
|
3044
|
+
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
2923
3045
|
}
|
|
2924
3046
|
//#endregion
|
|
2925
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
3047
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
|
|
2926
3048
|
const error$1 = () => {
|
|
2927
3049
|
const Sizable = {
|
|
2928
3050
|
string: {
|
|
@@ -2977,7 +3099,9 @@ const error$1 = () => {
|
|
|
2977
3099
|
base64url: "base64url-encoded string",
|
|
2978
3100
|
json_string: "JSON string",
|
|
2979
3101
|
e164: "E.164 number",
|
|
3102
|
+
currency_code: "currency code",
|
|
2980
3103
|
credit_card: "credit card number",
|
|
3104
|
+
iban: "IBAN",
|
|
2981
3105
|
jwt: "JWT",
|
|
2982
3106
|
template_literal: "input"
|
|
2983
3107
|
};
|
|
@@ -3028,7 +3152,7 @@ function en_default() {
|
|
|
3028
3152
|
return { localeError: error$1() };
|
|
3029
3153
|
}
|
|
3030
3154
|
//#endregion
|
|
3031
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
3155
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
|
|
3032
3156
|
var _a;
|
|
3033
3157
|
var $ZodRegistry = class {
|
|
3034
3158
|
constructor() {
|
|
@@ -3075,13 +3199,17 @@ function registry() {
|
|
|
3075
3199
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
3076
3200
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3077
3201
|
//#endregion
|
|
3078
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
3202
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
|
|
3203
|
+
function snapshotChecks(def) {
|
|
3204
|
+
if (def.checks) def.checks = [...def.checks];
|
|
3205
|
+
return def;
|
|
3206
|
+
}
|
|
3079
3207
|
// @__NO_SIDE_EFFECTS__
|
|
3080
3208
|
function _string(Class, params) {
|
|
3081
|
-
return new Class({
|
|
3209
|
+
return new Class(snapshotChecks({
|
|
3082
3210
|
type: "string",
|
|
3083
3211
|
...normalizeParams(params)
|
|
3084
|
-
});
|
|
3212
|
+
}));
|
|
3085
3213
|
}
|
|
3086
3214
|
// @__NO_SIDE_EFFECTS__
|
|
3087
3215
|
function _email(Class, params) {
|
|
@@ -3353,11 +3481,11 @@ function _isoDuration(Class, params) {
|
|
|
3353
3481
|
}
|
|
3354
3482
|
// @__NO_SIDE_EFFECTS__
|
|
3355
3483
|
function _number(Class, params) {
|
|
3356
|
-
return new Class({
|
|
3484
|
+
return new Class(snapshotChecks({
|
|
3357
3485
|
type: "number",
|
|
3358
3486
|
checks: [],
|
|
3359
3487
|
...normalizeParams(params)
|
|
3360
|
-
});
|
|
3488
|
+
}));
|
|
3361
3489
|
}
|
|
3362
3490
|
// @__NO_SIDE_EFFECTS__
|
|
3363
3491
|
function _int(Class, params) {
|
|
@@ -3580,7 +3708,7 @@ function _check(fn, params) {
|
|
|
3580
3708
|
return ch;
|
|
3581
3709
|
}
|
|
3582
3710
|
//#endregion
|
|
3583
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
3711
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
|
|
3584
3712
|
function assignProps(target, ...sources) {
|
|
3585
3713
|
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3586
3714
|
return target;
|
|
@@ -3623,7 +3751,7 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
|
3623
3751
|
Object.assign(json, result);
|
|
3624
3752
|
return true;
|
|
3625
3753
|
}
|
|
3626
|
-
function
|
|
3754
|
+
function processSchema(schema, ctx, _params = {
|
|
3627
3755
|
path: [],
|
|
3628
3756
|
schemaPath: []
|
|
3629
3757
|
}) {
|
|
@@ -3662,7 +3790,7 @@ function process(schema, ctx, _params = {
|
|
|
3662
3790
|
const parent = schema._zod.parent;
|
|
3663
3791
|
if (parent) {
|
|
3664
3792
|
if (!result.ref) result.ref = parent;
|
|
3665
|
-
|
|
3793
|
+
processSchema(parent, ctx, params);
|
|
3666
3794
|
ctx.seen.get(parent).isParent = true;
|
|
3667
3795
|
}
|
|
3668
3796
|
}
|
|
@@ -3752,10 +3880,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3752
3880
|
continue;
|
|
3753
3881
|
}
|
|
3754
3882
|
if (seen.count > 1) {
|
|
3755
|
-
if (ctx.reused === "ref")
|
|
3756
|
-
extractToDef(entry);
|
|
3757
|
-
continue;
|
|
3758
|
-
}
|
|
3883
|
+
if (ctx.reused === "ref") extractToDef(entry);
|
|
3759
3884
|
}
|
|
3760
3885
|
}
|
|
3761
3886
|
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
@@ -4010,7 +4135,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
4010
4135
|
...params,
|
|
4011
4136
|
processors
|
|
4012
4137
|
});
|
|
4013
|
-
|
|
4138
|
+
processSchema(schema, ctx);
|
|
4014
4139
|
extractDefs(ctx, schema);
|
|
4015
4140
|
return finalize(ctx, schema);
|
|
4016
4141
|
};
|
|
@@ -4022,12 +4147,84 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
4022
4147
|
io,
|
|
4023
4148
|
processors
|
|
4024
4149
|
});
|
|
4025
|
-
|
|
4150
|
+
processSchema(schema, ctx);
|
|
4026
4151
|
extractDefs(ctx, schema);
|
|
4027
4152
|
return finalize(ctx, schema);
|
|
4028
4153
|
};
|
|
4029
4154
|
//#endregion
|
|
4030
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
4155
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
|
|
4156
|
+
const narrowMin = (agg, key, value) => {
|
|
4157
|
+
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4158
|
+
};
|
|
4159
|
+
const narrowMax = (agg, key, value) => {
|
|
4160
|
+
if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
|
|
4161
|
+
};
|
|
4162
|
+
const narrowBoth = (agg, value) => {
|
|
4163
|
+
narrowMin(agg, "minimum", value);
|
|
4164
|
+
narrowMax(agg, "maximum", value);
|
|
4165
|
+
};
|
|
4166
|
+
const addDivisor = (agg, value) => {
|
|
4167
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4168
|
+
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
|
|
4169
|
+
};
|
|
4170
|
+
const addPattern = (agg, pattern) => {
|
|
4171
|
+
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4172
|
+
agg.patterns.add(pattern);
|
|
4173
|
+
};
|
|
4174
|
+
const intersectMime = (agg, mime) => {
|
|
4175
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4176
|
+
};
|
|
4177
|
+
const setFormat = (agg, format) => {
|
|
4178
|
+
agg.format = format;
|
|
4179
|
+
if (format.includes("int")) agg.isInt = true;
|
|
4180
|
+
};
|
|
4181
|
+
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4182
|
+
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4183
|
+
const formatContributor = (ranges) => (agg, def) => {
|
|
4184
|
+
setFormat(agg, def.format);
|
|
4185
|
+
const [minimum, maximum] = ranges[def.format];
|
|
4186
|
+
narrowMin(agg, "minimum", minimum);
|
|
4187
|
+
narrowMax(agg, "maximum", maximum);
|
|
4188
|
+
};
|
|
4189
|
+
const contributors = {
|
|
4190
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4191
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4192
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4193
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4194
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4195
|
+
min_length: minContributor,
|
|
4196
|
+
max_length: maxContributor,
|
|
4197
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4198
|
+
min_size: minContributor,
|
|
4199
|
+
max_size: maxContributor,
|
|
4200
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4201
|
+
string_format: (agg, def) => {
|
|
4202
|
+
setFormat(agg, def.format);
|
|
4203
|
+
if (def.pattern) addPattern(agg, def.pattern);
|
|
4204
|
+
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
|
|
4205
|
+
if (def.local || def.precision === -1) agg.laxFormat = true;
|
|
4206
|
+
},
|
|
4207
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4208
|
+
};
|
|
4209
|
+
function aggregateChecks(schema) {
|
|
4210
|
+
const agg = {};
|
|
4211
|
+
const def = schema._zod.def;
|
|
4212
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4213
|
+
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4214
|
+
const bag = schema._zod.bag;
|
|
4215
|
+
if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
|
|
4216
|
+
if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4217
|
+
if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
|
|
4218
|
+
if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4219
|
+
if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
|
|
4220
|
+
if (bag.format !== void 0) {
|
|
4221
|
+
agg.format ?? (agg.format = bag.format);
|
|
4222
|
+
if (bag.format.includes("int")) agg.isInt = true;
|
|
4223
|
+
}
|
|
4224
|
+
if (bag.mime) intersectMime(agg, bag.mime);
|
|
4225
|
+
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
|
|
4226
|
+
return agg;
|
|
4227
|
+
}
|
|
4031
4228
|
const formatMap = {
|
|
4032
4229
|
guid: "uuid",
|
|
4033
4230
|
url: "uri",
|
|
@@ -4035,10 +4232,12 @@ const formatMap = {
|
|
|
4035
4232
|
json_string: "json-string",
|
|
4036
4233
|
regex: ""
|
|
4037
4234
|
};
|
|
4235
|
+
const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
|
|
4236
|
+
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
4038
4237
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
4039
4238
|
const json = _json;
|
|
4040
4239
|
json.type = "string";
|
|
4041
|
-
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema
|
|
4240
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
4042
4241
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
4043
4242
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
4044
4243
|
if (format) {
|
|
@@ -4048,7 +4247,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
4048
4247
|
}
|
|
4049
4248
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
4050
4249
|
if (patterns && patterns.size > 0) {
|
|
4051
|
-
const patternList = [...patterns];
|
|
4250
|
+
const patternList = [...patterns].map(exactPattern);
|
|
4052
4251
|
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
4053
4252
|
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
4054
4253
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
@@ -4058,9 +4257,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
4058
4257
|
};
|
|
4059
4258
|
const numberProcessor = (schema, ctx, _json, params) => {
|
|
4060
4259
|
const json = _json;
|
|
4061
|
-
const { minimum, maximum,
|
|
4062
|
-
|
|
4063
|
-
else json.type = "number";
|
|
4260
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
4261
|
+
json.type = isInt ? "integer" : "number";
|
|
4064
4262
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
4065
4263
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
4066
4264
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -4076,9 +4274,13 @@ const numberProcessor = (schema, ctx, _json, params) => {
|
|
|
4076
4274
|
json.exclusiveMaximum = true;
|
|
4077
4275
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
4078
4276
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
4079
|
-
if (
|
|
4080
|
-
|
|
4081
|
-
|
|
4277
|
+
if (multipleOf) {
|
|
4278
|
+
const divisors = /* @__PURE__ */ new Set();
|
|
4279
|
+
for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
|
|
4280
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
4281
|
+
const [first, ...rest] = divisors;
|
|
4282
|
+
if (first !== void 0) json.multipleOf = first;
|
|
4283
|
+
if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
4082
4284
|
}
|
|
4083
4285
|
};
|
|
4084
4286
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
@@ -4133,11 +4335,11 @@ const transformProcessor = (schema, ctx, json, params) => {
|
|
|
4133
4335
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
4134
4336
|
const json = _json;
|
|
4135
4337
|
const def = schema._zod.def;
|
|
4136
|
-
const { minimum, maximum } = schema
|
|
4338
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
4137
4339
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
4138
4340
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
4139
4341
|
json.type = "array";
|
|
4140
|
-
json.items =
|
|
4342
|
+
json.items = processSchema(def.element, ctx, {
|
|
4141
4343
|
...params,
|
|
4142
4344
|
path: [...params.path, "items"]
|
|
4143
4345
|
});
|
|
@@ -4155,7 +4357,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
4155
4357
|
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
4156
4358
|
json.type = "object";
|
|
4157
4359
|
json.properties = {};
|
|
4158
|
-
for (const key in shape) assignProp(json.properties, key,
|
|
4360
|
+
for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
4159
4361
|
...params,
|
|
4160
4362
|
path: [
|
|
4161
4363
|
...params.path,
|
|
@@ -4163,17 +4365,16 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
4163
4365
|
key
|
|
4164
4366
|
]
|
|
4165
4367
|
}));
|
|
4166
|
-
const
|
|
4167
|
-
const
|
|
4368
|
+
const requiredKeys = [];
|
|
4369
|
+
for (const key of Object.keys(shape)) {
|
|
4168
4370
|
const field = def.shape[key];
|
|
4169
|
-
if (ctx.io === "input"
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
4371
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
|
|
4372
|
+
}
|
|
4373
|
+
if (requiredKeys.length > 0) json.required = requiredKeys;
|
|
4173
4374
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
4174
4375
|
else if (!def.catchall) {
|
|
4175
4376
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
4176
|
-
} else if (def.catchall) json.additionalProperties =
|
|
4377
|
+
} else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
4177
4378
|
...params,
|
|
4178
4379
|
path: [...params.path, "additionalProperties"]
|
|
4179
4380
|
});
|
|
@@ -4181,7 +4382,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
4181
4382
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
4182
4383
|
const def = schema._zod.def;
|
|
4183
4384
|
const isExclusive = def.inclusive === false;
|
|
4184
|
-
const options = def.options.map((x, i) =>
|
|
4385
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
4185
4386
|
...params,
|
|
4186
4387
|
path: [
|
|
4187
4388
|
...params.path,
|
|
@@ -4194,7 +4395,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
4194
4395
|
};
|
|
4195
4396
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
4196
4397
|
const def = schema._zod.def;
|
|
4197
|
-
const a =
|
|
4398
|
+
const a = processSchema(def.left, ctx, {
|
|
4198
4399
|
...params,
|
|
4199
4400
|
path: [
|
|
4200
4401
|
...params.path,
|
|
@@ -4202,7 +4403,7 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
4202
4403
|
0
|
|
4203
4404
|
]
|
|
4204
4405
|
});
|
|
4205
|
-
const b =
|
|
4406
|
+
const b = processSchema(def.right, ctx, {
|
|
4206
4407
|
...params,
|
|
4207
4408
|
path: [
|
|
4208
4409
|
...params.path,
|
|
@@ -4278,9 +4479,9 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
4278
4479
|
const def = schema._zod.def;
|
|
4279
4480
|
json.type = "object";
|
|
4280
4481
|
const keyType = def.keyType;
|
|
4281
|
-
const patterns = keyType.
|
|
4482
|
+
const patterns = aggregateChecks(keyType).patterns;
|
|
4282
4483
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
4283
|
-
const valueSchema =
|
|
4484
|
+
const valueSchema = processSchema(def.valueType, ctx, {
|
|
4284
4485
|
...params,
|
|
4285
4486
|
path: [
|
|
4286
4487
|
...params.path,
|
|
@@ -4289,10 +4490,10 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
4289
4490
|
]
|
|
4290
4491
|
});
|
|
4291
4492
|
json.patternProperties = {};
|
|
4292
|
-
for (const pattern of patterns) assignProp(json.patternProperties, pattern.source, valueSchema);
|
|
4493
|
+
for (const pattern of patterns) assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
4293
4494
|
} else {
|
|
4294
4495
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
4295
|
-
json.propertyNames =
|
|
4496
|
+
json.propertyNames = processSchema(def.keyType, ctx, {
|
|
4296
4497
|
...params,
|
|
4297
4498
|
path: [...params.path, "propertyNames"]
|
|
4298
4499
|
});
|
|
@@ -4304,7 +4505,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
4304
4505
|
}
|
|
4305
4506
|
pending.push(schema);
|
|
4306
4507
|
}
|
|
4307
|
-
json.additionalProperties =
|
|
4508
|
+
json.additionalProperties = processSchema(def.valueType, ctx, {
|
|
4308
4509
|
...params,
|
|
4309
4510
|
path: [...params.path, "additionalProperties"]
|
|
4310
4511
|
});
|
|
@@ -4318,7 +4519,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
4318
4519
|
};
|
|
4319
4520
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4320
4521
|
const def = schema._zod.def;
|
|
4321
|
-
const inner =
|
|
4522
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
4322
4523
|
const seen = ctx.seen.get(schema);
|
|
4323
4524
|
if (ctx.target === "openapi-3.0") {
|
|
4324
4525
|
seen.ref = def.innerType;
|
|
@@ -4327,7 +4528,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
4327
4528
|
};
|
|
4328
4529
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
4329
4530
|
const def = schema._zod.def;
|
|
4330
|
-
|
|
4531
|
+
processSchema(def.innerType, ctx, params);
|
|
4331
4532
|
const seen = ctx.seen.get(schema);
|
|
4332
4533
|
seen.ref = def.innerType;
|
|
4333
4534
|
};
|
|
@@ -4348,7 +4549,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
|
4348
4549
|
}
|
|
4349
4550
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
4350
4551
|
const def = schema._zod.def;
|
|
4351
|
-
|
|
4552
|
+
processSchema(def.innerType, ctx, params);
|
|
4352
4553
|
const seen = ctx.seen.get(schema);
|
|
4353
4554
|
seen.ref = def.innerType;
|
|
4354
4555
|
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -4356,7 +4557,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
|
|
|
4356
4557
|
};
|
|
4357
4558
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
4358
4559
|
const def = schema._zod.def;
|
|
4359
|
-
|
|
4560
|
+
processSchema(def.innerType, ctx, params);
|
|
4360
4561
|
const seen = ctx.seen.get(schema);
|
|
4361
4562
|
seen.ref = def.innerType;
|
|
4362
4563
|
if (ctx.io !== "input") return;
|
|
@@ -4365,7 +4566,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
|
|
|
4365
4566
|
};
|
|
4366
4567
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
4367
4568
|
const def = schema._zod.def;
|
|
4368
|
-
|
|
4569
|
+
processSchema(def.innerType, ctx, params);
|
|
4369
4570
|
const seen = ctx.seen.get(schema);
|
|
4370
4571
|
seen.ref = def.innerType;
|
|
4371
4572
|
let catchValue;
|
|
@@ -4381,25 +4582,25 @@ const pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
4381
4582
|
const def = schema._zod.def;
|
|
4382
4583
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
4383
4584
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
4384
|
-
|
|
4585
|
+
processSchema(innerType, ctx, params);
|
|
4385
4586
|
const seen = ctx.seen.get(schema);
|
|
4386
4587
|
seen.ref = innerType;
|
|
4387
4588
|
};
|
|
4388
4589
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
4389
4590
|
const def = schema._zod.def;
|
|
4390
|
-
|
|
4591
|
+
processSchema(def.innerType, ctx, params);
|
|
4391
4592
|
const seen = ctx.seen.get(schema);
|
|
4392
4593
|
seen.ref = def.innerType;
|
|
4393
4594
|
json.readOnly = true;
|
|
4394
4595
|
};
|
|
4395
4596
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
4396
4597
|
const def = schema._zod.def;
|
|
4397
|
-
|
|
4598
|
+
processSchema(def.innerType, ctx, params);
|
|
4398
4599
|
const seen = ctx.seen.get(schema);
|
|
4399
4600
|
seen.ref = def.innerType;
|
|
4400
4601
|
};
|
|
4401
4602
|
//#endregion
|
|
4402
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
4603
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
|
|
4403
4604
|
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4404
4605
|
function _lazyMethod(proto, key, make) {
|
|
4405
4606
|
Object.defineProperty(proto, key, {
|
|
@@ -4449,7 +4650,7 @@ const initializer = (inst, issues) => {
|
|
|
4449
4650
|
};
|
|
4450
4651
|
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
4451
4652
|
//#endregion
|
|
4452
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
4653
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
|
|
4453
4654
|
const parse$1 = /* @__PURE__ */ _parse(ZodRealError);
|
|
4454
4655
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4455
4656
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -4463,7 +4664,7 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
4463
4664
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4464
4665
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4465
4666
|
//#endregion
|
|
4466
|
-
//#region ../../node_modules/.pnpm/zod@4.5
|
|
4667
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
|
|
4467
4668
|
function _ensureDefaultLocale() {
|
|
4468
4669
|
if (!globalConfig.localeError) config(en_default());
|
|
4469
4670
|
}
|
|
@@ -4599,6 +4800,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
4599
4800
|
set spa(value) {
|
|
4600
4801
|
own(this, "spa", value);
|
|
4601
4802
|
},
|
|
4803
|
+
validate(data, params) {
|
|
4804
|
+
return validate(this, data, params);
|
|
4805
|
+
},
|
|
4806
|
+
validateAsync(data, params) {
|
|
4807
|
+
return validateAsync$1(this, data, params);
|
|
4808
|
+
},
|
|
4602
4809
|
encode: function _encode(data, params) {
|
|
4603
4810
|
return encode(this, data, params, { callee: _encode });
|
|
4604
4811
|
},
|
|
@@ -4638,10 +4845,10 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
4638
4845
|
$ZodString.init(inst, def);
|
|
4639
4846
|
ZodType.init(inst, def);
|
|
4640
4847
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4848
|
+
}, /*@__PURE__*/ derived({
|
|
4849
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
4850
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
4851
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
4645
4852
|
}, {
|
|
4646
4853
|
regex(...args) {
|
|
4647
4854
|
return this.check(/* @__PURE__ */ _regex(...args));
|
|
@@ -4688,7 +4895,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
4688
4895
|
slugify() {
|
|
4689
4896
|
return this.check(/* @__PURE__ */ _slugify());
|
|
4690
4897
|
}
|
|
4691
|
-
});
|
|
4898
|
+
}));
|
|
4692
4899
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
4693
4900
|
$ZodString.init(inst, def);
|
|
4694
4901
|
_ZodString.init(inst, def);
|
|
@@ -4880,12 +5087,21 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
4880
5087
|
$ZodNumber.init(inst, def);
|
|
4881
5088
|
ZodType.init(inst, def);
|
|
4882
5089
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
4883
|
-
const bag = inst._zod.bag;
|
|
4884
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
4885
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
4886
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
4887
5090
|
inst.isFinite = true;
|
|
4888
|
-
|
|
5091
|
+
}, /*@__PURE__*/ derived({
|
|
5092
|
+
minValue: (inst) => {
|
|
5093
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
5094
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
5095
|
+
},
|
|
5096
|
+
maxValue: (inst) => {
|
|
5097
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
5098
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
5099
|
+
},
|
|
5100
|
+
isInt: (inst) => {
|
|
5101
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
5102
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
5103
|
+
},
|
|
5104
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
4889
5105
|
}, {
|
|
4890
5106
|
gt(value, params) {
|
|
4891
5107
|
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
@@ -4932,7 +5148,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
4932
5148
|
finite() {
|
|
4933
5149
|
return this;
|
|
4934
5150
|
}
|
|
4935
|
-
});
|
|
5151
|
+
}));
|
|
4936
5152
|
function number$1(params) {
|
|
4937
5153
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
4938
5154
|
}
|
|
@@ -5004,34 +5220,19 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
|
5004
5220
|
return _enum(Object.keys(this._zod.def.shape));
|
|
5005
5221
|
},
|
|
5006
5222
|
catchall(catchall) {
|
|
5007
|
-
return this.clone({
|
|
5008
|
-
...this._zod.def,
|
|
5009
|
-
catchall
|
|
5010
|
-
});
|
|
5223
|
+
return this.clone(mergeDefs(this._zod.def, { catchall }));
|
|
5011
5224
|
},
|
|
5012
5225
|
passthrough() {
|
|
5013
|
-
return this.clone({
|
|
5014
|
-
...this._zod.def,
|
|
5015
|
-
catchall: unknown()
|
|
5016
|
-
});
|
|
5226
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5017
5227
|
},
|
|
5018
5228
|
loose() {
|
|
5019
|
-
return this.clone({
|
|
5020
|
-
...this._zod.def,
|
|
5021
|
-
catchall: unknown()
|
|
5022
|
-
});
|
|
5229
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5023
5230
|
},
|
|
5024
5231
|
strict() {
|
|
5025
|
-
return this.clone({
|
|
5026
|
-
...this._zod.def,
|
|
5027
|
-
catchall: never()
|
|
5028
|
-
});
|
|
5232
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
5029
5233
|
},
|
|
5030
5234
|
strip() {
|
|
5031
|
-
return this.clone({
|
|
5032
|
-
...this._zod.def,
|
|
5033
|
-
catchall: void 0
|
|
5034
|
-
});
|
|
5235
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
|
|
5035
5236
|
},
|
|
5036
5237
|
extend(incoming) {
|
|
5037
5238
|
return extend(this, incoming);
|
|
@@ -5130,7 +5331,7 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
|
5130
5331
|
ZodType.init(inst, def);
|
|
5131
5332
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
5132
5333
|
inst.enum = def.entries;
|
|
5133
|
-
inst.options =
|
|
5334
|
+
inst.options = [...inst._zod.values];
|
|
5134
5335
|
const keys = new Set(Object.keys(def.entries));
|
|
5135
5336
|
inst.extract = (values, params) => {
|
|
5136
5337
|
const newEntries = {};
|