@rspack-canary/browser 1.6.0-canary-17d2172b-20251016033144 → 1.6.0-canary-2ccce257-20251016173648
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/dist/index.mjs +892 -581
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/schema/config.d.ts +1 -1
- package/dist/schema/loaders.d.ts +1 -1
- package/dist/schema/plugins.d.ts +1 -1
- package/dist/schema/utils.d.ts +1 -1
- package/dist/schema/validate.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -40392,74 +40392,25 @@ class $ZodAsyncError extends Error {
|
|
|
40392
40392
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
40393
40393
|
}
|
|
40394
40394
|
}
|
|
40395
|
+
class $ZodEncodeError extends Error {
|
|
40396
|
+
constructor(name){
|
|
40397
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
40398
|
+
this.name = "ZodEncodeError";
|
|
40399
|
+
}
|
|
40400
|
+
}
|
|
40395
40401
|
const globalConfig = {};
|
|
40396
40402
|
function core_config(newConfig) {
|
|
40397
40403
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
40398
40404
|
return globalConfig;
|
|
40399
40405
|
}
|
|
40400
|
-
|
|
40401
|
-
const cuid2 = /^[0-9a-z]+$/;
|
|
40402
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
40403
|
-
const xid = /^[0-9a-vA-V]{20}$/;
|
|
40404
|
-
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
40405
|
-
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
40406
|
-
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
40407
|
-
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})$/;
|
|
40408
|
-
const regexes_uuid = (version)=>{
|
|
40409
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
|
40410
|
-
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})$`);
|
|
40411
|
-
};
|
|
40412
|
-
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
40413
|
-
const _emoji = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
40414
|
-
function emoji() {
|
|
40415
|
-
return new RegExp(_emoji, "u");
|
|
40416
|
-
}
|
|
40417
|
-
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])$/;
|
|
40418
|
-
const ipv6 = /^(([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})$/;
|
|
40419
|
-
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])$/;
|
|
40420
|
-
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])$/;
|
|
40421
|
-
const regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
40422
|
-
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
40423
|
-
const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
40424
|
-
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
40425
|
-
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])))";
|
|
40426
|
-
const regexes_date = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
40427
|
-
function timeSource(args) {
|
|
40428
|
-
const hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
40429
|
-
const regex = "number" == typeof args.precision ? -1 === args.precision ? `${hhmm}` : 0 === args.precision ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
40430
|
-
return regex;
|
|
40431
|
-
}
|
|
40432
|
-
function regexes_time(args) {
|
|
40433
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
40434
|
-
}
|
|
40435
|
-
function datetime(args) {
|
|
40436
|
-
const time = timeSource({
|
|
40437
|
-
precision: args.precision
|
|
40438
|
-
});
|
|
40439
|
-
const opts = [
|
|
40440
|
-
"Z"
|
|
40441
|
-
];
|
|
40442
|
-
if (args.local) opts.push("");
|
|
40443
|
-
if (args.offset) opts.push("([+-]\\d{2}:\\d{2})");
|
|
40444
|
-
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
40445
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
40446
|
-
}
|
|
40447
|
-
const string = (params)=>{
|
|
40448
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
40449
|
-
return new RegExp(`^${regex}$`);
|
|
40450
|
-
};
|
|
40451
|
-
const integer = /^\d+$/;
|
|
40452
|
-
const number = /^-?\d+(?:\.\d+)?/i;
|
|
40453
|
-
const regexes_boolean = /true|false/i;
|
|
40454
|
-
const _null = /null/i;
|
|
40455
|
-
const _undefined = /undefined/i;
|
|
40456
|
-
const lowercase = /^[^A-Z]*$/;
|
|
40457
|
-
const uppercase = /^[^a-z]*$/;
|
|
40458
|
-
function getEnumValues(entries) {
|
|
40406
|
+
function util_getEnumValues(entries) {
|
|
40459
40407
|
const numericValues = Object.values(entries).filter((v)=>"number" == typeof v);
|
|
40460
40408
|
const values = Object.entries(entries).filter(([k, _])=>-1 === numericValues.indexOf(+k)).map(([_, v])=>v);
|
|
40461
40409
|
return values;
|
|
40462
40410
|
}
|
|
40411
|
+
function joinValues(array, separator = "|") {
|
|
40412
|
+
return array.map((val)=>stringifyPrimitive(val)).join(separator);
|
|
40413
|
+
}
|
|
40463
40414
|
function jsonStringifyReplacer(_, value) {
|
|
40464
40415
|
if ("bigint" == typeof value) return value.toString();
|
|
40465
40416
|
return value;
|
|
@@ -40489,22 +40440,28 @@ function cleanRegex(source) {
|
|
|
40489
40440
|
}
|
|
40490
40441
|
function floatSafeRemainder(val, step) {
|
|
40491
40442
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
40492
|
-
const
|
|
40443
|
+
const stepString = step.toString();
|
|
40444
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
40445
|
+
if (0 === stepDecCount && /\d?e-\d?/.test(stepString)) {
|
|
40446
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
40447
|
+
if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
|
|
40448
|
+
}
|
|
40493
40449
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
40494
40450
|
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
40495
40451
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
40496
40452
|
return valInt % stepInt / 10 ** decCount;
|
|
40497
40453
|
}
|
|
40454
|
+
const EVALUATING = Symbol("evaluating");
|
|
40498
40455
|
function defineLazy(object, key, getter) {
|
|
40499
|
-
|
|
40456
|
+
let value;
|
|
40500
40457
|
Object.defineProperty(object, key, {
|
|
40501
40458
|
get () {
|
|
40502
|
-
if (
|
|
40503
|
-
|
|
40504
|
-
|
|
40505
|
-
|
|
40459
|
+
if (value === EVALUATING) return;
|
|
40460
|
+
if (void 0 === value) {
|
|
40461
|
+
value = EVALUATING;
|
|
40462
|
+
value = getter();
|
|
40506
40463
|
}
|
|
40507
|
-
|
|
40464
|
+
return value;
|
|
40508
40465
|
},
|
|
40509
40466
|
set (v) {
|
|
40510
40467
|
Object.defineProperty(object, key, {
|
|
@@ -40522,10 +40479,18 @@ function assignProp(target, prop, value) {
|
|
|
40522
40479
|
configurable: true
|
|
40523
40480
|
});
|
|
40524
40481
|
}
|
|
40482
|
+
function mergeDefs(...defs) {
|
|
40483
|
+
const mergedDescriptors = {};
|
|
40484
|
+
for (const def of defs){
|
|
40485
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
40486
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
40487
|
+
}
|
|
40488
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
40489
|
+
}
|
|
40525
40490
|
function esc(str) {
|
|
40526
40491
|
return JSON.stringify(str);
|
|
40527
40492
|
}
|
|
40528
|
-
const captureStackTrace =
|
|
40493
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args)=>{};
|
|
40529
40494
|
function util_isObject(data) {
|
|
40530
40495
|
return "object" == typeof data && null !== data && !Array.isArray(data);
|
|
40531
40496
|
}
|
|
@@ -40548,6 +40513,15 @@ function isPlainObject(o) {
|
|
|
40548
40513
|
if (false === Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf")) return false;
|
|
40549
40514
|
return true;
|
|
40550
40515
|
}
|
|
40516
|
+
function shallowClone(o) {
|
|
40517
|
+
if (isPlainObject(o)) return {
|
|
40518
|
+
...o
|
|
40519
|
+
};
|
|
40520
|
+
if (Array.isArray(o)) return [
|
|
40521
|
+
...o
|
|
40522
|
+
];
|
|
40523
|
+
return o;
|
|
40524
|
+
}
|
|
40551
40525
|
const getParsedType = (data)=>{
|
|
40552
40526
|
const t = typeof data;
|
|
40553
40527
|
switch(t){
|
|
@@ -40616,6 +40590,11 @@ function normalizeParams(_params) {
|
|
|
40616
40590
|
};
|
|
40617
40591
|
return params;
|
|
40618
40592
|
}
|
|
40593
|
+
function stringifyPrimitive(value) {
|
|
40594
|
+
if ("bigint" == typeof value) return value.toString() + "n";
|
|
40595
|
+
if ("string" == typeof value) return `"${value}"`;
|
|
40596
|
+
return `${value}`;
|
|
40597
|
+
}
|
|
40619
40598
|
function optionalKeys(shape) {
|
|
40620
40599
|
return Object.keys(shape).filter((k)=>"optional" === shape[k]._zod.optin && "optional" === shape[k]._zod.optout);
|
|
40621
40600
|
}
|
|
@@ -40642,35 +40621,59 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
40642
40621
|
]
|
|
40643
40622
|
};
|
|
40644
40623
|
function pick(schema, mask) {
|
|
40645
|
-
const newShape = {};
|
|
40646
40624
|
const currDef = schema._zod.def;
|
|
40647
|
-
|
|
40648
|
-
|
|
40649
|
-
|
|
40650
|
-
|
|
40651
|
-
|
|
40652
|
-
|
|
40653
|
-
|
|
40625
|
+
const def = mergeDefs(schema._zod.def, {
|
|
40626
|
+
get shape () {
|
|
40627
|
+
const newShape = {};
|
|
40628
|
+
for(const key in mask){
|
|
40629
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
40630
|
+
if (mask[key]) newShape[key] = currDef.shape[key];
|
|
40631
|
+
}
|
|
40632
|
+
assignProp(this, "shape", newShape);
|
|
40633
|
+
return newShape;
|
|
40634
|
+
},
|
|
40654
40635
|
checks: []
|
|
40655
40636
|
});
|
|
40637
|
+
return clone(schema, def);
|
|
40656
40638
|
}
|
|
40657
40639
|
function omit(schema, mask) {
|
|
40658
|
-
const newShape = {
|
|
40659
|
-
...schema._zod.def.shape
|
|
40660
|
-
};
|
|
40661
40640
|
const currDef = schema._zod.def;
|
|
40662
|
-
|
|
40663
|
-
|
|
40664
|
-
|
|
40665
|
-
|
|
40666
|
-
|
|
40667
|
-
|
|
40668
|
-
|
|
40641
|
+
const def = mergeDefs(schema._zod.def, {
|
|
40642
|
+
get shape () {
|
|
40643
|
+
const newShape = {
|
|
40644
|
+
...schema._zod.def.shape
|
|
40645
|
+
};
|
|
40646
|
+
for(const key in mask){
|
|
40647
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
40648
|
+
if (mask[key]) delete newShape[key];
|
|
40649
|
+
}
|
|
40650
|
+
assignProp(this, "shape", newShape);
|
|
40651
|
+
return newShape;
|
|
40652
|
+
},
|
|
40669
40653
|
checks: []
|
|
40670
40654
|
});
|
|
40655
|
+
return clone(schema, def);
|
|
40671
40656
|
}
|
|
40672
40657
|
function extend(schema, shape) {
|
|
40673
40658
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
40659
|
+
const checks = schema._zod.def.checks;
|
|
40660
|
+
const hasChecks = checks && checks.length > 0;
|
|
40661
|
+
if (hasChecks) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
40662
|
+
const def = mergeDefs(schema._zod.def, {
|
|
40663
|
+
get shape () {
|
|
40664
|
+
const _shape = {
|
|
40665
|
+
...schema._zod.def.shape,
|
|
40666
|
+
...shape
|
|
40667
|
+
};
|
|
40668
|
+
assignProp(this, "shape", _shape);
|
|
40669
|
+
return _shape;
|
|
40670
|
+
},
|
|
40671
|
+
checks: []
|
|
40672
|
+
});
|
|
40673
|
+
return clone(schema, def);
|
|
40674
|
+
}
|
|
40675
|
+
function safeExtend(schema, shape) {
|
|
40676
|
+
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
40674
40677
|
const def = {
|
|
40675
40678
|
...schema._zod.def,
|
|
40676
40679
|
get shape () {
|
|
@@ -40681,13 +40684,12 @@ function extend(schema, shape) {
|
|
|
40681
40684
|
assignProp(this, "shape", _shape);
|
|
40682
40685
|
return _shape;
|
|
40683
40686
|
},
|
|
40684
|
-
checks:
|
|
40687
|
+
checks: schema._zod.def.checks
|
|
40685
40688
|
};
|
|
40686
40689
|
return clone(schema, def);
|
|
40687
40690
|
}
|
|
40688
40691
|
function merge(a, b) {
|
|
40689
|
-
|
|
40690
|
-
...a._zod.def,
|
|
40692
|
+
const def = mergeDefs(a._zod.def, {
|
|
40691
40693
|
get shape () {
|
|
40692
40694
|
const _shape = {
|
|
40693
40695
|
...a._zod.def.shape,
|
|
@@ -40696,55 +40698,65 @@ function merge(a, b) {
|
|
|
40696
40698
|
assignProp(this, "shape", _shape);
|
|
40697
40699
|
return _shape;
|
|
40698
40700
|
},
|
|
40699
|
-
catchall
|
|
40701
|
+
get catchall () {
|
|
40702
|
+
return b._zod.def.catchall;
|
|
40703
|
+
},
|
|
40700
40704
|
checks: []
|
|
40701
40705
|
});
|
|
40706
|
+
return clone(a, def);
|
|
40702
40707
|
}
|
|
40703
40708
|
function partial(Class, schema, mask) {
|
|
40704
|
-
const
|
|
40705
|
-
|
|
40706
|
-
|
|
40707
|
-
|
|
40708
|
-
|
|
40709
|
-
|
|
40710
|
-
|
|
40711
|
-
|
|
40712
|
-
|
|
40713
|
-
|
|
40714
|
-
|
|
40715
|
-
|
|
40716
|
-
|
|
40717
|
-
|
|
40718
|
-
|
|
40719
|
-
|
|
40720
|
-
|
|
40721
|
-
|
|
40709
|
+
const def = mergeDefs(schema._zod.def, {
|
|
40710
|
+
get shape () {
|
|
40711
|
+
const oldShape = schema._zod.def.shape;
|
|
40712
|
+
const shape = {
|
|
40713
|
+
...oldShape
|
|
40714
|
+
};
|
|
40715
|
+
if (mask) for(const key in mask){
|
|
40716
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
40717
|
+
if (mask[key]) shape[key] = Class ? new Class({
|
|
40718
|
+
type: "optional",
|
|
40719
|
+
innerType: oldShape[key]
|
|
40720
|
+
}) : oldShape[key];
|
|
40721
|
+
}
|
|
40722
|
+
else for(const key in oldShape)shape[key] = Class ? new Class({
|
|
40723
|
+
type: "optional",
|
|
40724
|
+
innerType: oldShape[key]
|
|
40725
|
+
}) : oldShape[key];
|
|
40726
|
+
assignProp(this, "shape", shape);
|
|
40727
|
+
return shape;
|
|
40728
|
+
},
|
|
40722
40729
|
checks: []
|
|
40723
40730
|
});
|
|
40731
|
+
return clone(schema, def);
|
|
40724
40732
|
}
|
|
40725
40733
|
function required(Class, schema, mask) {
|
|
40726
|
-
const
|
|
40727
|
-
|
|
40728
|
-
|
|
40729
|
-
|
|
40730
|
-
|
|
40731
|
-
|
|
40732
|
-
|
|
40733
|
-
|
|
40734
|
-
|
|
40735
|
-
|
|
40736
|
-
|
|
40737
|
-
|
|
40738
|
-
|
|
40739
|
-
|
|
40740
|
-
|
|
40741
|
-
|
|
40742
|
-
|
|
40743
|
-
|
|
40734
|
+
const def = mergeDefs(schema._zod.def, {
|
|
40735
|
+
get shape () {
|
|
40736
|
+
const oldShape = schema._zod.def.shape;
|
|
40737
|
+
const shape = {
|
|
40738
|
+
...oldShape
|
|
40739
|
+
};
|
|
40740
|
+
if (mask) for(const key in mask){
|
|
40741
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
40742
|
+
if (mask[key]) shape[key] = new Class({
|
|
40743
|
+
type: "nonoptional",
|
|
40744
|
+
innerType: oldShape[key]
|
|
40745
|
+
});
|
|
40746
|
+
}
|
|
40747
|
+
else for(const key in oldShape)shape[key] = new Class({
|
|
40748
|
+
type: "nonoptional",
|
|
40749
|
+
innerType: oldShape[key]
|
|
40750
|
+
});
|
|
40751
|
+
assignProp(this, "shape", shape);
|
|
40752
|
+
return shape;
|
|
40753
|
+
},
|
|
40744
40754
|
checks: []
|
|
40745
40755
|
});
|
|
40756
|
+
return clone(schema, def);
|
|
40746
40757
|
}
|
|
40747
40758
|
function aborted(x, startIndex = 0) {
|
|
40759
|
+
if (true === x.aborted) return true;
|
|
40748
40760
|
for(let i = startIndex; i < x.issues.length; i++)if (x.issues[i]?.continue !== true) return true;
|
|
40749
40761
|
return false;
|
|
40750
40762
|
}
|
|
@@ -40790,6 +40802,246 @@ function util_issue(...args) {
|
|
|
40790
40802
|
...iss
|
|
40791
40803
|
};
|
|
40792
40804
|
}
|
|
40805
|
+
const errors_initializer = (inst, def)=>{
|
|
40806
|
+
inst.name = "$ZodError";
|
|
40807
|
+
Object.defineProperty(inst, "_zod", {
|
|
40808
|
+
value: inst._zod,
|
|
40809
|
+
enumerable: false
|
|
40810
|
+
});
|
|
40811
|
+
Object.defineProperty(inst, "issues", {
|
|
40812
|
+
value: def,
|
|
40813
|
+
enumerable: false
|
|
40814
|
+
});
|
|
40815
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
40816
|
+
Object.defineProperty(inst, "toString", {
|
|
40817
|
+
value: ()=>inst.message,
|
|
40818
|
+
enumerable: false
|
|
40819
|
+
});
|
|
40820
|
+
};
|
|
40821
|
+
const $ZodError = $constructor("$ZodError", errors_initializer);
|
|
40822
|
+
const $ZodRealError = $constructor("$ZodError", errors_initializer, {
|
|
40823
|
+
Parent: Error
|
|
40824
|
+
});
|
|
40825
|
+
function flattenError(error, mapper = (issue)=>issue.message) {
|
|
40826
|
+
const fieldErrors = {};
|
|
40827
|
+
const formErrors = [];
|
|
40828
|
+
for (const sub of error.issues)if (sub.path.length > 0) {
|
|
40829
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
40830
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
40831
|
+
} else formErrors.push(mapper(sub));
|
|
40832
|
+
return {
|
|
40833
|
+
formErrors,
|
|
40834
|
+
fieldErrors
|
|
40835
|
+
};
|
|
40836
|
+
}
|
|
40837
|
+
function errors_formatError(error, mapper = (issue)=>issue.message) {
|
|
40838
|
+
const fieldErrors = {
|
|
40839
|
+
_errors: []
|
|
40840
|
+
};
|
|
40841
|
+
const processError = (error)=>{
|
|
40842
|
+
for (const issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
|
|
40843
|
+
issues
|
|
40844
|
+
}));
|
|
40845
|
+
else if ("invalid_key" === issue.code) processError({
|
|
40846
|
+
issues: issue.issues
|
|
40847
|
+
});
|
|
40848
|
+
else if ("invalid_element" === issue.code) processError({
|
|
40849
|
+
issues: issue.issues
|
|
40850
|
+
});
|
|
40851
|
+
else if (0 === issue.path.length) fieldErrors._errors.push(mapper(issue));
|
|
40852
|
+
else {
|
|
40853
|
+
let curr = fieldErrors;
|
|
40854
|
+
let i = 0;
|
|
40855
|
+
while(i < issue.path.length){
|
|
40856
|
+
const el = issue.path[i];
|
|
40857
|
+
const terminal = i === issue.path.length - 1;
|
|
40858
|
+
if (terminal) {
|
|
40859
|
+
curr[el] = curr[el] || {
|
|
40860
|
+
_errors: []
|
|
40861
|
+
};
|
|
40862
|
+
curr[el]._errors.push(mapper(issue));
|
|
40863
|
+
} else curr[el] = curr[el] || {
|
|
40864
|
+
_errors: []
|
|
40865
|
+
};
|
|
40866
|
+
curr = curr[el];
|
|
40867
|
+
i++;
|
|
40868
|
+
}
|
|
40869
|
+
}
|
|
40870
|
+
};
|
|
40871
|
+
processError(error);
|
|
40872
|
+
return fieldErrors;
|
|
40873
|
+
}
|
|
40874
|
+
const _parse = (_Err)=>(schema, value, _ctx, _params)=>{
|
|
40875
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40876
|
+
async: false
|
|
40877
|
+
}) : {
|
|
40878
|
+
async: false
|
|
40879
|
+
};
|
|
40880
|
+
const result = schema._zod.run({
|
|
40881
|
+
value,
|
|
40882
|
+
issues: []
|
|
40883
|
+
}, ctx);
|
|
40884
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
40885
|
+
if (result.issues.length) {
|
|
40886
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
|
|
40887
|
+
captureStackTrace(e, _params?.callee);
|
|
40888
|
+
throw e;
|
|
40889
|
+
}
|
|
40890
|
+
return result.value;
|
|
40891
|
+
};
|
|
40892
|
+
const _parseAsync = (_Err)=>async (schema, value, _ctx, params)=>{
|
|
40893
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40894
|
+
async: true
|
|
40895
|
+
}) : {
|
|
40896
|
+
async: true
|
|
40897
|
+
};
|
|
40898
|
+
let result = schema._zod.run({
|
|
40899
|
+
value,
|
|
40900
|
+
issues: []
|
|
40901
|
+
}, ctx);
|
|
40902
|
+
if (result instanceof Promise) result = await result;
|
|
40903
|
+
if (result.issues.length) {
|
|
40904
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
|
|
40905
|
+
captureStackTrace(e, params?.callee);
|
|
40906
|
+
throw e;
|
|
40907
|
+
}
|
|
40908
|
+
return result.value;
|
|
40909
|
+
};
|
|
40910
|
+
const _safeParse = (_Err)=>(schema, value, _ctx)=>{
|
|
40911
|
+
const ctx = _ctx ? {
|
|
40912
|
+
..._ctx,
|
|
40913
|
+
async: false
|
|
40914
|
+
} : {
|
|
40915
|
+
async: false
|
|
40916
|
+
};
|
|
40917
|
+
const result = schema._zod.run({
|
|
40918
|
+
value,
|
|
40919
|
+
issues: []
|
|
40920
|
+
}, ctx);
|
|
40921
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
40922
|
+
return result.issues.length ? {
|
|
40923
|
+
success: false,
|
|
40924
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
|
|
40925
|
+
} : {
|
|
40926
|
+
success: true,
|
|
40927
|
+
data: result.value
|
|
40928
|
+
};
|
|
40929
|
+
};
|
|
40930
|
+
const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
40931
|
+
const _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
|
|
40932
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40933
|
+
async: true
|
|
40934
|
+
}) : {
|
|
40935
|
+
async: true
|
|
40936
|
+
};
|
|
40937
|
+
let result = schema._zod.run({
|
|
40938
|
+
value,
|
|
40939
|
+
issues: []
|
|
40940
|
+
}, ctx);
|
|
40941
|
+
if (result instanceof Promise) result = await result;
|
|
40942
|
+
return result.issues.length ? {
|
|
40943
|
+
success: false,
|
|
40944
|
+
error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
|
|
40945
|
+
} : {
|
|
40946
|
+
success: true,
|
|
40947
|
+
data: result.value
|
|
40948
|
+
};
|
|
40949
|
+
};
|
|
40950
|
+
const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
40951
|
+
const _encode = (_Err)=>(schema, value, _ctx)=>{
|
|
40952
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40953
|
+
direction: "backward"
|
|
40954
|
+
}) : {
|
|
40955
|
+
direction: "backward"
|
|
40956
|
+
};
|
|
40957
|
+
return _parse(_Err)(schema, value, ctx);
|
|
40958
|
+
};
|
|
40959
|
+
const _decode = (_Err)=>(schema, value, _ctx)=>_parse(_Err)(schema, value, _ctx);
|
|
40960
|
+
const _encodeAsync = (_Err)=>async (schema, value, _ctx)=>{
|
|
40961
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40962
|
+
direction: "backward"
|
|
40963
|
+
}) : {
|
|
40964
|
+
direction: "backward"
|
|
40965
|
+
};
|
|
40966
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
40967
|
+
};
|
|
40968
|
+
const _decodeAsync = (_Err)=>async (schema, value, _ctx)=>_parseAsync(_Err)(schema, value, _ctx);
|
|
40969
|
+
const _safeEncode = (_Err)=>(schema, value, _ctx)=>{
|
|
40970
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40971
|
+
direction: "backward"
|
|
40972
|
+
}) : {
|
|
40973
|
+
direction: "backward"
|
|
40974
|
+
};
|
|
40975
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
40976
|
+
};
|
|
40977
|
+
const _safeDecode = (_Err)=>(schema, value, _ctx)=>_safeParse(_Err)(schema, value, _ctx);
|
|
40978
|
+
const _safeEncodeAsync = (_Err)=>async (schema, value, _ctx)=>{
|
|
40979
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
40980
|
+
direction: "backward"
|
|
40981
|
+
}) : {
|
|
40982
|
+
direction: "backward"
|
|
40983
|
+
};
|
|
40984
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
40985
|
+
};
|
|
40986
|
+
const _safeDecodeAsync = (_Err)=>async (schema, value, _ctx)=>_safeParseAsync(_Err)(schema, value, _ctx);
|
|
40987
|
+
const cuid = /^[cC][^\s-]{8,}$/;
|
|
40988
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
40989
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
40990
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
40991
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
40992
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
40993
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
40994
|
+
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})$/;
|
|
40995
|
+
const regexes_uuid = (version)=>{
|
|
40996
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
40997
|
+
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})$`);
|
|
40998
|
+
};
|
|
40999
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
41000
|
+
const _emoji = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
41001
|
+
function emoji() {
|
|
41002
|
+
return new RegExp(_emoji, "u");
|
|
41003
|
+
}
|
|
41004
|
+
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])$/;
|
|
41005
|
+
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}|:))$/;
|
|
41006
|
+
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])$/;
|
|
41007
|
+
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])$/;
|
|
41008
|
+
const regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
41009
|
+
const regexes_base64url = /^[A-Za-z0-9_-]*$/;
|
|
41010
|
+
const hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
41011
|
+
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
41012
|
+
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])))";
|
|
41013
|
+
const regexes_date = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
41014
|
+
function timeSource(args) {
|
|
41015
|
+
const hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
41016
|
+
const regex = "number" == typeof args.precision ? -1 === args.precision ? `${hhmm}` : 0 === args.precision ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
41017
|
+
return regex;
|
|
41018
|
+
}
|
|
41019
|
+
function regexes_time(args) {
|
|
41020
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
41021
|
+
}
|
|
41022
|
+
function datetime(args) {
|
|
41023
|
+
const time = timeSource({
|
|
41024
|
+
precision: args.precision
|
|
41025
|
+
});
|
|
41026
|
+
const opts = [
|
|
41027
|
+
"Z"
|
|
41028
|
+
];
|
|
41029
|
+
if (args.local) opts.push("");
|
|
41030
|
+
if (args.offset) opts.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
41031
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
41032
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
41033
|
+
}
|
|
41034
|
+
const string = (params)=>{
|
|
41035
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
41036
|
+
return new RegExp(`^${regex}$`);
|
|
41037
|
+
};
|
|
41038
|
+
const integer = /^-?\d+$/;
|
|
41039
|
+
const regexes_number = /^-?\d+(?:\.\d+)?/;
|
|
41040
|
+
const regexes_boolean = /^(?:true|false)$/i;
|
|
41041
|
+
const _null = /^null$/i;
|
|
41042
|
+
const _undefined = /^undefined$/i;
|
|
41043
|
+
const lowercase = /^[^A-Z]*$/;
|
|
41044
|
+
const uppercase = /^[^a-z]*$/;
|
|
40793
41045
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def)=>{
|
|
40794
41046
|
var _a;
|
|
40795
41047
|
inst._zod ?? (inst._zod = {});
|
|
@@ -40885,6 +41137,7 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
40885
41137
|
expected: origin,
|
|
40886
41138
|
format: def.format,
|
|
40887
41139
|
code: "invalid_type",
|
|
41140
|
+
continue: false,
|
|
40888
41141
|
input,
|
|
40889
41142
|
inst
|
|
40890
41143
|
});
|
|
@@ -41182,164 +41435,10 @@ class Doc {
|
|
|
41182
41435
|
return new F(...args, lines.join("\n"));
|
|
41183
41436
|
}
|
|
41184
41437
|
}
|
|
41185
|
-
const errors_initializer = (inst, def)=>{
|
|
41186
|
-
inst.name = "$ZodError";
|
|
41187
|
-
Object.defineProperty(inst, "_zod", {
|
|
41188
|
-
value: inst._zod,
|
|
41189
|
-
enumerable: false
|
|
41190
|
-
});
|
|
41191
|
-
Object.defineProperty(inst, "issues", {
|
|
41192
|
-
value: def,
|
|
41193
|
-
enumerable: false
|
|
41194
|
-
});
|
|
41195
|
-
Object.defineProperty(inst, "message", {
|
|
41196
|
-
get () {
|
|
41197
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
41198
|
-
},
|
|
41199
|
-
enumerable: true
|
|
41200
|
-
});
|
|
41201
|
-
Object.defineProperty(inst, "toString", {
|
|
41202
|
-
value: ()=>inst.message,
|
|
41203
|
-
enumerable: false
|
|
41204
|
-
});
|
|
41205
|
-
};
|
|
41206
|
-
const $ZodError = $constructor("$ZodError", errors_initializer);
|
|
41207
|
-
const $ZodRealError = $constructor("$ZodError", errors_initializer, {
|
|
41208
|
-
Parent: Error
|
|
41209
|
-
});
|
|
41210
|
-
function flattenError(error, mapper = (issue)=>issue.message) {
|
|
41211
|
-
const fieldErrors = {};
|
|
41212
|
-
const formErrors = [];
|
|
41213
|
-
for (const sub of error.issues)if (sub.path.length > 0) {
|
|
41214
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
41215
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
41216
|
-
} else formErrors.push(mapper(sub));
|
|
41217
|
-
return {
|
|
41218
|
-
formErrors,
|
|
41219
|
-
fieldErrors
|
|
41220
|
-
};
|
|
41221
|
-
}
|
|
41222
|
-
function errors_formatError(error, _mapper) {
|
|
41223
|
-
const mapper = _mapper || function(issue) {
|
|
41224
|
-
return issue.message;
|
|
41225
|
-
};
|
|
41226
|
-
const fieldErrors = {
|
|
41227
|
-
_errors: []
|
|
41228
|
-
};
|
|
41229
|
-
const processError = (error)=>{
|
|
41230
|
-
for (const issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
|
|
41231
|
-
issues
|
|
41232
|
-
}));
|
|
41233
|
-
else if ("invalid_key" === issue.code) processError({
|
|
41234
|
-
issues: issue.issues
|
|
41235
|
-
});
|
|
41236
|
-
else if ("invalid_element" === issue.code) processError({
|
|
41237
|
-
issues: issue.issues
|
|
41238
|
-
});
|
|
41239
|
-
else if (0 === issue.path.length) fieldErrors._errors.push(mapper(issue));
|
|
41240
|
-
else {
|
|
41241
|
-
let curr = fieldErrors;
|
|
41242
|
-
let i = 0;
|
|
41243
|
-
while(i < issue.path.length){
|
|
41244
|
-
const el = issue.path[i];
|
|
41245
|
-
const terminal = i === issue.path.length - 1;
|
|
41246
|
-
if (terminal) {
|
|
41247
|
-
curr[el] = curr[el] || {
|
|
41248
|
-
_errors: []
|
|
41249
|
-
};
|
|
41250
|
-
curr[el]._errors.push(mapper(issue));
|
|
41251
|
-
} else curr[el] = curr[el] || {
|
|
41252
|
-
_errors: []
|
|
41253
|
-
};
|
|
41254
|
-
curr = curr[el];
|
|
41255
|
-
i++;
|
|
41256
|
-
}
|
|
41257
|
-
}
|
|
41258
|
-
};
|
|
41259
|
-
processError(error);
|
|
41260
|
-
return fieldErrors;
|
|
41261
|
-
}
|
|
41262
|
-
const _parse = (_Err)=>(schema, value, _ctx, _params)=>{
|
|
41263
|
-
const ctx = _ctx ? Object.assign(_ctx, {
|
|
41264
|
-
async: false
|
|
41265
|
-
}) : {
|
|
41266
|
-
async: false
|
|
41267
|
-
};
|
|
41268
|
-
const result = schema._zod.run({
|
|
41269
|
-
value,
|
|
41270
|
-
issues: []
|
|
41271
|
-
}, ctx);
|
|
41272
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
41273
|
-
if (result.issues.length) {
|
|
41274
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
|
|
41275
|
-
captureStackTrace(e, _params?.callee);
|
|
41276
|
-
throw e;
|
|
41277
|
-
}
|
|
41278
|
-
return result.value;
|
|
41279
|
-
};
|
|
41280
|
-
const _parseAsync = (_Err)=>async (schema, value, _ctx, params)=>{
|
|
41281
|
-
const ctx = _ctx ? Object.assign(_ctx, {
|
|
41282
|
-
async: true
|
|
41283
|
-
}) : {
|
|
41284
|
-
async: true
|
|
41285
|
-
};
|
|
41286
|
-
let result = schema._zod.run({
|
|
41287
|
-
value,
|
|
41288
|
-
issues: []
|
|
41289
|
-
}, ctx);
|
|
41290
|
-
if (result instanceof Promise) result = await result;
|
|
41291
|
-
if (result.issues.length) {
|
|
41292
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
|
|
41293
|
-
captureStackTrace(e, params?.callee);
|
|
41294
|
-
throw e;
|
|
41295
|
-
}
|
|
41296
|
-
return result.value;
|
|
41297
|
-
};
|
|
41298
|
-
const _safeParse = (_Err)=>(schema, value, _ctx)=>{
|
|
41299
|
-
const ctx = _ctx ? {
|
|
41300
|
-
..._ctx,
|
|
41301
|
-
async: false
|
|
41302
|
-
} : {
|
|
41303
|
-
async: false
|
|
41304
|
-
};
|
|
41305
|
-
const result = schema._zod.run({
|
|
41306
|
-
value,
|
|
41307
|
-
issues: []
|
|
41308
|
-
}, ctx);
|
|
41309
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
41310
|
-
return result.issues.length ? {
|
|
41311
|
-
success: false,
|
|
41312
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
|
|
41313
|
-
} : {
|
|
41314
|
-
success: true,
|
|
41315
|
-
data: result.value
|
|
41316
|
-
};
|
|
41317
|
-
};
|
|
41318
|
-
const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
41319
|
-
const _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
|
|
41320
|
-
const ctx = _ctx ? Object.assign(_ctx, {
|
|
41321
|
-
async: true
|
|
41322
|
-
}) : {
|
|
41323
|
-
async: true
|
|
41324
|
-
};
|
|
41325
|
-
let result = schema._zod.run({
|
|
41326
|
-
value,
|
|
41327
|
-
issues: []
|
|
41328
|
-
}, ctx);
|
|
41329
|
-
if (result instanceof Promise) result = await result;
|
|
41330
|
-
return result.issues.length ? {
|
|
41331
|
-
success: false,
|
|
41332
|
-
error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
|
|
41333
|
-
} : {
|
|
41334
|
-
success: true,
|
|
41335
|
-
data: result.value
|
|
41336
|
-
};
|
|
41337
|
-
};
|
|
41338
|
-
const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
41339
41438
|
const versions_version = {
|
|
41340
41439
|
major: 4,
|
|
41341
|
-
minor:
|
|
41342
|
-
patch:
|
|
41440
|
+
minor: 1,
|
|
41441
|
+
patch: 12
|
|
41343
41442
|
};
|
|
41344
41443
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def)=>{
|
|
41345
41444
|
var _a;
|
|
@@ -41384,7 +41483,31 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def)=>{
|
|
|
41384
41483
|
if (asyncResult) return asyncResult.then(()=>payload);
|
|
41385
41484
|
return payload;
|
|
41386
41485
|
};
|
|
41486
|
+
const handleCanaryResult = (canary, payload, ctx)=>{
|
|
41487
|
+
if (aborted(canary)) {
|
|
41488
|
+
canary.aborted = true;
|
|
41489
|
+
return canary;
|
|
41490
|
+
}
|
|
41491
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
41492
|
+
if (checkResult instanceof Promise) {
|
|
41493
|
+
if (false === ctx.async) throw new $ZodAsyncError();
|
|
41494
|
+
return checkResult.then((checkResult)=>inst._zod.parse(checkResult, ctx));
|
|
41495
|
+
}
|
|
41496
|
+
return inst._zod.parse(checkResult, ctx);
|
|
41497
|
+
};
|
|
41387
41498
|
inst._zod.run = (payload, ctx)=>{
|
|
41499
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
41500
|
+
if ("backward" === ctx.direction) {
|
|
41501
|
+
const canary = inst._zod.parse({
|
|
41502
|
+
value: payload.value,
|
|
41503
|
+
issues: []
|
|
41504
|
+
}, {
|
|
41505
|
+
...ctx,
|
|
41506
|
+
skipChecks: true
|
|
41507
|
+
});
|
|
41508
|
+
if (canary instanceof Promise) return canary.then((canary)=>handleCanaryResult(canary, payload, ctx));
|
|
41509
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
41510
|
+
}
|
|
41388
41511
|
const result = inst._zod.parse(payload, ctx);
|
|
41389
41512
|
if (result instanceof Promise) {
|
|
41390
41513
|
if (false === ctx.async) throw new $ZodAsyncError();
|
|
@@ -41467,9 +41590,8 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def)=>{
|
|
|
41467
41590
|
$ZodStringFormat.init(inst, def);
|
|
41468
41591
|
inst._zod.check = (payload)=>{
|
|
41469
41592
|
try {
|
|
41470
|
-
const
|
|
41471
|
-
const url = new URL(
|
|
41472
|
-
const href = url.href;
|
|
41593
|
+
const trimmed = payload.value.trim();
|
|
41594
|
+
const url = new URL(trimmed);
|
|
41473
41595
|
if (def.hostname) {
|
|
41474
41596
|
def.hostname.lastIndex = 0;
|
|
41475
41597
|
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
@@ -41494,8 +41616,8 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def)=>{
|
|
|
41494
41616
|
continue: !def.abort
|
|
41495
41617
|
});
|
|
41496
41618
|
}
|
|
41497
|
-
if (
|
|
41498
|
-
else payload.value =
|
|
41619
|
+
if (def.normalize) payload.value = url.href;
|
|
41620
|
+
else payload.value = trimmed;
|
|
41499
41621
|
return;
|
|
41500
41622
|
} catch (_) {
|
|
41501
41623
|
payload.issues.push({
|
|
@@ -41589,8 +41711,10 @@ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def)=>{
|
|
|
41589
41711
|
def.pattern ?? (def.pattern = cidrv6);
|
|
41590
41712
|
$ZodStringFormat.init(inst, def);
|
|
41591
41713
|
inst._zod.check = (payload)=>{
|
|
41592
|
-
const
|
|
41714
|
+
const parts = payload.value.split("/");
|
|
41593
41715
|
try {
|
|
41716
|
+
if (2 !== parts.length) throw new Error();
|
|
41717
|
+
const [address, prefix] = parts;
|
|
41594
41718
|
if (!prefix) throw new Error();
|
|
41595
41719
|
const prefixNum = Number(prefix);
|
|
41596
41720
|
if (`${prefixNum}` !== prefix) throw new Error();
|
|
@@ -41635,13 +41759,13 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def)=>{
|
|
|
41635
41759
|
};
|
|
41636
41760
|
});
|
|
41637
41761
|
function isValidBase64URL(data) {
|
|
41638
|
-
if (!
|
|
41762
|
+
if (!regexes_base64url.test(data)) return false;
|
|
41639
41763
|
const base64 = data.replace(/[-_]/g, (c)=>"-" === c ? "+" : "/");
|
|
41640
41764
|
const padded = base64.padEnd(4 * Math.ceil(base64.length / 4), "=");
|
|
41641
41765
|
return isValidBase64(padded);
|
|
41642
41766
|
}
|
|
41643
41767
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def)=>{
|
|
41644
|
-
def.pattern ?? (def.pattern =
|
|
41768
|
+
def.pattern ?? (def.pattern = regexes_base64url);
|
|
41645
41769
|
$ZodStringFormat.init(inst, def);
|
|
41646
41770
|
inst._zod.onattach.push((inst)=>{
|
|
41647
41771
|
inst._zod.bag.contentEncoding = "base64url";
|
|
@@ -41691,7 +41815,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def)=>{
|
|
|
41691
41815
|
});
|
|
41692
41816
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def)=>{
|
|
41693
41817
|
$ZodType.init(inst, def);
|
|
41694
|
-
inst._zod.pattern = inst._zod.bag.pattern ??
|
|
41818
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? regexes_number;
|
|
41695
41819
|
inst._zod.parse = (payload, _ctx)=>{
|
|
41696
41820
|
if (def.coerce) try {
|
|
41697
41821
|
payload.value = Number(payload.value);
|
|
@@ -41823,32 +41947,69 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def)=>{
|
|
|
41823
41947
|
return payload;
|
|
41824
41948
|
};
|
|
41825
41949
|
});
|
|
41826
|
-
function
|
|
41950
|
+
function handlePropertyResult(result, final, key, input) {
|
|
41827
41951
|
if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
|
|
41828
|
-
|
|
41829
|
-
}
|
|
41830
|
-
function handleOptionalObjectResult(result, final, key, input) {
|
|
41831
|
-
if (result.issues.length) if (void 0 === input[key]) if (key in input) final.value[key] = void 0;
|
|
41832
|
-
else final.value[key] = result.value;
|
|
41833
|
-
else final.issues.push(...prefixIssues(key, result.issues));
|
|
41834
|
-
else if (void 0 === result.value) {
|
|
41952
|
+
if (void 0 === result.value) {
|
|
41835
41953
|
if (key in input) final.value[key] = void 0;
|
|
41836
41954
|
} else final.value[key] = result.value;
|
|
41837
41955
|
}
|
|
41956
|
+
function normalizeDef(def) {
|
|
41957
|
+
const keys = Object.keys(def.shape);
|
|
41958
|
+
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`);
|
|
41959
|
+
const okeys = optionalKeys(def.shape);
|
|
41960
|
+
return {
|
|
41961
|
+
...def,
|
|
41962
|
+
keys,
|
|
41963
|
+
keySet: new Set(keys),
|
|
41964
|
+
numKeys: keys.length,
|
|
41965
|
+
optionalKeys: new Set(okeys)
|
|
41966
|
+
};
|
|
41967
|
+
}
|
|
41968
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
41969
|
+
const unrecognized = [];
|
|
41970
|
+
const keySet = def.keySet;
|
|
41971
|
+
const _catchall = def.catchall._zod;
|
|
41972
|
+
const t = _catchall.def.type;
|
|
41973
|
+
for (const key of Object.keys(input)){
|
|
41974
|
+
if (keySet.has(key)) continue;
|
|
41975
|
+
if ("never" === t) {
|
|
41976
|
+
unrecognized.push(key);
|
|
41977
|
+
continue;
|
|
41978
|
+
}
|
|
41979
|
+
const r = _catchall.run({
|
|
41980
|
+
value: input[key],
|
|
41981
|
+
issues: []
|
|
41982
|
+
}, ctx);
|
|
41983
|
+
if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
|
|
41984
|
+
else handlePropertyResult(r, payload, key, input);
|
|
41985
|
+
}
|
|
41986
|
+
if (unrecognized.length) payload.issues.push({
|
|
41987
|
+
code: "unrecognized_keys",
|
|
41988
|
+
keys: unrecognized,
|
|
41989
|
+
input,
|
|
41990
|
+
inst
|
|
41991
|
+
});
|
|
41992
|
+
if (!proms.length) return payload;
|
|
41993
|
+
return Promise.all(proms).then(()=>payload);
|
|
41994
|
+
}
|
|
41838
41995
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
|
|
41839
41996
|
$ZodType.init(inst, def);
|
|
41840
|
-
const
|
|
41841
|
-
|
|
41842
|
-
|
|
41843
|
-
|
|
41844
|
-
|
|
41845
|
-
|
|
41846
|
-
|
|
41847
|
-
|
|
41848
|
-
|
|
41849
|
-
|
|
41850
|
-
|
|
41851
|
-
|
|
41997
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
41998
|
+
if (!desc?.get) {
|
|
41999
|
+
const sh = def.shape;
|
|
42000
|
+
Object.defineProperty(def, "shape", {
|
|
42001
|
+
get: ()=>{
|
|
42002
|
+
const newSh = {
|
|
42003
|
+
...sh
|
|
42004
|
+
};
|
|
42005
|
+
Object.defineProperty(def, "shape", {
|
|
42006
|
+
value: newSh
|
|
42007
|
+
});
|
|
42008
|
+
return newSh;
|
|
42009
|
+
}
|
|
42010
|
+
});
|
|
42011
|
+
}
|
|
42012
|
+
const _normalized = util_cached(()=>normalizeDef(def));
|
|
41852
42013
|
defineLazy(inst._zod, "propValues", ()=>{
|
|
41853
42014
|
const shape = def.shape;
|
|
41854
42015
|
const propValues = {};
|
|
@@ -41861,6 +42022,41 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
|
|
|
41861
42022
|
}
|
|
41862
42023
|
return propValues;
|
|
41863
42024
|
});
|
|
42025
|
+
const isObject = util_isObject;
|
|
42026
|
+
const catchall = def.catchall;
|
|
42027
|
+
let value;
|
|
42028
|
+
inst._zod.parse = (payload, ctx)=>{
|
|
42029
|
+
value ?? (value = _normalized.value);
|
|
42030
|
+
const input = payload.value;
|
|
42031
|
+
if (!isObject(input)) {
|
|
42032
|
+
payload.issues.push({
|
|
42033
|
+
expected: "object",
|
|
42034
|
+
code: "invalid_type",
|
|
42035
|
+
input,
|
|
42036
|
+
inst
|
|
42037
|
+
});
|
|
42038
|
+
return payload;
|
|
42039
|
+
}
|
|
42040
|
+
payload.value = {};
|
|
42041
|
+
const proms = [];
|
|
42042
|
+
const shape = value.shape;
|
|
42043
|
+
for (const key of value.keys){
|
|
42044
|
+
const el = shape[key];
|
|
42045
|
+
const r = el._zod.run({
|
|
42046
|
+
value: input[key],
|
|
42047
|
+
issues: []
|
|
42048
|
+
}, ctx);
|
|
42049
|
+
if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
|
|
42050
|
+
else handlePropertyResult(r, payload, key, input);
|
|
42051
|
+
}
|
|
42052
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(()=>payload) : payload;
|
|
42053
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
42054
|
+
};
|
|
42055
|
+
});
|
|
42056
|
+
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def)=>{
|
|
42057
|
+
$ZodObject.init(inst, def);
|
|
42058
|
+
const superParse = inst._zod.parse;
|
|
42059
|
+
const _normalized = util_cached(()=>normalizeDef(def));
|
|
41864
42060
|
const generateFastpass = (shape)=>{
|
|
41865
42061
|
const doc = new Doc([
|
|
41866
42062
|
"shape",
|
|
@@ -41876,40 +42072,29 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
|
|
|
41876
42072
|
const ids = Object.create(null);
|
|
41877
42073
|
let counter = 0;
|
|
41878
42074
|
for (const key of normalized.keys)ids[key] = `key_${counter++}`;
|
|
41879
|
-
doc.write("const newResult = {}");
|
|
41880
|
-
for (const key of normalized.keys)
|
|
42075
|
+
doc.write("const newResult = {};");
|
|
42076
|
+
for (const key of normalized.keys){
|
|
41881
42077
|
const id = ids[key];
|
|
41882
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
41883
42078
|
const k = esc(key);
|
|
42079
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
41884
42080
|
doc.write(`
|
|
41885
42081
|
if (${id}.issues.length) {
|
|
41886
|
-
|
|
41887
|
-
|
|
41888
|
-
|
|
41889
|
-
|
|
41890
|
-
|
|
41891
|
-
|
|
41892
|
-
|
|
41893
|
-
|
|
41894
|
-
|
|
41895
|
-
|
|
41896
|
-
);
|
|
42082
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
42083
|
+
...iss,
|
|
42084
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
42085
|
+
})));
|
|
42086
|
+
}
|
|
42087
|
+
|
|
42088
|
+
|
|
42089
|
+
if (${id}.value === undefined) {
|
|
42090
|
+
if (${k} in input) {
|
|
42091
|
+
newResult[${k}] = undefined;
|
|
41897
42092
|
}
|
|
41898
|
-
} else if (${id}.value === undefined) {
|
|
41899
|
-
if (${k} in input) newResult[${k}] = undefined;
|
|
41900
42093
|
} else {
|
|
41901
42094
|
newResult[${k}] = ${id}.value;
|
|
41902
42095
|
}
|
|
41903
|
-
|
|
41904
|
-
|
|
41905
|
-
const id = ids[key];
|
|
41906
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
41907
|
-
doc.write(`
|
|
41908
|
-
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
41909
|
-
...iss,
|
|
41910
|
-
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
41911
|
-
})));`);
|
|
41912
|
-
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
42096
|
+
|
|
42097
|
+
`);
|
|
41913
42098
|
}
|
|
41914
42099
|
doc.write("payload.value = newResult;");
|
|
41915
42100
|
doc.write("return payload;");
|
|
@@ -41935,51 +42120,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
|
|
|
41935
42120
|
});
|
|
41936
42121
|
return payload;
|
|
41937
42122
|
}
|
|
41938
|
-
const proms = [];
|
|
41939
42123
|
if (jit && fastEnabled && ctx?.async === false && true !== ctx.jitless) {
|
|
41940
42124
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
41941
42125
|
payload = fastpass(payload, ctx);
|
|
41942
|
-
|
|
41943
|
-
payload
|
|
41944
|
-
const shape = value.shape;
|
|
41945
|
-
for (const key of value.keys){
|
|
41946
|
-
const el = shape[key];
|
|
41947
|
-
const r = el._zod.run({
|
|
41948
|
-
value: input[key],
|
|
41949
|
-
issues: []
|
|
41950
|
-
}, ctx);
|
|
41951
|
-
const isOptional = "optional" === el._zod.optin && "optional" === el._zod.optout;
|
|
41952
|
-
if (r instanceof Promise) proms.push(r.then((r)=>isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
|
|
41953
|
-
else if (isOptional) handleOptionalObjectResult(r, payload, key, input);
|
|
41954
|
-
else handleObjectResult(r, payload, key);
|
|
41955
|
-
}
|
|
41956
|
-
}
|
|
41957
|
-
if (!catchall) return proms.length ? Promise.all(proms).then(()=>payload) : payload;
|
|
41958
|
-
const unrecognized = [];
|
|
41959
|
-
const keySet = value.keySet;
|
|
41960
|
-
const _catchall = catchall._zod;
|
|
41961
|
-
const t = _catchall.def.type;
|
|
41962
|
-
for (const key of Object.keys(input)){
|
|
41963
|
-
if (keySet.has(key)) continue;
|
|
41964
|
-
if ("never" === t) {
|
|
41965
|
-
unrecognized.push(key);
|
|
41966
|
-
continue;
|
|
41967
|
-
}
|
|
41968
|
-
const r = _catchall.run({
|
|
41969
|
-
value: input[key],
|
|
41970
|
-
issues: []
|
|
41971
|
-
}, ctx);
|
|
41972
|
-
if (r instanceof Promise) proms.push(r.then((r)=>handleObjectResult(r, payload, key)));
|
|
41973
|
-
else handleObjectResult(r, payload, key);
|
|
42126
|
+
if (!catchall) return payload;
|
|
42127
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
41974
42128
|
}
|
|
41975
|
-
|
|
41976
|
-
code: "unrecognized_keys",
|
|
41977
|
-
keys: unrecognized,
|
|
41978
|
-
input,
|
|
41979
|
-
inst
|
|
41980
|
-
});
|
|
41981
|
-
if (!proms.length) return payload;
|
|
41982
|
-
return Promise.all(proms).then(()=>payload);
|
|
42129
|
+
return superParse(payload, ctx);
|
|
41983
42130
|
};
|
|
41984
42131
|
});
|
|
41985
42132
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -41987,6 +42134,11 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
41987
42134
|
final.value = result.value;
|
|
41988
42135
|
return final;
|
|
41989
42136
|
}
|
|
42137
|
+
const nonaborted = results.filter((r)=>!aborted(r));
|
|
42138
|
+
if (1 === nonaborted.length) {
|
|
42139
|
+
final.value = nonaborted[0].value;
|
|
42140
|
+
return nonaborted[0];
|
|
42141
|
+
}
|
|
41990
42142
|
final.issues.push({
|
|
41991
42143
|
code: "invalid_union",
|
|
41992
42144
|
input: final.value,
|
|
@@ -42008,7 +42160,10 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def)=>{
|
|
|
42008
42160
|
return new RegExp(`^(${patterns.map((p)=>cleanRegex(p.source)).join("|")})$`);
|
|
42009
42161
|
}
|
|
42010
42162
|
});
|
|
42163
|
+
const single = 1 === def.options.length;
|
|
42164
|
+
const first = def.options[0]._zod.run;
|
|
42011
42165
|
inst._zod.parse = (payload, ctx)=>{
|
|
42166
|
+
if (single) return first(payload, ctx);
|
|
42012
42167
|
let async = false;
|
|
42013
42168
|
const results = [];
|
|
42014
42169
|
for (const option of def.options){
|
|
@@ -42142,16 +42297,16 @@ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def)=>{
|
|
|
42142
42297
|
const tooSmall = input.length < optStart - 1;
|
|
42143
42298
|
if (tooBig || tooSmall) {
|
|
42144
42299
|
payload.issues.push({
|
|
42145
|
-
input,
|
|
42146
|
-
inst,
|
|
42147
|
-
origin: "array",
|
|
42148
42300
|
...tooBig ? {
|
|
42149
42301
|
code: "too_big",
|
|
42150
42302
|
maximum: items.length
|
|
42151
42303
|
} : {
|
|
42152
42304
|
code: "too_small",
|
|
42153
42305
|
minimum: items.length
|
|
42154
|
-
}
|
|
42306
|
+
},
|
|
42307
|
+
input,
|
|
42308
|
+
inst,
|
|
42309
|
+
origin: "array"
|
|
42155
42310
|
});
|
|
42156
42311
|
return payload;
|
|
42157
42312
|
}
|
|
@@ -42242,8 +42397,8 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def)=>{
|
|
|
42242
42397
|
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
42243
42398
|
if (keyResult.issues.length) {
|
|
42244
42399
|
payload.issues.push({
|
|
42245
|
-
origin: "record",
|
|
42246
42400
|
code: "invalid_key",
|
|
42401
|
+
origin: "record",
|
|
42247
42402
|
issues: keyResult.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())),
|
|
42248
42403
|
input: key,
|
|
42249
42404
|
path: [
|
|
@@ -42274,12 +42429,13 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def)=>{
|
|
|
42274
42429
|
});
|
|
42275
42430
|
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def)=>{
|
|
42276
42431
|
$ZodType.init(inst, def);
|
|
42277
|
-
const values =
|
|
42278
|
-
|
|
42432
|
+
const values = util_getEnumValues(def.entries);
|
|
42433
|
+
const valuesSet = new Set(values);
|
|
42434
|
+
inst._zod.values = valuesSet;
|
|
42279
42435
|
inst._zod.pattern = new RegExp(`^(${values.filter((k)=>propertyKeyTypes.has(typeof k)).map((o)=>"string" == typeof o ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
42280
42436
|
inst._zod.parse = (payload, _ctx)=>{
|
|
42281
42437
|
const input = payload.value;
|
|
42282
|
-
if (
|
|
42438
|
+
if (valuesSet.has(input)) return payload;
|
|
42283
42439
|
payload.issues.push({
|
|
42284
42440
|
code: "invalid_value",
|
|
42285
42441
|
values,
|
|
@@ -42291,8 +42447,9 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def)=>{
|
|
|
42291
42447
|
});
|
|
42292
42448
|
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def)=>{
|
|
42293
42449
|
$ZodType.init(inst, def);
|
|
42450
|
+
if (0 === def.values.length) throw new Error("Cannot create literal schema with no valid values");
|
|
42294
42451
|
inst._zod.values = new Set(def.values);
|
|
42295
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o)=>"string" == typeof o ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
|
|
42452
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o)=>"string" == typeof o ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
42296
42453
|
inst._zod.parse = (payload, _ctx)=>{
|
|
42297
42454
|
const input = payload.value;
|
|
42298
42455
|
if (inst._zod.values.has(input)) return payload;
|
|
@@ -42307,9 +42464,10 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def)=>{
|
|
|
42307
42464
|
});
|
|
42308
42465
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def)=>{
|
|
42309
42466
|
$ZodType.init(inst, def);
|
|
42310
|
-
inst._zod.parse = (payload,
|
|
42467
|
+
inst._zod.parse = (payload, ctx)=>{
|
|
42468
|
+
if ("backward" === ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
|
|
42311
42469
|
const _out = def.transform(payload.value, payload);
|
|
42312
|
-
if (
|
|
42470
|
+
if (ctx.async) {
|
|
42313
42471
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
42314
42472
|
return output.then((output)=>{
|
|
42315
42473
|
payload.value = output;
|
|
@@ -42321,6 +42479,13 @@ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def)=>{
|
|
|
42321
42479
|
return payload;
|
|
42322
42480
|
};
|
|
42323
42481
|
});
|
|
42482
|
+
function handleOptionalResult(result, input) {
|
|
42483
|
+
if (result.issues.length && void 0 === input) return {
|
|
42484
|
+
issues: [],
|
|
42485
|
+
value: void 0
|
|
42486
|
+
};
|
|
42487
|
+
return result;
|
|
42488
|
+
}
|
|
42324
42489
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def)=>{
|
|
42325
42490
|
$ZodType.init(inst, def);
|
|
42326
42491
|
inst._zod.optin = "optional";
|
|
@@ -42334,7 +42499,11 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def)=>{
|
|
|
42334
42499
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
42335
42500
|
});
|
|
42336
42501
|
inst._zod.parse = (payload, ctx)=>{
|
|
42337
|
-
if ("optional" === def.innerType._zod.optin)
|
|
42502
|
+
if ("optional" === def.innerType._zod.optin) {
|
|
42503
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
42504
|
+
if (result instanceof Promise) return result.then((r)=>handleOptionalResult(r, payload.value));
|
|
42505
|
+
return handleOptionalResult(result, payload.value);
|
|
42506
|
+
}
|
|
42338
42507
|
if (void 0 === payload.value) return payload;
|
|
42339
42508
|
return def.innerType._zod.run(payload, ctx);
|
|
42340
42509
|
};
|
|
@@ -42361,6 +42530,7 @@ const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def)=>{
|
|
|
42361
42530
|
inst._zod.optin = "optional";
|
|
42362
42531
|
defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
|
|
42363
42532
|
inst._zod.parse = (payload, ctx)=>{
|
|
42533
|
+
if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
|
|
42364
42534
|
if (void 0 === payload.value) {
|
|
42365
42535
|
payload.value = def.defaultValue;
|
|
42366
42536
|
return payload;
|
|
@@ -42379,6 +42549,7 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def)=>{
|
|
|
42379
42549
|
inst._zod.optin = "optional";
|
|
42380
42550
|
defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
|
|
42381
42551
|
inst._zod.parse = (payload, ctx)=>{
|
|
42552
|
+
if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
|
|
42382
42553
|
if (void 0 === payload.value) payload.value = def.defaultValue;
|
|
42383
42554
|
return def.innerType._zod.run(payload, ctx);
|
|
42384
42555
|
};
|
|
@@ -42408,10 +42579,11 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
42408
42579
|
}
|
|
42409
42580
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def)=>{
|
|
42410
42581
|
$ZodType.init(inst, def);
|
|
42411
|
-
inst._zod
|
|
42582
|
+
defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
|
|
42412
42583
|
defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
|
|
42413
42584
|
defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
|
|
42414
42585
|
inst._zod.parse = (payload, ctx)=>{
|
|
42586
|
+
if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
|
|
42415
42587
|
const result = def.innerType._zod.run(payload, ctx);
|
|
42416
42588
|
if (result instanceof Promise) return result.then((result)=>{
|
|
42417
42589
|
payload.value = result.value;
|
|
@@ -42446,15 +42618,24 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def)=>{
|
|
|
42446
42618
|
defineLazy(inst._zod, "values", ()=>def.in._zod.values);
|
|
42447
42619
|
defineLazy(inst._zod, "optin", ()=>def.in._zod.optin);
|
|
42448
42620
|
defineLazy(inst._zod, "optout", ()=>def.out._zod.optout);
|
|
42621
|
+
defineLazy(inst._zod, "propValues", ()=>def.in._zod.propValues);
|
|
42449
42622
|
inst._zod.parse = (payload, ctx)=>{
|
|
42623
|
+
if ("backward" === ctx.direction) {
|
|
42624
|
+
const right = def.out._zod.run(payload, ctx);
|
|
42625
|
+
if (right instanceof Promise) return right.then((right)=>handlePipeResult(right, def.in, ctx));
|
|
42626
|
+
return handlePipeResult(right, def.in, ctx);
|
|
42627
|
+
}
|
|
42450
42628
|
const left = def.in._zod.run(payload, ctx);
|
|
42451
|
-
if (left instanceof Promise) return left.then((left)=>handlePipeResult(left, def, ctx));
|
|
42452
|
-
return handlePipeResult(left, def, ctx);
|
|
42629
|
+
if (left instanceof Promise) return left.then((left)=>handlePipeResult(left, def.out, ctx));
|
|
42630
|
+
return handlePipeResult(left, def.out, ctx);
|
|
42453
42631
|
};
|
|
42454
42632
|
});
|
|
42455
|
-
function handlePipeResult(left,
|
|
42456
|
-
if (
|
|
42457
|
-
|
|
42633
|
+
function handlePipeResult(left, next, ctx) {
|
|
42634
|
+
if (left.issues.length) {
|
|
42635
|
+
left.aborted = true;
|
|
42636
|
+
return left;
|
|
42637
|
+
}
|
|
42638
|
+
return next._zod.run({
|
|
42458
42639
|
value: left.value,
|
|
42459
42640
|
issues: left.issues
|
|
42460
42641
|
}, ctx);
|
|
@@ -42466,6 +42647,7 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def)=>{
|
|
|
42466
42647
|
defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
|
|
42467
42648
|
defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
|
|
42468
42649
|
inst._zod.parse = (payload, ctx)=>{
|
|
42650
|
+
if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
|
|
42469
42651
|
const result = def.innerType._zod.run(payload, ctx);
|
|
42470
42652
|
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
42471
42653
|
return handleReadonlyResult(result);
|
|
@@ -42480,8 +42662,8 @@ const $ZodLazy = /*@__PURE__*/ $constructor("$ZodLazy", (inst, def)=>{
|
|
|
42480
42662
|
defineLazy(inst._zod, "innerType", ()=>def.getter());
|
|
42481
42663
|
defineLazy(inst._zod, "pattern", ()=>inst._zod.innerType._zod.pattern);
|
|
42482
42664
|
defineLazy(inst._zod, "propValues", ()=>inst._zod.innerType._zod.propValues);
|
|
42483
|
-
defineLazy(inst._zod, "optin", ()=>inst._zod.innerType._zod.optin);
|
|
42484
|
-
defineLazy(inst._zod, "optout", ()=>inst._zod.innerType._zod.optout);
|
|
42665
|
+
defineLazy(inst._zod, "optin", ()=>inst._zod.innerType._zod.optin ?? void 0);
|
|
42666
|
+
defineLazy(inst._zod, "optout", ()=>inst._zod.innerType._zod.optout ?? void 0);
|
|
42485
42667
|
inst._zod.parse = (payload, ctx)=>{
|
|
42486
42668
|
const inner = inst._zod.innerType;
|
|
42487
42669
|
return inner._zod.run(payload, ctx);
|
|
@@ -42513,11 +42695,125 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
42513
42695
|
payload.issues.push(util_issue(_iss));
|
|
42514
42696
|
}
|
|
42515
42697
|
}
|
|
42698
|
+
const en_parsedType = (data)=>{
|
|
42699
|
+
const t = typeof data;
|
|
42700
|
+
switch(t){
|
|
42701
|
+
case "number":
|
|
42702
|
+
return Number.isNaN(data) ? "NaN" : "number";
|
|
42703
|
+
case "object":
|
|
42704
|
+
if (Array.isArray(data)) return "array";
|
|
42705
|
+
if (null === data) return "null";
|
|
42706
|
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) return data.constructor.name;
|
|
42707
|
+
}
|
|
42708
|
+
return t;
|
|
42709
|
+
};
|
|
42710
|
+
const en_error = ()=>{
|
|
42711
|
+
const Sizable = {
|
|
42712
|
+
string: {
|
|
42713
|
+
unit: "characters",
|
|
42714
|
+
verb: "to have"
|
|
42715
|
+
},
|
|
42716
|
+
file: {
|
|
42717
|
+
unit: "bytes",
|
|
42718
|
+
verb: "to have"
|
|
42719
|
+
},
|
|
42720
|
+
array: {
|
|
42721
|
+
unit: "items",
|
|
42722
|
+
verb: "to have"
|
|
42723
|
+
},
|
|
42724
|
+
set: {
|
|
42725
|
+
unit: "items",
|
|
42726
|
+
verb: "to have"
|
|
42727
|
+
}
|
|
42728
|
+
};
|
|
42729
|
+
function getSizing(origin) {
|
|
42730
|
+
return Sizable[origin] ?? null;
|
|
42731
|
+
}
|
|
42732
|
+
const Nouns = {
|
|
42733
|
+
regex: "input",
|
|
42734
|
+
email: "email address",
|
|
42735
|
+
url: "URL",
|
|
42736
|
+
emoji: "emoji",
|
|
42737
|
+
uuid: "UUID",
|
|
42738
|
+
uuidv4: "UUIDv4",
|
|
42739
|
+
uuidv6: "UUIDv6",
|
|
42740
|
+
nanoid: "nanoid",
|
|
42741
|
+
guid: "GUID",
|
|
42742
|
+
cuid: "cuid",
|
|
42743
|
+
cuid2: "cuid2",
|
|
42744
|
+
ulid: "ULID",
|
|
42745
|
+
xid: "XID",
|
|
42746
|
+
ksuid: "KSUID",
|
|
42747
|
+
datetime: "ISO datetime",
|
|
42748
|
+
date: "ISO date",
|
|
42749
|
+
time: "ISO time",
|
|
42750
|
+
duration: "ISO duration",
|
|
42751
|
+
ipv4: "IPv4 address",
|
|
42752
|
+
ipv6: "IPv6 address",
|
|
42753
|
+
cidrv4: "IPv4 range",
|
|
42754
|
+
cidrv6: "IPv6 range",
|
|
42755
|
+
base64: "base64-encoded string",
|
|
42756
|
+
base64url: "base64url-encoded string",
|
|
42757
|
+
json_string: "JSON string",
|
|
42758
|
+
e164: "E.164 number",
|
|
42759
|
+
jwt: "JWT",
|
|
42760
|
+
template_literal: "input"
|
|
42761
|
+
};
|
|
42762
|
+
return (issue)=>{
|
|
42763
|
+
switch(issue.code){
|
|
42764
|
+
case "invalid_type":
|
|
42765
|
+
return `Invalid input: expected ${issue.expected}, received ${en_parsedType(issue.input)}`;
|
|
42766
|
+
case "invalid_value":
|
|
42767
|
+
if (1 === issue.values.length) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
42768
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
42769
|
+
case "too_big":
|
|
42770
|
+
{
|
|
42771
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
42772
|
+
const sizing = getSizing(issue.origin);
|
|
42773
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
42774
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
42775
|
+
}
|
|
42776
|
+
case "too_small":
|
|
42777
|
+
{
|
|
42778
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
42779
|
+
const sizing = getSizing(issue.origin);
|
|
42780
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
42781
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
42782
|
+
}
|
|
42783
|
+
case "invalid_format":
|
|
42784
|
+
{
|
|
42785
|
+
const _issue = issue;
|
|
42786
|
+
if ("starts_with" === _issue.format) return `Invalid string: must start with "${_issue.prefix}"`;
|
|
42787
|
+
if ("ends_with" === _issue.format) return `Invalid string: must end with "${_issue.suffix}"`;
|
|
42788
|
+
if ("includes" === _issue.format) return `Invalid string: must include "${_issue.includes}"`;
|
|
42789
|
+
if ("regex" === _issue.format) return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
42790
|
+
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
|
42791
|
+
}
|
|
42792
|
+
case "not_multiple_of":
|
|
42793
|
+
return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
42794
|
+
case "unrecognized_keys":
|
|
42795
|
+
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
42796
|
+
case "invalid_key":
|
|
42797
|
+
return `Invalid key in ${issue.origin}`;
|
|
42798
|
+
case "invalid_union":
|
|
42799
|
+
return "Invalid input";
|
|
42800
|
+
case "invalid_element":
|
|
42801
|
+
return `Invalid value in ${issue.origin}`;
|
|
42802
|
+
default:
|
|
42803
|
+
return "Invalid input";
|
|
42804
|
+
}
|
|
42805
|
+
};
|
|
42806
|
+
};
|
|
42807
|
+
function en() {
|
|
42808
|
+
return {
|
|
42809
|
+
localeError: en_error()
|
|
42810
|
+
};
|
|
42811
|
+
}
|
|
42516
42812
|
Symbol("ZodOutput");
|
|
42517
42813
|
Symbol("ZodInput");
|
|
42518
|
-
class $ZodRegistry {
|
|
42814
|
+
class registries_$ZodRegistry {
|
|
42519
42815
|
constructor(){
|
|
42520
|
-
this._map = new
|
|
42816
|
+
this._map = new WeakMap();
|
|
42521
42817
|
this._idmap = new Map();
|
|
42522
42818
|
}
|
|
42523
42819
|
add(schema, ..._meta) {
|
|
@@ -42530,7 +42826,7 @@ class $ZodRegistry {
|
|
|
42530
42826
|
return this;
|
|
42531
42827
|
}
|
|
42532
42828
|
clear() {
|
|
42533
|
-
this._map = new
|
|
42829
|
+
this._map = new WeakMap();
|
|
42534
42830
|
this._idmap = new Map();
|
|
42535
42831
|
return this;
|
|
42536
42832
|
}
|
|
@@ -42547,10 +42843,11 @@ class $ZodRegistry {
|
|
|
42547
42843
|
...this.get(p) ?? {}
|
|
42548
42844
|
};
|
|
42549
42845
|
delete pm.id;
|
|
42550
|
-
|
|
42846
|
+
const f = {
|
|
42551
42847
|
...pm,
|
|
42552
42848
|
...this._map.get(schema)
|
|
42553
42849
|
};
|
|
42850
|
+
return Object.keys(f).length ? f : void 0;
|
|
42554
42851
|
}
|
|
42555
42852
|
return this._map.get(schema);
|
|
42556
42853
|
}
|
|
@@ -42559,9 +42856,9 @@ class $ZodRegistry {
|
|
|
42559
42856
|
}
|
|
42560
42857
|
}
|
|
42561
42858
|
function registry() {
|
|
42562
|
-
return new $ZodRegistry();
|
|
42859
|
+
return new registries_$ZodRegistry();
|
|
42563
42860
|
}
|
|
42564
|
-
const
|
|
42861
|
+
const registries_globalRegistry = /*@__PURE__*/ registry();
|
|
42565
42862
|
function _string(Class, params) {
|
|
42566
42863
|
return new Class({
|
|
42567
42864
|
type: "string",
|
|
@@ -43007,6 +43304,32 @@ function _refine(Class, fn, _params) {
|
|
|
43007
43304
|
});
|
|
43008
43305
|
return schema;
|
|
43009
43306
|
}
|
|
43307
|
+
function _superRefine(fn) {
|
|
43308
|
+
const ch = _check((payload)=>{
|
|
43309
|
+
payload.addIssue = (issue)=>{
|
|
43310
|
+
if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
|
|
43311
|
+
else {
|
|
43312
|
+
const _issue = issue;
|
|
43313
|
+
if (_issue.fatal) _issue.continue = false;
|
|
43314
|
+
_issue.code ?? (_issue.code = "custom");
|
|
43315
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
43316
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
43317
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
43318
|
+
payload.issues.push(util_issue(_issue));
|
|
43319
|
+
}
|
|
43320
|
+
};
|
|
43321
|
+
return fn(payload.value, payload);
|
|
43322
|
+
});
|
|
43323
|
+
return ch;
|
|
43324
|
+
}
|
|
43325
|
+
function _check(fn, params) {
|
|
43326
|
+
const ch = new $ZodCheck({
|
|
43327
|
+
check: "custom",
|
|
43328
|
+
...normalizeParams(params)
|
|
43329
|
+
});
|
|
43330
|
+
ch._zod.check = fn;
|
|
43331
|
+
return ch;
|
|
43332
|
+
}
|
|
43010
43333
|
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def)=>{
|
|
43011
43334
|
$ZodISODateTime.init(inst, def);
|
|
43012
43335
|
ZodStringFormat.init(inst, def);
|
|
@@ -43046,10 +43369,16 @@ const classic_errors_initializer = (inst, issues)=>{
|
|
|
43046
43369
|
value: (mapper)=>flattenError(inst, mapper)
|
|
43047
43370
|
},
|
|
43048
43371
|
addIssue: {
|
|
43049
|
-
value: (issue)=>
|
|
43372
|
+
value: (issue)=>{
|
|
43373
|
+
inst.issues.push(issue);
|
|
43374
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
43375
|
+
}
|
|
43050
43376
|
},
|
|
43051
43377
|
addIssues: {
|
|
43052
|
-
value: (issues)=>
|
|
43378
|
+
value: (issues)=>{
|
|
43379
|
+
inst.issues.push(...issues);
|
|
43380
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
43381
|
+
}
|
|
43053
43382
|
},
|
|
43054
43383
|
isEmpty: {
|
|
43055
43384
|
get () {
|
|
@@ -43062,18 +43391,26 @@ $constructor("ZodError", classic_errors_initializer);
|
|
|
43062
43391
|
const ZodRealError = $constructor("ZodError", classic_errors_initializer, {
|
|
43063
43392
|
Parent: Error
|
|
43064
43393
|
});
|
|
43065
|
-
const
|
|
43066
|
-
const
|
|
43394
|
+
const classic_parse_parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
43395
|
+
const classic_parse_parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
43067
43396
|
const parse_safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
43068
43397
|
const parse_safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
43398
|
+
const parse_encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
43399
|
+
const parse_decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
43400
|
+
const parse_encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
43401
|
+
const parse_decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
43402
|
+
const parse_safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
43403
|
+
const parse_safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
43404
|
+
const parse_safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
43405
|
+
const parse_safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
43069
43406
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
|
|
43070
43407
|
$ZodType.init(inst, def);
|
|
43071
43408
|
inst.def = def;
|
|
43409
|
+
inst.type = def.type;
|
|
43072
43410
|
Object.defineProperty(inst, "_def", {
|
|
43073
43411
|
value: def
|
|
43074
43412
|
});
|
|
43075
|
-
inst.check = (...checks)=>inst.clone({
|
|
43076
|
-
...def,
|
|
43413
|
+
inst.check = (...checks)=>inst.clone(mergeDefs(def, {
|
|
43077
43414
|
checks: [
|
|
43078
43415
|
...def.checks ?? [],
|
|
43079
43416
|
...checks.map((ch)=>"function" == typeof ch ? {
|
|
@@ -43086,22 +43423,30 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
|
|
|
43086
43423
|
}
|
|
43087
43424
|
} : ch)
|
|
43088
43425
|
]
|
|
43089
|
-
});
|
|
43426
|
+
}));
|
|
43090
43427
|
inst.clone = (def, params)=>clone(inst, def, params);
|
|
43091
43428
|
inst.brand = ()=>inst;
|
|
43092
43429
|
inst.register = (reg, meta)=>{
|
|
43093
43430
|
reg.add(inst, meta);
|
|
43094
43431
|
return inst;
|
|
43095
43432
|
};
|
|
43096
|
-
inst.parse = (data, params)=>
|
|
43433
|
+
inst.parse = (data, params)=>classic_parse_parse(inst, data, params, {
|
|
43097
43434
|
callee: inst.parse
|
|
43098
43435
|
});
|
|
43099
43436
|
inst.safeParse = (data, params)=>parse_safeParse(inst, data, params);
|
|
43100
|
-
inst.parseAsync = async (data, params)=>
|
|
43437
|
+
inst.parseAsync = async (data, params)=>classic_parse_parseAsync(inst, data, params, {
|
|
43101
43438
|
callee: inst.parseAsync
|
|
43102
43439
|
});
|
|
43103
43440
|
inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params);
|
|
43104
43441
|
inst.spa = inst.safeParseAsync;
|
|
43442
|
+
inst.encode = (data, params)=>parse_encode(inst, data, params);
|
|
43443
|
+
inst.decode = (data, params)=>parse_decode(inst, data, params);
|
|
43444
|
+
inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params);
|
|
43445
|
+
inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params);
|
|
43446
|
+
inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params);
|
|
43447
|
+
inst.safeDecode = (data, params)=>parse_safeDecode(inst, data, params);
|
|
43448
|
+
inst.safeEncodeAsync = async (data, params)=>parse_safeEncodeAsync(inst, data, params);
|
|
43449
|
+
inst.safeDecodeAsync = async (data, params)=>parse_safeDecodeAsync(inst, data, params);
|
|
43105
43450
|
inst.refine = (check, params)=>inst.check(refine(check, params));
|
|
43106
43451
|
inst.superRefine = (refinement)=>inst.check(superRefine(refinement));
|
|
43107
43452
|
inst.overwrite = (fn)=>inst.check(_overwrite(fn));
|
|
@@ -43123,21 +43468,21 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
|
|
|
43123
43468
|
inst.readonly = ()=>readonly(inst);
|
|
43124
43469
|
inst.describe = (description)=>{
|
|
43125
43470
|
const cl = inst.clone();
|
|
43126
|
-
|
|
43471
|
+
registries_globalRegistry.add(cl, {
|
|
43127
43472
|
description
|
|
43128
43473
|
});
|
|
43129
43474
|
return cl;
|
|
43130
43475
|
};
|
|
43131
43476
|
Object.defineProperty(inst, "description", {
|
|
43132
43477
|
get () {
|
|
43133
|
-
return
|
|
43478
|
+
return registries_globalRegistry.get(inst)?.description;
|
|
43134
43479
|
},
|
|
43135
43480
|
configurable: true
|
|
43136
43481
|
});
|
|
43137
43482
|
inst.meta = (...args)=>{
|
|
43138
|
-
if (0 === args.length) return
|
|
43483
|
+
if (0 === args.length) return registries_globalRegistry.get(inst);
|
|
43139
43484
|
const cl = inst.clone();
|
|
43140
|
-
|
|
43485
|
+
registries_globalRegistry.add(cl, args[0]);
|
|
43141
43486
|
return cl;
|
|
43142
43487
|
};
|
|
43143
43488
|
inst.isOptional = ()=>inst.safeParse(void 0).success;
|
|
@@ -43371,7 +43716,7 @@ function schemas_array(element, params) {
|
|
|
43371
43716
|
return _array(ZodArray, element, params);
|
|
43372
43717
|
}
|
|
43373
43718
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
|
|
43374
|
-
$
|
|
43719
|
+
$ZodObjectJIT.init(inst, def);
|
|
43375
43720
|
ZodType.init(inst, def);
|
|
43376
43721
|
defineLazy(inst, "shape", ()=>def.shape);
|
|
43377
43722
|
inst.keyof = ()=>schemas_enum(Object.keys(inst._zod.def.shape));
|
|
@@ -43396,6 +43741,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
|
|
|
43396
43741
|
catchall: void 0
|
|
43397
43742
|
});
|
|
43398
43743
|
inst.extend = (incoming)=>extend(inst, incoming);
|
|
43744
|
+
inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
|
|
43399
43745
|
inst.merge = (other)=>merge(inst, other);
|
|
43400
43746
|
inst.pick = (mask)=>pick(inst, mask);
|
|
43401
43747
|
inst.omit = (mask)=>omit(inst, mask);
|
|
@@ -43405,12 +43751,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
|
|
|
43405
43751
|
function schemas_object(shape, params) {
|
|
43406
43752
|
const def = {
|
|
43407
43753
|
type: "object",
|
|
43408
|
-
|
|
43409
|
-
assignProp(this, "shape", {
|
|
43410
|
-
...shape
|
|
43411
|
-
});
|
|
43412
|
-
return this.shape;
|
|
43413
|
-
},
|
|
43754
|
+
shape: shape ?? {},
|
|
43414
43755
|
...normalizeParams(params)
|
|
43415
43756
|
};
|
|
43416
43757
|
return new ZodObject(def);
|
|
@@ -43418,12 +43759,7 @@ function schemas_object(shape, params) {
|
|
|
43418
43759
|
function strictObject(shape, params) {
|
|
43419
43760
|
return new ZodObject({
|
|
43420
43761
|
type: "object",
|
|
43421
|
-
|
|
43422
|
-
assignProp(this, "shape", {
|
|
43423
|
-
...shape
|
|
43424
|
-
});
|
|
43425
|
-
return this.shape;
|
|
43426
|
-
},
|
|
43762
|
+
shape,
|
|
43427
43763
|
catchall: never(),
|
|
43428
43764
|
...normalizeParams(params)
|
|
43429
43765
|
});
|
|
@@ -43550,6 +43886,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def)=>{
|
|
|
43550
43886
|
$ZodTransform.init(inst, def);
|
|
43551
43887
|
ZodType.init(inst, def);
|
|
43552
43888
|
inst._zod.parse = (payload, _ctx)=>{
|
|
43889
|
+
if ("backward" === _ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
|
|
43553
43890
|
payload.addIssue = (issue)=>{
|
|
43554
43891
|
if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, def));
|
|
43555
43892
|
else {
|
|
@@ -43558,7 +43895,6 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def)=>{
|
|
|
43558
43895
|
_issue.code ?? (_issue.code = "custom");
|
|
43559
43896
|
_issue.input ?? (_issue.input = payload.value);
|
|
43560
43897
|
_issue.inst ?? (_issue.inst = inst);
|
|
43561
|
-
_issue.continue ?? (_issue.continue = true);
|
|
43562
43898
|
payload.issues.push(util_issue(_issue));
|
|
43563
43899
|
}
|
|
43564
43900
|
};
|
|
@@ -43610,7 +43946,7 @@ function schemas_default(innerType, defaultValue) {
|
|
|
43610
43946
|
type: "default",
|
|
43611
43947
|
innerType: innerType,
|
|
43612
43948
|
get defaultValue () {
|
|
43613
|
-
return "function" == typeof defaultValue ? defaultValue() : defaultValue;
|
|
43949
|
+
return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
|
|
43614
43950
|
}
|
|
43615
43951
|
});
|
|
43616
43952
|
}
|
|
@@ -43624,7 +43960,7 @@ function prefault(innerType, defaultValue) {
|
|
|
43624
43960
|
type: "prefault",
|
|
43625
43961
|
innerType: innerType,
|
|
43626
43962
|
get defaultValue () {
|
|
43627
|
-
return "function" == typeof defaultValue ? defaultValue() : defaultValue;
|
|
43963
|
+
return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
|
|
43628
43964
|
}
|
|
43629
43965
|
});
|
|
43630
43966
|
}
|
|
@@ -43669,6 +44005,7 @@ function pipe(in_, out) {
|
|
|
43669
44005
|
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def)=>{
|
|
43670
44006
|
$ZodReadonly.init(inst, def);
|
|
43671
44007
|
ZodType.init(inst, def);
|
|
44008
|
+
inst.unwrap = ()=>inst._zod.def.innerType;
|
|
43672
44009
|
});
|
|
43673
44010
|
function readonly(innerType) {
|
|
43674
44011
|
return new ZodReadonly({
|
|
@@ -43691,13 +44028,6 @@ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def)=>{
|
|
|
43691
44028
|
$ZodCustom.init(inst, def);
|
|
43692
44029
|
ZodType.init(inst, def);
|
|
43693
44030
|
});
|
|
43694
|
-
function schemas_check(fn) {
|
|
43695
|
-
const ch = new $ZodCheck({
|
|
43696
|
-
check: "custom"
|
|
43697
|
-
});
|
|
43698
|
-
ch._zod.check = fn;
|
|
43699
|
-
return ch;
|
|
43700
|
-
}
|
|
43701
44031
|
function custom(fn, _params) {
|
|
43702
44032
|
return _custom(ZodCustom, fn ?? (()=>true), _params);
|
|
43703
44033
|
}
|
|
@@ -43705,22 +44035,7 @@ function refine(fn, _params = {}) {
|
|
|
43705
44035
|
return _refine(ZodCustom, fn, _params);
|
|
43706
44036
|
}
|
|
43707
44037
|
function superRefine(fn) {
|
|
43708
|
-
|
|
43709
|
-
payload.addIssue = (issue)=>{
|
|
43710
|
-
if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
|
|
43711
|
-
else {
|
|
43712
|
-
const _issue = issue;
|
|
43713
|
-
if (_issue.fatal) _issue.continue = false;
|
|
43714
|
-
_issue.code ?? (_issue.code = "custom");
|
|
43715
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
43716
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
43717
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
43718
|
-
payload.issues.push(util_issue(_issue));
|
|
43719
|
-
}
|
|
43720
|
-
};
|
|
43721
|
-
return fn(payload.value, payload);
|
|
43722
|
-
});
|
|
43723
|
-
return ch;
|
|
44038
|
+
return _superRefine(fn);
|
|
43724
44039
|
}
|
|
43725
44040
|
function _instanceof(cls, params = {
|
|
43726
44041
|
error: `Input not instance of ${cls.name}`
|
|
@@ -43735,6 +44050,9 @@ function _instanceof(cls, params = {
|
|
|
43735
44050
|
inst._zod.bag.Class = cls;
|
|
43736
44051
|
return inst;
|
|
43737
44052
|
}
|
|
44053
|
+
var compat_ZodFirstPartyTypeKind;
|
|
44054
|
+
compat_ZodFirstPartyTypeKind || (compat_ZodFirstPartyTypeKind = {});
|
|
44055
|
+
core_config(en());
|
|
43738
44056
|
const numberOrInfinity = schemas_number().or(literal(1 / 0));
|
|
43739
44057
|
const intOrInfinity = schemas_int().or(literal(1 / 0));
|
|
43740
44058
|
const anyFunction = custom((data)=>"function" == typeof data, {
|
|
@@ -43921,63 +44239,12 @@ function getIssuesFromErrorOptions(options) {
|
|
|
43921
44239
|
}
|
|
43922
44240
|
return [];
|
|
43923
44241
|
}
|
|
43924
|
-
function
|
|
43925
|
-
return
|
|
43926
|
-
|
|
43927
|
-
|
|
43928
|
-
|
|
43929
|
-
|
|
43930
|
-
return stringifySymbol(value);
|
|
43931
|
-
case "bigint":
|
|
43932
|
-
case "number":
|
|
43933
|
-
switch(options.localization){
|
|
43934
|
-
case true:
|
|
43935
|
-
return value.toLocaleString();
|
|
43936
|
-
case false:
|
|
43937
|
-
return value.toString();
|
|
43938
|
-
default:
|
|
43939
|
-
return value.toLocaleString(options.localization);
|
|
43940
|
-
}
|
|
43941
|
-
case "string":
|
|
43942
|
-
if (options.wrapStringValueInQuote) return `"${value}"`;
|
|
43943
|
-
return value;
|
|
43944
|
-
default:
|
|
43945
|
-
if (value instanceof Date) switch(options.localization){
|
|
43946
|
-
case true:
|
|
43947
|
-
return value.toLocaleString();
|
|
43948
|
-
case false:
|
|
43949
|
-
return value.toISOString();
|
|
43950
|
-
default:
|
|
43951
|
-
return value.toLocaleString(options.localization);
|
|
43952
|
-
}
|
|
43953
|
-
return String(value);
|
|
43954
|
-
}
|
|
43955
|
-
}
|
|
43956
|
-
var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
|
|
43957
|
-
function joinPath(path) {
|
|
43958
|
-
if (1 === path.length) {
|
|
43959
|
-
let propertyKey = path[0];
|
|
43960
|
-
if ("symbol" == typeof propertyKey) propertyKey = stringifySymbol(propertyKey);
|
|
43961
|
-
return propertyKey.toString() || '""';
|
|
43962
|
-
}
|
|
43963
|
-
return path.reduce((acc, propertyKey)=>{
|
|
43964
|
-
if ("number" == typeof propertyKey) return acc + "[" + propertyKey.toString() + "]";
|
|
43965
|
-
if ("symbol" == typeof propertyKey) propertyKey = stringifySymbol(propertyKey);
|
|
43966
|
-
if (propertyKey.includes('"')) return acc + '["' + escapeQuotes(propertyKey) + '"]';
|
|
43967
|
-
if (!identifierRegex.test(propertyKey)) return acc + '["' + propertyKey + '"]';
|
|
43968
|
-
const separator = 0 === acc.length ? "" : ".";
|
|
43969
|
-
return acc + separator + propertyKey;
|
|
43970
|
-
}, "");
|
|
43971
|
-
}
|
|
43972
|
-
function escapeQuotes(str) {
|
|
43973
|
-
return str.replace(/"/g, '\\"');
|
|
43974
|
-
}
|
|
43975
|
-
function isNonEmptyArray(value) {
|
|
43976
|
-
return 0 !== value.length;
|
|
43977
|
-
}
|
|
43978
|
-
function titleCase(value) {
|
|
43979
|
-
if (0 === value.length) return value;
|
|
43980
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
44242
|
+
function parseCustomIssue(issue) {
|
|
44243
|
+
return {
|
|
44244
|
+
type: issue.code,
|
|
44245
|
+
path: issue.path,
|
|
44246
|
+
message: issue.message ?? "Invalid input"
|
|
44247
|
+
};
|
|
43981
44248
|
}
|
|
43982
44249
|
function parseInvalidElementIssue(issue) {
|
|
43983
44250
|
return {
|
|
@@ -43986,6 +44253,13 @@ function parseInvalidElementIssue(issue) {
|
|
|
43986
44253
|
message: `unexpected element in ${issue.origin}`
|
|
43987
44254
|
};
|
|
43988
44255
|
}
|
|
44256
|
+
function parseInvalidKeyIssue(issue) {
|
|
44257
|
+
return {
|
|
44258
|
+
type: issue.code,
|
|
44259
|
+
path: issue.path,
|
|
44260
|
+
message: `unexpected key in ${issue.origin}`
|
|
44261
|
+
};
|
|
44262
|
+
}
|
|
43989
44263
|
function parseInvalidStringFormatIssue(issue, options = {
|
|
43990
44264
|
displayInvalidFormatDetails: false
|
|
43991
44265
|
}) {
|
|
@@ -44068,14 +44342,14 @@ function parseStringInvalidJWT(issue, options = {
|
|
|
44068
44342
|
}
|
|
44069
44343
|
function parseInvalidTypeIssue(issue) {
|
|
44070
44344
|
let message = `expected ${issue.expected}`;
|
|
44071
|
-
if ("input" in issue) message += `, received ${
|
|
44345
|
+
if ("input" in issue) message += `, received ${v4_getTypeName(issue.input)}`;
|
|
44072
44346
|
return {
|
|
44073
44347
|
type: issue.code,
|
|
44074
44348
|
path: issue.path,
|
|
44075
44349
|
message
|
|
44076
44350
|
};
|
|
44077
44351
|
}
|
|
44078
|
-
function
|
|
44352
|
+
function v4_getTypeName(value) {
|
|
44079
44353
|
if ("object" == typeof value) {
|
|
44080
44354
|
if (null === value) return "null";
|
|
44081
44355
|
if (void 0 === value) return "undefined";
|
|
@@ -44090,6 +44364,45 @@ function getTypeName(value) {
|
|
|
44090
44364
|
}
|
|
44091
44365
|
return typeof value;
|
|
44092
44366
|
}
|
|
44367
|
+
function parseInvalidUnionIssue(issue) {
|
|
44368
|
+
return {
|
|
44369
|
+
type: issue.code,
|
|
44370
|
+
path: issue.path,
|
|
44371
|
+
message: issue.message ?? "Invalid input"
|
|
44372
|
+
};
|
|
44373
|
+
}
|
|
44374
|
+
function stringifySymbol(symbol) {
|
|
44375
|
+
return symbol.description ?? "";
|
|
44376
|
+
}
|
|
44377
|
+
function stringify(value, options = {}) {
|
|
44378
|
+
switch(typeof value){
|
|
44379
|
+
case "symbol":
|
|
44380
|
+
return stringifySymbol(value);
|
|
44381
|
+
case "bigint":
|
|
44382
|
+
case "number":
|
|
44383
|
+
switch(options.localization){
|
|
44384
|
+
case true:
|
|
44385
|
+
return value.toLocaleString();
|
|
44386
|
+
case false:
|
|
44387
|
+
return value.toString();
|
|
44388
|
+
default:
|
|
44389
|
+
return value.toLocaleString(options.localization);
|
|
44390
|
+
}
|
|
44391
|
+
case "string":
|
|
44392
|
+
if (options.wrapStringValueInQuote) return `"${value}"`;
|
|
44393
|
+
return value;
|
|
44394
|
+
default:
|
|
44395
|
+
if (value instanceof Date) switch(options.localization){
|
|
44396
|
+
case true:
|
|
44397
|
+
return value.toLocaleString();
|
|
44398
|
+
case false:
|
|
44399
|
+
return value.toISOString();
|
|
44400
|
+
default:
|
|
44401
|
+
return value.toLocaleString(options.localization);
|
|
44402
|
+
}
|
|
44403
|
+
return String(value);
|
|
44404
|
+
}
|
|
44405
|
+
}
|
|
44093
44406
|
function v4_joinValues(values, options) {
|
|
44094
44407
|
const valuesToDisplay = (options.maxValuesToDisplay ? values.slice(0, options.maxValuesToDisplay) : values).map((value)=>stringify(value, {
|
|
44095
44408
|
wrapStringValueInQuote: options.wrapStringValuesInQuote
|
|
@@ -44145,7 +44458,7 @@ function parseTooBigIssue(issue, options) {
|
|
|
44145
44458
|
return {
|
|
44146
44459
|
type: issue.code,
|
|
44147
44460
|
path: issue.path,
|
|
44148
|
-
message: `number must be less ${issue.inclusive ? "or equal to" : "
|
|
44461
|
+
message: `number must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
|
|
44149
44462
|
};
|
|
44150
44463
|
case "string":
|
|
44151
44464
|
return {
|
|
@@ -44181,7 +44494,7 @@ function parseTooBigIssue(issue, options) {
|
|
|
44181
44494
|
return {
|
|
44182
44495
|
type: issue.code,
|
|
44183
44496
|
path: issue.path,
|
|
44184
|
-
message: `value must be less ${issue.inclusive ? "or equal to" : "
|
|
44497
|
+
message: `value must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
|
|
44185
44498
|
};
|
|
44186
44499
|
}
|
|
44187
44500
|
}
|
|
@@ -44198,7 +44511,7 @@ function parseTooSmallIssue(issue, options) {
|
|
|
44198
44511
|
return {
|
|
44199
44512
|
type: issue.code,
|
|
44200
44513
|
path: issue.path,
|
|
44201
|
-
message: `number must be greater ${issue.inclusive ? "or equal to" : "
|
|
44514
|
+
message: `number must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
|
|
44202
44515
|
};
|
|
44203
44516
|
case "date":
|
|
44204
44517
|
return {
|
|
@@ -44234,7 +44547,7 @@ function parseTooSmallIssue(issue, options) {
|
|
|
44234
44547
|
return {
|
|
44235
44548
|
type: issue.code,
|
|
44236
44549
|
path: issue.path,
|
|
44237
|
-
message: `value must be greater ${issue.inclusive ? "or equal to" : "
|
|
44550
|
+
message: `value must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
|
|
44238
44551
|
};
|
|
44239
44552
|
}
|
|
44240
44553
|
}
|
|
@@ -44251,20 +44564,6 @@ function parseUnrecognizedKeysIssue(issue, options) {
|
|
|
44251
44564
|
message: `unrecognized key(s) ${keysStr} in object`
|
|
44252
44565
|
};
|
|
44253
44566
|
}
|
|
44254
|
-
function parseInvalidKeyIssue(issue) {
|
|
44255
|
-
return {
|
|
44256
|
-
type: issue.code,
|
|
44257
|
-
path: issue.path,
|
|
44258
|
-
message: `unexpected key in ${issue.origin}`
|
|
44259
|
-
};
|
|
44260
|
-
}
|
|
44261
|
-
function parseCustomIssue(issue) {
|
|
44262
|
-
return {
|
|
44263
|
-
type: issue.code,
|
|
44264
|
-
path: issue.path,
|
|
44265
|
-
message: issue.message
|
|
44266
|
-
};
|
|
44267
|
-
}
|
|
44268
44567
|
var issueParsers = {
|
|
44269
44568
|
invalid_type: parseInvalidTypeIssue,
|
|
44270
44569
|
too_big: parseTooBigIssue,
|
|
@@ -44278,23 +44577,7 @@ var issueParsers = {
|
|
|
44278
44577
|
custom: parseCustomIssue,
|
|
44279
44578
|
invalid_union: parseInvalidUnionIssue
|
|
44280
44579
|
};
|
|
44281
|
-
function parseInvalidUnionIssue(issue, options) {
|
|
44282
|
-
const errorMap = createErrorMap(options);
|
|
44283
|
-
const individualMessages = issue.errors.map((issues)=>issues.map((subIssue)=>errorMap({
|
|
44284
|
-
...subIssue,
|
|
44285
|
-
path: issue.path.concat(subIssue.path)
|
|
44286
|
-
})).join(options.issueSeparator));
|
|
44287
|
-
const message = Array.from(new Set(individualMessages)).join(options.unionSeparator);
|
|
44288
|
-
return {
|
|
44289
|
-
type: issue.code,
|
|
44290
|
-
path: [],
|
|
44291
|
-
message
|
|
44292
|
-
};
|
|
44293
|
-
}
|
|
44294
44580
|
var defaultErrorMapOptions = {
|
|
44295
|
-
includePath: true,
|
|
44296
|
-
unionSeparator: " or ",
|
|
44297
|
-
issueSeparator: "; ",
|
|
44298
44581
|
displayInvalidFormatDetails: false,
|
|
44299
44582
|
allowedValuesSeparator: ", ",
|
|
44300
44583
|
allowedValuesLastSeparator: " or ",
|
|
@@ -44304,7 +44587,6 @@ var defaultErrorMapOptions = {
|
|
|
44304
44587
|
unrecognizedKeysLastSeparator: " and ",
|
|
44305
44588
|
wrapUnrecognizedKeysInQuote: true,
|
|
44306
44589
|
maxUnrecognizedKeysToDisplay: 5,
|
|
44307
|
-
issuesInTitleCase: true,
|
|
44308
44590
|
dateLocalization: true,
|
|
44309
44591
|
numberLocalization: true
|
|
44310
44592
|
};
|
|
@@ -44317,45 +44599,78 @@ function createErrorMap(partialOptions = {}) {
|
|
|
44317
44599
|
if (void 0 === issue.code) return "Not supported issue type";
|
|
44318
44600
|
const parseFunc = issueParsers[issue.code];
|
|
44319
44601
|
const ast = parseFunc(issue, options);
|
|
44320
|
-
return
|
|
44602
|
+
return ast.message;
|
|
44321
44603
|
};
|
|
44322
44604
|
return errorMap;
|
|
44323
44605
|
}
|
|
44324
|
-
function
|
|
44325
|
-
|
|
44326
|
-
|
|
44327
|
-
|
|
44328
|
-
|
|
44329
|
-
|
|
44330
|
-
|
|
44331
|
-
|
|
44332
|
-
|
|
44333
|
-
break pathCondition;
|
|
44334
|
-
}
|
|
44335
|
-
}
|
|
44336
|
-
buf.push(` at "${joinPath(ast.path)}"`);
|
|
44606
|
+
function isNonEmptyArray(value) {
|
|
44607
|
+
return 0 !== value.length;
|
|
44608
|
+
}
|
|
44609
|
+
var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
|
|
44610
|
+
function joinPath(path) {
|
|
44611
|
+
if (1 === path.length) {
|
|
44612
|
+
let propertyKey = path[0];
|
|
44613
|
+
if ("symbol" == typeof propertyKey) propertyKey = stringifySymbol(propertyKey);
|
|
44614
|
+
return propertyKey.toString() || '""';
|
|
44337
44615
|
}
|
|
44338
|
-
return
|
|
44616
|
+
return path.reduce((acc, propertyKey)=>{
|
|
44617
|
+
if ("number" == typeof propertyKey) return acc + "[" + propertyKey.toString() + "]";
|
|
44618
|
+
if ("symbol" == typeof propertyKey) propertyKey = stringifySymbol(propertyKey);
|
|
44619
|
+
if (propertyKey.includes('"')) return acc + '["' + escapeQuotes(propertyKey) + '"]';
|
|
44620
|
+
if (!identifierRegex.test(propertyKey)) return acc + '["' + propertyKey + '"]';
|
|
44621
|
+
const separator = 0 === acc.length ? "" : ".";
|
|
44622
|
+
return acc + separator + propertyKey;
|
|
44623
|
+
}, "");
|
|
44624
|
+
}
|
|
44625
|
+
function escapeQuotes(str) {
|
|
44626
|
+
return str.replace(/"/g, '\\"');
|
|
44627
|
+
}
|
|
44628
|
+
function titleCase(value) {
|
|
44629
|
+
if (0 === value.length) return value;
|
|
44630
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
44339
44631
|
}
|
|
44340
|
-
var identityErrorMap = (issue)=>issue.message;
|
|
44341
44632
|
var defaultMessageBuilderOptions = {
|
|
44342
44633
|
prefix: "Validation error",
|
|
44343
44634
|
prefixSeparator: ": ",
|
|
44344
44635
|
maxIssuesInMessage: 99,
|
|
44345
|
-
|
|
44346
|
-
|
|
44636
|
+
unionSeparator: " or ",
|
|
44637
|
+
issueSeparator: "; ",
|
|
44638
|
+
includePath: true,
|
|
44639
|
+
forceTitleCase: true
|
|
44347
44640
|
};
|
|
44348
44641
|
function createMessageBuilder(partialOptions = {}) {
|
|
44349
44642
|
const options = {
|
|
44350
44643
|
...defaultMessageBuilderOptions,
|
|
44351
44644
|
...partialOptions
|
|
44352
44645
|
};
|
|
44353
|
-
const errorMap = options.error;
|
|
44354
44646
|
return function(issues) {
|
|
44355
|
-
const message = issues.slice(0, options.maxIssuesInMessage).map(
|
|
44647
|
+
const message = issues.slice(0, options.maxIssuesInMessage).map((issue)=>mapIssue(issue, options)).join(options.issueSeparator);
|
|
44356
44648
|
return conditionallyPrefixMessage(message, options);
|
|
44357
44649
|
};
|
|
44358
44650
|
}
|
|
44651
|
+
function mapIssue(issue, options) {
|
|
44652
|
+
if ("invalid_union" === issue.code && isNonEmptyArray(issue.errors)) {
|
|
44653
|
+
const individualMessages = issue.errors.map((issues)=>issues.map((subIssue)=>mapIssue({
|
|
44654
|
+
...subIssue,
|
|
44655
|
+
path: issue.path.concat(subIssue.path)
|
|
44656
|
+
}, options)).join(options.issueSeparator));
|
|
44657
|
+
return Array.from(new Set(individualMessages)).join(options.unionSeparator);
|
|
44658
|
+
}
|
|
44659
|
+
const buf = [];
|
|
44660
|
+
if (options.forceTitleCase) buf.push(titleCase(issue.message));
|
|
44661
|
+
else buf.push(issue.message);
|
|
44662
|
+
pathCondition: if (options.includePath && void 0 !== issue.path && isNonEmptyArray(issue.path)) {
|
|
44663
|
+
if (1 === issue.path.length) {
|
|
44664
|
+
const identifier = issue.path[0];
|
|
44665
|
+
if ("number" == typeof identifier) {
|
|
44666
|
+
buf.push(` at index ${identifier}`);
|
|
44667
|
+
break pathCondition;
|
|
44668
|
+
}
|
|
44669
|
+
}
|
|
44670
|
+
buf.push(` at "${joinPath(issue.path)}"`);
|
|
44671
|
+
}
|
|
44672
|
+
return buf.join("");
|
|
44673
|
+
}
|
|
44359
44674
|
function conditionallyPrefixMessage(message, options) {
|
|
44360
44675
|
if (null != options.prefix) {
|
|
44361
44676
|
if (message.length > 0) return [
|
|
@@ -44439,13 +44754,11 @@ function validate(opts, createSchema, options = {}) {
|
|
|
44439
44754
|
return null;
|
|
44440
44755
|
}
|
|
44441
44756
|
function validate_toValidationError(error) {
|
|
44442
|
-
const customErrorMap = createErrorMap();
|
|
44443
44757
|
const separator = "\n- ";
|
|
44444
44758
|
const validationErr = fromZodError(error, {
|
|
44445
44759
|
prefix: "Invalid configuration object. Rspack has been initialized using a configuration object that does not match the API schema.",
|
|
44446
44760
|
prefixSeparator: separator,
|
|
44447
|
-
issueSeparator: separator
|
|
44448
|
-
error: customErrorMap
|
|
44761
|
+
issueSeparator: separator
|
|
44449
44762
|
});
|
|
44450
44763
|
return new validate_ValidationError(validationErr.message);
|
|
44451
44764
|
}
|
|
@@ -46605,7 +46918,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
46605
46918
|
if ("object" == typeof rspackFuture) {
|
|
46606
46919
|
D(rspackFuture, "bundlerInfo", {});
|
|
46607
46920
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
46608
|
-
D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-
|
|
46921
|
+
D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-2ccce257-20251016173648");
|
|
46609
46922
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
46610
46923
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
46611
46924
|
}
|
|
@@ -50548,7 +50861,7 @@ class MultiStats {
|
|
|
50548
50861
|
return obj;
|
|
50549
50862
|
});
|
|
50550
50863
|
if (childOptions.version) {
|
|
50551
|
-
obj.rspackVersion = "1.6.0-canary-
|
|
50864
|
+
obj.rspackVersion = "1.6.0-canary-2ccce257-20251016173648";
|
|
50552
50865
|
obj.version = "5.75.0";
|
|
50553
50866
|
}
|
|
50554
50867
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -51856,7 +52169,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
51856
52169
|
},
|
|
51857
52170
|
version: (object)=>{
|
|
51858
52171
|
object.version = "5.75.0";
|
|
51859
|
-
object.rspackVersion = "1.6.0-canary-
|
|
52172
|
+
object.rspackVersion = "1.6.0-canary-2ccce257-20251016173648";
|
|
51860
52173
|
},
|
|
51861
52174
|
env: (object, _compilation, _context, { _env })=>{
|
|
51862
52175
|
object.env = _env;
|
|
@@ -54729,7 +55042,8 @@ const getZodSwcLoaderOptionsSchema = memoize(()=>{
|
|
|
54729
55042
|
}).partial();
|
|
54730
55043
|
});
|
|
54731
55044
|
core_config({
|
|
54732
|
-
jitless: true
|
|
55045
|
+
jitless: true,
|
|
55046
|
+
customError: createErrorMap()
|
|
54733
55047
|
});
|
|
54734
55048
|
const getExternalsTypeSchema = memoize(()=>schemas_enum([
|
|
54735
55049
|
"var",
|
|
@@ -55046,10 +55360,7 @@ const getRspackOptionsSchema = memoize(()=>{
|
|
|
55046
55360
|
const res = getZodSwcLoaderOptionsSchema().safeParse(data.options);
|
|
55047
55361
|
if (!res.success) {
|
|
55048
55362
|
const validationErr = fromZodError(res.error, {
|
|
55049
|
-
prefix: "Invalid options for 'builtin:swc-loader'"
|
|
55050
|
-
error: createErrorMap({
|
|
55051
|
-
issuesInTitleCase: false
|
|
55052
|
-
})
|
|
55363
|
+
prefix: "Invalid options for 'builtin:swc-loader'"
|
|
55053
55364
|
});
|
|
55054
55365
|
ctx.issues.push({
|
|
55055
55366
|
code: "custom",
|
|
@@ -56326,7 +56637,7 @@ function transformSync(source, options) {
|
|
|
56326
56637
|
const _options = JSON.stringify(options || {});
|
|
56327
56638
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
56328
56639
|
}
|
|
56329
|
-
const exports_rspackVersion = "1.6.0-canary-
|
|
56640
|
+
const exports_rspackVersion = "1.6.0-canary-2ccce257-20251016173648";
|
|
56330
56641
|
const exports_version = "5.75.0";
|
|
56331
56642
|
const exports_WebpackError = Error;
|
|
56332
56643
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|