@learncard/learn-card-plugin 1.1.43 → 1.1.44
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/learn-card-plugin.cjs.development.js +1330 -664
- package/dist/learn-card-plugin.cjs.development.js.map +4 -4
- package/dist/learn-card-plugin.cjs.production.min.js +1 -1
- package/dist/learn-card-plugin.cjs.production.min.js.map +4 -4
- package/dist/learn-card-plugin.esm.js +1329 -663
- package/dist/learn-card-plugin.esm.js.map +4 -4
- package/package.json +4 -4
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toCommonJS = (
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var src_exports = {};
|
|
@@ -25,7 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
|
|
28
|
-
// ../../../node_modules/.pnpm/zod@3.
|
|
28
|
+
// ../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
29
29
|
var util;
|
|
30
30
|
(function(util2) {
|
|
31
31
|
util2.assertEqual = (val) => val;
|
|
@@ -87,6 +87,15 @@ var util;
|
|
|
87
87
|
return value;
|
|
88
88
|
};
|
|
89
89
|
})(util || (util = {}));
|
|
90
|
+
var objectUtil;
|
|
91
|
+
(function(objectUtil2) {
|
|
92
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
93
|
+
return {
|
|
94
|
+
...first,
|
|
95
|
+
...second
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
})(objectUtil || (objectUtil = {}));
|
|
90
99
|
var ZodParsedType = util.arrayToEnum([
|
|
91
100
|
"string",
|
|
92
101
|
"nan",
|
|
@@ -230,6 +239,11 @@ var ZodError = class extends Error {
|
|
|
230
239
|
processError(this);
|
|
231
240
|
return fieldErrors;
|
|
232
241
|
}
|
|
242
|
+
static assert(value) {
|
|
243
|
+
if (!(value instanceof ZodError)) {
|
|
244
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
233
247
|
toString() {
|
|
234
248
|
return this.message;
|
|
235
249
|
}
|
|
@@ -297,7 +311,12 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
297
311
|
break;
|
|
298
312
|
case ZodIssueCode.invalid_string:
|
|
299
313
|
if (typeof issue.validation === "object") {
|
|
300
|
-
if ("
|
|
314
|
+
if ("includes" in issue.validation) {
|
|
315
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
316
|
+
if (typeof issue.validation.position === "number") {
|
|
317
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
318
|
+
}
|
|
319
|
+
} else if ("startsWith" in issue.validation) {
|
|
301
320
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
302
321
|
} else if ("endsWith" in issue.validation) {
|
|
303
322
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
@@ -318,7 +337,7 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
318
337
|
else if (issue.type === "number")
|
|
319
338
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
320
339
|
else if (issue.type === "date")
|
|
321
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
|
340
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
322
341
|
else
|
|
323
342
|
message = "Invalid input";
|
|
324
343
|
break;
|
|
@@ -329,8 +348,10 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
329
348
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
330
349
|
else if (issue.type === "number")
|
|
331
350
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
351
|
+
else if (issue.type === "bigint")
|
|
352
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
332
353
|
else if (issue.type === "date")
|
|
333
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
|
354
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
334
355
|
else
|
|
335
356
|
message = "Invalid input";
|
|
336
357
|
break;
|
|
@@ -368,6 +389,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
|
368
389
|
...issueData,
|
|
369
390
|
path: fullPath
|
|
370
391
|
};
|
|
392
|
+
if (issueData.message !== void 0) {
|
|
393
|
+
return {
|
|
394
|
+
...issueData,
|
|
395
|
+
path: fullPath,
|
|
396
|
+
message: issueData.message
|
|
397
|
+
};
|
|
398
|
+
}
|
|
371
399
|
let errorMessage = "";
|
|
372
400
|
const maps = errorMaps.filter((m3) => !!m3).slice().reverse();
|
|
373
401
|
for (const map of maps) {
|
|
@@ -376,11 +404,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
|
376
404
|
return {
|
|
377
405
|
...issueData,
|
|
378
406
|
path: fullPath,
|
|
379
|
-
message:
|
|
407
|
+
message: errorMessage
|
|
380
408
|
};
|
|
381
409
|
}, "makeIssue");
|
|
382
410
|
var EMPTY_PATH = [];
|
|
383
411
|
function addIssueToContext(ctx, issueData) {
|
|
412
|
+
const overrideMap = getErrorMap();
|
|
384
413
|
const issue = makeIssue({
|
|
385
414
|
issueData,
|
|
386
415
|
data: ctx.data,
|
|
@@ -388,8 +417,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
388
417
|
errorMaps: [
|
|
389
418
|
ctx.common.contextualErrorMap,
|
|
390
419
|
ctx.schemaErrorMap,
|
|
391
|
-
|
|
392
|
-
errorMap
|
|
420
|
+
overrideMap,
|
|
421
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
393
422
|
].filter((x2) => !!x2)
|
|
394
423
|
});
|
|
395
424
|
ctx.common.issues.push(issue);
|
|
@@ -421,9 +450,11 @@ var ParseStatus = class {
|
|
|
421
450
|
static async mergeObjectAsync(status, pairs) {
|
|
422
451
|
const syncPairs = [];
|
|
423
452
|
for (const pair of pairs) {
|
|
453
|
+
const key = await pair.key;
|
|
454
|
+
const value = await pair.value;
|
|
424
455
|
syncPairs.push({
|
|
425
|
-
key
|
|
426
|
-
value
|
|
456
|
+
key,
|
|
457
|
+
value
|
|
427
458
|
});
|
|
428
459
|
}
|
|
429
460
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -440,7 +471,7 @@ var ParseStatus = class {
|
|
|
440
471
|
status.dirty();
|
|
441
472
|
if (value.status === "dirty")
|
|
442
473
|
status.dirty();
|
|
443
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
474
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
444
475
|
finalObject[key.value] = value.value;
|
|
445
476
|
}
|
|
446
477
|
}
|
|
@@ -456,21 +487,49 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
|
|
|
456
487
|
var isAborted = /* @__PURE__ */ __name((x2) => x2.status === "aborted", "isAborted");
|
|
457
488
|
var isDirty = /* @__PURE__ */ __name((x2) => x2.status === "dirty", "isDirty");
|
|
458
489
|
var isValid = /* @__PURE__ */ __name((x2) => x2.status === "valid", "isValid");
|
|
459
|
-
var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !==
|
|
490
|
+
var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !== "undefined" && x2 instanceof Promise, "isAsync");
|
|
491
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
492
|
+
if (kind === "a" && !f)
|
|
493
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
494
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
495
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
496
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
497
|
+
}
|
|
498
|
+
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
|
|
499
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
500
|
+
if (kind === "m")
|
|
501
|
+
throw new TypeError("Private method is not writable");
|
|
502
|
+
if (kind === "a" && !f)
|
|
503
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
504
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
505
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
506
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
507
|
+
}
|
|
508
|
+
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
|
|
460
509
|
var errorUtil;
|
|
461
510
|
(function(errorUtil2) {
|
|
462
511
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
463
512
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
464
513
|
})(errorUtil || (errorUtil = {}));
|
|
514
|
+
var _ZodEnum_cache;
|
|
515
|
+
var _ZodNativeEnum_cache;
|
|
465
516
|
var ParseInputLazyPath = class {
|
|
466
517
|
constructor(parent, value, path, key) {
|
|
518
|
+
this._cachedPath = [];
|
|
467
519
|
this.parent = parent;
|
|
468
520
|
this.data = value;
|
|
469
521
|
this._path = path;
|
|
470
522
|
this._key = key;
|
|
471
523
|
}
|
|
472
524
|
get path() {
|
|
473
|
-
|
|
525
|
+
if (!this._cachedPath.length) {
|
|
526
|
+
if (this._key instanceof Array) {
|
|
527
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
528
|
+
} else {
|
|
529
|
+
this._cachedPath.push(...this._path, this._key);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return this._cachedPath;
|
|
474
533
|
}
|
|
475
534
|
};
|
|
476
535
|
__name(ParseInputLazyPath, "ParseInputLazyPath");
|
|
@@ -481,8 +540,16 @@ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
|
|
|
481
540
|
if (!ctx.common.issues.length) {
|
|
482
541
|
throw new Error("Validation failed but no issues detected.");
|
|
483
542
|
}
|
|
484
|
-
|
|
485
|
-
|
|
543
|
+
return {
|
|
544
|
+
success: false,
|
|
545
|
+
get error() {
|
|
546
|
+
if (this._error)
|
|
547
|
+
return this._error;
|
|
548
|
+
const error = new ZodError(ctx.common.issues);
|
|
549
|
+
this._error = error;
|
|
550
|
+
return this._error;
|
|
551
|
+
}
|
|
552
|
+
};
|
|
486
553
|
}
|
|
487
554
|
}, "handleResult");
|
|
488
555
|
function processCreateParams(params) {
|
|
@@ -495,12 +562,17 @@ function processCreateParams(params) {
|
|
|
495
562
|
if (errorMap2)
|
|
496
563
|
return { errorMap: errorMap2, description };
|
|
497
564
|
const customMap = /* @__PURE__ */ __name((iss, ctx) => {
|
|
498
|
-
|
|
499
|
-
|
|
565
|
+
var _a, _b;
|
|
566
|
+
const { message } = params;
|
|
567
|
+
if (iss.code === "invalid_enum_value") {
|
|
568
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
569
|
+
}
|
|
500
570
|
if (typeof ctx.data === "undefined") {
|
|
501
|
-
return { message:
|
|
571
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
502
572
|
}
|
|
503
|
-
|
|
573
|
+
if (iss.code !== "invalid_type")
|
|
574
|
+
return { message: ctx.defaultError };
|
|
575
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
504
576
|
}, "customMap");
|
|
505
577
|
return { errorMap: customMap, description };
|
|
506
578
|
}
|
|
@@ -530,6 +602,7 @@ var ZodType = class {
|
|
|
530
602
|
this.catch = this.catch.bind(this);
|
|
531
603
|
this.describe = this.describe.bind(this);
|
|
532
604
|
this.pipe = this.pipe.bind(this);
|
|
605
|
+
this.readonly = this.readonly.bind(this);
|
|
533
606
|
this.isNullable = this.isNullable.bind(this);
|
|
534
607
|
this.isOptional = this.isOptional.bind(this);
|
|
535
608
|
}
|
|
@@ -674,28 +747,29 @@ var ZodType = class {
|
|
|
674
747
|
return this._refinement(refinement);
|
|
675
748
|
}
|
|
676
749
|
optional() {
|
|
677
|
-
return ZodOptional.create(this);
|
|
750
|
+
return ZodOptional.create(this, this._def);
|
|
678
751
|
}
|
|
679
752
|
nullable() {
|
|
680
|
-
return ZodNullable.create(this);
|
|
753
|
+
return ZodNullable.create(this, this._def);
|
|
681
754
|
}
|
|
682
755
|
nullish() {
|
|
683
|
-
return this.
|
|
756
|
+
return this.nullable().optional();
|
|
684
757
|
}
|
|
685
758
|
array() {
|
|
686
|
-
return ZodArray.create(this);
|
|
759
|
+
return ZodArray.create(this, this._def);
|
|
687
760
|
}
|
|
688
761
|
promise() {
|
|
689
|
-
return ZodPromise.create(this);
|
|
762
|
+
return ZodPromise.create(this, this._def);
|
|
690
763
|
}
|
|
691
764
|
or(option) {
|
|
692
|
-
return ZodUnion.create([this, option]);
|
|
765
|
+
return ZodUnion.create([this, option], this._def);
|
|
693
766
|
}
|
|
694
767
|
and(incoming) {
|
|
695
|
-
return ZodIntersection.create(this, incoming);
|
|
768
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
696
769
|
}
|
|
697
770
|
transform(transform) {
|
|
698
771
|
return new ZodEffects({
|
|
772
|
+
...processCreateParams(this._def),
|
|
699
773
|
schema: this,
|
|
700
774
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
701
775
|
effect: { type: "transform", transform }
|
|
@@ -704,6 +778,7 @@ var ZodType = class {
|
|
|
704
778
|
default(def) {
|
|
705
779
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
706
780
|
return new ZodDefault({
|
|
781
|
+
...processCreateParams(this._def),
|
|
707
782
|
innerType: this,
|
|
708
783
|
defaultValue: defaultValueFunc,
|
|
709
784
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -713,14 +788,15 @@ var ZodType = class {
|
|
|
713
788
|
return new ZodBranded({
|
|
714
789
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
715
790
|
type: this,
|
|
716
|
-
...processCreateParams(
|
|
791
|
+
...processCreateParams(this._def)
|
|
717
792
|
});
|
|
718
793
|
}
|
|
719
794
|
catch(def) {
|
|
720
|
-
const
|
|
795
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
|
721
796
|
return new ZodCatch({
|
|
797
|
+
...processCreateParams(this._def),
|
|
722
798
|
innerType: this,
|
|
723
|
-
|
|
799
|
+
catchValue: catchValueFunc,
|
|
724
800
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
725
801
|
});
|
|
726
802
|
}
|
|
@@ -734,6 +810,9 @@ var ZodType = class {
|
|
|
734
810
|
pipe(target) {
|
|
735
811
|
return ZodPipeline.create(this, target);
|
|
736
812
|
}
|
|
813
|
+
readonly() {
|
|
814
|
+
return ZodReadonly.create(this);
|
|
815
|
+
}
|
|
737
816
|
isOptional() {
|
|
738
817
|
return this.safeParse(void 0).success;
|
|
739
818
|
}
|
|
@@ -743,43 +822,54 @@ var ZodType = class {
|
|
|
743
822
|
};
|
|
744
823
|
__name(ZodType, "ZodType");
|
|
745
824
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
746
|
-
var
|
|
747
|
-
var
|
|
748
|
-
var
|
|
825
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
826
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
827
|
+
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;
|
|
828
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
829
|
+
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)?)??$/;
|
|
830
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
831
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
832
|
+
var emojiRegex;
|
|
833
|
+
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])$/;
|
|
834
|
+
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
835
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
836
|
+
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])))`;
|
|
837
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
838
|
+
function timeRegexSource(args) {
|
|
839
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
749
840
|
if (args.precision) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
754
|
-
}
|
|
755
|
-
} else if (args.precision === 0) {
|
|
756
|
-
if (args.offset) {
|
|
757
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
758
|
-
} else {
|
|
759
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
760
|
-
}
|
|
761
|
-
} else {
|
|
762
|
-
if (args.offset) {
|
|
763
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
764
|
-
} else {
|
|
765
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
766
|
-
}
|
|
841
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
842
|
+
} else if (args.precision == null) {
|
|
843
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
767
844
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
845
|
+
return regex;
|
|
846
|
+
}
|
|
847
|
+
__name(timeRegexSource, "timeRegexSource");
|
|
848
|
+
function timeRegex(args) {
|
|
849
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
850
|
+
}
|
|
851
|
+
__name(timeRegex, "timeRegex");
|
|
852
|
+
function datetimeRegex(args) {
|
|
853
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
854
|
+
const opts = [];
|
|
855
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
856
|
+
if (args.offset)
|
|
857
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
858
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
859
|
+
return new RegExp(`^${regex}$`);
|
|
860
|
+
}
|
|
861
|
+
__name(datetimeRegex, "datetimeRegex");
|
|
862
|
+
function isValidIP(ip, version) {
|
|
863
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
864
|
+
return true;
|
|
782
865
|
}
|
|
866
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
__name(isValidIP, "isValidIP");
|
|
872
|
+
var ZodString = class extends ZodType {
|
|
783
873
|
_parse(input) {
|
|
784
874
|
if (this._def.coerce) {
|
|
785
875
|
input.data = String(input.data);
|
|
@@ -787,14 +877,11 @@ var ZodString = class extends ZodType {
|
|
|
787
877
|
const parsedType = this._getType(input);
|
|
788
878
|
if (parsedType !== ZodParsedType.string) {
|
|
789
879
|
const ctx2 = this._getOrReturnCtx(input);
|
|
790
|
-
addIssueToContext(
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
received: ctx2.parsedType
|
|
796
|
-
}
|
|
797
|
-
);
|
|
880
|
+
addIssueToContext(ctx2, {
|
|
881
|
+
code: ZodIssueCode.invalid_type,
|
|
882
|
+
expected: ZodParsedType.string,
|
|
883
|
+
received: ctx2.parsedType
|
|
884
|
+
});
|
|
798
885
|
return INVALID;
|
|
799
886
|
}
|
|
800
887
|
const status = new ParseStatus();
|
|
@@ -862,6 +949,19 @@ var ZodString = class extends ZodType {
|
|
|
862
949
|
});
|
|
863
950
|
status.dirty();
|
|
864
951
|
}
|
|
952
|
+
} else if (check.kind === "emoji") {
|
|
953
|
+
if (!emojiRegex) {
|
|
954
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
955
|
+
}
|
|
956
|
+
if (!emojiRegex.test(input.data)) {
|
|
957
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
958
|
+
addIssueToContext(ctx, {
|
|
959
|
+
validation: "emoji",
|
|
960
|
+
code: ZodIssueCode.invalid_string,
|
|
961
|
+
message: check.message
|
|
962
|
+
});
|
|
963
|
+
status.dirty();
|
|
964
|
+
}
|
|
865
965
|
} else if (check.kind === "uuid") {
|
|
866
966
|
if (!uuidRegex.test(input.data)) {
|
|
867
967
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -872,6 +972,16 @@ var ZodString = class extends ZodType {
|
|
|
872
972
|
});
|
|
873
973
|
status.dirty();
|
|
874
974
|
}
|
|
975
|
+
} else if (check.kind === "nanoid") {
|
|
976
|
+
if (!nanoidRegex.test(input.data)) {
|
|
977
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
978
|
+
addIssueToContext(ctx, {
|
|
979
|
+
validation: "nanoid",
|
|
980
|
+
code: ZodIssueCode.invalid_string,
|
|
981
|
+
message: check.message
|
|
982
|
+
});
|
|
983
|
+
status.dirty();
|
|
984
|
+
}
|
|
875
985
|
} else if (check.kind === "cuid") {
|
|
876
986
|
if (!cuidRegex.test(input.data)) {
|
|
877
987
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -882,6 +992,26 @@ var ZodString = class extends ZodType {
|
|
|
882
992
|
});
|
|
883
993
|
status.dirty();
|
|
884
994
|
}
|
|
995
|
+
} else if (check.kind === "cuid2") {
|
|
996
|
+
if (!cuid2Regex.test(input.data)) {
|
|
997
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
998
|
+
addIssueToContext(ctx, {
|
|
999
|
+
validation: "cuid2",
|
|
1000
|
+
code: ZodIssueCode.invalid_string,
|
|
1001
|
+
message: check.message
|
|
1002
|
+
});
|
|
1003
|
+
status.dirty();
|
|
1004
|
+
}
|
|
1005
|
+
} else if (check.kind === "ulid") {
|
|
1006
|
+
if (!ulidRegex.test(input.data)) {
|
|
1007
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1008
|
+
addIssueToContext(ctx, {
|
|
1009
|
+
validation: "ulid",
|
|
1010
|
+
code: ZodIssueCode.invalid_string,
|
|
1011
|
+
message: check.message
|
|
1012
|
+
});
|
|
1013
|
+
status.dirty();
|
|
1014
|
+
}
|
|
885
1015
|
} else if (check.kind === "url") {
|
|
886
1016
|
try {
|
|
887
1017
|
new URL(input.data);
|
|
@@ -908,6 +1038,20 @@ var ZodString = class extends ZodType {
|
|
|
908
1038
|
}
|
|
909
1039
|
} else if (check.kind === "trim") {
|
|
910
1040
|
input.data = input.data.trim();
|
|
1041
|
+
} else if (check.kind === "includes") {
|
|
1042
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
1043
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1044
|
+
addIssueToContext(ctx, {
|
|
1045
|
+
code: ZodIssueCode.invalid_string,
|
|
1046
|
+
validation: { includes: check.value, position: check.position },
|
|
1047
|
+
message: check.message
|
|
1048
|
+
});
|
|
1049
|
+
status.dirty();
|
|
1050
|
+
}
|
|
1051
|
+
} else if (check.kind === "toLowerCase") {
|
|
1052
|
+
input.data = input.data.toLowerCase();
|
|
1053
|
+
} else if (check.kind === "toUpperCase") {
|
|
1054
|
+
input.data = input.data.toUpperCase();
|
|
911
1055
|
} else if (check.kind === "startsWith") {
|
|
912
1056
|
if (!input.data.startsWith(check.value)) {
|
|
913
1057
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -939,12 +1083,71 @@ var ZodString = class extends ZodType {
|
|
|
939
1083
|
});
|
|
940
1084
|
status.dirty();
|
|
941
1085
|
}
|
|
1086
|
+
} else if (check.kind === "date") {
|
|
1087
|
+
const regex = dateRegex;
|
|
1088
|
+
if (!regex.test(input.data)) {
|
|
1089
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1090
|
+
addIssueToContext(ctx, {
|
|
1091
|
+
code: ZodIssueCode.invalid_string,
|
|
1092
|
+
validation: "date",
|
|
1093
|
+
message: check.message
|
|
1094
|
+
});
|
|
1095
|
+
status.dirty();
|
|
1096
|
+
}
|
|
1097
|
+
} else if (check.kind === "time") {
|
|
1098
|
+
const regex = timeRegex(check);
|
|
1099
|
+
if (!regex.test(input.data)) {
|
|
1100
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1101
|
+
addIssueToContext(ctx, {
|
|
1102
|
+
code: ZodIssueCode.invalid_string,
|
|
1103
|
+
validation: "time",
|
|
1104
|
+
message: check.message
|
|
1105
|
+
});
|
|
1106
|
+
status.dirty();
|
|
1107
|
+
}
|
|
1108
|
+
} else if (check.kind === "duration") {
|
|
1109
|
+
if (!durationRegex.test(input.data)) {
|
|
1110
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1111
|
+
addIssueToContext(ctx, {
|
|
1112
|
+
validation: "duration",
|
|
1113
|
+
code: ZodIssueCode.invalid_string,
|
|
1114
|
+
message: check.message
|
|
1115
|
+
});
|
|
1116
|
+
status.dirty();
|
|
1117
|
+
}
|
|
1118
|
+
} else if (check.kind === "ip") {
|
|
1119
|
+
if (!isValidIP(input.data, check.version)) {
|
|
1120
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1121
|
+
addIssueToContext(ctx, {
|
|
1122
|
+
validation: "ip",
|
|
1123
|
+
code: ZodIssueCode.invalid_string,
|
|
1124
|
+
message: check.message
|
|
1125
|
+
});
|
|
1126
|
+
status.dirty();
|
|
1127
|
+
}
|
|
1128
|
+
} else if (check.kind === "base64") {
|
|
1129
|
+
if (!base64Regex.test(input.data)) {
|
|
1130
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1131
|
+
addIssueToContext(ctx, {
|
|
1132
|
+
validation: "base64",
|
|
1133
|
+
code: ZodIssueCode.invalid_string,
|
|
1134
|
+
message: check.message
|
|
1135
|
+
});
|
|
1136
|
+
status.dirty();
|
|
1137
|
+
}
|
|
942
1138
|
} else {
|
|
943
1139
|
util.assertNever(check);
|
|
944
1140
|
}
|
|
945
1141
|
}
|
|
946
1142
|
return { status: status.value, value: input.data };
|
|
947
1143
|
}
|
|
1144
|
+
_regex(regex, validation, message) {
|
|
1145
|
+
return this.refinement((data) => regex.test(data), {
|
|
1146
|
+
validation,
|
|
1147
|
+
code: ZodIssueCode.invalid_string,
|
|
1148
|
+
...errorUtil.errToObj(message)
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
948
1151
|
_addCheck(check) {
|
|
949
1152
|
return new ZodString({
|
|
950
1153
|
...this._def,
|
|
@@ -957,19 +1160,38 @@ var ZodString = class extends ZodType {
|
|
|
957
1160
|
url(message) {
|
|
958
1161
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
959
1162
|
}
|
|
1163
|
+
emoji(message) {
|
|
1164
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
1165
|
+
}
|
|
960
1166
|
uuid(message) {
|
|
961
1167
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
962
1168
|
}
|
|
1169
|
+
nanoid(message) {
|
|
1170
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1171
|
+
}
|
|
963
1172
|
cuid(message) {
|
|
964
1173
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
965
1174
|
}
|
|
1175
|
+
cuid2(message) {
|
|
1176
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
1177
|
+
}
|
|
1178
|
+
ulid(message) {
|
|
1179
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1180
|
+
}
|
|
1181
|
+
base64(message) {
|
|
1182
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1183
|
+
}
|
|
1184
|
+
ip(options) {
|
|
1185
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1186
|
+
}
|
|
966
1187
|
datetime(options) {
|
|
967
|
-
var _a;
|
|
1188
|
+
var _a, _b;
|
|
968
1189
|
if (typeof options === "string") {
|
|
969
1190
|
return this._addCheck({
|
|
970
1191
|
kind: "datetime",
|
|
971
1192
|
precision: null,
|
|
972
1193
|
offset: false,
|
|
1194
|
+
local: false,
|
|
973
1195
|
message: options
|
|
974
1196
|
});
|
|
975
1197
|
}
|
|
@@ -977,9 +1199,30 @@ var ZodString = class extends ZodType {
|
|
|
977
1199
|
kind: "datetime",
|
|
978
1200
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
979
1201
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1202
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1203
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
date(message) {
|
|
1207
|
+
return this._addCheck({ kind: "date", message });
|
|
1208
|
+
}
|
|
1209
|
+
time(options) {
|
|
1210
|
+
if (typeof options === "string") {
|
|
1211
|
+
return this._addCheck({
|
|
1212
|
+
kind: "time",
|
|
1213
|
+
precision: null,
|
|
1214
|
+
message: options
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
return this._addCheck({
|
|
1218
|
+
kind: "time",
|
|
1219
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
980
1220
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
981
1221
|
});
|
|
982
1222
|
}
|
|
1223
|
+
duration(message) {
|
|
1224
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1225
|
+
}
|
|
983
1226
|
regex(regex, message) {
|
|
984
1227
|
return this._addCheck({
|
|
985
1228
|
kind: "regex",
|
|
@@ -987,6 +1230,14 @@ var ZodString = class extends ZodType {
|
|
|
987
1230
|
...errorUtil.errToObj(message)
|
|
988
1231
|
});
|
|
989
1232
|
}
|
|
1233
|
+
includes(value, options) {
|
|
1234
|
+
return this._addCheck({
|
|
1235
|
+
kind: "includes",
|
|
1236
|
+
value,
|
|
1237
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
1238
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
990
1241
|
startsWith(value, message) {
|
|
991
1242
|
return this._addCheck({
|
|
992
1243
|
kind: "startsWith",
|
|
@@ -1022,21 +1273,69 @@ var ZodString = class extends ZodType {
|
|
|
1022
1273
|
...errorUtil.errToObj(message)
|
|
1023
1274
|
});
|
|
1024
1275
|
}
|
|
1276
|
+
nonempty(message) {
|
|
1277
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1278
|
+
}
|
|
1279
|
+
trim() {
|
|
1280
|
+
return new ZodString({
|
|
1281
|
+
...this._def,
|
|
1282
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
toLowerCase() {
|
|
1286
|
+
return new ZodString({
|
|
1287
|
+
...this._def,
|
|
1288
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
toUpperCase() {
|
|
1292
|
+
return new ZodString({
|
|
1293
|
+
...this._def,
|
|
1294
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1025
1297
|
get isDatetime() {
|
|
1026
1298
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1027
1299
|
}
|
|
1300
|
+
get isDate() {
|
|
1301
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1302
|
+
}
|
|
1303
|
+
get isTime() {
|
|
1304
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1305
|
+
}
|
|
1306
|
+
get isDuration() {
|
|
1307
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1308
|
+
}
|
|
1028
1309
|
get isEmail() {
|
|
1029
1310
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1030
1311
|
}
|
|
1031
1312
|
get isURL() {
|
|
1032
1313
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
1033
1314
|
}
|
|
1315
|
+
get isEmoji() {
|
|
1316
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
1317
|
+
}
|
|
1034
1318
|
get isUUID() {
|
|
1035
1319
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1036
1320
|
}
|
|
1321
|
+
get isNANOID() {
|
|
1322
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1323
|
+
}
|
|
1037
1324
|
get isCUID() {
|
|
1038
1325
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1039
1326
|
}
|
|
1327
|
+
get isCUID2() {
|
|
1328
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
1329
|
+
}
|
|
1330
|
+
get isULID() {
|
|
1331
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
1332
|
+
}
|
|
1333
|
+
get isIP() {
|
|
1334
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1335
|
+
}
|
|
1336
|
+
get isBase64() {
|
|
1337
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1338
|
+
}
|
|
1040
1339
|
get minLength() {
|
|
1041
1340
|
let min = null;
|
|
1042
1341
|
for (const ch of this._def.checks) {
|
|
@@ -1248,6 +1547,19 @@ var ZodNumber = class extends ZodType {
|
|
|
1248
1547
|
message: errorUtil.toString(message)
|
|
1249
1548
|
});
|
|
1250
1549
|
}
|
|
1550
|
+
safe(message) {
|
|
1551
|
+
return this._addCheck({
|
|
1552
|
+
kind: "min",
|
|
1553
|
+
inclusive: true,
|
|
1554
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
1555
|
+
message: errorUtil.toString(message)
|
|
1556
|
+
})._addCheck({
|
|
1557
|
+
kind: "max",
|
|
1558
|
+
inclusive: true,
|
|
1559
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
1560
|
+
message: errorUtil.toString(message)
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1251
1563
|
get minValue() {
|
|
1252
1564
|
let min = null;
|
|
1253
1565
|
for (const ch of this._def.checks) {
|
|
@@ -1269,7 +1581,22 @@ var ZodNumber = class extends ZodType {
|
|
|
1269
1581
|
return max;
|
|
1270
1582
|
}
|
|
1271
1583
|
get isInt() {
|
|
1272
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
1584
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1585
|
+
}
|
|
1586
|
+
get isFinite() {
|
|
1587
|
+
let max = null, min = null;
|
|
1588
|
+
for (const ch of this._def.checks) {
|
|
1589
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1590
|
+
return true;
|
|
1591
|
+
} else if (ch.kind === "min") {
|
|
1592
|
+
if (min === null || ch.value > min)
|
|
1593
|
+
min = ch.value;
|
|
1594
|
+
} else if (ch.kind === "max") {
|
|
1595
|
+
if (max === null || ch.value < max)
|
|
1596
|
+
max = ch.value;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
1273
1600
|
}
|
|
1274
1601
|
};
|
|
1275
1602
|
__name(ZodNumber, "ZodNumber");
|
|
@@ -1282,27 +1609,167 @@ ZodNumber.create = (params) => {
|
|
|
1282
1609
|
});
|
|
1283
1610
|
};
|
|
1284
1611
|
var ZodBigInt = class extends ZodType {
|
|
1612
|
+
constructor() {
|
|
1613
|
+
super(...arguments);
|
|
1614
|
+
this.min = this.gte;
|
|
1615
|
+
this.max = this.lte;
|
|
1616
|
+
}
|
|
1285
1617
|
_parse(input) {
|
|
1286
1618
|
if (this._def.coerce) {
|
|
1287
1619
|
input.data = BigInt(input.data);
|
|
1288
1620
|
}
|
|
1289
1621
|
const parsedType = this._getType(input);
|
|
1290
1622
|
if (parsedType !== ZodParsedType.bigint) {
|
|
1291
|
-
const
|
|
1292
|
-
addIssueToContext(
|
|
1623
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1624
|
+
addIssueToContext(ctx2, {
|
|
1293
1625
|
code: ZodIssueCode.invalid_type,
|
|
1294
1626
|
expected: ZodParsedType.bigint,
|
|
1295
|
-
received:
|
|
1627
|
+
received: ctx2.parsedType
|
|
1296
1628
|
});
|
|
1297
1629
|
return INVALID;
|
|
1298
1630
|
}
|
|
1299
|
-
|
|
1631
|
+
let ctx = void 0;
|
|
1632
|
+
const status = new ParseStatus();
|
|
1633
|
+
for (const check of this._def.checks) {
|
|
1634
|
+
if (check.kind === "min") {
|
|
1635
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1636
|
+
if (tooSmall) {
|
|
1637
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1638
|
+
addIssueToContext(ctx, {
|
|
1639
|
+
code: ZodIssueCode.too_small,
|
|
1640
|
+
type: "bigint",
|
|
1641
|
+
minimum: check.value,
|
|
1642
|
+
inclusive: check.inclusive,
|
|
1643
|
+
message: check.message
|
|
1644
|
+
});
|
|
1645
|
+
status.dirty();
|
|
1646
|
+
}
|
|
1647
|
+
} else if (check.kind === "max") {
|
|
1648
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1649
|
+
if (tooBig) {
|
|
1650
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1651
|
+
addIssueToContext(ctx, {
|
|
1652
|
+
code: ZodIssueCode.too_big,
|
|
1653
|
+
type: "bigint",
|
|
1654
|
+
maximum: check.value,
|
|
1655
|
+
inclusive: check.inclusive,
|
|
1656
|
+
message: check.message
|
|
1657
|
+
});
|
|
1658
|
+
status.dirty();
|
|
1659
|
+
}
|
|
1660
|
+
} else if (check.kind === "multipleOf") {
|
|
1661
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
1662
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1663
|
+
addIssueToContext(ctx, {
|
|
1664
|
+
code: ZodIssueCode.not_multiple_of,
|
|
1665
|
+
multipleOf: check.value,
|
|
1666
|
+
message: check.message
|
|
1667
|
+
});
|
|
1668
|
+
status.dirty();
|
|
1669
|
+
}
|
|
1670
|
+
} else {
|
|
1671
|
+
util.assertNever(check);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return { status: status.value, value: input.data };
|
|
1675
|
+
}
|
|
1676
|
+
gte(value, message) {
|
|
1677
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1678
|
+
}
|
|
1679
|
+
gt(value, message) {
|
|
1680
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
1681
|
+
}
|
|
1682
|
+
lte(value, message) {
|
|
1683
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
1684
|
+
}
|
|
1685
|
+
lt(value, message) {
|
|
1686
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1687
|
+
}
|
|
1688
|
+
setLimit(kind, value, inclusive, message) {
|
|
1689
|
+
return new ZodBigInt({
|
|
1690
|
+
...this._def,
|
|
1691
|
+
checks: [
|
|
1692
|
+
...this._def.checks,
|
|
1693
|
+
{
|
|
1694
|
+
kind,
|
|
1695
|
+
value,
|
|
1696
|
+
inclusive,
|
|
1697
|
+
message: errorUtil.toString(message)
|
|
1698
|
+
}
|
|
1699
|
+
]
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
_addCheck(check) {
|
|
1703
|
+
return new ZodBigInt({
|
|
1704
|
+
...this._def,
|
|
1705
|
+
checks: [...this._def.checks, check]
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
positive(message) {
|
|
1709
|
+
return this._addCheck({
|
|
1710
|
+
kind: "min",
|
|
1711
|
+
value: BigInt(0),
|
|
1712
|
+
inclusive: false,
|
|
1713
|
+
message: errorUtil.toString(message)
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
negative(message) {
|
|
1717
|
+
return this._addCheck({
|
|
1718
|
+
kind: "max",
|
|
1719
|
+
value: BigInt(0),
|
|
1720
|
+
inclusive: false,
|
|
1721
|
+
message: errorUtil.toString(message)
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
nonpositive(message) {
|
|
1725
|
+
return this._addCheck({
|
|
1726
|
+
kind: "max",
|
|
1727
|
+
value: BigInt(0),
|
|
1728
|
+
inclusive: true,
|
|
1729
|
+
message: errorUtil.toString(message)
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
nonnegative(message) {
|
|
1733
|
+
return this._addCheck({
|
|
1734
|
+
kind: "min",
|
|
1735
|
+
value: BigInt(0),
|
|
1736
|
+
inclusive: true,
|
|
1737
|
+
message: errorUtil.toString(message)
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
multipleOf(value, message) {
|
|
1741
|
+
return this._addCheck({
|
|
1742
|
+
kind: "multipleOf",
|
|
1743
|
+
value,
|
|
1744
|
+
message: errorUtil.toString(message)
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
get minValue() {
|
|
1748
|
+
let min = null;
|
|
1749
|
+
for (const ch of this._def.checks) {
|
|
1750
|
+
if (ch.kind === "min") {
|
|
1751
|
+
if (min === null || ch.value > min)
|
|
1752
|
+
min = ch.value;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
return min;
|
|
1756
|
+
}
|
|
1757
|
+
get maxValue() {
|
|
1758
|
+
let max = null;
|
|
1759
|
+
for (const ch of this._def.checks) {
|
|
1760
|
+
if (ch.kind === "max") {
|
|
1761
|
+
if (max === null || ch.value < max)
|
|
1762
|
+
max = ch.value;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return max;
|
|
1300
1766
|
}
|
|
1301
1767
|
};
|
|
1302
1768
|
__name(ZodBigInt, "ZodBigInt");
|
|
1303
1769
|
ZodBigInt.create = (params) => {
|
|
1304
1770
|
var _a;
|
|
1305
1771
|
return new ZodBigInt({
|
|
1772
|
+
checks: [],
|
|
1306
1773
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1307
1774
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
1308
1775
|
...processCreateParams(params)
|
|
@@ -1637,13 +2104,13 @@ var ZodArray = class extends ZodType {
|
|
|
1637
2104
|
}
|
|
1638
2105
|
}
|
|
1639
2106
|
if (ctx.common.async) {
|
|
1640
|
-
return Promise.all(ctx.data.map((item, i2) => {
|
|
2107
|
+
return Promise.all([...ctx.data].map((item, i2) => {
|
|
1641
2108
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
1642
2109
|
})).then((result2) => {
|
|
1643
2110
|
return ParseStatus.mergeArray(status, result2);
|
|
1644
2111
|
});
|
|
1645
2112
|
}
|
|
1646
|
-
const result = ctx.data.map((item, i2) => {
|
|
2113
|
+
const result = [...ctx.data].map((item, i2) => {
|
|
1647
2114
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
1648
2115
|
});
|
|
1649
2116
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -1684,24 +2151,6 @@ ZodArray.create = (schema, params) => {
|
|
|
1684
2151
|
...processCreateParams(params)
|
|
1685
2152
|
});
|
|
1686
2153
|
};
|
|
1687
|
-
var objectUtil;
|
|
1688
|
-
(function(objectUtil2) {
|
|
1689
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
1690
|
-
return {
|
|
1691
|
-
...first,
|
|
1692
|
-
...second
|
|
1693
|
-
};
|
|
1694
|
-
};
|
|
1695
|
-
})(objectUtil || (objectUtil = {}));
|
|
1696
|
-
var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
|
|
1697
|
-
return new ZodObject({
|
|
1698
|
-
...def,
|
|
1699
|
-
shape: () => ({
|
|
1700
|
-
...def.shape(),
|
|
1701
|
-
...augmentation
|
|
1702
|
-
})
|
|
1703
|
-
});
|
|
1704
|
-
}, "AugmentFactory");
|
|
1705
2154
|
function deepPartialify(schema) {
|
|
1706
2155
|
if (schema instanceof ZodObject) {
|
|
1707
2156
|
const newShape = {};
|
|
@@ -1714,7 +2163,10 @@ function deepPartialify(schema) {
|
|
|
1714
2163
|
shape: () => newShape
|
|
1715
2164
|
});
|
|
1716
2165
|
} else if (schema instanceof ZodArray) {
|
|
1717
|
-
return ZodArray
|
|
2166
|
+
return new ZodArray({
|
|
2167
|
+
...schema._def,
|
|
2168
|
+
type: deepPartialify(schema.element)
|
|
2169
|
+
});
|
|
1718
2170
|
} else if (schema instanceof ZodOptional) {
|
|
1719
2171
|
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
|
1720
2172
|
} else if (schema instanceof ZodNullable) {
|
|
@@ -1731,8 +2183,7 @@ var ZodObject = class extends ZodType {
|
|
|
1731
2183
|
super(...arguments);
|
|
1732
2184
|
this._cached = null;
|
|
1733
2185
|
this.nonstrict = this.passthrough;
|
|
1734
|
-
this.augment =
|
|
1735
|
-
this.extend = AugmentFactory(this._def);
|
|
2186
|
+
this.augment = this.extend;
|
|
1736
2187
|
}
|
|
1737
2188
|
_getCached() {
|
|
1738
2189
|
if (this._cached !== null)
|
|
@@ -1812,9 +2263,10 @@ var ZodObject = class extends ZodType {
|
|
|
1812
2263
|
const syncPairs = [];
|
|
1813
2264
|
for (const pair of pairs) {
|
|
1814
2265
|
const key = await pair.key;
|
|
2266
|
+
const value = await pair.value;
|
|
1815
2267
|
syncPairs.push({
|
|
1816
2268
|
key,
|
|
1817
|
-
value
|
|
2269
|
+
value,
|
|
1818
2270
|
alwaysSet: pair.alwaysSet
|
|
1819
2271
|
});
|
|
1820
2272
|
}
|
|
@@ -1861,18 +2313,30 @@ var ZodObject = class extends ZodType {
|
|
|
1861
2313
|
unknownKeys: "passthrough"
|
|
1862
2314
|
});
|
|
1863
2315
|
}
|
|
1864
|
-
|
|
1865
|
-
return
|
|
2316
|
+
extend(augmentation) {
|
|
2317
|
+
return new ZodObject({
|
|
2318
|
+
...this._def,
|
|
2319
|
+
shape: () => ({
|
|
2320
|
+
...this._def.shape(),
|
|
2321
|
+
...augmentation
|
|
2322
|
+
})
|
|
2323
|
+
});
|
|
1866
2324
|
}
|
|
1867
2325
|
merge(merging) {
|
|
1868
2326
|
const merged = new ZodObject({
|
|
1869
2327
|
unknownKeys: merging._def.unknownKeys,
|
|
1870
2328
|
catchall: merging._def.catchall,
|
|
1871
|
-
shape: () =>
|
|
2329
|
+
shape: () => ({
|
|
2330
|
+
...this._def.shape(),
|
|
2331
|
+
...merging._def.shape()
|
|
2332
|
+
}),
|
|
1872
2333
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
1873
2334
|
});
|
|
1874
2335
|
return merged;
|
|
1875
2336
|
}
|
|
2337
|
+
setKey(key, schema) {
|
|
2338
|
+
return this.augment({ [key]: schema });
|
|
2339
|
+
}
|
|
1876
2340
|
catchall(index) {
|
|
1877
2341
|
return new ZodObject({
|
|
1878
2342
|
...this._def,
|
|
@@ -1881,9 +2345,10 @@ var ZodObject = class extends ZodType {
|
|
|
1881
2345
|
}
|
|
1882
2346
|
pick(mask) {
|
|
1883
2347
|
const shape = {};
|
|
1884
|
-
util.objectKeys(mask).
|
|
1885
|
-
if (this.shape[key])
|
|
2348
|
+
util.objectKeys(mask).forEach((key) => {
|
|
2349
|
+
if (mask[key] && this.shape[key]) {
|
|
1886
2350
|
shape[key] = this.shape[key];
|
|
2351
|
+
}
|
|
1887
2352
|
});
|
|
1888
2353
|
return new ZodObject({
|
|
1889
2354
|
...this._def,
|
|
@@ -1892,8 +2357,8 @@ var ZodObject = class extends ZodType {
|
|
|
1892
2357
|
}
|
|
1893
2358
|
omit(mask) {
|
|
1894
2359
|
const shape = {};
|
|
1895
|
-
util.objectKeys(this.shape).
|
|
1896
|
-
if (
|
|
2360
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2361
|
+
if (!mask[key]) {
|
|
1897
2362
|
shape[key] = this.shape[key];
|
|
1898
2363
|
}
|
|
1899
2364
|
});
|
|
@@ -1907,24 +2372,14 @@ var ZodObject = class extends ZodType {
|
|
|
1907
2372
|
}
|
|
1908
2373
|
partial(mask) {
|
|
1909
2374
|
const newShape = {};
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
newShape[key] = this.shape[key].optional();
|
|
1916
|
-
}
|
|
1917
|
-
});
|
|
1918
|
-
return new ZodObject({
|
|
1919
|
-
...this._def,
|
|
1920
|
-
shape: () => newShape
|
|
1921
|
-
});
|
|
1922
|
-
} else {
|
|
1923
|
-
for (const key in this.shape) {
|
|
1924
|
-
const fieldSchema = this.shape[key];
|
|
2375
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2376
|
+
const fieldSchema = this.shape[key];
|
|
2377
|
+
if (mask && !mask[key]) {
|
|
2378
|
+
newShape[key] = fieldSchema;
|
|
2379
|
+
} else {
|
|
1925
2380
|
newShape[key] = fieldSchema.optional();
|
|
1926
2381
|
}
|
|
1927
|
-
}
|
|
2382
|
+
});
|
|
1928
2383
|
return new ZodObject({
|
|
1929
2384
|
...this._def,
|
|
1930
2385
|
shape: () => newShape
|
|
@@ -1932,21 +2387,10 @@ var ZodObject = class extends ZodType {
|
|
|
1932
2387
|
}
|
|
1933
2388
|
required(mask) {
|
|
1934
2389
|
const newShape = {};
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
} else {
|
|
1940
|
-
const fieldSchema = this.shape[key];
|
|
1941
|
-
let newField = fieldSchema;
|
|
1942
|
-
while (newField instanceof ZodOptional) {
|
|
1943
|
-
newField = newField._def.innerType;
|
|
1944
|
-
}
|
|
1945
|
-
newShape[key] = newField;
|
|
1946
|
-
}
|
|
1947
|
-
});
|
|
1948
|
-
} else {
|
|
1949
|
-
for (const key in this.shape) {
|
|
2390
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2391
|
+
if (mask && !mask[key]) {
|
|
2392
|
+
newShape[key] = this.shape[key];
|
|
2393
|
+
} else {
|
|
1950
2394
|
const fieldSchema = this.shape[key];
|
|
1951
2395
|
let newField = fieldSchema;
|
|
1952
2396
|
while (newField instanceof ZodOptional) {
|
|
@@ -1954,7 +2398,7 @@ var ZodObject = class extends ZodType {
|
|
|
1954
2398
|
}
|
|
1955
2399
|
newShape[key] = newField;
|
|
1956
2400
|
}
|
|
1957
|
-
}
|
|
2401
|
+
});
|
|
1958
2402
|
return new ZodObject({
|
|
1959
2403
|
...this._def,
|
|
1960
2404
|
shape: () => newShape
|
|
@@ -2095,15 +2539,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
|
|
|
2095
2539
|
} else if (type instanceof ZodEnum) {
|
|
2096
2540
|
return type.options;
|
|
2097
2541
|
} else if (type instanceof ZodNativeEnum) {
|
|
2098
|
-
return
|
|
2542
|
+
return util.objectValues(type.enum);
|
|
2099
2543
|
} else if (type instanceof ZodDefault) {
|
|
2100
2544
|
return getDiscriminator(type._def.innerType);
|
|
2101
2545
|
} else if (type instanceof ZodUndefined) {
|
|
2102
2546
|
return [void 0];
|
|
2103
2547
|
} else if (type instanceof ZodNull) {
|
|
2104
2548
|
return [null];
|
|
2549
|
+
} else if (type instanceof ZodOptional) {
|
|
2550
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2551
|
+
} else if (type instanceof ZodNullable) {
|
|
2552
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2553
|
+
} else if (type instanceof ZodBranded) {
|
|
2554
|
+
return getDiscriminator(type.unwrap());
|
|
2555
|
+
} else if (type instanceof ZodReadonly) {
|
|
2556
|
+
return getDiscriminator(type.unwrap());
|
|
2557
|
+
} else if (type instanceof ZodCatch) {
|
|
2558
|
+
return getDiscriminator(type._def.innerType);
|
|
2105
2559
|
} else {
|
|
2106
|
-
return
|
|
2560
|
+
return [];
|
|
2107
2561
|
}
|
|
2108
2562
|
}, "getDiscriminator");
|
|
2109
2563
|
var ZodDiscriminatedUnion = class extends ZodType {
|
|
@@ -2155,7 +2609,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2155
2609
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2156
2610
|
for (const type of options) {
|
|
2157
2611
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2158
|
-
if (!discriminatorValues) {
|
|
2612
|
+
if (!discriminatorValues.length) {
|
|
2159
2613
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2160
2614
|
}
|
|
2161
2615
|
for (const value of discriminatorValues) {
|
|
@@ -2300,7 +2754,7 @@ var ZodTuple = class extends ZodType {
|
|
|
2300
2754
|
});
|
|
2301
2755
|
status.dirty();
|
|
2302
2756
|
}
|
|
2303
|
-
const items = ctx.data.map((item, itemIndex) => {
|
|
2757
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
2304
2758
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
2305
2759
|
if (!schema)
|
|
2306
2760
|
return null;
|
|
@@ -2359,7 +2813,8 @@ var ZodRecord = class extends ZodType {
|
|
|
2359
2813
|
for (const key in ctx.data) {
|
|
2360
2814
|
pairs.push({
|
|
2361
2815
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
2362
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
2816
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
2817
|
+
alwaysSet: key in ctx.data
|
|
2363
2818
|
});
|
|
2364
2819
|
}
|
|
2365
2820
|
if (ctx.common.async) {
|
|
@@ -2390,6 +2845,12 @@ var ZodRecord = class extends ZodType {
|
|
|
2390
2845
|
};
|
|
2391
2846
|
__name(ZodRecord, "ZodRecord");
|
|
2392
2847
|
var ZodMap = class extends ZodType {
|
|
2848
|
+
get keySchema() {
|
|
2849
|
+
return this._def.keyType;
|
|
2850
|
+
}
|
|
2851
|
+
get valueSchema() {
|
|
2852
|
+
return this._def.valueType;
|
|
2853
|
+
}
|
|
2393
2854
|
_parse(input) {
|
|
2394
2855
|
const { status, ctx } = this._processInputParams(input);
|
|
2395
2856
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -2589,27 +3050,29 @@ var ZodFunction = class extends ZodType {
|
|
|
2589
3050
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
2590
3051
|
const fn = ctx.data;
|
|
2591
3052
|
if (this._def.returns instanceof ZodPromise) {
|
|
2592
|
-
|
|
3053
|
+
const me = this;
|
|
3054
|
+
return OK(async function(...args) {
|
|
2593
3055
|
const error = new ZodError([]);
|
|
2594
|
-
const parsedArgs = await
|
|
3056
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e2) => {
|
|
2595
3057
|
error.addIssue(makeArgsIssue(args, e2));
|
|
2596
3058
|
throw error;
|
|
2597
3059
|
});
|
|
2598
|
-
const result = await fn
|
|
2599
|
-
const parsedReturns = await
|
|
3060
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3061
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e2) => {
|
|
2600
3062
|
error.addIssue(makeReturnsIssue(result, e2));
|
|
2601
3063
|
throw error;
|
|
2602
3064
|
});
|
|
2603
3065
|
return parsedReturns;
|
|
2604
3066
|
});
|
|
2605
3067
|
} else {
|
|
2606
|
-
|
|
2607
|
-
|
|
3068
|
+
const me = this;
|
|
3069
|
+
return OK(function(...args) {
|
|
3070
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
2608
3071
|
if (!parsedArgs.success) {
|
|
2609
3072
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
2610
3073
|
}
|
|
2611
|
-
const result = fn
|
|
2612
|
-
const parsedReturns =
|
|
3074
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3075
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
2613
3076
|
if (!parsedReturns.success) {
|
|
2614
3077
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
2615
3078
|
}
|
|
@@ -2676,6 +3139,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
2676
3139
|
if (input.data !== this._def.value) {
|
|
2677
3140
|
const ctx = this._getOrReturnCtx(input);
|
|
2678
3141
|
addIssueToContext(ctx, {
|
|
3142
|
+
received: ctx.data,
|
|
2679
3143
|
code: ZodIssueCode.invalid_literal,
|
|
2680
3144
|
expected: this._def.value
|
|
2681
3145
|
});
|
|
@@ -2704,6 +3168,10 @@ function createZodEnum(values, params) {
|
|
|
2704
3168
|
}
|
|
2705
3169
|
__name(createZodEnum, "createZodEnum");
|
|
2706
3170
|
var ZodEnum = class extends ZodType {
|
|
3171
|
+
constructor() {
|
|
3172
|
+
super(...arguments);
|
|
3173
|
+
_ZodEnum_cache.set(this, void 0);
|
|
3174
|
+
}
|
|
2707
3175
|
_parse(input) {
|
|
2708
3176
|
if (typeof input.data !== "string") {
|
|
2709
3177
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2715,7 +3183,10 @@ var ZodEnum = class extends ZodType {
|
|
|
2715
3183
|
});
|
|
2716
3184
|
return INVALID;
|
|
2717
3185
|
}
|
|
2718
|
-
if (this
|
|
3186
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
3187
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
3188
|
+
}
|
|
3189
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
2719
3190
|
const ctx = this._getOrReturnCtx(input);
|
|
2720
3191
|
const expectedValues = this._def.values;
|
|
2721
3192
|
addIssueToContext(ctx, {
|
|
@@ -2751,10 +3222,27 @@ var ZodEnum = class extends ZodType {
|
|
|
2751
3222
|
}
|
|
2752
3223
|
return enumValues;
|
|
2753
3224
|
}
|
|
3225
|
+
extract(values, newDef = this._def) {
|
|
3226
|
+
return ZodEnum.create(values, {
|
|
3227
|
+
...this._def,
|
|
3228
|
+
...newDef
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
exclude(values, newDef = this._def) {
|
|
3232
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3233
|
+
...this._def,
|
|
3234
|
+
...newDef
|
|
3235
|
+
});
|
|
3236
|
+
}
|
|
2754
3237
|
};
|
|
2755
3238
|
__name(ZodEnum, "ZodEnum");
|
|
3239
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2756
3240
|
ZodEnum.create = createZodEnum;
|
|
2757
3241
|
var ZodNativeEnum = class extends ZodType {
|
|
3242
|
+
constructor() {
|
|
3243
|
+
super(...arguments);
|
|
3244
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
3245
|
+
}
|
|
2758
3246
|
_parse(input) {
|
|
2759
3247
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
2760
3248
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2767,7 +3255,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
2767
3255
|
});
|
|
2768
3256
|
return INVALID;
|
|
2769
3257
|
}
|
|
2770
|
-
if (
|
|
3258
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
3259
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
3260
|
+
}
|
|
3261
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
2771
3262
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
2772
3263
|
addIssueToContext(ctx, {
|
|
2773
3264
|
received: ctx.data,
|
|
@@ -2783,6 +3274,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
2783
3274
|
}
|
|
2784
3275
|
};
|
|
2785
3276
|
__name(ZodNativeEnum, "ZodNativeEnum");
|
|
3277
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2786
3278
|
ZodNativeEnum.create = (values, params) => {
|
|
2787
3279
|
return new ZodNativeEnum({
|
|
2788
3280
|
values,
|
|
@@ -2791,6 +3283,9 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
2791
3283
|
});
|
|
2792
3284
|
};
|
|
2793
3285
|
var ZodPromise = class extends ZodType {
|
|
3286
|
+
unwrap() {
|
|
3287
|
+
return this._def.type;
|
|
3288
|
+
}
|
|
2794
3289
|
_parse(input) {
|
|
2795
3290
|
const { ctx } = this._processInputParams(input);
|
|
2796
3291
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -2828,24 +3323,6 @@ var ZodEffects = class extends ZodType {
|
|
|
2828
3323
|
_parse(input) {
|
|
2829
3324
|
const { status, ctx } = this._processInputParams(input);
|
|
2830
3325
|
const effect = this._def.effect || null;
|
|
2831
|
-
if (effect.type === "preprocess") {
|
|
2832
|
-
const processed = effect.transform(ctx.data);
|
|
2833
|
-
if (ctx.common.async) {
|
|
2834
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
2835
|
-
return this._def.schema._parseAsync({
|
|
2836
|
-
data: processed2,
|
|
2837
|
-
path: ctx.path,
|
|
2838
|
-
parent: ctx
|
|
2839
|
-
});
|
|
2840
|
-
});
|
|
2841
|
-
} else {
|
|
2842
|
-
return this._def.schema._parseSync({
|
|
2843
|
-
data: processed,
|
|
2844
|
-
path: ctx.path,
|
|
2845
|
-
parent: ctx
|
|
2846
|
-
});
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
3326
|
const checkCtx = {
|
|
2850
3327
|
addIssue: (arg) => {
|
|
2851
3328
|
addIssueToContext(ctx, arg);
|
|
@@ -2860,6 +3337,42 @@ var ZodEffects = class extends ZodType {
|
|
|
2860
3337
|
}
|
|
2861
3338
|
};
|
|
2862
3339
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3340
|
+
if (effect.type === "preprocess") {
|
|
3341
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3342
|
+
if (ctx.common.async) {
|
|
3343
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3344
|
+
if (status.value === "aborted")
|
|
3345
|
+
return INVALID;
|
|
3346
|
+
const result = await this._def.schema._parseAsync({
|
|
3347
|
+
data: processed2,
|
|
3348
|
+
path: ctx.path,
|
|
3349
|
+
parent: ctx
|
|
3350
|
+
});
|
|
3351
|
+
if (result.status === "aborted")
|
|
3352
|
+
return INVALID;
|
|
3353
|
+
if (result.status === "dirty")
|
|
3354
|
+
return DIRTY(result.value);
|
|
3355
|
+
if (status.value === "dirty")
|
|
3356
|
+
return DIRTY(result.value);
|
|
3357
|
+
return result;
|
|
3358
|
+
});
|
|
3359
|
+
} else {
|
|
3360
|
+
if (status.value === "aborted")
|
|
3361
|
+
return INVALID;
|
|
3362
|
+
const result = this._def.schema._parseSync({
|
|
3363
|
+
data: processed,
|
|
3364
|
+
path: ctx.path,
|
|
3365
|
+
parent: ctx
|
|
3366
|
+
});
|
|
3367
|
+
if (result.status === "aborted")
|
|
3368
|
+
return INVALID;
|
|
3369
|
+
if (result.status === "dirty")
|
|
3370
|
+
return DIRTY(result.value);
|
|
3371
|
+
if (status.value === "dirty")
|
|
3372
|
+
return DIRTY(result.value);
|
|
3373
|
+
return result;
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
2863
3376
|
if (effect.type === "refinement") {
|
|
2864
3377
|
const executeRefinement = /* @__PURE__ */ __name((acc) => {
|
|
2865
3378
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -3006,26 +3519,45 @@ ZodDefault.create = (type, params) => {
|
|
|
3006
3519
|
var ZodCatch = class extends ZodType {
|
|
3007
3520
|
_parse(input) {
|
|
3008
3521
|
const { ctx } = this._processInputParams(input);
|
|
3522
|
+
const newCtx = {
|
|
3523
|
+
...ctx,
|
|
3524
|
+
common: {
|
|
3525
|
+
...ctx.common,
|
|
3526
|
+
issues: []
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3009
3529
|
const result = this._def.innerType._parse({
|
|
3010
|
-
data:
|
|
3011
|
-
path:
|
|
3012
|
-
parent:
|
|
3530
|
+
data: newCtx.data,
|
|
3531
|
+
path: newCtx.path,
|
|
3532
|
+
parent: {
|
|
3533
|
+
...newCtx
|
|
3534
|
+
}
|
|
3013
3535
|
});
|
|
3014
3536
|
if (isAsync(result)) {
|
|
3015
3537
|
return result.then((result2) => {
|
|
3016
3538
|
return {
|
|
3017
3539
|
status: "valid",
|
|
3018
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
3540
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
3541
|
+
get error() {
|
|
3542
|
+
return new ZodError(newCtx.common.issues);
|
|
3543
|
+
},
|
|
3544
|
+
input: newCtx.data
|
|
3545
|
+
})
|
|
3019
3546
|
};
|
|
3020
3547
|
});
|
|
3021
3548
|
} else {
|
|
3022
3549
|
return {
|
|
3023
3550
|
status: "valid",
|
|
3024
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
3551
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
3552
|
+
get error() {
|
|
3553
|
+
return new ZodError(newCtx.common.issues);
|
|
3554
|
+
},
|
|
3555
|
+
input: newCtx.data
|
|
3556
|
+
})
|
|
3025
3557
|
};
|
|
3026
3558
|
}
|
|
3027
3559
|
}
|
|
3028
|
-
|
|
3560
|
+
removeCatch() {
|
|
3029
3561
|
return this._def.innerType;
|
|
3030
3562
|
}
|
|
3031
3563
|
};
|
|
@@ -3034,7 +3566,7 @@ ZodCatch.create = (type, params) => {
|
|
|
3034
3566
|
return new ZodCatch({
|
|
3035
3567
|
innerType: type,
|
|
3036
3568
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
3037
|
-
|
|
3569
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
3038
3570
|
...processCreateParams(params)
|
|
3039
3571
|
});
|
|
3040
3572
|
};
|
|
@@ -3132,17 +3664,43 @@ var ZodPipeline = class extends ZodType {
|
|
|
3132
3664
|
}
|
|
3133
3665
|
};
|
|
3134
3666
|
__name(ZodPipeline, "ZodPipeline");
|
|
3135
|
-
var
|
|
3667
|
+
var ZodReadonly = class extends ZodType {
|
|
3668
|
+
_parse(input) {
|
|
3669
|
+
const result = this._def.innerType._parse(input);
|
|
3670
|
+
const freeze = /* @__PURE__ */ __name((data) => {
|
|
3671
|
+
if (isValid(data)) {
|
|
3672
|
+
data.value = Object.freeze(data.value);
|
|
3673
|
+
}
|
|
3674
|
+
return data;
|
|
3675
|
+
}, "freeze");
|
|
3676
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3677
|
+
}
|
|
3678
|
+
unwrap() {
|
|
3679
|
+
return this._def.innerType;
|
|
3680
|
+
}
|
|
3681
|
+
};
|
|
3682
|
+
__name(ZodReadonly, "ZodReadonly");
|
|
3683
|
+
ZodReadonly.create = (type, params) => {
|
|
3684
|
+
return new ZodReadonly({
|
|
3685
|
+
innerType: type,
|
|
3686
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3687
|
+
...processCreateParams(params)
|
|
3688
|
+
});
|
|
3689
|
+
};
|
|
3690
|
+
function custom(check, params = {}, fatal) {
|
|
3136
3691
|
if (check)
|
|
3137
3692
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3693
|
+
var _a, _b;
|
|
3138
3694
|
if (!check(data)) {
|
|
3139
|
-
const p = typeof params === "function" ? params(data) : params;
|
|
3695
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3696
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3140
3697
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3141
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
|
3698
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3142
3699
|
}
|
|
3143
3700
|
});
|
|
3144
3701
|
return ZodAny.create();
|
|
3145
|
-
}
|
|
3702
|
+
}
|
|
3703
|
+
__name(custom, "custom");
|
|
3146
3704
|
var late = {
|
|
3147
3705
|
object: ZodObject.lazycreate
|
|
3148
3706
|
};
|
|
@@ -3183,10 +3741,11 @@ var ZodFirstPartyTypeKind;
|
|
|
3183
3741
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3184
3742
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3185
3743
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3744
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3186
3745
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3187
3746
|
var instanceOfType = /* @__PURE__ */ __name((cls, params = {
|
|
3188
3747
|
message: `Input not instance of ${cls.name}`
|
|
3189
|
-
}) => custom((data) => data instanceof cls, params
|
|
3748
|
+
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
|
3190
3749
|
var stringType = ZodString.create;
|
|
3191
3750
|
var numberType = ZodNumber.create;
|
|
3192
3751
|
var nanType = ZodNaN.create;
|
|
@@ -3227,12 +3786,15 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
|
|
|
3227
3786
|
var coerce = {
|
|
3228
3787
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
3229
3788
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
3230
|
-
boolean: (arg) => ZodBoolean.create({
|
|
3789
|
+
boolean: (arg) => ZodBoolean.create({
|
|
3790
|
+
...arg,
|
|
3791
|
+
coerce: true
|
|
3792
|
+
}),
|
|
3231
3793
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
3232
3794
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3233
3795
|
};
|
|
3234
3796
|
var NEVER = INVALID;
|
|
3235
|
-
var
|
|
3797
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
3236
3798
|
__proto__: null,
|
|
3237
3799
|
defaultErrorMap: errorMap,
|
|
3238
3800
|
setErrorMap,
|
|
@@ -3251,9 +3813,13 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3251
3813
|
get util() {
|
|
3252
3814
|
return util;
|
|
3253
3815
|
},
|
|
3816
|
+
get objectUtil() {
|
|
3817
|
+
return objectUtil;
|
|
3818
|
+
},
|
|
3254
3819
|
ZodParsedType,
|
|
3255
3820
|
getParsedType,
|
|
3256
3821
|
ZodType,
|
|
3822
|
+
datetimeRegex,
|
|
3257
3823
|
ZodString,
|
|
3258
3824
|
ZodNumber,
|
|
3259
3825
|
ZodBigInt,
|
|
@@ -3267,9 +3833,6 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3267
3833
|
ZodNever,
|
|
3268
3834
|
ZodVoid,
|
|
3269
3835
|
ZodArray,
|
|
3270
|
-
get objectUtil() {
|
|
3271
|
-
return objectUtil;
|
|
3272
|
-
},
|
|
3273
3836
|
ZodObject,
|
|
3274
3837
|
ZodUnion,
|
|
3275
3838
|
ZodDiscriminatedUnion,
|
|
@@ -3294,6 +3857,7 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3294
3857
|
BRAND,
|
|
3295
3858
|
ZodBranded,
|
|
3296
3859
|
ZodPipeline,
|
|
3860
|
+
ZodReadonly,
|
|
3297
3861
|
custom,
|
|
3298
3862
|
Schema: ZodType,
|
|
3299
3863
|
ZodSchema: ZodType,
|
|
@@ -3347,38 +3911,140 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3347
3911
|
ZodError
|
|
3348
3912
|
});
|
|
3349
3913
|
|
|
3914
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZodSymbols.chunk.mjs
|
|
3915
|
+
var currentSymbol = Symbol("current");
|
|
3916
|
+
var previousSymbol = Symbol("previous");
|
|
3917
|
+
|
|
3918
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZod.chunk.mjs
|
|
3919
|
+
var mergeOpenApi = /* @__PURE__ */ __name((openapi, {
|
|
3920
|
+
ref: _ref,
|
|
3921
|
+
refType: _refType,
|
|
3922
|
+
param: _param,
|
|
3923
|
+
header: _header,
|
|
3924
|
+
...rest
|
|
3925
|
+
} = {}) => ({
|
|
3926
|
+
...rest,
|
|
3927
|
+
...openapi
|
|
3928
|
+
}), "mergeOpenApi");
|
|
3929
|
+
function extendZodWithOpenApi(zod) {
|
|
3930
|
+
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
|
3931
|
+
return;
|
|
3932
|
+
}
|
|
3933
|
+
zod.ZodType.prototype.openapi = function(openapi) {
|
|
3934
|
+
const { zodOpenApi, ...rest } = this._def;
|
|
3935
|
+
const result = new this.constructor({
|
|
3936
|
+
...rest,
|
|
3937
|
+
zodOpenApi: {
|
|
3938
|
+
openapi: mergeOpenApi(
|
|
3939
|
+
openapi,
|
|
3940
|
+
zodOpenApi == null ? void 0 : zodOpenApi.openapi
|
|
3941
|
+
)
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3944
|
+
result._def.zodOpenApi[currentSymbol] = result;
|
|
3945
|
+
if (zodOpenApi) {
|
|
3946
|
+
result._def.zodOpenApi[previousSymbol] = this;
|
|
3947
|
+
}
|
|
3948
|
+
return result;
|
|
3949
|
+
};
|
|
3950
|
+
const zodDescribe = zod.ZodType.prototype.describe;
|
|
3951
|
+
zod.ZodType.prototype.describe = function(...args) {
|
|
3952
|
+
const result = zodDescribe.apply(this, args);
|
|
3953
|
+
const def = result._def;
|
|
3954
|
+
if (def.zodOpenApi) {
|
|
3955
|
+
const cloned = { ...def.zodOpenApi };
|
|
3956
|
+
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
|
3957
|
+
cloned[previousSymbol] = this;
|
|
3958
|
+
cloned[currentSymbol] = result;
|
|
3959
|
+
def.zodOpenApi = cloned;
|
|
3960
|
+
} else {
|
|
3961
|
+
def.zodOpenApi = {
|
|
3962
|
+
openapi: { description: args[0] },
|
|
3963
|
+
[currentSymbol]: result
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
return result;
|
|
3967
|
+
};
|
|
3968
|
+
const zodObjectExtend = zod.ZodObject.prototype.extend;
|
|
3969
|
+
zod.ZodObject.prototype.extend = function(...args) {
|
|
3970
|
+
const extendResult = zodObjectExtend.apply(this, args);
|
|
3971
|
+
const zodOpenApi = extendResult._def.zodOpenApi;
|
|
3972
|
+
if (zodOpenApi) {
|
|
3973
|
+
const cloned = { ...zodOpenApi };
|
|
3974
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
3975
|
+
cloned[previousSymbol] = this;
|
|
3976
|
+
extendResult._def.zodOpenApi = cloned;
|
|
3977
|
+
} else {
|
|
3978
|
+
extendResult._def.zodOpenApi = {
|
|
3979
|
+
[previousSymbol]: this
|
|
3980
|
+
};
|
|
3981
|
+
}
|
|
3982
|
+
return extendResult;
|
|
3983
|
+
};
|
|
3984
|
+
const zodObjectOmit = zod.ZodObject.prototype.omit;
|
|
3985
|
+
zod.ZodObject.prototype.omit = function(...args) {
|
|
3986
|
+
const omitResult = zodObjectOmit.apply(this, args);
|
|
3987
|
+
const zodOpenApi = omitResult._def.zodOpenApi;
|
|
3988
|
+
if (zodOpenApi) {
|
|
3989
|
+
const cloned = { ...zodOpenApi };
|
|
3990
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
3991
|
+
delete cloned[previousSymbol];
|
|
3992
|
+
delete cloned[currentSymbol];
|
|
3993
|
+
omitResult._def.zodOpenApi = cloned;
|
|
3994
|
+
}
|
|
3995
|
+
return omitResult;
|
|
3996
|
+
};
|
|
3997
|
+
const zodObjectPick = zod.ZodObject.prototype.pick;
|
|
3998
|
+
zod.ZodObject.prototype.pick = function(...args) {
|
|
3999
|
+
const pickResult = zodObjectPick.apply(this, args);
|
|
4000
|
+
const zodOpenApi = pickResult._def.zodOpenApi;
|
|
4001
|
+
if (zodOpenApi) {
|
|
4002
|
+
const cloned = { ...zodOpenApi };
|
|
4003
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
4004
|
+
delete cloned[previousSymbol];
|
|
4005
|
+
delete cloned[currentSymbol];
|
|
4006
|
+
pickResult._def.zodOpenApi = cloned;
|
|
4007
|
+
}
|
|
4008
|
+
return pickResult;
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
__name(extendZodWithOpenApi, "extendZodWithOpenApi");
|
|
4012
|
+
|
|
4013
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extend.mjs
|
|
4014
|
+
extendZodWithOpenApi(z);
|
|
4015
|
+
|
|
3350
4016
|
// ../../learn-card-types/dist/types.esm.js
|
|
3351
4017
|
var __defProp2 = Object.defineProperty;
|
|
3352
4018
|
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
3353
|
-
var ContextValidator =
|
|
3354
|
-
var AchievementCriteriaValidator =
|
|
3355
|
-
type:
|
|
3356
|
-
narrative:
|
|
4019
|
+
var ContextValidator = z.array(z.string().or(z.record(z.any())));
|
|
4020
|
+
var AchievementCriteriaValidator = z.object({
|
|
4021
|
+
type: z.string().optional(),
|
|
4022
|
+
narrative: z.string().optional()
|
|
3357
4023
|
});
|
|
3358
|
-
var ImageValidator =
|
|
3359
|
-
|
|
3360
|
-
id:
|
|
3361
|
-
type:
|
|
3362
|
-
caption:
|
|
4024
|
+
var ImageValidator = z.string().or(
|
|
4025
|
+
z.object({
|
|
4026
|
+
id: z.string(),
|
|
4027
|
+
type: z.string(),
|
|
4028
|
+
caption: z.string().optional()
|
|
3363
4029
|
})
|
|
3364
4030
|
);
|
|
3365
|
-
var GeoCoordinatesValidator =
|
|
3366
|
-
type:
|
|
3367
|
-
latitude:
|
|
3368
|
-
longitude:
|
|
4031
|
+
var GeoCoordinatesValidator = z.object({
|
|
4032
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4033
|
+
latitude: z.number(),
|
|
4034
|
+
longitude: z.number()
|
|
3369
4035
|
});
|
|
3370
|
-
var AddressValidator =
|
|
3371
|
-
type:
|
|
3372
|
-
addressCountry:
|
|
3373
|
-
addressCountryCode:
|
|
3374
|
-
addressRegion:
|
|
3375
|
-
addressLocality:
|
|
3376
|
-
streetAddress:
|
|
3377
|
-
postOfficeBoxNumber:
|
|
3378
|
-
postalCode:
|
|
4036
|
+
var AddressValidator = z.object({
|
|
4037
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4038
|
+
addressCountry: z.string().optional(),
|
|
4039
|
+
addressCountryCode: z.string().optional(),
|
|
4040
|
+
addressRegion: z.string().optional(),
|
|
4041
|
+
addressLocality: z.string().optional(),
|
|
4042
|
+
streetAddress: z.string().optional(),
|
|
4043
|
+
postOfficeBoxNumber: z.string().optional(),
|
|
4044
|
+
postalCode: z.string().optional(),
|
|
3379
4045
|
geo: GeoCoordinatesValidator.optional()
|
|
3380
4046
|
});
|
|
3381
|
-
var IdentifierTypeValidator =
|
|
4047
|
+
var IdentifierTypeValidator = z.enum([
|
|
3382
4048
|
"sourcedId",
|
|
3383
4049
|
"systemId",
|
|
3384
4050
|
"productId",
|
|
@@ -3397,140 +4063,140 @@ var IdentifierTypeValidator = mod.enum([
|
|
|
3397
4063
|
"ltiPlatformId",
|
|
3398
4064
|
"ltiUserId",
|
|
3399
4065
|
"identifier"
|
|
3400
|
-
]).or(
|
|
3401
|
-
var IdentifierEntryValidator =
|
|
3402
|
-
type:
|
|
3403
|
-
identifier:
|
|
4066
|
+
]).or(z.string());
|
|
4067
|
+
var IdentifierEntryValidator = z.object({
|
|
4068
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4069
|
+
identifier: z.string(),
|
|
3404
4070
|
identifierType: IdentifierTypeValidator
|
|
3405
4071
|
});
|
|
3406
|
-
var ProfileValidator =
|
|
3407
|
-
|
|
3408
|
-
id:
|
|
3409
|
-
type:
|
|
3410
|
-
name:
|
|
3411
|
-
url:
|
|
3412
|
-
phone:
|
|
3413
|
-
description:
|
|
3414
|
-
endorsement:
|
|
4072
|
+
var ProfileValidator = z.string().or(
|
|
4073
|
+
z.object({
|
|
4074
|
+
id: z.string().optional(),
|
|
4075
|
+
type: z.string().or(z.string().array().nonempty().optional()),
|
|
4076
|
+
name: z.string().optional(),
|
|
4077
|
+
url: z.string().optional(),
|
|
4078
|
+
phone: z.string().optional(),
|
|
4079
|
+
description: z.string().optional(),
|
|
4080
|
+
endorsement: z.any().array().optional(),
|
|
3415
4081
|
image: ImageValidator.optional(),
|
|
3416
|
-
email:
|
|
4082
|
+
email: z.string().email().optional(),
|
|
3417
4083
|
address: AddressValidator.optional(),
|
|
3418
4084
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3419
|
-
official:
|
|
3420
|
-
parentOrg:
|
|
3421
|
-
familyName:
|
|
3422
|
-
givenName:
|
|
3423
|
-
additionalName:
|
|
3424
|
-
patronymicName:
|
|
3425
|
-
honorificPrefix:
|
|
3426
|
-
honorificSuffix:
|
|
3427
|
-
familyNamePrefix:
|
|
3428
|
-
dateOfBirth:
|
|
3429
|
-
}).catchall(
|
|
4085
|
+
official: z.string().optional(),
|
|
4086
|
+
parentOrg: z.any().optional(),
|
|
4087
|
+
familyName: z.string().optional(),
|
|
4088
|
+
givenName: z.string().optional(),
|
|
4089
|
+
additionalName: z.string().optional(),
|
|
4090
|
+
patronymicName: z.string().optional(),
|
|
4091
|
+
honorificPrefix: z.string().optional(),
|
|
4092
|
+
honorificSuffix: z.string().optional(),
|
|
4093
|
+
familyNamePrefix: z.string().optional(),
|
|
4094
|
+
dateOfBirth: z.string().optional()
|
|
4095
|
+
}).catchall(z.any())
|
|
3430
4096
|
);
|
|
3431
|
-
var CredentialSubjectValidator =
|
|
3432
|
-
var CredentialStatusValidator =
|
|
3433
|
-
var CredentialSchemaValidator =
|
|
3434
|
-
var RefreshServiceValidator =
|
|
3435
|
-
var TermsOfUseValidator =
|
|
3436
|
-
var VC2EvidenceValidator =
|
|
3437
|
-
var UnsignedVCValidator =
|
|
4097
|
+
var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
|
|
4098
|
+
var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
|
|
4099
|
+
var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
|
|
4100
|
+
var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
|
|
4101
|
+
var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
|
|
4102
|
+
var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
|
|
4103
|
+
var UnsignedVCValidator = z.object({
|
|
3438
4104
|
"@context": ContextValidator,
|
|
3439
|
-
id:
|
|
3440
|
-
type:
|
|
4105
|
+
id: z.string().optional(),
|
|
4106
|
+
type: z.string().array().nonempty(),
|
|
3441
4107
|
issuer: ProfileValidator,
|
|
3442
4108
|
credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
|
|
3443
4109
|
refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
|
|
3444
4110
|
credentialSchema: CredentialSchemaValidator.or(
|
|
3445
4111
|
CredentialSchemaValidator.array()
|
|
3446
4112
|
).optional(),
|
|
3447
|
-
issuanceDate:
|
|
3448
|
-
expirationDate:
|
|
4113
|
+
issuanceDate: z.string().optional(),
|
|
4114
|
+
expirationDate: z.string().optional(),
|
|
3449
4115
|
credentialStatus: CredentialStatusValidator.or(
|
|
3450
4116
|
CredentialStatusValidator.array()
|
|
3451
4117
|
).optional(),
|
|
3452
|
-
name:
|
|
3453
|
-
description:
|
|
3454
|
-
validFrom:
|
|
3455
|
-
validUntil:
|
|
4118
|
+
name: z.string().optional(),
|
|
4119
|
+
description: z.string().optional(),
|
|
4120
|
+
validFrom: z.string().optional(),
|
|
4121
|
+
validUntil: z.string().optional(),
|
|
3456
4122
|
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
|
|
3457
4123
|
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
|
|
3458
4124
|
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
|
|
3459
|
-
}).catchall(
|
|
3460
|
-
var ProofValidator =
|
|
3461
|
-
type:
|
|
3462
|
-
created:
|
|
3463
|
-
challenge:
|
|
3464
|
-
domain:
|
|
3465
|
-
nonce:
|
|
3466
|
-
proofPurpose:
|
|
3467
|
-
verificationMethod:
|
|
3468
|
-
jws:
|
|
3469
|
-
}).catchall(
|
|
4125
|
+
}).catchall(z.any());
|
|
4126
|
+
var ProofValidator = z.object({
|
|
4127
|
+
type: z.string(),
|
|
4128
|
+
created: z.string(),
|
|
4129
|
+
challenge: z.string().optional(),
|
|
4130
|
+
domain: z.string().optional(),
|
|
4131
|
+
nonce: z.string().optional(),
|
|
4132
|
+
proofPurpose: z.string(),
|
|
4133
|
+
verificationMethod: z.string(),
|
|
4134
|
+
jws: z.string().optional()
|
|
4135
|
+
}).catchall(z.any());
|
|
3470
4136
|
var VCValidator = UnsignedVCValidator.extend({
|
|
3471
4137
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3472
4138
|
});
|
|
3473
|
-
var UnsignedVPValidator =
|
|
4139
|
+
var UnsignedVPValidator = z.object({
|
|
3474
4140
|
"@context": ContextValidator,
|
|
3475
|
-
id:
|
|
3476
|
-
type:
|
|
4141
|
+
id: z.string().optional(),
|
|
4142
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
3477
4143
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
|
3478
|
-
holder:
|
|
3479
|
-
}).catchall(
|
|
4144
|
+
holder: z.string().optional()
|
|
4145
|
+
}).catchall(z.any());
|
|
3480
4146
|
var VPValidator = UnsignedVPValidator.extend({
|
|
3481
4147
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3482
4148
|
});
|
|
3483
|
-
var JWKValidator =
|
|
3484
|
-
kty:
|
|
3485
|
-
crv:
|
|
3486
|
-
x:
|
|
3487
|
-
y:
|
|
3488
|
-
n:
|
|
3489
|
-
d:
|
|
4149
|
+
var JWKValidator = z.object({
|
|
4150
|
+
kty: z.string(),
|
|
4151
|
+
crv: z.string(),
|
|
4152
|
+
x: z.string(),
|
|
4153
|
+
y: z.string().optional(),
|
|
4154
|
+
n: z.string().optional(),
|
|
4155
|
+
d: z.string().optional()
|
|
3490
4156
|
});
|
|
3491
|
-
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d:
|
|
3492
|
-
var JWERecipientHeaderValidator =
|
|
3493
|
-
alg:
|
|
3494
|
-
iv:
|
|
3495
|
-
tag:
|
|
4157
|
+
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
|
|
4158
|
+
var JWERecipientHeaderValidator = z.object({
|
|
4159
|
+
alg: z.string(),
|
|
4160
|
+
iv: z.string(),
|
|
4161
|
+
tag: z.string(),
|
|
3496
4162
|
epk: JWKValidator.partial().optional(),
|
|
3497
|
-
kid:
|
|
3498
|
-
apv:
|
|
3499
|
-
apu:
|
|
4163
|
+
kid: z.string().optional(),
|
|
4164
|
+
apv: z.string().optional(),
|
|
4165
|
+
apu: z.string().optional()
|
|
3500
4166
|
});
|
|
3501
|
-
var JWERecipientValidator =
|
|
4167
|
+
var JWERecipientValidator = z.object({
|
|
3502
4168
|
header: JWERecipientHeaderValidator,
|
|
3503
|
-
encrypted_key:
|
|
4169
|
+
encrypted_key: z.string()
|
|
3504
4170
|
});
|
|
3505
|
-
var JWEValidator =
|
|
3506
|
-
protected:
|
|
3507
|
-
iv:
|
|
3508
|
-
ciphertext:
|
|
3509
|
-
tag:
|
|
3510
|
-
aad:
|
|
4171
|
+
var JWEValidator = z.object({
|
|
4172
|
+
protected: z.string(),
|
|
4173
|
+
iv: z.string(),
|
|
4174
|
+
ciphertext: z.string(),
|
|
4175
|
+
tag: z.string(),
|
|
4176
|
+
aad: z.string().optional(),
|
|
3511
4177
|
recipients: JWERecipientValidator.array().optional()
|
|
3512
4178
|
});
|
|
3513
|
-
var VerificationMethodValidator =
|
|
3514
|
-
|
|
4179
|
+
var VerificationMethodValidator = z.string().or(
|
|
4180
|
+
z.object({
|
|
3515
4181
|
"@context": ContextValidator.optional(),
|
|
3516
|
-
id:
|
|
3517
|
-
type:
|
|
3518
|
-
controller:
|
|
4182
|
+
id: z.string(),
|
|
4183
|
+
type: z.string(),
|
|
4184
|
+
controller: z.string(),
|
|
3519
4185
|
publicKeyJwk: JWKValidator.optional(),
|
|
3520
|
-
publicKeyBase58:
|
|
3521
|
-
blockChainAccountId:
|
|
3522
|
-
}).catchall(
|
|
4186
|
+
publicKeyBase58: z.string().optional(),
|
|
4187
|
+
blockChainAccountId: z.string().optional()
|
|
4188
|
+
}).catchall(z.any())
|
|
3523
4189
|
);
|
|
3524
|
-
var ServiceValidator =
|
|
3525
|
-
id:
|
|
3526
|
-
type:
|
|
3527
|
-
serviceEndpoint:
|
|
3528
|
-
}).catchall(
|
|
3529
|
-
var DidDocumentValidator =
|
|
4190
|
+
var ServiceValidator = z.object({
|
|
4191
|
+
id: z.string(),
|
|
4192
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4193
|
+
serviceEndpoint: z.any().or(z.any().array().nonempty())
|
|
4194
|
+
}).catchall(z.any());
|
|
4195
|
+
var DidDocumentValidator = z.object({
|
|
3530
4196
|
"@context": ContextValidator,
|
|
3531
|
-
id:
|
|
3532
|
-
alsoKnownAs:
|
|
3533
|
-
controller:
|
|
4197
|
+
id: z.string(),
|
|
4198
|
+
alsoKnownAs: z.string().optional(),
|
|
4199
|
+
controller: z.string().or(z.string().array().nonempty()).optional(),
|
|
3534
4200
|
verificationMethod: VerificationMethodValidator.array().optional(),
|
|
3535
4201
|
authentication: VerificationMethodValidator.array().optional(),
|
|
3536
4202
|
assertionMethod: VerificationMethodValidator.array().optional(),
|
|
@@ -3540,8 +4206,8 @@ var DidDocumentValidator = mod.object({
|
|
|
3540
4206
|
publicKey: VerificationMethodValidator.array().optional(),
|
|
3541
4207
|
service: ServiceValidator.array().optional(),
|
|
3542
4208
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3543
|
-
}).catchall(
|
|
3544
|
-
var AlignmentTargetTypeValidator =
|
|
4209
|
+
}).catchall(z.any());
|
|
4210
|
+
var AlignmentTargetTypeValidator = z.enum([
|
|
3545
4211
|
"ceasn:Competency",
|
|
3546
4212
|
"ceterms:Credential",
|
|
3547
4213
|
"CFItem",
|
|
@@ -3549,17 +4215,17 @@ var AlignmentTargetTypeValidator = mod.enum([
|
|
|
3549
4215
|
"CFRubricCriterion",
|
|
3550
4216
|
"CFRubricCriterionLevel",
|
|
3551
4217
|
"CTDL"
|
|
3552
|
-
]).or(
|
|
3553
|
-
var AlignmentValidator =
|
|
3554
|
-
type:
|
|
3555
|
-
targetCode:
|
|
3556
|
-
targetDescription:
|
|
3557
|
-
targetName:
|
|
3558
|
-
targetFramework:
|
|
4218
|
+
]).or(z.string());
|
|
4219
|
+
var AlignmentValidator = z.object({
|
|
4220
|
+
type: z.string().array().nonempty(),
|
|
4221
|
+
targetCode: z.string().optional(),
|
|
4222
|
+
targetDescription: z.string().optional(),
|
|
4223
|
+
targetName: z.string(),
|
|
4224
|
+
targetFramework: z.string().optional(),
|
|
3559
4225
|
targetType: AlignmentTargetTypeValidator.optional(),
|
|
3560
|
-
targetUrl:
|
|
4226
|
+
targetUrl: z.string()
|
|
3561
4227
|
});
|
|
3562
|
-
var KnownAchievementTypeValidator =
|
|
4228
|
+
var KnownAchievementTypeValidator = z.enum([
|
|
3563
4229
|
"Achievement",
|
|
3564
4230
|
"ApprenticeshipCertificate",
|
|
3565
4231
|
"Assessment",
|
|
@@ -3592,23 +4258,23 @@ var KnownAchievementTypeValidator = mod.enum([
|
|
|
3592
4258
|
"ResearchDoctorate",
|
|
3593
4259
|
"SecondarySchoolDiploma"
|
|
3594
4260
|
]);
|
|
3595
|
-
var AchievementTypeValidator = KnownAchievementTypeValidator.or(
|
|
3596
|
-
var CriteriaValidator =
|
|
3597
|
-
var EndorsementSubjectValidator =
|
|
3598
|
-
id:
|
|
3599
|
-
type:
|
|
3600
|
-
endorsementComment:
|
|
4261
|
+
var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
|
|
4262
|
+
var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
|
|
4263
|
+
var EndorsementSubjectValidator = z.object({
|
|
4264
|
+
id: z.string(),
|
|
4265
|
+
type: z.string().array().nonempty(),
|
|
4266
|
+
endorsementComment: z.string().optional()
|
|
3601
4267
|
});
|
|
3602
4268
|
var EndorsementCredentialValidator = UnsignedVCValidator.extend({
|
|
3603
4269
|
credentialSubject: EndorsementSubjectValidator,
|
|
3604
4270
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3605
4271
|
});
|
|
3606
|
-
var RelatedValidator =
|
|
3607
|
-
id:
|
|
3608
|
-
"@language":
|
|
3609
|
-
version:
|
|
4272
|
+
var RelatedValidator = z.object({
|
|
4273
|
+
id: z.string(),
|
|
4274
|
+
"@language": z.string().optional(),
|
|
4275
|
+
version: z.string().optional()
|
|
3610
4276
|
});
|
|
3611
|
-
var ResultTypeValidator =
|
|
4277
|
+
var ResultTypeValidator = z.enum([
|
|
3612
4278
|
"GradePointAverage",
|
|
3613
4279
|
"LetterGrade",
|
|
3614
4280
|
"Percent",
|
|
@@ -3621,59 +4287,59 @@ var ResultTypeValidator = mod.enum([
|
|
|
3621
4287
|
"RubricScore",
|
|
3622
4288
|
"ScaledScore",
|
|
3623
4289
|
"Status"
|
|
3624
|
-
]).or(
|
|
3625
|
-
var RubricCriterionValidator =
|
|
3626
|
-
id:
|
|
3627
|
-
type:
|
|
4290
|
+
]).or(z.string());
|
|
4291
|
+
var RubricCriterionValidator = z.object({
|
|
4292
|
+
id: z.string(),
|
|
4293
|
+
type: z.string().array().nonempty(),
|
|
3628
4294
|
alignment: AlignmentValidator.array().optional(),
|
|
3629
|
-
description:
|
|
3630
|
-
level:
|
|
3631
|
-
name:
|
|
3632
|
-
points:
|
|
3633
|
-
}).catchall(
|
|
3634
|
-
var ResultDescriptionValidator =
|
|
3635
|
-
id:
|
|
3636
|
-
type:
|
|
4295
|
+
description: z.string().optional(),
|
|
4296
|
+
level: z.string().optional(),
|
|
4297
|
+
name: z.string(),
|
|
4298
|
+
points: z.string().optional()
|
|
4299
|
+
}).catchall(z.any());
|
|
4300
|
+
var ResultDescriptionValidator = z.object({
|
|
4301
|
+
id: z.string(),
|
|
4302
|
+
type: z.string().array().nonempty(),
|
|
3637
4303
|
alignment: AlignmentValidator.array().optional(),
|
|
3638
|
-
allowedValue:
|
|
3639
|
-
name:
|
|
3640
|
-
requiredLevel:
|
|
3641
|
-
requiredValue:
|
|
4304
|
+
allowedValue: z.string().array().optional(),
|
|
4305
|
+
name: z.string(),
|
|
4306
|
+
requiredLevel: z.string().optional(),
|
|
4307
|
+
requiredValue: z.string().optional(),
|
|
3642
4308
|
resultType: ResultTypeValidator,
|
|
3643
4309
|
rubricCriterionLevel: RubricCriterionValidator.array().optional(),
|
|
3644
|
-
valueMax:
|
|
3645
|
-
valueMin:
|
|
3646
|
-
}).catchall(
|
|
3647
|
-
var AchievementValidator =
|
|
3648
|
-
id:
|
|
3649
|
-
type:
|
|
4310
|
+
valueMax: z.string().optional(),
|
|
4311
|
+
valueMin: z.string().optional()
|
|
4312
|
+
}).catchall(z.any());
|
|
4313
|
+
var AchievementValidator = z.object({
|
|
4314
|
+
id: z.string().optional(),
|
|
4315
|
+
type: z.string().array().nonempty(),
|
|
3650
4316
|
alignment: AlignmentValidator.array().optional(),
|
|
3651
4317
|
achievementType: AchievementTypeValidator.optional(),
|
|
3652
4318
|
creator: ProfileValidator.optional(),
|
|
3653
|
-
creditsAvailable:
|
|
4319
|
+
creditsAvailable: z.number().optional(),
|
|
3654
4320
|
criteria: CriteriaValidator,
|
|
3655
|
-
description:
|
|
4321
|
+
description: z.string(),
|
|
3656
4322
|
endorsement: EndorsementCredentialValidator.array().optional(),
|
|
3657
|
-
fieldOfStudy:
|
|
3658
|
-
humanCode:
|
|
4323
|
+
fieldOfStudy: z.string().optional(),
|
|
4324
|
+
humanCode: z.string().optional(),
|
|
3659
4325
|
image: ImageValidator.optional(),
|
|
3660
|
-
"@language":
|
|
3661
|
-
name:
|
|
4326
|
+
"@language": z.string().optional(),
|
|
4327
|
+
name: z.string(),
|
|
3662
4328
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3663
4329
|
related: RelatedValidator.array().optional(),
|
|
3664
4330
|
resultDescription: ResultDescriptionValidator.array().optional(),
|
|
3665
|
-
specialization:
|
|
3666
|
-
tag:
|
|
3667
|
-
version:
|
|
3668
|
-
}).catchall(
|
|
3669
|
-
var IdentityObjectValidator =
|
|
3670
|
-
type:
|
|
3671
|
-
hashed:
|
|
3672
|
-
identityHash:
|
|
3673
|
-
identityType:
|
|
3674
|
-
salt:
|
|
4331
|
+
specialization: z.string().optional(),
|
|
4332
|
+
tag: z.string().array().optional(),
|
|
4333
|
+
version: z.string().optional()
|
|
4334
|
+
}).catchall(z.any());
|
|
4335
|
+
var IdentityObjectValidator = z.object({
|
|
4336
|
+
type: z.string(),
|
|
4337
|
+
hashed: z.boolean(),
|
|
4338
|
+
identityHash: z.string(),
|
|
4339
|
+
identityType: z.string(),
|
|
4340
|
+
salt: z.string().optional()
|
|
3675
4341
|
});
|
|
3676
|
-
var ResultStatusTypeValidator =
|
|
4342
|
+
var ResultStatusTypeValidator = z.enum([
|
|
3677
4343
|
"Completed",
|
|
3678
4344
|
"Enrolled",
|
|
3679
4345
|
"Failed",
|
|
@@ -3681,42 +4347,42 @@ var ResultStatusTypeValidator = mod.enum([
|
|
|
3681
4347
|
"OnHold",
|
|
3682
4348
|
"Withdrew"
|
|
3683
4349
|
]);
|
|
3684
|
-
var ResultValidator =
|
|
3685
|
-
type:
|
|
3686
|
-
achievedLevel:
|
|
4350
|
+
var ResultValidator = z.object({
|
|
4351
|
+
type: z.string().array().nonempty(),
|
|
4352
|
+
achievedLevel: z.string().optional(),
|
|
3687
4353
|
alignment: AlignmentValidator.array().optional(),
|
|
3688
|
-
resultDescription:
|
|
4354
|
+
resultDescription: z.string().optional(),
|
|
3689
4355
|
status: ResultStatusTypeValidator.optional(),
|
|
3690
|
-
value:
|
|
3691
|
-
}).catchall(
|
|
3692
|
-
var AchievementSubjectValidator =
|
|
3693
|
-
id:
|
|
3694
|
-
type:
|
|
3695
|
-
activityEndDate:
|
|
3696
|
-
activityStartDate:
|
|
3697
|
-
creditsEarned:
|
|
4356
|
+
value: z.string().optional()
|
|
4357
|
+
}).catchall(z.any());
|
|
4358
|
+
var AchievementSubjectValidator = z.object({
|
|
4359
|
+
id: z.string().optional(),
|
|
4360
|
+
type: z.string().array().nonempty(),
|
|
4361
|
+
activityEndDate: z.string().optional(),
|
|
4362
|
+
activityStartDate: z.string().optional(),
|
|
4363
|
+
creditsEarned: z.number().optional(),
|
|
3698
4364
|
achievement: AchievementValidator.optional(),
|
|
3699
4365
|
identifier: IdentityObjectValidator.array().optional(),
|
|
3700
4366
|
image: ImageValidator.optional(),
|
|
3701
|
-
licenseNumber:
|
|
3702
|
-
narrative:
|
|
4367
|
+
licenseNumber: z.string().optional(),
|
|
4368
|
+
narrative: z.string().optional(),
|
|
3703
4369
|
result: ResultValidator.array().optional(),
|
|
3704
|
-
role:
|
|
4370
|
+
role: z.string().optional(),
|
|
3705
4371
|
source: ProfileValidator.optional(),
|
|
3706
|
-
term:
|
|
3707
|
-
}).catchall(
|
|
3708
|
-
var EvidenceValidator =
|
|
3709
|
-
id:
|
|
3710
|
-
type:
|
|
3711
|
-
narrative:
|
|
3712
|
-
name:
|
|
3713
|
-
description:
|
|
3714
|
-
genre:
|
|
3715
|
-
audience:
|
|
3716
|
-
}).catchall(
|
|
4372
|
+
term: z.string().optional()
|
|
4373
|
+
}).catchall(z.any());
|
|
4374
|
+
var EvidenceValidator = z.object({
|
|
4375
|
+
id: z.string().optional(),
|
|
4376
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4377
|
+
narrative: z.string().optional(),
|
|
4378
|
+
name: z.string().optional(),
|
|
4379
|
+
description: z.string().optional(),
|
|
4380
|
+
genre: z.string().optional(),
|
|
4381
|
+
audience: z.string().optional()
|
|
4382
|
+
}).catchall(z.any());
|
|
3717
4383
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
3718
|
-
name:
|
|
3719
|
-
description:
|
|
4384
|
+
name: z.string().optional(),
|
|
4385
|
+
description: z.string().optional(),
|
|
3720
4386
|
image: ImageValidator.optional(),
|
|
3721
4387
|
credentialSubject: AchievementSubjectValidator.or(
|
|
3722
4388
|
AchievementSubjectValidator.array()
|
|
@@ -3727,42 +4393,42 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
|
3727
4393
|
var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
|
|
3728
4394
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3729
4395
|
});
|
|
3730
|
-
var VerificationCheckValidator =
|
|
3731
|
-
checks:
|
|
3732
|
-
warnings:
|
|
3733
|
-
errors:
|
|
4396
|
+
var VerificationCheckValidator = z.object({
|
|
4397
|
+
checks: z.string().array(),
|
|
4398
|
+
warnings: z.string().array(),
|
|
4399
|
+
errors: z.string().array()
|
|
3734
4400
|
});
|
|
3735
|
-
var VerificationStatusValidator =
|
|
4401
|
+
var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
|
|
3736
4402
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
|
3737
|
-
var VerificationItemValidator =
|
|
3738
|
-
check:
|
|
4403
|
+
var VerificationItemValidator = z.object({
|
|
4404
|
+
check: z.string(),
|
|
3739
4405
|
status: VerificationStatusValidator,
|
|
3740
|
-
message:
|
|
3741
|
-
details:
|
|
4406
|
+
message: z.string().optional(),
|
|
4407
|
+
details: z.string().optional()
|
|
3742
4408
|
});
|
|
3743
|
-
var CredentialInfoValidator =
|
|
3744
|
-
title:
|
|
3745
|
-
createdAt:
|
|
4409
|
+
var CredentialInfoValidator = z.object({
|
|
4410
|
+
title: z.string().optional(),
|
|
4411
|
+
createdAt: z.string().optional(),
|
|
3746
4412
|
issuer: ProfileValidator.optional(),
|
|
3747
4413
|
issuee: ProfileValidator.optional(),
|
|
3748
4414
|
credentialSubject: CredentialSubjectValidator.optional()
|
|
3749
4415
|
});
|
|
3750
|
-
var CredentialRecordValidator =
|
|
3751
|
-
var PaginationOptionsValidator =
|
|
3752
|
-
limit:
|
|
3753
|
-
cursor:
|
|
3754
|
-
sort:
|
|
4416
|
+
var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
|
|
4417
|
+
var PaginationOptionsValidator = z.object({
|
|
4418
|
+
limit: z.number(),
|
|
4419
|
+
cursor: z.string().optional(),
|
|
4420
|
+
sort: z.string().optional()
|
|
3755
4421
|
});
|
|
3756
|
-
var PaginationResponseValidator =
|
|
3757
|
-
cursor:
|
|
3758
|
-
hasMore:
|
|
4422
|
+
var PaginationResponseValidator = z.object({
|
|
4423
|
+
cursor: z.string().optional(),
|
|
4424
|
+
hasMore: z.boolean()
|
|
3759
4425
|
});
|
|
3760
|
-
var EncryptedRecordValidator =
|
|
4426
|
+
var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator, fields: z.string().array() }).catchall(z.any());
|
|
3761
4427
|
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
|
3762
4428
|
records: EncryptedRecordValidator.array()
|
|
3763
4429
|
});
|
|
3764
4430
|
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
3765
|
-
id:
|
|
4431
|
+
id: z.string()
|
|
3766
4432
|
});
|
|
3767
4433
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
3768
4434
|
records: EncryptedCredentialRecordValidator.array()
|
|
@@ -3773,8 +4439,8 @@ var parseRegexString = /* @__PURE__ */ __name2((regexStr) => {
|
|
|
3773
4439
|
throw new Error("Invalid RegExp string format");
|
|
3774
4440
|
return { pattern: match2[1], flags: match2[2] };
|
|
3775
4441
|
}, "parseRegexString");
|
|
3776
|
-
var RegExpValidator =
|
|
3777
|
-
|
|
4442
|
+
var RegExpValidator = z.instanceof(RegExp).or(
|
|
4443
|
+
z.string().refine(
|
|
3778
4444
|
(str) => {
|
|
3779
4445
|
try {
|
|
3780
4446
|
parseRegexString(str);
|
|
@@ -3795,71 +4461,71 @@ var RegExpValidator = mod.instanceof(RegExp).or(
|
|
|
3795
4461
|
}
|
|
3796
4462
|
})
|
|
3797
4463
|
);
|
|
3798
|
-
var StringQuery =
|
|
3799
|
-
var LCNProfileDisplayValidator =
|
|
3800
|
-
backgroundColor:
|
|
3801
|
-
backgroundImage:
|
|
3802
|
-
fadeBackgroundImage:
|
|
3803
|
-
repeatBackgroundImage:
|
|
3804
|
-
fontColor:
|
|
3805
|
-
accentColor:
|
|
3806
|
-
accentFontColor:
|
|
3807
|
-
idBackgroundImage:
|
|
3808
|
-
fadeIdBackgroundImage:
|
|
3809
|
-
idBackgroundColor:
|
|
3810
|
-
repeatIdBackgroundImage:
|
|
4464
|
+
var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
|
|
4465
|
+
var LCNProfileDisplayValidator = z.object({
|
|
4466
|
+
backgroundColor: z.string().optional(),
|
|
4467
|
+
backgroundImage: z.string().optional(),
|
|
4468
|
+
fadeBackgroundImage: z.boolean().optional(),
|
|
4469
|
+
repeatBackgroundImage: z.boolean().optional(),
|
|
4470
|
+
fontColor: z.string().optional(),
|
|
4471
|
+
accentColor: z.string().optional(),
|
|
4472
|
+
accentFontColor: z.string().optional(),
|
|
4473
|
+
idBackgroundImage: z.string().optional(),
|
|
4474
|
+
fadeIdBackgroundImage: z.boolean().optional(),
|
|
4475
|
+
idBackgroundColor: z.string().optional(),
|
|
4476
|
+
repeatIdBackgroundImage: z.boolean().optional()
|
|
3811
4477
|
});
|
|
3812
|
-
var LCNProfileValidator =
|
|
3813
|
-
profileId:
|
|
3814
|
-
displayName:
|
|
3815
|
-
shortBio:
|
|
3816
|
-
bio:
|
|
3817
|
-
did:
|
|
3818
|
-
isPrivate:
|
|
3819
|
-
email:
|
|
3820
|
-
image:
|
|
3821
|
-
heroImage:
|
|
3822
|
-
websiteLink:
|
|
3823
|
-
isServiceProfile:
|
|
3824
|
-
type:
|
|
3825
|
-
notificationsWebhook:
|
|
4478
|
+
var LCNProfileValidator = z.object({
|
|
4479
|
+
profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
|
4480
|
+
displayName: z.string().default("").describe("Human-readable display name for the profile."),
|
|
4481
|
+
shortBio: z.string().default("").describe("Short bio for the profile."),
|
|
4482
|
+
bio: z.string().default("").describe("Longer bio for the profile."),
|
|
4483
|
+
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
|
4484
|
+
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
|
4485
|
+
email: z.string().optional().describe("Contact email address for the profile."),
|
|
4486
|
+
image: z.string().optional().describe("Profile image URL for the profile."),
|
|
4487
|
+
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
|
4488
|
+
websiteLink: z.string().optional().describe("Website link for the profile."),
|
|
4489
|
+
isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
|
|
4490
|
+
type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
|
|
4491
|
+
notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
|
|
3826
4492
|
display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
|
|
3827
|
-
role:
|
|
3828
|
-
dob:
|
|
4493
|
+
role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
|
4494
|
+
dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
|
|
3829
4495
|
});
|
|
3830
|
-
var LCNProfileQueryValidator =
|
|
4496
|
+
var LCNProfileQueryValidator = z.object({
|
|
3831
4497
|
profileId: StringQuery,
|
|
3832
4498
|
displayName: StringQuery,
|
|
3833
4499
|
shortBio: StringQuery,
|
|
3834
4500
|
bio: StringQuery,
|
|
3835
4501
|
email: StringQuery,
|
|
3836
4502
|
websiteLink: StringQuery,
|
|
3837
|
-
isServiceProfile:
|
|
4503
|
+
isServiceProfile: z.boolean(),
|
|
3838
4504
|
type: StringQuery
|
|
3839
4505
|
}).partial();
|
|
3840
4506
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
3841
4507
|
records: LCNProfileValidator.array()
|
|
3842
4508
|
});
|
|
3843
|
-
var LCNProfileConnectionStatusEnum =
|
|
4509
|
+
var LCNProfileConnectionStatusEnum = z.enum([
|
|
3844
4510
|
"CONNECTED",
|
|
3845
4511
|
"PENDING_REQUEST_SENT",
|
|
3846
4512
|
"PENDING_REQUEST_RECEIVED",
|
|
3847
4513
|
"NOT_CONNECTED"
|
|
3848
4514
|
]);
|
|
3849
|
-
var LCNProfileManagerValidator =
|
|
3850
|
-
id:
|
|
3851
|
-
created:
|
|
3852
|
-
displayName:
|
|
3853
|
-
shortBio:
|
|
3854
|
-
bio:
|
|
3855
|
-
email:
|
|
3856
|
-
image:
|
|
3857
|
-
heroImage:
|
|
4515
|
+
var LCNProfileManagerValidator = z.object({
|
|
4516
|
+
id: z.string(),
|
|
4517
|
+
created: z.string(),
|
|
4518
|
+
displayName: z.string().default("").optional(),
|
|
4519
|
+
shortBio: z.string().default("").optional(),
|
|
4520
|
+
bio: z.string().default("").optional(),
|
|
4521
|
+
email: z.string().optional(),
|
|
4522
|
+
image: z.string().optional(),
|
|
4523
|
+
heroImage: z.string().optional()
|
|
3858
4524
|
});
|
|
3859
4525
|
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
|
3860
|
-
records: LCNProfileManagerValidator.extend({ did:
|
|
4526
|
+
records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
|
|
3861
4527
|
});
|
|
3862
|
-
var LCNProfileManagerQueryValidator =
|
|
4528
|
+
var LCNProfileManagerQueryValidator = z.object({
|
|
3863
4529
|
id: StringQuery,
|
|
3864
4530
|
displayName: StringQuery,
|
|
3865
4531
|
shortBio: StringQuery,
|
|
@@ -3867,296 +4533,296 @@ var LCNProfileManagerQueryValidator = mod.object({
|
|
|
3867
4533
|
email: StringQuery
|
|
3868
4534
|
}).partial();
|
|
3869
4535
|
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
|
3870
|
-
records:
|
|
4536
|
+
records: z.object({
|
|
3871
4537
|
profile: LCNProfileValidator,
|
|
3872
|
-
manager: LCNProfileManagerValidator.extend({ did:
|
|
4538
|
+
manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
|
|
3873
4539
|
}).array()
|
|
3874
4540
|
});
|
|
3875
|
-
var SentCredentialInfoValidator =
|
|
3876
|
-
uri:
|
|
3877
|
-
to:
|
|
3878
|
-
from:
|
|
3879
|
-
sent:
|
|
3880
|
-
received:
|
|
4541
|
+
var SentCredentialInfoValidator = z.object({
|
|
4542
|
+
uri: z.string(),
|
|
4543
|
+
to: z.string(),
|
|
4544
|
+
from: z.string(),
|
|
4545
|
+
sent: z.string().datetime(),
|
|
4546
|
+
received: z.string().datetime().optional()
|
|
3881
4547
|
});
|
|
3882
|
-
var BoostPermissionsValidator =
|
|
3883
|
-
role:
|
|
3884
|
-
canEdit:
|
|
3885
|
-
canIssue:
|
|
3886
|
-
canRevoke:
|
|
3887
|
-
canManagePermissions:
|
|
3888
|
-
canIssueChildren:
|
|
3889
|
-
canCreateChildren:
|
|
3890
|
-
canEditChildren:
|
|
3891
|
-
canRevokeChildren:
|
|
3892
|
-
canManageChildrenPermissions:
|
|
3893
|
-
canManageChildrenProfiles:
|
|
3894
|
-
canViewAnalytics:
|
|
4548
|
+
var BoostPermissionsValidator = z.object({
|
|
4549
|
+
role: z.string(),
|
|
4550
|
+
canEdit: z.boolean(),
|
|
4551
|
+
canIssue: z.boolean(),
|
|
4552
|
+
canRevoke: z.boolean(),
|
|
4553
|
+
canManagePermissions: z.boolean(),
|
|
4554
|
+
canIssueChildren: z.string(),
|
|
4555
|
+
canCreateChildren: z.string(),
|
|
4556
|
+
canEditChildren: z.string(),
|
|
4557
|
+
canRevokeChildren: z.string(),
|
|
4558
|
+
canManageChildrenPermissions: z.string(),
|
|
4559
|
+
canManageChildrenProfiles: z.boolean().default(false).optional(),
|
|
4560
|
+
canViewAnalytics: z.boolean()
|
|
3895
4561
|
});
|
|
3896
|
-
var BoostPermissionsQueryValidator =
|
|
4562
|
+
var BoostPermissionsQueryValidator = z.object({
|
|
3897
4563
|
role: StringQuery,
|
|
3898
|
-
canEdit:
|
|
3899
|
-
canIssue:
|
|
3900
|
-
canRevoke:
|
|
3901
|
-
canManagePermissions:
|
|
4564
|
+
canEdit: z.boolean(),
|
|
4565
|
+
canIssue: z.boolean(),
|
|
4566
|
+
canRevoke: z.boolean(),
|
|
4567
|
+
canManagePermissions: z.boolean(),
|
|
3902
4568
|
canIssueChildren: StringQuery,
|
|
3903
4569
|
canCreateChildren: StringQuery,
|
|
3904
4570
|
canEditChildren: StringQuery,
|
|
3905
4571
|
canRevokeChildren: StringQuery,
|
|
3906
4572
|
canManageChildrenPermissions: StringQuery,
|
|
3907
|
-
canManageChildrenProfiles:
|
|
3908
|
-
canViewAnalytics:
|
|
4573
|
+
canManageChildrenProfiles: z.boolean(),
|
|
4574
|
+
canViewAnalytics: z.boolean()
|
|
3909
4575
|
}).partial();
|
|
3910
|
-
var ClaimHookTypeValidator =
|
|
3911
|
-
var ClaimHookValidator =
|
|
3912
|
-
|
|
3913
|
-
type:
|
|
3914
|
-
data:
|
|
3915
|
-
claimUri:
|
|
3916
|
-
targetUri:
|
|
4576
|
+
var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
|
|
4577
|
+
var ClaimHookValidator = z.discriminatedUnion("type", [
|
|
4578
|
+
z.object({
|
|
4579
|
+
type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
|
|
4580
|
+
data: z.object({
|
|
4581
|
+
claimUri: z.string(),
|
|
4582
|
+
targetUri: z.string(),
|
|
3917
4583
|
permissions: BoostPermissionsValidator.partial()
|
|
3918
4584
|
})
|
|
3919
4585
|
}),
|
|
3920
|
-
|
|
3921
|
-
type:
|
|
3922
|
-
data:
|
|
4586
|
+
z.object({
|
|
4587
|
+
type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
|
|
4588
|
+
data: z.object({ claimUri: z.string(), targetUri: z.string() })
|
|
3923
4589
|
})
|
|
3924
4590
|
]);
|
|
3925
|
-
var ClaimHookQueryValidator =
|
|
4591
|
+
var ClaimHookQueryValidator = z.object({
|
|
3926
4592
|
type: StringQuery,
|
|
3927
|
-
data:
|
|
4593
|
+
data: z.object({
|
|
3928
4594
|
claimUri: StringQuery,
|
|
3929
4595
|
targetUri: StringQuery,
|
|
3930
4596
|
permissions: BoostPermissionsQueryValidator
|
|
3931
4597
|
})
|
|
3932
4598
|
}).deepPartial();
|
|
3933
|
-
var FullClaimHookValidator =
|
|
4599
|
+
var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
|
|
3934
4600
|
var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
|
|
3935
4601
|
records: FullClaimHookValidator.array()
|
|
3936
4602
|
});
|
|
3937
|
-
var LCNBoostStatus =
|
|
3938
|
-
var BoostValidator =
|
|
3939
|
-
uri:
|
|
3940
|
-
name:
|
|
3941
|
-
type:
|
|
3942
|
-
category:
|
|
4603
|
+
var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
|
|
4604
|
+
var BoostValidator = z.object({
|
|
4605
|
+
uri: z.string(),
|
|
4606
|
+
name: z.string().optional(),
|
|
4607
|
+
type: z.string().optional(),
|
|
4608
|
+
category: z.string().optional(),
|
|
3943
4609
|
status: LCNBoostStatus.optional(),
|
|
3944
|
-
autoConnectRecipients:
|
|
3945
|
-
meta:
|
|
4610
|
+
autoConnectRecipients: z.boolean().optional(),
|
|
4611
|
+
meta: z.record(z.any()).optional(),
|
|
3946
4612
|
claimPermissions: BoostPermissionsValidator.optional()
|
|
3947
4613
|
});
|
|
3948
|
-
var BoostQueryValidator =
|
|
4614
|
+
var BoostQueryValidator = z.object({
|
|
3949
4615
|
uri: StringQuery,
|
|
3950
4616
|
name: StringQuery,
|
|
3951
4617
|
type: StringQuery,
|
|
3952
4618
|
category: StringQuery,
|
|
3953
|
-
meta:
|
|
3954
|
-
status: LCNBoostStatus.or(
|
|
3955
|
-
autoConnectRecipients:
|
|
4619
|
+
meta: z.record(StringQuery),
|
|
4620
|
+
status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
|
|
4621
|
+
autoConnectRecipients: z.boolean()
|
|
3956
4622
|
}).partial();
|
|
3957
4623
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
|
3958
4624
|
records: BoostValidator.array()
|
|
3959
4625
|
});
|
|
3960
|
-
var BoostRecipientValidator =
|
|
4626
|
+
var BoostRecipientValidator = z.object({
|
|
3961
4627
|
to: LCNProfileValidator,
|
|
3962
|
-
from:
|
|
3963
|
-
received:
|
|
3964
|
-
uri:
|
|
4628
|
+
from: z.string(),
|
|
4629
|
+
received: z.string().optional(),
|
|
4630
|
+
uri: z.string().optional()
|
|
3965
4631
|
});
|
|
3966
4632
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
3967
4633
|
records: BoostRecipientValidator.array()
|
|
3968
4634
|
});
|
|
3969
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
|
3970
|
-
endpoint:
|
|
3971
|
-
name:
|
|
3972
|
-
did:
|
|
4635
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
|
|
4636
|
+
endpoint: z.string(),
|
|
4637
|
+
name: z.string(),
|
|
4638
|
+
did: z.string().optional()
|
|
3973
4639
|
});
|
|
3974
|
-
var LCNBoostClaimLinkOptionsValidator =
|
|
3975
|
-
ttlSeconds:
|
|
3976
|
-
totalUses:
|
|
4640
|
+
var LCNBoostClaimLinkOptionsValidator = z.object({
|
|
4641
|
+
ttlSeconds: z.number().optional(),
|
|
4642
|
+
totalUses: z.number().optional()
|
|
3977
4643
|
});
|
|
3978
|
-
var LCNSigningAuthorityValidator =
|
|
3979
|
-
endpoint:
|
|
4644
|
+
var LCNSigningAuthorityValidator = z.object({
|
|
4645
|
+
endpoint: z.string()
|
|
3980
4646
|
});
|
|
3981
|
-
var LCNSigningAuthorityForUserValidator =
|
|
4647
|
+
var LCNSigningAuthorityForUserValidator = z.object({
|
|
3982
4648
|
signingAuthority: LCNSigningAuthorityValidator,
|
|
3983
|
-
relationship:
|
|
3984
|
-
name:
|
|
4649
|
+
relationship: z.object({
|
|
4650
|
+
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
|
3985
4651
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
|
3986
4652
|
}),
|
|
3987
|
-
did:
|
|
4653
|
+
did: z.string()
|
|
3988
4654
|
})
|
|
3989
4655
|
});
|
|
3990
|
-
var AutoBoostConfigValidator =
|
|
3991
|
-
boostUri:
|
|
3992
|
-
signingAuthority:
|
|
3993
|
-
endpoint:
|
|
3994
|
-
name:
|
|
4656
|
+
var AutoBoostConfigValidator = z.object({
|
|
4657
|
+
boostUri: z.string(),
|
|
4658
|
+
signingAuthority: z.object({
|
|
4659
|
+
endpoint: z.string(),
|
|
4660
|
+
name: z.string()
|
|
3995
4661
|
})
|
|
3996
4662
|
});
|
|
3997
|
-
var ConsentFlowTermsStatusValidator =
|
|
3998
|
-
var ConsentFlowContractValidator =
|
|
3999
|
-
read:
|
|
4000
|
-
anonymize:
|
|
4001
|
-
credentials:
|
|
4002
|
-
personal:
|
|
4663
|
+
var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
|
|
4664
|
+
var ConsentFlowContractValidator = z.object({
|
|
4665
|
+
read: z.object({
|
|
4666
|
+
anonymize: z.boolean().optional(),
|
|
4667
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4668
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
4003
4669
|
}).default({}),
|
|
4004
|
-
write:
|
|
4005
|
-
credentials:
|
|
4006
|
-
personal:
|
|
4670
|
+
write: z.object({
|
|
4671
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4672
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
4007
4673
|
}).default({})
|
|
4008
4674
|
});
|
|
4009
|
-
var ConsentFlowContractDetailsValidator =
|
|
4675
|
+
var ConsentFlowContractDetailsValidator = z.object({
|
|
4010
4676
|
contract: ConsentFlowContractValidator,
|
|
4011
4677
|
owner: LCNProfileValidator,
|
|
4012
|
-
name:
|
|
4013
|
-
subtitle:
|
|
4014
|
-
description:
|
|
4015
|
-
reasonForAccessing:
|
|
4016
|
-
image:
|
|
4017
|
-
uri:
|
|
4018
|
-
needsGuardianConsent:
|
|
4019
|
-
redirectUrl:
|
|
4020
|
-
frontDoorBoostUri:
|
|
4021
|
-
createdAt:
|
|
4022
|
-
updatedAt:
|
|
4023
|
-
expiresAt:
|
|
4024
|
-
autoBoosts:
|
|
4025
|
-
writers:
|
|
4678
|
+
name: z.string(),
|
|
4679
|
+
subtitle: z.string().optional(),
|
|
4680
|
+
description: z.string().optional(),
|
|
4681
|
+
reasonForAccessing: z.string().optional(),
|
|
4682
|
+
image: z.string().optional(),
|
|
4683
|
+
uri: z.string(),
|
|
4684
|
+
needsGuardianConsent: z.boolean().optional(),
|
|
4685
|
+
redirectUrl: z.string().optional(),
|
|
4686
|
+
frontDoorBoostUri: z.string().optional(),
|
|
4687
|
+
createdAt: z.string(),
|
|
4688
|
+
updatedAt: z.string(),
|
|
4689
|
+
expiresAt: z.string().optional(),
|
|
4690
|
+
autoBoosts: z.string().array().optional(),
|
|
4691
|
+
writers: z.array(LCNProfileValidator).optional()
|
|
4026
4692
|
});
|
|
4027
4693
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
|
4028
4694
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
|
4029
4695
|
});
|
|
4030
|
-
var ConsentFlowContractDataValidator =
|
|
4031
|
-
credentials:
|
|
4032
|
-
personal:
|
|
4033
|
-
date:
|
|
4696
|
+
var ConsentFlowContractDataValidator = z.object({
|
|
4697
|
+
credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
|
|
4698
|
+
personal: z.record(z.string()).default({}),
|
|
4699
|
+
date: z.string()
|
|
4034
4700
|
});
|
|
4035
4701
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
4036
4702
|
records: ConsentFlowContractDataValidator.array()
|
|
4037
4703
|
});
|
|
4038
|
-
var ConsentFlowContractDataForDidValidator =
|
|
4039
|
-
credentials:
|
|
4040
|
-
personal:
|
|
4041
|
-
date:
|
|
4042
|
-
contractUri:
|
|
4704
|
+
var ConsentFlowContractDataForDidValidator = z.object({
|
|
4705
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
|
4706
|
+
personal: z.record(z.string()).default({}),
|
|
4707
|
+
date: z.string(),
|
|
4708
|
+
contractUri: z.string()
|
|
4043
4709
|
});
|
|
4044
4710
|
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
4045
4711
|
records: ConsentFlowContractDataForDidValidator.array()
|
|
4046
4712
|
});
|
|
4047
|
-
var ConsentFlowTermValidator =
|
|
4048
|
-
sharing:
|
|
4049
|
-
shared:
|
|
4050
|
-
shareAll:
|
|
4051
|
-
shareUntil:
|
|
4713
|
+
var ConsentFlowTermValidator = z.object({
|
|
4714
|
+
sharing: z.boolean().optional(),
|
|
4715
|
+
shared: z.string().array().optional(),
|
|
4716
|
+
shareAll: z.boolean().optional(),
|
|
4717
|
+
shareUntil: z.string().optional()
|
|
4052
4718
|
});
|
|
4053
|
-
var ConsentFlowTermsValidator =
|
|
4054
|
-
read:
|
|
4055
|
-
anonymize:
|
|
4056
|
-
credentials:
|
|
4057
|
-
shareAll:
|
|
4058
|
-
sharing:
|
|
4059
|
-
categories:
|
|
4719
|
+
var ConsentFlowTermsValidator = z.object({
|
|
4720
|
+
read: z.object({
|
|
4721
|
+
anonymize: z.boolean().optional(),
|
|
4722
|
+
credentials: z.object({
|
|
4723
|
+
shareAll: z.boolean().optional(),
|
|
4724
|
+
sharing: z.boolean().optional(),
|
|
4725
|
+
categories: z.record(ConsentFlowTermValidator).default({})
|
|
4060
4726
|
}).default({}),
|
|
4061
|
-
personal:
|
|
4727
|
+
personal: z.record(z.string()).default({})
|
|
4062
4728
|
}).default({}),
|
|
4063
|
-
write:
|
|
4064
|
-
credentials:
|
|
4065
|
-
personal:
|
|
4729
|
+
write: z.object({
|
|
4730
|
+
credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
|
|
4731
|
+
personal: z.record(z.boolean()).default({})
|
|
4066
4732
|
}).default({}),
|
|
4067
|
-
deniedWriters:
|
|
4733
|
+
deniedWriters: z.array(z.string()).optional()
|
|
4068
4734
|
});
|
|
4069
4735
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
4070
|
-
records:
|
|
4071
|
-
expiresAt:
|
|
4072
|
-
oneTime:
|
|
4736
|
+
records: z.object({
|
|
4737
|
+
expiresAt: z.string().optional(),
|
|
4738
|
+
oneTime: z.boolean().optional(),
|
|
4073
4739
|
terms: ConsentFlowTermsValidator,
|
|
4074
4740
|
contract: ConsentFlowContractDetailsValidator,
|
|
4075
|
-
uri:
|
|
4741
|
+
uri: z.string(),
|
|
4076
4742
|
consenter: LCNProfileValidator,
|
|
4077
4743
|
status: ConsentFlowTermsStatusValidator
|
|
4078
4744
|
}).array()
|
|
4079
4745
|
});
|
|
4080
|
-
var ConsentFlowContractQueryValidator =
|
|
4081
|
-
read:
|
|
4082
|
-
anonymize:
|
|
4083
|
-
credentials:
|
|
4084
|
-
categories:
|
|
4746
|
+
var ConsentFlowContractQueryValidator = z.object({
|
|
4747
|
+
read: z.object({
|
|
4748
|
+
anonymize: z.boolean().optional(),
|
|
4749
|
+
credentials: z.object({
|
|
4750
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4085
4751
|
}).optional(),
|
|
4086
|
-
personal:
|
|
4752
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4087
4753
|
}).optional(),
|
|
4088
|
-
write:
|
|
4089
|
-
credentials:
|
|
4090
|
-
categories:
|
|
4754
|
+
write: z.object({
|
|
4755
|
+
credentials: z.object({
|
|
4756
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4091
4757
|
}).optional(),
|
|
4092
|
-
personal:
|
|
4758
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4093
4759
|
}).optional()
|
|
4094
4760
|
});
|
|
4095
|
-
var ConsentFlowDataQueryValidator =
|
|
4096
|
-
anonymize:
|
|
4097
|
-
credentials:
|
|
4098
|
-
personal:
|
|
4761
|
+
var ConsentFlowDataQueryValidator = z.object({
|
|
4762
|
+
anonymize: z.boolean().optional(),
|
|
4763
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4764
|
+
personal: z.record(z.boolean()).optional()
|
|
4099
4765
|
});
|
|
4100
|
-
var ConsentFlowDataForDidQueryValidator =
|
|
4101
|
-
credentials:
|
|
4102
|
-
personal:
|
|
4766
|
+
var ConsentFlowDataForDidQueryValidator = z.object({
|
|
4767
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4768
|
+
personal: z.record(z.boolean()).optional(),
|
|
4103
4769
|
id: StringQuery.optional()
|
|
4104
4770
|
});
|
|
4105
|
-
var ConsentFlowTermsQueryValidator =
|
|
4106
|
-
read:
|
|
4107
|
-
anonymize:
|
|
4108
|
-
credentials:
|
|
4109
|
-
shareAll:
|
|
4110
|
-
sharing:
|
|
4111
|
-
categories:
|
|
4771
|
+
var ConsentFlowTermsQueryValidator = z.object({
|
|
4772
|
+
read: z.object({
|
|
4773
|
+
anonymize: z.boolean().optional(),
|
|
4774
|
+
credentials: z.object({
|
|
4775
|
+
shareAll: z.boolean().optional(),
|
|
4776
|
+
sharing: z.boolean().optional(),
|
|
4777
|
+
categories: z.record(ConsentFlowTermValidator.optional()).optional()
|
|
4112
4778
|
}).optional(),
|
|
4113
|
-
personal:
|
|
4779
|
+
personal: z.record(z.string()).optional()
|
|
4114
4780
|
}).optional(),
|
|
4115
|
-
write:
|
|
4116
|
-
credentials:
|
|
4117
|
-
personal:
|
|
4781
|
+
write: z.object({
|
|
4782
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4783
|
+
personal: z.record(z.boolean()).optional()
|
|
4118
4784
|
}).optional()
|
|
4119
4785
|
});
|
|
4120
|
-
var ConsentFlowTransactionActionValidator =
|
|
4786
|
+
var ConsentFlowTransactionActionValidator = z.enum([
|
|
4121
4787
|
"consent",
|
|
4122
4788
|
"update",
|
|
4123
4789
|
"sync",
|
|
4124
4790
|
"withdraw",
|
|
4125
4791
|
"write"
|
|
4126
4792
|
]);
|
|
4127
|
-
var ConsentFlowTransactionsQueryValidator =
|
|
4793
|
+
var ConsentFlowTransactionsQueryValidator = z.object({
|
|
4128
4794
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
|
4129
4795
|
action: ConsentFlowTransactionActionValidator.or(
|
|
4130
4796
|
ConsentFlowTransactionActionValidator.array()
|
|
4131
4797
|
).optional(),
|
|
4132
|
-
date:
|
|
4133
|
-
expiresAt:
|
|
4134
|
-
oneTime:
|
|
4798
|
+
date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
4799
|
+
expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
4800
|
+
oneTime: z.boolean().optional()
|
|
4135
4801
|
});
|
|
4136
|
-
var ConsentFlowTransactionValidator =
|
|
4137
|
-
expiresAt:
|
|
4138
|
-
oneTime:
|
|
4802
|
+
var ConsentFlowTransactionValidator = z.object({
|
|
4803
|
+
expiresAt: z.string().optional(),
|
|
4804
|
+
oneTime: z.boolean().optional(),
|
|
4139
4805
|
terms: ConsentFlowTermsValidator.optional(),
|
|
4140
|
-
id:
|
|
4806
|
+
id: z.string(),
|
|
4141
4807
|
action: ConsentFlowTransactionActionValidator,
|
|
4142
|
-
date:
|
|
4143
|
-
uris:
|
|
4808
|
+
date: z.string(),
|
|
4809
|
+
uris: z.string().array().optional()
|
|
4144
4810
|
});
|
|
4145
4811
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
|
4146
4812
|
records: ConsentFlowTransactionValidator.array()
|
|
4147
4813
|
});
|
|
4148
|
-
var ContractCredentialValidator =
|
|
4149
|
-
credentialUri:
|
|
4150
|
-
termsUri:
|
|
4151
|
-
contractUri:
|
|
4152
|
-
boostUri:
|
|
4153
|
-
category:
|
|
4154
|
-
date:
|
|
4814
|
+
var ContractCredentialValidator = z.object({
|
|
4815
|
+
credentialUri: z.string(),
|
|
4816
|
+
termsUri: z.string(),
|
|
4817
|
+
contractUri: z.string(),
|
|
4818
|
+
boostUri: z.string(),
|
|
4819
|
+
category: z.string().optional(),
|
|
4820
|
+
date: z.string()
|
|
4155
4821
|
});
|
|
4156
4822
|
var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
|
|
4157
4823
|
records: ContractCredentialValidator.array()
|
|
4158
4824
|
});
|
|
4159
|
-
var LCNNotificationTypeEnumValidator =
|
|
4825
|
+
var LCNNotificationTypeEnumValidator = z.enum([
|
|
4160
4826
|
"CONNECTION_REQUEST",
|
|
4161
4827
|
"CONNECTION_ACCEPTED",
|
|
4162
4828
|
"CREDENTIAL_RECEIVED",
|
|
@@ -4167,40 +4833,40 @@ var LCNNotificationTypeEnumValidator = mod.enum([
|
|
|
4167
4833
|
"PRESENTATION_RECEIVED",
|
|
4168
4834
|
"CONSENT_FLOW_TRANSACTION"
|
|
4169
4835
|
]);
|
|
4170
|
-
var LCNNotificationMessageValidator =
|
|
4171
|
-
title:
|
|
4172
|
-
body:
|
|
4836
|
+
var LCNNotificationMessageValidator = z.object({
|
|
4837
|
+
title: z.string().optional(),
|
|
4838
|
+
body: z.string().optional()
|
|
4173
4839
|
});
|
|
4174
|
-
var LCNNotificationDataValidator =
|
|
4175
|
-
vcUris:
|
|
4176
|
-
vpUris:
|
|
4840
|
+
var LCNNotificationDataValidator = z.object({
|
|
4841
|
+
vcUris: z.array(z.string()).optional(),
|
|
4842
|
+
vpUris: z.array(z.string()).optional(),
|
|
4177
4843
|
transaction: ConsentFlowTransactionValidator.optional()
|
|
4178
4844
|
});
|
|
4179
|
-
var LCNNotificationValidator =
|
|
4845
|
+
var LCNNotificationValidator = z.object({
|
|
4180
4846
|
type: LCNNotificationTypeEnumValidator,
|
|
4181
|
-
to: LCNProfileValidator.partial().and(
|
|
4182
|
-
from: LCNProfileValidator.partial().and(
|
|
4847
|
+
to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
4848
|
+
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
4183
4849
|
message: LCNNotificationMessageValidator.optional(),
|
|
4184
4850
|
data: LCNNotificationDataValidator.optional(),
|
|
4185
|
-
sent:
|
|
4851
|
+
sent: z.string().datetime().optional()
|
|
4186
4852
|
});
|
|
4187
4853
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
|
4188
|
-
var AuthGrantValidator =
|
|
4189
|
-
id:
|
|
4190
|
-
name:
|
|
4191
|
-
description:
|
|
4192
|
-
challenge:
|
|
4193
|
-
status:
|
|
4854
|
+
var AuthGrantValidator = z.object({
|
|
4855
|
+
id: z.string(),
|
|
4856
|
+
name: z.string(),
|
|
4857
|
+
description: z.string().optional(),
|
|
4858
|
+
challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
|
|
4859
|
+
status: z.enum(["revoked", "active"], {
|
|
4194
4860
|
required_error: "Status is required",
|
|
4195
4861
|
invalid_type_error: "Status must be either active or revoked"
|
|
4196
4862
|
}),
|
|
4197
|
-
scope:
|
|
4198
|
-
createdAt:
|
|
4199
|
-
expiresAt:
|
|
4863
|
+
scope: z.string(),
|
|
4864
|
+
createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
|
|
4865
|
+
expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
|
4200
4866
|
});
|
|
4201
|
-
var FlatAuthGrantValidator =
|
|
4202
|
-
var AuthGrantStatusValidator =
|
|
4203
|
-
var AuthGrantQueryValidator =
|
|
4867
|
+
var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
|
|
4868
|
+
var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
|
|
4869
|
+
var AuthGrantQueryValidator = z.object({
|
|
4204
4870
|
id: StringQuery,
|
|
4205
4871
|
name: StringQuery,
|
|
4206
4872
|
description: StringQuery,
|
|
@@ -5059,7 +5725,7 @@ var formatters2 = {
|
|
|
5059
5725
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
5060
5726
|
}
|
|
5061
5727
|
}, "O"),
|
|
5062
|
-
z: /* @__PURE__ */ __name(function
|
|
5728
|
+
z: /* @__PURE__ */ __name(function z2(date, token, _localize, options) {
|
|
5063
5729
|
var originalDate = options._originalDate || date;
|
|
5064
5730
|
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
5065
5731
|
switch (token) {
|