@avantf/dsh-mem 0.6.3 → 0.7.0
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 +15 -10
- package/lib/client.js +1146 -2300
- package/lib/dsh-build.json +5 -5
- package/lib/engine/mem/config/config_files.d.ts +1 -1
- package/lib/engine/mem/db/dao/chunks.d.ts +6 -0
- package/lib/engine/mem/db/dao/fact_sources.d.ts +28 -6
- package/lib/engine/mem/defaults.d.ts +25 -0
- package/lib/engine/mem/dispatch.d.ts +4 -2
- package/lib/engine/mem/facts_io.d.ts +288 -0
- package/lib/engine/mem/index.d.ts +4 -0
- package/lib/engine/mem/maintenance_paths.d.ts +41 -0
- package/lib/engine/mem/modelBootstrap.d.ts +0 -69
- package/lib/engine/mem/runtime.d.ts +57 -3
- package/lib/engine/mem/store/facts_restore.d.ts +116 -0
- package/lib/engine/mem/store/hybrid.d.ts +0 -4
- package/lib/engine/mem/store/memory.d.ts +16 -0
- package/lib/engine/mem/store/vector_space.d.ts +60 -0
- package/lib/engine/mem-contract/tools.d.ts +55 -1
- package/lib/index.js +4418 -2591
- package/lib/interface-version.json +2 -2
- package/lib/types/command.d.ts +61 -0
- package/lib/types/command.d.ts.map +1 -0
- package/lib/types/envinit-bootstrap.d.ts +11 -9
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interface_gate.d.ts +9 -9
- package/lib/types/remote.d.ts +9 -2
- package/lib/types/remote.d.ts.map +1 -1
- package/lib/types/render.d.ts +3 -3
- package/package.json +6 -6
package/lib/client.js
CHANGED
|
@@ -72,34 +72,83 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
"warn": "HvfIsq_warn"
|
|
73
73
|
};
|
|
74
74
|
//#endregion
|
|
75
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
75
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
76
|
+
var _a$1;
|
|
77
|
+
function $constructor(name, initializer, params) {
|
|
78
|
+
function init(inst, def) {
|
|
79
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
80
|
+
value: {
|
|
81
|
+
def,
|
|
82
|
+
constr: _,
|
|
83
|
+
traits: /* @__PURE__ */ new Set()
|
|
84
|
+
},
|
|
85
|
+
enumerable: false
|
|
86
|
+
});
|
|
87
|
+
if (inst._zod.traits.has(name)) return;
|
|
88
|
+
inst._zod.traits.add(name);
|
|
89
|
+
initializer(inst, def);
|
|
90
|
+
const proto = _.prototype;
|
|
91
|
+
const keys = Object.keys(proto);
|
|
92
|
+
for (let i = 0; i < keys.length; i++) {
|
|
93
|
+
const k = keys[i];
|
|
94
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const Parent = params?.Parent ?? Object;
|
|
98
|
+
class Definition extends Parent {}
|
|
99
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
100
|
+
function _(def) {
|
|
101
|
+
var _a;
|
|
102
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
103
|
+
init(inst, def);
|
|
104
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
105
|
+
for (const fn of inst._zod.deferred) fn();
|
|
106
|
+
return inst;
|
|
107
|
+
}
|
|
108
|
+
Object.defineProperty(_, "init", { value: init });
|
|
109
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
110
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
111
|
+
return inst?._zod?.traits?.has(name);
|
|
112
|
+
} });
|
|
113
|
+
Object.defineProperty(_, "name", { value: name });
|
|
114
|
+
return _;
|
|
115
|
+
}
|
|
116
|
+
var $ZodAsyncError = class extends Error {
|
|
117
|
+
constructor() {
|
|
118
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var $ZodEncodeError = class extends Error {
|
|
122
|
+
constructor(name) {
|
|
123
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
124
|
+
this.name = "ZodEncodeError";
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
128
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
129
|
+
function config(newConfig) {
|
|
130
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
131
|
+
return globalConfig;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
76
135
|
function getEnumValues(entries) {
|
|
77
136
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
78
137
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
79
138
|
}
|
|
80
|
-
function joinValues(array, separator = "|") {
|
|
81
|
-
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
82
|
-
}
|
|
83
139
|
function jsonStringifyReplacer(_, value) {
|
|
84
140
|
if (typeof value === "bigint") return value.toString();
|
|
85
141
|
return value;
|
|
86
142
|
}
|
|
87
|
-
var Cached = class {
|
|
88
|
-
constructor(getter) {
|
|
89
|
-
this._getter = getter;
|
|
90
|
-
this._value = void 0;
|
|
91
|
-
}
|
|
92
|
-
get value() {
|
|
93
|
-
const getter = this._getter;
|
|
94
|
-
if (getter !== void 0) {
|
|
95
|
-
this._value = getter();
|
|
96
|
-
this._getter = void 0;
|
|
97
|
-
}
|
|
98
|
-
return this._value;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
143
|
function cached(getter) {
|
|
102
|
-
return
|
|
144
|
+
return { get value() {
|
|
145
|
+
{
|
|
146
|
+
const value = getter();
|
|
147
|
+
Object.defineProperty(this, "value", { value });
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
throw new Error("cached value already set");
|
|
151
|
+
} };
|
|
103
152
|
}
|
|
104
153
|
function nullish(input) {
|
|
105
154
|
return input === null || input === void 0;
|
|
@@ -112,10 +161,28 @@ window.__ModuleLoader__.load({
|
|
|
112
161
|
function floatSafeRemainder(val, step) {
|
|
113
162
|
const ratio = val / step;
|
|
114
163
|
const roundedRatio = Math.round(ratio);
|
|
115
|
-
const tolerance =
|
|
164
|
+
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
116
165
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
117
166
|
return ratio - roundedRatio;
|
|
118
167
|
}
|
|
168
|
+
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
169
|
+
function defineLazy(object, key, getter) {
|
|
170
|
+
let value = void 0;
|
|
171
|
+
Object.defineProperty(object, key, {
|
|
172
|
+
get() {
|
|
173
|
+
if (value === EVALUATING) return;
|
|
174
|
+
if (value === void 0) {
|
|
175
|
+
value = EVALUATING;
|
|
176
|
+
value = getter();
|
|
177
|
+
}
|
|
178
|
+
return value;
|
|
179
|
+
},
|
|
180
|
+
set(v) {
|
|
181
|
+
Object.defineProperty(object, key, { value: v });
|
|
182
|
+
},
|
|
183
|
+
configurable: true
|
|
184
|
+
});
|
|
185
|
+
}
|
|
119
186
|
function assignProp(target, prop, value) {
|
|
120
187
|
Object.defineProperty(target, prop, {
|
|
121
188
|
value,
|
|
@@ -124,58 +191,6 @@ window.__ModuleLoader__.load({
|
|
|
124
191
|
configurable: true
|
|
125
192
|
});
|
|
126
193
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
129
|
-
*
|
|
130
|
-
* 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.
|
|
131
|
-
*/
|
|
132
|
-
function rawShape(def) {
|
|
133
|
-
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
134
|
-
return desc?.get ? desc.get.raw : desc?.value;
|
|
135
|
-
}
|
|
136
|
-
function sourceShape(schema) {
|
|
137
|
-
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
138
|
-
}
|
|
139
|
-
function deferProp(target, key, getter) {
|
|
140
|
-
Object.defineProperty(target, key, {
|
|
141
|
-
get() {
|
|
142
|
-
const value = getter();
|
|
143
|
-
assignProp(this, key, value);
|
|
144
|
-
return value;
|
|
145
|
-
},
|
|
146
|
-
enumerable: true,
|
|
147
|
-
configurable: true
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
function putProp(target, key, value) {
|
|
151
|
-
if (key in target) assignProp(target, key, value);
|
|
152
|
-
else target[key] = value;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
156
|
-
*
|
|
157
|
-
* 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.
|
|
158
|
-
*/
|
|
159
|
-
function mirrorShape(target, source, keys, wrap) {
|
|
160
|
-
const raw = sourceShape(source);
|
|
161
|
-
for (const key of keys) {
|
|
162
|
-
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
163
|
-
if (!desc.enumerable) continue;
|
|
164
|
-
if (desc.get) deferProp(target, key, () => {
|
|
165
|
-
const value = source._zod.def.shape[key];
|
|
166
|
-
return wrap ? wrap(value, key) : value;
|
|
167
|
-
});
|
|
168
|
-
else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function mirrorProps(target, source) {
|
|
172
|
-
for (const key of Reflect.ownKeys(source)) {
|
|
173
|
-
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
174
|
-
if (!desc.enumerable) continue;
|
|
175
|
-
if (desc.get) deferProp(target, key, () => source[key]);
|
|
176
|
-
else putProp(target, key, desc.value);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
194
|
function mergeDefs(...defs) {
|
|
180
195
|
const mergedDescriptors = {};
|
|
181
196
|
for (const def of defs) {
|
|
@@ -249,56 +264,51 @@ window.__ModuleLoader__.load({
|
|
|
249
264
|
};
|
|
250
265
|
return params;
|
|
251
266
|
}
|
|
252
|
-
function stringifyPrimitive(value) {
|
|
253
|
-
if (typeof value === "bigint") return value.toString() + "n";
|
|
254
|
-
if (typeof value === "string") return `"${value}"`;
|
|
255
|
-
return `${value}`;
|
|
256
|
-
}
|
|
257
267
|
function optionalKeys(shape) {
|
|
258
268
|
return Object.keys(shape).filter((k) => {
|
|
259
|
-
return shape[k]._zod.optin
|
|
269
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
260
270
|
});
|
|
261
271
|
}
|
|
262
|
-
const NUMBER_FORMAT_RANGES =
|
|
272
|
+
const NUMBER_FORMAT_RANGES = {
|
|
263
273
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
264
274
|
int32: [-2147483648, 2147483647],
|
|
265
275
|
uint32: [0, 4294967295],
|
|
266
276
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
267
277
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
268
|
-
}))();
|
|
269
|
-
const BIGINT_FORMAT_RANGES = {
|
|
270
|
-
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
271
|
-
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
|
|
272
278
|
};
|
|
273
279
|
function pick(schema, mask) {
|
|
274
280
|
const currDef = schema._zod.def;
|
|
275
281
|
const checks = currDef.checks;
|
|
276
282
|
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
283
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
284
|
+
get shape() {
|
|
285
|
+
const newShape = {};
|
|
286
|
+
for (const key in mask) {
|
|
287
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
288
|
+
if (!mask[key]) continue;
|
|
289
|
+
newShape[key] = currDef.shape[key];
|
|
290
|
+
}
|
|
291
|
+
assignProp(this, "shape", newShape);
|
|
292
|
+
return newShape;
|
|
293
|
+
},
|
|
281
294
|
checks: []
|
|
282
295
|
}));
|
|
283
296
|
}
|
|
284
|
-
function maskedKeys(schema, mask) {
|
|
285
|
-
const raw = sourceShape(schema);
|
|
286
|
-
const keys = [];
|
|
287
|
-
for (const key of Reflect.ownKeys(mask)) {
|
|
288
|
-
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
289
|
-
if (mask[key]) keys.push(key);
|
|
290
|
-
}
|
|
291
|
-
return keys;
|
|
292
|
-
}
|
|
293
297
|
function omit(schema, mask) {
|
|
294
298
|
const currDef = schema._zod.def;
|
|
295
299
|
const checks = currDef.checks;
|
|
296
300
|
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
302
|
+
get shape() {
|
|
303
|
+
const newShape = { ...schema._zod.def.shape };
|
|
304
|
+
for (const key in mask) {
|
|
305
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
306
|
+
if (!mask[key]) continue;
|
|
307
|
+
delete newShape[key];
|
|
308
|
+
}
|
|
309
|
+
assignProp(this, "shape", newShape);
|
|
310
|
+
return newShape;
|
|
311
|
+
},
|
|
302
312
|
checks: []
|
|
303
313
|
}));
|
|
304
314
|
}
|
|
@@ -306,57 +316,90 @@ window.__ModuleLoader__.load({
|
|
|
306
316
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
307
317
|
const checks = schema._zod.def.checks;
|
|
308
318
|
if (checks && checks.length > 0) {
|
|
309
|
-
const existingShape =
|
|
310
|
-
for (const key
|
|
319
|
+
const existingShape = schema._zod.def.shape;
|
|
320
|
+
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
311
321
|
}
|
|
312
|
-
return clone(schema, mergeDefs(schema._zod.def, { shape
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
322
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
323
|
+
const _shape = {
|
|
324
|
+
...schema._zod.def.shape,
|
|
325
|
+
...shape
|
|
326
|
+
};
|
|
327
|
+
assignProp(this, "shape", _shape);
|
|
328
|
+
return _shape;
|
|
329
|
+
} }));
|
|
319
330
|
}
|
|
320
331
|
function safeExtend(schema, shape) {
|
|
321
332
|
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
322
|
-
return clone(schema, mergeDefs(schema._zod.def, { shape
|
|
333
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
334
|
+
const _shape = {
|
|
335
|
+
...schema._zod.def.shape,
|
|
336
|
+
...shape
|
|
337
|
+
};
|
|
338
|
+
assignProp(this, "shape", _shape);
|
|
339
|
+
return _shape;
|
|
340
|
+
} }));
|
|
323
341
|
}
|
|
324
342
|
function merge(a, b) {
|
|
325
|
-
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
326
343
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
327
|
-
const newShape = {};
|
|
328
|
-
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
329
|
-
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
330
344
|
return clone(a, mergeDefs(a._zod.def, {
|
|
331
|
-
shape
|
|
345
|
+
get shape() {
|
|
346
|
+
const _shape = {
|
|
347
|
+
...a._zod.def.shape,
|
|
348
|
+
...b._zod.def.shape
|
|
349
|
+
};
|
|
350
|
+
assignProp(this, "shape", _shape);
|
|
351
|
+
return _shape;
|
|
352
|
+
},
|
|
332
353
|
get catchall() {
|
|
333
354
|
return b._zod.def.catchall;
|
|
334
355
|
},
|
|
335
356
|
checks: b._zod.def.checks ?? []
|
|
336
357
|
}));
|
|
337
358
|
}
|
|
338
|
-
function partial(Class, schema, mask
|
|
359
|
+
function partial(Class, schema, mask) {
|
|
339
360
|
const checks = schema._zod.def.checks;
|
|
340
|
-
if (checks && checks.length > 0) throw new Error(
|
|
341
|
-
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
342
|
-
const newShape = {};
|
|
343
|
-
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
|
|
344
|
-
type: "optional",
|
|
345
|
-
innerType: value
|
|
346
|
-
})));
|
|
361
|
+
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
347
362
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
348
|
-
shape
|
|
363
|
+
get shape() {
|
|
364
|
+
const oldShape = schema._zod.def.shape;
|
|
365
|
+
const shape = { ...oldShape };
|
|
366
|
+
if (mask) for (const key in mask) {
|
|
367
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
368
|
+
if (!mask[key]) continue;
|
|
369
|
+
shape[key] = Class ? new Class({
|
|
370
|
+
type: "optional",
|
|
371
|
+
innerType: oldShape[key]
|
|
372
|
+
}) : oldShape[key];
|
|
373
|
+
}
|
|
374
|
+
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
375
|
+
type: "optional",
|
|
376
|
+
innerType: oldShape[key]
|
|
377
|
+
}) : oldShape[key];
|
|
378
|
+
assignProp(this, "shape", shape);
|
|
379
|
+
return shape;
|
|
380
|
+
},
|
|
349
381
|
checks: []
|
|
350
382
|
}));
|
|
351
383
|
}
|
|
352
384
|
function required(Class, schema, mask) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
385
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
386
|
+
const oldShape = schema._zod.def.shape;
|
|
387
|
+
const shape = { ...oldShape };
|
|
388
|
+
if (mask) for (const key in mask) {
|
|
389
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
390
|
+
if (!mask[key]) continue;
|
|
391
|
+
shape[key] = new Class({
|
|
392
|
+
type: "nonoptional",
|
|
393
|
+
innerType: oldShape[key]
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
else for (const key in oldShape) shape[key] = new Class({
|
|
397
|
+
type: "nonoptional",
|
|
398
|
+
innerType: oldShape[key]
|
|
399
|
+
});
|
|
400
|
+
assignProp(this, "shape", shape);
|
|
401
|
+
return shape;
|
|
402
|
+
} }));
|
|
360
403
|
}
|
|
361
404
|
function aborted(x, startIndex = 0) {
|
|
362
405
|
if (x.aborted === true) return true;
|
|
@@ -379,56 +422,19 @@ window.__ModuleLoader__.load({
|
|
|
379
422
|
function unwrapMessage(message) {
|
|
380
423
|
return typeof message === "string" ? message : message?.message;
|
|
381
424
|
}
|
|
382
|
-
function attachSchema(issues, start, inst) {
|
|
383
|
-
var _a;
|
|
384
|
-
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
385
|
-
}
|
|
386
425
|
function finalizeIssue(iss, ctx, config) {
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
const full = {};
|
|
394
|
-
for (const k of Object.keys(iss)) {
|
|
395
|
-
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
396
|
-
full[k] = iss[k];
|
|
397
|
-
}
|
|
398
|
-
full.path ?? (full.path = []);
|
|
399
|
-
full.message = message;
|
|
400
|
-
if (ctx?.reportInput) full.input = iss.input;
|
|
401
|
-
return full;
|
|
402
|
-
}
|
|
403
|
-
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
404
|
-
function codePointLength(str) {
|
|
405
|
-
const units = str.length;
|
|
406
|
-
if (!highSurrogate.test(str)) return units;
|
|
407
|
-
let count = units;
|
|
408
|
-
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
409
|
-
count--;
|
|
410
|
-
i++;
|
|
411
|
-
}
|
|
412
|
-
return count;
|
|
426
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
427
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
428
|
+
rest.path ?? (rest.path = []);
|
|
429
|
+
rest.message = message;
|
|
430
|
+
if (ctx?.reportInput) rest.input = _input;
|
|
431
|
+
return rest;
|
|
413
432
|
}
|
|
414
433
|
function getLengthableOrigin(input) {
|
|
415
434
|
if (Array.isArray(input)) return "array";
|
|
416
435
|
if (typeof input === "string") return "string";
|
|
417
436
|
return "unknown";
|
|
418
437
|
}
|
|
419
|
-
function parsedType(data) {
|
|
420
|
-
const t = typeof data;
|
|
421
|
-
switch (t) {
|
|
422
|
-
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
423
|
-
case "object": {
|
|
424
|
-
if (data === null) return "null";
|
|
425
|
-
if (Array.isArray(data)) return "array";
|
|
426
|
-
const obj = data;
|
|
427
|
-
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return t;
|
|
431
|
-
}
|
|
432
438
|
function issue(...args) {
|
|
433
439
|
const [iss, input, inst] = args;
|
|
434
440
|
if (typeof iss === "string") return {
|
|
@@ -439,337 +445,33 @@ window.__ModuleLoader__.load({
|
|
|
439
445
|
};
|
|
440
446
|
return { ...iss };
|
|
441
447
|
}
|
|
442
|
-
/**
|
|
443
|
-
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
444
|
-
*
|
|
445
|
-
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
446
|
-
*/
|
|
447
|
-
function members(proto, table) {
|
|
448
|
-
for (const key in table) {
|
|
449
|
-
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
450
|
-
if (desc.get) Object.defineProperty(proto, key, {
|
|
451
|
-
...desc,
|
|
452
|
-
enumerable: false
|
|
453
|
-
});
|
|
454
|
-
else defineBound(proto, key, desc.value);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
458
|
-
function own(inst, key, value, enumerable = true) {
|
|
459
|
-
Object.defineProperty(inst, key, {
|
|
460
|
-
configurable: true,
|
|
461
|
-
writable: true,
|
|
462
|
-
enumerable,
|
|
463
|
-
value
|
|
464
|
-
});
|
|
465
|
-
return value;
|
|
466
|
-
}
|
|
467
|
-
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
468
|
-
function hide(inst, key, value) {
|
|
469
|
-
return own(inst, key, value, false);
|
|
470
|
-
}
|
|
471
|
-
/** 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. */
|
|
472
|
-
function derived(computes, table) {
|
|
473
|
-
for (const key in computes) {
|
|
474
|
-
const compute = computes[key];
|
|
475
|
-
Object.defineProperty(table, key, {
|
|
476
|
-
configurable: true,
|
|
477
|
-
enumerable: true,
|
|
478
|
-
get() {
|
|
479
|
-
return own(this, key, compute(this));
|
|
480
|
-
},
|
|
481
|
-
set(value) {
|
|
482
|
-
own(this, key, value);
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
return table;
|
|
487
|
-
}
|
|
488
|
-
function defineBound(proto, key, fn) {
|
|
489
|
-
Object.defineProperty(proto, key, {
|
|
490
|
-
configurable: true,
|
|
491
|
-
get() {
|
|
492
|
-
return this == null ? fn : own(this, key, fn.bind(this));
|
|
493
|
-
},
|
|
494
|
-
set(value) {
|
|
495
|
-
own(this, key, value);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
500
|
-
function claim(inst, sentinel) {
|
|
501
|
-
const proto = Object.getPrototypeOf(inst);
|
|
502
|
-
return sentinel in proto ? void 0 : proto;
|
|
503
|
-
}
|
|
504
|
-
let installing;
|
|
505
|
-
let broke = false;
|
|
506
|
-
const breaker = {
|
|
507
|
-
configurable: true,
|
|
508
|
-
get() {
|
|
509
|
-
broke = true;
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
514
|
-
* constructor, computed from the internals object itself and cached there on
|
|
515
|
-
* first read. One accessor per constructor rather than one per instance.
|
|
516
|
-
*/
|
|
517
|
-
function defineLazyInternal(inst, key, compute) {
|
|
518
|
-
const proto = Object.getPrototypeOf(inst._zod);
|
|
519
|
-
if (key in proto && installing !== inst._zod) {
|
|
520
|
-
installing = void 0;
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
installing = inst._zod;
|
|
524
|
-
Object.defineProperty(proto, key, {
|
|
525
|
-
configurable: true,
|
|
526
|
-
get() {
|
|
527
|
-
Object.defineProperty(this, key, breaker);
|
|
528
|
-
const outer = broke;
|
|
529
|
-
broke = false;
|
|
530
|
-
try {
|
|
531
|
-
const value = compute(this);
|
|
532
|
-
if (broke) delete this[key];
|
|
533
|
-
else Object.defineProperty(this, key, {
|
|
534
|
-
configurable: true,
|
|
535
|
-
writable: true,
|
|
536
|
-
value
|
|
537
|
-
});
|
|
538
|
-
broke = broke || outer;
|
|
539
|
-
return value;
|
|
540
|
-
} catch (err) {
|
|
541
|
-
delete this[key];
|
|
542
|
-
broke = broke || outer;
|
|
543
|
-
throw err;
|
|
544
|
-
}
|
|
545
|
-
},
|
|
546
|
-
set(value) {
|
|
547
|
-
Object.defineProperty(this, key, {
|
|
548
|
-
configurable: true,
|
|
549
|
-
writable: true,
|
|
550
|
-
value
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
557
|
-
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
558
|
-
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
559
|
-
*/
|
|
560
|
-
function installLazyProp(inst, key, make, enumerable) {
|
|
561
|
-
const proto = claim(inst, key);
|
|
562
|
-
if (!proto) return;
|
|
563
|
-
Object.defineProperty(proto, key, {
|
|
564
|
-
configurable: true,
|
|
565
|
-
get() {
|
|
566
|
-
const desc = {
|
|
567
|
-
configurable: true,
|
|
568
|
-
writable: true,
|
|
569
|
-
enumerable,
|
|
570
|
-
value: void 0
|
|
571
|
-
};
|
|
572
|
-
Object.defineProperty(this, key, desc);
|
|
573
|
-
desc.value = make(this);
|
|
574
|
-
Object.defineProperty(this, key, desc);
|
|
575
|
-
return desc.value;
|
|
576
|
-
},
|
|
577
|
-
set(value) {
|
|
578
|
-
Object.defineProperty(this, key, {
|
|
579
|
-
configurable: true,
|
|
580
|
-
writable: true,
|
|
581
|
-
enumerable,
|
|
582
|
-
value
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
588
|
-
const CONSTANT_CATCH = "~constantCatch";
|
|
589
|
-
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
590
|
-
function constantCatch(value) {
|
|
591
|
-
const fn = () => value;
|
|
592
|
-
fn[CONSTANT_CATCH] = true;
|
|
593
|
-
return fn;
|
|
594
|
-
}
|
|
595
448
|
//#endregion
|
|
596
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
597
|
-
var _a$1;
|
|
598
|
-
const _zodDesc = {
|
|
599
|
-
value: void 0,
|
|
600
|
-
enumerable: false
|
|
601
|
-
};
|
|
602
|
-
let _E = "captureStackTrace" in Error ? Error : null;
|
|
603
|
-
function newError(Definition) {
|
|
604
|
-
const E = _E;
|
|
605
|
-
if (E) {
|
|
606
|
-
const saved = E.stackTraceLimit;
|
|
607
|
-
if (typeof saved === "number") {
|
|
608
|
-
try {
|
|
609
|
-
E.stackTraceLimit = 0;
|
|
610
|
-
} catch {
|
|
611
|
-
_E = null;
|
|
612
|
-
return new Definition();
|
|
613
|
-
}
|
|
614
|
-
try {
|
|
615
|
-
return new Definition();
|
|
616
|
-
} finally {
|
|
617
|
-
E.stackTraceLimit = saved;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
return new Definition();
|
|
622
|
-
}
|
|
623
|
-
function $constructor(name, initializer, proto, params) {
|
|
624
|
-
const zodProto = {};
|
|
625
|
-
function Internals(def) {
|
|
626
|
-
this.def = def;
|
|
627
|
-
this.constr = _;
|
|
628
|
-
this.traits = /* @__PURE__ */ new Set();
|
|
629
|
-
}
|
|
630
|
-
Internals.prototype = zodProto;
|
|
631
|
-
const protoMembers = proto;
|
|
632
|
-
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
633
|
-
function init(inst, def) {
|
|
634
|
-
if (!inst._zod) {
|
|
635
|
-
_zodDesc.value = new Internals(def);
|
|
636
|
-
try {
|
|
637
|
-
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
638
|
-
} finally {
|
|
639
|
-
_zodDesc.value = void 0;
|
|
640
|
-
}
|
|
641
|
-
} else if (inst._zod.traits.has(name)) return;
|
|
642
|
-
inst._zod.traits.add(name);
|
|
643
|
-
initializer(inst, def);
|
|
644
|
-
if (initialized) {
|
|
645
|
-
const own = Object.getPrototypeOf(inst);
|
|
646
|
-
const ctorProto = inst._zod.constr.prototype;
|
|
647
|
-
let up = own;
|
|
648
|
-
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
649
|
-
const target = up ?? own;
|
|
650
|
-
if (!initialized.has(target)) {
|
|
651
|
-
initialized.add(target);
|
|
652
|
-
members(target, protoMembers);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
const proto = _.prototype;
|
|
656
|
-
for (const k in proto) {
|
|
657
|
-
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
658
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
const Parent = params?.Parent ?? Object;
|
|
662
|
-
class Definition extends Parent {}
|
|
663
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
664
|
-
function _(def) {
|
|
665
|
-
const inst = params?.Parent ? newError(Definition) : this;
|
|
666
|
-
init(inst, def);
|
|
667
|
-
const deferred = inst._zod.deferred;
|
|
668
|
-
if (deferred) {
|
|
669
|
-
for (const fn of deferred) fn();
|
|
670
|
-
inst._zod.deferred = void 0;
|
|
671
|
-
}
|
|
672
|
-
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
673
|
-
if (pp) pp(inst);
|
|
674
|
-
return inst;
|
|
675
|
-
}
|
|
676
|
-
Object.defineProperty(_, "init", { value: init });
|
|
677
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
678
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
679
|
-
return inst?._zod?.traits?.has(name);
|
|
680
|
-
} });
|
|
681
|
-
Object.defineProperty(_, "name", { value: name });
|
|
682
|
-
return _;
|
|
683
|
-
}
|
|
684
|
-
var $ZodAsyncError = class extends Error {
|
|
685
|
-
constructor() {
|
|
686
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
var $ZodEncodeError = class extends Error {
|
|
690
|
-
constructor(name) {
|
|
691
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
692
|
-
this.name = "ZodEncodeError";
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
696
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
697
|
-
function config(newConfig) {
|
|
698
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
699
|
-
return globalConfig;
|
|
700
|
-
}
|
|
701
|
-
//#endregion
|
|
702
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
|
|
703
|
-
function _getMessage() {
|
|
704
|
-
const internals = this._zod;
|
|
705
|
-
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
706
|
-
return internals.message;
|
|
707
|
-
}
|
|
708
|
-
function _setMessage(value) {
|
|
709
|
-
this._zod.message = value;
|
|
710
|
-
}
|
|
711
|
-
const _messageDesc = {
|
|
712
|
-
get: _getMessage,
|
|
713
|
-
set: _setMessage,
|
|
714
|
-
enumerable: true,
|
|
715
|
-
configurable: true
|
|
716
|
-
};
|
|
717
|
-
const _issuesDesc = {
|
|
718
|
-
value: void 0,
|
|
719
|
-
enumerable: false
|
|
720
|
-
};
|
|
721
|
-
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
449
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
722
450
|
const initializer$1 = (inst, def) => {
|
|
723
451
|
inst.name = "$ZodError";
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
value,
|
|
738
|
-
configurable: true,
|
|
739
|
-
writable: true
|
|
740
|
-
});
|
|
741
|
-
return value;
|
|
742
|
-
},
|
|
743
|
-
set(value) {
|
|
744
|
-
Object.defineProperty(this, "toString", {
|
|
745
|
-
value,
|
|
746
|
-
configurable: true,
|
|
747
|
-
writable: true
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
}
|
|
452
|
+
Object.defineProperty(inst, "_zod", {
|
|
453
|
+
value: inst._zod,
|
|
454
|
+
enumerable: false
|
|
455
|
+
});
|
|
456
|
+
Object.defineProperty(inst, "issues", {
|
|
457
|
+
value: def,
|
|
458
|
+
enumerable: false
|
|
459
|
+
});
|
|
460
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
461
|
+
Object.defineProperty(inst, "toString", {
|
|
462
|
+
value: () => inst.message,
|
|
463
|
+
enumerable: false
|
|
464
|
+
});
|
|
752
465
|
};
|
|
753
466
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
754
|
-
$constructor("$ZodError", initializer$1,
|
|
755
|
-
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
756
|
-
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
757
|
-
* "__proto__" would hit the setter instead of creating a key. */
|
|
758
|
-
function node(obj, key, make) {
|
|
759
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key)) if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
760
|
-
value: make(),
|
|
761
|
-
writable: true,
|
|
762
|
-
enumerable: true,
|
|
763
|
-
configurable: true
|
|
764
|
-
});
|
|
765
|
-
else obj[key] = make();
|
|
766
|
-
return obj[key];
|
|
767
|
-
}
|
|
467
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
768
468
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
769
469
|
const fieldErrors = {};
|
|
770
470
|
const formErrors = [];
|
|
771
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
772
|
-
|
|
471
|
+
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
472
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
473
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
474
|
+
} else formErrors.push(mapper(sub));
|
|
773
475
|
return {
|
|
774
476
|
formErrors,
|
|
775
477
|
fieldErrors
|
|
@@ -789,21 +491,12 @@ window.__ModuleLoader__.load({
|
|
|
789
491
|
let i = 0;
|
|
790
492
|
while (i < fullpath.length) {
|
|
791
493
|
const el = fullpath[i];
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
continue;
|
|
494
|
+
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
495
|
+
else {
|
|
496
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
497
|
+
curr[el]._errors.push(mapper(issue));
|
|
797
498
|
}
|
|
798
|
-
|
|
799
|
-
value: { _errors: [] },
|
|
800
|
-
enumerable: true,
|
|
801
|
-
writable: true,
|
|
802
|
-
configurable: true
|
|
803
|
-
});
|
|
804
|
-
const node = curr[el];
|
|
805
|
-
if (terminal) node._errors.push(mapper(issue));
|
|
806
|
-
curr = node;
|
|
499
|
+
curr = curr[el];
|
|
807
500
|
i++;
|
|
808
501
|
}
|
|
809
502
|
}
|
|
@@ -813,54 +506,8 @@ window.__ModuleLoader__.load({
|
|
|
813
506
|
return fieldErrors;
|
|
814
507
|
}
|
|
815
508
|
//#endregion
|
|
816
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
817
|
-
|
|
818
|
-
return {
|
|
819
|
-
callee: params?.callee ?? callee,
|
|
820
|
-
Err: params?.Err
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
const _parse = (_Err) => {
|
|
824
|
-
const fn = (schema, value, _ctx, _params) => {
|
|
825
|
-
const ctx = _ctx ? {
|
|
826
|
-
..._ctx,
|
|
827
|
-
async: false
|
|
828
|
-
} : { async: false };
|
|
829
|
-
const result = schema._zod.run({
|
|
830
|
-
value,
|
|
831
|
-
issues: []
|
|
832
|
-
}, ctx);
|
|
833
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
834
|
-
if (result.issues.length) {
|
|
835
|
-
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
836
|
-
captureStackTrace(e, _params?.callee ?? fn);
|
|
837
|
-
throw e;
|
|
838
|
-
}
|
|
839
|
-
return result.value;
|
|
840
|
-
};
|
|
841
|
-
return fn;
|
|
842
|
-
};
|
|
843
|
-
const _parseAsync = (_Err) => {
|
|
844
|
-
const fn = async (schema, value, _ctx, params) => {
|
|
845
|
-
const ctx = _ctx ? {
|
|
846
|
-
..._ctx,
|
|
847
|
-
async: true
|
|
848
|
-
} : { async: true };
|
|
849
|
-
let result = schema._zod.run({
|
|
850
|
-
value,
|
|
851
|
-
issues: []
|
|
852
|
-
}, ctx);
|
|
853
|
-
if (result instanceof Promise) result = await result;
|
|
854
|
-
if (result.issues.length) {
|
|
855
|
-
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
856
|
-
captureStackTrace(e, params?.callee ?? fn);
|
|
857
|
-
throw e;
|
|
858
|
-
}
|
|
859
|
-
return result.value;
|
|
860
|
-
};
|
|
861
|
-
return fn;
|
|
862
|
-
};
|
|
863
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
509
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
510
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
864
511
|
const ctx = _ctx ? {
|
|
865
512
|
..._ctx,
|
|
866
513
|
async: false
|
|
@@ -870,31 +517,14 @@ window.__ModuleLoader__.load({
|
|
|
870
517
|
issues: []
|
|
871
518
|
}, ctx);
|
|
872
519
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
520
|
+
if (result.issues.length) {
|
|
521
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
522
|
+
captureStackTrace(e, _params?.callee);
|
|
523
|
+
throw e;
|
|
524
|
+
}
|
|
525
|
+
return result.value;
|
|
877
526
|
};
|
|
878
|
-
|
|
879
|
-
let error;
|
|
880
|
-
return {
|
|
881
|
-
success: false,
|
|
882
|
-
get error() {
|
|
883
|
-
if (!error) {
|
|
884
|
-
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
885
|
-
issues = void 0;
|
|
886
|
-
ctx = void 0;
|
|
887
|
-
}
|
|
888
|
-
return error;
|
|
889
|
-
},
|
|
890
|
-
set error(e) {
|
|
891
|
-
error = e;
|
|
892
|
-
issues = void 0;
|
|
893
|
-
ctx = void 0;
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
527
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
898
528
|
const ctx = _ctx ? {
|
|
899
529
|
..._ctx,
|
|
900
530
|
async: true
|
|
@@ -904,96 +534,70 @@ window.__ModuleLoader__.load({
|
|
|
904
534
|
issues: []
|
|
905
535
|
}, ctx);
|
|
906
536
|
if (result instanceof Promise) result = await result;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
};
|
|
912
|
-
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
913
|
-
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
914
|
-
const validate = ((schema, value, _ctx) => {
|
|
915
|
-
const validator = schema._zod.bag.validator;
|
|
916
|
-
if (validator !== void 0) {
|
|
917
|
-
if (validator(value) !== COMPILE_INVALID) return true;
|
|
918
|
-
if (validator.definite === true && _ctx === void 0) return false;
|
|
537
|
+
if (result.issues.length) {
|
|
538
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
539
|
+
captureStackTrace(e, params?.callee);
|
|
540
|
+
throw e;
|
|
919
541
|
}
|
|
920
|
-
return
|
|
921
|
-
}
|
|
922
|
-
|
|
542
|
+
return result.value;
|
|
543
|
+
};
|
|
544
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
923
545
|
const ctx = _ctx ? {
|
|
924
546
|
..._ctx,
|
|
925
|
-
async: false
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
async: false,
|
|
929
|
-
abortEarly: true
|
|
930
|
-
};
|
|
931
|
-
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
932
|
-
let result;
|
|
933
|
-
if (fallbackRun) {
|
|
934
|
-
ctx[COMPILE_FALLBACK] = true;
|
|
935
|
-
result = fallbackRun({
|
|
936
|
-
value,
|
|
937
|
-
issues: []
|
|
938
|
-
}, ctx);
|
|
939
|
-
} else result = schema._zod.run({
|
|
547
|
+
async: false
|
|
548
|
+
} : { async: false };
|
|
549
|
+
const result = schema._zod.run({
|
|
940
550
|
value,
|
|
941
551
|
issues: []
|
|
942
552
|
}, ctx);
|
|
943
553
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
944
|
-
return result.issues.length
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
const ctx = _ctx ? {
|
|
948
|
-
..._ctx,
|
|
949
|
-
async: true,
|
|
950
|
-
abortEarly: true
|
|
554
|
+
return result.issues.length ? {
|
|
555
|
+
success: false,
|
|
556
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
951
557
|
} : {
|
|
952
|
-
|
|
953
|
-
|
|
558
|
+
success: true,
|
|
559
|
+
data: result.value
|
|
954
560
|
};
|
|
561
|
+
};
|
|
562
|
+
const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
563
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
564
|
+
const ctx = _ctx ? {
|
|
565
|
+
..._ctx,
|
|
566
|
+
async: true
|
|
567
|
+
} : { async: true };
|
|
955
568
|
let result = schema._zod.run({
|
|
956
569
|
value,
|
|
957
570
|
issues: []
|
|
958
571
|
}, ctx);
|
|
959
572
|
if (result instanceof Promise) result = await result;
|
|
960
|
-
return result.issues.length
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
..._ctx,
|
|
967
|
-
direction: "backward"
|
|
968
|
-
} : { direction: "backward" };
|
|
969
|
-
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
573
|
+
return result.issues.length ? {
|
|
574
|
+
success: false,
|
|
575
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
576
|
+
} : {
|
|
577
|
+
success: true,
|
|
578
|
+
data: result.value
|
|
970
579
|
};
|
|
971
|
-
return fn;
|
|
972
580
|
};
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
581
|
+
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
582
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
583
|
+
const ctx = _ctx ? {
|
|
584
|
+
..._ctx,
|
|
585
|
+
direction: "backward"
|
|
586
|
+
} : { direction: "backward" };
|
|
587
|
+
return _parse(_Err)(schema, value, ctx);
|
|
979
588
|
};
|
|
980
|
-
const
|
|
981
|
-
|
|
982
|
-
const fn = async (schema, value, _ctx, _params) => {
|
|
983
|
-
const ctx = _ctx ? {
|
|
984
|
-
..._ctx,
|
|
985
|
-
direction: "backward"
|
|
986
|
-
} : { direction: "backward" };
|
|
987
|
-
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
988
|
-
};
|
|
989
|
-
return fn;
|
|
589
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
590
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
990
591
|
};
|
|
991
|
-
const
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
};
|
|
996
|
-
return
|
|
592
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
593
|
+
const ctx = _ctx ? {
|
|
594
|
+
..._ctx,
|
|
595
|
+
direction: "backward"
|
|
596
|
+
} : { direction: "backward" };
|
|
597
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
598
|
+
};
|
|
599
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
600
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
997
601
|
};
|
|
998
602
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
999
603
|
const ctx = _ctx ? {
|
|
@@ -1016,7 +620,7 @@ window.__ModuleLoader__.load({
|
|
|
1016
620
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1017
621
|
};
|
|
1018
622
|
//#endregion
|
|
1019
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
623
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
|
|
1020
624
|
/**
|
|
1021
625
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1022
626
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -1024,15 +628,12 @@ window.__ModuleLoader__.load({
|
|
|
1024
628
|
*/
|
|
1025
629
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
1026
630
|
const cuid2 = /^[0-9a-z]+$/;
|
|
1027
|
-
const ulid = /^[0-
|
|
631
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
1028
632
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
1029
633
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
1030
634
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1031
|
-
function nanoidOfLength(length) {
|
|
1032
|
-
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
1033
|
-
}
|
|
1034
635
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
1035
|
-
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
636
|
+
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
1036
637
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
1037
638
|
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
1038
639
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -1043,62 +644,53 @@ window.__ModuleLoader__.load({
|
|
|
1043
644
|
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})$`);
|
|
1044
645
|
};
|
|
1045
646
|
/** Practical email validation */
|
|
1046
|
-
const email = /^(
|
|
1047
|
-
const _emoji$1 = `^(
|
|
647
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
648
|
+
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
1048
649
|
function emoji() {
|
|
1049
650
|
return new RegExp(_emoji$1, "u");
|
|
1050
651
|
}
|
|
1051
652
|
const ipv4 = /^(?:(?: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])$/;
|
|
1052
653
|
const ipv6 = /^(([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}|:))$/;
|
|
1053
654
|
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])$/;
|
|
1054
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
655
|
+
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1055
656
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
1056
|
-
const base64url = /^
|
|
657
|
+
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
1057
658
|
const httpProtocol = /^https?$/;
|
|
1058
659
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
1059
660
|
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])))`;
|
|
1060
|
-
|
|
1061
|
-
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
1062
|
-
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
1063
|
-
function anchor(source) {
|
|
1064
|
-
return new RegExp(`^${source}$`);
|
|
1065
|
-
}
|
|
1066
|
-
const date = /*@__PURE__*/ anchor(dateSource);
|
|
661
|
+
const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
1067
662
|
function timeSource(args) {
|
|
1068
663
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1069
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` :
|
|
664
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1070
665
|
}
|
|
1071
|
-
function time(args) {
|
|
666
|
+
function time$1(args) {
|
|
1072
667
|
return new RegExp(`^${timeSource(args)}$`);
|
|
1073
668
|
}
|
|
1074
|
-
function datetime(args) {
|
|
669
|
+
function datetime$1(args) {
|
|
670
|
+
const time = timeSource({ precision: args.precision });
|
|
1075
671
|
const opts = ["Z"];
|
|
672
|
+
if (args.local) opts.push("");
|
|
1076
673
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1077
|
-
const
|
|
1078
|
-
precision: args.precision,
|
|
1079
|
-
seconds: true
|
|
1080
|
-
})}(?:${opts.join("|")})`;
|
|
1081
|
-
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
674
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
1082
675
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
1083
676
|
}
|
|
1084
|
-
const
|
|
677
|
+
const string$1 = (params) => {
|
|
678
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
679
|
+
return new RegExp(`^${regex}$`);
|
|
680
|
+
};
|
|
681
|
+
const integer = /^-?\d+$/;
|
|
1085
682
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
1086
683
|
const boolean$1 = /^(?:true|false)$/i;
|
|
1087
684
|
const lowercase = /^[^A-Z]*$/;
|
|
1088
685
|
const uppercase = /^[^a-z]*$/;
|
|
1089
686
|
//#endregion
|
|
1090
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
687
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
1091
688
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
1092
689
|
var _a;
|
|
1093
690
|
inst._zod ?? (inst._zod = {});
|
|
1094
691
|
inst._zod.def = def;
|
|
1095
692
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
1096
693
|
});
|
|
1097
|
-
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
1098
|
-
const _whenHasLength = (payload) => {
|
|
1099
|
-
const val = payload.value;
|
|
1100
|
-
return !nullish(val) && val.length !== void 0;
|
|
1101
|
-
};
|
|
1102
694
|
const numericOriginMap = {
|
|
1103
695
|
number: "number",
|
|
1104
696
|
bigint: "bigint",
|
|
@@ -1107,10 +699,16 @@ window.__ModuleLoader__.load({
|
|
|
1107
699
|
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
1108
700
|
$ZodCheck.init(inst, def);
|
|
1109
701
|
const origin = numericOriginMap[typeof def.value];
|
|
702
|
+
inst._zod.onattach.push((inst) => {
|
|
703
|
+
const bag = inst._zod.bag;
|
|
704
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
705
|
+
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
706
|
+
else bag.exclusiveMaximum = def.value;
|
|
707
|
+
});
|
|
1110
708
|
inst._zod.check = (payload) => {
|
|
1111
709
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
1112
710
|
payload.issues.push({
|
|
1113
|
-
origin
|
|
711
|
+
origin,
|
|
1114
712
|
code: "too_big",
|
|
1115
713
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1116
714
|
input: payload.value,
|
|
@@ -1123,10 +721,16 @@ window.__ModuleLoader__.load({
|
|
|
1123
721
|
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1124
722
|
$ZodCheck.init(inst, def);
|
|
1125
723
|
const origin = numericOriginMap[typeof def.value];
|
|
724
|
+
inst._zod.onattach.push((inst) => {
|
|
725
|
+
const bag = inst._zod.bag;
|
|
726
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
727
|
+
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
728
|
+
else bag.exclusiveMinimum = def.value;
|
|
729
|
+
});
|
|
1126
730
|
inst._zod.check = (payload) => {
|
|
1127
731
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
1128
732
|
payload.issues.push({
|
|
1129
|
-
origin
|
|
733
|
+
origin,
|
|
1130
734
|
code: "too_small",
|
|
1131
735
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1132
736
|
input: payload.value,
|
|
@@ -1138,9 +742,13 @@ window.__ModuleLoader__.load({
|
|
|
1138
742
|
});
|
|
1139
743
|
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
1140
744
|
$ZodCheck.init(inst, def);
|
|
745
|
+
inst._zod.onattach.push((inst) => {
|
|
746
|
+
var _a;
|
|
747
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
748
|
+
});
|
|
1141
749
|
inst._zod.check = (payload) => {
|
|
1142
750
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1143
|
-
if (typeof payload.value === "bigint" ?
|
|
751
|
+
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1144
752
|
payload.issues.push({
|
|
1145
753
|
origin: typeof payload.value,
|
|
1146
754
|
code: "not_multiple_of",
|
|
@@ -1157,6 +765,13 @@ window.__ModuleLoader__.load({
|
|
|
1157
765
|
const isInt = def.format?.includes("int");
|
|
1158
766
|
const origin = isInt ? "int" : "number";
|
|
1159
767
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
768
|
+
inst._zod.onattach.push((inst) => {
|
|
769
|
+
const bag = inst._zod.bag;
|
|
770
|
+
bag.format = def.format;
|
|
771
|
+
bag.minimum = minimum;
|
|
772
|
+
bag.maximum = maximum;
|
|
773
|
+
if (isInt) bag.pattern = integer;
|
|
774
|
+
});
|
|
1160
775
|
inst._zod.check = (payload) => {
|
|
1161
776
|
const input = payload.value;
|
|
1162
777
|
if (isInt) {
|
|
@@ -1218,11 +833,17 @@ window.__ModuleLoader__.load({
|
|
|
1218
833
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
1219
834
|
var _a;
|
|
1220
835
|
$ZodCheck.init(inst, def);
|
|
1221
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
836
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
837
|
+
const val = payload.value;
|
|
838
|
+
return !nullish(val) && val.length !== void 0;
|
|
839
|
+
});
|
|
840
|
+
inst._zod.onattach.push((inst) => {
|
|
841
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
842
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
843
|
+
});
|
|
1222
844
|
inst._zod.check = (payload) => {
|
|
1223
845
|
const input = payload.value;
|
|
1224
|
-
|
|
1225
|
-
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
846
|
+
if (input.length <= def.maximum) return;
|
|
1226
847
|
const origin = getLengthableOrigin(input);
|
|
1227
848
|
payload.issues.push({
|
|
1228
849
|
origin,
|
|
@@ -1238,11 +859,17 @@ window.__ModuleLoader__.load({
|
|
|
1238
859
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
1239
860
|
var _a;
|
|
1240
861
|
$ZodCheck.init(inst, def);
|
|
1241
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
862
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
863
|
+
const val = payload.value;
|
|
864
|
+
return !nullish(val) && val.length !== void 0;
|
|
865
|
+
});
|
|
866
|
+
inst._zod.onattach.push((inst) => {
|
|
867
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
868
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
869
|
+
});
|
|
1242
870
|
inst._zod.check = (payload) => {
|
|
1243
871
|
const input = payload.value;
|
|
1244
|
-
|
|
1245
|
-
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
872
|
+
if (input.length >= def.minimum) return;
|
|
1246
873
|
const origin = getLengthableOrigin(input);
|
|
1247
874
|
payload.issues.push({
|
|
1248
875
|
origin,
|
|
@@ -1258,11 +885,19 @@ window.__ModuleLoader__.load({
|
|
|
1258
885
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
1259
886
|
var _a;
|
|
1260
887
|
$ZodCheck.init(inst, def);
|
|
1261
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
888
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
889
|
+
const val = payload.value;
|
|
890
|
+
return !nullish(val) && val.length !== void 0;
|
|
891
|
+
});
|
|
892
|
+
inst._zod.onattach.push((inst) => {
|
|
893
|
+
const bag = inst._zod.bag;
|
|
894
|
+
bag.minimum = def.length;
|
|
895
|
+
bag.maximum = def.length;
|
|
896
|
+
bag.length = def.length;
|
|
897
|
+
});
|
|
1262
898
|
inst._zod.check = (payload) => {
|
|
1263
899
|
const input = payload.value;
|
|
1264
|
-
const
|
|
1265
|
-
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
900
|
+
const length = input.length;
|
|
1266
901
|
if (length === def.length) return;
|
|
1267
902
|
const origin = getLengthableOrigin(input);
|
|
1268
903
|
const tooBig = length > def.length;
|
|
@@ -1286,6 +921,14 @@ window.__ModuleLoader__.load({
|
|
|
1286
921
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1287
922
|
var _a, _b;
|
|
1288
923
|
$ZodCheck.init(inst, def);
|
|
924
|
+
inst._zod.onattach.push((inst) => {
|
|
925
|
+
const bag = inst._zod.bag;
|
|
926
|
+
bag.format = def.format;
|
|
927
|
+
if (def.pattern) {
|
|
928
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
929
|
+
bag.patterns.add(def.pattern);
|
|
930
|
+
}
|
|
931
|
+
});
|
|
1289
932
|
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1290
933
|
def.pattern.lastIndex = 0;
|
|
1291
934
|
if (def.pattern.test(payload.value)) return;
|
|
@@ -1328,7 +971,13 @@ window.__ModuleLoader__.load({
|
|
|
1328
971
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1329
972
|
$ZodCheck.init(inst, def);
|
|
1330
973
|
const escapedRegex = escapeRegex(def.includes);
|
|
1331
|
-
|
|
974
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
975
|
+
def.pattern = pattern;
|
|
976
|
+
inst._zod.onattach.push((inst) => {
|
|
977
|
+
const bag = inst._zod.bag;
|
|
978
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
979
|
+
bag.patterns.add(pattern);
|
|
980
|
+
});
|
|
1332
981
|
inst._zod.check = (payload) => {
|
|
1333
982
|
if (payload.value.includes(def.includes, def.position)) return;
|
|
1334
983
|
payload.issues.push({
|
|
@@ -1346,6 +995,11 @@ window.__ModuleLoader__.load({
|
|
|
1346
995
|
$ZodCheck.init(inst, def);
|
|
1347
996
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1348
997
|
def.pattern ?? (def.pattern = pattern);
|
|
998
|
+
inst._zod.onattach.push((inst) => {
|
|
999
|
+
const bag = inst._zod.bag;
|
|
1000
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1001
|
+
bag.patterns.add(pattern);
|
|
1002
|
+
});
|
|
1349
1003
|
inst._zod.check = (payload) => {
|
|
1350
1004
|
if (payload.value.startsWith(def.prefix)) return;
|
|
1351
1005
|
payload.issues.push({
|
|
@@ -1363,6 +1017,11 @@ window.__ModuleLoader__.load({
|
|
|
1363
1017
|
$ZodCheck.init(inst, def);
|
|
1364
1018
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1365
1019
|
def.pattern ?? (def.pattern = pattern);
|
|
1020
|
+
inst._zod.onattach.push((inst) => {
|
|
1021
|
+
const bag = inst._zod.bag;
|
|
1022
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1023
|
+
bag.patterns.add(pattern);
|
|
1024
|
+
});
|
|
1366
1025
|
inst._zod.check = (payload) => {
|
|
1367
1026
|
if (payload.value.endsWith(def.suffix)) return;
|
|
1368
1027
|
payload.issues.push({
|
|
@@ -1383,21 +1042,17 @@ window.__ModuleLoader__.load({
|
|
|
1383
1042
|
};
|
|
1384
1043
|
});
|
|
1385
1044
|
//#endregion
|
|
1386
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
1045
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
|
|
1387
1046
|
var Doc = class {
|
|
1388
|
-
constructor(args = []
|
|
1047
|
+
constructor(args = []) {
|
|
1389
1048
|
this.content = [];
|
|
1390
1049
|
this.indent = 0;
|
|
1391
|
-
this.args = args;
|
|
1392
|
-
this.closed = closed;
|
|
1050
|
+
if (this) this.args = args;
|
|
1393
1051
|
}
|
|
1394
1052
|
indented(fn) {
|
|
1395
1053
|
this.indent += 1;
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
} finally {
|
|
1399
|
-
this.indent -= 1;
|
|
1400
|
-
}
|
|
1054
|
+
fn(this);
|
|
1055
|
+
this.indent -= 1;
|
|
1401
1056
|
}
|
|
1402
1057
|
write(arg) {
|
|
1403
1058
|
if (typeof arg === "function") {
|
|
@@ -1412,27 +1067,28 @@ window.__ModuleLoader__.load({
|
|
|
1412
1067
|
}
|
|
1413
1068
|
compile() {
|
|
1414
1069
|
const F = Function;
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1070
|
+
const args = this?.args;
|
|
1071
|
+
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
1072
|
+
return new F(...args, lines.join("\n"));
|
|
1417
1073
|
}
|
|
1418
1074
|
};
|
|
1419
1075
|
//#endregion
|
|
1420
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
1076
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
1421
1077
|
const version = {
|
|
1422
1078
|
major: 4,
|
|
1423
|
-
minor:
|
|
1424
|
-
patch:
|
|
1079
|
+
minor: 4,
|
|
1080
|
+
patch: 3
|
|
1425
1081
|
};
|
|
1426
1082
|
//#endregion
|
|
1427
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
1083
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
1428
1084
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1429
1085
|
var _a;
|
|
1430
1086
|
inst ?? (inst = {});
|
|
1431
1087
|
inst._zod.def = def;
|
|
1432
1088
|
inst._zod.bag = inst._zod.bag || {};
|
|
1433
1089
|
inst._zod.version = version;
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1090
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
1091
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1436
1092
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1437
1093
|
if (checks.length === 0) {
|
|
1438
1094
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1441,7 +1097,6 @@ window.__ModuleLoader__.load({
|
|
|
1441
1097
|
});
|
|
1442
1098
|
} else {
|
|
1443
1099
|
const runChecks = (payload, checks, ctx) => {
|
|
1444
|
-
if (payload.memo) return payload;
|
|
1445
1100
|
let isAborted = aborted(payload);
|
|
1446
1101
|
let asyncResult;
|
|
1447
1102
|
for (const ch of checks) {
|
|
@@ -1455,12 +1110,10 @@ window.__ModuleLoader__.load({
|
|
|
1455
1110
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1456
1111
|
await _;
|
|
1457
1112
|
if (payload.issues.length === currLen) return;
|
|
1458
|
-
attachSchema(payload.issues, currLen, inst);
|
|
1459
1113
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1460
1114
|
});
|
|
1461
1115
|
else {
|
|
1462
1116
|
if (payload.issues.length === currLen) continue;
|
|
1463
|
-
attachSchema(payload.issues, currLen, inst);
|
|
1464
1117
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1465
1118
|
}
|
|
1466
1119
|
}
|
|
@@ -1504,43 +1157,22 @@ window.__ModuleLoader__.load({
|
|
|
1504
1157
|
return runChecks(result, checks, ctx);
|
|
1505
1158
|
};
|
|
1506
1159
|
}
|
|
1507
|
-
|
|
1508
|
-
get "~standard"() {
|
|
1509
|
-
return hide(this, "~standard", standardProps(this));
|
|
1510
|
-
},
|
|
1511
|
-
set "~standard"(value) {
|
|
1512
|
-
own(this, "~standard", value);
|
|
1513
|
-
}
|
|
1514
|
-
});
|
|
1515
|
-
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1516
|
-
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1517
|
-
async function validateAsync(inst, value) {
|
|
1518
|
-
const ctx = { async: true };
|
|
1519
|
-
return toStandardResult(await inst._zod.run({
|
|
1520
|
-
value,
|
|
1521
|
-
issues: []
|
|
1522
|
-
}, ctx), ctx);
|
|
1523
|
-
}
|
|
1524
|
-
function standardProps(inst) {
|
|
1525
|
-
return {
|
|
1160
|
+
defineLazy(inst, "~standard", () => ({
|
|
1526
1161
|
validate: (value) => {
|
|
1527
|
-
const ctx = { async: false };
|
|
1528
1162
|
try {
|
|
1529
|
-
const r = inst
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
} catch (_) {}
|
|
1535
|
-
return validateAsync(inst, value);
|
|
1163
|
+
const r = safeParse$1(inst, value);
|
|
1164
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1165
|
+
} catch (_) {
|
|
1166
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1167
|
+
}
|
|
1536
1168
|
},
|
|
1537
1169
|
vendor: "zod",
|
|
1538
1170
|
version: 1
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1171
|
+
}));
|
|
1172
|
+
});
|
|
1541
1173
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1542
1174
|
$ZodType.init(inst, def);
|
|
1543
|
-
inst._zod.pattern =
|
|
1175
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
1544
1176
|
inst._zod.parse = (payload, _) => {
|
|
1545
1177
|
if (def.coerce) try {
|
|
1546
1178
|
payload.value = String(payload.value);
|
|
@@ -1584,95 +1216,51 @@ window.__ModuleLoader__.load({
|
|
|
1584
1216
|
def.pattern ?? (def.pattern = email);
|
|
1585
1217
|
$ZodStringFormat.init(inst, def);
|
|
1586
1218
|
});
|
|
1587
|
-
function canParseURL(input) {
|
|
1588
|
-
try {
|
|
1589
|
-
if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
|
|
1590
|
-
new URL(input);
|
|
1591
|
-
return true;
|
|
1592
|
-
} catch {
|
|
1593
|
-
return false;
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
function validateURL(trimmed, def) {
|
|
1597
|
-
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
|
|
1598
|
-
return parseURLObject(trimmed, def);
|
|
1599
|
-
}
|
|
1600
|
-
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
1601
|
-
function parseURLObject(trimmed, def) {
|
|
1602
|
-
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1603
|
-
try {
|
|
1604
|
-
if (typeof URL !== "undefined") {
|
|
1605
|
-
const URLStatic = URL;
|
|
1606
|
-
if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
|
|
1607
|
-
}
|
|
1608
|
-
return new URL(trimmed);
|
|
1609
|
-
} catch {
|
|
1610
|
-
return 2;
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1614
|
-
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
1615
|
-
function stripTabAndNewline(value) {
|
|
1616
|
-
return value.replace(asciiTabOrNewline, "");
|
|
1617
|
-
}
|
|
1618
|
-
function urlHostnameOk(url, hostname) {
|
|
1619
|
-
hostname.lastIndex = 0;
|
|
1620
|
-
return hostname.test(url.hostname);
|
|
1621
|
-
}
|
|
1622
|
-
function urlProtocolOk(url, protocol) {
|
|
1623
|
-
protocol.lastIndex = 0;
|
|
1624
|
-
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1625
|
-
}
|
|
1626
1219
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1627
1220
|
$ZodStringFormat.init(inst, def);
|
|
1628
1221
|
inst._zod.check = (payload) => {
|
|
1629
1222
|
try {
|
|
1630
1223
|
const trimmed = payload.value.trim();
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1224
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
1225
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
1226
|
+
payload.issues.push({
|
|
1227
|
+
code: "invalid_format",
|
|
1228
|
+
format: "url",
|
|
1229
|
+
note: "Invalid URL format",
|
|
1230
|
+
input: payload.value,
|
|
1231
|
+
inst,
|
|
1232
|
+
continue: !def.abort
|
|
1233
|
+
});
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
const url = new URL(trimmed);
|
|
1238
|
+
if (def.hostname) {
|
|
1239
|
+
def.hostname.lastIndex = 0;
|
|
1240
|
+
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1634
1241
|
code: "invalid_format",
|
|
1635
1242
|
format: "url",
|
|
1636
|
-
note: "Invalid
|
|
1243
|
+
note: "Invalid hostname",
|
|
1244
|
+
pattern: def.hostname.source,
|
|
1637
1245
|
input: payload.value,
|
|
1638
1246
|
inst,
|
|
1639
1247
|
continue: !def.abort
|
|
1640
1248
|
});
|
|
1641
|
-
return;
|
|
1642
1249
|
}
|
|
1643
|
-
if (
|
|
1644
|
-
|
|
1250
|
+
if (def.protocol) {
|
|
1251
|
+
def.protocol.lastIndex = 0;
|
|
1252
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1645
1253
|
code: "invalid_format",
|
|
1646
1254
|
format: "url",
|
|
1255
|
+
note: "Invalid protocol",
|
|
1256
|
+
pattern: def.protocol.source,
|
|
1647
1257
|
input: payload.value,
|
|
1648
1258
|
inst,
|
|
1649
1259
|
continue: !def.abort
|
|
1650
1260
|
});
|
|
1651
|
-
return;
|
|
1652
|
-
}
|
|
1653
|
-
if (url === true) {
|
|
1654
|
-
payload.value = stripTabAndNewline(trimmed);
|
|
1655
|
-
return;
|
|
1656
1261
|
}
|
|
1657
|
-
if (def.
|
|
1658
|
-
|
|
1659
|
-
format: "url",
|
|
1660
|
-
note: "Invalid hostname",
|
|
1661
|
-
pattern: def.hostname.source,
|
|
1662
|
-
input: payload.value,
|
|
1663
|
-
inst,
|
|
1664
|
-
continue: !def.abort
|
|
1665
|
-
});
|
|
1666
|
-
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1667
|
-
code: "invalid_format",
|
|
1668
|
-
format: "url",
|
|
1669
|
-
note: "Invalid protocol",
|
|
1670
|
-
pattern: def.protocol.source,
|
|
1671
|
-
input: payload.value,
|
|
1672
|
-
inst,
|
|
1673
|
-
continue: !def.abort
|
|
1674
|
-
});
|
|
1675
|
-
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1262
|
+
if (def.normalize) payload.value = url.href;
|
|
1263
|
+
else payload.value = trimmed;
|
|
1676
1264
|
return;
|
|
1677
1265
|
} catch (_) {
|
|
1678
1266
|
payload.issues.push({
|
|
@@ -1690,8 +1278,7 @@ window.__ModuleLoader__.load({
|
|
|
1690
1278
|
$ZodStringFormat.init(inst, def);
|
|
1691
1279
|
});
|
|
1692
1280
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1693
|
-
|
|
1694
|
-
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1281
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
1695
1282
|
$ZodStringFormat.init(inst, def);
|
|
1696
1283
|
});
|
|
1697
1284
|
/**
|
|
@@ -1720,69 +1307,70 @@ window.__ModuleLoader__.load({
|
|
|
1720
1307
|
$ZodStringFormat.init(inst, def);
|
|
1721
1308
|
});
|
|
1722
1309
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1723
|
-
def.pattern ?? (def.pattern = datetime(def));
|
|
1310
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1724
1311
|
$ZodStringFormat.init(inst, def);
|
|
1725
1312
|
});
|
|
1726
1313
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1727
|
-
def.pattern ?? (def.pattern = date);
|
|
1314
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1728
1315
|
$ZodStringFormat.init(inst, def);
|
|
1729
1316
|
});
|
|
1730
1317
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1731
|
-
def.pattern ?? (def.pattern = time(def));
|
|
1318
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1732
1319
|
$ZodStringFormat.init(inst, def);
|
|
1733
1320
|
});
|
|
1734
1321
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1735
|
-
def.pattern ?? (def.pattern = duration);
|
|
1322
|
+
def.pattern ?? (def.pattern = duration$1);
|
|
1736
1323
|
$ZodStringFormat.init(inst, def);
|
|
1737
1324
|
});
|
|
1738
1325
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1739
1326
|
def.pattern ?? (def.pattern = ipv4);
|
|
1740
1327
|
$ZodStringFormat.init(inst, def);
|
|
1328
|
+
inst._zod.bag.format = `ipv4`;
|
|
1741
1329
|
});
|
|
1742
|
-
/** 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`. */
|
|
1743
|
-
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1744
|
-
function isValidIPv6(value) {
|
|
1745
|
-
if (!ipv6Alphabet.test(value)) return false;
|
|
1746
|
-
return canParseURL(`http://[${value}]`);
|
|
1747
|
-
}
|
|
1748
1330
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1749
1331
|
def.pattern ?? (def.pattern = ipv6);
|
|
1750
1332
|
$ZodStringFormat.init(inst, def);
|
|
1333
|
+
inst._zod.bag.format = `ipv6`;
|
|
1751
1334
|
inst._zod.check = (payload) => {
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1335
|
+
try {
|
|
1336
|
+
new URL(`http://[${payload.value}]`);
|
|
1337
|
+
} catch {
|
|
1338
|
+
payload.issues.push({
|
|
1339
|
+
code: "invalid_format",
|
|
1340
|
+
format: "ipv6",
|
|
1341
|
+
input: payload.value,
|
|
1342
|
+
inst,
|
|
1343
|
+
continue: !def.abort
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1759
1346
|
};
|
|
1760
1347
|
});
|
|
1761
1348
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1762
1349
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1763
1350
|
$ZodStringFormat.init(inst, def);
|
|
1764
1351
|
});
|
|
1765
|
-
function isValidCIDRv6(value) {
|
|
1766
|
-
const parts = value.split("/");
|
|
1767
|
-
if (parts.length !== 2) return false;
|
|
1768
|
-
const [address, prefix] = parts;
|
|
1769
|
-
if (!prefix) return false;
|
|
1770
|
-
const prefixNum = Number(prefix);
|
|
1771
|
-
if (`${prefixNum}` !== prefix) return false;
|
|
1772
|
-
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1773
|
-
return isValidIPv6(address);
|
|
1774
|
-
}
|
|
1775
1352
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1776
1353
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1777
1354
|
$ZodStringFormat.init(inst, def);
|
|
1778
1355
|
inst._zod.check = (payload) => {
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1356
|
+
const parts = payload.value.split("/");
|
|
1357
|
+
try {
|
|
1358
|
+
if (parts.length !== 2) throw new Error();
|
|
1359
|
+
const [address, prefix] = parts;
|
|
1360
|
+
if (!prefix) throw new Error();
|
|
1361
|
+
const prefixNum = Number(prefix);
|
|
1362
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1363
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1364
|
+
new URL(`http://[${address}]`);
|
|
1365
|
+
} catch {
|
|
1366
|
+
payload.issues.push({
|
|
1367
|
+
code: "invalid_format",
|
|
1368
|
+
format: "cidrv6",
|
|
1369
|
+
input: payload.value,
|
|
1370
|
+
inst,
|
|
1371
|
+
continue: !def.abort
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1786
1374
|
};
|
|
1787
1375
|
});
|
|
1788
1376
|
function isValidBase64(data) {
|
|
@@ -1796,10 +1384,10 @@ window.__ModuleLoader__.load({
|
|
|
1796
1384
|
return false;
|
|
1797
1385
|
}
|
|
1798
1386
|
}
|
|
1799
|
-
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1800
1387
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1801
|
-
def.pattern ?? (def.pattern =
|
|
1388
|
+
def.pattern ?? (def.pattern = base64);
|
|
1802
1389
|
$ZodStringFormat.init(inst, def);
|
|
1390
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
1803
1391
|
inst._zod.check = (payload) => {
|
|
1804
1392
|
if (isValidBase64(payload.value)) return;
|
|
1805
1393
|
payload.issues.push({
|
|
@@ -1811,15 +1399,15 @@ window.__ModuleLoader__.load({
|
|
|
1811
1399
|
});
|
|
1812
1400
|
};
|
|
1813
1401
|
});
|
|
1814
|
-
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1815
1402
|
function isValidBase64URL(data) {
|
|
1816
|
-
if (!
|
|
1403
|
+
if (!base64url.test(data)) return false;
|
|
1817
1404
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1818
1405
|
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1819
1406
|
}
|
|
1820
1407
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1821
|
-
def.pattern ?? (def.pattern =
|
|
1408
|
+
def.pattern ?? (def.pattern = base64url);
|
|
1822
1409
|
$ZodStringFormat.init(inst, def);
|
|
1410
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
1823
1411
|
inst._zod.check = (payload) => {
|
|
1824
1412
|
if (isValidBase64URL(payload.value)) return;
|
|
1825
1413
|
payload.issues.push({
|
|
@@ -1865,14 +1453,14 @@ window.__ModuleLoader__.load({
|
|
|
1865
1453
|
});
|
|
1866
1454
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1867
1455
|
$ZodType.init(inst, def);
|
|
1868
|
-
inst._zod.pattern = number$1;
|
|
1456
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
1869
1457
|
inst._zod.parse = (payload, _ctx) => {
|
|
1870
1458
|
if (def.coerce) try {
|
|
1871
1459
|
payload.value = Number(payload.value);
|
|
1872
1460
|
} catch (_) {}
|
|
1873
1461
|
const input = payload.value;
|
|
1874
1462
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1875
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1463
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
1876
1464
|
payload.issues.push({
|
|
1877
1465
|
expected: "number",
|
|
1878
1466
|
code: "invalid_type",
|
|
@@ -1931,8 +1519,6 @@ window.__ModuleLoader__.load({
|
|
|
1931
1519
|
}
|
|
1932
1520
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1933
1521
|
$ZodType.init(inst, def);
|
|
1934
|
-
const memo = globalConfig.memoizer;
|
|
1935
|
-
memo?.attach(inst);
|
|
1936
1522
|
inst._zod.parse = (payload, ctx) => {
|
|
1937
1523
|
const input = payload.value;
|
|
1938
1524
|
if (!Array.isArray(input)) {
|
|
@@ -1944,9 +1530,8 @@ window.__ModuleLoader__.load({
|
|
|
1944
1530
|
});
|
|
1945
1531
|
return payload;
|
|
1946
1532
|
}
|
|
1947
|
-
payload.value =
|
|
1533
|
+
payload.value = Array(input.length);
|
|
1948
1534
|
const proms = [];
|
|
1949
|
-
const abortEarly = ctx?.abortEarly;
|
|
1950
1535
|
for (let i = 0; i < input.length; i++) {
|
|
1951
1536
|
const item = input[i];
|
|
1952
1537
|
const result = def.element._zod.run({
|
|
@@ -1954,24 +1539,19 @@ window.__ModuleLoader__.load({
|
|
|
1954
1539
|
issues: []
|
|
1955
1540
|
}, ctx);
|
|
1956
1541
|
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1957
|
-
else
|
|
1958
|
-
handleArrayResult(result, payload, i);
|
|
1959
|
-
if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
|
|
1960
|
-
}
|
|
1542
|
+
else handleArrayResult(result, payload, i);
|
|
1961
1543
|
}
|
|
1962
1544
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1963
1545
|
return payload;
|
|
1964
1546
|
};
|
|
1965
1547
|
});
|
|
1966
|
-
function handlePropertyResult(result, final, key, input,
|
|
1548
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
1967
1549
|
const isPresent = key in input;
|
|
1968
|
-
const isOptionalOut = optout === "optional";
|
|
1969
|
-
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1970
1550
|
if (result.issues.length) {
|
|
1971
|
-
if (
|
|
1551
|
+
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
1972
1552
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1973
1553
|
}
|
|
1974
|
-
if (!isPresent &&
|
|
1554
|
+
if (!isPresent && !isOptionalIn) {
|
|
1975
1555
|
if (!result.issues.length) final.issues.push({
|
|
1976
1556
|
code: "invalid_type",
|
|
1977
1557
|
expected: "nonoptional",
|
|
@@ -1981,44 +1561,31 @@ window.__ModuleLoader__.load({
|
|
|
1981
1561
|
return;
|
|
1982
1562
|
}
|
|
1983
1563
|
if (result.value === void 0) {
|
|
1984
|
-
if (isPresent
|
|
1564
|
+
if (isPresent) final.value[key] = void 0;
|
|
1985
1565
|
} else final.value[key] = result.value;
|
|
1986
1566
|
}
|
|
1987
|
-
const NO_SYMBOL_KEYS = [];
|
|
1988
1567
|
function normalizeDef(def) {
|
|
1989
1568
|
const keys = Object.keys(def.shape);
|
|
1990
|
-
const
|
|
1991
|
-
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
1992
|
-
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
1993
|
-
for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
1569
|
+
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1994
1570
|
const okeys = optionalKeys(def.shape);
|
|
1995
1571
|
return {
|
|
1996
1572
|
...def,
|
|
1997
|
-
|
|
1998
|
-
symbolKeys,
|
|
1573
|
+
keys,
|
|
1999
1574
|
keySet: new Set(keys),
|
|
2000
1575
|
numKeys: keys.length,
|
|
2001
1576
|
optionalKeys: new Set(okeys)
|
|
2002
1577
|
};
|
|
2003
1578
|
}
|
|
2004
|
-
function handleCatchall(proms, input, payload, ctx, def, inst
|
|
1579
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2005
1580
|
const unrecognized = [];
|
|
2006
1581
|
const keySet = def.keySet;
|
|
2007
1582
|
const _catchall = def.catchall._zod;
|
|
2008
1583
|
const t = _catchall.def.type;
|
|
2009
|
-
const
|
|
2010
|
-
const
|
|
2011
|
-
let seen = 0;
|
|
1584
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
1585
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
2012
1586
|
for (const key in input) {
|
|
2013
|
-
if (
|
|
2014
|
-
if (aborted(payload, seen)) break;
|
|
2015
|
-
seen = payload.issues.length;
|
|
2016
|
-
}
|
|
1587
|
+
if (key === "__proto__") continue;
|
|
2017
1588
|
if (keySet.has(key)) continue;
|
|
2018
|
-
if (key === "__proto__") {
|
|
2019
|
-
if (t === "never") unrecognized.push(key);
|
|
2020
|
-
continue;
|
|
2021
|
-
}
|
|
2022
1589
|
if (t === "never") {
|
|
2023
1590
|
unrecognized.push(key);
|
|
2024
1591
|
continue;
|
|
@@ -2027,15 +1594,14 @@ window.__ModuleLoader__.load({
|
|
|
2027
1594
|
value: input[key],
|
|
2028
1595
|
issues: []
|
|
2029
1596
|
}, ctx);
|
|
2030
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
2031
|
-
else handlePropertyResult(r, payload, key, input,
|
|
1597
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1598
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
2032
1599
|
}
|
|
2033
1600
|
if (unrecognized.length) payload.issues.push({
|
|
2034
1601
|
code: "unrecognized_keys",
|
|
2035
1602
|
keys: unrecognized,
|
|
2036
1603
|
input,
|
|
2037
|
-
inst
|
|
2038
|
-
continue: true
|
|
1604
|
+
inst
|
|
2039
1605
|
});
|
|
2040
1606
|
if (!proms.length) return payload;
|
|
2041
1607
|
return Promise.all(proms).then(() => {
|
|
@@ -2044,41 +1610,34 @@ window.__ModuleLoader__.load({
|
|
|
2044
1610
|
}
|
|
2045
1611
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
2046
1612
|
$ZodType.init(inst, def);
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
const get = () => {
|
|
1613
|
+
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1614
|
+
const sh = def.shape;
|
|
1615
|
+
Object.defineProperty(def, "shape", { get: () => {
|
|
2051
1616
|
const newSh = { ...sh };
|
|
2052
1617
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
2053
|
-
get.raw = newSh;
|
|
2054
1618
|
return newSh;
|
|
2055
|
-
};
|
|
2056
|
-
get.raw = sh;
|
|
2057
|
-
Object.defineProperty(def, "shape", { get });
|
|
1619
|
+
} });
|
|
2058
1620
|
}
|
|
2059
1621
|
const _normalized = cached(() => normalizeDef(def));
|
|
2060
|
-
|
|
2061
|
-
const shape =
|
|
1622
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1623
|
+
const shape = def.shape;
|
|
2062
1624
|
const propValues = {};
|
|
2063
1625
|
for (const key in shape) {
|
|
2064
1626
|
const field = shape[key]._zod;
|
|
2065
1627
|
if (field.values) {
|
|
2066
|
-
|
|
1628
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
2067
1629
|
for (const v of field.values) propValues[key].add(v);
|
|
2068
|
-
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
2069
1630
|
}
|
|
2070
1631
|
}
|
|
2071
1632
|
return propValues;
|
|
2072
1633
|
});
|
|
2073
|
-
const isObject$
|
|
1634
|
+
const isObject$2 = isObject;
|
|
2074
1635
|
const catchall = def.catchall;
|
|
2075
1636
|
let value;
|
|
2076
|
-
const memo = globalConfig.memoizer;
|
|
2077
|
-
memo?.attach(inst);
|
|
2078
1637
|
inst._zod.parse = (payload, ctx) => {
|
|
2079
1638
|
value ?? (value = _normalized.value);
|
|
2080
1639
|
const input = payload.value;
|
|
2081
|
-
if (!isObject$
|
|
1640
|
+
if (!isObject$2(input)) {
|
|
2082
1641
|
payload.issues.push({
|
|
2083
1642
|
expected: "object",
|
|
2084
1643
|
code: "invalid_type",
|
|
@@ -2087,90 +1646,77 @@ window.__ModuleLoader__.load({
|
|
|
2087
1646
|
});
|
|
2088
1647
|
return payload;
|
|
2089
1648
|
}
|
|
2090
|
-
payload.value =
|
|
1649
|
+
payload.value = {};
|
|
2091
1650
|
const proms = [];
|
|
2092
1651
|
const shape = value.shape;
|
|
2093
|
-
const
|
|
2094
|
-
let seen = payload.issues.length;
|
|
2095
|
-
for (const key of value.allKeys) {
|
|
2096
|
-
if (abortEarly && payload.issues.length !== seen) {
|
|
2097
|
-
if (aborted(payload, seen)) break;
|
|
2098
|
-
seen = payload.issues.length;
|
|
2099
|
-
}
|
|
2100
|
-
if (key === "__proto__") continue;
|
|
1652
|
+
for (const key of value.keys) {
|
|
2101
1653
|
const el = shape[key];
|
|
2102
|
-
const
|
|
2103
|
-
const
|
|
1654
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
1655
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
2104
1656
|
const r = el._zod.run({
|
|
2105
1657
|
value: input[key],
|
|
2106
1658
|
issues: []
|
|
2107
1659
|
}, ctx);
|
|
2108
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
2109
|
-
else handlePropertyResult(r, payload, key, input,
|
|
1660
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1661
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
2110
1662
|
}
|
|
2111
1663
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2112
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst
|
|
1664
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2113
1665
|
};
|
|
2114
1666
|
});
|
|
2115
1667
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
2116
1668
|
$ZodObject.init(inst, def);
|
|
2117
1669
|
const superParse = inst._zod.parse;
|
|
2118
1670
|
const _normalized = cached(() => normalizeDef(def));
|
|
2119
|
-
const memo = globalConfig.memoizer;
|
|
2120
1671
|
const generateFastpass = (shape) => {
|
|
1672
|
+
const doc = new Doc([
|
|
1673
|
+
"shape",
|
|
1674
|
+
"payload",
|
|
1675
|
+
"ctx"
|
|
1676
|
+
]);
|
|
2121
1677
|
const normalized = _normalized.value;
|
|
2122
|
-
const
|
|
2123
|
-
|
|
2124
|
-
shape,
|
|
2125
|
-
|
|
2126
|
-
memo,
|
|
2127
|
-
syms
|
|
2128
|
-
});
|
|
2129
|
-
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2130
|
-
const prefixStr = (id, k) => `
|
|
2131
|
-
let ${id}_ab = false;
|
|
2132
|
-
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2133
|
-
const iss = ${id}.issues[i];
|
|
2134
|
-
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2135
|
-
payload.issues.push(iss);
|
|
2136
|
-
if (iss.continue !== true) ${id}_ab = true;
|
|
2137
|
-
}
|
|
2138
|
-
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2139
|
-
payload.value = newResult;
|
|
2140
|
-
return payload;
|
|
2141
|
-
}`;
|
|
1678
|
+
const parseStr = (key) => {
|
|
1679
|
+
const k = esc(key);
|
|
1680
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1681
|
+
};
|
|
2142
1682
|
doc.write(`const input = payload.value;`);
|
|
2143
1683
|
const ids = Object.create(null);
|
|
2144
1684
|
let counter = 0;
|
|
2145
|
-
for (const key of normalized.
|
|
2146
|
-
doc.write(
|
|
2147
|
-
for (const key of normalized.
|
|
2148
|
-
if (key === "__proto__") continue;
|
|
1685
|
+
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
1686
|
+
doc.write(`const newResult = {};`);
|
|
1687
|
+
for (const key of normalized.keys) {
|
|
2149
1688
|
const id = ids[key];
|
|
2150
|
-
const k =
|
|
2151
|
-
const isPresent = `${k} in input`;
|
|
1689
|
+
const k = esc(key);
|
|
2152
1690
|
const schema = shape[key];
|
|
2153
|
-
const
|
|
2154
|
-
const isOptionalIn = optin !== void 0;
|
|
1691
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
2155
1692
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
2156
|
-
doc.write(`const ${id} = ${parseStr(
|
|
2157
|
-
if (isOptionalIn && isOptionalOut)
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
1693
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1694
|
+
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
1695
|
+
if (${id}.issues.length) {
|
|
1696
|
+
if (${k} in input) {
|
|
1697
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1698
|
+
...iss,
|
|
1699
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1700
|
+
})));
|
|
2163
1701
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
if (${id}.value === undefined) {
|
|
1705
|
+
if (${k} in input) {
|
|
1706
|
+
newResult[${k}] = undefined;
|
|
2167
1707
|
}
|
|
1708
|
+
} else {
|
|
1709
|
+
newResult[${k}] = ${id}.value;
|
|
2168
1710
|
}
|
|
2169
|
-
|
|
1711
|
+
|
|
2170
1712
|
`);
|
|
2171
|
-
|
|
2172
|
-
const ${id}_present = ${
|
|
2173
|
-
if (${id}.issues.length) {
|
|
1713
|
+
else if (!isOptionalIn) doc.write(`
|
|
1714
|
+
const ${id}_present = ${k} in input;
|
|
1715
|
+
if (${id}.issues.length) {
|
|
1716
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1717
|
+
...iss,
|
|
1718
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1719
|
+
})));
|
|
2174
1720
|
}
|
|
2175
1721
|
if (!${id}_present && !${id}.issues.length) {
|
|
2176
1722
|
payload.issues.push({
|
|
@@ -2179,36 +1725,42 @@ window.__ModuleLoader__.load({
|
|
|
2179
1725
|
input: undefined,
|
|
2180
1726
|
path: [${k}]
|
|
2181
1727
|
});
|
|
2182
|
-
if (ctx && ctx.abortEarly) {
|
|
2183
|
-
payload.value = newResult;
|
|
2184
|
-
return payload;
|
|
2185
|
-
}
|
|
2186
1728
|
}
|
|
2187
1729
|
|
|
2188
1730
|
if (${id}_present) {
|
|
2189
|
-
|
|
1731
|
+
if (${id}.value === undefined) {
|
|
1732
|
+
newResult[${k}] = undefined;
|
|
1733
|
+
} else {
|
|
1734
|
+
newResult[${k}] = ${id}.value;
|
|
1735
|
+
}
|
|
2190
1736
|
}
|
|
2191
1737
|
|
|
2192
1738
|
`);
|
|
2193
|
-
else
|
|
2194
|
-
|
|
2195
|
-
|
|
1739
|
+
else doc.write(`
|
|
1740
|
+
if (${id}.issues.length) {
|
|
1741
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1742
|
+
...iss,
|
|
1743
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1744
|
+
})));
|
|
2196
1745
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
1746
|
+
|
|
1747
|
+
if (${id}.value === undefined) {
|
|
1748
|
+
if (${k} in input) {
|
|
1749
|
+
newResult[${k}] = undefined;
|
|
1750
|
+
}
|
|
1751
|
+
} else {
|
|
2201
1752
|
newResult[${k}] = ${id}.value;
|
|
2202
1753
|
}
|
|
1754
|
+
|
|
2203
1755
|
`);
|
|
2204
|
-
}
|
|
2205
1756
|
}
|
|
2206
1757
|
doc.write(`payload.value = newResult;`);
|
|
2207
1758
|
doc.write(`return payload;`);
|
|
2208
|
-
|
|
1759
|
+
const fn = doc.compile();
|
|
1760
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2209
1761
|
};
|
|
2210
1762
|
let fastpass;
|
|
2211
|
-
const isObject$
|
|
1763
|
+
const isObject$1 = isObject;
|
|
2212
1764
|
const jit = !globalConfig.jitless;
|
|
2213
1765
|
const fastEnabled = jit && allowsEval.value;
|
|
2214
1766
|
const catchall = def.catchall;
|
|
@@ -2216,7 +1768,7 @@ window.__ModuleLoader__.load({
|
|
|
2216
1768
|
inst._zod.parse = (payload, ctx) => {
|
|
2217
1769
|
value ?? (value = _normalized.value);
|
|
2218
1770
|
const input = payload.value;
|
|
2219
|
-
if (!isObject$
|
|
1771
|
+
if (!isObject$1(input)) {
|
|
2220
1772
|
payload.issues.push({
|
|
2221
1773
|
expected: "object",
|
|
2222
1774
|
code: "invalid_type",
|
|
@@ -2229,7 +1781,7 @@ window.__ModuleLoader__.load({
|
|
|
2229
1781
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
2230
1782
|
payload = fastpass(payload, ctx);
|
|
2231
1783
|
if (!catchall) return payload;
|
|
2232
|
-
return handleCatchall([], input, payload, ctx, value, inst
|
|
1784
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2233
1785
|
}
|
|
2234
1786
|
return superParse(payload, ctx);
|
|
2235
1787
|
};
|
|
@@ -2254,14 +1806,14 @@ window.__ModuleLoader__.load({
|
|
|
2254
1806
|
}
|
|
2255
1807
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
2256
1808
|
$ZodType.init(inst, def);
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
if (
|
|
1809
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1810
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1811
|
+
defineLazy(inst._zod, "values", () => {
|
|
1812
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2261
1813
|
});
|
|
2262
|
-
|
|
2263
|
-
if (
|
|
2264
|
-
const patterns =
|
|
1814
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1815
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
1816
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2265
1817
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
2266
1818
|
}
|
|
2267
1819
|
});
|
|
@@ -2323,9 +1875,7 @@ window.__ModuleLoader__.load({
|
|
|
2323
1875
|
...a,
|
|
2324
1876
|
...b
|
|
2325
1877
|
};
|
|
2326
|
-
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
2327
1878
|
for (const key of sharedKeys) {
|
|
2328
|
-
if (key === "__proto__") continue;
|
|
2329
1879
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
2330
1880
|
if (!sharedValue.valid) return {
|
|
2331
1881
|
valid: false,
|
|
@@ -2367,39 +1917,26 @@ window.__ModuleLoader__.load({
|
|
|
2367
1917
|
function handleIntersectionResults(result, left, right) {
|
|
2368
1918
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
2369
1919
|
let unrecIssue;
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2374
|
-
unrecIssue ?? (unrecIssue = iss);
|
|
2375
|
-
keys = iss.keys;
|
|
2376
|
-
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2377
|
-
const k = String(iss.path[0]);
|
|
2378
|
-
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2379
|
-
keys = [k];
|
|
2380
|
-
} else return false;
|
|
2381
|
-
for (const k of keys) {
|
|
1920
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
1921
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1922
|
+
for (const k of iss.keys) {
|
|
2382
1923
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
2383
|
-
unrecKeys.get(k)
|
|
1924
|
+
unrecKeys.get(k).l = true;
|
|
2384
1925
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2390
|
-
if (bothKeys.length) {
|
|
2391
|
-
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2392
|
-
if (aggregated.length) result.issues.push({
|
|
2393
|
-
...unrecIssue,
|
|
2394
|
-
keys: aggregated
|
|
2395
|
-
});
|
|
2396
|
-
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
1926
|
+
} else result.issues.push(iss);
|
|
1927
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
1928
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1929
|
+
unrecKeys.get(k).r = true;
|
|
2397
1930
|
}
|
|
1931
|
+
else result.issues.push(iss);
|
|
1932
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1933
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
1934
|
+
...unrecIssue,
|
|
1935
|
+
keys: bothKeys
|
|
1936
|
+
});
|
|
1937
|
+
if (aborted(result)) return result;
|
|
2398
1938
|
const merged = mergeValues(left.value, right.value);
|
|
2399
|
-
if (!merged.valid) {
|
|
2400
|
-
if (aborted(result)) return result;
|
|
2401
|
-
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2402
|
-
}
|
|
1939
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2403
1940
|
result.value = merged.data;
|
|
2404
1941
|
return result;
|
|
2405
1942
|
}
|
|
@@ -2408,10 +1945,7 @@ window.__ModuleLoader__.load({
|
|
|
2408
1945
|
const values = getEnumValues(def.entries);
|
|
2409
1946
|
const valuesSet = new Set(values);
|
|
2410
1947
|
inst._zod.values = valuesSet;
|
|
2411
|
-
|
|
2412
|
-
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2413
|
-
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2414
|
-
});
|
|
1948
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
2415
1949
|
inst._zod.parse = (payload, _ctx) => {
|
|
2416
1950
|
const input = payload.value;
|
|
2417
1951
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2427,66 +1961,67 @@ window.__ModuleLoader__.load({
|
|
|
2427
1961
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2428
1962
|
$ZodType.init(inst, def);
|
|
2429
1963
|
inst._zod.optin = "optional";
|
|
2430
|
-
globalConfig.memoizer?.guard(inst);
|
|
2431
1964
|
inst._zod.parse = (payload, ctx) => {
|
|
2432
1965
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2433
1966
|
const _out = def.transform(payload.value, payload);
|
|
2434
1967
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2435
1968
|
payload.value = output;
|
|
1969
|
+
payload.fallback = true;
|
|
2436
1970
|
return payload;
|
|
2437
1971
|
});
|
|
2438
1972
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2439
1973
|
payload.value = _out;
|
|
1974
|
+
payload.fallback = true;
|
|
2440
1975
|
return payload;
|
|
2441
1976
|
};
|
|
2442
1977
|
});
|
|
2443
|
-
function handleOptionalResult(
|
|
2444
|
-
|
|
2445
|
-
|
|
1978
|
+
function handleOptionalResult(result, input) {
|
|
1979
|
+
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
1980
|
+
issues: [],
|
|
1981
|
+
value: void 0
|
|
1982
|
+
};
|
|
1983
|
+
return result;
|
|
2446
1984
|
}
|
|
2447
1985
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2448
1986
|
$ZodType.init(inst, def);
|
|
2449
|
-
|
|
1987
|
+
inst._zod.optin = "optional";
|
|
2450
1988
|
inst._zod.optout = "optional";
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
1989
|
+
defineLazy(inst._zod, "values", () => {
|
|
1990
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2454
1991
|
});
|
|
2455
|
-
|
|
2456
|
-
const pattern =
|
|
1992
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1993
|
+
const pattern = def.innerType._zod.pattern;
|
|
2457
1994
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2458
1995
|
});
|
|
2459
1996
|
inst._zod.parse = (payload, ctx) => {
|
|
2460
|
-
if (
|
|
2461
|
-
|
|
2462
|
-
const result = def.innerType._zod.run(
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
}, ctx);
|
|
2466
|
-
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2467
|
-
return handleOptionalResult(payload, result);
|
|
1997
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1998
|
+
const input = payload.value;
|
|
1999
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2000
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
2001
|
+
return handleOptionalResult(result, input);
|
|
2468
2002
|
}
|
|
2003
|
+
if (payload.value === void 0) return payload;
|
|
2469
2004
|
return def.innerType._zod.run(payload, ctx);
|
|
2470
2005
|
};
|
|
2471
2006
|
});
|
|
2472
2007
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2473
2008
|
$ZodOptional.init(inst, def);
|
|
2474
|
-
|
|
2475
|
-
|
|
2009
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2010
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2476
2011
|
inst._zod.parse = (payload, ctx) => {
|
|
2477
2012
|
return def.innerType._zod.run(payload, ctx);
|
|
2478
2013
|
};
|
|
2479
2014
|
});
|
|
2480
2015
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2481
2016
|
$ZodType.init(inst, def);
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
const pattern =
|
|
2017
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2018
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2019
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2020
|
+
const pattern = def.innerType._zod.pattern;
|
|
2486
2021
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2487
2022
|
});
|
|
2488
|
-
|
|
2489
|
-
return
|
|
2023
|
+
defineLazy(inst._zod, "values", () => {
|
|
2024
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2490
2025
|
});
|
|
2491
2026
|
inst._zod.parse = (payload, ctx) => {
|
|
2492
2027
|
if (payload.value === null) return payload;
|
|
@@ -2495,8 +2030,8 @@ window.__ModuleLoader__.load({
|
|
|
2495
2030
|
});
|
|
2496
2031
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2497
2032
|
$ZodType.init(inst, def);
|
|
2498
|
-
inst._zod.optin = "
|
|
2499
|
-
|
|
2033
|
+
inst._zod.optin = "optional";
|
|
2034
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2500
2035
|
inst._zod.parse = (payload, ctx) => {
|
|
2501
2036
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2502
2037
|
if (payload.value === void 0) {
|
|
@@ -2517,8 +2052,8 @@ window.__ModuleLoader__.load({
|
|
|
2517
2052
|
}
|
|
2518
2053
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2519
2054
|
$ZodType.init(inst, def);
|
|
2520
|
-
inst._zod.optin = "
|
|
2521
|
-
|
|
2055
|
+
inst._zod.optin = "optional";
|
|
2056
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2522
2057
|
inst._zod.parse = (payload, ctx) => {
|
|
2523
2058
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2524
2059
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -2527,8 +2062,8 @@ window.__ModuleLoader__.load({
|
|
|
2527
2062
|
});
|
|
2528
2063
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2529
2064
|
$ZodType.init(inst, def);
|
|
2530
|
-
|
|
2531
|
-
const v =
|
|
2065
|
+
defineLazy(inst._zod, "values", () => {
|
|
2066
|
+
const v = def.innerType._zod.values;
|
|
2532
2067
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2533
2068
|
});
|
|
2534
2069
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2546,41 +2081,46 @@ window.__ModuleLoader__.load({
|
|
|
2546
2081
|
});
|
|
2547
2082
|
return payload;
|
|
2548
2083
|
}
|
|
2549
|
-
function handleCatchResult(payload, result, def, ctx) {
|
|
2550
|
-
if (!result.issues.length) {
|
|
2551
|
-
payload.value = result.value;
|
|
2552
|
-
if (result.memo) payload.memo = true;
|
|
2553
|
-
return payload;
|
|
2554
|
-
}
|
|
2555
|
-
payload.value = def.catchValue({
|
|
2556
|
-
...result,
|
|
2557
|
-
value: payload.value,
|
|
2558
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2559
|
-
input: payload.value
|
|
2560
|
-
});
|
|
2561
|
-
return payload;
|
|
2562
|
-
}
|
|
2563
2084
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2564
2085
|
$ZodType.init(inst, def);
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2086
|
+
inst._zod.optin = "optional";
|
|
2087
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2088
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2568
2089
|
inst._zod.parse = (payload, ctx) => {
|
|
2569
2090
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2570
|
-
const result = def.innerType._zod.run(
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2091
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2092
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
2093
|
+
payload.value = result.value;
|
|
2094
|
+
if (result.issues.length) {
|
|
2095
|
+
payload.value = def.catchValue({
|
|
2096
|
+
...payload,
|
|
2097
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2098
|
+
input: payload.value
|
|
2099
|
+
});
|
|
2100
|
+
payload.issues = [];
|
|
2101
|
+
payload.fallback = true;
|
|
2102
|
+
}
|
|
2103
|
+
return payload;
|
|
2104
|
+
});
|
|
2105
|
+
payload.value = result.value;
|
|
2106
|
+
if (result.issues.length) {
|
|
2107
|
+
payload.value = def.catchValue({
|
|
2108
|
+
...payload,
|
|
2109
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2110
|
+
input: payload.value
|
|
2111
|
+
});
|
|
2112
|
+
payload.issues = [];
|
|
2113
|
+
payload.fallback = true;
|
|
2114
|
+
}
|
|
2115
|
+
return payload;
|
|
2576
2116
|
};
|
|
2577
2117
|
});
|
|
2578
2118
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2579
2119
|
$ZodType.init(inst, def);
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2120
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2121
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
2122
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2123
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2584
2124
|
inst._zod.parse = (payload, ctx) => {
|
|
2585
2125
|
if (ctx.direction === "backward") {
|
|
2586
2126
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2593,21 +2133,22 @@ window.__ModuleLoader__.load({
|
|
|
2593
2133
|
};
|
|
2594
2134
|
});
|
|
2595
2135
|
function handlePipeResult(left, next, ctx) {
|
|
2596
|
-
if (left.issues.
|
|
2136
|
+
if (left.issues.length) {
|
|
2597
2137
|
left.aborted = true;
|
|
2598
2138
|
return left;
|
|
2599
2139
|
}
|
|
2600
2140
|
return next._zod.run({
|
|
2601
2141
|
value: left.value,
|
|
2602
|
-
issues: left.issues
|
|
2142
|
+
issues: left.issues,
|
|
2143
|
+
fallback: left.fallback
|
|
2603
2144
|
}, ctx);
|
|
2604
2145
|
}
|
|
2605
2146
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2606
2147
|
$ZodType.init(inst, def);
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2148
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2149
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2150
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2151
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2611
2152
|
inst._zod.parse = (payload, ctx) => {
|
|
2612
2153
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2613
2154
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2616,398 +2157,37 @@ window.__ModuleLoader__.load({
|
|
|
2616
2157
|
};
|
|
2617
2158
|
});
|
|
2618
2159
|
function handleReadonlyResult(payload) {
|
|
2619
|
-
|
|
2160
|
+
payload.value = Object.freeze(payload.value);
|
|
2620
2161
|
return payload;
|
|
2621
2162
|
}
|
|
2622
2163
|
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2623
|
-
$ZodCheck.init(inst, def);
|
|
2624
|
-
$ZodType.init(inst, def);
|
|
2625
|
-
inst._zod.parse = (payload, _) => {
|
|
2626
|
-
return payload;
|
|
2627
|
-
};
|
|
2628
|
-
inst._zod.check = (payload) => {
|
|
2629
|
-
const input = payload.value;
|
|
2630
|
-
const r = def.fn(input);
|
|
2631
|
-
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2632
|
-
handleRefineResult(r, payload, input, inst);
|
|
2633
|
-
};
|
|
2634
|
-
});
|
|
2635
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
2636
|
-
if (!result) {
|
|
2637
|
-
const _iss = {
|
|
2638
|
-
code: "custom",
|
|
2639
|
-
input,
|
|
2640
|
-
inst,
|
|
2641
|
-
path: [...inst._zod.def.path ?? []],
|
|
2642
|
-
continue: !inst._zod.def.abort
|
|
2643
|
-
};
|
|
2644
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2645
|
-
payload.issues.push(issue(_iss));
|
|
2646
|
-
}
|
|
2647
|
-
}
|
|
2648
|
-
//#endregion
|
|
2649
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
|
|
2650
|
-
var $ZodCyclicError = class extends Error {
|
|
2651
|
-
constructor() {
|
|
2652
|
-
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2653
|
-
this.name = "ZodCyclicError";
|
|
2654
|
-
}
|
|
2655
|
-
};
|
|
2656
|
-
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2657
|
-
const STATE = "~memo";
|
|
2658
|
-
const NO_ISSUES = [];
|
|
2659
|
-
function isRef(value) {
|
|
2660
|
-
return value !== null && typeof value === "object";
|
|
2661
|
-
}
|
|
2662
|
-
function cloneIssues(issues) {
|
|
2663
|
-
return issues.map((iss) => iss.path ? {
|
|
2664
|
-
...iss,
|
|
2665
|
-
path: iss.path.slice()
|
|
2666
|
-
} : { ...iss });
|
|
2667
|
-
}
|
|
2668
|
-
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2669
|
-
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
2670
|
-
const NONE = 0;
|
|
2671
|
-
const ASSUMED = 1;
|
|
2672
|
-
const PROVEN = 2;
|
|
2673
|
-
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2674
|
-
function isRecursive(inst, stack, resolve) {
|
|
2675
|
-
const cached = recursive.get(inst);
|
|
2676
|
-
if (cached !== void 0) return cached ? PROVEN : NONE;
|
|
2677
|
-
if (stack.has(inst)) return PROVEN;
|
|
2678
|
-
stack.add(inst);
|
|
2679
|
-
let result = NONE;
|
|
2680
|
-
const check = (child) => {
|
|
2681
|
-
if (result !== PROVEN && child?._zod) {
|
|
2682
|
-
const answer = isRecursive(child, stack, resolve);
|
|
2683
|
-
if (answer > result) result = answer;
|
|
2684
|
-
}
|
|
2685
|
-
};
|
|
2686
|
-
const shape = (sh, spread) => {
|
|
2687
|
-
let answer = NONE;
|
|
2688
|
-
for (const key of Reflect.ownKeys(sh)) {
|
|
2689
|
-
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
2690
|
-
if (spread && !desc.enumerable) continue;
|
|
2691
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
2692
|
-
if (child > answer) answer = child;
|
|
2693
|
-
}
|
|
2694
|
-
return answer;
|
|
2695
|
-
};
|
|
2696
|
-
const merge = (answer) => {
|
|
2697
|
-
if (answer > result) result = answer;
|
|
2698
|
-
};
|
|
2699
|
-
const def = inst._zod.def;
|
|
2700
|
-
switch (def.type) {
|
|
2701
|
-
case "object": {
|
|
2702
|
-
const raw = rawShape(def);
|
|
2703
|
-
merge(raw ? shape(raw, true) : ASSUMED);
|
|
2704
|
-
check(def.catchall);
|
|
2705
|
-
break;
|
|
2706
|
-
}
|
|
2707
|
-
case "array":
|
|
2708
|
-
check(def.element);
|
|
2709
|
-
break;
|
|
2710
|
-
case "tuple":
|
|
2711
|
-
for (const el of def.items) check(el);
|
|
2712
|
-
check(def.rest);
|
|
2713
|
-
break;
|
|
2714
|
-
case "record":
|
|
2715
|
-
case "map":
|
|
2716
|
-
check(def.keyType);
|
|
2717
|
-
check(def.valueType);
|
|
2718
|
-
break;
|
|
2719
|
-
case "set":
|
|
2720
|
-
check(def.valueType);
|
|
2721
|
-
break;
|
|
2722
|
-
case "union":
|
|
2723
|
-
for (const el of def.options) check(el);
|
|
2724
|
-
break;
|
|
2725
|
-
case "intersection":
|
|
2726
|
-
check(def.left);
|
|
2727
|
-
check(def.right);
|
|
2728
|
-
break;
|
|
2729
|
-
case "optional":
|
|
2730
|
-
case "nullable":
|
|
2731
|
-
case "default":
|
|
2732
|
-
case "prefault":
|
|
2733
|
-
case "catch":
|
|
2734
|
-
case "readonly":
|
|
2735
|
-
case "nonoptional":
|
|
2736
|
-
case "promise":
|
|
2737
|
-
case "success":
|
|
2738
|
-
check(def.innerType);
|
|
2739
|
-
break;
|
|
2740
|
-
case "pipe":
|
|
2741
|
-
check(def.in);
|
|
2742
|
-
check(def.out);
|
|
2743
|
-
break;
|
|
2744
|
-
case "function":
|
|
2745
|
-
check(def.input);
|
|
2746
|
-
check(def.output);
|
|
2747
|
-
break;
|
|
2748
|
-
case "lazy": {
|
|
2749
|
-
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
2750
|
-
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
2751
|
-
break;
|
|
2752
|
-
}
|
|
2753
|
-
case "template_literal":
|
|
2754
|
-
case "string":
|
|
2755
|
-
case "number":
|
|
2756
|
-
case "int":
|
|
2757
|
-
case "boolean":
|
|
2758
|
-
case "bigint":
|
|
2759
|
-
case "symbol":
|
|
2760
|
-
case "undefined":
|
|
2761
|
-
case "null":
|
|
2762
|
-
case "void":
|
|
2763
|
-
case "never":
|
|
2764
|
-
case "any":
|
|
2765
|
-
case "unknown":
|
|
2766
|
-
case "date":
|
|
2767
|
-
case "nan":
|
|
2768
|
-
case "enum":
|
|
2769
|
-
case "literal":
|
|
2770
|
-
case "file":
|
|
2771
|
-
case "transform":
|
|
2772
|
-
case "custom": break;
|
|
2773
|
-
default: for (const key in def) {
|
|
2774
|
-
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
2775
|
-
if (!desc || desc.get) continue;
|
|
2776
|
-
const value = desc.value;
|
|
2777
|
-
if (!value || typeof value !== "object") continue;
|
|
2778
|
-
if (value._zod) check(value);
|
|
2779
|
-
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
stack.delete(inst);
|
|
2783
|
-
return settle(inst, result);
|
|
2784
|
-
}
|
|
2785
|
-
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
2786
|
-
function settle(inst, answer) {
|
|
2787
|
-
if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
|
|
2788
|
-
return answer;
|
|
2789
|
-
}
|
|
2790
|
-
function bucketFor(state, inst) {
|
|
2791
|
-
let bucket = state.buckets.get(inst);
|
|
2792
|
-
if (!bucket) {
|
|
2793
|
-
bucket = /* @__PURE__ */ new WeakMap();
|
|
2794
|
-
state.buckets.set(inst, bucket);
|
|
2795
|
-
}
|
|
2796
|
-
return bucket;
|
|
2797
|
-
}
|
|
2798
|
-
let handoff;
|
|
2799
|
-
const open = [];
|
|
2800
|
-
const memo = {
|
|
2801
|
-
alloc(_inst, payload, empty) {
|
|
2802
|
-
const bucket = handoff;
|
|
2803
|
-
if (!bucket) return empty;
|
|
2804
|
-
handoff = void 0;
|
|
2805
|
-
const entry = {
|
|
2806
|
-
value: empty,
|
|
2807
|
-
issues: null
|
|
2808
|
-
};
|
|
2809
|
-
bucket.set(payload.value, entry);
|
|
2810
|
-
open.push(entry);
|
|
2811
|
-
return empty;
|
|
2812
|
-
},
|
|
2813
|
-
guard(inst) {
|
|
2814
|
-
var _a;
|
|
2815
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2816
|
-
inst._zod.deferred.push(() => {
|
|
2817
|
-
const base = inst._zod.parse;
|
|
2818
|
-
const wrapped = (payload, ctx) => {
|
|
2819
|
-
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2820
|
-
return base(payload, ctx);
|
|
2821
|
-
};
|
|
2822
|
-
inst._zod.parse = wrapped;
|
|
2823
|
-
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2824
|
-
});
|
|
2825
|
-
},
|
|
2826
|
-
attach(inst) {
|
|
2827
|
-
var _a;
|
|
2828
|
-
let isRecursiveInst;
|
|
2829
|
-
let rechecked = false;
|
|
2830
|
-
let lastCtx;
|
|
2831
|
-
let lastBucket;
|
|
2832
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2833
|
-
inst._zod.deferred.push(() => {
|
|
2834
|
-
const base = inst._zod.parse;
|
|
2835
|
-
const wrapped = (payload, ctx) => {
|
|
2836
|
-
if (isRecursiveInst === void 0) {
|
|
2837
|
-
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
2838
|
-
if (walked === NONE) {
|
|
2839
|
-
inst._zod.parse = base;
|
|
2840
|
-
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2841
|
-
return base(payload, ctx);
|
|
2842
|
-
}
|
|
2843
|
-
if (walked === PROVEN || rechecked) isRecursiveInst = true;
|
|
2844
|
-
else rechecked = true;
|
|
2845
|
-
}
|
|
2846
|
-
const input = payload.value;
|
|
2847
|
-
if (!isRef(input)) return base(payload, ctx);
|
|
2848
|
-
let state = ctx[STATE];
|
|
2849
|
-
if (!state) {
|
|
2850
|
-
state = {
|
|
2851
|
-
buckets: /* @__PURE__ */ new WeakMap(),
|
|
2852
|
-
backEdges: void 0
|
|
2853
|
-
};
|
|
2854
|
-
ctx[STATE] = state;
|
|
2855
|
-
}
|
|
2856
|
-
let bucket;
|
|
2857
|
-
if (lastCtx === ctx) bucket = lastBucket;
|
|
2858
|
-
else {
|
|
2859
|
-
bucket = bucketFor(state, inst);
|
|
2860
|
-
lastCtx = ctx;
|
|
2861
|
-
lastBucket = bucket;
|
|
2862
|
-
}
|
|
2863
|
-
const hit = bucket.get(input);
|
|
2864
|
-
if (hit) {
|
|
2865
|
-
payload.value = hit.value;
|
|
2866
|
-
if (hit.issues) {
|
|
2867
|
-
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2868
|
-
} else {
|
|
2869
|
-
payload.memo = true;
|
|
2870
|
-
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
2871
|
-
state.backEdges.add(hit.value);
|
|
2872
|
-
}
|
|
2873
|
-
return payload;
|
|
2874
|
-
}
|
|
2875
|
-
handoff = bucket;
|
|
2876
|
-
const depth = open.length;
|
|
2877
|
-
const result = base(payload, ctx);
|
|
2878
|
-
handoff = void 0;
|
|
2879
|
-
const entry = open.length > depth ? open.pop() : void 0;
|
|
2880
|
-
if (result instanceof Promise) return result.then((r) => {
|
|
2881
|
-
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2882
|
-
return r;
|
|
2883
|
-
});
|
|
2884
|
-
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2885
|
-
return result;
|
|
2886
|
-
};
|
|
2887
|
-
inst._zod.parse = wrapped;
|
|
2888
|
-
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2889
|
-
});
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2893
|
-
function memoizer() {
|
|
2894
|
-
return memo;
|
|
2895
|
-
}
|
|
2896
|
-
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2897
|
-
function isBackEdge(ctx, value) {
|
|
2898
|
-
const backEdges = ctx[STATE]?.backEdges;
|
|
2899
|
-
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
2900
|
-
}
|
|
2901
|
-
//#endregion
|
|
2902
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
|
|
2903
|
-
const error = () => {
|
|
2904
|
-
const Sizable = {
|
|
2905
|
-
string: {
|
|
2906
|
-
unit: "characters",
|
|
2907
|
-
verb: "to have"
|
|
2908
|
-
},
|
|
2909
|
-
file: {
|
|
2910
|
-
unit: "bytes",
|
|
2911
|
-
verb: "to have"
|
|
2912
|
-
},
|
|
2913
|
-
array: {
|
|
2914
|
-
unit: "items",
|
|
2915
|
-
verb: "to have"
|
|
2916
|
-
},
|
|
2917
|
-
set: {
|
|
2918
|
-
unit: "items",
|
|
2919
|
-
verb: "to have"
|
|
2920
|
-
},
|
|
2921
|
-
map: {
|
|
2922
|
-
unit: "entries",
|
|
2923
|
-
verb: "to have"
|
|
2924
|
-
}
|
|
2164
|
+
$ZodCheck.init(inst, def);
|
|
2165
|
+
$ZodType.init(inst, def);
|
|
2166
|
+
inst._zod.parse = (payload, _) => {
|
|
2167
|
+
return payload;
|
|
2925
2168
|
};
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
email: "email address",
|
|
2932
|
-
url: "URL",
|
|
2933
|
-
emoji: "emoji",
|
|
2934
|
-
uuid: "UUID",
|
|
2935
|
-
uuidv4: "UUIDv4",
|
|
2936
|
-
uuidv6: "UUIDv6",
|
|
2937
|
-
nanoid: "nanoid",
|
|
2938
|
-
guid: "GUID",
|
|
2939
|
-
cuid: "cuid",
|
|
2940
|
-
cuid2: "cuid2",
|
|
2941
|
-
ulid: "ULID",
|
|
2942
|
-
xid: "XID",
|
|
2943
|
-
ksuid: "KSUID",
|
|
2944
|
-
datetime: "ISO datetime",
|
|
2945
|
-
date: "ISO date",
|
|
2946
|
-
time: "ISO time",
|
|
2947
|
-
duration: "ISO duration",
|
|
2948
|
-
ipv4: "IPv4 address",
|
|
2949
|
-
ipv6: "IPv6 address",
|
|
2950
|
-
mac: "MAC address",
|
|
2951
|
-
cidrv4: "IPv4 range",
|
|
2952
|
-
cidrv6: "IPv6 range",
|
|
2953
|
-
base64: "base64-encoded string",
|
|
2954
|
-
base64url: "base64url-encoded string",
|
|
2955
|
-
json_string: "JSON string",
|
|
2956
|
-
e164: "E.164 number",
|
|
2957
|
-
currency_code: "currency code",
|
|
2958
|
-
credit_card: "credit card number",
|
|
2959
|
-
iban: "IBAN",
|
|
2960
|
-
jwt: "JWT",
|
|
2961
|
-
template_literal: "input"
|
|
2169
|
+
inst._zod.check = (payload) => {
|
|
2170
|
+
const input = payload.value;
|
|
2171
|
+
const r = def.fn(input);
|
|
2172
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2173
|
+
handleRefineResult(r, payload, input, inst);
|
|
2962
2174
|
};
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2175
|
+
});
|
|
2176
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2177
|
+
if (!result) {
|
|
2178
|
+
const _iss = {
|
|
2179
|
+
code: "custom",
|
|
2180
|
+
input,
|
|
2181
|
+
inst,
|
|
2182
|
+
path: [...inst._zod.def.path ?? []],
|
|
2183
|
+
continue: !inst._zod.def.abort
|
|
2184
|
+
};
|
|
2185
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2186
|
+
payload.issues.push(issue(_iss));
|
|
2967
2187
|
}
|
|
2968
|
-
return (issue) => {
|
|
2969
|
-
switch (issue.code) {
|
|
2970
|
-
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
2971
|
-
case "invalid_value":
|
|
2972
|
-
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
2973
|
-
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
2974
|
-
case "too_big": {
|
|
2975
|
-
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
2976
|
-
const sizing = getSizing(issue.origin);
|
|
2977
|
-
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
2978
|
-
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
2979
|
-
}
|
|
2980
|
-
case "too_small": {
|
|
2981
|
-
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
2982
|
-
const sizing = getSizing(issue.origin);
|
|
2983
|
-
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
2984
|
-
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
2985
|
-
}
|
|
2986
|
-
case "invalid_format": {
|
|
2987
|
-
const _issue = issue;
|
|
2988
|
-
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
2989
|
-
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
2990
|
-
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
2991
|
-
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
2992
|
-
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
2993
|
-
}
|
|
2994
|
-
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
2995
|
-
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
2996
|
-
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
2997
|
-
case "invalid_union":
|
|
2998
|
-
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
2999
|
-
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
3000
|
-
return "Invalid input";
|
|
3001
|
-
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
3002
|
-
default: return `Invalid input`;
|
|
3003
|
-
}
|
|
3004
|
-
};
|
|
3005
|
-
};
|
|
3006
|
-
function en_default() {
|
|
3007
|
-
return { localeError: error() };
|
|
3008
2188
|
}
|
|
3009
2189
|
//#endregion
|
|
3010
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
2190
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
3011
2191
|
var _a;
|
|
3012
2192
|
var $ZodRegistry = class {
|
|
3013
2193
|
constructor() {
|
|
@@ -3054,17 +2234,13 @@ window.__ModuleLoader__.load({
|
|
|
3054
2234
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
3055
2235
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3056
2236
|
//#endregion
|
|
3057
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
3058
|
-
function snapshotChecks(def) {
|
|
3059
|
-
if (def.checks) def.checks = [...def.checks];
|
|
3060
|
-
return def;
|
|
3061
|
-
}
|
|
2237
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
3062
2238
|
// @__NO_SIDE_EFFECTS__
|
|
3063
2239
|
function _string(Class, params) {
|
|
3064
|
-
return new Class(
|
|
2240
|
+
return new Class({
|
|
3065
2241
|
type: "string",
|
|
3066
2242
|
...normalizeParams(params)
|
|
3067
|
-
})
|
|
2243
|
+
});
|
|
3068
2244
|
}
|
|
3069
2245
|
// @__NO_SIDE_EFFECTS__
|
|
3070
2246
|
function _email(Class, params) {
|
|
@@ -3336,11 +2512,11 @@ window.__ModuleLoader__.load({
|
|
|
3336
2512
|
}
|
|
3337
2513
|
// @__NO_SIDE_EFFECTS__
|
|
3338
2514
|
function _number(Class, params) {
|
|
3339
|
-
return new Class(
|
|
2515
|
+
return new Class({
|
|
3340
2516
|
type: "number",
|
|
3341
2517
|
checks: [],
|
|
3342
2518
|
...normalizeParams(params)
|
|
3343
|
-
})
|
|
2519
|
+
});
|
|
3344
2520
|
}
|
|
3345
2521
|
// @__NO_SIDE_EFFECTS__
|
|
3346
2522
|
function _int(Class, params) {
|
|
@@ -3547,7 +2723,7 @@ window.__ModuleLoader__.load({
|
|
|
3547
2723
|
const _issue = issue$2;
|
|
3548
2724
|
if (_issue.fatal) _issue.continue = false;
|
|
3549
2725
|
_issue.code ?? (_issue.code = "custom");
|
|
3550
|
-
|
|
2726
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
3551
2727
|
_issue.inst ?? (_issue.inst = ch);
|
|
3552
2728
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
3553
2729
|
payload.issues.push(issue(_issue));
|
|
@@ -3567,11 +2743,7 @@ window.__ModuleLoader__.load({
|
|
|
3567
2743
|
return ch;
|
|
3568
2744
|
}
|
|
3569
2745
|
//#endregion
|
|
3570
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
3571
|
-
function assignProps(target, ...sources) {
|
|
3572
|
-
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3573
|
-
return target;
|
|
3574
|
-
}
|
|
2746
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
3575
2747
|
function initializeContext(params) {
|
|
3576
2748
|
let target = params?.target ?? "draft-2020-12";
|
|
3577
2749
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -3585,32 +2757,12 @@ window.__ModuleLoader__.load({
|
|
|
3585
2757
|
io: params?.io ?? "output",
|
|
3586
2758
|
counter: 0,
|
|
3587
2759
|
seen: /* @__PURE__ */ new Map(),
|
|
3588
|
-
sharedDefsExtractedFor: void 0,
|
|
3589
|
-
sharedEmitDoneFor: void 0,
|
|
3590
2760
|
cycles: params?.cycles ?? "ref",
|
|
3591
2761
|
reused: params?.reused ?? "inline",
|
|
3592
|
-
intersections: [],
|
|
3593
|
-
deferred: [],
|
|
3594
2762
|
external: params?.external ?? void 0
|
|
3595
2763
|
};
|
|
3596
2764
|
}
|
|
3597
|
-
|
|
3598
|
-
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3599
|
-
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3600
|
-
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3601
|
-
*/
|
|
3602
|
-
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3603
|
-
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3604
|
-
zodSchema: schema,
|
|
3605
|
-
path: params.path,
|
|
3606
|
-
message
|
|
3607
|
-
}) : ctx.unrepresentable;
|
|
3608
|
-
if (result === "any") return false;
|
|
3609
|
-
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3610
|
-
Object.assign(json, result);
|
|
3611
|
-
return true;
|
|
3612
|
-
}
|
|
3613
|
-
function processSchema(schema, ctx, _params = {
|
|
2765
|
+
function process(schema, ctx, _params = {
|
|
3614
2766
|
path: [],
|
|
3615
2767
|
schemaPath: []
|
|
3616
2768
|
}) {
|
|
@@ -3629,8 +2781,6 @@ window.__ModuleLoader__.load({
|
|
|
3629
2781
|
path: _params.path
|
|
3630
2782
|
};
|
|
3631
2783
|
ctx.seen.set(schema, result);
|
|
3632
|
-
ctx.sharedDefsExtractedFor = void 0;
|
|
3633
|
-
ctx.sharedEmitDoneFor = void 0;
|
|
3634
2784
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
3635
2785
|
if (overrideSchema) result.schema = overrideSchema;
|
|
3636
2786
|
else {
|
|
@@ -3649,12 +2799,12 @@ window.__ModuleLoader__.load({
|
|
|
3649
2799
|
const parent = schema._zod.parent;
|
|
3650
2800
|
if (parent) {
|
|
3651
2801
|
if (!result.ref) result.ref = parent;
|
|
3652
|
-
|
|
2802
|
+
process(parent, ctx, params);
|
|
3653
2803
|
ctx.seen.get(parent).isParent = true;
|
|
3654
2804
|
}
|
|
3655
2805
|
}
|
|
3656
2806
|
const meta = ctx.metadataRegistry.get(schema);
|
|
3657
|
-
if (meta)
|
|
2807
|
+
if (meta) Object.assign(result.schema, meta);
|
|
3658
2808
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
3659
2809
|
delete result.schema.examples;
|
|
3660
2810
|
delete result.schema.default;
|
|
@@ -3663,13 +2813,9 @@ window.__ModuleLoader__.load({
|
|
|
3663
2813
|
delete result.schema._prefault;
|
|
3664
2814
|
return ctx.seen.get(schema).schema;
|
|
3665
2815
|
}
|
|
3666
|
-
function encodeJSONPointerSegment(segment) {
|
|
3667
|
-
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3668
|
-
}
|
|
3669
2816
|
function extractDefs(ctx, schema) {
|
|
3670
2817
|
const root = ctx.seen.get(schema);
|
|
3671
2818
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3672
|
-
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
3673
2819
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
3674
2820
|
for (const entry of ctx.seen.entries()) {
|
|
3675
2821
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -3689,16 +2835,15 @@ window.__ModuleLoader__.load({
|
|
|
3689
2835
|
entry[1].defId = id;
|
|
3690
2836
|
return {
|
|
3691
2837
|
defId: id,
|
|
3692
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${
|
|
2838
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3693
2839
|
};
|
|
3694
2840
|
}
|
|
3695
|
-
|
|
3696
|
-
const defUriPrefix =
|
|
3697
|
-
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2841
|
+
if (entry[1] === root) return { ref: "#" };
|
|
2842
|
+
const defUriPrefix = `#/${defsSegment}/`;
|
|
3698
2843
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
3699
2844
|
return {
|
|
3700
2845
|
defId,
|
|
3701
|
-
ref: defUriPrefix +
|
|
2846
|
+
ref: defUriPrefix + defId
|
|
3702
2847
|
};
|
|
3703
2848
|
};
|
|
3704
2849
|
const extractToDef = (entry) => {
|
|
@@ -3739,114 +2884,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3739
2884
|
continue;
|
|
3740
2885
|
}
|
|
3741
2886
|
if (seen.count > 1) {
|
|
3742
|
-
if (ctx.reused === "ref")
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3746
|
-
}
|
|
3747
|
-
/** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
|
|
3748
|
-
function compactTypeUnion(schema) {
|
|
3749
|
-
const options = schema.anyOf;
|
|
3750
|
-
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3751
|
-
const types = [];
|
|
3752
|
-
for (const option of options) {
|
|
3753
|
-
if (!option || typeof option !== "object") return;
|
|
3754
|
-
compactTypeUnion(option);
|
|
3755
|
-
const keys = Object.keys(option);
|
|
3756
|
-
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3757
|
-
const type = option.type;
|
|
3758
|
-
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3759
|
-
if (typeof member !== "string") return;
|
|
3760
|
-
if (!types.includes(member)) types.push(member);
|
|
3761
|
-
}
|
|
3762
|
-
}
|
|
3763
|
-
delete schema.anyOf;
|
|
3764
|
-
schema.type = types.length === 1 ? types[0] : types;
|
|
3765
|
-
}
|
|
3766
|
-
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3767
|
-
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3768
|
-
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3769
|
-
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3770
|
-
"type",
|
|
3771
|
-
"properties",
|
|
3772
|
-
"required",
|
|
3773
|
-
"additionalProperties"
|
|
3774
|
-
]);
|
|
3775
|
-
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3776
|
-
/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
|
|
3777
|
-
function undeclaredConstraint(member) {
|
|
3778
|
-
const extra = member.additionalProperties;
|
|
3779
|
-
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3780
|
-
return Object.keys(extra).length ? extra : null;
|
|
3781
|
-
}
|
|
3782
|
-
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3783
|
-
function foldObjects(members) {
|
|
3784
|
-
const objects = [];
|
|
3785
|
-
for (const member of members) {
|
|
3786
|
-
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3787
|
-
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3788
|
-
objects.push(member);
|
|
3789
|
-
}
|
|
3790
|
-
const properties = {};
|
|
3791
|
-
const required = /* @__PURE__ */ new Set();
|
|
3792
|
-
for (const object of objects) {
|
|
3793
|
-
for (const key in object.properties) {
|
|
3794
|
-
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3795
|
-
const parts = [];
|
|
3796
|
-
for (const other of objects) {
|
|
3797
|
-
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3798
|
-
if (part === null || part === void 0) continue;
|
|
3799
|
-
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
2887
|
+
if (ctx.reused === "ref") {
|
|
2888
|
+
extractToDef(entry);
|
|
2889
|
+
continue;
|
|
3800
2890
|
}
|
|
3801
|
-
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
3802
|
-
}
|
|
3803
|
-
for (const key of object.required ?? []) required.add(key);
|
|
3804
|
-
}
|
|
3805
|
-
const folded = {
|
|
3806
|
-
type: "object",
|
|
3807
|
-
properties
|
|
3808
|
-
};
|
|
3809
|
-
if (required.size) folded.required = [...required];
|
|
3810
|
-
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3811
|
-
else {
|
|
3812
|
-
const constraints = [];
|
|
3813
|
-
for (const object of objects) {
|
|
3814
|
-
const constraint = undeclaredConstraint(object);
|
|
3815
|
-
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3816
2891
|
}
|
|
3817
|
-
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3818
|
-
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3819
|
-
}
|
|
3820
|
-
return folded;
|
|
3821
|
-
}
|
|
3822
|
-
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3823
|
-
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3824
|
-
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3825
|
-
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3826
|
-
* into one object is the encoding that says so on every target.
|
|
3827
|
-
*
|
|
3828
|
-
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3829
|
-
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3830
|
-
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3831
|
-
function foldIntersection(json) {
|
|
3832
|
-
const allOf = json.allOf;
|
|
3833
|
-
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3834
|
-
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3835
|
-
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3836
|
-
let folded = null;
|
|
3837
|
-
if (!unions.length) folded = foldObjects(allOf);
|
|
3838
|
-
else {
|
|
3839
|
-
const union = unions[0];
|
|
3840
|
-
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3841
|
-
if (Object.keys(union).length !== 1) return;
|
|
3842
|
-
const rest = allOf.filter((m) => m !== union);
|
|
3843
|
-
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3844
|
-
if (branches.some((b) => !b)) return;
|
|
3845
|
-
folded = { [keyword]: branches };
|
|
3846
2892
|
}
|
|
3847
|
-
if (!folded) return;
|
|
3848
|
-
delete json.allOf;
|
|
3849
|
-
assignProps(json, folded);
|
|
3850
2893
|
}
|
|
3851
2894
|
function finalize(ctx, schema) {
|
|
3852
2895
|
const root = ctx.seen.get(schema);
|
|
@@ -3865,8 +2908,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3865
2908
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
3866
2909
|
schema.allOf = schema.allOf ?? [];
|
|
3867
2910
|
schema.allOf.push(refSchema);
|
|
3868
|
-
} else
|
|
3869
|
-
|
|
2911
|
+
} else Object.assign(schema, refSchema);
|
|
2912
|
+
Object.assign(schema, _cached);
|
|
3870
2913
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
3871
2914
|
if (key === "$ref" || key === "allOf") continue;
|
|
3872
2915
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -3894,22 +2937,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3894
2937
|
path: seen.path ?? []
|
|
3895
2938
|
});
|
|
3896
2939
|
};
|
|
3897
|
-
|
|
3898
|
-
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3899
|
-
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3900
|
-
for (const rewrite of ctx.deferred) rewrite();
|
|
3901
|
-
if (ctx.intersections.length) {
|
|
3902
|
-
const carriers = /* @__PURE__ */ new Map();
|
|
3903
|
-
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3904
|
-
const allOf = json?.allOf;
|
|
3905
|
-
if (!Array.isArray(allOf)) continue;
|
|
3906
|
-
const existing = carriers.get(allOf);
|
|
3907
|
-
if (existing) existing.push(json);
|
|
3908
|
-
else carriers.set(allOf, [json]);
|
|
3909
|
-
}
|
|
3910
|
-
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
2940
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3913
2941
|
const result = {};
|
|
3914
2942
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3915
2943
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -3920,18 +2948,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3920
2948
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
3921
2949
|
result.$id = ctx.external.uri(id);
|
|
3922
2950
|
}
|
|
3923
|
-
|
|
2951
|
+
Object.assign(result, root.def ?? root.schema);
|
|
3924
2952
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3925
2953
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
3926
2954
|
const defs = ctx.external?.defs ?? {};
|
|
3927
|
-
|
|
2955
|
+
for (const entry of ctx.seen.entries()) {
|
|
3928
2956
|
const seen = entry[1];
|
|
3929
2957
|
if (seen.def && seen.defId) {
|
|
3930
2958
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
3931
|
-
|
|
2959
|
+
defs[seen.defId] = seen.def;
|
|
3932
2960
|
}
|
|
3933
2961
|
}
|
|
3934
|
-
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
3935
2962
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
3936
2963
|
else result.definitions = defs;
|
|
3937
2964
|
try {
|
|
@@ -3961,7 +2988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3961
2988
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3962
2989
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3963
2990
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3964
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault"
|
|
2991
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
3965
2992
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3966
2993
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3967
2994
|
if (def.type === "pipe") {
|
|
@@ -3992,7 +3019,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3992
3019
|
...params,
|
|
3993
3020
|
processors
|
|
3994
3021
|
});
|
|
3995
|
-
|
|
3022
|
+
process(schema, ctx);
|
|
3996
3023
|
extractDefs(ctx, schema);
|
|
3997
3024
|
return finalize(ctx, schema);
|
|
3998
3025
|
};
|
|
@@ -4004,84 +3031,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4004
3031
|
io,
|
|
4005
3032
|
processors
|
|
4006
3033
|
});
|
|
4007
|
-
|
|
3034
|
+
process(schema, ctx);
|
|
4008
3035
|
extractDefs(ctx, schema);
|
|
4009
3036
|
return finalize(ctx, schema);
|
|
4010
3037
|
};
|
|
4011
3038
|
//#endregion
|
|
4012
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
4013
|
-
const narrowMin = (agg, key, value) => {
|
|
4014
|
-
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4015
|
-
};
|
|
4016
|
-
const narrowMax = (agg, key, value) => {
|
|
4017
|
-
if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
|
|
4018
|
-
};
|
|
4019
|
-
const narrowBoth = (agg, value) => {
|
|
4020
|
-
narrowMin(agg, "minimum", value);
|
|
4021
|
-
narrowMax(agg, "maximum", value);
|
|
4022
|
-
};
|
|
4023
|
-
const addDivisor = (agg, value) => {
|
|
4024
|
-
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4025
|
-
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
|
|
4026
|
-
};
|
|
4027
|
-
const addPattern = (agg, pattern) => {
|
|
4028
|
-
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4029
|
-
agg.patterns.add(pattern);
|
|
4030
|
-
};
|
|
4031
|
-
const intersectMime = (agg, mime) => {
|
|
4032
|
-
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4033
|
-
};
|
|
4034
|
-
const setFormat = (agg, format) => {
|
|
4035
|
-
agg.format = format;
|
|
4036
|
-
if (format.includes("int")) agg.isInt = true;
|
|
4037
|
-
};
|
|
4038
|
-
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4039
|
-
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4040
|
-
const formatContributor = (ranges) => (agg, def) => {
|
|
4041
|
-
setFormat(agg, def.format);
|
|
4042
|
-
const [minimum, maximum] = ranges[def.format];
|
|
4043
|
-
narrowMin(agg, "minimum", minimum);
|
|
4044
|
-
narrowMax(agg, "maximum", maximum);
|
|
4045
|
-
};
|
|
4046
|
-
const contributors = {
|
|
4047
|
-
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4048
|
-
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4049
|
-
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4050
|
-
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4051
|
-
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4052
|
-
min_length: minContributor,
|
|
4053
|
-
max_length: maxContributor,
|
|
4054
|
-
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4055
|
-
min_size: minContributor,
|
|
4056
|
-
max_size: maxContributor,
|
|
4057
|
-
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4058
|
-
string_format: (agg, def) => {
|
|
4059
|
-
setFormat(agg, def.format);
|
|
4060
|
-
if (def.pattern) addPattern(agg, def.pattern);
|
|
4061
|
-
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
|
|
4062
|
-
if (def.local || def.precision === -1) agg.laxFormat = true;
|
|
4063
|
-
},
|
|
4064
|
-
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4065
|
-
};
|
|
4066
|
-
function aggregateChecks(schema) {
|
|
4067
|
-
const agg = {};
|
|
4068
|
-
const def = schema._zod.def;
|
|
4069
|
-
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4070
|
-
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4071
|
-
const bag = schema._zod.bag;
|
|
4072
|
-
if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
|
|
4073
|
-
if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4074
|
-
if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
|
|
4075
|
-
if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4076
|
-
if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
|
|
4077
|
-
if (bag.format !== void 0) {
|
|
4078
|
-
agg.format ?? (agg.format = bag.format);
|
|
4079
|
-
if (bag.format.includes("int")) agg.isInt = true;
|
|
4080
|
-
}
|
|
4081
|
-
if (bag.mime) intersectMime(agg, bag.mime);
|
|
4082
|
-
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
|
|
4083
|
-
return agg;
|
|
4084
|
-
}
|
|
3039
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
4085
3040
|
const formatMap = {
|
|
4086
3041
|
guid: "uuid",
|
|
4087
3042
|
url: "uri",
|
|
@@ -4089,33 +3044,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4089
3044
|
json_string: "json-string",
|
|
4090
3045
|
regex: ""
|
|
4091
3046
|
};
|
|
4092
|
-
const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
|
|
4093
|
-
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
4094
3047
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
4095
3048
|
const json = _json;
|
|
4096
3049
|
json.type = "string";
|
|
4097
|
-
const { minimum, maximum, format, patterns, contentEncoding
|
|
3050
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
4098
3051
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
4099
3052
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
4100
3053
|
if (format) {
|
|
4101
3054
|
json.format = formatMap[format] ?? format;
|
|
4102
3055
|
if (json.format === "") delete json.format;
|
|
4103
|
-
if (format === "time"
|
|
3056
|
+
if (format === "time") delete json.format;
|
|
4104
3057
|
}
|
|
4105
3058
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
4106
3059
|
if (patterns && patterns.size > 0) {
|
|
4107
|
-
const
|
|
4108
|
-
if (
|
|
4109
|
-
else if (
|
|
3060
|
+
const regexes = [...patterns];
|
|
3061
|
+
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
3062
|
+
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
4110
3063
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
4111
3064
|
pattern: regex.source
|
|
4112
3065
|
}))];
|
|
4113
3066
|
}
|
|
4114
3067
|
};
|
|
4115
|
-
const numberProcessor = (schema, ctx, _json,
|
|
3068
|
+
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
4116
3069
|
const json = _json;
|
|
4117
|
-
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum
|
|
4118
|
-
|
|
3070
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3071
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
3072
|
+
else json.type = "number";
|
|
4119
3073
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
4120
3074
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
4121
3075
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -4129,14 +3083,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4129
3083
|
json.exclusiveMaximum = true;
|
|
4130
3084
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
4131
3085
|
else if (typeof maximum === "number") json.maximum = maximum;
|
|
4132
|
-
if (multipleOf)
|
|
4133
|
-
const divisors = /* @__PURE__ */ new Set();
|
|
4134
|
-
for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
|
|
4135
|
-
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
4136
|
-
const [first, ...rest] = divisors;
|
|
4137
|
-
if (first !== void 0) json.multipleOf = first;
|
|
4138
|
-
if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
4139
|
-
}
|
|
3086
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
4140
3087
|
};
|
|
4141
3088
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4142
3089
|
json.type = "boolean";
|
|
@@ -4147,63 +3094,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4147
3094
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
4148
3095
|
const def = schema._zod.def;
|
|
4149
3096
|
const values = getEnumValues(def.entries);
|
|
4150
|
-
if (values.length === 0) {
|
|
4151
|
-
json.not = {};
|
|
4152
|
-
return;
|
|
4153
|
-
}
|
|
4154
3097
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
4155
3098
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
4156
3099
|
json.enum = values;
|
|
4157
3100
|
};
|
|
4158
|
-
const customProcessor = (
|
|
4159
|
-
|
|
3101
|
+
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3102
|
+
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4160
3103
|
};
|
|
4161
|
-
const transformProcessor = (
|
|
4162
|
-
|
|
3104
|
+
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3105
|
+
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4163
3106
|
};
|
|
4164
3107
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
4165
3108
|
const json = _json;
|
|
4166
3109
|
const def = schema._zod.def;
|
|
4167
|
-
const { minimum, maximum } =
|
|
3110
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
4168
3111
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
4169
3112
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
4170
3113
|
json.type = "array";
|
|
4171
|
-
json.items =
|
|
3114
|
+
json.items = process(def.element, ctx, {
|
|
4172
3115
|
...params,
|
|
4173
3116
|
path: [...params.path, "items"]
|
|
4174
3117
|
});
|
|
4175
3118
|
};
|
|
4176
|
-
function inputOptin(schema) {
|
|
4177
|
-
const def = schema._zod.def;
|
|
4178
|
-
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
4179
|
-
if (def.type === "catch") return inputOptin(def.innerType);
|
|
4180
|
-
return schema._zod.optin;
|
|
4181
|
-
}
|
|
4182
3119
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
4183
3120
|
const json = _json;
|
|
4184
3121
|
const def = schema._zod.def;
|
|
4185
|
-
const shape = def.shape;
|
|
4186
|
-
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
4187
3122
|
json.type = "object";
|
|
4188
3123
|
json.properties = {};
|
|
4189
|
-
|
|
3124
|
+
const shape = def.shape;
|
|
3125
|
+
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
4190
3126
|
...params,
|
|
4191
3127
|
path: [
|
|
4192
3128
|
...params.path,
|
|
4193
3129
|
"properties",
|
|
4194
3130
|
key
|
|
4195
3131
|
]
|
|
3132
|
+
});
|
|
3133
|
+
const allKeys = new Set(Object.keys(shape));
|
|
3134
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3135
|
+
const v = def.shape[key]._zod;
|
|
3136
|
+
if (ctx.io === "input") return v.optin === void 0;
|
|
3137
|
+
else return v.optout === void 0;
|
|
4196
3138
|
}));
|
|
4197
|
-
|
|
4198
|
-
for (const key of Object.keys(shape)) {
|
|
4199
|
-
const field = def.shape[key];
|
|
4200
|
-
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
|
|
4201
|
-
}
|
|
4202
|
-
if (requiredKeys.length > 0) json.required = requiredKeys;
|
|
3139
|
+
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
4203
3140
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
4204
3141
|
else if (!def.catchall) {
|
|
4205
3142
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
4206
|
-
} else if (def.catchall) json.additionalProperties =
|
|
3143
|
+
} else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
|
|
4207
3144
|
...params,
|
|
4208
3145
|
path: [...params.path, "additionalProperties"]
|
|
4209
3146
|
});
|
|
@@ -4211,7 +3148,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4211
3148
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
4212
3149
|
const def = schema._zod.def;
|
|
4213
3150
|
const isExclusive = def.inclusive === false;
|
|
4214
|
-
const options = def.options.map((x, i) =>
|
|
3151
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
4215
3152
|
...params,
|
|
4216
3153
|
path: [
|
|
4217
3154
|
...params.path,
|
|
@@ -4224,7 +3161,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4224
3161
|
};
|
|
4225
3162
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
4226
3163
|
const def = schema._zod.def;
|
|
4227
|
-
const a =
|
|
3164
|
+
const a = process(def.left, ctx, {
|
|
4228
3165
|
...params,
|
|
4229
3166
|
path: [
|
|
4230
3167
|
...params.path,
|
|
@@ -4232,7 +3169,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4232
3169
|
0
|
|
4233
3170
|
]
|
|
4234
3171
|
});
|
|
4235
|
-
const b =
|
|
3172
|
+
const b = process(def.right, ctx, {
|
|
4236
3173
|
...params,
|
|
4237
3174
|
path: [
|
|
4238
3175
|
...params.path,
|
|
@@ -4241,13 +3178,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4241
3178
|
]
|
|
4242
3179
|
});
|
|
4243
3180
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
4244
|
-
|
|
4245
|
-
json.allOf = allOf;
|
|
4246
|
-
ctx.intersections.push(allOf);
|
|
3181
|
+
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4247
3182
|
};
|
|
4248
3183
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4249
3184
|
const def = schema._zod.def;
|
|
4250
|
-
const inner =
|
|
3185
|
+
const inner = process(def.innerType, ctx, params);
|
|
4251
3186
|
const seen = ctx.seen.get(schema);
|
|
4252
3187
|
if (ctx.target === "openapi-3.0") {
|
|
4253
3188
|
seen.ref = def.innerType;
|
|
@@ -4256,53 +3191,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4256
3191
|
};
|
|
4257
3192
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
4258
3193
|
const def = schema._zod.def;
|
|
4259
|
-
|
|
3194
|
+
process(def.innerType, ctx, params);
|
|
4260
3195
|
const seen = ctx.seen.get(schema);
|
|
4261
3196
|
seen.ref = def.innerType;
|
|
4262
3197
|
};
|
|
4263
|
-
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
4264
|
-
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
4265
|
-
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
4266
|
-
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4267
|
-
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4268
|
-
let unrepresentable = false;
|
|
4269
|
-
const serialized = JSON.stringify(value, (_, val) => {
|
|
4270
|
-
if (typeof val !== "bigint") return val;
|
|
4271
|
-
unrepresentable = true;
|
|
4272
|
-
return null;
|
|
4273
|
-
});
|
|
4274
|
-
if (!unrepresentable) return JSON.parse(serialized);
|
|
4275
|
-
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4276
|
-
return UNREPRESENTABLE_DEFAULT;
|
|
4277
|
-
}
|
|
4278
3198
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
4279
3199
|
const def = schema._zod.def;
|
|
4280
|
-
|
|
3200
|
+
process(def.innerType, ctx, params);
|
|
4281
3201
|
const seen = ctx.seen.get(schema);
|
|
4282
3202
|
seen.ref = def.innerType;
|
|
4283
|
-
|
|
4284
|
-
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3203
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
4285
3204
|
};
|
|
4286
3205
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
4287
3206
|
const def = schema._zod.def;
|
|
4288
|
-
|
|
3207
|
+
process(def.innerType, ctx, params);
|
|
4289
3208
|
const seen = ctx.seen.get(schema);
|
|
4290
3209
|
seen.ref = def.innerType;
|
|
4291
|
-
if (ctx.io
|
|
4292
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4293
|
-
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3210
|
+
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
4294
3211
|
};
|
|
4295
3212
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
4296
3213
|
const def = schema._zod.def;
|
|
4297
|
-
|
|
3214
|
+
process(def.innerType, ctx, params);
|
|
4298
3215
|
const seen = ctx.seen.get(schema);
|
|
4299
3216
|
seen.ref = def.innerType;
|
|
4300
3217
|
let catchValue;
|
|
4301
3218
|
try {
|
|
4302
3219
|
catchValue = def.catchValue(void 0);
|
|
4303
3220
|
} catch {
|
|
4304
|
-
|
|
4305
|
-
return;
|
|
3221
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
4306
3222
|
}
|
|
4307
3223
|
json.default = catchValue;
|
|
4308
3224
|
};
|
|
@@ -4310,75 +3226,77 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4310
3226
|
const def = schema._zod.def;
|
|
4311
3227
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
4312
3228
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
4313
|
-
|
|
3229
|
+
process(innerType, ctx, params);
|
|
4314
3230
|
const seen = ctx.seen.get(schema);
|
|
4315
3231
|
seen.ref = innerType;
|
|
4316
3232
|
};
|
|
4317
3233
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
4318
3234
|
const def = schema._zod.def;
|
|
4319
|
-
|
|
3235
|
+
process(def.innerType, ctx, params);
|
|
4320
3236
|
const seen = ctx.seen.get(schema);
|
|
4321
3237
|
seen.ref = def.innerType;
|
|
4322
3238
|
json.readOnly = true;
|
|
4323
3239
|
};
|
|
4324
3240
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
4325
3241
|
const def = schema._zod.def;
|
|
4326
|
-
|
|
3242
|
+
process(def.innerType, ctx, params);
|
|
4327
3243
|
const seen = ctx.seen.get(schema);
|
|
4328
3244
|
seen.ref = def.innerType;
|
|
4329
3245
|
};
|
|
4330
3246
|
//#endregion
|
|
4331
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
4332
|
-
const
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
3247
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
3248
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
3249
|
+
$ZodISODateTime.init(inst, def);
|
|
3250
|
+
ZodStringFormat.init(inst, def);
|
|
3251
|
+
});
|
|
3252
|
+
function datetime(params) {
|
|
3253
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
3254
|
+
}
|
|
3255
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
3256
|
+
$ZodISODate.init(inst, def);
|
|
3257
|
+
ZodStringFormat.init(inst, def);
|
|
3258
|
+
});
|
|
3259
|
+
function date(params) {
|
|
3260
|
+
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
3261
|
+
}
|
|
3262
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
3263
|
+
$ZodISOTime.init(inst, def);
|
|
3264
|
+
ZodStringFormat.init(inst, def);
|
|
3265
|
+
});
|
|
3266
|
+
function time(params) {
|
|
3267
|
+
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3268
|
+
}
|
|
3269
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
3270
|
+
$ZodISODuration.init(inst, def);
|
|
3271
|
+
ZodStringFormat.init(inst, def);
|
|
3272
|
+
});
|
|
3273
|
+
function duration(params) {
|
|
3274
|
+
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4354
3275
|
}
|
|
3276
|
+
//#endregion
|
|
3277
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
4355
3278
|
const initializer = (inst, issues) => {
|
|
4356
3279
|
$ZodError.init(inst, issues);
|
|
4357
3280
|
inst.name = "ZodError";
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
configurable: true,
|
|
4373
|
-
enumerable: false,
|
|
4374
|
-
get() {
|
|
4375
|
-
return this.issues.length === 0;
|
|
4376
|
-
}
|
|
3281
|
+
Object.defineProperties(inst, {
|
|
3282
|
+
format: { value: (mapper) => formatError(inst, mapper) },
|
|
3283
|
+
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
3284
|
+
addIssue: { value: (issue) => {
|
|
3285
|
+
inst.issues.push(issue);
|
|
3286
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3287
|
+
} },
|
|
3288
|
+
addIssues: { value: (issues) => {
|
|
3289
|
+
inst.issues.push(...issues);
|
|
3290
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3291
|
+
} },
|
|
3292
|
+
isEmpty: { get() {
|
|
3293
|
+
return inst.issues.length === 0;
|
|
3294
|
+
} }
|
|
4377
3295
|
});
|
|
4378
3296
|
};
|
|
4379
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer,
|
|
3297
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
4380
3298
|
//#endregion
|
|
4381
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
3299
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
4382
3300
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4383
3301
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4384
3302
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -4392,320 +3310,255 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4392
3310
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4393
3311
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4394
3312
|
//#endregion
|
|
4395
|
-
//#region ../../../node_modules/.pnpm/zod@4.
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
if (!
|
|
3313
|
+
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
3314
|
+
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
3315
|
+
function _installLazyMethods(inst, group, methods) {
|
|
3316
|
+
const proto = Object.getPrototypeOf(inst);
|
|
3317
|
+
let installed = _installedGroups.get(proto);
|
|
3318
|
+
if (!installed) {
|
|
3319
|
+
installed = /* @__PURE__ */ new Set();
|
|
3320
|
+
_installedGroups.set(proto, installed);
|
|
3321
|
+
}
|
|
3322
|
+
if (installed.has(group)) return;
|
|
3323
|
+
installed.add(group);
|
|
3324
|
+
for (const key in methods) {
|
|
3325
|
+
const fn = methods[key];
|
|
3326
|
+
Object.defineProperty(proto, key, {
|
|
3327
|
+
configurable: true,
|
|
3328
|
+
enumerable: false,
|
|
3329
|
+
get() {
|
|
3330
|
+
const bound = fn.bind(this);
|
|
3331
|
+
Object.defineProperty(this, key, {
|
|
3332
|
+
configurable: true,
|
|
3333
|
+
writable: true,
|
|
3334
|
+
enumerable: true,
|
|
3335
|
+
value: bound
|
|
3336
|
+
});
|
|
3337
|
+
return bound;
|
|
3338
|
+
},
|
|
3339
|
+
set(v) {
|
|
3340
|
+
Object.defineProperty(this, key, {
|
|
3341
|
+
configurable: true,
|
|
3342
|
+
writable: true,
|
|
3343
|
+
enumerable: true,
|
|
3344
|
+
value: v
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
4401
3349
|
}
|
|
4402
3350
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4403
|
-
_ensureDefaultLocale();
|
|
4404
3351
|
$ZodType.init(inst, def);
|
|
3352
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3353
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3354
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3355
|
+
} });
|
|
3356
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
4405
3357
|
inst.def = def;
|
|
4406
3358
|
inst.type = def.type;
|
|
3359
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
3360
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3361
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3362
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3363
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3364
|
+
inst.spa = inst.safeParseAsync;
|
|
3365
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
3366
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
3367
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3368
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3369
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3370
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3371
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3372
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3373
|
+
_installLazyMethods(inst, "ZodType", {
|
|
3374
|
+
check(...chks) {
|
|
3375
|
+
const def = this.def;
|
|
3376
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3377
|
+
check: ch,
|
|
3378
|
+
def: { check: "custom" },
|
|
3379
|
+
onattach: []
|
|
3380
|
+
} } : ch)] }), { parent: true });
|
|
3381
|
+
},
|
|
3382
|
+
with(...chks) {
|
|
3383
|
+
return this.check(...chks);
|
|
3384
|
+
},
|
|
3385
|
+
clone(def, params) {
|
|
3386
|
+
return clone(this, def, params);
|
|
3387
|
+
},
|
|
3388
|
+
brand() {
|
|
3389
|
+
return this;
|
|
3390
|
+
},
|
|
3391
|
+
register(reg, meta) {
|
|
3392
|
+
reg.add(this, meta);
|
|
3393
|
+
return this;
|
|
3394
|
+
},
|
|
3395
|
+
refine(check, params) {
|
|
3396
|
+
return this.check(refine(check, params));
|
|
3397
|
+
},
|
|
3398
|
+
superRefine(refinement, params) {
|
|
3399
|
+
return this.check(superRefine(refinement, params));
|
|
3400
|
+
},
|
|
3401
|
+
overwrite(fn) {
|
|
3402
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3403
|
+
},
|
|
3404
|
+
optional() {
|
|
3405
|
+
return optional(this);
|
|
3406
|
+
},
|
|
3407
|
+
exactOptional() {
|
|
3408
|
+
return exactOptional(this);
|
|
3409
|
+
},
|
|
3410
|
+
nullable() {
|
|
3411
|
+
return nullable(this);
|
|
3412
|
+
},
|
|
3413
|
+
nullish() {
|
|
3414
|
+
return optional(nullable(this));
|
|
3415
|
+
},
|
|
3416
|
+
nonoptional(params) {
|
|
3417
|
+
return nonoptional(this, params);
|
|
3418
|
+
},
|
|
3419
|
+
array() {
|
|
3420
|
+
return array(this);
|
|
3421
|
+
},
|
|
3422
|
+
or(arg) {
|
|
3423
|
+
return union([this, arg]);
|
|
3424
|
+
},
|
|
3425
|
+
and(arg) {
|
|
3426
|
+
return intersection(this, arg);
|
|
3427
|
+
},
|
|
3428
|
+
transform(tx) {
|
|
3429
|
+
return pipe(this, transform(tx));
|
|
3430
|
+
},
|
|
3431
|
+
default(d) {
|
|
3432
|
+
return _default(this, d);
|
|
3433
|
+
},
|
|
3434
|
+
prefault(d) {
|
|
3435
|
+
return prefault(this, d);
|
|
3436
|
+
},
|
|
3437
|
+
catch(params) {
|
|
3438
|
+
return _catch(this, params);
|
|
3439
|
+
},
|
|
3440
|
+
pipe(target) {
|
|
3441
|
+
return pipe(this, target);
|
|
3442
|
+
},
|
|
3443
|
+
readonly() {
|
|
3444
|
+
return readonly(this);
|
|
3445
|
+
},
|
|
3446
|
+
describe(description) {
|
|
3447
|
+
const cl = this.clone();
|
|
3448
|
+
globalRegistry.add(cl, { description });
|
|
3449
|
+
return cl;
|
|
3450
|
+
},
|
|
3451
|
+
meta(...args) {
|
|
3452
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
3453
|
+
const cl = this.clone();
|
|
3454
|
+
globalRegistry.add(cl, args[0]);
|
|
3455
|
+
return cl;
|
|
3456
|
+
},
|
|
3457
|
+
isOptional() {
|
|
3458
|
+
return this.safeParse(void 0).success;
|
|
3459
|
+
},
|
|
3460
|
+
isNullable() {
|
|
3461
|
+
return this.safeParse(null).success;
|
|
3462
|
+
},
|
|
3463
|
+
apply(fn) {
|
|
3464
|
+
return fn(this);
|
|
3465
|
+
}
|
|
3466
|
+
});
|
|
3467
|
+
Object.defineProperty(inst, "description", {
|
|
3468
|
+
get() {
|
|
3469
|
+
return globalRegistry.get(inst)?.description;
|
|
3470
|
+
},
|
|
3471
|
+
configurable: true
|
|
3472
|
+
});
|
|
4407
3473
|
return inst;
|
|
4408
|
-
}, {
|
|
4409
|
-
check(...chks) {
|
|
4410
|
-
const def = this.def;
|
|
4411
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4412
|
-
check: ch,
|
|
4413
|
-
def: { check: "custom" },
|
|
4414
|
-
onattach: []
|
|
4415
|
-
} } : ch)] }), { parent: true });
|
|
4416
|
-
},
|
|
4417
|
-
with(...chks) {
|
|
4418
|
-
return this.check(...chks);
|
|
4419
|
-
},
|
|
4420
|
-
clone(def, params) {
|
|
4421
|
-
return clone(this, def, params);
|
|
4422
|
-
},
|
|
4423
|
-
brand() {
|
|
4424
|
-
return this;
|
|
4425
|
-
},
|
|
4426
|
-
register(reg, meta) {
|
|
4427
|
-
reg.add(this, meta);
|
|
4428
|
-
return this;
|
|
4429
|
-
},
|
|
4430
|
-
refine(check, params) {
|
|
4431
|
-
return this.check(refine(check, params));
|
|
4432
|
-
},
|
|
4433
|
-
superRefine(refinement, params) {
|
|
4434
|
-
return this.check(superRefine(refinement, params));
|
|
4435
|
-
},
|
|
4436
|
-
overwrite(fn) {
|
|
4437
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4438
|
-
},
|
|
4439
|
-
optional() {
|
|
4440
|
-
return optional(this);
|
|
4441
|
-
},
|
|
4442
|
-
exactOptional() {
|
|
4443
|
-
return exactOptional(this);
|
|
4444
|
-
},
|
|
4445
|
-
nullable() {
|
|
4446
|
-
return nullable(this);
|
|
4447
|
-
},
|
|
4448
|
-
nullish() {
|
|
4449
|
-
return optional(nullable(this));
|
|
4450
|
-
},
|
|
4451
|
-
nonoptional(params) {
|
|
4452
|
-
return nonoptional(this, params);
|
|
4453
|
-
},
|
|
4454
|
-
array() {
|
|
4455
|
-
return array(this);
|
|
4456
|
-
},
|
|
4457
|
-
or(arg) {
|
|
4458
|
-
return union([this, arg]);
|
|
4459
|
-
},
|
|
4460
|
-
and(arg) {
|
|
4461
|
-
return intersection(this, arg);
|
|
4462
|
-
},
|
|
4463
|
-
transform(tx) {
|
|
4464
|
-
return pipe(this, transform(tx));
|
|
4465
|
-
},
|
|
4466
|
-
default(d) {
|
|
4467
|
-
return _default(this, d);
|
|
4468
|
-
},
|
|
4469
|
-
prefault(d) {
|
|
4470
|
-
return prefault(this, d);
|
|
4471
|
-
},
|
|
4472
|
-
catch(params) {
|
|
4473
|
-
return _catch(this, params);
|
|
4474
|
-
},
|
|
4475
|
-
pipe(target) {
|
|
4476
|
-
return pipe(this, target);
|
|
4477
|
-
},
|
|
4478
|
-
readonly() {
|
|
4479
|
-
return readonly(this);
|
|
4480
|
-
},
|
|
4481
|
-
describe(description) {
|
|
4482
|
-
const cl = this.clone();
|
|
4483
|
-
globalRegistry.add(cl, { description });
|
|
4484
|
-
return cl;
|
|
4485
|
-
},
|
|
4486
|
-
meta(...args) {
|
|
4487
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
4488
|
-
const cl = this.clone();
|
|
4489
|
-
globalRegistry.add(cl, args[0]);
|
|
4490
|
-
return cl;
|
|
4491
|
-
},
|
|
4492
|
-
isOptional() {
|
|
4493
|
-
return this.safeParse(void 0).success;
|
|
4494
|
-
},
|
|
4495
|
-
isNullable() {
|
|
4496
|
-
return this.safeParse(null).success;
|
|
4497
|
-
},
|
|
4498
|
-
apply(fn, ...args) {
|
|
4499
|
-
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4500
|
-
},
|
|
4501
|
-
get "~standard"() {
|
|
4502
|
-
return hide(this, "~standard", {
|
|
4503
|
-
...standardProps(this),
|
|
4504
|
-
jsonSchema: {
|
|
4505
|
-
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4506
|
-
output: createStandardJSONSchemaMethod(this, "output")
|
|
4507
|
-
}
|
|
4508
|
-
});
|
|
4509
|
-
},
|
|
4510
|
-
set "~standard"(value) {
|
|
4511
|
-
own(this, "~standard", value);
|
|
4512
|
-
},
|
|
4513
|
-
parse: function _parse(data, params) {
|
|
4514
|
-
return parse(this, data, params, { callee: _parse });
|
|
4515
|
-
},
|
|
4516
|
-
parseAsync: async function _parseAsync(data, params) {
|
|
4517
|
-
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4518
|
-
},
|
|
4519
|
-
safeParse(data, params) {
|
|
4520
|
-
return safeParse(this, data, params);
|
|
4521
|
-
},
|
|
4522
|
-
async safeParseAsync(data, params) {
|
|
4523
|
-
return safeParseAsync(this, data, params);
|
|
4524
|
-
},
|
|
4525
|
-
get spa() {
|
|
4526
|
-
return this?.safeParseAsync;
|
|
4527
|
-
},
|
|
4528
|
-
set spa(value) {
|
|
4529
|
-
own(this, "spa", value);
|
|
4530
|
-
},
|
|
4531
|
-
validate(data, params) {
|
|
4532
|
-
return validate(this, data, params);
|
|
4533
|
-
},
|
|
4534
|
-
validateAsync(data, params) {
|
|
4535
|
-
return validateAsync$1(this, data, params);
|
|
4536
|
-
},
|
|
4537
|
-
encode: function _encode(data, params) {
|
|
4538
|
-
return encode(this, data, params, { callee: _encode });
|
|
4539
|
-
},
|
|
4540
|
-
decode: function _decode(data, params) {
|
|
4541
|
-
return decode(this, data, params, { callee: _decode });
|
|
4542
|
-
},
|
|
4543
|
-
encodeAsync: async function _encodeAsync(data, params) {
|
|
4544
|
-
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4545
|
-
},
|
|
4546
|
-
decodeAsync: async function _decodeAsync(data, params) {
|
|
4547
|
-
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4548
|
-
},
|
|
4549
|
-
safeEncode(data, params) {
|
|
4550
|
-
return safeEncode(this, data, params);
|
|
4551
|
-
},
|
|
4552
|
-
safeDecode(data, params) {
|
|
4553
|
-
return safeDecode(this, data, params);
|
|
4554
|
-
},
|
|
4555
|
-
async safeEncodeAsync(data, params) {
|
|
4556
|
-
return safeEncodeAsync(this, data, params);
|
|
4557
|
-
},
|
|
4558
|
-
async safeDecodeAsync(data, params) {
|
|
4559
|
-
return safeDecodeAsync(this, data, params);
|
|
4560
|
-
},
|
|
4561
|
-
toJSONSchema(params) {
|
|
4562
|
-
return createToJSONSchemaMethod(this, {})(params);
|
|
4563
|
-
},
|
|
4564
|
-
get description() {
|
|
4565
|
-
return globalRegistry.get(this)?.description;
|
|
4566
|
-
},
|
|
4567
|
-
get _def() {
|
|
4568
|
-
return this._zod.def;
|
|
4569
|
-
}
|
|
4570
3474
|
});
|
|
4571
3475
|
/** @internal */
|
|
4572
3476
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
4573
3477
|
$ZodString.init(inst, def);
|
|
4574
3478
|
ZodType.init(inst, def);
|
|
4575
3479
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
4576
|
-
|
|
4577
|
-
format
|
|
4578
|
-
minLength
|
|
4579
|
-
maxLength
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
3480
|
+
const bag = inst._zod.bag;
|
|
3481
|
+
inst.format = bag.format ?? null;
|
|
3482
|
+
inst.minLength = bag.minimum ?? null;
|
|
3483
|
+
inst.maxLength = bag.maximum ?? null;
|
|
3484
|
+
_installLazyMethods(inst, "_ZodString", {
|
|
3485
|
+
regex(...args) {
|
|
3486
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
3487
|
+
},
|
|
3488
|
+
includes(...args) {
|
|
3489
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
3490
|
+
},
|
|
3491
|
+
startsWith(...args) {
|
|
3492
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
3493
|
+
},
|
|
3494
|
+
endsWith(...args) {
|
|
3495
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
3496
|
+
},
|
|
3497
|
+
min(...args) {
|
|
3498
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
3499
|
+
},
|
|
3500
|
+
max(...args) {
|
|
3501
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
3502
|
+
},
|
|
3503
|
+
length(...args) {
|
|
3504
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
3505
|
+
},
|
|
3506
|
+
nonempty(...args) {
|
|
3507
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
3508
|
+
},
|
|
3509
|
+
lowercase(params) {
|
|
3510
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
3511
|
+
},
|
|
3512
|
+
uppercase(params) {
|
|
3513
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
3514
|
+
},
|
|
3515
|
+
trim() {
|
|
3516
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
3517
|
+
},
|
|
3518
|
+
normalize(...args) {
|
|
3519
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
3520
|
+
},
|
|
3521
|
+
toLowerCase() {
|
|
3522
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
3523
|
+
},
|
|
3524
|
+
toUpperCase() {
|
|
3525
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
3526
|
+
},
|
|
3527
|
+
slugify() {
|
|
3528
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
3529
|
+
}
|
|
3530
|
+
});
|
|
3531
|
+
});
|
|
4627
3532
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
4628
3533
|
$ZodString.init(inst, def);
|
|
4629
3534
|
_ZodString.init(inst, def);
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
},
|
|
4658
|
-
nanoid(params) {
|
|
4659
|
-
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4660
|
-
},
|
|
4661
|
-
cuid(params) {
|
|
4662
|
-
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4663
|
-
},
|
|
4664
|
-
cuid2(params) {
|
|
4665
|
-
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4666
|
-
},
|
|
4667
|
-
ulid(params) {
|
|
4668
|
-
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4669
|
-
},
|
|
4670
|
-
base64(params) {
|
|
4671
|
-
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4672
|
-
},
|
|
4673
|
-
base64url(params) {
|
|
4674
|
-
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4675
|
-
},
|
|
4676
|
-
xid(params) {
|
|
4677
|
-
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4678
|
-
},
|
|
4679
|
-
ksuid(params) {
|
|
4680
|
-
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4681
|
-
},
|
|
4682
|
-
ipv4(params) {
|
|
4683
|
-
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4684
|
-
},
|
|
4685
|
-
ipv6(params) {
|
|
4686
|
-
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4687
|
-
},
|
|
4688
|
-
cidrv4(params) {
|
|
4689
|
-
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4690
|
-
},
|
|
4691
|
-
cidrv6(params) {
|
|
4692
|
-
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4693
|
-
},
|
|
4694
|
-
e164(params) {
|
|
4695
|
-
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4696
|
-
},
|
|
4697
|
-
datetime(params) {
|
|
4698
|
-
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4699
|
-
},
|
|
4700
|
-
date(params) {
|
|
4701
|
-
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4702
|
-
},
|
|
4703
|
-
time(params) {
|
|
4704
|
-
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4705
|
-
},
|
|
4706
|
-
duration(params) {
|
|
4707
|
-
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4708
|
-
}
|
|
3535
|
+
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
3536
|
+
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
3537
|
+
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
3538
|
+
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
3539
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3540
|
+
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
3541
|
+
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
3542
|
+
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
3543
|
+
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
3544
|
+
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
3545
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3546
|
+
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
3547
|
+
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
3548
|
+
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
3549
|
+
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
3550
|
+
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
3551
|
+
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
3552
|
+
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
3553
|
+
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
3554
|
+
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
3555
|
+
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
3556
|
+
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
3557
|
+
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
3558
|
+
inst.datetime = (params) => inst.check(datetime(params));
|
|
3559
|
+
inst.date = (params) => inst.check(date(params));
|
|
3560
|
+
inst.time = (params) => inst.check(time(params));
|
|
3561
|
+
inst.duration = (params) => inst.check(duration(params));
|
|
4709
3562
|
});
|
|
4710
3563
|
function string(params) {
|
|
4711
3564
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -4714,22 +3567,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4714
3567
|
$ZodStringFormat.init(inst, def);
|
|
4715
3568
|
_ZodString.init(inst, def);
|
|
4716
3569
|
});
|
|
4717
|
-
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4718
|
-
$ZodISODateTime.init(inst, def);
|
|
4719
|
-
ZodStringFormat.init(inst, def);
|
|
4720
|
-
});
|
|
4721
|
-
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4722
|
-
$ZodISODate.init(inst, def);
|
|
4723
|
-
ZodStringFormat.init(inst, def);
|
|
4724
|
-
});
|
|
4725
|
-
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4726
|
-
$ZodISOTime.init(inst, def);
|
|
4727
|
-
ZodStringFormat.init(inst, def);
|
|
4728
|
-
});
|
|
4729
|
-
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4730
|
-
$ZodISODuration.init(inst, def);
|
|
4731
|
-
ZodStringFormat.init(inst, def);
|
|
4732
|
-
});
|
|
4733
3570
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
4734
3571
|
$ZodEmail.init(inst, def);
|
|
4735
3572
|
ZodStringFormat.init(inst, def);
|
|
@@ -4815,68 +3652,60 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4815
3652
|
$ZodNumber.init(inst, def);
|
|
4816
3653
|
ZodType.init(inst, def);
|
|
4817
3654
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3655
|
+
_installLazyMethods(inst, "ZodNumber", {
|
|
3656
|
+
gt(value, params) {
|
|
3657
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3658
|
+
},
|
|
3659
|
+
gte(value, params) {
|
|
3660
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3661
|
+
},
|
|
3662
|
+
min(value, params) {
|
|
3663
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3664
|
+
},
|
|
3665
|
+
lt(value, params) {
|
|
3666
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3667
|
+
},
|
|
3668
|
+
lte(value, params) {
|
|
3669
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3670
|
+
},
|
|
3671
|
+
max(value, params) {
|
|
3672
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3673
|
+
},
|
|
3674
|
+
int(params) {
|
|
3675
|
+
return this.check(int(params));
|
|
3676
|
+
},
|
|
3677
|
+
safe(params) {
|
|
3678
|
+
return this.check(int(params));
|
|
3679
|
+
},
|
|
3680
|
+
positive(params) {
|
|
3681
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3682
|
+
},
|
|
3683
|
+
nonnegative(params) {
|
|
3684
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3685
|
+
},
|
|
3686
|
+
negative(params) {
|
|
3687
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3688
|
+
},
|
|
3689
|
+
nonpositive(params) {
|
|
3690
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3691
|
+
},
|
|
3692
|
+
multipleOf(value, params) {
|
|
3693
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3694
|
+
},
|
|
3695
|
+
step(value, params) {
|
|
3696
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3697
|
+
},
|
|
3698
|
+
finite() {
|
|
3699
|
+
return this;
|
|
3700
|
+
}
|
|
3701
|
+
});
|
|
3702
|
+
const bag = inst._zod.bag;
|
|
3703
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3704
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3705
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
4818
3706
|
inst.isFinite = true;
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
4822
|
-
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
4823
|
-
},
|
|
4824
|
-
maxValue: (inst) => {
|
|
4825
|
-
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
4826
|
-
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
4827
|
-
},
|
|
4828
|
-
isInt: (inst) => {
|
|
4829
|
-
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
4830
|
-
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
4831
|
-
},
|
|
4832
|
-
format: (inst) => aggregateChecks(inst).format ?? null
|
|
4833
|
-
}, {
|
|
4834
|
-
gt(value, params) {
|
|
4835
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
4836
|
-
},
|
|
4837
|
-
gte(value, params) {
|
|
4838
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4839
|
-
},
|
|
4840
|
-
min(value, params) {
|
|
4841
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4842
|
-
},
|
|
4843
|
-
lt(value, params) {
|
|
4844
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
4845
|
-
},
|
|
4846
|
-
lte(value, params) {
|
|
4847
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4848
|
-
},
|
|
4849
|
-
max(value, params) {
|
|
4850
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4851
|
-
},
|
|
4852
|
-
int(params) {
|
|
4853
|
-
return this.check(int(params));
|
|
4854
|
-
},
|
|
4855
|
-
safe(params) {
|
|
4856
|
-
return this.check(int(params));
|
|
4857
|
-
},
|
|
4858
|
-
positive(params) {
|
|
4859
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
4860
|
-
},
|
|
4861
|
-
nonnegative(params) {
|
|
4862
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
4863
|
-
},
|
|
4864
|
-
negative(params) {
|
|
4865
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
4866
|
-
},
|
|
4867
|
-
nonpositive(params) {
|
|
4868
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
4869
|
-
},
|
|
4870
|
-
multipleOf(value, params) {
|
|
4871
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4872
|
-
},
|
|
4873
|
-
step(value, params) {
|
|
4874
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4875
|
-
},
|
|
4876
|
-
finite() {
|
|
4877
|
-
return this;
|
|
4878
|
-
}
|
|
4879
|
-
}));
|
|
3707
|
+
inst.format = bag.format ?? null;
|
|
3708
|
+
});
|
|
4880
3709
|
function number(params) {
|
|
4881
3710
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
4882
3711
|
}
|
|
@@ -4920,80 +3749,94 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4920
3749
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
4921
3750
|
}
|
|
4922
3751
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
4923
|
-
_ensureDefaultMemoizer();
|
|
4924
3752
|
$ZodArray.init(inst, def);
|
|
4925
3753
|
ZodType.init(inst, def);
|
|
4926
3754
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
4927
3755
|
inst.element = def.element;
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
3756
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
3757
|
+
min(n, params) {
|
|
3758
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
3759
|
+
},
|
|
3760
|
+
nonempty(params) {
|
|
3761
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
3762
|
+
},
|
|
3763
|
+
max(n, params) {
|
|
3764
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
3765
|
+
},
|
|
3766
|
+
length(n, params) {
|
|
3767
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
3768
|
+
},
|
|
3769
|
+
unwrap() {
|
|
3770
|
+
return this.element;
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
4944
3773
|
});
|
|
4945
3774
|
function array(element, params) {
|
|
4946
3775
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
4947
3776
|
}
|
|
4948
3777
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
4949
|
-
_ensureDefaultMemoizer();
|
|
4950
3778
|
$ZodObjectJIT.init(inst, def);
|
|
4951
3779
|
ZodType.init(inst, def);
|
|
4952
3780
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
3781
|
+
defineLazy(inst, "shape", () => {
|
|
3782
|
+
return def.shape;
|
|
3783
|
+
});
|
|
3784
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
3785
|
+
keyof() {
|
|
3786
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
3787
|
+
},
|
|
3788
|
+
catchall(catchall) {
|
|
3789
|
+
return this.clone({
|
|
3790
|
+
...this._zod.def,
|
|
3791
|
+
catchall
|
|
3792
|
+
});
|
|
3793
|
+
},
|
|
3794
|
+
passthrough() {
|
|
3795
|
+
return this.clone({
|
|
3796
|
+
...this._zod.def,
|
|
3797
|
+
catchall: unknown()
|
|
3798
|
+
});
|
|
3799
|
+
},
|
|
3800
|
+
loose() {
|
|
3801
|
+
return this.clone({
|
|
3802
|
+
...this._zod.def,
|
|
3803
|
+
catchall: unknown()
|
|
3804
|
+
});
|
|
3805
|
+
},
|
|
3806
|
+
strict() {
|
|
3807
|
+
return this.clone({
|
|
3808
|
+
...this._zod.def,
|
|
3809
|
+
catchall: never()
|
|
3810
|
+
});
|
|
3811
|
+
},
|
|
3812
|
+
strip() {
|
|
3813
|
+
return this.clone({
|
|
3814
|
+
...this._zod.def,
|
|
3815
|
+
catchall: void 0
|
|
3816
|
+
});
|
|
3817
|
+
},
|
|
3818
|
+
extend(incoming) {
|
|
3819
|
+
return extend(this, incoming);
|
|
3820
|
+
},
|
|
3821
|
+
safeExtend(incoming) {
|
|
3822
|
+
return safeExtend(this, incoming);
|
|
3823
|
+
},
|
|
3824
|
+
merge(other) {
|
|
3825
|
+
return merge(this, other);
|
|
3826
|
+
},
|
|
3827
|
+
pick(mask) {
|
|
3828
|
+
return pick(this, mask);
|
|
3829
|
+
},
|
|
3830
|
+
omit(mask) {
|
|
3831
|
+
return omit(this, mask);
|
|
3832
|
+
},
|
|
3833
|
+
partial(...args) {
|
|
3834
|
+
return partial(ZodOptional, this, args[0]);
|
|
3835
|
+
},
|
|
3836
|
+
required(...args) {
|
|
3837
|
+
return required(ZodNonOptional, this, args[0]);
|
|
3838
|
+
}
|
|
3839
|
+
});
|
|
4997
3840
|
});
|
|
4998
3841
|
function object(shape, params) {
|
|
4999
3842
|
const def = {
|
|
@@ -5033,7 +3876,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5033
3876
|
ZodType.init(inst, def);
|
|
5034
3877
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
5035
3878
|
inst.enum = def.entries;
|
|
5036
|
-
inst.options =
|
|
3879
|
+
inst.options = Object.values(def.entries);
|
|
5037
3880
|
const keys = new Set(Object.keys(def.entries));
|
|
5038
3881
|
inst.extract = (values, params) => {
|
|
5039
3882
|
const newEntries = {};
|
|
@@ -5067,7 +3910,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5067
3910
|
});
|
|
5068
3911
|
}
|
|
5069
3912
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
5070
|
-
_ensureDefaultMemoizer();
|
|
5071
3913
|
$ZodTransform.init(inst, def);
|
|
5072
3914
|
ZodType.init(inst, def);
|
|
5073
3915
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -5079,7 +3921,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5079
3921
|
const _issue = issue$1;
|
|
5080
3922
|
if (_issue.fatal) _issue.continue = false;
|
|
5081
3923
|
_issue.code ?? (_issue.code = "custom");
|
|
5082
|
-
|
|
3924
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
5083
3925
|
_issue.inst ?? (_issue.inst = inst);
|
|
5084
3926
|
payload.issues.push(issue(_issue));
|
|
5085
3927
|
}
|
|
@@ -5087,9 +3929,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5087
3929
|
const output = def.transform(payload.value, payload);
|
|
5088
3930
|
if (output instanceof Promise) return output.then((output) => {
|
|
5089
3931
|
payload.value = output;
|
|
3932
|
+
payload.fallback = true;
|
|
5090
3933
|
return payload;
|
|
5091
3934
|
});
|
|
5092
3935
|
payload.value = output;
|
|
3936
|
+
payload.fallback = true;
|
|
5093
3937
|
return payload;
|
|
5094
3938
|
};
|
|
5095
3939
|
});
|
|
@@ -5190,7 +4034,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5190
4034
|
return new ZodCatch({
|
|
5191
4035
|
type: "catch",
|
|
5192
4036
|
innerType,
|
|
5193
|
-
catchValue: typeof catchValue === "function" ? catchValue :
|
|
4037
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
5194
4038
|
});
|
|
5195
4039
|
}
|
|
5196
4040
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -5346,6 +4190,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5346
4190
|
offset: count.optional(),
|
|
5347
4191
|
reason: optionalText.optional(),
|
|
5348
4192
|
dry_run: bool.optional(),
|
|
4193
|
+
file: optionalText.optional(),
|
|
4194
|
+
confirm: bool.optional(),
|
|
5349
4195
|
store: optionalText.optional(),
|
|
5350
4196
|
contradiction_id: count.optional(),
|
|
5351
4197
|
resolution: optionalText.optional(),
|