@socketsecurity/cli-with-sentry 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +350 -88
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/flags.js +5 -6
- package/dist/flags.js.map +1 -1
- package/dist/shadow-npm-inject.js +2 -5
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/handle-patch.d.mts +1 -1
- package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/manifest-schema.d.mts +34 -0
- package/dist/types/commands/patch/manifest-schema.d.mts.map +1 -0
- package/dist/types/flags.d.mts +9 -8
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +1 -1
- package/dist/vendor.js +3407 -93
- package/package.json +3 -2
package/dist/vendor.js
CHANGED
|
@@ -1826,9 +1826,9 @@ const parse$6 = (version, options, throwErrors = false) => {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
};
|
|
1828
1828
|
var parse_1$3 = parse$6;
|
|
1829
|
-
const parse$5 = parse_1$3;
|
|
1829
|
+
const parse$5$1 = parse_1$3;
|
|
1830
1830
|
const valid$1 = (version, options) => {
|
|
1831
|
-
const v = parse$5(version, options);
|
|
1831
|
+
const v = parse$5$1(version, options);
|
|
1832
1832
|
return v ? v.version : null;
|
|
1833
1833
|
};
|
|
1834
1834
|
var valid_1$1 = valid$1;
|
|
@@ -7391,7 +7391,7 @@ Object.defineProperty(lib$2$1, "__esModule", {
|
|
|
7391
7391
|
value: true
|
|
7392
7392
|
});
|
|
7393
7393
|
var codeFrameColumns_1 = lib$2$1.codeFrameColumns = codeFrameColumns;
|
|
7394
|
-
lib$2$1.default = _default;
|
|
7394
|
+
lib$2$1.default = _default$1;
|
|
7395
7395
|
var _highlight = lib$1$1;
|
|
7396
7396
|
var _chalk = _interopRequireWildcard(chalkExports, true);
|
|
7397
7397
|
function _getRequireWildcardCache(e) {
|
|
@@ -7541,7 +7541,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
|
7541
7541
|
return frame;
|
|
7542
7542
|
}
|
|
7543
7543
|
}
|
|
7544
|
-
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
|
7544
|
+
function _default$1(rawLines, lineNumber, colNumber, opts = {}) {
|
|
7545
7545
|
if (!deprecationWarningShown) {
|
|
7546
7546
|
deprecationWarningShown = true;
|
|
7547
7547
|
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
|
@@ -7870,7 +7870,7 @@ function isBuffer(val) {
|
|
|
7870
7870
|
}
|
|
7871
7871
|
return false;
|
|
7872
7872
|
}
|
|
7873
|
-
const isPlainObject$
|
|
7873
|
+
const isPlainObject$3 = isPlainObj;
|
|
7874
7874
|
const arrify = arrify$1;
|
|
7875
7875
|
const kindOf = kindOf$1;
|
|
7876
7876
|
const push = (obj, prop, value) => {
|
|
@@ -7927,7 +7927,7 @@ const buildOptions$1 = options => {
|
|
|
7927
7927
|
type: value
|
|
7928
7928
|
};
|
|
7929
7929
|
}
|
|
7930
|
-
if (isPlainObject$
|
|
7930
|
+
if (isPlainObject$3(value)) {
|
|
7931
7931
|
const props = value;
|
|
7932
7932
|
const {
|
|
7933
7933
|
type
|
|
@@ -7971,10 +7971,10 @@ const constructParserOptions = /*@__PURE__*/getDefaultExportFromCjs(minimistOpti
|
|
|
7971
7971
|
var mapObj = {
|
|
7972
7972
|
exports: {}
|
|
7973
7973
|
};
|
|
7974
|
-
const isObject$1 = value => typeof value === 'object' && value !== null;
|
|
7974
|
+
const isObject$1$1 = value => typeof value === 'object' && value !== null;
|
|
7975
7975
|
const mapObjectSkip = Symbol('skip');
|
|
7976
7976
|
// Customized for this use-case
|
|
7977
|
-
const isObjectCustom = value => isObject$1(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
|
|
7977
|
+
const isObjectCustom = value => isObject$1$1(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
|
|
7978
7978
|
const mapObject = (object, mapper, options, isSeen = new WeakMap()) => {
|
|
7979
7979
|
options = {
|
|
7980
7980
|
deep: false,
|
|
@@ -8013,7 +8013,7 @@ const mapObject = (object, mapper, options, isSeen = new WeakMap()) => {
|
|
|
8013
8013
|
return target;
|
|
8014
8014
|
};
|
|
8015
8015
|
mapObj.exports = (object, mapper, options) => {
|
|
8016
|
-
if (!isObject$1(object)) {
|
|
8016
|
+
if (!isObject$1$1(object)) {
|
|
8017
8017
|
throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
|
|
8018
8018
|
}
|
|
8019
8019
|
return mapObject(object, mapper, options);
|
|
@@ -8033,7 +8033,7 @@ const cache$3 = new QuickLRU({
|
|
|
8033
8033
|
});
|
|
8034
8034
|
// Reproduces behavior from `map-obj`.
|
|
8035
8035
|
const isObject$4 = value => typeof value === 'object' && value !== null && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
|
|
8036
|
-
const transform = (input, options = {}) => {
|
|
8036
|
+
const transform$2 = (input, options = {}) => {
|
|
8037
8037
|
if (!isObject$4(input)) {
|
|
8038
8038
|
return input;
|
|
8039
8039
|
}
|
|
@@ -8067,9 +8067,9 @@ const transform = (input, options = {}) => {
|
|
|
8067
8067
|
};
|
|
8068
8068
|
function decamelizeKeys(input, options) {
|
|
8069
8069
|
if (Array.isArray(input)) {
|
|
8070
|
-
return Object.keys(input).map(key => transform(input[key], options));
|
|
8070
|
+
return Object.keys(input).map(key => transform$2(input[key], options));
|
|
8071
8071
|
}
|
|
8072
|
-
return transform(input, options);
|
|
8072
|
+
return transform$2(input, options);
|
|
8073
8073
|
}
|
|
8074
8074
|
|
|
8075
8075
|
const decamelizeFlagKey = flagKey => `--${decamelize$2(flagKey, {
|
|
@@ -14959,7 +14959,7 @@ function requireCompile$1() {
|
|
|
14959
14959
|
var $id$1 = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
|
|
14960
14960
|
var description$1 = "Meta-schema for $data reference (JSON AnySchema extension proposal)";
|
|
14961
14961
|
var type$3 = "object";
|
|
14962
|
-
var required$
|
|
14962
|
+
var required$2 = [
|
|
14963
14963
|
"$data"
|
|
14964
14964
|
];
|
|
14965
14965
|
var properties$2 = {
|
|
@@ -14980,7 +14980,7 @@ var require$$9$1 = {
|
|
|
14980
14980
|
$id: $id$1,
|
|
14981
14981
|
description: description$1,
|
|
14982
14982
|
type: type$3,
|
|
14983
|
-
required: required$
|
|
14983
|
+
required: required$2,
|
|
14984
14984
|
properties: properties$2,
|
|
14985
14985
|
additionalProperties: additionalProperties$1
|
|
14986
14986
|
};
|
|
@@ -16890,13 +16890,13 @@ function requireLimitProperties() {
|
|
|
16890
16890
|
return limitProperties;
|
|
16891
16891
|
}
|
|
16892
16892
|
|
|
16893
|
-
var required = {};
|
|
16893
|
+
var required$1 = {};
|
|
16894
16894
|
|
|
16895
16895
|
var hasRequiredRequired;
|
|
16896
16896
|
function requireRequired() {
|
|
16897
|
-
if (hasRequiredRequired) return required;
|
|
16897
|
+
if (hasRequiredRequired) return required$1;
|
|
16898
16898
|
hasRequiredRequired = 1;
|
|
16899
|
-
Object.defineProperty(required, "__esModule", {
|
|
16899
|
+
Object.defineProperty(required$1, "__esModule", {
|
|
16900
16900
|
value: true
|
|
16901
16901
|
});
|
|
16902
16902
|
const code_1 = requireCode();
|
|
@@ -16991,8 +16991,8 @@ function requireRequired() {
|
|
|
16991
16991
|
}
|
|
16992
16992
|
}
|
|
16993
16993
|
};
|
|
16994
|
-
required.default = def;
|
|
16995
|
-
return required;
|
|
16994
|
+
required$1.default = def;
|
|
16995
|
+
return required$1;
|
|
16996
16996
|
}
|
|
16997
16997
|
|
|
16998
16998
|
var limitItems = {};
|
|
@@ -17184,13 +17184,13 @@ function require_const() {
|
|
|
17184
17184
|
return _const;
|
|
17185
17185
|
}
|
|
17186
17186
|
|
|
17187
|
-
var _enum = {};
|
|
17187
|
+
var _enum$1 = {};
|
|
17188
17188
|
|
|
17189
17189
|
var hasRequired_enum;
|
|
17190
17190
|
function require_enum() {
|
|
17191
|
-
if (hasRequired_enum) return _enum;
|
|
17191
|
+
if (hasRequired_enum) return _enum$1;
|
|
17192
17192
|
hasRequired_enum = 1;
|
|
17193
|
-
Object.defineProperty(_enum, "__esModule", {
|
|
17193
|
+
Object.defineProperty(_enum$1, "__esModule", {
|
|
17194
17194
|
value: true
|
|
17195
17195
|
});
|
|
17196
17196
|
const codegen_1 = requireCodegen();
|
|
@@ -17241,8 +17241,8 @@ function require_enum() {
|
|
|
17241
17241
|
}
|
|
17242
17242
|
}
|
|
17243
17243
|
};
|
|
17244
|
-
_enum.default = def;
|
|
17245
|
-
return _enum;
|
|
17244
|
+
_enum$1.default = def;
|
|
17245
|
+
return _enum$1;
|
|
17246
17246
|
}
|
|
17247
17247
|
|
|
17248
17248
|
var hasRequiredValidation;
|
|
@@ -20851,11 +20851,11 @@ function requireLog() {
|
|
|
20851
20851
|
return log;
|
|
20852
20852
|
}
|
|
20853
20853
|
|
|
20854
|
-
var merge$
|
|
20854
|
+
var merge$3 = {};
|
|
20855
20855
|
|
|
20856
20856
|
var hasRequiredMerge;
|
|
20857
20857
|
function requireMerge() {
|
|
20858
|
-
if (hasRequiredMerge) return merge$
|
|
20858
|
+
if (hasRequiredMerge) return merge$3;
|
|
20859
20859
|
hasRequiredMerge = 1;
|
|
20860
20860
|
var identity = requireIdentity$1();
|
|
20861
20861
|
var Scalar = requireScalar();
|
|
@@ -20903,10 +20903,10 @@ function requireMerge() {
|
|
|
20903
20903
|
}
|
|
20904
20904
|
return map;
|
|
20905
20905
|
}
|
|
20906
|
-
merge$
|
|
20907
|
-
merge$
|
|
20908
|
-
merge$
|
|
20909
|
-
return merge$
|
|
20906
|
+
merge$3.addMergeToJSMap = addMergeToJSMap;
|
|
20907
|
+
merge$3.isMergeKey = isMergeKey;
|
|
20908
|
+
merge$3.merge = merge;
|
|
20909
|
+
return merge$3;
|
|
20910
20910
|
}
|
|
20911
20911
|
|
|
20912
20912
|
var hasRequiredAddPairToJSMap;
|
|
@@ -21465,11 +21465,11 @@ function requireSeq() {
|
|
|
21465
21465
|
return seq$1;
|
|
21466
21466
|
}
|
|
21467
21467
|
|
|
21468
|
-
var string$
|
|
21468
|
+
var string$4 = {};
|
|
21469
21469
|
|
|
21470
21470
|
var hasRequiredString$2;
|
|
21471
21471
|
function requireString$2() {
|
|
21472
|
-
if (hasRequiredString$2) return string$
|
|
21472
|
+
if (hasRequiredString$2) return string$4;
|
|
21473
21473
|
hasRequiredString$2 = 1;
|
|
21474
21474
|
var stringifyString = requireStringifyString();
|
|
21475
21475
|
const string = {
|
|
@@ -21484,8 +21484,8 @@ function requireString$2() {
|
|
|
21484
21484
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
21485
21485
|
}
|
|
21486
21486
|
};
|
|
21487
|
-
string$
|
|
21488
|
-
return string$
|
|
21487
|
+
string$4.string = string;
|
|
21488
|
+
return string$4;
|
|
21489
21489
|
}
|
|
21490
21490
|
|
|
21491
21491
|
var tags = {};
|
|
@@ -27025,10 +27025,10 @@ function requireV1() {
|
|
|
27025
27025
|
return v1;
|
|
27026
27026
|
}
|
|
27027
27027
|
|
|
27028
|
-
var config$
|
|
27028
|
+
var config$3;
|
|
27029
27029
|
var hasRequiredConfig$2;
|
|
27030
27030
|
function requireConfig$2() {
|
|
27031
|
-
if (hasRequiredConfig$2) return config$
|
|
27031
|
+
if (hasRequiredConfig$2) return config$3;
|
|
27032
27032
|
hasRequiredConfig$2 = 1;
|
|
27033
27033
|
const {
|
|
27034
27034
|
readFile
|
|
@@ -27262,14 +27262,14 @@ function requireConfig$2() {
|
|
|
27262
27262
|
}
|
|
27263
27263
|
return config;
|
|
27264
27264
|
}
|
|
27265
|
-
config$
|
|
27265
|
+
config$3 = {
|
|
27266
27266
|
getDefaultConfig,
|
|
27267
27267
|
parseSocketConfig,
|
|
27268
27268
|
readSocketConfig,
|
|
27269
27269
|
SocketValidationError,
|
|
27270
27270
|
socketYmlSchema
|
|
27271
27271
|
};
|
|
27272
|
-
return config$
|
|
27272
|
+
return config$3;
|
|
27273
27273
|
}
|
|
27274
27274
|
|
|
27275
27275
|
var configExports = requireConfig$2();
|
|
@@ -27444,7 +27444,7 @@ var isInteractiveExports = /*@__PURE__*/ requireIsInteractive();
|
|
|
27444
27444
|
var dist$e = {};
|
|
27445
27445
|
|
|
27446
27446
|
var name$2 = "@socketsecurity/sdk";
|
|
27447
|
-
var version$
|
|
27447
|
+
var version$6 = "1.4.85";
|
|
27448
27448
|
var license = "MIT";
|
|
27449
27449
|
var description = "SDK for the Socket API client";
|
|
27450
27450
|
var author = {
|
|
@@ -27585,7 +27585,7 @@ var typeCoverage = {
|
|
|
27585
27585
|
};
|
|
27586
27586
|
var require$$14 = {
|
|
27587
27587
|
name: name$2,
|
|
27588
|
-
version: version$
|
|
27588
|
+
version: version$6,
|
|
27589
27589
|
license: license,
|
|
27590
27590
|
description: description,
|
|
27591
27591
|
author: author,
|
|
@@ -29121,10 +29121,10 @@ function requireError$c() {
|
|
|
29121
29121
|
return error$c;
|
|
29122
29122
|
}
|
|
29123
29123
|
|
|
29124
|
-
var decode$
|
|
29124
|
+
var decode$2;
|
|
29125
29125
|
var hasRequiredDecode$1;
|
|
29126
29126
|
function requireDecode$1() {
|
|
29127
|
-
if (hasRequiredDecode$1) return decode$
|
|
29127
|
+
if (hasRequiredDecode$1) return decode$2;
|
|
29128
29128
|
hasRequiredDecode$1 = 1;
|
|
29129
29129
|
const {
|
|
29130
29130
|
PurlError
|
|
@@ -29138,10 +29138,10 @@ function requireDecode$1() {
|
|
|
29138
29138
|
} catch {}
|
|
29139
29139
|
throw new PurlError(`unable to decode "${comp}" component`);
|
|
29140
29140
|
}
|
|
29141
|
-
decode$
|
|
29141
|
+
decode$2 = {
|
|
29142
29142
|
decodePurlComponent
|
|
29143
29143
|
};
|
|
29144
|
-
return decode$
|
|
29144
|
+
return decode$2;
|
|
29145
29145
|
}
|
|
29146
29146
|
|
|
29147
29147
|
var constants$a;
|
|
@@ -29377,10 +29377,10 @@ function requireStrings$1() {
|
|
|
29377
29377
|
return strings$1;
|
|
29378
29378
|
}
|
|
29379
29379
|
|
|
29380
|
-
var encode$
|
|
29380
|
+
var encode$2;
|
|
29381
29381
|
var hasRequiredEncode$1;
|
|
29382
29382
|
function requireEncode$1() {
|
|
29383
|
-
if (hasRequiredEncode$1) return encode$
|
|
29383
|
+
if (hasRequiredEncode$1) return encode$2;
|
|
29384
29384
|
hasRequiredEncode$1 = 1;
|
|
29385
29385
|
const {
|
|
29386
29386
|
REUSED_SEARCH_PARAMS,
|
|
@@ -29442,7 +29442,7 @@ function requireEncode$1() {
|
|
|
29442
29442
|
function encodeVersion(version) {
|
|
29443
29443
|
return isNonEmptyString(version) ? encodeComponent(version).replaceAll('%3A', ':') : '';
|
|
29444
29444
|
}
|
|
29445
|
-
encode$
|
|
29445
|
+
encode$2 = {
|
|
29446
29446
|
encodeComponent,
|
|
29447
29447
|
encodeName,
|
|
29448
29448
|
encodeNamespace,
|
|
@@ -29451,7 +29451,7 @@ function requireEncode$1() {
|
|
|
29451
29451
|
encodeQualifierParam,
|
|
29452
29452
|
encodeSubpath
|
|
29453
29453
|
};
|
|
29454
|
-
return encode$
|
|
29454
|
+
return encode$2;
|
|
29455
29455
|
}
|
|
29456
29456
|
|
|
29457
29457
|
var helpers$4;
|
|
@@ -34585,20 +34585,20 @@ var tasks = {};
|
|
|
34585
34585
|
|
|
34586
34586
|
var utils$7 = {};
|
|
34587
34587
|
|
|
34588
|
-
var array = {};
|
|
34588
|
+
var array$1 = {};
|
|
34589
34589
|
|
|
34590
34590
|
var hasRequiredArray;
|
|
34591
34591
|
function requireArray() {
|
|
34592
|
-
if (hasRequiredArray) return array;
|
|
34592
|
+
if (hasRequiredArray) return array$1;
|
|
34593
34593
|
hasRequiredArray = 1;
|
|
34594
|
-
Object.defineProperty(array, "__esModule", {
|
|
34594
|
+
Object.defineProperty(array$1, "__esModule", {
|
|
34595
34595
|
value: true
|
|
34596
34596
|
});
|
|
34597
|
-
array.splitWhen = array.flatten = void 0;
|
|
34597
|
+
array$1.splitWhen = array$1.flatten = void 0;
|
|
34598
34598
|
function flatten(items) {
|
|
34599
34599
|
return items.reduce((collection, item) => [].concat(collection, item), []);
|
|
34600
34600
|
}
|
|
34601
|
-
array.flatten = flatten;
|
|
34601
|
+
array$1.flatten = flatten;
|
|
34602
34602
|
function splitWhen(items, predicate) {
|
|
34603
34603
|
const result = [[]];
|
|
34604
34604
|
let groupIndex = 0;
|
|
@@ -34612,8 +34612,8 @@ function requireArray() {
|
|
|
34612
34612
|
}
|
|
34613
34613
|
return result;
|
|
34614
34614
|
}
|
|
34615
|
-
array.splitWhen = splitWhen;
|
|
34616
|
-
return array;
|
|
34615
|
+
array$1.splitWhen = splitWhen;
|
|
34616
|
+
return array$1;
|
|
34617
34617
|
}
|
|
34618
34618
|
|
|
34619
34619
|
var errno = {};
|
|
@@ -39395,25 +39395,25 @@ function requireStream$4() {
|
|
|
39395
39395
|
return stream$4;
|
|
39396
39396
|
}
|
|
39397
39397
|
|
|
39398
|
-
var string$
|
|
39398
|
+
var string$3 = {};
|
|
39399
39399
|
|
|
39400
39400
|
var hasRequiredString$1;
|
|
39401
39401
|
function requireString$1() {
|
|
39402
|
-
if (hasRequiredString$1) return string$
|
|
39402
|
+
if (hasRequiredString$1) return string$3;
|
|
39403
39403
|
hasRequiredString$1 = 1;
|
|
39404
|
-
Object.defineProperty(string$
|
|
39404
|
+
Object.defineProperty(string$3, "__esModule", {
|
|
39405
39405
|
value: true
|
|
39406
39406
|
});
|
|
39407
|
-
string$
|
|
39407
|
+
string$3.isEmpty = string$3.isString = void 0;
|
|
39408
39408
|
function isString(input) {
|
|
39409
39409
|
return typeof input === 'string';
|
|
39410
39410
|
}
|
|
39411
|
-
string$
|
|
39411
|
+
string$3.isString = isString;
|
|
39412
39412
|
function isEmpty(input) {
|
|
39413
39413
|
return input === '';
|
|
39414
39414
|
}
|
|
39415
|
-
string$
|
|
39416
|
-
return string$
|
|
39415
|
+
string$3.isEmpty = isEmpty;
|
|
39416
|
+
return string$3;
|
|
39417
39417
|
}
|
|
39418
39418
|
|
|
39419
39419
|
var hasRequiredUtils$5;
|
|
@@ -41066,7 +41066,7 @@ var provider = {};
|
|
|
41066
41066
|
|
|
41067
41067
|
var deep = {};
|
|
41068
41068
|
|
|
41069
|
-
var partial = {};
|
|
41069
|
+
var partial$1 = {};
|
|
41070
41070
|
|
|
41071
41071
|
var matcher = {};
|
|
41072
41072
|
|
|
@@ -41125,9 +41125,9 @@ function requireMatcher() {
|
|
|
41125
41125
|
|
|
41126
41126
|
var hasRequiredPartial;
|
|
41127
41127
|
function requirePartial() {
|
|
41128
|
-
if (hasRequiredPartial) return partial;
|
|
41128
|
+
if (hasRequiredPartial) return partial$1;
|
|
41129
41129
|
hasRequiredPartial = 1;
|
|
41130
|
-
Object.defineProperty(partial, "__esModule", {
|
|
41130
|
+
Object.defineProperty(partial$1, "__esModule", {
|
|
41131
41131
|
value: true
|
|
41132
41132
|
});
|
|
41133
41133
|
const matcher_1 = requireMatcher();
|
|
@@ -41165,8 +41165,8 @@ function requirePartial() {
|
|
|
41165
41165
|
return false;
|
|
41166
41166
|
}
|
|
41167
41167
|
}
|
|
41168
|
-
partial.default = PartialMatcher;
|
|
41169
|
-
return partial;
|
|
41168
|
+
partial$1.default = PartialMatcher;
|
|
41169
|
+
return partial$1;
|
|
41170
41170
|
}
|
|
41171
41171
|
|
|
41172
41172
|
var hasRequiredDeep;
|
|
@@ -42423,10 +42423,10 @@ function requireError$a() {
|
|
|
42423
42423
|
return error$a;
|
|
42424
42424
|
}
|
|
42425
42425
|
|
|
42426
|
-
var decode;
|
|
42426
|
+
var decode$1;
|
|
42427
42427
|
var hasRequiredDecode;
|
|
42428
42428
|
function requireDecode() {
|
|
42429
|
-
if (hasRequiredDecode) return decode;
|
|
42429
|
+
if (hasRequiredDecode) return decode$1;
|
|
42430
42430
|
hasRequiredDecode = 1;
|
|
42431
42431
|
const {
|
|
42432
42432
|
PurlError
|
|
@@ -42440,10 +42440,10 @@ function requireDecode() {
|
|
|
42440
42440
|
} catch {}
|
|
42441
42441
|
throw new PurlError(`unable to decode "${comp}" component`);
|
|
42442
42442
|
}
|
|
42443
|
-
decode = {
|
|
42443
|
+
decode$1 = {
|
|
42444
42444
|
decodePurlComponent
|
|
42445
42445
|
};
|
|
42446
|
-
return decode;
|
|
42446
|
+
return decode$1;
|
|
42447
42447
|
}
|
|
42448
42448
|
|
|
42449
42449
|
var constants$6;
|
|
@@ -42679,10 +42679,10 @@ function requireStrings() {
|
|
|
42679
42679
|
return strings;
|
|
42680
42680
|
}
|
|
42681
42681
|
|
|
42682
|
-
var encode;
|
|
42682
|
+
var encode$1;
|
|
42683
42683
|
var hasRequiredEncode;
|
|
42684
42684
|
function requireEncode() {
|
|
42685
|
-
if (hasRequiredEncode) return encode;
|
|
42685
|
+
if (hasRequiredEncode) return encode$1;
|
|
42686
42686
|
hasRequiredEncode = 1;
|
|
42687
42687
|
const {
|
|
42688
42688
|
REUSED_SEARCH_PARAMS,
|
|
@@ -42739,7 +42739,7 @@ function requireEncode() {
|
|
|
42739
42739
|
// Convert plus signs to %20 for better portability.
|
|
42740
42740
|
return str.replace(/\+/g, '%20');
|
|
42741
42741
|
}
|
|
42742
|
-
encode = {
|
|
42742
|
+
encode$1 = {
|
|
42743
42743
|
encodeComponent,
|
|
42744
42744
|
encodeName,
|
|
42745
42745
|
encodeNamespace,
|
|
@@ -42748,7 +42748,7 @@ function requireEncode() {
|
|
|
42748
42748
|
encodeQualifierParam,
|
|
42749
42749
|
encodeSubpath
|
|
42750
42750
|
};
|
|
42751
|
-
return encode;
|
|
42751
|
+
return encode$1;
|
|
42752
42752
|
}
|
|
42753
42753
|
|
|
42754
42754
|
var helpers$3;
|
|
@@ -46841,7 +46841,7 @@ function lowercaseKeys(object) {
|
|
|
46841
46841
|
}
|
|
46842
46842
|
|
|
46843
46843
|
// pkg/dist-src/util/is-plain-object.js
|
|
46844
|
-
function isPlainObject$
|
|
46844
|
+
function isPlainObject$2(value) {
|
|
46845
46845
|
if (typeof value !== "object" || value === null) return false;
|
|
46846
46846
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
46847
46847
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -46854,7 +46854,7 @@ function isPlainObject$1(value) {
|
|
|
46854
46854
|
function mergeDeep(defaults, options) {
|
|
46855
46855
|
const result = Object.assign({}, defaults);
|
|
46856
46856
|
Object.keys(options).forEach(key => {
|
|
46857
|
-
if (isPlainObject$
|
|
46857
|
+
if (isPlainObject$2(options[key])) {
|
|
46858
46858
|
if (!(key in defaults)) Object.assign(result, {
|
|
46859
46859
|
[key]: options[key]
|
|
46860
46860
|
});else result[key] = mergeDeep(defaults[key], options[key]);
|
|
@@ -46878,7 +46878,7 @@ function removeUndefinedProperties(obj) {
|
|
|
46878
46878
|
}
|
|
46879
46879
|
|
|
46880
46880
|
// pkg/dist-src/merge.js
|
|
46881
|
-
function merge$
|
|
46881
|
+
function merge$2(defaults, route, options) {
|
|
46882
46882
|
if (typeof route === "string") {
|
|
46883
46883
|
let [method, url] = route.split(" ");
|
|
46884
46884
|
options = Object.assign(url ? {
|
|
@@ -46932,7 +46932,7 @@ function extractUrlVariableNames(url) {
|
|
|
46932
46932
|
}
|
|
46933
46933
|
|
|
46934
46934
|
// pkg/dist-src/util/omit.js
|
|
46935
|
-
function omit(object, keysToOmit) {
|
|
46935
|
+
function omit$1(object, keysToOmit) {
|
|
46936
46936
|
const result = {
|
|
46937
46937
|
__proto__: null
|
|
46938
46938
|
};
|
|
@@ -47071,19 +47071,19 @@ function expand(template, context) {
|
|
|
47071
47071
|
}
|
|
47072
47072
|
|
|
47073
47073
|
// pkg/dist-src/parse.js
|
|
47074
|
-
function parse$
|
|
47074
|
+
function parse$5(options) {
|
|
47075
47075
|
let method = options.method.toUpperCase();
|
|
47076
47076
|
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
|
47077
47077
|
let headers = Object.assign({}, options.headers);
|
|
47078
47078
|
let body;
|
|
47079
|
-
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]);
|
|
47079
|
+
let parameters = omit$1(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]);
|
|
47080
47080
|
const urlVariableNames = extractUrlVariableNames(url);
|
|
47081
47081
|
url = parseUrl$2(url).expand(parameters);
|
|
47082
47082
|
if (!/^http/.test(url)) {
|
|
47083
47083
|
url = options.baseUrl + url;
|
|
47084
47084
|
}
|
|
47085
47085
|
const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
|
|
47086
|
-
const remainingParameters = omit(parameters, omittedParameters);
|
|
47086
|
+
const remainingParameters = omit$1(parameters, omittedParameters);
|
|
47087
47087
|
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
|
47088
47088
|
if (!isBinaryRequest) {
|
|
47089
47089
|
if (options.mediaType.format) {
|
|
@@ -47129,18 +47129,18 @@ function parse$4(options) {
|
|
|
47129
47129
|
|
|
47130
47130
|
// pkg/dist-src/endpoint-with-defaults.js
|
|
47131
47131
|
function endpointWithDefaults(defaults, route, options) {
|
|
47132
|
-
return parse$
|
|
47132
|
+
return parse$5(merge$2(defaults, route, options));
|
|
47133
47133
|
}
|
|
47134
47134
|
|
|
47135
47135
|
// pkg/dist-src/with-defaults.js
|
|
47136
47136
|
function withDefaults$2(oldDefaults, newDefaults) {
|
|
47137
|
-
const DEFAULTS2 = merge$
|
|
47137
|
+
const DEFAULTS2 = merge$2(oldDefaults, newDefaults);
|
|
47138
47138
|
const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
|
|
47139
47139
|
return Object.assign(endpoint2, {
|
|
47140
47140
|
DEFAULTS: DEFAULTS2,
|
|
47141
47141
|
defaults: withDefaults$2.bind(null, DEFAULTS2),
|
|
47142
|
-
merge: merge$
|
|
47143
|
-
parse: parse$
|
|
47142
|
+
merge: merge$2.bind(null, DEFAULTS2),
|
|
47143
|
+
parse: parse$5
|
|
47144
47144
|
});
|
|
47145
47145
|
}
|
|
47146
47146
|
|
|
@@ -47312,7 +47312,7 @@ var defaults_default = {
|
|
|
47312
47312
|
};
|
|
47313
47313
|
|
|
47314
47314
|
// pkg/dist-src/is-plain-object.js
|
|
47315
|
-
function isPlainObject(value) {
|
|
47315
|
+
function isPlainObject$1(value) {
|
|
47316
47316
|
if (typeof value !== "object" || value === null) return false;
|
|
47317
47317
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
47318
47318
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -47327,7 +47327,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
47327
47327
|
}
|
|
47328
47328
|
const log = requestOptions.request?.log || console;
|
|
47329
47329
|
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
|
47330
|
-
const body = isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
|
47330
|
+
const body = isPlainObject$1(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
|
47331
47331
|
const requestHeaders = Object.fromEntries(Object.entries(requestOptions.headers).map(([name, value]) => [name, String(value)]));
|
|
47332
47332
|
let fetchResponse;
|
|
47333
47333
|
try {
|
|
@@ -60942,10 +60942,10 @@ function requireNode$5() {
|
|
|
60942
60942
|
return node$5.exports;
|
|
60943
60943
|
}
|
|
60944
60944
|
|
|
60945
|
-
var parse$
|
|
60945
|
+
var parse$4;
|
|
60946
60946
|
var hasRequiredParse$3;
|
|
60947
60947
|
function requireParse$3() {
|
|
60948
|
-
if (hasRequiredParse$3) return parse$
|
|
60948
|
+
if (hasRequiredParse$3) return parse$4;
|
|
60949
60949
|
hasRequiredParse$3 = 1;
|
|
60950
60950
|
var AND_REGEXP = /^\s+and\s+(.*)/i;
|
|
60951
60951
|
var OR_REGEXP = /^(?:,\s*|\s+or\s+)(.*)/i;
|
|
@@ -61008,7 +61008,7 @@ function requireParse$3() {
|
|
|
61008
61008
|
return false;
|
|
61009
61009
|
});
|
|
61010
61010
|
}
|
|
61011
|
-
parse$
|
|
61011
|
+
parse$4 = function parse(all, queries) {
|
|
61012
61012
|
if (!Array.isArray(queries)) queries = [queries];
|
|
61013
61013
|
return flatten(queries.map(function (block) {
|
|
61014
61014
|
var qs = [];
|
|
@@ -61018,7 +61018,7 @@ function requireParse$3() {
|
|
|
61018
61018
|
return qs;
|
|
61019
61019
|
}));
|
|
61020
61020
|
};
|
|
61021
|
-
return parse$
|
|
61021
|
+
return parse$4;
|
|
61022
61022
|
}
|
|
61023
61023
|
|
|
61024
61024
|
var browserslist_1;
|
|
@@ -64433,6 +64433,3316 @@ function requireSrc$1() {
|
|
|
64433
64433
|
|
|
64434
64434
|
var srcExports = requireSrc$1();
|
|
64435
64435
|
|
|
64436
|
+
/** A special constant with type `never` */
|
|
64437
|
+
function $constructor(name, initializer, params) {
|
|
64438
|
+
function init(inst, def) {
|
|
64439
|
+
var _a;
|
|
64440
|
+
Object.defineProperty(inst, "_zod", {
|
|
64441
|
+
value: inst._zod ?? {},
|
|
64442
|
+
enumerable: false
|
|
64443
|
+
});
|
|
64444
|
+
(_a = inst._zod).traits ?? (_a.traits = new Set());
|
|
64445
|
+
inst._zod.traits.add(name);
|
|
64446
|
+
initializer(inst, def);
|
|
64447
|
+
// support prototype modifications
|
|
64448
|
+
for (const k in _.prototype) {
|
|
64449
|
+
if (!(k in inst)) Object.defineProperty(inst, k, {
|
|
64450
|
+
value: _.prototype[k].bind(inst)
|
|
64451
|
+
});
|
|
64452
|
+
}
|
|
64453
|
+
inst._zod.constr = _;
|
|
64454
|
+
inst._zod.def = def;
|
|
64455
|
+
}
|
|
64456
|
+
// doesn't work if Parent has a constructor with arguments
|
|
64457
|
+
const Parent = params?.Parent ?? Object;
|
|
64458
|
+
class Definition extends Parent {}
|
|
64459
|
+
Object.defineProperty(Definition, "name", {
|
|
64460
|
+
value: name
|
|
64461
|
+
});
|
|
64462
|
+
function _(def) {
|
|
64463
|
+
var _a;
|
|
64464
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
64465
|
+
init(inst, def);
|
|
64466
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
64467
|
+
for (const fn of inst._zod.deferred) {
|
|
64468
|
+
fn();
|
|
64469
|
+
}
|
|
64470
|
+
return inst;
|
|
64471
|
+
}
|
|
64472
|
+
Object.defineProperty(_, "init", {
|
|
64473
|
+
value: init
|
|
64474
|
+
});
|
|
64475
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
64476
|
+
value: inst => {
|
|
64477
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
64478
|
+
return inst?._zod?.traits?.has(name);
|
|
64479
|
+
}
|
|
64480
|
+
});
|
|
64481
|
+
Object.defineProperty(_, "name", {
|
|
64482
|
+
value: name
|
|
64483
|
+
});
|
|
64484
|
+
return _;
|
|
64485
|
+
}
|
|
64486
|
+
class $ZodAsyncError extends Error {
|
|
64487
|
+
constructor() {
|
|
64488
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
64489
|
+
}
|
|
64490
|
+
}
|
|
64491
|
+
class $ZodEncodeError extends Error {
|
|
64492
|
+
constructor(name) {
|
|
64493
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
64494
|
+
this.name = "ZodEncodeError";
|
|
64495
|
+
}
|
|
64496
|
+
}
|
|
64497
|
+
const globalConfig = {};
|
|
64498
|
+
function config$2(newConfig) {
|
|
64499
|
+
return globalConfig;
|
|
64500
|
+
}
|
|
64501
|
+
|
|
64502
|
+
// functions
|
|
64503
|
+
function getEnumValues(entries) {
|
|
64504
|
+
const numericValues = Object.values(entries).filter(v => typeof v === "number");
|
|
64505
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
64506
|
+
return values;
|
|
64507
|
+
}
|
|
64508
|
+
function jsonStringifyReplacer(_, value) {
|
|
64509
|
+
if (typeof value === "bigint") return value.toString();
|
|
64510
|
+
return value;
|
|
64511
|
+
}
|
|
64512
|
+
function cached(getter) {
|
|
64513
|
+
return {
|
|
64514
|
+
get value() {
|
|
64515
|
+
{
|
|
64516
|
+
const value = getter();
|
|
64517
|
+
Object.defineProperty(this, "value", {
|
|
64518
|
+
value
|
|
64519
|
+
});
|
|
64520
|
+
return value;
|
|
64521
|
+
}
|
|
64522
|
+
}
|
|
64523
|
+
};
|
|
64524
|
+
}
|
|
64525
|
+
function nullish(input) {
|
|
64526
|
+
return input === null || input === undefined;
|
|
64527
|
+
}
|
|
64528
|
+
function cleanRegex(source) {
|
|
64529
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
64530
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
64531
|
+
return source.slice(start, end);
|
|
64532
|
+
}
|
|
64533
|
+
const EVALUATING = Symbol("evaluating");
|
|
64534
|
+
function defineLazy(object, key, getter) {
|
|
64535
|
+
let value = undefined;
|
|
64536
|
+
Object.defineProperty(object, key, {
|
|
64537
|
+
get() {
|
|
64538
|
+
if (value === EVALUATING) {
|
|
64539
|
+
// Circular reference detected, return undefined to break the cycle
|
|
64540
|
+
return undefined;
|
|
64541
|
+
}
|
|
64542
|
+
if (value === undefined) {
|
|
64543
|
+
value = EVALUATING;
|
|
64544
|
+
value = getter();
|
|
64545
|
+
}
|
|
64546
|
+
return value;
|
|
64547
|
+
},
|
|
64548
|
+
set(v) {
|
|
64549
|
+
Object.defineProperty(object, key, {
|
|
64550
|
+
value: v
|
|
64551
|
+
// configurable: true,
|
|
64552
|
+
});
|
|
64553
|
+
// object[key] = v;
|
|
64554
|
+
},
|
|
64555
|
+
configurable: true
|
|
64556
|
+
});
|
|
64557
|
+
}
|
|
64558
|
+
function objectClone(obj) {
|
|
64559
|
+
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
64560
|
+
}
|
|
64561
|
+
function assignProp(target, prop, value) {
|
|
64562
|
+
Object.defineProperty(target, prop, {
|
|
64563
|
+
value,
|
|
64564
|
+
writable: true,
|
|
64565
|
+
enumerable: true,
|
|
64566
|
+
configurable: true
|
|
64567
|
+
});
|
|
64568
|
+
}
|
|
64569
|
+
function mergeDefs(...defs) {
|
|
64570
|
+
const mergedDescriptors = {};
|
|
64571
|
+
for (const def of defs) {
|
|
64572
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
64573
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
64574
|
+
}
|
|
64575
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
64576
|
+
}
|
|
64577
|
+
function esc(str) {
|
|
64578
|
+
return JSON.stringify(str);
|
|
64579
|
+
}
|
|
64580
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
64581
|
+
function isObject$1(data) {
|
|
64582
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
64583
|
+
}
|
|
64584
|
+
const allowsEval = cached(() => {
|
|
64585
|
+
// @ts-ignore
|
|
64586
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
64587
|
+
return false;
|
|
64588
|
+
}
|
|
64589
|
+
try {
|
|
64590
|
+
const F = Function;
|
|
64591
|
+
new F("");
|
|
64592
|
+
return true;
|
|
64593
|
+
} catch (_) {
|
|
64594
|
+
return false;
|
|
64595
|
+
}
|
|
64596
|
+
});
|
|
64597
|
+
function isPlainObject(o) {
|
|
64598
|
+
if (isObject$1(o) === false) return false;
|
|
64599
|
+
// modified constructor
|
|
64600
|
+
const ctor = o.constructor;
|
|
64601
|
+
if (ctor === undefined) return true;
|
|
64602
|
+
// modified prototype
|
|
64603
|
+
const prot = ctor.prototype;
|
|
64604
|
+
if (isObject$1(prot) === false) return false;
|
|
64605
|
+
// ctor doesn't have static `isPrototypeOf`
|
|
64606
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
64607
|
+
return false;
|
|
64608
|
+
}
|
|
64609
|
+
return true;
|
|
64610
|
+
}
|
|
64611
|
+
function shallowClone(o) {
|
|
64612
|
+
if (isPlainObject(o)) return {
|
|
64613
|
+
...o
|
|
64614
|
+
};
|
|
64615
|
+
return o;
|
|
64616
|
+
}
|
|
64617
|
+
const propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
|
64618
|
+
function escapeRegex(str) {
|
|
64619
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
64620
|
+
}
|
|
64621
|
+
// zod-specific utils
|
|
64622
|
+
function clone(inst, def, params) {
|
|
64623
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
64624
|
+
if (!def || params?.parent) cl._zod.parent = inst;
|
|
64625
|
+
return cl;
|
|
64626
|
+
}
|
|
64627
|
+
function normalizeParams(_params) {
|
|
64628
|
+
const params = _params;
|
|
64629
|
+
if (!params) return {};
|
|
64630
|
+
if (typeof params === "string") return {
|
|
64631
|
+
error: () => params
|
|
64632
|
+
};
|
|
64633
|
+
if (params?.message !== undefined) {
|
|
64634
|
+
if (params?.error !== undefined) throw new Error("Cannot specify both `message` and `error` params");
|
|
64635
|
+
params.error = params.message;
|
|
64636
|
+
}
|
|
64637
|
+
delete params.message;
|
|
64638
|
+
if (typeof params.error === "string") return {
|
|
64639
|
+
...params,
|
|
64640
|
+
error: () => params.error
|
|
64641
|
+
};
|
|
64642
|
+
return params;
|
|
64643
|
+
}
|
|
64644
|
+
function optionalKeys(shape) {
|
|
64645
|
+
return Object.keys(shape).filter(k => {
|
|
64646
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
64647
|
+
});
|
|
64648
|
+
}
|
|
64649
|
+
function pick(schema, mask) {
|
|
64650
|
+
const currDef = schema._zod.def;
|
|
64651
|
+
const def = mergeDefs(schema._zod.def, {
|
|
64652
|
+
get shape() {
|
|
64653
|
+
const newShape = {};
|
|
64654
|
+
for (const key in mask) {
|
|
64655
|
+
if (!(key in currDef.shape)) {
|
|
64656
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
64657
|
+
}
|
|
64658
|
+
if (!mask[key]) continue;
|
|
64659
|
+
newShape[key] = currDef.shape[key];
|
|
64660
|
+
}
|
|
64661
|
+
assignProp(this, "shape", newShape); // self-caching
|
|
64662
|
+
return newShape;
|
|
64663
|
+
},
|
|
64664
|
+
checks: []
|
|
64665
|
+
});
|
|
64666
|
+
return clone(schema, def);
|
|
64667
|
+
}
|
|
64668
|
+
function omit(schema, mask) {
|
|
64669
|
+
const currDef = schema._zod.def;
|
|
64670
|
+
const def = mergeDefs(schema._zod.def, {
|
|
64671
|
+
get shape() {
|
|
64672
|
+
const newShape = {
|
|
64673
|
+
...schema._zod.def.shape
|
|
64674
|
+
};
|
|
64675
|
+
for (const key in mask) {
|
|
64676
|
+
if (!(key in currDef.shape)) {
|
|
64677
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
64678
|
+
}
|
|
64679
|
+
if (!mask[key]) continue;
|
|
64680
|
+
delete newShape[key];
|
|
64681
|
+
}
|
|
64682
|
+
assignProp(this, "shape", newShape); // self-caching
|
|
64683
|
+
return newShape;
|
|
64684
|
+
},
|
|
64685
|
+
checks: []
|
|
64686
|
+
});
|
|
64687
|
+
return clone(schema, def);
|
|
64688
|
+
}
|
|
64689
|
+
function extend$1(schema, shape) {
|
|
64690
|
+
if (!isPlainObject(shape)) {
|
|
64691
|
+
throw new Error("Invalid input to extend: expected a plain object");
|
|
64692
|
+
}
|
|
64693
|
+
const checks = schema._zod.def.checks;
|
|
64694
|
+
const hasChecks = checks && checks.length > 0;
|
|
64695
|
+
if (hasChecks) {
|
|
64696
|
+
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
64697
|
+
}
|
|
64698
|
+
const def = mergeDefs(schema._zod.def, {
|
|
64699
|
+
get shape() {
|
|
64700
|
+
const _shape = {
|
|
64701
|
+
...schema._zod.def.shape,
|
|
64702
|
+
...shape
|
|
64703
|
+
};
|
|
64704
|
+
assignProp(this, "shape", _shape); // self-caching
|
|
64705
|
+
return _shape;
|
|
64706
|
+
},
|
|
64707
|
+
checks: []
|
|
64708
|
+
});
|
|
64709
|
+
return clone(schema, def);
|
|
64710
|
+
}
|
|
64711
|
+
function safeExtend(schema, shape) {
|
|
64712
|
+
if (!isPlainObject(shape)) {
|
|
64713
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
64714
|
+
}
|
|
64715
|
+
const def = {
|
|
64716
|
+
...schema._zod.def,
|
|
64717
|
+
get shape() {
|
|
64718
|
+
const _shape = {
|
|
64719
|
+
...schema._zod.def.shape,
|
|
64720
|
+
...shape
|
|
64721
|
+
};
|
|
64722
|
+
assignProp(this, "shape", _shape); // self-caching
|
|
64723
|
+
return _shape;
|
|
64724
|
+
},
|
|
64725
|
+
checks: schema._zod.def.checks
|
|
64726
|
+
};
|
|
64727
|
+
return clone(schema, def);
|
|
64728
|
+
}
|
|
64729
|
+
function merge$1(a, b) {
|
|
64730
|
+
const def = mergeDefs(a._zod.def, {
|
|
64731
|
+
get shape() {
|
|
64732
|
+
const _shape = {
|
|
64733
|
+
...a._zod.def.shape,
|
|
64734
|
+
...b._zod.def.shape
|
|
64735
|
+
};
|
|
64736
|
+
assignProp(this, "shape", _shape); // self-caching
|
|
64737
|
+
return _shape;
|
|
64738
|
+
},
|
|
64739
|
+
get catchall() {
|
|
64740
|
+
return b._zod.def.catchall;
|
|
64741
|
+
},
|
|
64742
|
+
checks: [] // delete existing checks
|
|
64743
|
+
});
|
|
64744
|
+
return clone(a, def);
|
|
64745
|
+
}
|
|
64746
|
+
function partial(Class, schema, mask) {
|
|
64747
|
+
const def = mergeDefs(schema._zod.def, {
|
|
64748
|
+
get shape() {
|
|
64749
|
+
const oldShape = schema._zod.def.shape;
|
|
64750
|
+
const shape = {
|
|
64751
|
+
...oldShape
|
|
64752
|
+
};
|
|
64753
|
+
if (mask) {
|
|
64754
|
+
for (const key in mask) {
|
|
64755
|
+
if (!(key in oldShape)) {
|
|
64756
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
64757
|
+
}
|
|
64758
|
+
if (!mask[key]) continue;
|
|
64759
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
64760
|
+
shape[key] = Class ? new Class({
|
|
64761
|
+
type: "optional",
|
|
64762
|
+
innerType: oldShape[key]
|
|
64763
|
+
}) : oldShape[key];
|
|
64764
|
+
}
|
|
64765
|
+
} else {
|
|
64766
|
+
for (const key in oldShape) {
|
|
64767
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
64768
|
+
shape[key] = Class ? new Class({
|
|
64769
|
+
type: "optional",
|
|
64770
|
+
innerType: oldShape[key]
|
|
64771
|
+
}) : oldShape[key];
|
|
64772
|
+
}
|
|
64773
|
+
}
|
|
64774
|
+
assignProp(this, "shape", shape); // self-caching
|
|
64775
|
+
return shape;
|
|
64776
|
+
},
|
|
64777
|
+
checks: []
|
|
64778
|
+
});
|
|
64779
|
+
return clone(schema, def);
|
|
64780
|
+
}
|
|
64781
|
+
function required(Class, schema, mask) {
|
|
64782
|
+
const def = mergeDefs(schema._zod.def, {
|
|
64783
|
+
get shape() {
|
|
64784
|
+
const oldShape = schema._zod.def.shape;
|
|
64785
|
+
const shape = {
|
|
64786
|
+
...oldShape
|
|
64787
|
+
};
|
|
64788
|
+
if (mask) {
|
|
64789
|
+
for (const key in mask) {
|
|
64790
|
+
if (!(key in shape)) {
|
|
64791
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
64792
|
+
}
|
|
64793
|
+
if (!mask[key]) continue;
|
|
64794
|
+
// overwrite with non-optional
|
|
64795
|
+
shape[key] = new Class({
|
|
64796
|
+
type: "nonoptional",
|
|
64797
|
+
innerType: oldShape[key]
|
|
64798
|
+
});
|
|
64799
|
+
}
|
|
64800
|
+
} else {
|
|
64801
|
+
for (const key in oldShape) {
|
|
64802
|
+
// overwrite with non-optional
|
|
64803
|
+
shape[key] = new Class({
|
|
64804
|
+
type: "nonoptional",
|
|
64805
|
+
innerType: oldShape[key]
|
|
64806
|
+
});
|
|
64807
|
+
}
|
|
64808
|
+
}
|
|
64809
|
+
assignProp(this, "shape", shape); // self-caching
|
|
64810
|
+
return shape;
|
|
64811
|
+
},
|
|
64812
|
+
checks: []
|
|
64813
|
+
});
|
|
64814
|
+
return clone(schema, def);
|
|
64815
|
+
}
|
|
64816
|
+
// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
|
|
64817
|
+
function aborted(x, startIndex = 0) {
|
|
64818
|
+
if (x.aborted === true) return true;
|
|
64819
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
64820
|
+
if (x.issues[i]?.continue !== true) {
|
|
64821
|
+
return true;
|
|
64822
|
+
}
|
|
64823
|
+
}
|
|
64824
|
+
return false;
|
|
64825
|
+
}
|
|
64826
|
+
function prefixIssues(path, issues) {
|
|
64827
|
+
return issues.map(iss => {
|
|
64828
|
+
var _a;
|
|
64829
|
+
(_a = iss).path ?? (_a.path = []);
|
|
64830
|
+
iss.path.unshift(path);
|
|
64831
|
+
return iss;
|
|
64832
|
+
});
|
|
64833
|
+
}
|
|
64834
|
+
function unwrapMessage(message) {
|
|
64835
|
+
return typeof message === "string" ? message : message?.message;
|
|
64836
|
+
}
|
|
64837
|
+
function finalizeIssue(iss, ctx, config) {
|
|
64838
|
+
const full = {
|
|
64839
|
+
...iss,
|
|
64840
|
+
path: iss.path ?? []
|
|
64841
|
+
};
|
|
64842
|
+
// for backwards compatibility
|
|
64843
|
+
if (!iss.message) {
|
|
64844
|
+
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
64845
|
+
full.message = message;
|
|
64846
|
+
}
|
|
64847
|
+
// delete (full as any).def;
|
|
64848
|
+
delete full.inst;
|
|
64849
|
+
delete full.continue;
|
|
64850
|
+
if (!ctx?.reportInput) {
|
|
64851
|
+
delete full.input;
|
|
64852
|
+
}
|
|
64853
|
+
return full;
|
|
64854
|
+
}
|
|
64855
|
+
function getLengthableOrigin(input) {
|
|
64856
|
+
if (Array.isArray(input)) return "array";
|
|
64857
|
+
if (typeof input === "string") return "string";
|
|
64858
|
+
return "unknown";
|
|
64859
|
+
}
|
|
64860
|
+
function issue(...args) {
|
|
64861
|
+
const [iss, input, inst] = args;
|
|
64862
|
+
if (typeof iss === "string") {
|
|
64863
|
+
return {
|
|
64864
|
+
message: iss,
|
|
64865
|
+
code: "custom",
|
|
64866
|
+
input,
|
|
64867
|
+
inst
|
|
64868
|
+
};
|
|
64869
|
+
}
|
|
64870
|
+
return {
|
|
64871
|
+
...iss
|
|
64872
|
+
};
|
|
64873
|
+
}
|
|
64874
|
+
|
|
64875
|
+
const initializer$1 = (inst, def) => {
|
|
64876
|
+
inst.name = "$ZodError";
|
|
64877
|
+
Object.defineProperty(inst, "_zod", {
|
|
64878
|
+
value: inst._zod,
|
|
64879
|
+
enumerable: false
|
|
64880
|
+
});
|
|
64881
|
+
Object.defineProperty(inst, "issues", {
|
|
64882
|
+
value: def,
|
|
64883
|
+
enumerable: false
|
|
64884
|
+
});
|
|
64885
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
64886
|
+
Object.defineProperty(inst, "toString", {
|
|
64887
|
+
value: () => inst.message,
|
|
64888
|
+
enumerable: false
|
|
64889
|
+
});
|
|
64890
|
+
};
|
|
64891
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
64892
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, {
|
|
64893
|
+
Parent: Error
|
|
64894
|
+
});
|
|
64895
|
+
function flattenError(error, mapper = issue => issue.message) {
|
|
64896
|
+
const fieldErrors = {};
|
|
64897
|
+
const formErrors = [];
|
|
64898
|
+
for (const sub of error.issues) {
|
|
64899
|
+
if (sub.path.length > 0) {
|
|
64900
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
64901
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
64902
|
+
} else {
|
|
64903
|
+
formErrors.push(mapper(sub));
|
|
64904
|
+
}
|
|
64905
|
+
}
|
|
64906
|
+
return {
|
|
64907
|
+
formErrors,
|
|
64908
|
+
fieldErrors
|
|
64909
|
+
};
|
|
64910
|
+
}
|
|
64911
|
+
function formatError$1(error, _mapper) {
|
|
64912
|
+
const mapper = _mapper || function (issue) {
|
|
64913
|
+
return issue.message;
|
|
64914
|
+
};
|
|
64915
|
+
const fieldErrors = {
|
|
64916
|
+
_errors: []
|
|
64917
|
+
};
|
|
64918
|
+
const processError = error => {
|
|
64919
|
+
for (const issue of error.issues) {
|
|
64920
|
+
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
64921
|
+
issue.errors.map(issues => processError({
|
|
64922
|
+
issues
|
|
64923
|
+
}));
|
|
64924
|
+
} else if (issue.code === "invalid_key") {
|
|
64925
|
+
processError({
|
|
64926
|
+
issues: issue.issues
|
|
64927
|
+
});
|
|
64928
|
+
} else if (issue.code === "invalid_element") {
|
|
64929
|
+
processError({
|
|
64930
|
+
issues: issue.issues
|
|
64931
|
+
});
|
|
64932
|
+
} else if (issue.path.length === 0) {
|
|
64933
|
+
fieldErrors._errors.push(mapper(issue));
|
|
64934
|
+
} else {
|
|
64935
|
+
let curr = fieldErrors;
|
|
64936
|
+
let i = 0;
|
|
64937
|
+
while (i < issue.path.length) {
|
|
64938
|
+
const el = issue.path[i];
|
|
64939
|
+
const terminal = i === issue.path.length - 1;
|
|
64940
|
+
if (!terminal) {
|
|
64941
|
+
curr[el] = curr[el] || {
|
|
64942
|
+
_errors: []
|
|
64943
|
+
};
|
|
64944
|
+
} else {
|
|
64945
|
+
curr[el] = curr[el] || {
|
|
64946
|
+
_errors: []
|
|
64947
|
+
};
|
|
64948
|
+
curr[el]._errors.push(mapper(issue));
|
|
64949
|
+
}
|
|
64950
|
+
curr = curr[el];
|
|
64951
|
+
i++;
|
|
64952
|
+
}
|
|
64953
|
+
}
|
|
64954
|
+
}
|
|
64955
|
+
};
|
|
64956
|
+
processError(error);
|
|
64957
|
+
return fieldErrors;
|
|
64958
|
+
}
|
|
64959
|
+
|
|
64960
|
+
const _parse = _Err => (schema, value, _ctx, _params) => {
|
|
64961
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
64962
|
+
async: false
|
|
64963
|
+
}) : {
|
|
64964
|
+
async: false
|
|
64965
|
+
};
|
|
64966
|
+
const result = schema._zod.run({
|
|
64967
|
+
value,
|
|
64968
|
+
issues: []
|
|
64969
|
+
}, ctx);
|
|
64970
|
+
if (result instanceof Promise) {
|
|
64971
|
+
throw new $ZodAsyncError();
|
|
64972
|
+
}
|
|
64973
|
+
if (result.issues.length) {
|
|
64974
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map(iss => finalizeIssue(iss, ctx, config$2())));
|
|
64975
|
+
captureStackTrace(e, _params?.callee);
|
|
64976
|
+
throw e;
|
|
64977
|
+
}
|
|
64978
|
+
return result.value;
|
|
64979
|
+
};
|
|
64980
|
+
const _parseAsync = _Err => async (schema, value, _ctx, params) => {
|
|
64981
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
64982
|
+
async: true
|
|
64983
|
+
}) : {
|
|
64984
|
+
async: true
|
|
64985
|
+
};
|
|
64986
|
+
let result = schema._zod.run({
|
|
64987
|
+
value,
|
|
64988
|
+
issues: []
|
|
64989
|
+
}, ctx);
|
|
64990
|
+
if (result instanceof Promise) result = await result;
|
|
64991
|
+
if (result.issues.length) {
|
|
64992
|
+
const e = new (params?.Err ?? _Err)(result.issues.map(iss => finalizeIssue(iss, ctx, config$2())));
|
|
64993
|
+
captureStackTrace(e, params?.callee);
|
|
64994
|
+
throw e;
|
|
64995
|
+
}
|
|
64996
|
+
return result.value;
|
|
64997
|
+
};
|
|
64998
|
+
const _safeParse = _Err => (schema, value, _ctx) => {
|
|
64999
|
+
const ctx = _ctx ? {
|
|
65000
|
+
..._ctx,
|
|
65001
|
+
async: false
|
|
65002
|
+
} : {
|
|
65003
|
+
async: false
|
|
65004
|
+
};
|
|
65005
|
+
const result = schema._zod.run({
|
|
65006
|
+
value,
|
|
65007
|
+
issues: []
|
|
65008
|
+
}, ctx);
|
|
65009
|
+
if (result instanceof Promise) {
|
|
65010
|
+
throw new $ZodAsyncError();
|
|
65011
|
+
}
|
|
65012
|
+
return result.issues.length ? {
|
|
65013
|
+
success: false,
|
|
65014
|
+
error: new (_Err ?? $ZodError)(result.issues.map(iss => finalizeIssue(iss, ctx, config$2())))
|
|
65015
|
+
} : {
|
|
65016
|
+
success: true,
|
|
65017
|
+
data: result.value
|
|
65018
|
+
};
|
|
65019
|
+
};
|
|
65020
|
+
const safeParse$1 = /* @__PURE__*/_safeParse($ZodRealError);
|
|
65021
|
+
const _safeParseAsync = _Err => async (schema, value, _ctx) => {
|
|
65022
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
65023
|
+
async: true
|
|
65024
|
+
}) : {
|
|
65025
|
+
async: true
|
|
65026
|
+
};
|
|
65027
|
+
let result = schema._zod.run({
|
|
65028
|
+
value,
|
|
65029
|
+
issues: []
|
|
65030
|
+
}, ctx);
|
|
65031
|
+
if (result instanceof Promise) result = await result;
|
|
65032
|
+
return result.issues.length ? {
|
|
65033
|
+
success: false,
|
|
65034
|
+
error: new _Err(result.issues.map(iss => finalizeIssue(iss, ctx, config$2())))
|
|
65035
|
+
} : {
|
|
65036
|
+
success: true,
|
|
65037
|
+
data: result.value
|
|
65038
|
+
};
|
|
65039
|
+
};
|
|
65040
|
+
const safeParseAsync$1 = /* @__PURE__*/_safeParseAsync($ZodRealError);
|
|
65041
|
+
const _encode = _Err => (schema, value, _ctx) => {
|
|
65042
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
65043
|
+
direction: "backward"
|
|
65044
|
+
}) : {
|
|
65045
|
+
direction: "backward"
|
|
65046
|
+
};
|
|
65047
|
+
return _parse(_Err)(schema, value, ctx);
|
|
65048
|
+
};
|
|
65049
|
+
const _decode = _Err => (schema, value, _ctx) => {
|
|
65050
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
65051
|
+
};
|
|
65052
|
+
const _encodeAsync = _Err => async (schema, value, _ctx) => {
|
|
65053
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
65054
|
+
direction: "backward"
|
|
65055
|
+
}) : {
|
|
65056
|
+
direction: "backward"
|
|
65057
|
+
};
|
|
65058
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
65059
|
+
};
|
|
65060
|
+
const _decodeAsync = _Err => async (schema, value, _ctx) => {
|
|
65061
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
65062
|
+
};
|
|
65063
|
+
const _safeEncode = _Err => (schema, value, _ctx) => {
|
|
65064
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
65065
|
+
direction: "backward"
|
|
65066
|
+
}) : {
|
|
65067
|
+
direction: "backward"
|
|
65068
|
+
};
|
|
65069
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
65070
|
+
};
|
|
65071
|
+
const _safeDecode = _Err => (schema, value, _ctx) => {
|
|
65072
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
65073
|
+
};
|
|
65074
|
+
const _safeEncodeAsync = _Err => async (schema, value, _ctx) => {
|
|
65075
|
+
const ctx = _ctx ? Object.assign(_ctx, {
|
|
65076
|
+
direction: "backward"
|
|
65077
|
+
}) : {
|
|
65078
|
+
direction: "backward"
|
|
65079
|
+
};
|
|
65080
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
65081
|
+
};
|
|
65082
|
+
const _safeDecodeAsync = _Err => async (schema, value, _ctx) => {
|
|
65083
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
65084
|
+
};
|
|
65085
|
+
|
|
65086
|
+
const cuid = /^[cC][^\s-]{8,}$/;
|
|
65087
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
65088
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
65089
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
65090
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
65091
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
65092
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
65093
|
+
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
65094
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
65095
|
+
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})$/;
|
|
65096
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
65097
|
+
*
|
|
65098
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
65099
|
+
const uuid = version => {
|
|
65100
|
+
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)$/;
|
|
65101
|
+
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})$`);
|
|
65102
|
+
};
|
|
65103
|
+
/** Practical email validation */
|
|
65104
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
65105
|
+
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
65106
|
+
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
65107
|
+
function emoji() {
|
|
65108
|
+
return new RegExp(_emoji$1, "u");
|
|
65109
|
+
}
|
|
65110
|
+
const ipv4$1 = /^(?:(?: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])$/;
|
|
65111
|
+
const ipv6$1 = /^(([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})$/;
|
|
65112
|
+
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])$/;
|
|
65113
|
+
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])$/;
|
|
65114
|
+
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
65115
|
+
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
65116
|
+
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
65117
|
+
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
|
65118
|
+
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
65119
|
+
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])?)*\.?$/;
|
|
65120
|
+
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
65121
|
+
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
65122
|
+
// 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])))`;
|
|
65123
|
+
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])))`;
|
|
65124
|
+
const date$1 = /*@__PURE__*/new RegExp(`^${dateSource}$`);
|
|
65125
|
+
function timeSource(args) {
|
|
65126
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
65127
|
+
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
65128
|
+
return regex;
|
|
65129
|
+
}
|
|
65130
|
+
function time$1(args) {
|
|
65131
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
65132
|
+
}
|
|
65133
|
+
// Adapted from https://stackoverflow.com/a/3143231
|
|
65134
|
+
function datetime$1(args) {
|
|
65135
|
+
const time = timeSource({
|
|
65136
|
+
precision: args.precision
|
|
65137
|
+
});
|
|
65138
|
+
const opts = ["Z"];
|
|
65139
|
+
if (args.local) opts.push("");
|
|
65140
|
+
// if (args.offset) opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
65141
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
65142
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
65143
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
65144
|
+
}
|
|
65145
|
+
const string$2 = params => {
|
|
65146
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
65147
|
+
return new RegExp(`^${regex}$`);
|
|
65148
|
+
};
|
|
65149
|
+
// regex for string with no uppercase letters
|
|
65150
|
+
const lowercase = /^[^A-Z]*$/;
|
|
65151
|
+
// regex for string with no lowercase letters
|
|
65152
|
+
const uppercase = /^[^a-z]*$/;
|
|
65153
|
+
|
|
65154
|
+
// import { $ZodType } from "./schemas.js";
|
|
65155
|
+
const $ZodCheck = /*@__PURE__*/$constructor("$ZodCheck", (inst, def) => {
|
|
65156
|
+
var _a;
|
|
65157
|
+
inst._zod ?? (inst._zod = {});
|
|
65158
|
+
inst._zod.def = def;
|
|
65159
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
65160
|
+
});
|
|
65161
|
+
const $ZodCheckMaxLength = /*@__PURE__*/$constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
65162
|
+
var _a;
|
|
65163
|
+
$ZodCheck.init(inst, def);
|
|
65164
|
+
(_a = inst._zod.def).when ?? (_a.when = payload => {
|
|
65165
|
+
const val = payload.value;
|
|
65166
|
+
return !nullish(val) && val.length !== undefined;
|
|
65167
|
+
});
|
|
65168
|
+
inst._zod.onattach.push(inst => {
|
|
65169
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
65170
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
65171
|
+
});
|
|
65172
|
+
inst._zod.check = payload => {
|
|
65173
|
+
const input = payload.value;
|
|
65174
|
+
const length = input.length;
|
|
65175
|
+
if (length <= def.maximum) return;
|
|
65176
|
+
const origin = getLengthableOrigin(input);
|
|
65177
|
+
payload.issues.push({
|
|
65178
|
+
origin,
|
|
65179
|
+
code: "too_big",
|
|
65180
|
+
maximum: def.maximum,
|
|
65181
|
+
inclusive: true,
|
|
65182
|
+
input,
|
|
65183
|
+
inst,
|
|
65184
|
+
continue: !def.abort
|
|
65185
|
+
});
|
|
65186
|
+
};
|
|
65187
|
+
});
|
|
65188
|
+
const $ZodCheckMinLength = /*@__PURE__*/$constructor("$ZodCheckMinLength", (inst, def) => {
|
|
65189
|
+
var _a;
|
|
65190
|
+
$ZodCheck.init(inst, def);
|
|
65191
|
+
(_a = inst._zod.def).when ?? (_a.when = payload => {
|
|
65192
|
+
const val = payload.value;
|
|
65193
|
+
return !nullish(val) && val.length !== undefined;
|
|
65194
|
+
});
|
|
65195
|
+
inst._zod.onattach.push(inst => {
|
|
65196
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
65197
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
65198
|
+
});
|
|
65199
|
+
inst._zod.check = payload => {
|
|
65200
|
+
const input = payload.value;
|
|
65201
|
+
const length = input.length;
|
|
65202
|
+
if (length >= def.minimum) return;
|
|
65203
|
+
const origin = getLengthableOrigin(input);
|
|
65204
|
+
payload.issues.push({
|
|
65205
|
+
origin,
|
|
65206
|
+
code: "too_small",
|
|
65207
|
+
minimum: def.minimum,
|
|
65208
|
+
inclusive: true,
|
|
65209
|
+
input,
|
|
65210
|
+
inst,
|
|
65211
|
+
continue: !def.abort
|
|
65212
|
+
});
|
|
65213
|
+
};
|
|
65214
|
+
});
|
|
65215
|
+
const $ZodCheckLengthEquals = /*@__PURE__*/$constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
65216
|
+
var _a;
|
|
65217
|
+
$ZodCheck.init(inst, def);
|
|
65218
|
+
(_a = inst._zod.def).when ?? (_a.when = payload => {
|
|
65219
|
+
const val = payload.value;
|
|
65220
|
+
return !nullish(val) && val.length !== undefined;
|
|
65221
|
+
});
|
|
65222
|
+
inst._zod.onattach.push(inst => {
|
|
65223
|
+
const bag = inst._zod.bag;
|
|
65224
|
+
bag.minimum = def.length;
|
|
65225
|
+
bag.maximum = def.length;
|
|
65226
|
+
bag.length = def.length;
|
|
65227
|
+
});
|
|
65228
|
+
inst._zod.check = payload => {
|
|
65229
|
+
const input = payload.value;
|
|
65230
|
+
const length = input.length;
|
|
65231
|
+
if (length === def.length) return;
|
|
65232
|
+
const origin = getLengthableOrigin(input);
|
|
65233
|
+
const tooBig = length > def.length;
|
|
65234
|
+
payload.issues.push({
|
|
65235
|
+
origin,
|
|
65236
|
+
...(tooBig ? {
|
|
65237
|
+
code: "too_big",
|
|
65238
|
+
maximum: def.length
|
|
65239
|
+
} : {
|
|
65240
|
+
code: "too_small",
|
|
65241
|
+
minimum: def.length
|
|
65242
|
+
}),
|
|
65243
|
+
inclusive: true,
|
|
65244
|
+
exact: true,
|
|
65245
|
+
input: payload.value,
|
|
65246
|
+
inst,
|
|
65247
|
+
continue: !def.abort
|
|
65248
|
+
});
|
|
65249
|
+
};
|
|
65250
|
+
});
|
|
65251
|
+
const $ZodCheckStringFormat = /*@__PURE__*/$constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
65252
|
+
var _a, _b;
|
|
65253
|
+
$ZodCheck.init(inst, def);
|
|
65254
|
+
inst._zod.onattach.push(inst => {
|
|
65255
|
+
const bag = inst._zod.bag;
|
|
65256
|
+
bag.format = def.format;
|
|
65257
|
+
if (def.pattern) {
|
|
65258
|
+
bag.patterns ?? (bag.patterns = new Set());
|
|
65259
|
+
bag.patterns.add(def.pattern);
|
|
65260
|
+
}
|
|
65261
|
+
});
|
|
65262
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = payload => {
|
|
65263
|
+
def.pattern.lastIndex = 0;
|
|
65264
|
+
if (def.pattern.test(payload.value)) return;
|
|
65265
|
+
payload.issues.push({
|
|
65266
|
+
origin: "string",
|
|
65267
|
+
code: "invalid_format",
|
|
65268
|
+
format: def.format,
|
|
65269
|
+
input: payload.value,
|
|
65270
|
+
...(def.pattern ? {
|
|
65271
|
+
pattern: def.pattern.toString()
|
|
65272
|
+
} : {}),
|
|
65273
|
+
inst,
|
|
65274
|
+
continue: !def.abort
|
|
65275
|
+
});
|
|
65276
|
+
});else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
65277
|
+
});
|
|
65278
|
+
const $ZodCheckRegex = /*@__PURE__*/$constructor("$ZodCheckRegex", (inst, def) => {
|
|
65279
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
65280
|
+
inst._zod.check = payload => {
|
|
65281
|
+
def.pattern.lastIndex = 0;
|
|
65282
|
+
if (def.pattern.test(payload.value)) return;
|
|
65283
|
+
payload.issues.push({
|
|
65284
|
+
origin: "string",
|
|
65285
|
+
code: "invalid_format",
|
|
65286
|
+
format: "regex",
|
|
65287
|
+
input: payload.value,
|
|
65288
|
+
pattern: def.pattern.toString(),
|
|
65289
|
+
inst,
|
|
65290
|
+
continue: !def.abort
|
|
65291
|
+
});
|
|
65292
|
+
};
|
|
65293
|
+
});
|
|
65294
|
+
const $ZodCheckLowerCase = /*@__PURE__*/$constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
65295
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
65296
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
65297
|
+
});
|
|
65298
|
+
const $ZodCheckUpperCase = /*@__PURE__*/$constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
65299
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
65300
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
65301
|
+
});
|
|
65302
|
+
const $ZodCheckIncludes = /*@__PURE__*/$constructor("$ZodCheckIncludes", (inst, def) => {
|
|
65303
|
+
$ZodCheck.init(inst, def);
|
|
65304
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
65305
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
65306
|
+
def.pattern = pattern;
|
|
65307
|
+
inst._zod.onattach.push(inst => {
|
|
65308
|
+
const bag = inst._zod.bag;
|
|
65309
|
+
bag.patterns ?? (bag.patterns = new Set());
|
|
65310
|
+
bag.patterns.add(pattern);
|
|
65311
|
+
});
|
|
65312
|
+
inst._zod.check = payload => {
|
|
65313
|
+
if (payload.value.includes(def.includes, def.position)) return;
|
|
65314
|
+
payload.issues.push({
|
|
65315
|
+
origin: "string",
|
|
65316
|
+
code: "invalid_format",
|
|
65317
|
+
format: "includes",
|
|
65318
|
+
includes: def.includes,
|
|
65319
|
+
input: payload.value,
|
|
65320
|
+
inst,
|
|
65321
|
+
continue: !def.abort
|
|
65322
|
+
});
|
|
65323
|
+
};
|
|
65324
|
+
});
|
|
65325
|
+
const $ZodCheckStartsWith = /*@__PURE__*/$constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
65326
|
+
$ZodCheck.init(inst, def);
|
|
65327
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
65328
|
+
def.pattern ?? (def.pattern = pattern);
|
|
65329
|
+
inst._zod.onattach.push(inst => {
|
|
65330
|
+
const bag = inst._zod.bag;
|
|
65331
|
+
bag.patterns ?? (bag.patterns = new Set());
|
|
65332
|
+
bag.patterns.add(pattern);
|
|
65333
|
+
});
|
|
65334
|
+
inst._zod.check = payload => {
|
|
65335
|
+
if (payload.value.startsWith(def.prefix)) return;
|
|
65336
|
+
payload.issues.push({
|
|
65337
|
+
origin: "string",
|
|
65338
|
+
code: "invalid_format",
|
|
65339
|
+
format: "starts_with",
|
|
65340
|
+
prefix: def.prefix,
|
|
65341
|
+
input: payload.value,
|
|
65342
|
+
inst,
|
|
65343
|
+
continue: !def.abort
|
|
65344
|
+
});
|
|
65345
|
+
};
|
|
65346
|
+
});
|
|
65347
|
+
const $ZodCheckEndsWith = /*@__PURE__*/$constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
65348
|
+
$ZodCheck.init(inst, def);
|
|
65349
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
65350
|
+
def.pattern ?? (def.pattern = pattern);
|
|
65351
|
+
inst._zod.onattach.push(inst => {
|
|
65352
|
+
const bag = inst._zod.bag;
|
|
65353
|
+
bag.patterns ?? (bag.patterns = new Set());
|
|
65354
|
+
bag.patterns.add(pattern);
|
|
65355
|
+
});
|
|
65356
|
+
inst._zod.check = payload => {
|
|
65357
|
+
if (payload.value.endsWith(def.suffix)) return;
|
|
65358
|
+
payload.issues.push({
|
|
65359
|
+
origin: "string",
|
|
65360
|
+
code: "invalid_format",
|
|
65361
|
+
format: "ends_with",
|
|
65362
|
+
suffix: def.suffix,
|
|
65363
|
+
input: payload.value,
|
|
65364
|
+
inst,
|
|
65365
|
+
continue: !def.abort
|
|
65366
|
+
});
|
|
65367
|
+
};
|
|
65368
|
+
});
|
|
65369
|
+
const $ZodCheckOverwrite = /*@__PURE__*/$constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
65370
|
+
$ZodCheck.init(inst, def);
|
|
65371
|
+
inst._zod.check = payload => {
|
|
65372
|
+
payload.value = def.tx(payload.value);
|
|
65373
|
+
};
|
|
65374
|
+
});
|
|
65375
|
+
|
|
65376
|
+
class Doc {
|
|
65377
|
+
constructor(args = []) {
|
|
65378
|
+
this.content = [];
|
|
65379
|
+
this.indent = 0;
|
|
65380
|
+
if (this) this.args = args;
|
|
65381
|
+
}
|
|
65382
|
+
indented(fn) {
|
|
65383
|
+
this.indent += 1;
|
|
65384
|
+
fn(this);
|
|
65385
|
+
this.indent -= 1;
|
|
65386
|
+
}
|
|
65387
|
+
write(arg) {
|
|
65388
|
+
if (typeof arg === "function") {
|
|
65389
|
+
arg(this, {
|
|
65390
|
+
execution: "sync"
|
|
65391
|
+
});
|
|
65392
|
+
arg(this, {
|
|
65393
|
+
execution: "async"
|
|
65394
|
+
});
|
|
65395
|
+
return;
|
|
65396
|
+
}
|
|
65397
|
+
const content = arg;
|
|
65398
|
+
const lines = content.split("\n").filter(x => x);
|
|
65399
|
+
const minIndent = Math.min(...lines.map(x => x.length - x.trimStart().length));
|
|
65400
|
+
const dedented = lines.map(x => x.slice(minIndent)).map(x => " ".repeat(this.indent * 2) + x);
|
|
65401
|
+
for (const line of dedented) {
|
|
65402
|
+
this.content.push(line);
|
|
65403
|
+
}
|
|
65404
|
+
}
|
|
65405
|
+
compile() {
|
|
65406
|
+
const F = Function;
|
|
65407
|
+
const args = this?.args;
|
|
65408
|
+
const content = this?.content ?? [``];
|
|
65409
|
+
const lines = [...content.map(x => ` ${x}`)];
|
|
65410
|
+
// console.log(lines.join("\n"));
|
|
65411
|
+
return new F(...args, lines.join("\n"));
|
|
65412
|
+
}
|
|
65413
|
+
}
|
|
65414
|
+
|
|
65415
|
+
const version$5 = {
|
|
65416
|
+
major: 4,
|
|
65417
|
+
minor: 1,
|
|
65418
|
+
patch: 5
|
|
65419
|
+
};
|
|
65420
|
+
|
|
65421
|
+
const $ZodType = /*@__PURE__*/$constructor("$ZodType", (inst, def) => {
|
|
65422
|
+
var _a;
|
|
65423
|
+
inst ?? (inst = {});
|
|
65424
|
+
inst._zod.def = def; // set _def property
|
|
65425
|
+
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
65426
|
+
inst._zod.version = version$5;
|
|
65427
|
+
const checks = [...(inst._zod.def.checks ?? [])];
|
|
65428
|
+
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
65429
|
+
if (inst._zod.traits.has("$ZodCheck")) {
|
|
65430
|
+
checks.unshift(inst);
|
|
65431
|
+
}
|
|
65432
|
+
for (const ch of checks) {
|
|
65433
|
+
for (const fn of ch._zod.onattach) {
|
|
65434
|
+
fn(inst);
|
|
65435
|
+
}
|
|
65436
|
+
}
|
|
65437
|
+
if (checks.length === 0) {
|
|
65438
|
+
// deferred initializer
|
|
65439
|
+
// inst._zod.parse is not yet defined
|
|
65440
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
65441
|
+
inst._zod.deferred?.push(() => {
|
|
65442
|
+
inst._zod.run = inst._zod.parse;
|
|
65443
|
+
});
|
|
65444
|
+
} else {
|
|
65445
|
+
const runChecks = (payload, checks, ctx) => {
|
|
65446
|
+
let isAborted = aborted(payload);
|
|
65447
|
+
let asyncResult;
|
|
65448
|
+
for (const ch of checks) {
|
|
65449
|
+
if (ch._zod.def.when) {
|
|
65450
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
65451
|
+
if (!shouldRun) continue;
|
|
65452
|
+
} else if (isAborted) {
|
|
65453
|
+
continue;
|
|
65454
|
+
}
|
|
65455
|
+
const currLen = payload.issues.length;
|
|
65456
|
+
const _ = ch._zod.check(payload);
|
|
65457
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
65458
|
+
throw new $ZodAsyncError();
|
|
65459
|
+
}
|
|
65460
|
+
if (asyncResult || _ instanceof Promise) {
|
|
65461
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
65462
|
+
await _;
|
|
65463
|
+
const nextLen = payload.issues.length;
|
|
65464
|
+
if (nextLen === currLen) return;
|
|
65465
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
65466
|
+
});
|
|
65467
|
+
} else {
|
|
65468
|
+
const nextLen = payload.issues.length;
|
|
65469
|
+
if (nextLen === currLen) continue;
|
|
65470
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
65471
|
+
}
|
|
65472
|
+
}
|
|
65473
|
+
if (asyncResult) {
|
|
65474
|
+
return asyncResult.then(() => {
|
|
65475
|
+
return payload;
|
|
65476
|
+
});
|
|
65477
|
+
}
|
|
65478
|
+
return payload;
|
|
65479
|
+
};
|
|
65480
|
+
// const handleChecksResult = (
|
|
65481
|
+
// checkResult: ParsePayload,
|
|
65482
|
+
// originalResult: ParsePayload,
|
|
65483
|
+
// ctx: ParseContextInternal
|
|
65484
|
+
// ): util.MaybeAsync<ParsePayload> => {
|
|
65485
|
+
// // if the checks mutated the value && there are no issues, re-parse the result
|
|
65486
|
+
// if (checkResult.value !== originalResult.value && !checkResult.issues.length)
|
|
65487
|
+
// return inst._zod.parse(checkResult, ctx);
|
|
65488
|
+
// return originalResult;
|
|
65489
|
+
// };
|
|
65490
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
65491
|
+
// abort if the canary is aborted
|
|
65492
|
+
if (aborted(canary)) {
|
|
65493
|
+
canary.aborted = true;
|
|
65494
|
+
return canary;
|
|
65495
|
+
}
|
|
65496
|
+
// run checks first, then
|
|
65497
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
65498
|
+
if (checkResult instanceof Promise) {
|
|
65499
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
65500
|
+
return checkResult.then(checkResult => inst._zod.parse(checkResult, ctx));
|
|
65501
|
+
}
|
|
65502
|
+
return inst._zod.parse(checkResult, ctx);
|
|
65503
|
+
};
|
|
65504
|
+
inst._zod.run = (payload, ctx) => {
|
|
65505
|
+
if (ctx.skipChecks) {
|
|
65506
|
+
return inst._zod.parse(payload, ctx);
|
|
65507
|
+
}
|
|
65508
|
+
if (ctx.direction === "backward") {
|
|
65509
|
+
// run canary
|
|
65510
|
+
// initial pass (no checks)
|
|
65511
|
+
const canary = inst._zod.parse({
|
|
65512
|
+
value: payload.value,
|
|
65513
|
+
issues: []
|
|
65514
|
+
}, {
|
|
65515
|
+
...ctx,
|
|
65516
|
+
skipChecks: true
|
|
65517
|
+
});
|
|
65518
|
+
if (canary instanceof Promise) {
|
|
65519
|
+
return canary.then(canary => {
|
|
65520
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
65521
|
+
});
|
|
65522
|
+
}
|
|
65523
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
65524
|
+
}
|
|
65525
|
+
// forward
|
|
65526
|
+
const result = inst._zod.parse(payload, ctx);
|
|
65527
|
+
if (result instanceof Promise) {
|
|
65528
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
65529
|
+
return result.then(result => runChecks(result, checks, ctx));
|
|
65530
|
+
}
|
|
65531
|
+
return runChecks(result, checks, ctx);
|
|
65532
|
+
};
|
|
65533
|
+
}
|
|
65534
|
+
inst["~standard"] = {
|
|
65535
|
+
validate: value => {
|
|
65536
|
+
try {
|
|
65537
|
+
const r = safeParse$1(inst, value);
|
|
65538
|
+
return r.success ? {
|
|
65539
|
+
value: r.data
|
|
65540
|
+
} : {
|
|
65541
|
+
issues: r.error?.issues
|
|
65542
|
+
};
|
|
65543
|
+
} catch (_) {
|
|
65544
|
+
return safeParseAsync$1(inst, value).then(r => r.success ? {
|
|
65545
|
+
value: r.data
|
|
65546
|
+
} : {
|
|
65547
|
+
issues: r.error?.issues
|
|
65548
|
+
});
|
|
65549
|
+
}
|
|
65550
|
+
},
|
|
65551
|
+
vendor: "zod",
|
|
65552
|
+
version: 1
|
|
65553
|
+
};
|
|
65554
|
+
});
|
|
65555
|
+
const $ZodString = /*@__PURE__*/$constructor("$ZodString", (inst, def) => {
|
|
65556
|
+
$ZodType.init(inst, def);
|
|
65557
|
+
inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string$2(inst._zod.bag);
|
|
65558
|
+
inst._zod.parse = (payload, _) => {
|
|
65559
|
+
if (def.coerce) try {
|
|
65560
|
+
payload.value = String(payload.value);
|
|
65561
|
+
} catch (_) {}
|
|
65562
|
+
if (typeof payload.value === "string") return payload;
|
|
65563
|
+
payload.issues.push({
|
|
65564
|
+
expected: "string",
|
|
65565
|
+
code: "invalid_type",
|
|
65566
|
+
input: payload.value,
|
|
65567
|
+
inst
|
|
65568
|
+
});
|
|
65569
|
+
return payload;
|
|
65570
|
+
};
|
|
65571
|
+
});
|
|
65572
|
+
const $ZodStringFormat = /*@__PURE__*/$constructor("$ZodStringFormat", (inst, def) => {
|
|
65573
|
+
// check initialization must come first
|
|
65574
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
65575
|
+
$ZodString.init(inst, def);
|
|
65576
|
+
});
|
|
65577
|
+
const $ZodGUID = /*@__PURE__*/$constructor("$ZodGUID", (inst, def) => {
|
|
65578
|
+
def.pattern ?? (def.pattern = guid);
|
|
65579
|
+
$ZodStringFormat.init(inst, def);
|
|
65580
|
+
});
|
|
65581
|
+
const $ZodUUID = /*@__PURE__*/$constructor("$ZodUUID", (inst, def) => {
|
|
65582
|
+
if (def.version) {
|
|
65583
|
+
const versionMap = {
|
|
65584
|
+
v1: 1,
|
|
65585
|
+
v2: 2,
|
|
65586
|
+
v3: 3,
|
|
65587
|
+
v4: 4,
|
|
65588
|
+
v5: 5,
|
|
65589
|
+
v6: 6,
|
|
65590
|
+
v7: 7,
|
|
65591
|
+
v8: 8
|
|
65592
|
+
};
|
|
65593
|
+
const v = versionMap[def.version];
|
|
65594
|
+
if (v === undefined) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
65595
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
65596
|
+
} else def.pattern ?? (def.pattern = uuid());
|
|
65597
|
+
$ZodStringFormat.init(inst, def);
|
|
65598
|
+
});
|
|
65599
|
+
const $ZodEmail = /*@__PURE__*/$constructor("$ZodEmail", (inst, def) => {
|
|
65600
|
+
def.pattern ?? (def.pattern = email);
|
|
65601
|
+
$ZodStringFormat.init(inst, def);
|
|
65602
|
+
});
|
|
65603
|
+
const $ZodURL = /*@__PURE__*/$constructor("$ZodURL", (inst, def) => {
|
|
65604
|
+
$ZodStringFormat.init(inst, def);
|
|
65605
|
+
inst._zod.check = payload => {
|
|
65606
|
+
try {
|
|
65607
|
+
// Trim whitespace from input
|
|
65608
|
+
const trimmed = payload.value.trim();
|
|
65609
|
+
// @ts-ignore
|
|
65610
|
+
const url = new URL(trimmed);
|
|
65611
|
+
if (def.hostname) {
|
|
65612
|
+
def.hostname.lastIndex = 0;
|
|
65613
|
+
if (!def.hostname.test(url.hostname)) {
|
|
65614
|
+
payload.issues.push({
|
|
65615
|
+
code: "invalid_format",
|
|
65616
|
+
format: "url",
|
|
65617
|
+
note: "Invalid hostname",
|
|
65618
|
+
pattern: hostname.source,
|
|
65619
|
+
input: payload.value,
|
|
65620
|
+
inst,
|
|
65621
|
+
continue: !def.abort
|
|
65622
|
+
});
|
|
65623
|
+
}
|
|
65624
|
+
}
|
|
65625
|
+
if (def.protocol) {
|
|
65626
|
+
def.protocol.lastIndex = 0;
|
|
65627
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
|
|
65628
|
+
payload.issues.push({
|
|
65629
|
+
code: "invalid_format",
|
|
65630
|
+
format: "url",
|
|
65631
|
+
note: "Invalid protocol",
|
|
65632
|
+
pattern: def.protocol.source,
|
|
65633
|
+
input: payload.value,
|
|
65634
|
+
inst,
|
|
65635
|
+
continue: !def.abort
|
|
65636
|
+
});
|
|
65637
|
+
}
|
|
65638
|
+
}
|
|
65639
|
+
// Set the output value based on normalize flag
|
|
65640
|
+
if (def.normalize) {
|
|
65641
|
+
// Use normalized URL
|
|
65642
|
+
payload.value = url.href;
|
|
65643
|
+
} else {
|
|
65644
|
+
// Preserve the original input (trimmed)
|
|
65645
|
+
payload.value = trimmed;
|
|
65646
|
+
}
|
|
65647
|
+
return;
|
|
65648
|
+
} catch (_) {
|
|
65649
|
+
payload.issues.push({
|
|
65650
|
+
code: "invalid_format",
|
|
65651
|
+
format: "url",
|
|
65652
|
+
input: payload.value,
|
|
65653
|
+
inst,
|
|
65654
|
+
continue: !def.abort
|
|
65655
|
+
});
|
|
65656
|
+
}
|
|
65657
|
+
};
|
|
65658
|
+
});
|
|
65659
|
+
const $ZodEmoji = /*@__PURE__*/$constructor("$ZodEmoji", (inst, def) => {
|
|
65660
|
+
def.pattern ?? (def.pattern = emoji());
|
|
65661
|
+
$ZodStringFormat.init(inst, def);
|
|
65662
|
+
});
|
|
65663
|
+
const $ZodNanoID = /*@__PURE__*/$constructor("$ZodNanoID", (inst, def) => {
|
|
65664
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
65665
|
+
$ZodStringFormat.init(inst, def);
|
|
65666
|
+
});
|
|
65667
|
+
const $ZodCUID = /*@__PURE__*/$constructor("$ZodCUID", (inst, def) => {
|
|
65668
|
+
def.pattern ?? (def.pattern = cuid);
|
|
65669
|
+
$ZodStringFormat.init(inst, def);
|
|
65670
|
+
});
|
|
65671
|
+
const $ZodCUID2 = /*@__PURE__*/$constructor("$ZodCUID2", (inst, def) => {
|
|
65672
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
65673
|
+
$ZodStringFormat.init(inst, def);
|
|
65674
|
+
});
|
|
65675
|
+
const $ZodULID = /*@__PURE__*/$constructor("$ZodULID", (inst, def) => {
|
|
65676
|
+
def.pattern ?? (def.pattern = ulid);
|
|
65677
|
+
$ZodStringFormat.init(inst, def);
|
|
65678
|
+
});
|
|
65679
|
+
const $ZodXID = /*@__PURE__*/$constructor("$ZodXID", (inst, def) => {
|
|
65680
|
+
def.pattern ?? (def.pattern = xid);
|
|
65681
|
+
$ZodStringFormat.init(inst, def);
|
|
65682
|
+
});
|
|
65683
|
+
const $ZodKSUID = /*@__PURE__*/$constructor("$ZodKSUID", (inst, def) => {
|
|
65684
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
65685
|
+
$ZodStringFormat.init(inst, def);
|
|
65686
|
+
});
|
|
65687
|
+
const $ZodISODateTime = /*@__PURE__*/$constructor("$ZodISODateTime", (inst, def) => {
|
|
65688
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
65689
|
+
$ZodStringFormat.init(inst, def);
|
|
65690
|
+
});
|
|
65691
|
+
const $ZodISODate = /*@__PURE__*/$constructor("$ZodISODate", (inst, def) => {
|
|
65692
|
+
def.pattern ?? (def.pattern = date$1);
|
|
65693
|
+
$ZodStringFormat.init(inst, def);
|
|
65694
|
+
});
|
|
65695
|
+
const $ZodISOTime = /*@__PURE__*/$constructor("$ZodISOTime", (inst, def) => {
|
|
65696
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
65697
|
+
$ZodStringFormat.init(inst, def);
|
|
65698
|
+
});
|
|
65699
|
+
const $ZodISODuration = /*@__PURE__*/$constructor("$ZodISODuration", (inst, def) => {
|
|
65700
|
+
def.pattern ?? (def.pattern = duration$1);
|
|
65701
|
+
$ZodStringFormat.init(inst, def);
|
|
65702
|
+
});
|
|
65703
|
+
const $ZodIPv4 = /*@__PURE__*/$constructor("$ZodIPv4", (inst, def) => {
|
|
65704
|
+
def.pattern ?? (def.pattern = ipv4$1);
|
|
65705
|
+
$ZodStringFormat.init(inst, def);
|
|
65706
|
+
inst._zod.onattach.push(inst => {
|
|
65707
|
+
const bag = inst._zod.bag;
|
|
65708
|
+
bag.format = `ipv4`;
|
|
65709
|
+
});
|
|
65710
|
+
});
|
|
65711
|
+
const $ZodIPv6 = /*@__PURE__*/$constructor("$ZodIPv6", (inst, def) => {
|
|
65712
|
+
def.pattern ?? (def.pattern = ipv6$1);
|
|
65713
|
+
$ZodStringFormat.init(inst, def);
|
|
65714
|
+
inst._zod.onattach.push(inst => {
|
|
65715
|
+
const bag = inst._zod.bag;
|
|
65716
|
+
bag.format = `ipv6`;
|
|
65717
|
+
});
|
|
65718
|
+
inst._zod.check = payload => {
|
|
65719
|
+
try {
|
|
65720
|
+
// @ts-ignore
|
|
65721
|
+
new URL(`http://[${payload.value}]`);
|
|
65722
|
+
// return;
|
|
65723
|
+
} catch {
|
|
65724
|
+
payload.issues.push({
|
|
65725
|
+
code: "invalid_format",
|
|
65726
|
+
format: "ipv6",
|
|
65727
|
+
input: payload.value,
|
|
65728
|
+
inst,
|
|
65729
|
+
continue: !def.abort
|
|
65730
|
+
});
|
|
65731
|
+
}
|
|
65732
|
+
};
|
|
65733
|
+
});
|
|
65734
|
+
const $ZodCIDRv4 = /*@__PURE__*/$constructor("$ZodCIDRv4", (inst, def) => {
|
|
65735
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
65736
|
+
$ZodStringFormat.init(inst, def);
|
|
65737
|
+
});
|
|
65738
|
+
const $ZodCIDRv6 = /*@__PURE__*/$constructor("$ZodCIDRv6", (inst, def) => {
|
|
65739
|
+
def.pattern ?? (def.pattern = cidrv6); // not used for validation
|
|
65740
|
+
$ZodStringFormat.init(inst, def);
|
|
65741
|
+
inst._zod.check = payload => {
|
|
65742
|
+
const [address, prefix] = payload.value.split("/");
|
|
65743
|
+
try {
|
|
65744
|
+
if (!prefix) throw new Error();
|
|
65745
|
+
const prefixNum = Number(prefix);
|
|
65746
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
65747
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
65748
|
+
// @ts-ignore
|
|
65749
|
+
new URL(`http://[${address}]`);
|
|
65750
|
+
} catch {
|
|
65751
|
+
payload.issues.push({
|
|
65752
|
+
code: "invalid_format",
|
|
65753
|
+
format: "cidrv6",
|
|
65754
|
+
input: payload.value,
|
|
65755
|
+
inst,
|
|
65756
|
+
continue: !def.abort
|
|
65757
|
+
});
|
|
65758
|
+
}
|
|
65759
|
+
};
|
|
65760
|
+
});
|
|
65761
|
+
////////////////////////////// ZodBase64 //////////////////////////////
|
|
65762
|
+
function isValidBase64(data) {
|
|
65763
|
+
if (data === "") return true;
|
|
65764
|
+
if (data.length % 4 !== 0) return false;
|
|
65765
|
+
try {
|
|
65766
|
+
// @ts-ignore
|
|
65767
|
+
atob(data);
|
|
65768
|
+
return true;
|
|
65769
|
+
} catch {
|
|
65770
|
+
return false;
|
|
65771
|
+
}
|
|
65772
|
+
}
|
|
65773
|
+
const $ZodBase64 = /*@__PURE__*/$constructor("$ZodBase64", (inst, def) => {
|
|
65774
|
+
def.pattern ?? (def.pattern = base64);
|
|
65775
|
+
$ZodStringFormat.init(inst, def);
|
|
65776
|
+
inst._zod.onattach.push(inst => {
|
|
65777
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
65778
|
+
});
|
|
65779
|
+
inst._zod.check = payload => {
|
|
65780
|
+
if (isValidBase64(payload.value)) return;
|
|
65781
|
+
payload.issues.push({
|
|
65782
|
+
code: "invalid_format",
|
|
65783
|
+
format: "base64",
|
|
65784
|
+
input: payload.value,
|
|
65785
|
+
inst,
|
|
65786
|
+
continue: !def.abort
|
|
65787
|
+
});
|
|
65788
|
+
};
|
|
65789
|
+
});
|
|
65790
|
+
////////////////////////////// ZodBase64 //////////////////////////////
|
|
65791
|
+
function isValidBase64URL(data) {
|
|
65792
|
+
if (!base64url.test(data)) return false;
|
|
65793
|
+
const base64 = data.replace(/[-_]/g, c => c === "-" ? "+" : "/");
|
|
65794
|
+
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
65795
|
+
return isValidBase64(padded);
|
|
65796
|
+
}
|
|
65797
|
+
const $ZodBase64URL = /*@__PURE__*/$constructor("$ZodBase64URL", (inst, def) => {
|
|
65798
|
+
def.pattern ?? (def.pattern = base64url);
|
|
65799
|
+
$ZodStringFormat.init(inst, def);
|
|
65800
|
+
inst._zod.onattach.push(inst => {
|
|
65801
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
65802
|
+
});
|
|
65803
|
+
inst._zod.check = payload => {
|
|
65804
|
+
if (isValidBase64URL(payload.value)) return;
|
|
65805
|
+
payload.issues.push({
|
|
65806
|
+
code: "invalid_format",
|
|
65807
|
+
format: "base64url",
|
|
65808
|
+
input: payload.value,
|
|
65809
|
+
inst,
|
|
65810
|
+
continue: !def.abort
|
|
65811
|
+
});
|
|
65812
|
+
};
|
|
65813
|
+
});
|
|
65814
|
+
const $ZodE164 = /*@__PURE__*/$constructor("$ZodE164", (inst, def) => {
|
|
65815
|
+
def.pattern ?? (def.pattern = e164);
|
|
65816
|
+
$ZodStringFormat.init(inst, def);
|
|
65817
|
+
});
|
|
65818
|
+
////////////////////////////// ZodJWT //////////////////////////////
|
|
65819
|
+
function isValidJWT(token, algorithm = null) {
|
|
65820
|
+
try {
|
|
65821
|
+
const tokensParts = token.split(".");
|
|
65822
|
+
if (tokensParts.length !== 3) return false;
|
|
65823
|
+
const [header] = tokensParts;
|
|
65824
|
+
if (!header) return false;
|
|
65825
|
+
// @ts-ignore
|
|
65826
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
65827
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
65828
|
+
if (!parsedHeader.alg) return false;
|
|
65829
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
65830
|
+
return true;
|
|
65831
|
+
} catch {
|
|
65832
|
+
return false;
|
|
65833
|
+
}
|
|
65834
|
+
}
|
|
65835
|
+
const $ZodJWT = /*@__PURE__*/$constructor("$ZodJWT", (inst, def) => {
|
|
65836
|
+
$ZodStringFormat.init(inst, def);
|
|
65837
|
+
inst._zod.check = payload => {
|
|
65838
|
+
if (isValidJWT(payload.value, def.alg)) return;
|
|
65839
|
+
payload.issues.push({
|
|
65840
|
+
code: "invalid_format",
|
|
65841
|
+
format: "jwt",
|
|
65842
|
+
input: payload.value,
|
|
65843
|
+
inst,
|
|
65844
|
+
continue: !def.abort
|
|
65845
|
+
});
|
|
65846
|
+
};
|
|
65847
|
+
});
|
|
65848
|
+
const $ZodUnknown = /*@__PURE__*/$constructor("$ZodUnknown", (inst, def) => {
|
|
65849
|
+
$ZodType.init(inst, def);
|
|
65850
|
+
inst._zod.parse = payload => payload;
|
|
65851
|
+
});
|
|
65852
|
+
const $ZodNever = /*@__PURE__*/$constructor("$ZodNever", (inst, def) => {
|
|
65853
|
+
$ZodType.init(inst, def);
|
|
65854
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
65855
|
+
payload.issues.push({
|
|
65856
|
+
expected: "never",
|
|
65857
|
+
code: "invalid_type",
|
|
65858
|
+
input: payload.value,
|
|
65859
|
+
inst
|
|
65860
|
+
});
|
|
65861
|
+
return payload;
|
|
65862
|
+
};
|
|
65863
|
+
});
|
|
65864
|
+
function handleArrayResult(result, final, index) {
|
|
65865
|
+
if (result.issues.length) {
|
|
65866
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
65867
|
+
}
|
|
65868
|
+
final.value[index] = result.value;
|
|
65869
|
+
}
|
|
65870
|
+
const $ZodArray = /*@__PURE__*/$constructor("$ZodArray", (inst, def) => {
|
|
65871
|
+
$ZodType.init(inst, def);
|
|
65872
|
+
inst._zod.parse = (payload, ctx) => {
|
|
65873
|
+
const input = payload.value;
|
|
65874
|
+
if (!Array.isArray(input)) {
|
|
65875
|
+
payload.issues.push({
|
|
65876
|
+
expected: "array",
|
|
65877
|
+
code: "invalid_type",
|
|
65878
|
+
input,
|
|
65879
|
+
inst
|
|
65880
|
+
});
|
|
65881
|
+
return payload;
|
|
65882
|
+
}
|
|
65883
|
+
payload.value = Array(input.length);
|
|
65884
|
+
const proms = [];
|
|
65885
|
+
for (let i = 0; i < input.length; i++) {
|
|
65886
|
+
const item = input[i];
|
|
65887
|
+
const result = def.element._zod.run({
|
|
65888
|
+
value: item,
|
|
65889
|
+
issues: []
|
|
65890
|
+
}, ctx);
|
|
65891
|
+
if (result instanceof Promise) {
|
|
65892
|
+
proms.push(result.then(result => handleArrayResult(result, payload, i)));
|
|
65893
|
+
} else {
|
|
65894
|
+
handleArrayResult(result, payload, i);
|
|
65895
|
+
}
|
|
65896
|
+
}
|
|
65897
|
+
if (proms.length) {
|
|
65898
|
+
return Promise.all(proms).then(() => payload);
|
|
65899
|
+
}
|
|
65900
|
+
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
65901
|
+
};
|
|
65902
|
+
});
|
|
65903
|
+
function handlePropertyResult(result, final, key, input) {
|
|
65904
|
+
if (result.issues.length) {
|
|
65905
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
65906
|
+
}
|
|
65907
|
+
if (result.value === undefined) {
|
|
65908
|
+
if (key in input) {
|
|
65909
|
+
final.value[key] = undefined;
|
|
65910
|
+
}
|
|
65911
|
+
} else {
|
|
65912
|
+
final.value[key] = result.value;
|
|
65913
|
+
}
|
|
65914
|
+
}
|
|
65915
|
+
function normalizeDef(def) {
|
|
65916
|
+
const keys = Object.keys(def.shape);
|
|
65917
|
+
for (const k of keys) {
|
|
65918
|
+
if (!def.shape[k]._zod.traits.has("$ZodType")) {
|
|
65919
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
65920
|
+
}
|
|
65921
|
+
}
|
|
65922
|
+
const okeys = optionalKeys(def.shape);
|
|
65923
|
+
return {
|
|
65924
|
+
...def,
|
|
65925
|
+
keys,
|
|
65926
|
+
keySet: new Set(keys),
|
|
65927
|
+
numKeys: keys.length,
|
|
65928
|
+
optionalKeys: new Set(okeys)
|
|
65929
|
+
};
|
|
65930
|
+
}
|
|
65931
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
65932
|
+
const unrecognized = [];
|
|
65933
|
+
// iterate over input keys
|
|
65934
|
+
const keySet = def.keySet;
|
|
65935
|
+
const _catchall = def.catchall._zod;
|
|
65936
|
+
const t = _catchall.def.type;
|
|
65937
|
+
for (const key of Object.keys(input)) {
|
|
65938
|
+
if (keySet.has(key)) continue;
|
|
65939
|
+
if (t === "never") {
|
|
65940
|
+
unrecognized.push(key);
|
|
65941
|
+
continue;
|
|
65942
|
+
}
|
|
65943
|
+
const r = _catchall.run({
|
|
65944
|
+
value: input[key],
|
|
65945
|
+
issues: []
|
|
65946
|
+
}, ctx);
|
|
65947
|
+
if (r instanceof Promise) {
|
|
65948
|
+
proms.push(r.then(r => handlePropertyResult(r, payload, key, input)));
|
|
65949
|
+
} else {
|
|
65950
|
+
handlePropertyResult(r, payload, key, input);
|
|
65951
|
+
}
|
|
65952
|
+
}
|
|
65953
|
+
if (unrecognized.length) {
|
|
65954
|
+
payload.issues.push({
|
|
65955
|
+
code: "unrecognized_keys",
|
|
65956
|
+
keys: unrecognized,
|
|
65957
|
+
input,
|
|
65958
|
+
inst
|
|
65959
|
+
});
|
|
65960
|
+
}
|
|
65961
|
+
if (!proms.length) return payload;
|
|
65962
|
+
return Promise.all(proms).then(() => {
|
|
65963
|
+
return payload;
|
|
65964
|
+
});
|
|
65965
|
+
}
|
|
65966
|
+
const $ZodObject = /*@__PURE__*/$constructor("$ZodObject", (inst, def) => {
|
|
65967
|
+
// requires cast because technically $ZodObject doesn't extend
|
|
65968
|
+
$ZodType.init(inst, def);
|
|
65969
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
65970
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
65971
|
+
const shape = def.shape;
|
|
65972
|
+
const propValues = {};
|
|
65973
|
+
for (const key in shape) {
|
|
65974
|
+
const field = shape[key]._zod;
|
|
65975
|
+
if (field.values) {
|
|
65976
|
+
propValues[key] ?? (propValues[key] = new Set());
|
|
65977
|
+
for (const v of field.values) propValues[key].add(v);
|
|
65978
|
+
}
|
|
65979
|
+
}
|
|
65980
|
+
return propValues;
|
|
65981
|
+
});
|
|
65982
|
+
const isObject = isObject$1;
|
|
65983
|
+
const catchall = def.catchall;
|
|
65984
|
+
let value;
|
|
65985
|
+
inst._zod.parse = (payload, ctx) => {
|
|
65986
|
+
value ?? (value = _normalized.value);
|
|
65987
|
+
const input = payload.value;
|
|
65988
|
+
if (!isObject(input)) {
|
|
65989
|
+
payload.issues.push({
|
|
65990
|
+
expected: "object",
|
|
65991
|
+
code: "invalid_type",
|
|
65992
|
+
input,
|
|
65993
|
+
inst
|
|
65994
|
+
});
|
|
65995
|
+
return payload;
|
|
65996
|
+
}
|
|
65997
|
+
payload.value = {};
|
|
65998
|
+
const proms = [];
|
|
65999
|
+
const shape = value.shape;
|
|
66000
|
+
for (const key of value.keys) {
|
|
66001
|
+
const el = shape[key];
|
|
66002
|
+
const r = el._zod.run({
|
|
66003
|
+
value: input[key],
|
|
66004
|
+
issues: []
|
|
66005
|
+
}, ctx);
|
|
66006
|
+
if (r instanceof Promise) {
|
|
66007
|
+
proms.push(r.then(r => handlePropertyResult(r, payload, key, input)));
|
|
66008
|
+
} else {
|
|
66009
|
+
handlePropertyResult(r, payload, key, input);
|
|
66010
|
+
}
|
|
66011
|
+
}
|
|
66012
|
+
if (!catchall) {
|
|
66013
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
66014
|
+
}
|
|
66015
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
66016
|
+
};
|
|
66017
|
+
});
|
|
66018
|
+
const $ZodObjectJIT = /*@__PURE__*/$constructor("$ZodObjectJIT", (inst, def) => {
|
|
66019
|
+
// requires cast because technically $ZodObject doesn't extend
|
|
66020
|
+
$ZodObject.init(inst, def);
|
|
66021
|
+
const superParse = inst._zod.parse;
|
|
66022
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
66023
|
+
const generateFastpass = shape => {
|
|
66024
|
+
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
66025
|
+
const normalized = _normalized.value;
|
|
66026
|
+
const parseStr = key => {
|
|
66027
|
+
const k = esc(key);
|
|
66028
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
66029
|
+
};
|
|
66030
|
+
doc.write(`const input = payload.value;`);
|
|
66031
|
+
const ids = Object.create(null);
|
|
66032
|
+
let counter = 0;
|
|
66033
|
+
for (const key of normalized.keys) {
|
|
66034
|
+
ids[key] = `key_${counter++}`;
|
|
66035
|
+
}
|
|
66036
|
+
// A: preserve key order {
|
|
66037
|
+
doc.write(`const newResult = {}`);
|
|
66038
|
+
for (const key of normalized.keys) {
|
|
66039
|
+
const id = ids[key];
|
|
66040
|
+
const k = esc(key);
|
|
66041
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
66042
|
+
doc.write(`
|
|
66043
|
+
if (${id}.issues.length) {
|
|
66044
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
66045
|
+
...iss,
|
|
66046
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
66047
|
+
})));
|
|
66048
|
+
}
|
|
66049
|
+
|
|
66050
|
+
if (${id}.value === undefined) {
|
|
66051
|
+
if (${k} in input) {
|
|
66052
|
+
newResult[${k}] = undefined;
|
|
66053
|
+
}
|
|
66054
|
+
} else {
|
|
66055
|
+
newResult[${k}] = ${id}.value;
|
|
66056
|
+
}
|
|
66057
|
+
`);
|
|
66058
|
+
}
|
|
66059
|
+
doc.write(`payload.value = newResult;`);
|
|
66060
|
+
doc.write(`return payload;`);
|
|
66061
|
+
const fn = doc.compile();
|
|
66062
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
66063
|
+
};
|
|
66064
|
+
let fastpass;
|
|
66065
|
+
const isObject = isObject$1;
|
|
66066
|
+
const jit = !globalConfig.jitless;
|
|
66067
|
+
const allowsEval$1 = allowsEval;
|
|
66068
|
+
const fastEnabled = jit && allowsEval$1.value; // && !def.catchall;
|
|
66069
|
+
const catchall = def.catchall;
|
|
66070
|
+
let value;
|
|
66071
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66072
|
+
value ?? (value = _normalized.value);
|
|
66073
|
+
const input = payload.value;
|
|
66074
|
+
if (!isObject(input)) {
|
|
66075
|
+
payload.issues.push({
|
|
66076
|
+
expected: "object",
|
|
66077
|
+
code: "invalid_type",
|
|
66078
|
+
input,
|
|
66079
|
+
inst
|
|
66080
|
+
});
|
|
66081
|
+
return payload;
|
|
66082
|
+
}
|
|
66083
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
66084
|
+
// always synchronous
|
|
66085
|
+
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
66086
|
+
payload = fastpass(payload, ctx);
|
|
66087
|
+
if (!catchall) return payload;
|
|
66088
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
66089
|
+
}
|
|
66090
|
+
return superParse(payload, ctx);
|
|
66091
|
+
};
|
|
66092
|
+
});
|
|
66093
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
66094
|
+
for (const result of results) {
|
|
66095
|
+
if (result.issues.length === 0) {
|
|
66096
|
+
final.value = result.value;
|
|
66097
|
+
return final;
|
|
66098
|
+
}
|
|
66099
|
+
}
|
|
66100
|
+
const nonaborted = results.filter(r => !aborted(r));
|
|
66101
|
+
if (nonaborted.length === 1) {
|
|
66102
|
+
final.value = nonaborted[0].value;
|
|
66103
|
+
return nonaborted[0];
|
|
66104
|
+
}
|
|
66105
|
+
final.issues.push({
|
|
66106
|
+
code: "invalid_union",
|
|
66107
|
+
input: final.value,
|
|
66108
|
+
inst,
|
|
66109
|
+
errors: results.map(result => result.issues.map(iss => finalizeIssue(iss, ctx, config$2())))
|
|
66110
|
+
});
|
|
66111
|
+
return final;
|
|
66112
|
+
}
|
|
66113
|
+
const $ZodUnion = /*@__PURE__*/$constructor("$ZodUnion", (inst, def) => {
|
|
66114
|
+
$ZodType.init(inst, def);
|
|
66115
|
+
defineLazy(inst._zod, "optin", () => def.options.some(o => o._zod.optin === "optional") ? "optional" : undefined);
|
|
66116
|
+
defineLazy(inst._zod, "optout", () => def.options.some(o => o._zod.optout === "optional") ? "optional" : undefined);
|
|
66117
|
+
defineLazy(inst._zod, "values", () => {
|
|
66118
|
+
if (def.options.every(o => o._zod.values)) {
|
|
66119
|
+
return new Set(def.options.flatMap(option => Array.from(option._zod.values)));
|
|
66120
|
+
}
|
|
66121
|
+
return undefined;
|
|
66122
|
+
});
|
|
66123
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
66124
|
+
if (def.options.every(o => o._zod.pattern)) {
|
|
66125
|
+
const patterns = def.options.map(o => o._zod.pattern);
|
|
66126
|
+
return new RegExp(`^(${patterns.map(p => cleanRegex(p.source)).join("|")})$`);
|
|
66127
|
+
}
|
|
66128
|
+
return undefined;
|
|
66129
|
+
});
|
|
66130
|
+
const single = def.options.length === 1;
|
|
66131
|
+
const first = def.options[0]._zod.run;
|
|
66132
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66133
|
+
if (single) {
|
|
66134
|
+
return first(payload, ctx);
|
|
66135
|
+
}
|
|
66136
|
+
let async = false;
|
|
66137
|
+
const results = [];
|
|
66138
|
+
for (const option of def.options) {
|
|
66139
|
+
const result = option._zod.run({
|
|
66140
|
+
value: payload.value,
|
|
66141
|
+
issues: []
|
|
66142
|
+
}, ctx);
|
|
66143
|
+
if (result instanceof Promise) {
|
|
66144
|
+
results.push(result);
|
|
66145
|
+
async = true;
|
|
66146
|
+
} else {
|
|
66147
|
+
if (result.issues.length === 0) return result;
|
|
66148
|
+
results.push(result);
|
|
66149
|
+
}
|
|
66150
|
+
}
|
|
66151
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
66152
|
+
return Promise.all(results).then(results => {
|
|
66153
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
66154
|
+
});
|
|
66155
|
+
};
|
|
66156
|
+
});
|
|
66157
|
+
const $ZodIntersection = /*@__PURE__*/$constructor("$ZodIntersection", (inst, def) => {
|
|
66158
|
+
$ZodType.init(inst, def);
|
|
66159
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66160
|
+
const input = payload.value;
|
|
66161
|
+
const left = def.left._zod.run({
|
|
66162
|
+
value: input,
|
|
66163
|
+
issues: []
|
|
66164
|
+
}, ctx);
|
|
66165
|
+
const right = def.right._zod.run({
|
|
66166
|
+
value: input,
|
|
66167
|
+
issues: []
|
|
66168
|
+
}, ctx);
|
|
66169
|
+
const async = left instanceof Promise || right instanceof Promise;
|
|
66170
|
+
if (async) {
|
|
66171
|
+
return Promise.all([left, right]).then(([left, right]) => {
|
|
66172
|
+
return handleIntersectionResults(payload, left, right);
|
|
66173
|
+
});
|
|
66174
|
+
}
|
|
66175
|
+
return handleIntersectionResults(payload, left, right);
|
|
66176
|
+
};
|
|
66177
|
+
});
|
|
66178
|
+
function mergeValues(a, b) {
|
|
66179
|
+
// const aType = parse.t(a);
|
|
66180
|
+
// const bType = parse.t(b);
|
|
66181
|
+
if (a === b) {
|
|
66182
|
+
return {
|
|
66183
|
+
valid: true,
|
|
66184
|
+
data: a
|
|
66185
|
+
};
|
|
66186
|
+
}
|
|
66187
|
+
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
66188
|
+
return {
|
|
66189
|
+
valid: true,
|
|
66190
|
+
data: a
|
|
66191
|
+
};
|
|
66192
|
+
}
|
|
66193
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
66194
|
+
const bKeys = Object.keys(b);
|
|
66195
|
+
const sharedKeys = Object.keys(a).filter(key => bKeys.indexOf(key) !== -1);
|
|
66196
|
+
const newObj = {
|
|
66197
|
+
...a,
|
|
66198
|
+
...b
|
|
66199
|
+
};
|
|
66200
|
+
for (const key of sharedKeys) {
|
|
66201
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
66202
|
+
if (!sharedValue.valid) {
|
|
66203
|
+
return {
|
|
66204
|
+
valid: false,
|
|
66205
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
66206
|
+
};
|
|
66207
|
+
}
|
|
66208
|
+
newObj[key] = sharedValue.data;
|
|
66209
|
+
}
|
|
66210
|
+
return {
|
|
66211
|
+
valid: true,
|
|
66212
|
+
data: newObj
|
|
66213
|
+
};
|
|
66214
|
+
}
|
|
66215
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
66216
|
+
if (a.length !== b.length) {
|
|
66217
|
+
return {
|
|
66218
|
+
valid: false,
|
|
66219
|
+
mergeErrorPath: []
|
|
66220
|
+
};
|
|
66221
|
+
}
|
|
66222
|
+
const newArray = [];
|
|
66223
|
+
for (let index = 0; index < a.length; index++) {
|
|
66224
|
+
const itemA = a[index];
|
|
66225
|
+
const itemB = b[index];
|
|
66226
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
66227
|
+
if (!sharedValue.valid) {
|
|
66228
|
+
return {
|
|
66229
|
+
valid: false,
|
|
66230
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
66231
|
+
};
|
|
66232
|
+
}
|
|
66233
|
+
newArray.push(sharedValue.data);
|
|
66234
|
+
}
|
|
66235
|
+
return {
|
|
66236
|
+
valid: true,
|
|
66237
|
+
data: newArray
|
|
66238
|
+
};
|
|
66239
|
+
}
|
|
66240
|
+
return {
|
|
66241
|
+
valid: false,
|
|
66242
|
+
mergeErrorPath: []
|
|
66243
|
+
};
|
|
66244
|
+
}
|
|
66245
|
+
function handleIntersectionResults(result, left, right) {
|
|
66246
|
+
if (left.issues.length) {
|
|
66247
|
+
result.issues.push(...left.issues);
|
|
66248
|
+
}
|
|
66249
|
+
if (right.issues.length) {
|
|
66250
|
+
result.issues.push(...right.issues);
|
|
66251
|
+
}
|
|
66252
|
+
if (aborted(result)) return result;
|
|
66253
|
+
const merged = mergeValues(left.value, right.value);
|
|
66254
|
+
if (!merged.valid) {
|
|
66255
|
+
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
66256
|
+
}
|
|
66257
|
+
result.value = merged.data;
|
|
66258
|
+
return result;
|
|
66259
|
+
}
|
|
66260
|
+
const $ZodRecord = /*@__PURE__*/$constructor("$ZodRecord", (inst, def) => {
|
|
66261
|
+
$ZodType.init(inst, def);
|
|
66262
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66263
|
+
const input = payload.value;
|
|
66264
|
+
if (!isPlainObject(input)) {
|
|
66265
|
+
payload.issues.push({
|
|
66266
|
+
expected: "record",
|
|
66267
|
+
code: "invalid_type",
|
|
66268
|
+
input,
|
|
66269
|
+
inst
|
|
66270
|
+
});
|
|
66271
|
+
return payload;
|
|
66272
|
+
}
|
|
66273
|
+
const proms = [];
|
|
66274
|
+
if (def.keyType._zod.values) {
|
|
66275
|
+
const values = def.keyType._zod.values;
|
|
66276
|
+
payload.value = {};
|
|
66277
|
+
for (const key of values) {
|
|
66278
|
+
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
66279
|
+
const result = def.valueType._zod.run({
|
|
66280
|
+
value: input[key],
|
|
66281
|
+
issues: []
|
|
66282
|
+
}, ctx);
|
|
66283
|
+
if (result instanceof Promise) {
|
|
66284
|
+
proms.push(result.then(result => {
|
|
66285
|
+
if (result.issues.length) {
|
|
66286
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
66287
|
+
}
|
|
66288
|
+
payload.value[key] = result.value;
|
|
66289
|
+
}));
|
|
66290
|
+
} else {
|
|
66291
|
+
if (result.issues.length) {
|
|
66292
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
66293
|
+
}
|
|
66294
|
+
payload.value[key] = result.value;
|
|
66295
|
+
}
|
|
66296
|
+
}
|
|
66297
|
+
}
|
|
66298
|
+
let unrecognized;
|
|
66299
|
+
for (const key in input) {
|
|
66300
|
+
if (!values.has(key)) {
|
|
66301
|
+
unrecognized = unrecognized ?? [];
|
|
66302
|
+
unrecognized.push(key);
|
|
66303
|
+
}
|
|
66304
|
+
}
|
|
66305
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
66306
|
+
payload.issues.push({
|
|
66307
|
+
code: "unrecognized_keys",
|
|
66308
|
+
input,
|
|
66309
|
+
inst,
|
|
66310
|
+
keys: unrecognized
|
|
66311
|
+
});
|
|
66312
|
+
}
|
|
66313
|
+
} else {
|
|
66314
|
+
payload.value = {};
|
|
66315
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
66316
|
+
if (key === "__proto__") continue;
|
|
66317
|
+
const keyResult = def.keyType._zod.run({
|
|
66318
|
+
value: key,
|
|
66319
|
+
issues: []
|
|
66320
|
+
}, ctx);
|
|
66321
|
+
if (keyResult instanceof Promise) {
|
|
66322
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
66323
|
+
}
|
|
66324
|
+
if (keyResult.issues.length) {
|
|
66325
|
+
payload.issues.push({
|
|
66326
|
+
code: "invalid_key",
|
|
66327
|
+
origin: "record",
|
|
66328
|
+
issues: keyResult.issues.map(iss => finalizeIssue(iss, ctx, config$2())),
|
|
66329
|
+
input: key,
|
|
66330
|
+
path: [key],
|
|
66331
|
+
inst
|
|
66332
|
+
});
|
|
66333
|
+
payload.value[keyResult.value] = keyResult.value;
|
|
66334
|
+
continue;
|
|
66335
|
+
}
|
|
66336
|
+
const result = def.valueType._zod.run({
|
|
66337
|
+
value: input[key],
|
|
66338
|
+
issues: []
|
|
66339
|
+
}, ctx);
|
|
66340
|
+
if (result instanceof Promise) {
|
|
66341
|
+
proms.push(result.then(result => {
|
|
66342
|
+
if (result.issues.length) {
|
|
66343
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
66344
|
+
}
|
|
66345
|
+
payload.value[keyResult.value] = result.value;
|
|
66346
|
+
}));
|
|
66347
|
+
} else {
|
|
66348
|
+
if (result.issues.length) {
|
|
66349
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
66350
|
+
}
|
|
66351
|
+
payload.value[keyResult.value] = result.value;
|
|
66352
|
+
}
|
|
66353
|
+
}
|
|
66354
|
+
}
|
|
66355
|
+
if (proms.length) {
|
|
66356
|
+
return Promise.all(proms).then(() => payload);
|
|
66357
|
+
}
|
|
66358
|
+
return payload;
|
|
66359
|
+
};
|
|
66360
|
+
});
|
|
66361
|
+
const $ZodEnum = /*@__PURE__*/$constructor("$ZodEnum", (inst, def) => {
|
|
66362
|
+
$ZodType.init(inst, def);
|
|
66363
|
+
const values = getEnumValues(def.entries);
|
|
66364
|
+
const valuesSet = new Set(values);
|
|
66365
|
+
inst._zod.values = valuesSet;
|
|
66366
|
+
inst._zod.pattern = new RegExp(`^(${values.filter(k => propertyKeyTypes.has(typeof k)).map(o => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
66367
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
66368
|
+
const input = payload.value;
|
|
66369
|
+
if (valuesSet.has(input)) {
|
|
66370
|
+
return payload;
|
|
66371
|
+
}
|
|
66372
|
+
payload.issues.push({
|
|
66373
|
+
code: "invalid_value",
|
|
66374
|
+
values,
|
|
66375
|
+
input,
|
|
66376
|
+
inst
|
|
66377
|
+
});
|
|
66378
|
+
return payload;
|
|
66379
|
+
};
|
|
66380
|
+
});
|
|
66381
|
+
const $ZodTransform = /*@__PURE__*/$constructor("$ZodTransform", (inst, def) => {
|
|
66382
|
+
$ZodType.init(inst, def);
|
|
66383
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66384
|
+
if (ctx.direction === "backward") {
|
|
66385
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
66386
|
+
}
|
|
66387
|
+
const _out = def.transform(payload.value, payload);
|
|
66388
|
+
if (ctx.async) {
|
|
66389
|
+
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
66390
|
+
return output.then(output => {
|
|
66391
|
+
payload.value = output;
|
|
66392
|
+
return payload;
|
|
66393
|
+
});
|
|
66394
|
+
}
|
|
66395
|
+
if (_out instanceof Promise) {
|
|
66396
|
+
throw new $ZodAsyncError();
|
|
66397
|
+
}
|
|
66398
|
+
payload.value = _out;
|
|
66399
|
+
return payload;
|
|
66400
|
+
};
|
|
66401
|
+
});
|
|
66402
|
+
function handleOptionalResult(result, input) {
|
|
66403
|
+
if (result.issues.length && input === undefined) {
|
|
66404
|
+
return {
|
|
66405
|
+
issues: [],
|
|
66406
|
+
value: undefined
|
|
66407
|
+
};
|
|
66408
|
+
}
|
|
66409
|
+
return result;
|
|
66410
|
+
}
|
|
66411
|
+
const $ZodOptional = /*@__PURE__*/$constructor("$ZodOptional", (inst, def) => {
|
|
66412
|
+
$ZodType.init(inst, def);
|
|
66413
|
+
inst._zod.optin = "optional";
|
|
66414
|
+
inst._zod.optout = "optional";
|
|
66415
|
+
defineLazy(inst._zod, "values", () => {
|
|
66416
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
|
|
66417
|
+
});
|
|
66418
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
66419
|
+
const pattern = def.innerType._zod.pattern;
|
|
66420
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
|
|
66421
|
+
});
|
|
66422
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66423
|
+
if (def.innerType._zod.optin === "optional") {
|
|
66424
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
66425
|
+
if (result instanceof Promise) return result.then(r => handleOptionalResult(r, payload.value));
|
|
66426
|
+
return handleOptionalResult(result, payload.value);
|
|
66427
|
+
}
|
|
66428
|
+
if (payload.value === undefined) {
|
|
66429
|
+
return payload;
|
|
66430
|
+
}
|
|
66431
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66432
|
+
};
|
|
66433
|
+
});
|
|
66434
|
+
const $ZodNullable = /*@__PURE__*/$constructor("$ZodNullable", (inst, def) => {
|
|
66435
|
+
$ZodType.init(inst, def);
|
|
66436
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
66437
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
66438
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
66439
|
+
const pattern = def.innerType._zod.pattern;
|
|
66440
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
66441
|
+
});
|
|
66442
|
+
defineLazy(inst._zod, "values", () => {
|
|
66443
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
66444
|
+
});
|
|
66445
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66446
|
+
// Forward direction (decode): allow null to pass through
|
|
66447
|
+
if (payload.value === null) return payload;
|
|
66448
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66449
|
+
};
|
|
66450
|
+
});
|
|
66451
|
+
const $ZodDefault = /*@__PURE__*/$constructor("$ZodDefault", (inst, def) => {
|
|
66452
|
+
$ZodType.init(inst, def);
|
|
66453
|
+
// inst._zod.qin = "true";
|
|
66454
|
+
inst._zod.optin = "optional";
|
|
66455
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
66456
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66457
|
+
if (ctx.direction === "backward") {
|
|
66458
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66459
|
+
}
|
|
66460
|
+
// Forward direction (decode): apply defaults for undefined input
|
|
66461
|
+
if (payload.value === undefined) {
|
|
66462
|
+
payload.value = def.defaultValue;
|
|
66463
|
+
/**
|
|
66464
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
66465
|
+
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
66466
|
+
return payload;
|
|
66467
|
+
}
|
|
66468
|
+
// Forward direction: continue with default handling
|
|
66469
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
66470
|
+
if (result instanceof Promise) {
|
|
66471
|
+
return result.then(result => handleDefaultResult(result, def));
|
|
66472
|
+
}
|
|
66473
|
+
return handleDefaultResult(result, def);
|
|
66474
|
+
};
|
|
66475
|
+
});
|
|
66476
|
+
function handleDefaultResult(payload, def) {
|
|
66477
|
+
if (payload.value === undefined) {
|
|
66478
|
+
payload.value = def.defaultValue;
|
|
66479
|
+
}
|
|
66480
|
+
return payload;
|
|
66481
|
+
}
|
|
66482
|
+
const $ZodPrefault = /*@__PURE__*/$constructor("$ZodPrefault", (inst, def) => {
|
|
66483
|
+
$ZodType.init(inst, def);
|
|
66484
|
+
inst._zod.optin = "optional";
|
|
66485
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
66486
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66487
|
+
if (ctx.direction === "backward") {
|
|
66488
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66489
|
+
}
|
|
66490
|
+
// Forward direction (decode): apply prefault for undefined input
|
|
66491
|
+
if (payload.value === undefined) {
|
|
66492
|
+
payload.value = def.defaultValue;
|
|
66493
|
+
}
|
|
66494
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66495
|
+
};
|
|
66496
|
+
});
|
|
66497
|
+
const $ZodNonOptional = /*@__PURE__*/$constructor("$ZodNonOptional", (inst, def) => {
|
|
66498
|
+
$ZodType.init(inst, def);
|
|
66499
|
+
defineLazy(inst._zod, "values", () => {
|
|
66500
|
+
const v = def.innerType._zod.values;
|
|
66501
|
+
return v ? new Set([...v].filter(x => x !== undefined)) : undefined;
|
|
66502
|
+
});
|
|
66503
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66504
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
66505
|
+
if (result instanceof Promise) {
|
|
66506
|
+
return result.then(result => handleNonOptionalResult(result, inst));
|
|
66507
|
+
}
|
|
66508
|
+
return handleNonOptionalResult(result, inst);
|
|
66509
|
+
};
|
|
66510
|
+
});
|
|
66511
|
+
function handleNonOptionalResult(payload, inst) {
|
|
66512
|
+
if (!payload.issues.length && payload.value === undefined) {
|
|
66513
|
+
payload.issues.push({
|
|
66514
|
+
code: "invalid_type",
|
|
66515
|
+
expected: "nonoptional",
|
|
66516
|
+
input: payload.value,
|
|
66517
|
+
inst
|
|
66518
|
+
});
|
|
66519
|
+
}
|
|
66520
|
+
return payload;
|
|
66521
|
+
}
|
|
66522
|
+
const $ZodCatch = /*@__PURE__*/$constructor("$ZodCatch", (inst, def) => {
|
|
66523
|
+
$ZodType.init(inst, def);
|
|
66524
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
66525
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
66526
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
66527
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66528
|
+
if (ctx.direction === "backward") {
|
|
66529
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66530
|
+
}
|
|
66531
|
+
// Forward direction (decode): apply catch logic
|
|
66532
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
66533
|
+
if (result instanceof Promise) {
|
|
66534
|
+
return result.then(result => {
|
|
66535
|
+
payload.value = result.value;
|
|
66536
|
+
if (result.issues.length) {
|
|
66537
|
+
payload.value = def.catchValue({
|
|
66538
|
+
...payload,
|
|
66539
|
+
error: {
|
|
66540
|
+
issues: result.issues.map(iss => finalizeIssue(iss, ctx, config$2()))
|
|
66541
|
+
},
|
|
66542
|
+
input: payload.value
|
|
66543
|
+
});
|
|
66544
|
+
payload.issues = [];
|
|
66545
|
+
}
|
|
66546
|
+
return payload;
|
|
66547
|
+
});
|
|
66548
|
+
}
|
|
66549
|
+
payload.value = result.value;
|
|
66550
|
+
if (result.issues.length) {
|
|
66551
|
+
payload.value = def.catchValue({
|
|
66552
|
+
...payload,
|
|
66553
|
+
error: {
|
|
66554
|
+
issues: result.issues.map(iss => finalizeIssue(iss, ctx, config$2()))
|
|
66555
|
+
},
|
|
66556
|
+
input: payload.value
|
|
66557
|
+
});
|
|
66558
|
+
payload.issues = [];
|
|
66559
|
+
}
|
|
66560
|
+
return payload;
|
|
66561
|
+
};
|
|
66562
|
+
});
|
|
66563
|
+
const $ZodPipe = /*@__PURE__*/$constructor("$ZodPipe", (inst, def) => {
|
|
66564
|
+
$ZodType.init(inst, def);
|
|
66565
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
66566
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
66567
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
66568
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
66569
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66570
|
+
if (ctx.direction === "backward") {
|
|
66571
|
+
const right = def.out._zod.run(payload, ctx);
|
|
66572
|
+
if (right instanceof Promise) {
|
|
66573
|
+
return right.then(right => handlePipeResult(right, def.in, ctx));
|
|
66574
|
+
}
|
|
66575
|
+
return handlePipeResult(right, def.in, ctx);
|
|
66576
|
+
}
|
|
66577
|
+
const left = def.in._zod.run(payload, ctx);
|
|
66578
|
+
if (left instanceof Promise) {
|
|
66579
|
+
return left.then(left => handlePipeResult(left, def.out, ctx));
|
|
66580
|
+
}
|
|
66581
|
+
return handlePipeResult(left, def.out, ctx);
|
|
66582
|
+
};
|
|
66583
|
+
});
|
|
66584
|
+
function handlePipeResult(left, next, ctx) {
|
|
66585
|
+
if (left.issues.length) {
|
|
66586
|
+
// prevent further checks
|
|
66587
|
+
left.aborted = true;
|
|
66588
|
+
return left;
|
|
66589
|
+
}
|
|
66590
|
+
return next._zod.run({
|
|
66591
|
+
value: left.value,
|
|
66592
|
+
issues: left.issues
|
|
66593
|
+
}, ctx);
|
|
66594
|
+
}
|
|
66595
|
+
const $ZodReadonly = /*@__PURE__*/$constructor("$ZodReadonly", (inst, def) => {
|
|
66596
|
+
$ZodType.init(inst, def);
|
|
66597
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
66598
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
66599
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
66600
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
66601
|
+
inst._zod.parse = (payload, ctx) => {
|
|
66602
|
+
if (ctx.direction === "backward") {
|
|
66603
|
+
return def.innerType._zod.run(payload, ctx);
|
|
66604
|
+
}
|
|
66605
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
66606
|
+
if (result instanceof Promise) {
|
|
66607
|
+
return result.then(handleReadonlyResult);
|
|
66608
|
+
}
|
|
66609
|
+
return handleReadonlyResult(result);
|
|
66610
|
+
};
|
|
66611
|
+
});
|
|
66612
|
+
function handleReadonlyResult(payload) {
|
|
66613
|
+
payload.value = Object.freeze(payload.value);
|
|
66614
|
+
return payload;
|
|
66615
|
+
}
|
|
66616
|
+
const $ZodCustom = /*@__PURE__*/$constructor("$ZodCustom", (inst, def) => {
|
|
66617
|
+
$ZodCheck.init(inst, def);
|
|
66618
|
+
$ZodType.init(inst, def);
|
|
66619
|
+
inst._zod.parse = (payload, _) => {
|
|
66620
|
+
return payload;
|
|
66621
|
+
};
|
|
66622
|
+
inst._zod.check = payload => {
|
|
66623
|
+
const input = payload.value;
|
|
66624
|
+
const r = def.fn(input);
|
|
66625
|
+
if (r instanceof Promise) {
|
|
66626
|
+
return r.then(r => handleRefineResult(r, payload, input, inst));
|
|
66627
|
+
}
|
|
66628
|
+
handleRefineResult(r, payload, input, inst);
|
|
66629
|
+
return;
|
|
66630
|
+
};
|
|
66631
|
+
});
|
|
66632
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
66633
|
+
if (!result) {
|
|
66634
|
+
const _iss = {
|
|
66635
|
+
code: "custom",
|
|
66636
|
+
input,
|
|
66637
|
+
inst,
|
|
66638
|
+
// incorporates params.error into issue reporting
|
|
66639
|
+
path: [...(inst._zod.def.path ?? [])],
|
|
66640
|
+
// incorporates params.error into issue reporting
|
|
66641
|
+
continue: !inst._zod.def.abort
|
|
66642
|
+
// params: inst._zod.def.params,
|
|
66643
|
+
};
|
|
66644
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
66645
|
+
payload.issues.push(issue(_iss));
|
|
66646
|
+
}
|
|
66647
|
+
}
|
|
66648
|
+
|
|
66649
|
+
class $ZodRegistry {
|
|
66650
|
+
constructor() {
|
|
66651
|
+
this._map = new Map();
|
|
66652
|
+
this._idmap = new Map();
|
|
66653
|
+
}
|
|
66654
|
+
add(schema, ..._meta) {
|
|
66655
|
+
const meta = _meta[0];
|
|
66656
|
+
this._map.set(schema, meta);
|
|
66657
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
66658
|
+
if (this._idmap.has(meta.id)) {
|
|
66659
|
+
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
66660
|
+
}
|
|
66661
|
+
this._idmap.set(meta.id, schema);
|
|
66662
|
+
}
|
|
66663
|
+
return this;
|
|
66664
|
+
}
|
|
66665
|
+
clear() {
|
|
66666
|
+
this._map = new Map();
|
|
66667
|
+
this._idmap = new Map();
|
|
66668
|
+
return this;
|
|
66669
|
+
}
|
|
66670
|
+
remove(schema) {
|
|
66671
|
+
const meta = this._map.get(schema);
|
|
66672
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
66673
|
+
this._idmap.delete(meta.id);
|
|
66674
|
+
}
|
|
66675
|
+
this._map.delete(schema);
|
|
66676
|
+
return this;
|
|
66677
|
+
}
|
|
66678
|
+
get(schema) {
|
|
66679
|
+
// return this._map.get(schema) as any;
|
|
66680
|
+
// inherit metadata
|
|
66681
|
+
const p = schema._zod.parent;
|
|
66682
|
+
if (p) {
|
|
66683
|
+
const pm = {
|
|
66684
|
+
...(this.get(p) ?? {})
|
|
66685
|
+
};
|
|
66686
|
+
delete pm.id; // do not inherit id
|
|
66687
|
+
const f = {
|
|
66688
|
+
...pm,
|
|
66689
|
+
...this._map.get(schema)
|
|
66690
|
+
};
|
|
66691
|
+
return Object.keys(f).length ? f : undefined;
|
|
66692
|
+
}
|
|
66693
|
+
return this._map.get(schema);
|
|
66694
|
+
}
|
|
66695
|
+
has(schema) {
|
|
66696
|
+
return this._map.has(schema);
|
|
66697
|
+
}
|
|
66698
|
+
}
|
|
66699
|
+
// registries
|
|
66700
|
+
function registry$1() {
|
|
66701
|
+
return new $ZodRegistry();
|
|
66702
|
+
}
|
|
66703
|
+
const globalRegistry = /*@__PURE__*/registry$1();
|
|
66704
|
+
|
|
66705
|
+
function _string(Class, params) {
|
|
66706
|
+
return new Class({
|
|
66707
|
+
type: "string",
|
|
66708
|
+
...normalizeParams(params)
|
|
66709
|
+
});
|
|
66710
|
+
}
|
|
66711
|
+
function _email(Class, params) {
|
|
66712
|
+
return new Class({
|
|
66713
|
+
type: "string",
|
|
66714
|
+
format: "email",
|
|
66715
|
+
check: "string_format",
|
|
66716
|
+
abort: false,
|
|
66717
|
+
...normalizeParams(params)
|
|
66718
|
+
});
|
|
66719
|
+
}
|
|
66720
|
+
function _guid(Class, params) {
|
|
66721
|
+
return new Class({
|
|
66722
|
+
type: "string",
|
|
66723
|
+
format: "guid",
|
|
66724
|
+
check: "string_format",
|
|
66725
|
+
abort: false,
|
|
66726
|
+
...normalizeParams(params)
|
|
66727
|
+
});
|
|
66728
|
+
}
|
|
66729
|
+
function _uuid(Class, params) {
|
|
66730
|
+
return new Class({
|
|
66731
|
+
type: "string",
|
|
66732
|
+
format: "uuid",
|
|
66733
|
+
check: "string_format",
|
|
66734
|
+
abort: false,
|
|
66735
|
+
...normalizeParams(params)
|
|
66736
|
+
});
|
|
66737
|
+
}
|
|
66738
|
+
function _uuidv4(Class, params) {
|
|
66739
|
+
return new Class({
|
|
66740
|
+
type: "string",
|
|
66741
|
+
format: "uuid",
|
|
66742
|
+
check: "string_format",
|
|
66743
|
+
abort: false,
|
|
66744
|
+
version: "v4",
|
|
66745
|
+
...normalizeParams(params)
|
|
66746
|
+
});
|
|
66747
|
+
}
|
|
66748
|
+
function _uuidv6(Class, params) {
|
|
66749
|
+
return new Class({
|
|
66750
|
+
type: "string",
|
|
66751
|
+
format: "uuid",
|
|
66752
|
+
check: "string_format",
|
|
66753
|
+
abort: false,
|
|
66754
|
+
version: "v6",
|
|
66755
|
+
...normalizeParams(params)
|
|
66756
|
+
});
|
|
66757
|
+
}
|
|
66758
|
+
function _uuidv7(Class, params) {
|
|
66759
|
+
return new Class({
|
|
66760
|
+
type: "string",
|
|
66761
|
+
format: "uuid",
|
|
66762
|
+
check: "string_format",
|
|
66763
|
+
abort: false,
|
|
66764
|
+
version: "v7",
|
|
66765
|
+
...normalizeParams(params)
|
|
66766
|
+
});
|
|
66767
|
+
}
|
|
66768
|
+
function _url(Class, params) {
|
|
66769
|
+
return new Class({
|
|
66770
|
+
type: "string",
|
|
66771
|
+
format: "url",
|
|
66772
|
+
check: "string_format",
|
|
66773
|
+
abort: false,
|
|
66774
|
+
...normalizeParams(params)
|
|
66775
|
+
});
|
|
66776
|
+
}
|
|
66777
|
+
function _emoji(Class, params) {
|
|
66778
|
+
return new Class({
|
|
66779
|
+
type: "string",
|
|
66780
|
+
format: "emoji",
|
|
66781
|
+
check: "string_format",
|
|
66782
|
+
abort: false,
|
|
66783
|
+
...normalizeParams(params)
|
|
66784
|
+
});
|
|
66785
|
+
}
|
|
66786
|
+
function _nanoid(Class, params) {
|
|
66787
|
+
return new Class({
|
|
66788
|
+
type: "string",
|
|
66789
|
+
format: "nanoid",
|
|
66790
|
+
check: "string_format",
|
|
66791
|
+
abort: false,
|
|
66792
|
+
...normalizeParams(params)
|
|
66793
|
+
});
|
|
66794
|
+
}
|
|
66795
|
+
function _cuid(Class, params) {
|
|
66796
|
+
return new Class({
|
|
66797
|
+
type: "string",
|
|
66798
|
+
format: "cuid",
|
|
66799
|
+
check: "string_format",
|
|
66800
|
+
abort: false,
|
|
66801
|
+
...normalizeParams(params)
|
|
66802
|
+
});
|
|
66803
|
+
}
|
|
66804
|
+
function _cuid2(Class, params) {
|
|
66805
|
+
return new Class({
|
|
66806
|
+
type: "string",
|
|
66807
|
+
format: "cuid2",
|
|
66808
|
+
check: "string_format",
|
|
66809
|
+
abort: false,
|
|
66810
|
+
...normalizeParams(params)
|
|
66811
|
+
});
|
|
66812
|
+
}
|
|
66813
|
+
function _ulid(Class, params) {
|
|
66814
|
+
return new Class({
|
|
66815
|
+
type: "string",
|
|
66816
|
+
format: "ulid",
|
|
66817
|
+
check: "string_format",
|
|
66818
|
+
abort: false,
|
|
66819
|
+
...normalizeParams(params)
|
|
66820
|
+
});
|
|
66821
|
+
}
|
|
66822
|
+
function _xid(Class, params) {
|
|
66823
|
+
return new Class({
|
|
66824
|
+
type: "string",
|
|
66825
|
+
format: "xid",
|
|
66826
|
+
check: "string_format",
|
|
66827
|
+
abort: false,
|
|
66828
|
+
...normalizeParams(params)
|
|
66829
|
+
});
|
|
66830
|
+
}
|
|
66831
|
+
function _ksuid(Class, params) {
|
|
66832
|
+
return new Class({
|
|
66833
|
+
type: "string",
|
|
66834
|
+
format: "ksuid",
|
|
66835
|
+
check: "string_format",
|
|
66836
|
+
abort: false,
|
|
66837
|
+
...normalizeParams(params)
|
|
66838
|
+
});
|
|
66839
|
+
}
|
|
66840
|
+
function _ipv4(Class, params) {
|
|
66841
|
+
return new Class({
|
|
66842
|
+
type: "string",
|
|
66843
|
+
format: "ipv4",
|
|
66844
|
+
check: "string_format",
|
|
66845
|
+
abort: false,
|
|
66846
|
+
...normalizeParams(params)
|
|
66847
|
+
});
|
|
66848
|
+
}
|
|
66849
|
+
function _ipv6(Class, params) {
|
|
66850
|
+
return new Class({
|
|
66851
|
+
type: "string",
|
|
66852
|
+
format: "ipv6",
|
|
66853
|
+
check: "string_format",
|
|
66854
|
+
abort: false,
|
|
66855
|
+
...normalizeParams(params)
|
|
66856
|
+
});
|
|
66857
|
+
}
|
|
66858
|
+
function _cidrv4(Class, params) {
|
|
66859
|
+
return new Class({
|
|
66860
|
+
type: "string",
|
|
66861
|
+
format: "cidrv4",
|
|
66862
|
+
check: "string_format",
|
|
66863
|
+
abort: false,
|
|
66864
|
+
...normalizeParams(params)
|
|
66865
|
+
});
|
|
66866
|
+
}
|
|
66867
|
+
function _cidrv6(Class, params) {
|
|
66868
|
+
return new Class({
|
|
66869
|
+
type: "string",
|
|
66870
|
+
format: "cidrv6",
|
|
66871
|
+
check: "string_format",
|
|
66872
|
+
abort: false,
|
|
66873
|
+
...normalizeParams(params)
|
|
66874
|
+
});
|
|
66875
|
+
}
|
|
66876
|
+
function _base64(Class, params) {
|
|
66877
|
+
return new Class({
|
|
66878
|
+
type: "string",
|
|
66879
|
+
format: "base64",
|
|
66880
|
+
check: "string_format",
|
|
66881
|
+
abort: false,
|
|
66882
|
+
...normalizeParams(params)
|
|
66883
|
+
});
|
|
66884
|
+
}
|
|
66885
|
+
function _base64url(Class, params) {
|
|
66886
|
+
return new Class({
|
|
66887
|
+
type: "string",
|
|
66888
|
+
format: "base64url",
|
|
66889
|
+
check: "string_format",
|
|
66890
|
+
abort: false,
|
|
66891
|
+
...normalizeParams(params)
|
|
66892
|
+
});
|
|
66893
|
+
}
|
|
66894
|
+
function _e164(Class, params) {
|
|
66895
|
+
return new Class({
|
|
66896
|
+
type: "string",
|
|
66897
|
+
format: "e164",
|
|
66898
|
+
check: "string_format",
|
|
66899
|
+
abort: false,
|
|
66900
|
+
...normalizeParams(params)
|
|
66901
|
+
});
|
|
66902
|
+
}
|
|
66903
|
+
function _jwt(Class, params) {
|
|
66904
|
+
return new Class({
|
|
66905
|
+
type: "string",
|
|
66906
|
+
format: "jwt",
|
|
66907
|
+
check: "string_format",
|
|
66908
|
+
abort: false,
|
|
66909
|
+
...normalizeParams(params)
|
|
66910
|
+
});
|
|
66911
|
+
}
|
|
66912
|
+
function _isoDateTime(Class, params) {
|
|
66913
|
+
return new Class({
|
|
66914
|
+
type: "string",
|
|
66915
|
+
format: "datetime",
|
|
66916
|
+
check: "string_format",
|
|
66917
|
+
offset: false,
|
|
66918
|
+
local: false,
|
|
66919
|
+
precision: null,
|
|
66920
|
+
...normalizeParams(params)
|
|
66921
|
+
});
|
|
66922
|
+
}
|
|
66923
|
+
function _isoDate(Class, params) {
|
|
66924
|
+
return new Class({
|
|
66925
|
+
type: "string",
|
|
66926
|
+
format: "date",
|
|
66927
|
+
check: "string_format",
|
|
66928
|
+
...normalizeParams(params)
|
|
66929
|
+
});
|
|
66930
|
+
}
|
|
66931
|
+
function _isoTime(Class, params) {
|
|
66932
|
+
return new Class({
|
|
66933
|
+
type: "string",
|
|
66934
|
+
format: "time",
|
|
66935
|
+
check: "string_format",
|
|
66936
|
+
precision: null,
|
|
66937
|
+
...normalizeParams(params)
|
|
66938
|
+
});
|
|
66939
|
+
}
|
|
66940
|
+
function _isoDuration(Class, params) {
|
|
66941
|
+
return new Class({
|
|
66942
|
+
type: "string",
|
|
66943
|
+
format: "duration",
|
|
66944
|
+
check: "string_format",
|
|
66945
|
+
...normalizeParams(params)
|
|
66946
|
+
});
|
|
66947
|
+
}
|
|
66948
|
+
function _unknown(Class) {
|
|
66949
|
+
return new Class({
|
|
66950
|
+
type: "unknown"
|
|
66951
|
+
});
|
|
66952
|
+
}
|
|
66953
|
+
function _never(Class, params) {
|
|
66954
|
+
return new Class({
|
|
66955
|
+
type: "never",
|
|
66956
|
+
...normalizeParams(params)
|
|
66957
|
+
});
|
|
66958
|
+
}
|
|
66959
|
+
function _maxLength(maximum, params) {
|
|
66960
|
+
const ch = new $ZodCheckMaxLength({
|
|
66961
|
+
check: "max_length",
|
|
66962
|
+
...normalizeParams(params),
|
|
66963
|
+
maximum
|
|
66964
|
+
});
|
|
66965
|
+
return ch;
|
|
66966
|
+
}
|
|
66967
|
+
function _minLength(minimum, params) {
|
|
66968
|
+
return new $ZodCheckMinLength({
|
|
66969
|
+
check: "min_length",
|
|
66970
|
+
...normalizeParams(params),
|
|
66971
|
+
minimum
|
|
66972
|
+
});
|
|
66973
|
+
}
|
|
66974
|
+
function _length(length, params) {
|
|
66975
|
+
return new $ZodCheckLengthEquals({
|
|
66976
|
+
check: "length_equals",
|
|
66977
|
+
...normalizeParams(params),
|
|
66978
|
+
length
|
|
66979
|
+
});
|
|
66980
|
+
}
|
|
66981
|
+
function _regex(pattern, params) {
|
|
66982
|
+
return new $ZodCheckRegex({
|
|
66983
|
+
check: "string_format",
|
|
66984
|
+
format: "regex",
|
|
66985
|
+
...normalizeParams(params),
|
|
66986
|
+
pattern
|
|
66987
|
+
});
|
|
66988
|
+
}
|
|
66989
|
+
function _lowercase(params) {
|
|
66990
|
+
return new $ZodCheckLowerCase({
|
|
66991
|
+
check: "string_format",
|
|
66992
|
+
format: "lowercase",
|
|
66993
|
+
...normalizeParams(params)
|
|
66994
|
+
});
|
|
66995
|
+
}
|
|
66996
|
+
function _uppercase(params) {
|
|
66997
|
+
return new $ZodCheckUpperCase({
|
|
66998
|
+
check: "string_format",
|
|
66999
|
+
format: "uppercase",
|
|
67000
|
+
...normalizeParams(params)
|
|
67001
|
+
});
|
|
67002
|
+
}
|
|
67003
|
+
function _includes(includes, params) {
|
|
67004
|
+
return new $ZodCheckIncludes({
|
|
67005
|
+
check: "string_format",
|
|
67006
|
+
format: "includes",
|
|
67007
|
+
...normalizeParams(params),
|
|
67008
|
+
includes
|
|
67009
|
+
});
|
|
67010
|
+
}
|
|
67011
|
+
function _startsWith(prefix, params) {
|
|
67012
|
+
return new $ZodCheckStartsWith({
|
|
67013
|
+
check: "string_format",
|
|
67014
|
+
format: "starts_with",
|
|
67015
|
+
...normalizeParams(params),
|
|
67016
|
+
prefix
|
|
67017
|
+
});
|
|
67018
|
+
}
|
|
67019
|
+
function _endsWith(suffix, params) {
|
|
67020
|
+
return new $ZodCheckEndsWith({
|
|
67021
|
+
check: "string_format",
|
|
67022
|
+
format: "ends_with",
|
|
67023
|
+
...normalizeParams(params),
|
|
67024
|
+
suffix
|
|
67025
|
+
});
|
|
67026
|
+
}
|
|
67027
|
+
function _overwrite(tx) {
|
|
67028
|
+
return new $ZodCheckOverwrite({
|
|
67029
|
+
check: "overwrite",
|
|
67030
|
+
tx
|
|
67031
|
+
});
|
|
67032
|
+
}
|
|
67033
|
+
// normalize
|
|
67034
|
+
function _normalize(form) {
|
|
67035
|
+
return _overwrite(input => input.normalize(form));
|
|
67036
|
+
}
|
|
67037
|
+
// trim
|
|
67038
|
+
function _trim() {
|
|
67039
|
+
return _overwrite(input => input.trim());
|
|
67040
|
+
}
|
|
67041
|
+
// toLowerCase
|
|
67042
|
+
function _toLowerCase() {
|
|
67043
|
+
return _overwrite(input => input.toLowerCase());
|
|
67044
|
+
}
|
|
67045
|
+
// toUpperCase
|
|
67046
|
+
function _toUpperCase() {
|
|
67047
|
+
return _overwrite(input => input.toUpperCase());
|
|
67048
|
+
}
|
|
67049
|
+
function _array(Class, element, params) {
|
|
67050
|
+
return new Class({
|
|
67051
|
+
type: "array",
|
|
67052
|
+
element,
|
|
67053
|
+
// get element() {
|
|
67054
|
+
// return element;
|
|
67055
|
+
// },
|
|
67056
|
+
...normalizeParams(params)
|
|
67057
|
+
});
|
|
67058
|
+
}
|
|
67059
|
+
// same as _custom but defaults to abort:false
|
|
67060
|
+
function _refine(Class, fn, _params) {
|
|
67061
|
+
const schema = new Class({
|
|
67062
|
+
type: "custom",
|
|
67063
|
+
check: "custom",
|
|
67064
|
+
fn: fn,
|
|
67065
|
+
...normalizeParams(_params)
|
|
67066
|
+
});
|
|
67067
|
+
return schema;
|
|
67068
|
+
}
|
|
67069
|
+
function _superRefine(fn) {
|
|
67070
|
+
const ch = _check(payload => {
|
|
67071
|
+
payload.addIssue = issue$1 => {
|
|
67072
|
+
if (typeof issue$1 === "string") {
|
|
67073
|
+
payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
67074
|
+
} else {
|
|
67075
|
+
// for Zod 3 backwards compatibility
|
|
67076
|
+
const _issue = issue$1;
|
|
67077
|
+
if (_issue.fatal) _issue.continue = false;
|
|
67078
|
+
_issue.code ?? (_issue.code = "custom");
|
|
67079
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
67080
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
67081
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...
|
|
67082
|
+
payload.issues.push(issue(_issue));
|
|
67083
|
+
}
|
|
67084
|
+
};
|
|
67085
|
+
return fn(payload.value, payload);
|
|
67086
|
+
});
|
|
67087
|
+
return ch;
|
|
67088
|
+
}
|
|
67089
|
+
function _check(fn, params) {
|
|
67090
|
+
const ch = new $ZodCheck({
|
|
67091
|
+
check: "custom",
|
|
67092
|
+
...normalizeParams(params)
|
|
67093
|
+
});
|
|
67094
|
+
ch._zod.check = fn;
|
|
67095
|
+
return ch;
|
|
67096
|
+
}
|
|
67097
|
+
|
|
67098
|
+
const ZodISODateTime = /*@__PURE__*/$constructor("ZodISODateTime", (inst, def) => {
|
|
67099
|
+
$ZodISODateTime.init(inst, def);
|
|
67100
|
+
ZodStringFormat.init(inst, def);
|
|
67101
|
+
});
|
|
67102
|
+
function datetime(params) {
|
|
67103
|
+
return _isoDateTime(ZodISODateTime, params);
|
|
67104
|
+
}
|
|
67105
|
+
const ZodISODate = /*@__PURE__*/$constructor("ZodISODate", (inst, def) => {
|
|
67106
|
+
$ZodISODate.init(inst, def);
|
|
67107
|
+
ZodStringFormat.init(inst, def);
|
|
67108
|
+
});
|
|
67109
|
+
function date(params) {
|
|
67110
|
+
return _isoDate(ZodISODate, params);
|
|
67111
|
+
}
|
|
67112
|
+
const ZodISOTime = /*@__PURE__*/$constructor("ZodISOTime", (inst, def) => {
|
|
67113
|
+
$ZodISOTime.init(inst, def);
|
|
67114
|
+
ZodStringFormat.init(inst, def);
|
|
67115
|
+
});
|
|
67116
|
+
function time(params) {
|
|
67117
|
+
return _isoTime(ZodISOTime, params);
|
|
67118
|
+
}
|
|
67119
|
+
const ZodISODuration = /*@__PURE__*/$constructor("ZodISODuration", (inst, def) => {
|
|
67120
|
+
$ZodISODuration.init(inst, def);
|
|
67121
|
+
ZodStringFormat.init(inst, def);
|
|
67122
|
+
});
|
|
67123
|
+
function duration(params) {
|
|
67124
|
+
return _isoDuration(ZodISODuration, params);
|
|
67125
|
+
}
|
|
67126
|
+
|
|
67127
|
+
const initializer = (inst, issues) => {
|
|
67128
|
+
$ZodError.init(inst, issues);
|
|
67129
|
+
inst.name = "ZodError";
|
|
67130
|
+
Object.defineProperties(inst, {
|
|
67131
|
+
format: {
|
|
67132
|
+
value: mapper => formatError$1(inst, mapper)
|
|
67133
|
+
// enumerable: false,
|
|
67134
|
+
},
|
|
67135
|
+
flatten: {
|
|
67136
|
+
value: mapper => flattenError(inst, mapper)
|
|
67137
|
+
// enumerable: false,
|
|
67138
|
+
},
|
|
67139
|
+
addIssue: {
|
|
67140
|
+
value: issue => {
|
|
67141
|
+
inst.issues.push(issue);
|
|
67142
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
67143
|
+
}
|
|
67144
|
+
// enumerable: false,
|
|
67145
|
+
},
|
|
67146
|
+
addIssues: {
|
|
67147
|
+
value: issues => {
|
|
67148
|
+
inst.issues.push(...issues);
|
|
67149
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
67150
|
+
}
|
|
67151
|
+
// enumerable: false,
|
|
67152
|
+
},
|
|
67153
|
+
isEmpty: {
|
|
67154
|
+
get() {
|
|
67155
|
+
return inst.issues.length === 0;
|
|
67156
|
+
}
|
|
67157
|
+
// enumerable: false,
|
|
67158
|
+
}
|
|
67159
|
+
});
|
|
67160
|
+
// Object.defineProperty(inst, "isEmpty", {
|
|
67161
|
+
// get() {
|
|
67162
|
+
// return inst.issues.length === 0;
|
|
67163
|
+
// },
|
|
67164
|
+
// });
|
|
67165
|
+
};
|
|
67166
|
+
const ZodRealError = $constructor("ZodError", initializer, {
|
|
67167
|
+
Parent: Error
|
|
67168
|
+
});
|
|
67169
|
+
// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
|
|
67170
|
+
// export type ErrorMapCtx = core.$ZodErrorMapCtx;
|
|
67171
|
+
|
|
67172
|
+
const parse$3 = /* @__PURE__ */_parse(ZodRealError);
|
|
67173
|
+
const parseAsync = /* @__PURE__ */_parseAsync(ZodRealError);
|
|
67174
|
+
const safeParse = /* @__PURE__ */_safeParse(ZodRealError);
|
|
67175
|
+
const safeParseAsync = /* @__PURE__ */_safeParseAsync(ZodRealError);
|
|
67176
|
+
// Codec functions
|
|
67177
|
+
const encode = /* @__PURE__ */_encode(ZodRealError);
|
|
67178
|
+
const decode = /* @__PURE__ */_decode(ZodRealError);
|
|
67179
|
+
const encodeAsync = /* @__PURE__ */_encodeAsync(ZodRealError);
|
|
67180
|
+
const decodeAsync = /* @__PURE__ */_decodeAsync(ZodRealError);
|
|
67181
|
+
const safeEncode = /* @__PURE__ */_safeEncode(ZodRealError);
|
|
67182
|
+
const safeDecode = /* @__PURE__ */_safeDecode(ZodRealError);
|
|
67183
|
+
const safeEncodeAsync = /* @__PURE__ */_safeEncodeAsync(ZodRealError);
|
|
67184
|
+
const safeDecodeAsync = /* @__PURE__ */_safeDecodeAsync(ZodRealError);
|
|
67185
|
+
|
|
67186
|
+
const ZodType = /*@__PURE__*/$constructor("ZodType", (inst, def) => {
|
|
67187
|
+
$ZodType.init(inst, def);
|
|
67188
|
+
inst.def = def;
|
|
67189
|
+
inst.type = def.type;
|
|
67190
|
+
Object.defineProperty(inst, "_def", {
|
|
67191
|
+
value: def
|
|
67192
|
+
});
|
|
67193
|
+
// base methods
|
|
67194
|
+
inst.check = (...checks) => {
|
|
67195
|
+
return inst.clone({
|
|
67196
|
+
...def,
|
|
67197
|
+
checks: [...(def.checks ?? []), ...checks.map(ch => typeof ch === "function" ? {
|
|
67198
|
+
_zod: {
|
|
67199
|
+
check: ch,
|
|
67200
|
+
def: {
|
|
67201
|
+
check: "custom"
|
|
67202
|
+
},
|
|
67203
|
+
onattach: []
|
|
67204
|
+
}
|
|
67205
|
+
} : ch)]
|
|
67206
|
+
}
|
|
67207
|
+
// { parent: true }
|
|
67208
|
+
);
|
|
67209
|
+
};
|
|
67210
|
+
inst.clone = (def, params) => clone(inst, def, params);
|
|
67211
|
+
inst.brand = () => inst;
|
|
67212
|
+
inst.register = (reg, meta) => {
|
|
67213
|
+
reg.add(inst, meta);
|
|
67214
|
+
return inst;
|
|
67215
|
+
};
|
|
67216
|
+
// parsing
|
|
67217
|
+
inst.parse = (data, params) => parse$3(inst, data, params, {
|
|
67218
|
+
callee: inst.parse
|
|
67219
|
+
});
|
|
67220
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
67221
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, {
|
|
67222
|
+
callee: inst.parseAsync
|
|
67223
|
+
});
|
|
67224
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
67225
|
+
inst.spa = inst.safeParseAsync;
|
|
67226
|
+
// encoding/decoding
|
|
67227
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
67228
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
67229
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
67230
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
67231
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
67232
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
67233
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
67234
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
67235
|
+
// refinements
|
|
67236
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
67237
|
+
inst.superRefine = refinement => inst.check(superRefine(refinement));
|
|
67238
|
+
inst.overwrite = fn => inst.check(_overwrite(fn));
|
|
67239
|
+
// wrappers
|
|
67240
|
+
inst.optional = () => optional(inst);
|
|
67241
|
+
inst.nullable = () => nullable(inst);
|
|
67242
|
+
inst.nullish = () => optional(nullable(inst));
|
|
67243
|
+
inst.nonoptional = params => nonoptional(inst, params);
|
|
67244
|
+
inst.array = () => array(inst);
|
|
67245
|
+
inst.or = arg => union([inst, arg]);
|
|
67246
|
+
inst.and = arg => intersection(inst, arg);
|
|
67247
|
+
inst.transform = tx => pipe(inst, transform(tx));
|
|
67248
|
+
inst.default = def => _default(inst, def);
|
|
67249
|
+
inst.prefault = def => prefault(inst, def);
|
|
67250
|
+
// inst.coalesce = (def, params) => coalesce(inst, def, params);
|
|
67251
|
+
inst.catch = params => _catch(inst, params);
|
|
67252
|
+
inst.pipe = target => pipe(inst, target);
|
|
67253
|
+
inst.readonly = () => readonly(inst);
|
|
67254
|
+
// meta
|
|
67255
|
+
inst.describe = description => {
|
|
67256
|
+
const cl = inst.clone();
|
|
67257
|
+
globalRegistry.add(cl, {
|
|
67258
|
+
description
|
|
67259
|
+
});
|
|
67260
|
+
return cl;
|
|
67261
|
+
};
|
|
67262
|
+
Object.defineProperty(inst, "description", {
|
|
67263
|
+
get() {
|
|
67264
|
+
return globalRegistry.get(inst)?.description;
|
|
67265
|
+
},
|
|
67266
|
+
configurable: true
|
|
67267
|
+
});
|
|
67268
|
+
inst.meta = (...args) => {
|
|
67269
|
+
if (args.length === 0) {
|
|
67270
|
+
return globalRegistry.get(inst);
|
|
67271
|
+
}
|
|
67272
|
+
const cl = inst.clone();
|
|
67273
|
+
globalRegistry.add(cl, args[0]);
|
|
67274
|
+
return cl;
|
|
67275
|
+
};
|
|
67276
|
+
// helpers
|
|
67277
|
+
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
67278
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
67279
|
+
return inst;
|
|
67280
|
+
});
|
|
67281
|
+
/** @internal */
|
|
67282
|
+
const _ZodString = /*@__PURE__*/$constructor("_ZodString", (inst, def) => {
|
|
67283
|
+
$ZodString.init(inst, def);
|
|
67284
|
+
ZodType.init(inst, def);
|
|
67285
|
+
const bag = inst._zod.bag;
|
|
67286
|
+
inst.format = bag.format ?? null;
|
|
67287
|
+
inst.minLength = bag.minimum ?? null;
|
|
67288
|
+
inst.maxLength = bag.maximum ?? null;
|
|
67289
|
+
// validations
|
|
67290
|
+
inst.regex = (...args) => inst.check(_regex(...args));
|
|
67291
|
+
inst.includes = (...args) => inst.check(_includes(...args));
|
|
67292
|
+
inst.startsWith = (...args) => inst.check(_startsWith(...args));
|
|
67293
|
+
inst.endsWith = (...args) => inst.check(_endsWith(...args));
|
|
67294
|
+
inst.min = (...args) => inst.check(_minLength(...args));
|
|
67295
|
+
inst.max = (...args) => inst.check(_maxLength(...args));
|
|
67296
|
+
inst.length = (...args) => inst.check(_length(...args));
|
|
67297
|
+
inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
|
|
67298
|
+
inst.lowercase = params => inst.check(_lowercase(params));
|
|
67299
|
+
inst.uppercase = params => inst.check(_uppercase(params));
|
|
67300
|
+
// transforms
|
|
67301
|
+
inst.trim = () => inst.check(_trim());
|
|
67302
|
+
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
67303
|
+
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
67304
|
+
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
67305
|
+
});
|
|
67306
|
+
const ZodString = /*@__PURE__*/$constructor("ZodString", (inst, def) => {
|
|
67307
|
+
$ZodString.init(inst, def);
|
|
67308
|
+
_ZodString.init(inst, def);
|
|
67309
|
+
inst.email = params => inst.check(_email(ZodEmail, params));
|
|
67310
|
+
inst.url = params => inst.check(_url(ZodURL, params));
|
|
67311
|
+
inst.jwt = params => inst.check(_jwt(ZodJWT, params));
|
|
67312
|
+
inst.emoji = params => inst.check(_emoji(ZodEmoji, params));
|
|
67313
|
+
inst.guid = params => inst.check(_guid(ZodGUID, params));
|
|
67314
|
+
inst.uuid = params => inst.check(_uuid(ZodUUID, params));
|
|
67315
|
+
inst.uuidv4 = params => inst.check(_uuidv4(ZodUUID, params));
|
|
67316
|
+
inst.uuidv6 = params => inst.check(_uuidv6(ZodUUID, params));
|
|
67317
|
+
inst.uuidv7 = params => inst.check(_uuidv7(ZodUUID, params));
|
|
67318
|
+
inst.nanoid = params => inst.check(_nanoid(ZodNanoID, params));
|
|
67319
|
+
inst.guid = params => inst.check(_guid(ZodGUID, params));
|
|
67320
|
+
inst.cuid = params => inst.check(_cuid(ZodCUID, params));
|
|
67321
|
+
inst.cuid2 = params => inst.check(_cuid2(ZodCUID2, params));
|
|
67322
|
+
inst.ulid = params => inst.check(_ulid(ZodULID, params));
|
|
67323
|
+
inst.base64 = params => inst.check(_base64(ZodBase64, params));
|
|
67324
|
+
inst.base64url = params => inst.check(_base64url(ZodBase64URL, params));
|
|
67325
|
+
inst.xid = params => inst.check(_xid(ZodXID, params));
|
|
67326
|
+
inst.ksuid = params => inst.check(_ksuid(ZodKSUID, params));
|
|
67327
|
+
inst.ipv4 = params => inst.check(_ipv4(ZodIPv4, params));
|
|
67328
|
+
inst.ipv6 = params => inst.check(_ipv6(ZodIPv6, params));
|
|
67329
|
+
inst.cidrv4 = params => inst.check(_cidrv4(ZodCIDRv4, params));
|
|
67330
|
+
inst.cidrv6 = params => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
67331
|
+
inst.e164 = params => inst.check(_e164(ZodE164, params));
|
|
67332
|
+
// iso
|
|
67333
|
+
inst.datetime = params => inst.check(datetime(params));
|
|
67334
|
+
inst.date = params => inst.check(date(params));
|
|
67335
|
+
inst.time = params => inst.check(time(params));
|
|
67336
|
+
inst.duration = params => inst.check(duration(params));
|
|
67337
|
+
});
|
|
67338
|
+
function string$1(params) {
|
|
67339
|
+
return _string(ZodString, params);
|
|
67340
|
+
}
|
|
67341
|
+
const ZodStringFormat = /*@__PURE__*/$constructor("ZodStringFormat", (inst, def) => {
|
|
67342
|
+
$ZodStringFormat.init(inst, def);
|
|
67343
|
+
_ZodString.init(inst, def);
|
|
67344
|
+
});
|
|
67345
|
+
const ZodEmail = /*@__PURE__*/$constructor("ZodEmail", (inst, def) => {
|
|
67346
|
+
// ZodStringFormat.init(inst, def);
|
|
67347
|
+
$ZodEmail.init(inst, def);
|
|
67348
|
+
ZodStringFormat.init(inst, def);
|
|
67349
|
+
});
|
|
67350
|
+
const ZodGUID = /*@__PURE__*/$constructor("ZodGUID", (inst, def) => {
|
|
67351
|
+
// ZodStringFormat.init(inst, def);
|
|
67352
|
+
$ZodGUID.init(inst, def);
|
|
67353
|
+
ZodStringFormat.init(inst, def);
|
|
67354
|
+
});
|
|
67355
|
+
const ZodUUID = /*@__PURE__*/$constructor("ZodUUID", (inst, def) => {
|
|
67356
|
+
// ZodStringFormat.init(inst, def);
|
|
67357
|
+
$ZodUUID.init(inst, def);
|
|
67358
|
+
ZodStringFormat.init(inst, def);
|
|
67359
|
+
});
|
|
67360
|
+
const ZodURL = /*@__PURE__*/$constructor("ZodURL", (inst, def) => {
|
|
67361
|
+
// ZodStringFormat.init(inst, def);
|
|
67362
|
+
$ZodURL.init(inst, def);
|
|
67363
|
+
ZodStringFormat.init(inst, def);
|
|
67364
|
+
});
|
|
67365
|
+
const ZodEmoji = /*@__PURE__*/$constructor("ZodEmoji", (inst, def) => {
|
|
67366
|
+
// ZodStringFormat.init(inst, def);
|
|
67367
|
+
$ZodEmoji.init(inst, def);
|
|
67368
|
+
ZodStringFormat.init(inst, def);
|
|
67369
|
+
});
|
|
67370
|
+
const ZodNanoID = /*@__PURE__*/$constructor("ZodNanoID", (inst, def) => {
|
|
67371
|
+
// ZodStringFormat.init(inst, def);
|
|
67372
|
+
$ZodNanoID.init(inst, def);
|
|
67373
|
+
ZodStringFormat.init(inst, def);
|
|
67374
|
+
});
|
|
67375
|
+
const ZodCUID = /*@__PURE__*/$constructor("ZodCUID", (inst, def) => {
|
|
67376
|
+
// ZodStringFormat.init(inst, def);
|
|
67377
|
+
$ZodCUID.init(inst, def);
|
|
67378
|
+
ZodStringFormat.init(inst, def);
|
|
67379
|
+
});
|
|
67380
|
+
const ZodCUID2 = /*@__PURE__*/$constructor("ZodCUID2", (inst, def) => {
|
|
67381
|
+
// ZodStringFormat.init(inst, def);
|
|
67382
|
+
$ZodCUID2.init(inst, def);
|
|
67383
|
+
ZodStringFormat.init(inst, def);
|
|
67384
|
+
});
|
|
67385
|
+
const ZodULID = /*@__PURE__*/$constructor("ZodULID", (inst, def) => {
|
|
67386
|
+
// ZodStringFormat.init(inst, def);
|
|
67387
|
+
$ZodULID.init(inst, def);
|
|
67388
|
+
ZodStringFormat.init(inst, def);
|
|
67389
|
+
});
|
|
67390
|
+
const ZodXID = /*@__PURE__*/$constructor("ZodXID", (inst, def) => {
|
|
67391
|
+
// ZodStringFormat.init(inst, def);
|
|
67392
|
+
$ZodXID.init(inst, def);
|
|
67393
|
+
ZodStringFormat.init(inst, def);
|
|
67394
|
+
});
|
|
67395
|
+
const ZodKSUID = /*@__PURE__*/$constructor("ZodKSUID", (inst, def) => {
|
|
67396
|
+
// ZodStringFormat.init(inst, def);
|
|
67397
|
+
$ZodKSUID.init(inst, def);
|
|
67398
|
+
ZodStringFormat.init(inst, def);
|
|
67399
|
+
});
|
|
67400
|
+
const ZodIPv4 = /*@__PURE__*/$constructor("ZodIPv4", (inst, def) => {
|
|
67401
|
+
// ZodStringFormat.init(inst, def);
|
|
67402
|
+
$ZodIPv4.init(inst, def);
|
|
67403
|
+
ZodStringFormat.init(inst, def);
|
|
67404
|
+
});
|
|
67405
|
+
const ZodIPv6 = /*@__PURE__*/$constructor("ZodIPv6", (inst, def) => {
|
|
67406
|
+
// ZodStringFormat.init(inst, def);
|
|
67407
|
+
$ZodIPv6.init(inst, def);
|
|
67408
|
+
ZodStringFormat.init(inst, def);
|
|
67409
|
+
});
|
|
67410
|
+
const ZodCIDRv4 = /*@__PURE__*/$constructor("ZodCIDRv4", (inst, def) => {
|
|
67411
|
+
$ZodCIDRv4.init(inst, def);
|
|
67412
|
+
ZodStringFormat.init(inst, def);
|
|
67413
|
+
});
|
|
67414
|
+
const ZodCIDRv6 = /*@__PURE__*/$constructor("ZodCIDRv6", (inst, def) => {
|
|
67415
|
+
$ZodCIDRv6.init(inst, def);
|
|
67416
|
+
ZodStringFormat.init(inst, def);
|
|
67417
|
+
});
|
|
67418
|
+
const ZodBase64 = /*@__PURE__*/$constructor("ZodBase64", (inst, def) => {
|
|
67419
|
+
// ZodStringFormat.init(inst, def);
|
|
67420
|
+
$ZodBase64.init(inst, def);
|
|
67421
|
+
ZodStringFormat.init(inst, def);
|
|
67422
|
+
});
|
|
67423
|
+
const ZodBase64URL = /*@__PURE__*/$constructor("ZodBase64URL", (inst, def) => {
|
|
67424
|
+
// ZodStringFormat.init(inst, def);
|
|
67425
|
+
$ZodBase64URL.init(inst, def);
|
|
67426
|
+
ZodStringFormat.init(inst, def);
|
|
67427
|
+
});
|
|
67428
|
+
const ZodE164 = /*@__PURE__*/$constructor("ZodE164", (inst, def) => {
|
|
67429
|
+
// ZodStringFormat.init(inst, def);
|
|
67430
|
+
$ZodE164.init(inst, def);
|
|
67431
|
+
ZodStringFormat.init(inst, def);
|
|
67432
|
+
});
|
|
67433
|
+
const ZodJWT = /*@__PURE__*/$constructor("ZodJWT", (inst, def) => {
|
|
67434
|
+
// ZodStringFormat.init(inst, def);
|
|
67435
|
+
$ZodJWT.init(inst, def);
|
|
67436
|
+
ZodStringFormat.init(inst, def);
|
|
67437
|
+
});
|
|
67438
|
+
const ZodUnknown = /*@__PURE__*/$constructor("ZodUnknown", (inst, def) => {
|
|
67439
|
+
$ZodUnknown.init(inst, def);
|
|
67440
|
+
ZodType.init(inst, def);
|
|
67441
|
+
});
|
|
67442
|
+
function unknown() {
|
|
67443
|
+
return _unknown(ZodUnknown);
|
|
67444
|
+
}
|
|
67445
|
+
const ZodNever = /*@__PURE__*/$constructor("ZodNever", (inst, def) => {
|
|
67446
|
+
$ZodNever.init(inst, def);
|
|
67447
|
+
ZodType.init(inst, def);
|
|
67448
|
+
});
|
|
67449
|
+
function never(params) {
|
|
67450
|
+
return _never(ZodNever, params);
|
|
67451
|
+
}
|
|
67452
|
+
const ZodArray = /*@__PURE__*/$constructor("ZodArray", (inst, def) => {
|
|
67453
|
+
$ZodArray.init(inst, def);
|
|
67454
|
+
ZodType.init(inst, def);
|
|
67455
|
+
inst.element = def.element;
|
|
67456
|
+
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
67457
|
+
inst.nonempty = params => inst.check(_minLength(1, params));
|
|
67458
|
+
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
|
|
67459
|
+
inst.length = (len, params) => inst.check(_length(len, params));
|
|
67460
|
+
inst.unwrap = () => inst.element;
|
|
67461
|
+
});
|
|
67462
|
+
function array(element, params) {
|
|
67463
|
+
return _array(ZodArray, element, params);
|
|
67464
|
+
}
|
|
67465
|
+
const ZodObject = /*@__PURE__*/$constructor("ZodObject", (inst, def) => {
|
|
67466
|
+
$ZodObjectJIT.init(inst, def);
|
|
67467
|
+
ZodType.init(inst, def);
|
|
67468
|
+
defineLazy(inst, "shape", () => def.shape);
|
|
67469
|
+
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
67470
|
+
inst.catchall = catchall => inst.clone({
|
|
67471
|
+
...inst._zod.def,
|
|
67472
|
+
catchall: catchall
|
|
67473
|
+
});
|
|
67474
|
+
inst.passthrough = () => inst.clone({
|
|
67475
|
+
...inst._zod.def,
|
|
67476
|
+
catchall: unknown()
|
|
67477
|
+
});
|
|
67478
|
+
inst.loose = () => inst.clone({
|
|
67479
|
+
...inst._zod.def,
|
|
67480
|
+
catchall: unknown()
|
|
67481
|
+
});
|
|
67482
|
+
inst.strict = () => inst.clone({
|
|
67483
|
+
...inst._zod.def,
|
|
67484
|
+
catchall: never()
|
|
67485
|
+
});
|
|
67486
|
+
inst.strip = () => inst.clone({
|
|
67487
|
+
...inst._zod.def,
|
|
67488
|
+
catchall: undefined
|
|
67489
|
+
});
|
|
67490
|
+
inst.extend = incoming => {
|
|
67491
|
+
return extend$1(inst, incoming);
|
|
67492
|
+
};
|
|
67493
|
+
inst.safeExtend = incoming => {
|
|
67494
|
+
return safeExtend(inst, incoming);
|
|
67495
|
+
};
|
|
67496
|
+
inst.merge = other => merge$1(inst, other);
|
|
67497
|
+
inst.pick = mask => pick(inst, mask);
|
|
67498
|
+
inst.omit = mask => omit(inst, mask);
|
|
67499
|
+
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
67500
|
+
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
67501
|
+
});
|
|
67502
|
+
function object(shape, params) {
|
|
67503
|
+
const def = {
|
|
67504
|
+
type: "object",
|
|
67505
|
+
get shape() {
|
|
67506
|
+
assignProp(this, "shape", shape ? objectClone(shape) : {});
|
|
67507
|
+
return this.shape;
|
|
67508
|
+
},
|
|
67509
|
+
...normalizeParams(params)
|
|
67510
|
+
};
|
|
67511
|
+
return new ZodObject(def);
|
|
67512
|
+
}
|
|
67513
|
+
const ZodUnion = /*@__PURE__*/$constructor("ZodUnion", (inst, def) => {
|
|
67514
|
+
$ZodUnion.init(inst, def);
|
|
67515
|
+
ZodType.init(inst, def);
|
|
67516
|
+
inst.options = def.options;
|
|
67517
|
+
});
|
|
67518
|
+
function union(options, params) {
|
|
67519
|
+
return new ZodUnion({
|
|
67520
|
+
type: "union",
|
|
67521
|
+
options: options,
|
|
67522
|
+
...normalizeParams(params)
|
|
67523
|
+
});
|
|
67524
|
+
}
|
|
67525
|
+
const ZodIntersection = /*@__PURE__*/$constructor("ZodIntersection", (inst, def) => {
|
|
67526
|
+
$ZodIntersection.init(inst, def);
|
|
67527
|
+
ZodType.init(inst, def);
|
|
67528
|
+
});
|
|
67529
|
+
function intersection(left, right) {
|
|
67530
|
+
return new ZodIntersection({
|
|
67531
|
+
type: "intersection",
|
|
67532
|
+
left: left,
|
|
67533
|
+
right: right
|
|
67534
|
+
});
|
|
67535
|
+
}
|
|
67536
|
+
const ZodRecord = /*@__PURE__*/$constructor("ZodRecord", (inst, def) => {
|
|
67537
|
+
$ZodRecord.init(inst, def);
|
|
67538
|
+
ZodType.init(inst, def);
|
|
67539
|
+
inst.keyType = def.keyType;
|
|
67540
|
+
inst.valueType = def.valueType;
|
|
67541
|
+
});
|
|
67542
|
+
function record(keyType, valueType, params) {
|
|
67543
|
+
return new ZodRecord({
|
|
67544
|
+
type: "record",
|
|
67545
|
+
keyType,
|
|
67546
|
+
valueType: valueType,
|
|
67547
|
+
...normalizeParams(params)
|
|
67548
|
+
});
|
|
67549
|
+
}
|
|
67550
|
+
const ZodEnum = /*@__PURE__*/$constructor("ZodEnum", (inst, def) => {
|
|
67551
|
+
$ZodEnum.init(inst, def);
|
|
67552
|
+
ZodType.init(inst, def);
|
|
67553
|
+
inst.enum = def.entries;
|
|
67554
|
+
inst.options = Object.values(def.entries);
|
|
67555
|
+
const keys = new Set(Object.keys(def.entries));
|
|
67556
|
+
inst.extract = (values, params) => {
|
|
67557
|
+
const newEntries = {};
|
|
67558
|
+
for (const value of values) {
|
|
67559
|
+
if (keys.has(value)) {
|
|
67560
|
+
newEntries[value] = def.entries[value];
|
|
67561
|
+
} else throw new Error(`Key ${value} not found in enum`);
|
|
67562
|
+
}
|
|
67563
|
+
return new ZodEnum({
|
|
67564
|
+
...def,
|
|
67565
|
+
checks: [],
|
|
67566
|
+
...normalizeParams(params),
|
|
67567
|
+
entries: newEntries
|
|
67568
|
+
});
|
|
67569
|
+
};
|
|
67570
|
+
inst.exclude = (values, params) => {
|
|
67571
|
+
const newEntries = {
|
|
67572
|
+
...def.entries
|
|
67573
|
+
};
|
|
67574
|
+
for (const value of values) {
|
|
67575
|
+
if (keys.has(value)) {
|
|
67576
|
+
delete newEntries[value];
|
|
67577
|
+
} else throw new Error(`Key ${value} not found in enum`);
|
|
67578
|
+
}
|
|
67579
|
+
return new ZodEnum({
|
|
67580
|
+
...def,
|
|
67581
|
+
checks: [],
|
|
67582
|
+
...normalizeParams(params),
|
|
67583
|
+
entries: newEntries
|
|
67584
|
+
});
|
|
67585
|
+
};
|
|
67586
|
+
});
|
|
67587
|
+
function _enum(values, params) {
|
|
67588
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map(v => [v, v])) : values;
|
|
67589
|
+
return new ZodEnum({
|
|
67590
|
+
type: "enum",
|
|
67591
|
+
entries,
|
|
67592
|
+
...normalizeParams(params)
|
|
67593
|
+
});
|
|
67594
|
+
}
|
|
67595
|
+
const ZodTransform = /*@__PURE__*/$constructor("ZodTransform", (inst, def) => {
|
|
67596
|
+
$ZodTransform.init(inst, def);
|
|
67597
|
+
ZodType.init(inst, def);
|
|
67598
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
67599
|
+
if (_ctx.direction === "backward") {
|
|
67600
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
67601
|
+
}
|
|
67602
|
+
payload.addIssue = issue$1 => {
|
|
67603
|
+
if (typeof issue$1 === "string") {
|
|
67604
|
+
payload.issues.push(issue(issue$1, payload.value, def));
|
|
67605
|
+
} else {
|
|
67606
|
+
// for Zod 3 backwards compatibility
|
|
67607
|
+
const _issue = issue$1;
|
|
67608
|
+
if (_issue.fatal) _issue.continue = false;
|
|
67609
|
+
_issue.code ?? (_issue.code = "custom");
|
|
67610
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
67611
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
67612
|
+
// _issue.continue ??= true;
|
|
67613
|
+
payload.issues.push(issue(_issue));
|
|
67614
|
+
}
|
|
67615
|
+
};
|
|
67616
|
+
const output = def.transform(payload.value, payload);
|
|
67617
|
+
if (output instanceof Promise) {
|
|
67618
|
+
return output.then(output => {
|
|
67619
|
+
payload.value = output;
|
|
67620
|
+
return payload;
|
|
67621
|
+
});
|
|
67622
|
+
}
|
|
67623
|
+
payload.value = output;
|
|
67624
|
+
return payload;
|
|
67625
|
+
};
|
|
67626
|
+
});
|
|
67627
|
+
function transform(fn) {
|
|
67628
|
+
return new ZodTransform({
|
|
67629
|
+
type: "transform",
|
|
67630
|
+
transform: fn
|
|
67631
|
+
});
|
|
67632
|
+
}
|
|
67633
|
+
const ZodOptional = /*@__PURE__*/$constructor("ZodOptional", (inst, def) => {
|
|
67634
|
+
$ZodOptional.init(inst, def);
|
|
67635
|
+
ZodType.init(inst, def);
|
|
67636
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67637
|
+
});
|
|
67638
|
+
function optional(innerType) {
|
|
67639
|
+
return new ZodOptional({
|
|
67640
|
+
type: "optional",
|
|
67641
|
+
innerType: innerType
|
|
67642
|
+
});
|
|
67643
|
+
}
|
|
67644
|
+
const ZodNullable = /*@__PURE__*/$constructor("ZodNullable", (inst, def) => {
|
|
67645
|
+
$ZodNullable.init(inst, def);
|
|
67646
|
+
ZodType.init(inst, def);
|
|
67647
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67648
|
+
});
|
|
67649
|
+
function nullable(innerType) {
|
|
67650
|
+
return new ZodNullable({
|
|
67651
|
+
type: "nullable",
|
|
67652
|
+
innerType: innerType
|
|
67653
|
+
});
|
|
67654
|
+
}
|
|
67655
|
+
const ZodDefault = /*@__PURE__*/$constructor("ZodDefault", (inst, def) => {
|
|
67656
|
+
$ZodDefault.init(inst, def);
|
|
67657
|
+
ZodType.init(inst, def);
|
|
67658
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67659
|
+
inst.removeDefault = inst.unwrap;
|
|
67660
|
+
});
|
|
67661
|
+
function _default(innerType, defaultValue) {
|
|
67662
|
+
return new ZodDefault({
|
|
67663
|
+
type: "default",
|
|
67664
|
+
innerType: innerType,
|
|
67665
|
+
get defaultValue() {
|
|
67666
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
67667
|
+
}
|
|
67668
|
+
});
|
|
67669
|
+
}
|
|
67670
|
+
const ZodPrefault = /*@__PURE__*/$constructor("ZodPrefault", (inst, def) => {
|
|
67671
|
+
$ZodPrefault.init(inst, def);
|
|
67672
|
+
ZodType.init(inst, def);
|
|
67673
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67674
|
+
});
|
|
67675
|
+
function prefault(innerType, defaultValue) {
|
|
67676
|
+
return new ZodPrefault({
|
|
67677
|
+
type: "prefault",
|
|
67678
|
+
innerType: innerType,
|
|
67679
|
+
get defaultValue() {
|
|
67680
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
67681
|
+
}
|
|
67682
|
+
});
|
|
67683
|
+
}
|
|
67684
|
+
const ZodNonOptional = /*@__PURE__*/$constructor("ZodNonOptional", (inst, def) => {
|
|
67685
|
+
$ZodNonOptional.init(inst, def);
|
|
67686
|
+
ZodType.init(inst, def);
|
|
67687
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67688
|
+
});
|
|
67689
|
+
function nonoptional(innerType, params) {
|
|
67690
|
+
return new ZodNonOptional({
|
|
67691
|
+
type: "nonoptional",
|
|
67692
|
+
innerType: innerType,
|
|
67693
|
+
...normalizeParams(params)
|
|
67694
|
+
});
|
|
67695
|
+
}
|
|
67696
|
+
const ZodCatch = /*@__PURE__*/$constructor("ZodCatch", (inst, def) => {
|
|
67697
|
+
$ZodCatch.init(inst, def);
|
|
67698
|
+
ZodType.init(inst, def);
|
|
67699
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67700
|
+
inst.removeCatch = inst.unwrap;
|
|
67701
|
+
});
|
|
67702
|
+
function _catch(innerType, catchValue) {
|
|
67703
|
+
return new ZodCatch({
|
|
67704
|
+
type: "catch",
|
|
67705
|
+
innerType: innerType,
|
|
67706
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
67707
|
+
});
|
|
67708
|
+
}
|
|
67709
|
+
const ZodPipe = /*@__PURE__*/$constructor("ZodPipe", (inst, def) => {
|
|
67710
|
+
$ZodPipe.init(inst, def);
|
|
67711
|
+
ZodType.init(inst, def);
|
|
67712
|
+
inst.in = def.in;
|
|
67713
|
+
inst.out = def.out;
|
|
67714
|
+
});
|
|
67715
|
+
function pipe(in_, out) {
|
|
67716
|
+
return new ZodPipe({
|
|
67717
|
+
type: "pipe",
|
|
67718
|
+
in: in_,
|
|
67719
|
+
out: out
|
|
67720
|
+
// ...util.normalizeParams(params),
|
|
67721
|
+
});
|
|
67722
|
+
}
|
|
67723
|
+
const ZodReadonly = /*@__PURE__*/$constructor("ZodReadonly", (inst, def) => {
|
|
67724
|
+
$ZodReadonly.init(inst, def);
|
|
67725
|
+
ZodType.init(inst, def);
|
|
67726
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
67727
|
+
});
|
|
67728
|
+
function readonly(innerType) {
|
|
67729
|
+
return new ZodReadonly({
|
|
67730
|
+
type: "readonly",
|
|
67731
|
+
innerType: innerType
|
|
67732
|
+
});
|
|
67733
|
+
}
|
|
67734
|
+
const ZodCustom = /*@__PURE__*/$constructor("ZodCustom", (inst, def) => {
|
|
67735
|
+
$ZodCustom.init(inst, def);
|
|
67736
|
+
ZodType.init(inst, def);
|
|
67737
|
+
});
|
|
67738
|
+
function refine(fn, _params = {}) {
|
|
67739
|
+
return _refine(ZodCustom, fn, _params);
|
|
67740
|
+
}
|
|
67741
|
+
// superRefine
|
|
67742
|
+
function superRefine(fn) {
|
|
67743
|
+
return _superRefine(fn);
|
|
67744
|
+
}
|
|
67745
|
+
|
|
64436
67746
|
var fromPath_1;
|
|
64437
67747
|
var hasRequiredFromPath;
|
|
64438
67748
|
function requireFromPath() {
|
|
@@ -168066,6 +171376,7 @@ exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
|
168066
171376
|
exports.Octokit = Octokit;
|
|
168067
171377
|
exports.RequestError = RequestError;
|
|
168068
171378
|
exports.arboristExports = arboristExports;
|
|
171379
|
+
exports.array = array;
|
|
168069
171380
|
exports.browserslistExports = browserslistExports;
|
|
168070
171381
|
exports.configExports = configExports;
|
|
168071
171382
|
exports.distExports = distExports$1;
|
|
@@ -168083,19 +171394,22 @@ exports.messageWithCauses = messageWithCauses;
|
|
|
168083
171394
|
exports.micromatchExports = micromatchExports;
|
|
168084
171395
|
exports.nodeExports = nodeExports;
|
|
168085
171396
|
exports.npaExports = npaExports;
|
|
171397
|
+
exports.object = object;
|
|
168086
171398
|
exports.open = open;
|
|
168087
171399
|
exports.outExports = outExports;
|
|
168088
171400
|
exports.overrideSetExports = overrideSetExports;
|
|
168089
171401
|
exports.packageurlJsExports = packageurlJsExports$1;
|
|
168090
171402
|
exports.packageurlJsExports$1 = packageurlJsExports;
|
|
171403
|
+
exports.record = record;
|
|
168091
171404
|
exports.registryAuthTokenExports = registryAuthTokenExports;
|
|
168092
171405
|
exports.registryUrl = registryUrl;
|
|
168093
171406
|
exports.semverExports = semverExports;
|
|
168094
171407
|
exports.srcExports = srcExports;
|
|
168095
171408
|
exports.stackWithCauses = stackWithCauses;
|
|
171409
|
+
exports.string = string$1;
|
|
168096
171410
|
exports.terminalLinkExports = terminalLinkExports;
|
|
168097
171411
|
exports.updater = updater$1;
|
|
168098
171412
|
exports.yargsParser = yargsParser;
|
|
168099
171413
|
exports.yoctocolorsCjsExports = yoctocolorsCjsExports;
|
|
168100
|
-
//# debugId=
|
|
171414
|
+
//# debugId=1c3a2548-36ce-44ab-ab66-b8821831c1b0
|
|
168101
171415
|
//# sourceMappingURL=vendor.js.map
|