@botpress/api 1.27.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +960 -274
- package/dist/src/gen/admin/state.d.ts +6 -0
- package/dist/src/gen/state.d.ts +6 -0
- package/package.json +4 -2
- package/src/gen/admin/openapi.json +1 -1
- package/src/gen/admin/state.ts +7 -1
- package/src/gen/files/openapi.json +1 -1
- package/src/gen/files/state.ts +1 -1
- package/src/gen/openapi.json +1 -1
- package/src/gen/runtime/openapi.json +1 -1
- package/src/gen/runtime/state.ts +1 -1
- package/src/gen/state.ts +7 -1
- package/src/gen/tables/openapi.json +1 -1
- package/src/gen/tables/state.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -127,9 +127,9 @@ var require_dist = __commonJS({
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
130
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/util.js
|
|
131
131
|
var require_util = __commonJS({
|
|
132
|
-
"../../node_modules/.pnpm/zod@3.
|
|
132
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/util.js"(exports) {
|
|
133
133
|
"use strict";
|
|
134
134
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
135
135
|
exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
|
|
@@ -190,7 +190,7 @@ var require_util = __commonJS({
|
|
|
190
190
|
}
|
|
191
191
|
return value;
|
|
192
192
|
};
|
|
193
|
-
})(util4
|
|
193
|
+
})(util4 || (exports.util = util4 = {}));
|
|
194
194
|
var objectUtil2;
|
|
195
195
|
(function(objectUtil3) {
|
|
196
196
|
objectUtil3.mergeShapes = (first2, second) => {
|
|
@@ -199,7 +199,7 @@ var require_util = __commonJS({
|
|
|
199
199
|
...second
|
|
200
200
|
};
|
|
201
201
|
};
|
|
202
|
-
})(objectUtil2
|
|
202
|
+
})(objectUtil2 || (exports.objectUtil = objectUtil2 = {}));
|
|
203
203
|
exports.ZodParsedType = util4.arrayToEnum([
|
|
204
204
|
"string",
|
|
205
205
|
"nan",
|
|
@@ -267,9 +267,9 @@ var require_util = __commonJS({
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
270
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/ZodError.js
|
|
271
271
|
var require_ZodError = __commonJS({
|
|
272
|
-
"../../node_modules/.pnpm/zod@3.
|
|
272
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/ZodError.js"(exports) {
|
|
273
273
|
"use strict";
|
|
274
274
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
275
275
|
exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
|
|
@@ -298,6 +298,9 @@ var require_ZodError = __commonJS({
|
|
|
298
298
|
};
|
|
299
299
|
exports.quotelessJson = quotelessJson2;
|
|
300
300
|
var ZodError2 = class extends Error {
|
|
301
|
+
get errors() {
|
|
302
|
+
return this.issues;
|
|
303
|
+
}
|
|
301
304
|
constructor(issues) {
|
|
302
305
|
super();
|
|
303
306
|
this.issues = [];
|
|
@@ -316,9 +319,6 @@ var require_ZodError = __commonJS({
|
|
|
316
319
|
this.name = "ZodError";
|
|
317
320
|
this.issues = issues;
|
|
318
321
|
}
|
|
319
|
-
get errors() {
|
|
320
|
-
return this.issues;
|
|
321
|
-
}
|
|
322
322
|
format(_mapper) {
|
|
323
323
|
const mapper = _mapper || function(issue) {
|
|
324
324
|
return issue.message;
|
|
@@ -355,6 +355,11 @@ var require_ZodError = __commonJS({
|
|
|
355
355
|
processError(this);
|
|
356
356
|
return fieldErrors;
|
|
357
357
|
}
|
|
358
|
+
static assert(value) {
|
|
359
|
+
if (!(value instanceof ZodError2)) {
|
|
360
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
358
363
|
toString() {
|
|
359
364
|
return this.message;
|
|
360
365
|
}
|
|
@@ -389,9 +394,9 @@ var require_ZodError = __commonJS({
|
|
|
389
394
|
}
|
|
390
395
|
});
|
|
391
396
|
|
|
392
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
397
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/locales/en.js
|
|
393
398
|
var require_en = __commonJS({
|
|
394
|
-
"../../node_modules/.pnpm/zod@3.
|
|
399
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/locales/en.js"(exports) {
|
|
395
400
|
"use strict";
|
|
396
401
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
397
402
|
var util_1 = require_util();
|
|
@@ -498,9 +503,9 @@ var require_en = __commonJS({
|
|
|
498
503
|
}
|
|
499
504
|
});
|
|
500
505
|
|
|
501
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
506
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/errors.js
|
|
502
507
|
var require_errors = __commonJS({
|
|
503
|
-
"../../node_modules/.pnpm/zod@3.
|
|
508
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/errors.js"(exports) {
|
|
504
509
|
"use strict";
|
|
505
510
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
506
511
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -521,9 +526,9 @@ var require_errors = __commonJS({
|
|
|
521
526
|
}
|
|
522
527
|
});
|
|
523
528
|
|
|
524
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
529
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/parseUtil.js
|
|
525
530
|
var require_parseUtil = __commonJS({
|
|
526
|
-
"../../node_modules/.pnpm/zod@3.
|
|
531
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/parseUtil.js"(exports) {
|
|
527
532
|
"use strict";
|
|
528
533
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
529
534
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -539,6 +544,13 @@ var require_parseUtil = __commonJS({
|
|
|
539
544
|
...issueData,
|
|
540
545
|
path: fullPath
|
|
541
546
|
};
|
|
547
|
+
if (issueData.message !== void 0) {
|
|
548
|
+
return {
|
|
549
|
+
...issueData,
|
|
550
|
+
path: fullPath,
|
|
551
|
+
message: issueData.message
|
|
552
|
+
};
|
|
553
|
+
}
|
|
542
554
|
let errorMessage = "";
|
|
543
555
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
544
556
|
for (const map2 of maps) {
|
|
@@ -547,12 +559,13 @@ var require_parseUtil = __commonJS({
|
|
|
547
559
|
return {
|
|
548
560
|
...issueData,
|
|
549
561
|
path: fullPath,
|
|
550
|
-
message:
|
|
562
|
+
message: errorMessage
|
|
551
563
|
};
|
|
552
564
|
};
|
|
553
565
|
exports.makeIssue = makeIssue2;
|
|
554
566
|
exports.EMPTY_PATH = [];
|
|
555
567
|
function addIssueToContext2(ctx, issueData) {
|
|
568
|
+
const overrideMap = (0, errors_1.getErrorMap)();
|
|
556
569
|
const issue = (0, exports.makeIssue)({
|
|
557
570
|
issueData,
|
|
558
571
|
data: ctx.data,
|
|
@@ -560,8 +573,8 @@ var require_parseUtil = __commonJS({
|
|
|
560
573
|
errorMaps: [
|
|
561
574
|
ctx.common.contextualErrorMap,
|
|
562
575
|
ctx.schemaErrorMap,
|
|
563
|
-
|
|
564
|
-
en_1.default
|
|
576
|
+
overrideMap,
|
|
577
|
+
overrideMap === en_1.default ? void 0 : en_1.default
|
|
565
578
|
].filter((x) => !!x)
|
|
566
579
|
});
|
|
567
580
|
ctx.common.issues.push(issue);
|
|
@@ -593,9 +606,11 @@ var require_parseUtil = __commonJS({
|
|
|
593
606
|
static async mergeObjectAsync(status, pairs2) {
|
|
594
607
|
const syncPairs = [];
|
|
595
608
|
for (const pair of pairs2) {
|
|
609
|
+
const key = await pair.key;
|
|
610
|
+
const value = await pair.value;
|
|
596
611
|
syncPairs.push({
|
|
597
|
-
key
|
|
598
|
-
value
|
|
612
|
+
key,
|
|
613
|
+
value
|
|
599
614
|
});
|
|
600
615
|
}
|
|
601
616
|
return ParseStatus2.mergeObjectSync(status, syncPairs);
|
|
@@ -638,17 +653,17 @@ var require_parseUtil = __commonJS({
|
|
|
638
653
|
}
|
|
639
654
|
});
|
|
640
655
|
|
|
641
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
656
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/typeAliases.js
|
|
642
657
|
var require_typeAliases = __commonJS({
|
|
643
|
-
"../../node_modules/.pnpm/zod@3.
|
|
658
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/typeAliases.js"(exports) {
|
|
644
659
|
"use strict";
|
|
645
660
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
646
661
|
}
|
|
647
662
|
});
|
|
648
663
|
|
|
649
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
664
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/errorUtil.js
|
|
650
665
|
var require_errorUtil = __commonJS({
|
|
651
|
-
"../../node_modules/.pnpm/zod@3.
|
|
666
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/helpers/errorUtil.js"(exports) {
|
|
652
667
|
"use strict";
|
|
653
668
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
654
669
|
exports.errorUtil = void 0;
|
|
@@ -656,17 +671,35 @@ var require_errorUtil = __commonJS({
|
|
|
656
671
|
(function(errorUtil3) {
|
|
657
672
|
errorUtil3.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
658
673
|
errorUtil3.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
659
|
-
})(errorUtil2
|
|
674
|
+
})(errorUtil2 || (exports.errorUtil = errorUtil2 = {}));
|
|
660
675
|
}
|
|
661
676
|
});
|
|
662
677
|
|
|
663
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
678
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/types.js
|
|
664
679
|
var require_types = __commonJS({
|
|
665
|
-
"../../node_modules/.pnpm/zod@3.
|
|
680
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/types.js"(exports) {
|
|
666
681
|
"use strict";
|
|
682
|
+
var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state6, kind, f) {
|
|
683
|
+
if (kind === "a" && !f)
|
|
684
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
685
|
+
if (typeof state6 === "function" ? receiver !== state6 || !f : !state6.has(receiver))
|
|
686
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
687
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state6.get(receiver);
|
|
688
|
+
};
|
|
689
|
+
var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state6, value, kind, f) {
|
|
690
|
+
if (kind === "m")
|
|
691
|
+
throw new TypeError("Private method is not writable");
|
|
692
|
+
if (kind === "a" && !f)
|
|
693
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
694
|
+
if (typeof state6 === "function" ? receiver !== state6 || !f : !state6.has(receiver))
|
|
695
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
696
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state6.set(receiver, value), value;
|
|
697
|
+
};
|
|
698
|
+
var _ZodEnum_cache2;
|
|
699
|
+
var _ZodNativeEnum_cache2;
|
|
667
700
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
668
|
-
exports.
|
|
669
|
-
exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = exports.discriminatedUnion = void 0;
|
|
701
|
+
exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.datetimeRegex = exports.ZodType = void 0;
|
|
702
|
+
exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = exports.discriminatedUnion = exports.date = void 0;
|
|
670
703
|
var errors_1 = require_errors();
|
|
671
704
|
var errorUtil_1 = require_errorUtil();
|
|
672
705
|
var parseUtil_1 = require_parseUtil();
|
|
@@ -720,44 +753,21 @@ var require_types = __commonJS({
|
|
|
720
753
|
if (errorMap2)
|
|
721
754
|
return { errorMap: errorMap2, description };
|
|
722
755
|
const customMap = (iss, ctx) => {
|
|
723
|
-
|
|
724
|
-
|
|
756
|
+
var _a, _b;
|
|
757
|
+
const { message } = params;
|
|
758
|
+
if (iss.code === "invalid_enum_value") {
|
|
759
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
760
|
+
}
|
|
725
761
|
if (typeof ctx.data === "undefined") {
|
|
726
|
-
return { message:
|
|
762
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
727
763
|
}
|
|
728
|
-
|
|
764
|
+
if (iss.code !== "invalid_type")
|
|
765
|
+
return { message: ctx.defaultError };
|
|
766
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
729
767
|
};
|
|
730
768
|
return { errorMap: customMap, description };
|
|
731
769
|
}
|
|
732
770
|
var ZodType2 = class {
|
|
733
|
-
constructor(def) {
|
|
734
|
-
this.spa = this.safeParseAsync;
|
|
735
|
-
this._def = def;
|
|
736
|
-
this.parse = this.parse.bind(this);
|
|
737
|
-
this.safeParse = this.safeParse.bind(this);
|
|
738
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
739
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
740
|
-
this.spa = this.spa.bind(this);
|
|
741
|
-
this.refine = this.refine.bind(this);
|
|
742
|
-
this.refinement = this.refinement.bind(this);
|
|
743
|
-
this.superRefine = this.superRefine.bind(this);
|
|
744
|
-
this.optional = this.optional.bind(this);
|
|
745
|
-
this.nullable = this.nullable.bind(this);
|
|
746
|
-
this.nullish = this.nullish.bind(this);
|
|
747
|
-
this.array = this.array.bind(this);
|
|
748
|
-
this.promise = this.promise.bind(this);
|
|
749
|
-
this.or = this.or.bind(this);
|
|
750
|
-
this.and = this.and.bind(this);
|
|
751
|
-
this.transform = this.transform.bind(this);
|
|
752
|
-
this.brand = this.brand.bind(this);
|
|
753
|
-
this.default = this.default.bind(this);
|
|
754
|
-
this.catch = this.catch.bind(this);
|
|
755
|
-
this.describe = this.describe.bind(this);
|
|
756
|
-
this.pipe = this.pipe.bind(this);
|
|
757
|
-
this.readonly = this.readonly.bind(this);
|
|
758
|
-
this.isNullable = this.isNullable.bind(this);
|
|
759
|
-
this.isOptional = this.isOptional.bind(this);
|
|
760
|
-
}
|
|
761
771
|
get description() {
|
|
762
772
|
return this._def.description;
|
|
763
773
|
}
|
|
@@ -821,6 +831,43 @@ var require_types = __commonJS({
|
|
|
821
831
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
822
832
|
return handleResult2(ctx, result);
|
|
823
833
|
}
|
|
834
|
+
"~validate"(data) {
|
|
835
|
+
var _a, _b;
|
|
836
|
+
const ctx = {
|
|
837
|
+
common: {
|
|
838
|
+
issues: [],
|
|
839
|
+
async: !!this["~standard"].async
|
|
840
|
+
},
|
|
841
|
+
path: [],
|
|
842
|
+
schemaErrorMap: this._def.errorMap,
|
|
843
|
+
parent: null,
|
|
844
|
+
data,
|
|
845
|
+
parsedType: (0, util_1.getParsedType)(data)
|
|
846
|
+
};
|
|
847
|
+
if (!this["~standard"].async) {
|
|
848
|
+
try {
|
|
849
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
850
|
+
return (0, parseUtil_1.isValid)(result) ? {
|
|
851
|
+
value: result.value
|
|
852
|
+
} : {
|
|
853
|
+
issues: ctx.common.issues
|
|
854
|
+
};
|
|
855
|
+
} catch (err) {
|
|
856
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
857
|
+
this["~standard"].async = true;
|
|
858
|
+
}
|
|
859
|
+
ctx.common = {
|
|
860
|
+
issues: [],
|
|
861
|
+
async: true
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_1.isValid)(result) ? {
|
|
866
|
+
value: result.value
|
|
867
|
+
} : {
|
|
868
|
+
issues: ctx.common.issues
|
|
869
|
+
});
|
|
870
|
+
}
|
|
824
871
|
async parseAsync(data, params) {
|
|
825
872
|
const result = await this.safeParseAsync(data, params);
|
|
826
873
|
if (result.success)
|
|
@@ -898,6 +945,39 @@ var require_types = __commonJS({
|
|
|
898
945
|
superRefine(refinement) {
|
|
899
946
|
return this._refinement(refinement);
|
|
900
947
|
}
|
|
948
|
+
constructor(def) {
|
|
949
|
+
this.spa = this.safeParseAsync;
|
|
950
|
+
this._def = def;
|
|
951
|
+
this.parse = this.parse.bind(this);
|
|
952
|
+
this.safeParse = this.safeParse.bind(this);
|
|
953
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
954
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
955
|
+
this.spa = this.spa.bind(this);
|
|
956
|
+
this.refine = this.refine.bind(this);
|
|
957
|
+
this.refinement = this.refinement.bind(this);
|
|
958
|
+
this.superRefine = this.superRefine.bind(this);
|
|
959
|
+
this.optional = this.optional.bind(this);
|
|
960
|
+
this.nullable = this.nullable.bind(this);
|
|
961
|
+
this.nullish = this.nullish.bind(this);
|
|
962
|
+
this.array = this.array.bind(this);
|
|
963
|
+
this.promise = this.promise.bind(this);
|
|
964
|
+
this.or = this.or.bind(this);
|
|
965
|
+
this.and = this.and.bind(this);
|
|
966
|
+
this.transform = this.transform.bind(this);
|
|
967
|
+
this.brand = this.brand.bind(this);
|
|
968
|
+
this.default = this.default.bind(this);
|
|
969
|
+
this.catch = this.catch.bind(this);
|
|
970
|
+
this.describe = this.describe.bind(this);
|
|
971
|
+
this.pipe = this.pipe.bind(this);
|
|
972
|
+
this.readonly = this.readonly.bind(this);
|
|
973
|
+
this.isNullable = this.isNullable.bind(this);
|
|
974
|
+
this.isOptional = this.isOptional.bind(this);
|
|
975
|
+
this["~standard"] = {
|
|
976
|
+
version: 1,
|
|
977
|
+
vendor: "zod",
|
|
978
|
+
validate: (data) => this["~validate"](data)
|
|
979
|
+
};
|
|
980
|
+
}
|
|
901
981
|
optional() {
|
|
902
982
|
return ZodOptional2.create(this, this._def);
|
|
903
983
|
}
|
|
@@ -908,7 +988,7 @@ var require_types = __commonJS({
|
|
|
908
988
|
return this.nullable().optional();
|
|
909
989
|
}
|
|
910
990
|
array() {
|
|
911
|
-
return ZodArray2.create(this
|
|
991
|
+
return ZodArray2.create(this);
|
|
912
992
|
}
|
|
913
993
|
promise() {
|
|
914
994
|
return ZodPromise2.create(this, this._def);
|
|
@@ -976,35 +1056,46 @@ var require_types = __commonJS({
|
|
|
976
1056
|
exports.Schema = ZodType2;
|
|
977
1057
|
exports.ZodSchema = ZodType2;
|
|
978
1058
|
var cuidRegex2 = /^c[^\s-]{8,}$/i;
|
|
979
|
-
var cuid2Regex2 = /^[
|
|
980
|
-
var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
1059
|
+
var cuid2Regex2 = /^[0-9a-z]+$/;
|
|
1060
|
+
var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
981
1061
|
var uuidRegex2 = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
982
|
-
var
|
|
1062
|
+
var nanoidRegex2 = /^[a-z0-9_-]{21}$/i;
|
|
1063
|
+
var jwtRegex2 = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1064
|
+
var durationRegex2 = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
1065
|
+
var emailRegex2 = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
983
1066
|
var _emojiRegex2 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
984
1067
|
var emojiRegex2;
|
|
985
|
-
var ipv4Regex2 = /^((
|
|
986
|
-
var
|
|
987
|
-
var
|
|
1068
|
+
var ipv4Regex2 = /^(?:(?: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])$/;
|
|
1069
|
+
var ipv4CidrRegex2 = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
|
|
1070
|
+
var ipv6Regex2 = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1071
|
+
var ipv6CidrRegex2 = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1072
|
+
var base64Regex2 = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1073
|
+
var base64urlRegex2 = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1074
|
+
var dateRegexSource2 = `((\\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])))`;
|
|
1075
|
+
var dateRegex2 = new RegExp(`^${dateRegexSource2}$`);
|
|
1076
|
+
function timeRegexSource2(args) {
|
|
1077
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
988
1078
|
if (args.precision) {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1079
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
1080
|
+
} else if (args.precision == null) {
|
|
1081
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
1082
|
+
}
|
|
1083
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
1084
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
1085
|
+
}
|
|
1086
|
+
function timeRegex2(args) {
|
|
1087
|
+
return new RegExp(`^${timeRegexSource2(args)}$`);
|
|
1088
|
+
}
|
|
1089
|
+
function datetimeRegex2(args) {
|
|
1090
|
+
let regex = `${dateRegexSource2}T${timeRegexSource2(args)}`;
|
|
1091
|
+
const opts = [];
|
|
1092
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
1093
|
+
if (args.offset)
|
|
1094
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
1095
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
1096
|
+
return new RegExp(`^${regex}$`);
|
|
1097
|
+
}
|
|
1098
|
+
exports.datetimeRegex = datetimeRegex2;
|
|
1008
1099
|
function isValidIP2(ip, version) {
|
|
1009
1100
|
if ((version === "v4" || !version) && ipv4Regex2.test(ip)) {
|
|
1010
1101
|
return true;
|
|
@@ -1014,6 +1105,33 @@ var require_types = __commonJS({
|
|
|
1014
1105
|
}
|
|
1015
1106
|
return false;
|
|
1016
1107
|
}
|
|
1108
|
+
function isValidJWT2(jwt, alg) {
|
|
1109
|
+
if (!jwtRegex2.test(jwt))
|
|
1110
|
+
return false;
|
|
1111
|
+
try {
|
|
1112
|
+
const [header] = jwt.split(".");
|
|
1113
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
1114
|
+
const decoded = JSON.parse(atob(base64));
|
|
1115
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
1116
|
+
return false;
|
|
1117
|
+
if (!decoded.typ || !decoded.alg)
|
|
1118
|
+
return false;
|
|
1119
|
+
if (alg && decoded.alg !== alg)
|
|
1120
|
+
return false;
|
|
1121
|
+
return true;
|
|
1122
|
+
} catch (_a) {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function isValidCidr2(ip, version) {
|
|
1127
|
+
if ((version === "v4" || !version) && ipv4CidrRegex2.test(ip)) {
|
|
1128
|
+
return true;
|
|
1129
|
+
}
|
|
1130
|
+
if ((version === "v6" || !version) && ipv6CidrRegex2.test(ip)) {
|
|
1131
|
+
return true;
|
|
1132
|
+
}
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1017
1135
|
var ZodString2 = class extends ZodType2 {
|
|
1018
1136
|
_parse(input) {
|
|
1019
1137
|
if (this._def.coerce) {
|
|
@@ -1022,14 +1140,11 @@ var require_types = __commonJS({
|
|
|
1022
1140
|
const parsedType = this._getType(input);
|
|
1023
1141
|
if (parsedType !== util_1.ZodParsedType.string) {
|
|
1024
1142
|
const ctx2 = this._getOrReturnCtx(input);
|
|
1025
|
-
(0, parseUtil_1.addIssueToContext)(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
received: ctx2.parsedType
|
|
1031
|
-
}
|
|
1032
|
-
);
|
|
1143
|
+
(0, parseUtil_1.addIssueToContext)(ctx2, {
|
|
1144
|
+
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
1145
|
+
expected: util_1.ZodParsedType.string,
|
|
1146
|
+
received: ctx2.parsedType
|
|
1147
|
+
});
|
|
1033
1148
|
return parseUtil_1.INVALID;
|
|
1034
1149
|
}
|
|
1035
1150
|
const status = new parseUtil_1.ParseStatus();
|
|
@@ -1120,6 +1235,16 @@ var require_types = __commonJS({
|
|
|
1120
1235
|
});
|
|
1121
1236
|
status.dirty();
|
|
1122
1237
|
}
|
|
1238
|
+
} else if (check.kind === "nanoid") {
|
|
1239
|
+
if (!nanoidRegex2.test(input.data)) {
|
|
1240
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1241
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1242
|
+
validation: "nanoid",
|
|
1243
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1244
|
+
message: check.message
|
|
1245
|
+
});
|
|
1246
|
+
status.dirty();
|
|
1247
|
+
}
|
|
1123
1248
|
} else if (check.kind === "cuid") {
|
|
1124
1249
|
if (!cuidRegex2.test(input.data)) {
|
|
1125
1250
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1221,6 +1346,38 @@ var require_types = __commonJS({
|
|
|
1221
1346
|
});
|
|
1222
1347
|
status.dirty();
|
|
1223
1348
|
}
|
|
1349
|
+
} else if (check.kind === "date") {
|
|
1350
|
+
const regex = dateRegex2;
|
|
1351
|
+
if (!regex.test(input.data)) {
|
|
1352
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1353
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1354
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1355
|
+
validation: "date",
|
|
1356
|
+
message: check.message
|
|
1357
|
+
});
|
|
1358
|
+
status.dirty();
|
|
1359
|
+
}
|
|
1360
|
+
} else if (check.kind === "time") {
|
|
1361
|
+
const regex = timeRegex2(check);
|
|
1362
|
+
if (!regex.test(input.data)) {
|
|
1363
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1364
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1365
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1366
|
+
validation: "time",
|
|
1367
|
+
message: check.message
|
|
1368
|
+
});
|
|
1369
|
+
status.dirty();
|
|
1370
|
+
}
|
|
1371
|
+
} else if (check.kind === "duration") {
|
|
1372
|
+
if (!durationRegex2.test(input.data)) {
|
|
1373
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1374
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1375
|
+
validation: "duration",
|
|
1376
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1377
|
+
message: check.message
|
|
1378
|
+
});
|
|
1379
|
+
status.dirty();
|
|
1380
|
+
}
|
|
1224
1381
|
} else if (check.kind === "ip") {
|
|
1225
1382
|
if (!isValidIP2(input.data, check.version)) {
|
|
1226
1383
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1231,6 +1388,46 @@ var require_types = __commonJS({
|
|
|
1231
1388
|
});
|
|
1232
1389
|
status.dirty();
|
|
1233
1390
|
}
|
|
1391
|
+
} else if (check.kind === "jwt") {
|
|
1392
|
+
if (!isValidJWT2(input.data, check.alg)) {
|
|
1393
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1394
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1395
|
+
validation: "jwt",
|
|
1396
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1397
|
+
message: check.message
|
|
1398
|
+
});
|
|
1399
|
+
status.dirty();
|
|
1400
|
+
}
|
|
1401
|
+
} else if (check.kind === "cidr") {
|
|
1402
|
+
if (!isValidCidr2(input.data, check.version)) {
|
|
1403
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1404
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1405
|
+
validation: "cidr",
|
|
1406
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1407
|
+
message: check.message
|
|
1408
|
+
});
|
|
1409
|
+
status.dirty();
|
|
1410
|
+
}
|
|
1411
|
+
} else if (check.kind === "base64") {
|
|
1412
|
+
if (!base64Regex2.test(input.data)) {
|
|
1413
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1414
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1415
|
+
validation: "base64",
|
|
1416
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1417
|
+
message: check.message
|
|
1418
|
+
});
|
|
1419
|
+
status.dirty();
|
|
1420
|
+
}
|
|
1421
|
+
} else if (check.kind === "base64url") {
|
|
1422
|
+
if (!base64urlRegex2.test(input.data)) {
|
|
1423
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1424
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1425
|
+
validation: "base64url",
|
|
1426
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1427
|
+
message: check.message
|
|
1428
|
+
});
|
|
1429
|
+
status.dirty();
|
|
1430
|
+
}
|
|
1234
1431
|
} else {
|
|
1235
1432
|
util_1.util.assertNever(check);
|
|
1236
1433
|
}
|
|
@@ -1262,6 +1459,9 @@ var require_types = __commonJS({
|
|
|
1262
1459
|
uuid(message) {
|
|
1263
1460
|
return this._addCheck({ kind: "uuid", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1264
1461
|
}
|
|
1462
|
+
nanoid(message) {
|
|
1463
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1464
|
+
}
|
|
1265
1465
|
cuid(message) {
|
|
1266
1466
|
return this._addCheck({ kind: "cuid", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1267
1467
|
}
|
|
@@ -1271,16 +1471,32 @@ var require_types = __commonJS({
|
|
|
1271
1471
|
ulid(message) {
|
|
1272
1472
|
return this._addCheck({ kind: "ulid", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1273
1473
|
}
|
|
1474
|
+
base64(message) {
|
|
1475
|
+
return this._addCheck({ kind: "base64", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1476
|
+
}
|
|
1477
|
+
base64url(message) {
|
|
1478
|
+
return this._addCheck({
|
|
1479
|
+
kind: "base64url",
|
|
1480
|
+
...errorUtil_1.errorUtil.errToObj(message)
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
jwt(options) {
|
|
1484
|
+
return this._addCheck({ kind: "jwt", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1485
|
+
}
|
|
1274
1486
|
ip(options) {
|
|
1275
1487
|
return this._addCheck({ kind: "ip", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1276
1488
|
}
|
|
1489
|
+
cidr(options) {
|
|
1490
|
+
return this._addCheck({ kind: "cidr", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1491
|
+
}
|
|
1277
1492
|
datetime(options) {
|
|
1278
|
-
var _a;
|
|
1493
|
+
var _a, _b;
|
|
1279
1494
|
if (typeof options === "string") {
|
|
1280
1495
|
return this._addCheck({
|
|
1281
1496
|
kind: "datetime",
|
|
1282
1497
|
precision: null,
|
|
1283
1498
|
offset: false,
|
|
1499
|
+
local: false,
|
|
1284
1500
|
message: options
|
|
1285
1501
|
});
|
|
1286
1502
|
}
|
|
@@ -1288,9 +1504,30 @@ var require_types = __commonJS({
|
|
|
1288
1504
|
kind: "datetime",
|
|
1289
1505
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1290
1506
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1507
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1291
1508
|
...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1292
1509
|
});
|
|
1293
1510
|
}
|
|
1511
|
+
date(message) {
|
|
1512
|
+
return this._addCheck({ kind: "date", message });
|
|
1513
|
+
}
|
|
1514
|
+
time(options) {
|
|
1515
|
+
if (typeof options === "string") {
|
|
1516
|
+
return this._addCheck({
|
|
1517
|
+
kind: "time",
|
|
1518
|
+
precision: null,
|
|
1519
|
+
message: options
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
return this._addCheck({
|
|
1523
|
+
kind: "time",
|
|
1524
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1525
|
+
...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
duration(message) {
|
|
1529
|
+
return this._addCheck({ kind: "duration", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1530
|
+
}
|
|
1294
1531
|
regex(regex, message) {
|
|
1295
1532
|
return this._addCheck({
|
|
1296
1533
|
kind: "regex",
|
|
@@ -1365,6 +1602,15 @@ var require_types = __commonJS({
|
|
|
1365
1602
|
get isDatetime() {
|
|
1366
1603
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1367
1604
|
}
|
|
1605
|
+
get isDate() {
|
|
1606
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1607
|
+
}
|
|
1608
|
+
get isTime() {
|
|
1609
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1610
|
+
}
|
|
1611
|
+
get isDuration() {
|
|
1612
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1613
|
+
}
|
|
1368
1614
|
get isEmail() {
|
|
1369
1615
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1370
1616
|
}
|
|
@@ -1377,6 +1623,9 @@ var require_types = __commonJS({
|
|
|
1377
1623
|
get isUUID() {
|
|
1378
1624
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1379
1625
|
}
|
|
1626
|
+
get isNANOID() {
|
|
1627
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1628
|
+
}
|
|
1380
1629
|
get isCUID() {
|
|
1381
1630
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1382
1631
|
}
|
|
@@ -1389,6 +1638,15 @@ var require_types = __commonJS({
|
|
|
1389
1638
|
get isIP() {
|
|
1390
1639
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1391
1640
|
}
|
|
1641
|
+
get isCIDR() {
|
|
1642
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1643
|
+
}
|
|
1644
|
+
get isBase64() {
|
|
1645
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1646
|
+
}
|
|
1647
|
+
get isBase64url() {
|
|
1648
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1649
|
+
}
|
|
1392
1650
|
get minLength() {
|
|
1393
1651
|
let min2 = null;
|
|
1394
1652
|
for (const ch of this._def.checks) {
|
|
@@ -1668,17 +1926,15 @@ var require_types = __commonJS({
|
|
|
1668
1926
|
}
|
|
1669
1927
|
_parse(input) {
|
|
1670
1928
|
if (this._def.coerce) {
|
|
1671
|
-
|
|
1929
|
+
try {
|
|
1930
|
+
input.data = BigInt(input.data);
|
|
1931
|
+
} catch (_a) {
|
|
1932
|
+
return this._getInvalidInput(input);
|
|
1933
|
+
}
|
|
1672
1934
|
}
|
|
1673
1935
|
const parsedType = this._getType(input);
|
|
1674
1936
|
if (parsedType !== util_1.ZodParsedType.bigint) {
|
|
1675
|
-
|
|
1676
|
-
(0, parseUtil_1.addIssueToContext)(ctx2, {
|
|
1677
|
-
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
1678
|
-
expected: util_1.ZodParsedType.bigint,
|
|
1679
|
-
received: ctx2.parsedType
|
|
1680
|
-
});
|
|
1681
|
-
return parseUtil_1.INVALID;
|
|
1937
|
+
return this._getInvalidInput(input);
|
|
1682
1938
|
}
|
|
1683
1939
|
let ctx = void 0;
|
|
1684
1940
|
const status = new parseUtil_1.ParseStatus();
|
|
@@ -1725,6 +1981,15 @@ var require_types = __commonJS({
|
|
|
1725
1981
|
}
|
|
1726
1982
|
return { status: status.value, value: input.data };
|
|
1727
1983
|
}
|
|
1984
|
+
_getInvalidInput(input) {
|
|
1985
|
+
const ctx = this._getOrReturnCtx(input);
|
|
1986
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1987
|
+
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
1988
|
+
expected: util_1.ZodParsedType.bigint,
|
|
1989
|
+
received: ctx.parsedType
|
|
1990
|
+
});
|
|
1991
|
+
return parseUtil_1.INVALID;
|
|
1992
|
+
}
|
|
1728
1993
|
gte(value, message) {
|
|
1729
1994
|
return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
|
|
1730
1995
|
}
|
|
@@ -2313,9 +2578,10 @@ var require_types = __commonJS({
|
|
|
2313
2578
|
const syncPairs = [];
|
|
2314
2579
|
for (const pair of pairs2) {
|
|
2315
2580
|
const key = await pair.key;
|
|
2581
|
+
const value = await pair.value;
|
|
2316
2582
|
syncPairs.push({
|
|
2317
2583
|
key,
|
|
2318
|
-
value
|
|
2584
|
+
value,
|
|
2319
2585
|
alwaysSet: pair.alwaysSet
|
|
2320
2586
|
});
|
|
2321
2587
|
}
|
|
@@ -2587,15 +2853,25 @@ var require_types = __commonJS({
|
|
|
2587
2853
|
} else if (type2 instanceof ZodEnum2) {
|
|
2588
2854
|
return type2.options;
|
|
2589
2855
|
} else if (type2 instanceof ZodNativeEnum2) {
|
|
2590
|
-
return
|
|
2856
|
+
return util_1.util.objectValues(type2.enum);
|
|
2591
2857
|
} else if (type2 instanceof ZodDefault2) {
|
|
2592
2858
|
return getDiscriminator2(type2._def.innerType);
|
|
2593
2859
|
} else if (type2 instanceof ZodUndefined2) {
|
|
2594
2860
|
return [void 0];
|
|
2595
2861
|
} else if (type2 instanceof ZodNull2) {
|
|
2596
2862
|
return [null];
|
|
2863
|
+
} else if (type2 instanceof ZodOptional2) {
|
|
2864
|
+
return [void 0, ...getDiscriminator2(type2.unwrap())];
|
|
2865
|
+
} else if (type2 instanceof ZodNullable2) {
|
|
2866
|
+
return [null, ...getDiscriminator2(type2.unwrap())];
|
|
2867
|
+
} else if (type2 instanceof ZodBranded2) {
|
|
2868
|
+
return getDiscriminator2(type2.unwrap());
|
|
2869
|
+
} else if (type2 instanceof ZodReadonly2) {
|
|
2870
|
+
return getDiscriminator2(type2.unwrap());
|
|
2871
|
+
} else if (type2 instanceof ZodCatch2) {
|
|
2872
|
+
return getDiscriminator2(type2._def.innerType);
|
|
2597
2873
|
} else {
|
|
2598
|
-
return
|
|
2874
|
+
return [];
|
|
2599
2875
|
}
|
|
2600
2876
|
};
|
|
2601
2877
|
var ZodDiscriminatedUnion2 = class extends ZodType2 {
|
|
@@ -2647,7 +2923,7 @@ var require_types = __commonJS({
|
|
|
2647
2923
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2648
2924
|
for (const type2 of options) {
|
|
2649
2925
|
const discriminatorValues = getDiscriminator2(type2.shape[discriminator]);
|
|
2650
|
-
if (!discriminatorValues) {
|
|
2926
|
+
if (!discriminatorValues.length) {
|
|
2651
2927
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2652
2928
|
}
|
|
2653
2929
|
for (const value of discriminatorValues) {
|
|
@@ -2850,7 +3126,8 @@ var require_types = __commonJS({
|
|
|
2850
3126
|
for (const key in ctx.data) {
|
|
2851
3127
|
pairs2.push({
|
|
2852
3128
|
key: keyType._parse(new ParseInputLazyPath2(ctx, key, ctx.path, key)),
|
|
2853
|
-
value: valueType._parse(new ParseInputLazyPath2(ctx, ctx.data[key], ctx.path, key))
|
|
3129
|
+
value: valueType._parse(new ParseInputLazyPath2(ctx, ctx.data[key], ctx.path, key)),
|
|
3130
|
+
alwaysSet: key in ctx.data
|
|
2854
3131
|
});
|
|
2855
3132
|
}
|
|
2856
3133
|
if (ctx.common.async) {
|
|
@@ -3200,6 +3477,10 @@ var require_types = __commonJS({
|
|
|
3200
3477
|
});
|
|
3201
3478
|
}
|
|
3202
3479
|
var ZodEnum2 = class extends ZodType2 {
|
|
3480
|
+
constructor() {
|
|
3481
|
+
super(...arguments);
|
|
3482
|
+
_ZodEnum_cache2.set(this, void 0);
|
|
3483
|
+
}
|
|
3203
3484
|
_parse(input) {
|
|
3204
3485
|
if (typeof input.data !== "string") {
|
|
3205
3486
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3211,7 +3492,10 @@ var require_types = __commonJS({
|
|
|
3211
3492
|
});
|
|
3212
3493
|
return parseUtil_1.INVALID;
|
|
3213
3494
|
}
|
|
3214
|
-
if (this
|
|
3495
|
+
if (!__classPrivateFieldGet2(this, _ZodEnum_cache2, "f")) {
|
|
3496
|
+
__classPrivateFieldSet2(this, _ZodEnum_cache2, new Set(this._def.values), "f");
|
|
3497
|
+
}
|
|
3498
|
+
if (!__classPrivateFieldGet2(this, _ZodEnum_cache2, "f").has(input.data)) {
|
|
3215
3499
|
const ctx = this._getOrReturnCtx(input);
|
|
3216
3500
|
const expectedValues = this._def.values;
|
|
3217
3501
|
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
@@ -3247,16 +3531,27 @@ var require_types = __commonJS({
|
|
|
3247
3531
|
}
|
|
3248
3532
|
return enumValues;
|
|
3249
3533
|
}
|
|
3250
|
-
extract(values) {
|
|
3251
|
-
return ZodEnum2.create(values
|
|
3534
|
+
extract(values, newDef = this._def) {
|
|
3535
|
+
return ZodEnum2.create(values, {
|
|
3536
|
+
...this._def,
|
|
3537
|
+
...newDef
|
|
3538
|
+
});
|
|
3252
3539
|
}
|
|
3253
|
-
exclude(values) {
|
|
3254
|
-
return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt))
|
|
3540
|
+
exclude(values, newDef = this._def) {
|
|
3541
|
+
return ZodEnum2.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3542
|
+
...this._def,
|
|
3543
|
+
...newDef
|
|
3544
|
+
});
|
|
3255
3545
|
}
|
|
3256
3546
|
};
|
|
3257
3547
|
exports.ZodEnum = ZodEnum2;
|
|
3548
|
+
_ZodEnum_cache2 = /* @__PURE__ */ new WeakMap();
|
|
3258
3549
|
ZodEnum2.create = createZodEnum2;
|
|
3259
3550
|
var ZodNativeEnum2 = class extends ZodType2 {
|
|
3551
|
+
constructor() {
|
|
3552
|
+
super(...arguments);
|
|
3553
|
+
_ZodNativeEnum_cache2.set(this, void 0);
|
|
3554
|
+
}
|
|
3260
3555
|
_parse(input) {
|
|
3261
3556
|
const nativeEnumValues = util_1.util.getValidEnumValues(this._def.values);
|
|
3262
3557
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3269,7 +3564,10 @@ var require_types = __commonJS({
|
|
|
3269
3564
|
});
|
|
3270
3565
|
return parseUtil_1.INVALID;
|
|
3271
3566
|
}
|
|
3272
|
-
if (
|
|
3567
|
+
if (!__classPrivateFieldGet2(this, _ZodNativeEnum_cache2, "f")) {
|
|
3568
|
+
__classPrivateFieldSet2(this, _ZodNativeEnum_cache2, new Set(util_1.util.getValidEnumValues(this._def.values)), "f");
|
|
3569
|
+
}
|
|
3570
|
+
if (!__classPrivateFieldGet2(this, _ZodNativeEnum_cache2, "f").has(input.data)) {
|
|
3273
3571
|
const expectedValues = util_1.util.objectValues(nativeEnumValues);
|
|
3274
3572
|
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
3275
3573
|
received: ctx.data,
|
|
@@ -3285,6 +3583,7 @@ var require_types = __commonJS({
|
|
|
3285
3583
|
}
|
|
3286
3584
|
};
|
|
3287
3585
|
exports.ZodNativeEnum = ZodNativeEnum2;
|
|
3586
|
+
_ZodNativeEnum_cache2 = /* @__PURE__ */ new WeakMap();
|
|
3288
3587
|
ZodNativeEnum2.create = (values, params) => {
|
|
3289
3588
|
return new ZodNativeEnum2({
|
|
3290
3589
|
values,
|
|
@@ -3349,26 +3648,38 @@ var require_types = __commonJS({
|
|
|
3349
3648
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3350
3649
|
if (effect.type === "preprocess") {
|
|
3351
3650
|
const processed = effect.transform(ctx.data, checkCtx);
|
|
3352
|
-
if (ctx.common.issues.length) {
|
|
3353
|
-
return {
|
|
3354
|
-
status: "dirty",
|
|
3355
|
-
value: ctx.data
|
|
3356
|
-
};
|
|
3357
|
-
}
|
|
3358
3651
|
if (ctx.common.async) {
|
|
3359
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
3360
|
-
|
|
3652
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3653
|
+
if (status.value === "aborted")
|
|
3654
|
+
return parseUtil_1.INVALID;
|
|
3655
|
+
const result = await this._def.schema._parseAsync({
|
|
3361
3656
|
data: processed2,
|
|
3362
3657
|
path: ctx.path,
|
|
3363
3658
|
parent: ctx
|
|
3364
3659
|
});
|
|
3660
|
+
if (result.status === "aborted")
|
|
3661
|
+
return parseUtil_1.INVALID;
|
|
3662
|
+
if (result.status === "dirty")
|
|
3663
|
+
return (0, parseUtil_1.DIRTY)(result.value);
|
|
3664
|
+
if (status.value === "dirty")
|
|
3665
|
+
return (0, parseUtil_1.DIRTY)(result.value);
|
|
3666
|
+
return result;
|
|
3365
3667
|
});
|
|
3366
3668
|
} else {
|
|
3367
|
-
|
|
3669
|
+
if (status.value === "aborted")
|
|
3670
|
+
return parseUtil_1.INVALID;
|
|
3671
|
+
const result = this._def.schema._parseSync({
|
|
3368
3672
|
data: processed,
|
|
3369
3673
|
path: ctx.path,
|
|
3370
3674
|
parent: ctx
|
|
3371
3675
|
});
|
|
3676
|
+
if (result.status === "aborted")
|
|
3677
|
+
return parseUtil_1.INVALID;
|
|
3678
|
+
if (result.status === "dirty")
|
|
3679
|
+
return (0, parseUtil_1.DIRTY)(result.value);
|
|
3680
|
+
if (status.value === "dirty")
|
|
3681
|
+
return (0, parseUtil_1.DIRTY)(result.value);
|
|
3682
|
+
return result;
|
|
3372
3683
|
}
|
|
3373
3684
|
}
|
|
3374
3685
|
if (effect.type === "refinement") {
|
|
@@ -3666,10 +3977,16 @@ var require_types = __commonJS({
|
|
|
3666
3977
|
var ZodReadonly2 = class extends ZodType2 {
|
|
3667
3978
|
_parse(input) {
|
|
3668
3979
|
const result = this._def.innerType._parse(input);
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3980
|
+
const freeze = (data) => {
|
|
3981
|
+
if ((0, parseUtil_1.isValid)(data)) {
|
|
3982
|
+
data.value = Object.freeze(data.value);
|
|
3983
|
+
}
|
|
3984
|
+
return data;
|
|
3985
|
+
};
|
|
3986
|
+
return (0, parseUtil_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3987
|
+
}
|
|
3988
|
+
unwrap() {
|
|
3989
|
+
return this._def.innerType;
|
|
3673
3990
|
}
|
|
3674
3991
|
};
|
|
3675
3992
|
exports.ZodReadonly = ZodReadonly2;
|
|
@@ -3680,19 +3997,35 @@ var require_types = __commonJS({
|
|
|
3680
3997
|
...processCreateParams2(params)
|
|
3681
3998
|
});
|
|
3682
3999
|
};
|
|
3683
|
-
|
|
4000
|
+
function cleanParams2(params, data) {
|
|
4001
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
4002
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
4003
|
+
return p2;
|
|
4004
|
+
}
|
|
4005
|
+
function custom2(check, _params = {}, fatal) {
|
|
3684
4006
|
if (check)
|
|
3685
4007
|
return ZodAny2.create().superRefine((data, ctx) => {
|
|
3686
4008
|
var _a, _b;
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
4009
|
+
const r = check(data);
|
|
4010
|
+
if (r instanceof Promise) {
|
|
4011
|
+
return r.then((r2) => {
|
|
4012
|
+
var _a2, _b2;
|
|
4013
|
+
if (!r2) {
|
|
4014
|
+
const params = cleanParams2(_params, data);
|
|
4015
|
+
const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
|
|
4016
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4017
|
+
}
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
if (!r) {
|
|
4021
|
+
const params = cleanParams2(_params, data);
|
|
4022
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
4023
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3692
4024
|
}
|
|
4025
|
+
return;
|
|
3693
4026
|
});
|
|
3694
4027
|
return ZodAny2.create();
|
|
3695
|
-
}
|
|
4028
|
+
}
|
|
3696
4029
|
exports.custom = custom2;
|
|
3697
4030
|
exports.late = {
|
|
3698
4031
|
object: ZodObject2.lazycreate
|
|
@@ -3735,10 +4068,10 @@ var require_types = __commonJS({
|
|
|
3735
4068
|
ZodFirstPartyTypeKind3["ZodBranded"] = "ZodBranded";
|
|
3736
4069
|
ZodFirstPartyTypeKind3["ZodPipeline"] = "ZodPipeline";
|
|
3737
4070
|
ZodFirstPartyTypeKind3["ZodReadonly"] = "ZodReadonly";
|
|
3738
|
-
})(ZodFirstPartyTypeKind2
|
|
4071
|
+
})(ZodFirstPartyTypeKind2 || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind2 = {}));
|
|
3739
4072
|
var instanceOfType2 = (cls, params = {
|
|
3740
4073
|
message: `Input not instance of ${cls.name}`
|
|
3741
|
-
}) => (
|
|
4074
|
+
}) => custom2((data) => data instanceof cls, params);
|
|
3742
4075
|
exports.instanceof = instanceOfType2;
|
|
3743
4076
|
var stringType2 = ZodString2.create;
|
|
3744
4077
|
exports.string = stringType2;
|
|
@@ -3829,16 +4162,20 @@ var require_types = __commonJS({
|
|
|
3829
4162
|
}
|
|
3830
4163
|
});
|
|
3831
4164
|
|
|
3832
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
4165
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/external.js
|
|
3833
4166
|
var require_external = __commonJS({
|
|
3834
|
-
"../../node_modules/.pnpm/zod@3.
|
|
4167
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/external.js"(exports) {
|
|
3835
4168
|
"use strict";
|
|
3836
4169
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3837
4170
|
if (k2 === void 0)
|
|
3838
4171
|
k2 = k;
|
|
3839
|
-
Object.
|
|
3840
|
-
|
|
3841
|
-
|
|
4172
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4173
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4174
|
+
desc = { enumerable: true, get: function() {
|
|
4175
|
+
return m[k];
|
|
4176
|
+
} };
|
|
4177
|
+
}
|
|
4178
|
+
Object.defineProperty(o, k2, desc);
|
|
3842
4179
|
} : function(o, m, k, k2) {
|
|
3843
4180
|
if (k2 === void 0)
|
|
3844
4181
|
k2 = k;
|
|
@@ -3859,16 +4196,20 @@ var require_external = __commonJS({
|
|
|
3859
4196
|
}
|
|
3860
4197
|
});
|
|
3861
4198
|
|
|
3862
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
4199
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/index.js
|
|
3863
4200
|
var require_lib = __commonJS({
|
|
3864
|
-
"../../node_modules/.pnpm/zod@3.
|
|
4201
|
+
"../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/index.js"(exports) {
|
|
3865
4202
|
"use strict";
|
|
3866
4203
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3867
4204
|
if (k2 === void 0)
|
|
3868
4205
|
k2 = k;
|
|
3869
|
-
Object.
|
|
3870
|
-
|
|
3871
|
-
|
|
4206
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4207
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4208
|
+
desc = { enumerable: true, get: function() {
|
|
4209
|
+
return m[k];
|
|
4210
|
+
} };
|
|
4211
|
+
}
|
|
4212
|
+
Object.defineProperty(o, k2, desc);
|
|
3872
4213
|
} : function(o, m, k, k2) {
|
|
3873
4214
|
if (k2 === void 0)
|
|
3874
4215
|
k2 = k;
|
|
@@ -3905,9 +4246,9 @@ var require_lib = __commonJS({
|
|
|
3905
4246
|
}
|
|
3906
4247
|
});
|
|
3907
4248
|
|
|
3908
|
-
// ../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.
|
|
4249
|
+
// ../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.24.4/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js
|
|
3909
4250
|
var require_zod_openapi = __commonJS({
|
|
3910
|
-
"../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.
|
|
4251
|
+
"../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.24.4/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js"(exports) {
|
|
3911
4252
|
"use strict";
|
|
3912
4253
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3913
4254
|
exports.generateSchema = exports.extendApi = void 0;
|
|
@@ -4164,9 +4505,9 @@ var require_zod_openapi = __commonJS({
|
|
|
4164
4505
|
}
|
|
4165
4506
|
});
|
|
4166
4507
|
|
|
4167
|
-
// ../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.
|
|
4508
|
+
// ../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.24.4/node_modules/@anatine/zod-openapi/src/index.js
|
|
4168
4509
|
var require_src = __commonJS({
|
|
4169
|
-
"../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.
|
|
4510
|
+
"../../node_modules/.pnpm/@anatine+zod-openapi@1.12.1_openapi3-ts@2.0.2_zod@3.24.4/node_modules/@anatine/zod-openapi/src/index.js"(exports) {
|
|
4170
4511
|
"use strict";
|
|
4171
4512
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4172
4513
|
if (k2 === void 0)
|
|
@@ -162311,8 +162652,8 @@ var require_prettier = __commonJS({
|
|
|
162311
162652
|
__asyncValues: () => __asyncValues,
|
|
162312
162653
|
__await: () => __await,
|
|
162313
162654
|
__awaiter: () => __awaiter,
|
|
162314
|
-
__classPrivateFieldGet: () =>
|
|
162315
|
-
__classPrivateFieldSet: () =>
|
|
162655
|
+
__classPrivateFieldGet: () => __classPrivateFieldGet2,
|
|
162656
|
+
__classPrivateFieldSet: () => __classPrivateFieldSet2,
|
|
162316
162657
|
__createBinding: () => __createBinding,
|
|
162317
162658
|
__decorate: () => __decorate,
|
|
162318
162659
|
__exportStar: () => __exportStar,
|
|
@@ -162653,13 +162994,13 @@ var require_prettier = __commonJS({
|
|
|
162653
162994
|
default: mod
|
|
162654
162995
|
};
|
|
162655
162996
|
}
|
|
162656
|
-
function
|
|
162997
|
+
function __classPrivateFieldGet2(receiver, privateMap) {
|
|
162657
162998
|
if (!privateMap.has(receiver)) {
|
|
162658
162999
|
throw new TypeError("attempted to get private field on non-instance");
|
|
162659
163000
|
}
|
|
162660
163001
|
return privateMap.get(receiver);
|
|
162661
163002
|
}
|
|
162662
|
-
function
|
|
163003
|
+
function __classPrivateFieldSet2(receiver, privateMap, value) {
|
|
162663
163004
|
if (!privateMap.has(receiver)) {
|
|
162664
163005
|
throw new TypeError("attempted to set private field on non-instance");
|
|
162665
163006
|
}
|
|
@@ -275829,7 +276170,7 @@ var import_openapi3_ts = __toESM(require_dist3(), 1);
|
|
|
275829
276170
|
var import_verror2 = __toESM(require_verror(), 1);
|
|
275830
276171
|
var import_verror3 = __toESM(require_verror(), 1);
|
|
275831
276172
|
|
|
275832
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
276173
|
+
// ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/index.mjs
|
|
275833
276174
|
var util3;
|
|
275834
276175
|
(function(util4) {
|
|
275835
276176
|
util4.assertEqual = (val) => val;
|
|
@@ -275983,6 +276324,9 @@ var quotelessJson = (obj) => {
|
|
|
275983
276324
|
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
275984
276325
|
};
|
|
275985
276326
|
var ZodError = class extends Error {
|
|
276327
|
+
get errors() {
|
|
276328
|
+
return this.issues;
|
|
276329
|
+
}
|
|
275986
276330
|
constructor(issues) {
|
|
275987
276331
|
super();
|
|
275988
276332
|
this.issues = [];
|
|
@@ -276001,9 +276345,6 @@ var ZodError = class extends Error {
|
|
|
276001
276345
|
this.name = "ZodError";
|
|
276002
276346
|
this.issues = issues;
|
|
276003
276347
|
}
|
|
276004
|
-
get errors() {
|
|
276005
|
-
return this.issues;
|
|
276006
|
-
}
|
|
276007
276348
|
format(_mapper) {
|
|
276008
276349
|
const mapper = _mapper || function(issue) {
|
|
276009
276350
|
return issue.message;
|
|
@@ -276040,6 +276381,11 @@ var ZodError = class extends Error {
|
|
|
276040
276381
|
processError(this);
|
|
276041
276382
|
return fieldErrors;
|
|
276042
276383
|
}
|
|
276384
|
+
static assert(value) {
|
|
276385
|
+
if (!(value instanceof ZodError)) {
|
|
276386
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
276387
|
+
}
|
|
276388
|
+
}
|
|
276043
276389
|
toString() {
|
|
276044
276390
|
return this.message;
|
|
276045
276391
|
}
|
|
@@ -276182,6 +276528,13 @@ var makeIssue = (params) => {
|
|
|
276182
276528
|
...issueData,
|
|
276183
276529
|
path: fullPath
|
|
276184
276530
|
};
|
|
276531
|
+
if (issueData.message !== void 0) {
|
|
276532
|
+
return {
|
|
276533
|
+
...issueData,
|
|
276534
|
+
path: fullPath,
|
|
276535
|
+
message: issueData.message
|
|
276536
|
+
};
|
|
276537
|
+
}
|
|
276185
276538
|
let errorMessage = "";
|
|
276186
276539
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
276187
276540
|
for (const map2 of maps) {
|
|
@@ -276190,11 +276543,12 @@ var makeIssue = (params) => {
|
|
|
276190
276543
|
return {
|
|
276191
276544
|
...issueData,
|
|
276192
276545
|
path: fullPath,
|
|
276193
|
-
message:
|
|
276546
|
+
message: errorMessage
|
|
276194
276547
|
};
|
|
276195
276548
|
};
|
|
276196
276549
|
var EMPTY_PATH = [];
|
|
276197
276550
|
function addIssueToContext(ctx, issueData) {
|
|
276551
|
+
const overrideMap = getErrorMap();
|
|
276198
276552
|
const issue = makeIssue({
|
|
276199
276553
|
issueData,
|
|
276200
276554
|
data: ctx.data,
|
|
@@ -276202,8 +276556,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
276202
276556
|
errorMaps: [
|
|
276203
276557
|
ctx.common.contextualErrorMap,
|
|
276204
276558
|
ctx.schemaErrorMap,
|
|
276205
|
-
|
|
276206
|
-
errorMap
|
|
276559
|
+
overrideMap,
|
|
276560
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
276207
276561
|
].filter((x) => !!x)
|
|
276208
276562
|
});
|
|
276209
276563
|
ctx.common.issues.push(issue);
|
|
@@ -276234,9 +276588,11 @@ var ParseStatus = class {
|
|
|
276234
276588
|
static async mergeObjectAsync(status, pairs2) {
|
|
276235
276589
|
const syncPairs = [];
|
|
276236
276590
|
for (const pair of pairs2) {
|
|
276591
|
+
const key = await pair.key;
|
|
276592
|
+
const value = await pair.value;
|
|
276237
276593
|
syncPairs.push({
|
|
276238
|
-
key
|
|
276239
|
-
value
|
|
276594
|
+
key,
|
|
276595
|
+
value
|
|
276240
276596
|
});
|
|
276241
276597
|
}
|
|
276242
276598
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -276269,11 +276625,29 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
276269
276625
|
var isDirty = (x) => x.status === "dirty";
|
|
276270
276626
|
var isValid = (x) => x.status === "valid";
|
|
276271
276627
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
276628
|
+
function __classPrivateFieldGet(receiver, state6, kind, f) {
|
|
276629
|
+
if (kind === "a" && !f)
|
|
276630
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
276631
|
+
if (typeof state6 === "function" ? receiver !== state6 || !f : !state6.has(receiver))
|
|
276632
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
276633
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state6.get(receiver);
|
|
276634
|
+
}
|
|
276635
|
+
function __classPrivateFieldSet(receiver, state6, value, kind, f) {
|
|
276636
|
+
if (kind === "m")
|
|
276637
|
+
throw new TypeError("Private method is not writable");
|
|
276638
|
+
if (kind === "a" && !f)
|
|
276639
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
276640
|
+
if (typeof state6 === "function" ? receiver !== state6 || !f : !state6.has(receiver))
|
|
276641
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
276642
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state6.set(receiver, value), value;
|
|
276643
|
+
}
|
|
276272
276644
|
var errorUtil;
|
|
276273
276645
|
(function(errorUtil2) {
|
|
276274
276646
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
276275
276647
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
276276
276648
|
})(errorUtil || (errorUtil = {}));
|
|
276649
|
+
var _ZodEnum_cache;
|
|
276650
|
+
var _ZodNativeEnum_cache;
|
|
276277
276651
|
var ParseInputLazyPath = class {
|
|
276278
276652
|
constructor(parent, value, path2, key) {
|
|
276279
276653
|
this._cachedPath = [];
|
|
@@ -276322,44 +276696,21 @@ function processCreateParams(params) {
|
|
|
276322
276696
|
if (errorMap2)
|
|
276323
276697
|
return { errorMap: errorMap2, description };
|
|
276324
276698
|
const customMap = (iss, ctx) => {
|
|
276325
|
-
|
|
276326
|
-
|
|
276699
|
+
var _a, _b;
|
|
276700
|
+
const { message } = params;
|
|
276701
|
+
if (iss.code === "invalid_enum_value") {
|
|
276702
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
276703
|
+
}
|
|
276327
276704
|
if (typeof ctx.data === "undefined") {
|
|
276328
|
-
return { message:
|
|
276705
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
276329
276706
|
}
|
|
276330
|
-
|
|
276707
|
+
if (iss.code !== "invalid_type")
|
|
276708
|
+
return { message: ctx.defaultError };
|
|
276709
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
276331
276710
|
};
|
|
276332
276711
|
return { errorMap: customMap, description };
|
|
276333
276712
|
}
|
|
276334
276713
|
var ZodType = class {
|
|
276335
|
-
constructor(def) {
|
|
276336
|
-
this.spa = this.safeParseAsync;
|
|
276337
|
-
this._def = def;
|
|
276338
|
-
this.parse = this.parse.bind(this);
|
|
276339
|
-
this.safeParse = this.safeParse.bind(this);
|
|
276340
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
276341
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
276342
|
-
this.spa = this.spa.bind(this);
|
|
276343
|
-
this.refine = this.refine.bind(this);
|
|
276344
|
-
this.refinement = this.refinement.bind(this);
|
|
276345
|
-
this.superRefine = this.superRefine.bind(this);
|
|
276346
|
-
this.optional = this.optional.bind(this);
|
|
276347
|
-
this.nullable = this.nullable.bind(this);
|
|
276348
|
-
this.nullish = this.nullish.bind(this);
|
|
276349
|
-
this.array = this.array.bind(this);
|
|
276350
|
-
this.promise = this.promise.bind(this);
|
|
276351
|
-
this.or = this.or.bind(this);
|
|
276352
|
-
this.and = this.and.bind(this);
|
|
276353
|
-
this.transform = this.transform.bind(this);
|
|
276354
|
-
this.brand = this.brand.bind(this);
|
|
276355
|
-
this.default = this.default.bind(this);
|
|
276356
|
-
this.catch = this.catch.bind(this);
|
|
276357
|
-
this.describe = this.describe.bind(this);
|
|
276358
|
-
this.pipe = this.pipe.bind(this);
|
|
276359
|
-
this.readonly = this.readonly.bind(this);
|
|
276360
|
-
this.isNullable = this.isNullable.bind(this);
|
|
276361
|
-
this.isOptional = this.isOptional.bind(this);
|
|
276362
|
-
}
|
|
276363
276714
|
get description() {
|
|
276364
276715
|
return this._def.description;
|
|
276365
276716
|
}
|
|
@@ -276423,6 +276774,43 @@ var ZodType = class {
|
|
|
276423
276774
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
276424
276775
|
return handleResult(ctx, result);
|
|
276425
276776
|
}
|
|
276777
|
+
"~validate"(data) {
|
|
276778
|
+
var _a, _b;
|
|
276779
|
+
const ctx = {
|
|
276780
|
+
common: {
|
|
276781
|
+
issues: [],
|
|
276782
|
+
async: !!this["~standard"].async
|
|
276783
|
+
},
|
|
276784
|
+
path: [],
|
|
276785
|
+
schemaErrorMap: this._def.errorMap,
|
|
276786
|
+
parent: null,
|
|
276787
|
+
data,
|
|
276788
|
+
parsedType: getParsedType(data)
|
|
276789
|
+
};
|
|
276790
|
+
if (!this["~standard"].async) {
|
|
276791
|
+
try {
|
|
276792
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
276793
|
+
return isValid(result) ? {
|
|
276794
|
+
value: result.value
|
|
276795
|
+
} : {
|
|
276796
|
+
issues: ctx.common.issues
|
|
276797
|
+
};
|
|
276798
|
+
} catch (err) {
|
|
276799
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
276800
|
+
this["~standard"].async = true;
|
|
276801
|
+
}
|
|
276802
|
+
ctx.common = {
|
|
276803
|
+
issues: [],
|
|
276804
|
+
async: true
|
|
276805
|
+
};
|
|
276806
|
+
}
|
|
276807
|
+
}
|
|
276808
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
|
276809
|
+
value: result.value
|
|
276810
|
+
} : {
|
|
276811
|
+
issues: ctx.common.issues
|
|
276812
|
+
});
|
|
276813
|
+
}
|
|
276426
276814
|
async parseAsync(data, params) {
|
|
276427
276815
|
const result = await this.safeParseAsync(data, params);
|
|
276428
276816
|
if (result.success)
|
|
@@ -276500,6 +276888,39 @@ var ZodType = class {
|
|
|
276500
276888
|
superRefine(refinement) {
|
|
276501
276889
|
return this._refinement(refinement);
|
|
276502
276890
|
}
|
|
276891
|
+
constructor(def) {
|
|
276892
|
+
this.spa = this.safeParseAsync;
|
|
276893
|
+
this._def = def;
|
|
276894
|
+
this.parse = this.parse.bind(this);
|
|
276895
|
+
this.safeParse = this.safeParse.bind(this);
|
|
276896
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
276897
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
276898
|
+
this.spa = this.spa.bind(this);
|
|
276899
|
+
this.refine = this.refine.bind(this);
|
|
276900
|
+
this.refinement = this.refinement.bind(this);
|
|
276901
|
+
this.superRefine = this.superRefine.bind(this);
|
|
276902
|
+
this.optional = this.optional.bind(this);
|
|
276903
|
+
this.nullable = this.nullable.bind(this);
|
|
276904
|
+
this.nullish = this.nullish.bind(this);
|
|
276905
|
+
this.array = this.array.bind(this);
|
|
276906
|
+
this.promise = this.promise.bind(this);
|
|
276907
|
+
this.or = this.or.bind(this);
|
|
276908
|
+
this.and = this.and.bind(this);
|
|
276909
|
+
this.transform = this.transform.bind(this);
|
|
276910
|
+
this.brand = this.brand.bind(this);
|
|
276911
|
+
this.default = this.default.bind(this);
|
|
276912
|
+
this.catch = this.catch.bind(this);
|
|
276913
|
+
this.describe = this.describe.bind(this);
|
|
276914
|
+
this.pipe = this.pipe.bind(this);
|
|
276915
|
+
this.readonly = this.readonly.bind(this);
|
|
276916
|
+
this.isNullable = this.isNullable.bind(this);
|
|
276917
|
+
this.isOptional = this.isOptional.bind(this);
|
|
276918
|
+
this["~standard"] = {
|
|
276919
|
+
version: 1,
|
|
276920
|
+
vendor: "zod",
|
|
276921
|
+
validate: (data) => this["~validate"](data)
|
|
276922
|
+
};
|
|
276923
|
+
}
|
|
276503
276924
|
optional() {
|
|
276504
276925
|
return ZodOptional.create(this, this._def);
|
|
276505
276926
|
}
|
|
@@ -276510,7 +276931,7 @@ var ZodType = class {
|
|
|
276510
276931
|
return this.nullable().optional();
|
|
276511
276932
|
}
|
|
276512
276933
|
array() {
|
|
276513
|
-
return ZodArray.create(this
|
|
276934
|
+
return ZodArray.create(this);
|
|
276514
276935
|
}
|
|
276515
276936
|
promise() {
|
|
276516
276937
|
return ZodPromise.create(this, this._def);
|
|
@@ -276575,35 +276996,45 @@ var ZodType = class {
|
|
|
276575
276996
|
}
|
|
276576
276997
|
};
|
|
276577
276998
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
276578
|
-
var cuid2Regex = /^[
|
|
276579
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
276999
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
277000
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
276580
277001
|
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
276581
|
-
var
|
|
277002
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
277003
|
+
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
277004
|
+
var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
277005
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
276582
277006
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
276583
277007
|
var emojiRegex;
|
|
276584
|
-
var ipv4Regex = /^((
|
|
276585
|
-
var
|
|
276586
|
-
var
|
|
277008
|
+
var ipv4Regex = /^(?:(?: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])$/;
|
|
277009
|
+
var ipv4CidrRegex = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
|
|
277010
|
+
var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
277011
|
+
var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
277012
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
277013
|
+
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
277014
|
+
var dateRegexSource = `((\\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])))`;
|
|
277015
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
277016
|
+
function timeRegexSource(args) {
|
|
277017
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
276587
277018
|
if (args.precision) {
|
|
276588
|
-
|
|
276589
|
-
|
|
276590
|
-
|
|
276591
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
276592
|
-
}
|
|
276593
|
-
} else if (args.precision === 0) {
|
|
276594
|
-
if (args.offset) {
|
|
276595
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
276596
|
-
} else {
|
|
276597
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
276598
|
-
}
|
|
276599
|
-
} else {
|
|
276600
|
-
if (args.offset) {
|
|
276601
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
276602
|
-
} else {
|
|
276603
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
276604
|
-
}
|
|
277019
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
277020
|
+
} else if (args.precision == null) {
|
|
277021
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
276605
277022
|
}
|
|
276606
|
-
|
|
277023
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
277024
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
277025
|
+
}
|
|
277026
|
+
function timeRegex(args) {
|
|
277027
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
277028
|
+
}
|
|
277029
|
+
function datetimeRegex(args) {
|
|
277030
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
277031
|
+
const opts = [];
|
|
277032
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
277033
|
+
if (args.offset)
|
|
277034
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
277035
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
277036
|
+
return new RegExp(`^${regex}$`);
|
|
277037
|
+
}
|
|
276607
277038
|
function isValidIP(ip, version) {
|
|
276608
277039
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
276609
277040
|
return true;
|
|
@@ -276613,6 +277044,33 @@ function isValidIP(ip, version) {
|
|
|
276613
277044
|
}
|
|
276614
277045
|
return false;
|
|
276615
277046
|
}
|
|
277047
|
+
function isValidJWT(jwt, alg) {
|
|
277048
|
+
if (!jwtRegex.test(jwt))
|
|
277049
|
+
return false;
|
|
277050
|
+
try {
|
|
277051
|
+
const [header] = jwt.split(".");
|
|
277052
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
277053
|
+
const decoded = JSON.parse(atob(base64));
|
|
277054
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
277055
|
+
return false;
|
|
277056
|
+
if (!decoded.typ || !decoded.alg)
|
|
277057
|
+
return false;
|
|
277058
|
+
if (alg && decoded.alg !== alg)
|
|
277059
|
+
return false;
|
|
277060
|
+
return true;
|
|
277061
|
+
} catch (_a) {
|
|
277062
|
+
return false;
|
|
277063
|
+
}
|
|
277064
|
+
}
|
|
277065
|
+
function isValidCidr(ip, version) {
|
|
277066
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
277067
|
+
return true;
|
|
277068
|
+
}
|
|
277069
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
277070
|
+
return true;
|
|
277071
|
+
}
|
|
277072
|
+
return false;
|
|
277073
|
+
}
|
|
276616
277074
|
var ZodString = class extends ZodType {
|
|
276617
277075
|
_parse(input) {
|
|
276618
277076
|
if (this._def.coerce) {
|
|
@@ -276621,14 +277079,11 @@ var ZodString = class extends ZodType {
|
|
|
276621
277079
|
const parsedType = this._getType(input);
|
|
276622
277080
|
if (parsedType !== ZodParsedType.string) {
|
|
276623
277081
|
const ctx2 = this._getOrReturnCtx(input);
|
|
276624
|
-
addIssueToContext(
|
|
276625
|
-
|
|
276626
|
-
|
|
276627
|
-
|
|
276628
|
-
|
|
276629
|
-
received: ctx2.parsedType
|
|
276630
|
-
}
|
|
276631
|
-
);
|
|
277082
|
+
addIssueToContext(ctx2, {
|
|
277083
|
+
code: ZodIssueCode.invalid_type,
|
|
277084
|
+
expected: ZodParsedType.string,
|
|
277085
|
+
received: ctx2.parsedType
|
|
277086
|
+
});
|
|
276632
277087
|
return INVALID;
|
|
276633
277088
|
}
|
|
276634
277089
|
const status = new ParseStatus();
|
|
@@ -276719,6 +277174,16 @@ var ZodString = class extends ZodType {
|
|
|
276719
277174
|
});
|
|
276720
277175
|
status.dirty();
|
|
276721
277176
|
}
|
|
277177
|
+
} else if (check.kind === "nanoid") {
|
|
277178
|
+
if (!nanoidRegex.test(input.data)) {
|
|
277179
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277180
|
+
addIssueToContext(ctx, {
|
|
277181
|
+
validation: "nanoid",
|
|
277182
|
+
code: ZodIssueCode.invalid_string,
|
|
277183
|
+
message: check.message
|
|
277184
|
+
});
|
|
277185
|
+
status.dirty();
|
|
277186
|
+
}
|
|
276722
277187
|
} else if (check.kind === "cuid") {
|
|
276723
277188
|
if (!cuidRegex.test(input.data)) {
|
|
276724
277189
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -276820,6 +277285,38 @@ var ZodString = class extends ZodType {
|
|
|
276820
277285
|
});
|
|
276821
277286
|
status.dirty();
|
|
276822
277287
|
}
|
|
277288
|
+
} else if (check.kind === "date") {
|
|
277289
|
+
const regex = dateRegex;
|
|
277290
|
+
if (!regex.test(input.data)) {
|
|
277291
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277292
|
+
addIssueToContext(ctx, {
|
|
277293
|
+
code: ZodIssueCode.invalid_string,
|
|
277294
|
+
validation: "date",
|
|
277295
|
+
message: check.message
|
|
277296
|
+
});
|
|
277297
|
+
status.dirty();
|
|
277298
|
+
}
|
|
277299
|
+
} else if (check.kind === "time") {
|
|
277300
|
+
const regex = timeRegex(check);
|
|
277301
|
+
if (!regex.test(input.data)) {
|
|
277302
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277303
|
+
addIssueToContext(ctx, {
|
|
277304
|
+
code: ZodIssueCode.invalid_string,
|
|
277305
|
+
validation: "time",
|
|
277306
|
+
message: check.message
|
|
277307
|
+
});
|
|
277308
|
+
status.dirty();
|
|
277309
|
+
}
|
|
277310
|
+
} else if (check.kind === "duration") {
|
|
277311
|
+
if (!durationRegex.test(input.data)) {
|
|
277312
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277313
|
+
addIssueToContext(ctx, {
|
|
277314
|
+
validation: "duration",
|
|
277315
|
+
code: ZodIssueCode.invalid_string,
|
|
277316
|
+
message: check.message
|
|
277317
|
+
});
|
|
277318
|
+
status.dirty();
|
|
277319
|
+
}
|
|
276823
277320
|
} else if (check.kind === "ip") {
|
|
276824
277321
|
if (!isValidIP(input.data, check.version)) {
|
|
276825
277322
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -276830,6 +277327,46 @@ var ZodString = class extends ZodType {
|
|
|
276830
277327
|
});
|
|
276831
277328
|
status.dirty();
|
|
276832
277329
|
}
|
|
277330
|
+
} else if (check.kind === "jwt") {
|
|
277331
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
277332
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277333
|
+
addIssueToContext(ctx, {
|
|
277334
|
+
validation: "jwt",
|
|
277335
|
+
code: ZodIssueCode.invalid_string,
|
|
277336
|
+
message: check.message
|
|
277337
|
+
});
|
|
277338
|
+
status.dirty();
|
|
277339
|
+
}
|
|
277340
|
+
} else if (check.kind === "cidr") {
|
|
277341
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
277342
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277343
|
+
addIssueToContext(ctx, {
|
|
277344
|
+
validation: "cidr",
|
|
277345
|
+
code: ZodIssueCode.invalid_string,
|
|
277346
|
+
message: check.message
|
|
277347
|
+
});
|
|
277348
|
+
status.dirty();
|
|
277349
|
+
}
|
|
277350
|
+
} else if (check.kind === "base64") {
|
|
277351
|
+
if (!base64Regex.test(input.data)) {
|
|
277352
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277353
|
+
addIssueToContext(ctx, {
|
|
277354
|
+
validation: "base64",
|
|
277355
|
+
code: ZodIssueCode.invalid_string,
|
|
277356
|
+
message: check.message
|
|
277357
|
+
});
|
|
277358
|
+
status.dirty();
|
|
277359
|
+
}
|
|
277360
|
+
} else if (check.kind === "base64url") {
|
|
277361
|
+
if (!base64urlRegex.test(input.data)) {
|
|
277362
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
277363
|
+
addIssueToContext(ctx, {
|
|
277364
|
+
validation: "base64url",
|
|
277365
|
+
code: ZodIssueCode.invalid_string,
|
|
277366
|
+
message: check.message
|
|
277367
|
+
});
|
|
277368
|
+
status.dirty();
|
|
277369
|
+
}
|
|
276833
277370
|
} else {
|
|
276834
277371
|
util3.assertNever(check);
|
|
276835
277372
|
}
|
|
@@ -276861,6 +277398,9 @@ var ZodString = class extends ZodType {
|
|
|
276861
277398
|
uuid(message) {
|
|
276862
277399
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
276863
277400
|
}
|
|
277401
|
+
nanoid(message) {
|
|
277402
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
277403
|
+
}
|
|
276864
277404
|
cuid(message) {
|
|
276865
277405
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
276866
277406
|
}
|
|
@@ -276870,16 +277410,32 @@ var ZodString = class extends ZodType {
|
|
|
276870
277410
|
ulid(message) {
|
|
276871
277411
|
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
276872
277412
|
}
|
|
277413
|
+
base64(message) {
|
|
277414
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
277415
|
+
}
|
|
277416
|
+
base64url(message) {
|
|
277417
|
+
return this._addCheck({
|
|
277418
|
+
kind: "base64url",
|
|
277419
|
+
...errorUtil.errToObj(message)
|
|
277420
|
+
});
|
|
277421
|
+
}
|
|
277422
|
+
jwt(options) {
|
|
277423
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
277424
|
+
}
|
|
276873
277425
|
ip(options) {
|
|
276874
277426
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
276875
277427
|
}
|
|
277428
|
+
cidr(options) {
|
|
277429
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
277430
|
+
}
|
|
276876
277431
|
datetime(options) {
|
|
276877
|
-
var _a;
|
|
277432
|
+
var _a, _b;
|
|
276878
277433
|
if (typeof options === "string") {
|
|
276879
277434
|
return this._addCheck({
|
|
276880
277435
|
kind: "datetime",
|
|
276881
277436
|
precision: null,
|
|
276882
277437
|
offset: false,
|
|
277438
|
+
local: false,
|
|
276883
277439
|
message: options
|
|
276884
277440
|
});
|
|
276885
277441
|
}
|
|
@@ -276887,9 +277443,30 @@ var ZodString = class extends ZodType {
|
|
|
276887
277443
|
kind: "datetime",
|
|
276888
277444
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
276889
277445
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
277446
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
276890
277447
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
276891
277448
|
});
|
|
276892
277449
|
}
|
|
277450
|
+
date(message) {
|
|
277451
|
+
return this._addCheck({ kind: "date", message });
|
|
277452
|
+
}
|
|
277453
|
+
time(options) {
|
|
277454
|
+
if (typeof options === "string") {
|
|
277455
|
+
return this._addCheck({
|
|
277456
|
+
kind: "time",
|
|
277457
|
+
precision: null,
|
|
277458
|
+
message: options
|
|
277459
|
+
});
|
|
277460
|
+
}
|
|
277461
|
+
return this._addCheck({
|
|
277462
|
+
kind: "time",
|
|
277463
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
277464
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
277465
|
+
});
|
|
277466
|
+
}
|
|
277467
|
+
duration(message) {
|
|
277468
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
277469
|
+
}
|
|
276893
277470
|
regex(regex, message) {
|
|
276894
277471
|
return this._addCheck({
|
|
276895
277472
|
kind: "regex",
|
|
@@ -276964,6 +277541,15 @@ var ZodString = class extends ZodType {
|
|
|
276964
277541
|
get isDatetime() {
|
|
276965
277542
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
276966
277543
|
}
|
|
277544
|
+
get isDate() {
|
|
277545
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
277546
|
+
}
|
|
277547
|
+
get isTime() {
|
|
277548
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
277549
|
+
}
|
|
277550
|
+
get isDuration() {
|
|
277551
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
277552
|
+
}
|
|
276967
277553
|
get isEmail() {
|
|
276968
277554
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
276969
277555
|
}
|
|
@@ -276976,6 +277562,9 @@ var ZodString = class extends ZodType {
|
|
|
276976
277562
|
get isUUID() {
|
|
276977
277563
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
276978
277564
|
}
|
|
277565
|
+
get isNANOID() {
|
|
277566
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
277567
|
+
}
|
|
276979
277568
|
get isCUID() {
|
|
276980
277569
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
276981
277570
|
}
|
|
@@ -276988,6 +277577,15 @@ var ZodString = class extends ZodType {
|
|
|
276988
277577
|
get isIP() {
|
|
276989
277578
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
276990
277579
|
}
|
|
277580
|
+
get isCIDR() {
|
|
277581
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
277582
|
+
}
|
|
277583
|
+
get isBase64() {
|
|
277584
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
277585
|
+
}
|
|
277586
|
+
get isBase64url() {
|
|
277587
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
277588
|
+
}
|
|
276991
277589
|
get minLength() {
|
|
276992
277590
|
let min2 = null;
|
|
276993
277591
|
for (const ch of this._def.checks) {
|
|
@@ -277265,17 +277863,15 @@ var ZodBigInt = class extends ZodType {
|
|
|
277265
277863
|
}
|
|
277266
277864
|
_parse(input) {
|
|
277267
277865
|
if (this._def.coerce) {
|
|
277268
|
-
|
|
277866
|
+
try {
|
|
277867
|
+
input.data = BigInt(input.data);
|
|
277868
|
+
} catch (_a) {
|
|
277869
|
+
return this._getInvalidInput(input);
|
|
277870
|
+
}
|
|
277269
277871
|
}
|
|
277270
277872
|
const parsedType = this._getType(input);
|
|
277271
277873
|
if (parsedType !== ZodParsedType.bigint) {
|
|
277272
|
-
|
|
277273
|
-
addIssueToContext(ctx2, {
|
|
277274
|
-
code: ZodIssueCode.invalid_type,
|
|
277275
|
-
expected: ZodParsedType.bigint,
|
|
277276
|
-
received: ctx2.parsedType
|
|
277277
|
-
});
|
|
277278
|
-
return INVALID;
|
|
277874
|
+
return this._getInvalidInput(input);
|
|
277279
277875
|
}
|
|
277280
277876
|
let ctx = void 0;
|
|
277281
277877
|
const status = new ParseStatus();
|
|
@@ -277322,6 +277918,15 @@ var ZodBigInt = class extends ZodType {
|
|
|
277322
277918
|
}
|
|
277323
277919
|
return { status: status.value, value: input.data };
|
|
277324
277920
|
}
|
|
277921
|
+
_getInvalidInput(input) {
|
|
277922
|
+
const ctx = this._getOrReturnCtx(input);
|
|
277923
|
+
addIssueToContext(ctx, {
|
|
277924
|
+
code: ZodIssueCode.invalid_type,
|
|
277925
|
+
expected: ZodParsedType.bigint,
|
|
277926
|
+
received: ctx.parsedType
|
|
277927
|
+
});
|
|
277928
|
+
return INVALID;
|
|
277929
|
+
}
|
|
277325
277930
|
gte(value, message) {
|
|
277326
277931
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
277327
277932
|
}
|
|
@@ -277900,9 +278505,10 @@ var ZodObject = class extends ZodType {
|
|
|
277900
278505
|
const syncPairs = [];
|
|
277901
278506
|
for (const pair of pairs2) {
|
|
277902
278507
|
const key = await pair.key;
|
|
278508
|
+
const value = await pair.value;
|
|
277903
278509
|
syncPairs.push({
|
|
277904
278510
|
key,
|
|
277905
|
-
value
|
|
278511
|
+
value,
|
|
277906
278512
|
alwaysSet: pair.alwaysSet
|
|
277907
278513
|
});
|
|
277908
278514
|
}
|
|
@@ -278172,15 +278778,25 @@ var getDiscriminator = (type2) => {
|
|
|
278172
278778
|
} else if (type2 instanceof ZodEnum) {
|
|
278173
278779
|
return type2.options;
|
|
278174
278780
|
} else if (type2 instanceof ZodNativeEnum) {
|
|
278175
|
-
return
|
|
278781
|
+
return util3.objectValues(type2.enum);
|
|
278176
278782
|
} else if (type2 instanceof ZodDefault) {
|
|
278177
278783
|
return getDiscriminator(type2._def.innerType);
|
|
278178
278784
|
} else if (type2 instanceof ZodUndefined) {
|
|
278179
278785
|
return [void 0];
|
|
278180
278786
|
} else if (type2 instanceof ZodNull) {
|
|
278181
278787
|
return [null];
|
|
278788
|
+
} else if (type2 instanceof ZodOptional) {
|
|
278789
|
+
return [void 0, ...getDiscriminator(type2.unwrap())];
|
|
278790
|
+
} else if (type2 instanceof ZodNullable) {
|
|
278791
|
+
return [null, ...getDiscriminator(type2.unwrap())];
|
|
278792
|
+
} else if (type2 instanceof ZodBranded) {
|
|
278793
|
+
return getDiscriminator(type2.unwrap());
|
|
278794
|
+
} else if (type2 instanceof ZodReadonly) {
|
|
278795
|
+
return getDiscriminator(type2.unwrap());
|
|
278796
|
+
} else if (type2 instanceof ZodCatch) {
|
|
278797
|
+
return getDiscriminator(type2._def.innerType);
|
|
278182
278798
|
} else {
|
|
278183
|
-
return
|
|
278799
|
+
return [];
|
|
278184
278800
|
}
|
|
278185
278801
|
};
|
|
278186
278802
|
var ZodDiscriminatedUnion = class extends ZodType {
|
|
@@ -278232,7 +278848,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
278232
278848
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
278233
278849
|
for (const type2 of options) {
|
|
278234
278850
|
const discriminatorValues = getDiscriminator(type2.shape[discriminator]);
|
|
278235
|
-
if (!discriminatorValues) {
|
|
278851
|
+
if (!discriminatorValues.length) {
|
|
278236
278852
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
278237
278853
|
}
|
|
278238
278854
|
for (const value of discriminatorValues) {
|
|
@@ -278432,7 +279048,8 @@ var ZodRecord = class extends ZodType {
|
|
|
278432
279048
|
for (const key in ctx.data) {
|
|
278433
279049
|
pairs2.push({
|
|
278434
279050
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
278435
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
279051
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
279052
|
+
alwaysSet: key in ctx.data
|
|
278436
279053
|
});
|
|
278437
279054
|
}
|
|
278438
279055
|
if (ctx.common.async) {
|
|
@@ -278776,6 +279393,10 @@ function createZodEnum(values, params) {
|
|
|
278776
279393
|
});
|
|
278777
279394
|
}
|
|
278778
279395
|
var ZodEnum = class extends ZodType {
|
|
279396
|
+
constructor() {
|
|
279397
|
+
super(...arguments);
|
|
279398
|
+
_ZodEnum_cache.set(this, void 0);
|
|
279399
|
+
}
|
|
278779
279400
|
_parse(input) {
|
|
278780
279401
|
if (typeof input.data !== "string") {
|
|
278781
279402
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -278787,7 +279408,10 @@ var ZodEnum = class extends ZodType {
|
|
|
278787
279408
|
});
|
|
278788
279409
|
return INVALID;
|
|
278789
279410
|
}
|
|
278790
|
-
if (this
|
|
279411
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
279412
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
279413
|
+
}
|
|
279414
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
278791
279415
|
const ctx = this._getOrReturnCtx(input);
|
|
278792
279416
|
const expectedValues = this._def.values;
|
|
278793
279417
|
addIssueToContext(ctx, {
|
|
@@ -278823,15 +279447,26 @@ var ZodEnum = class extends ZodType {
|
|
|
278823
279447
|
}
|
|
278824
279448
|
return enumValues;
|
|
278825
279449
|
}
|
|
278826
|
-
extract(values) {
|
|
278827
|
-
return ZodEnum.create(values
|
|
279450
|
+
extract(values, newDef = this._def) {
|
|
279451
|
+
return ZodEnum.create(values, {
|
|
279452
|
+
...this._def,
|
|
279453
|
+
...newDef
|
|
279454
|
+
});
|
|
278828
279455
|
}
|
|
278829
|
-
exclude(values) {
|
|
278830
|
-
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt))
|
|
279456
|
+
exclude(values, newDef = this._def) {
|
|
279457
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
279458
|
+
...this._def,
|
|
279459
|
+
...newDef
|
|
279460
|
+
});
|
|
278831
279461
|
}
|
|
278832
279462
|
};
|
|
279463
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
278833
279464
|
ZodEnum.create = createZodEnum;
|
|
278834
279465
|
var ZodNativeEnum = class extends ZodType {
|
|
279466
|
+
constructor() {
|
|
279467
|
+
super(...arguments);
|
|
279468
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
279469
|
+
}
|
|
278835
279470
|
_parse(input) {
|
|
278836
279471
|
const nativeEnumValues = util3.getValidEnumValues(this._def.values);
|
|
278837
279472
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -278844,7 +279479,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
278844
279479
|
});
|
|
278845
279480
|
return INVALID;
|
|
278846
279481
|
}
|
|
278847
|
-
if (
|
|
279482
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
279483
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util3.getValidEnumValues(this._def.values)), "f");
|
|
279484
|
+
}
|
|
279485
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
278848
279486
|
const expectedValues = util3.objectValues(nativeEnumValues);
|
|
278849
279487
|
addIssueToContext(ctx, {
|
|
278850
279488
|
received: ctx.data,
|
|
@@ -278859,6 +279497,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
278859
279497
|
return this._def.values;
|
|
278860
279498
|
}
|
|
278861
279499
|
};
|
|
279500
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
278862
279501
|
ZodNativeEnum.create = (values, params) => {
|
|
278863
279502
|
return new ZodNativeEnum({
|
|
278864
279503
|
values,
|
|
@@ -278922,26 +279561,38 @@ var ZodEffects = class extends ZodType {
|
|
|
278922
279561
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
278923
279562
|
if (effect.type === "preprocess") {
|
|
278924
279563
|
const processed = effect.transform(ctx.data, checkCtx);
|
|
278925
|
-
if (ctx.common.issues.length) {
|
|
278926
|
-
return {
|
|
278927
|
-
status: "dirty",
|
|
278928
|
-
value: ctx.data
|
|
278929
|
-
};
|
|
278930
|
-
}
|
|
278931
279564
|
if (ctx.common.async) {
|
|
278932
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
278933
|
-
|
|
279565
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
279566
|
+
if (status.value === "aborted")
|
|
279567
|
+
return INVALID;
|
|
279568
|
+
const result = await this._def.schema._parseAsync({
|
|
278934
279569
|
data: processed2,
|
|
278935
279570
|
path: ctx.path,
|
|
278936
279571
|
parent: ctx
|
|
278937
279572
|
});
|
|
279573
|
+
if (result.status === "aborted")
|
|
279574
|
+
return INVALID;
|
|
279575
|
+
if (result.status === "dirty")
|
|
279576
|
+
return DIRTY(result.value);
|
|
279577
|
+
if (status.value === "dirty")
|
|
279578
|
+
return DIRTY(result.value);
|
|
279579
|
+
return result;
|
|
278938
279580
|
});
|
|
278939
279581
|
} else {
|
|
278940
|
-
|
|
279582
|
+
if (status.value === "aborted")
|
|
279583
|
+
return INVALID;
|
|
279584
|
+
const result = this._def.schema._parseSync({
|
|
278941
279585
|
data: processed,
|
|
278942
279586
|
path: ctx.path,
|
|
278943
279587
|
parent: ctx
|
|
278944
279588
|
});
|
|
279589
|
+
if (result.status === "aborted")
|
|
279590
|
+
return INVALID;
|
|
279591
|
+
if (result.status === "dirty")
|
|
279592
|
+
return DIRTY(result.value);
|
|
279593
|
+
if (status.value === "dirty")
|
|
279594
|
+
return DIRTY(result.value);
|
|
279595
|
+
return result;
|
|
278945
279596
|
}
|
|
278946
279597
|
}
|
|
278947
279598
|
if (effect.type === "refinement") {
|
|
@@ -279230,10 +279881,16 @@ var ZodPipeline = class extends ZodType {
|
|
|
279230
279881
|
var ZodReadonly = class extends ZodType {
|
|
279231
279882
|
_parse(input) {
|
|
279232
279883
|
const result = this._def.innerType._parse(input);
|
|
279233
|
-
|
|
279234
|
-
|
|
279235
|
-
|
|
279236
|
-
|
|
279884
|
+
const freeze = (data) => {
|
|
279885
|
+
if (isValid(data)) {
|
|
279886
|
+
data.value = Object.freeze(data.value);
|
|
279887
|
+
}
|
|
279888
|
+
return data;
|
|
279889
|
+
};
|
|
279890
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
279891
|
+
}
|
|
279892
|
+
unwrap() {
|
|
279893
|
+
return this._def.innerType;
|
|
279237
279894
|
}
|
|
279238
279895
|
};
|
|
279239
279896
|
ZodReadonly.create = (type2, params) => {
|
|
@@ -279243,19 +279900,35 @@ ZodReadonly.create = (type2, params) => {
|
|
|
279243
279900
|
...processCreateParams(params)
|
|
279244
279901
|
});
|
|
279245
279902
|
};
|
|
279246
|
-
|
|
279903
|
+
function cleanParams(params, data) {
|
|
279904
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
279905
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
279906
|
+
return p2;
|
|
279907
|
+
}
|
|
279908
|
+
function custom(check, _params = {}, fatal) {
|
|
279247
279909
|
if (check)
|
|
279248
279910
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
279249
279911
|
var _a, _b;
|
|
279250
|
-
|
|
279251
|
-
|
|
279252
|
-
|
|
279253
|
-
|
|
279254
|
-
|
|
279912
|
+
const r = check(data);
|
|
279913
|
+
if (r instanceof Promise) {
|
|
279914
|
+
return r.then((r2) => {
|
|
279915
|
+
var _a2, _b2;
|
|
279916
|
+
if (!r2) {
|
|
279917
|
+
const params = cleanParams(_params, data);
|
|
279918
|
+
const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
|
|
279919
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
279920
|
+
}
|
|
279921
|
+
});
|
|
279922
|
+
}
|
|
279923
|
+
if (!r) {
|
|
279924
|
+
const params = cleanParams(_params, data);
|
|
279925
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
279926
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
279255
279927
|
}
|
|
279928
|
+
return;
|
|
279256
279929
|
});
|
|
279257
279930
|
return ZodAny.create();
|
|
279258
|
-
}
|
|
279931
|
+
}
|
|
279259
279932
|
var late = {
|
|
279260
279933
|
object: ZodObject.lazycreate
|
|
279261
279934
|
};
|
|
@@ -279374,6 +280047,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
279374
280047
|
ZodParsedType,
|
|
279375
280048
|
getParsedType,
|
|
279376
280049
|
ZodType,
|
|
280050
|
+
datetimeRegex,
|
|
279377
280051
|
ZodString,
|
|
279378
280052
|
ZodNumber,
|
|
279379
280053
|
ZodBigInt,
|
|
@@ -284652,7 +285326,7 @@ var state = {
|
|
|
284652
285326
|
"title": "Botpress API",
|
|
284653
285327
|
"description": "API for Botpress Cloud",
|
|
284654
285328
|
"server": "https://api.botpress.cloud",
|
|
284655
|
-
"version": "1.
|
|
285329
|
+
"version": "1.28.0",
|
|
284656
285330
|
"prefix": "v1"
|
|
284657
285331
|
},
|
|
284658
285332
|
"errors": [
|
|
@@ -293779,6 +294453,12 @@ var state2 = {
|
|
|
293779
294453
|
"type": "string",
|
|
293780
294454
|
"description": "Bot ID",
|
|
293781
294455
|
"in": "path"
|
|
294456
|
+
},
|
|
294457
|
+
"shouldMergePlugins": {
|
|
294458
|
+
"in": "query",
|
|
294459
|
+
"type": "boolean",
|
|
294460
|
+
"required": false,
|
|
294461
|
+
"description": "If true, indicates that the client has support for server-side plugins. Enabling this option returns the bot without any plugins merged into it. You probably want to set this option to true, as it will soon become the default behavior."
|
|
293782
294462
|
}
|
|
293783
294463
|
},
|
|
293784
294464
|
"response": {
|
|
@@ -302207,7 +302887,7 @@ var state2 = {
|
|
|
302207
302887
|
"title": "Botpress API",
|
|
302208
302888
|
"description": "API for Botpress Cloud",
|
|
302209
302889
|
"server": "https://api.botpress.cloud",
|
|
302210
|
-
"version": "1.
|
|
302890
|
+
"version": "1.28.0",
|
|
302211
302891
|
"prefix": "v1"
|
|
302212
302892
|
},
|
|
302213
302893
|
"errors": [
|
|
@@ -308024,7 +308704,7 @@ var state3 = {
|
|
|
308024
308704
|
"title": "Botpress API",
|
|
308025
308705
|
"description": "API for Botpress Cloud",
|
|
308026
308706
|
"server": "https://api.botpress.cloud",
|
|
308027
|
-
"version": "1.
|
|
308707
|
+
"version": "1.28.0",
|
|
308028
308708
|
"prefix": "v1"
|
|
308029
308709
|
},
|
|
308030
308710
|
"errors": [
|
|
@@ -313070,7 +313750,7 @@ var state4 = {
|
|
|
313070
313750
|
"title": "Botpress API",
|
|
313071
313751
|
"description": "API for Botpress Cloud",
|
|
313072
313752
|
"server": "https://api.botpress.cloud",
|
|
313073
|
-
"version": "1.
|
|
313753
|
+
"version": "1.28.0",
|
|
313074
313754
|
"prefix": "v1"
|
|
313075
313755
|
},
|
|
313076
313756
|
"errors": [
|
|
@@ -324713,6 +325393,12 @@ var state5 = {
|
|
|
324713
325393
|
"type": "string",
|
|
324714
325394
|
"description": "Bot ID",
|
|
324715
325395
|
"in": "path"
|
|
325396
|
+
},
|
|
325397
|
+
"shouldMergePlugins": {
|
|
325398
|
+
"in": "query",
|
|
325399
|
+
"type": "boolean",
|
|
325400
|
+
"required": false,
|
|
325401
|
+
"description": "If true, indicates that the client has support for server-side plugins. Enabling this option returns the bot without any plugins merged into it. You probably want to set this option to true, as it will soon become the default behavior."
|
|
324716
325402
|
}
|
|
324717
325403
|
},
|
|
324718
325404
|
"response": {
|
|
@@ -336116,7 +336802,7 @@ var state5 = {
|
|
|
336116
336802
|
"title": "Botpress API",
|
|
336117
336803
|
"description": "API for Botpress Cloud",
|
|
336118
336804
|
"server": "https://api.botpress.cloud",
|
|
336119
|
-
"version": "1.
|
|
336805
|
+
"version": "1.28.0",
|
|
336120
336806
|
"prefix": "v1"
|
|
336121
336807
|
},
|
|
336122
336808
|
"errors": [
|