@learncard/learn-card-plugin 1.1.43 → 1.1.45
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 +1332 -665
- 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 +1331 -664
- package/dist/learn-card-plugin.esm.js.map +4 -4
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// ../../../node_modules/.pnpm/zod@3.
|
|
4
|
+
// ../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
5
5
|
var util;
|
|
6
6
|
(function(util2) {
|
|
7
7
|
util2.assertEqual = (val) => val;
|
|
@@ -63,6 +63,15 @@ var util;
|
|
|
63
63
|
return value;
|
|
64
64
|
};
|
|
65
65
|
})(util || (util = {}));
|
|
66
|
+
var objectUtil;
|
|
67
|
+
(function(objectUtil2) {
|
|
68
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
69
|
+
return {
|
|
70
|
+
...first,
|
|
71
|
+
...second
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
})(objectUtil || (objectUtil = {}));
|
|
66
75
|
var ZodParsedType = util.arrayToEnum([
|
|
67
76
|
"string",
|
|
68
77
|
"nan",
|
|
@@ -206,6 +215,11 @@ var ZodError = class extends Error {
|
|
|
206
215
|
processError(this);
|
|
207
216
|
return fieldErrors;
|
|
208
217
|
}
|
|
218
|
+
static assert(value) {
|
|
219
|
+
if (!(value instanceof ZodError)) {
|
|
220
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
209
223
|
toString() {
|
|
210
224
|
return this.message;
|
|
211
225
|
}
|
|
@@ -273,7 +287,12 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
273
287
|
break;
|
|
274
288
|
case ZodIssueCode.invalid_string:
|
|
275
289
|
if (typeof issue.validation === "object") {
|
|
276
|
-
if ("
|
|
290
|
+
if ("includes" in issue.validation) {
|
|
291
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
292
|
+
if (typeof issue.validation.position === "number") {
|
|
293
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
294
|
+
}
|
|
295
|
+
} else if ("startsWith" in issue.validation) {
|
|
277
296
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
278
297
|
} else if ("endsWith" in issue.validation) {
|
|
279
298
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
@@ -294,7 +313,7 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
294
313
|
else if (issue.type === "number")
|
|
295
314
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
296
315
|
else if (issue.type === "date")
|
|
297
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
|
316
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
298
317
|
else
|
|
299
318
|
message = "Invalid input";
|
|
300
319
|
break;
|
|
@@ -305,8 +324,10 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
305
324
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
306
325
|
else if (issue.type === "number")
|
|
307
326
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
327
|
+
else if (issue.type === "bigint")
|
|
328
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
308
329
|
else if (issue.type === "date")
|
|
309
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
|
330
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
310
331
|
else
|
|
311
332
|
message = "Invalid input";
|
|
312
333
|
break;
|
|
@@ -344,6 +365,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
|
344
365
|
...issueData,
|
|
345
366
|
path: fullPath
|
|
346
367
|
};
|
|
368
|
+
if (issueData.message !== void 0) {
|
|
369
|
+
return {
|
|
370
|
+
...issueData,
|
|
371
|
+
path: fullPath,
|
|
372
|
+
message: issueData.message
|
|
373
|
+
};
|
|
374
|
+
}
|
|
347
375
|
let errorMessage = "";
|
|
348
376
|
const maps = errorMaps.filter((m3) => !!m3).slice().reverse();
|
|
349
377
|
for (const map of maps) {
|
|
@@ -352,11 +380,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
|
352
380
|
return {
|
|
353
381
|
...issueData,
|
|
354
382
|
path: fullPath,
|
|
355
|
-
message:
|
|
383
|
+
message: errorMessage
|
|
356
384
|
};
|
|
357
385
|
}, "makeIssue");
|
|
358
386
|
var EMPTY_PATH = [];
|
|
359
387
|
function addIssueToContext(ctx, issueData) {
|
|
388
|
+
const overrideMap = getErrorMap();
|
|
360
389
|
const issue = makeIssue({
|
|
361
390
|
issueData,
|
|
362
391
|
data: ctx.data,
|
|
@@ -364,8 +393,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
364
393
|
errorMaps: [
|
|
365
394
|
ctx.common.contextualErrorMap,
|
|
366
395
|
ctx.schemaErrorMap,
|
|
367
|
-
|
|
368
|
-
errorMap
|
|
396
|
+
overrideMap,
|
|
397
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
369
398
|
].filter((x2) => !!x2)
|
|
370
399
|
});
|
|
371
400
|
ctx.common.issues.push(issue);
|
|
@@ -397,9 +426,11 @@ var ParseStatus = class {
|
|
|
397
426
|
static async mergeObjectAsync(status, pairs) {
|
|
398
427
|
const syncPairs = [];
|
|
399
428
|
for (const pair of pairs) {
|
|
429
|
+
const key = await pair.key;
|
|
430
|
+
const value = await pair.value;
|
|
400
431
|
syncPairs.push({
|
|
401
|
-
key
|
|
402
|
-
value
|
|
432
|
+
key,
|
|
433
|
+
value
|
|
403
434
|
});
|
|
404
435
|
}
|
|
405
436
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -416,7 +447,7 @@ var ParseStatus = class {
|
|
|
416
447
|
status.dirty();
|
|
417
448
|
if (value.status === "dirty")
|
|
418
449
|
status.dirty();
|
|
419
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
450
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
420
451
|
finalObject[key.value] = value.value;
|
|
421
452
|
}
|
|
422
453
|
}
|
|
@@ -432,21 +463,49 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
|
|
|
432
463
|
var isAborted = /* @__PURE__ */ __name((x2) => x2.status === "aborted", "isAborted");
|
|
433
464
|
var isDirty = /* @__PURE__ */ __name((x2) => x2.status === "dirty", "isDirty");
|
|
434
465
|
var isValid = /* @__PURE__ */ __name((x2) => x2.status === "valid", "isValid");
|
|
435
|
-
var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !==
|
|
466
|
+
var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !== "undefined" && x2 instanceof Promise, "isAsync");
|
|
467
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
468
|
+
if (kind === "a" && !f)
|
|
469
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
470
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
471
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
472
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
473
|
+
}
|
|
474
|
+
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
|
|
475
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
476
|
+
if (kind === "m")
|
|
477
|
+
throw new TypeError("Private method is not writable");
|
|
478
|
+
if (kind === "a" && !f)
|
|
479
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
480
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
481
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
482
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
483
|
+
}
|
|
484
|
+
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
|
|
436
485
|
var errorUtil;
|
|
437
486
|
(function(errorUtil2) {
|
|
438
487
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
439
488
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
440
489
|
})(errorUtil || (errorUtil = {}));
|
|
490
|
+
var _ZodEnum_cache;
|
|
491
|
+
var _ZodNativeEnum_cache;
|
|
441
492
|
var ParseInputLazyPath = class {
|
|
442
493
|
constructor(parent, value, path, key) {
|
|
494
|
+
this._cachedPath = [];
|
|
443
495
|
this.parent = parent;
|
|
444
496
|
this.data = value;
|
|
445
497
|
this._path = path;
|
|
446
498
|
this._key = key;
|
|
447
499
|
}
|
|
448
500
|
get path() {
|
|
449
|
-
|
|
501
|
+
if (!this._cachedPath.length) {
|
|
502
|
+
if (this._key instanceof Array) {
|
|
503
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
504
|
+
} else {
|
|
505
|
+
this._cachedPath.push(...this._path, this._key);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return this._cachedPath;
|
|
450
509
|
}
|
|
451
510
|
};
|
|
452
511
|
__name(ParseInputLazyPath, "ParseInputLazyPath");
|
|
@@ -457,8 +516,16 @@ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
|
|
|
457
516
|
if (!ctx.common.issues.length) {
|
|
458
517
|
throw new Error("Validation failed but no issues detected.");
|
|
459
518
|
}
|
|
460
|
-
|
|
461
|
-
|
|
519
|
+
return {
|
|
520
|
+
success: false,
|
|
521
|
+
get error() {
|
|
522
|
+
if (this._error)
|
|
523
|
+
return this._error;
|
|
524
|
+
const error = new ZodError(ctx.common.issues);
|
|
525
|
+
this._error = error;
|
|
526
|
+
return this._error;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
462
529
|
}
|
|
463
530
|
}, "handleResult");
|
|
464
531
|
function processCreateParams(params) {
|
|
@@ -471,12 +538,17 @@ function processCreateParams(params) {
|
|
|
471
538
|
if (errorMap2)
|
|
472
539
|
return { errorMap: errorMap2, description };
|
|
473
540
|
const customMap = /* @__PURE__ */ __name((iss, ctx) => {
|
|
474
|
-
|
|
475
|
-
|
|
541
|
+
var _a, _b;
|
|
542
|
+
const { message } = params;
|
|
543
|
+
if (iss.code === "invalid_enum_value") {
|
|
544
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
545
|
+
}
|
|
476
546
|
if (typeof ctx.data === "undefined") {
|
|
477
|
-
return { message:
|
|
547
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
478
548
|
}
|
|
479
|
-
|
|
549
|
+
if (iss.code !== "invalid_type")
|
|
550
|
+
return { message: ctx.defaultError };
|
|
551
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
480
552
|
}, "customMap");
|
|
481
553
|
return { errorMap: customMap, description };
|
|
482
554
|
}
|
|
@@ -506,6 +578,7 @@ var ZodType = class {
|
|
|
506
578
|
this.catch = this.catch.bind(this);
|
|
507
579
|
this.describe = this.describe.bind(this);
|
|
508
580
|
this.pipe = this.pipe.bind(this);
|
|
581
|
+
this.readonly = this.readonly.bind(this);
|
|
509
582
|
this.isNullable = this.isNullable.bind(this);
|
|
510
583
|
this.isOptional = this.isOptional.bind(this);
|
|
511
584
|
}
|
|
@@ -650,28 +723,29 @@ var ZodType = class {
|
|
|
650
723
|
return this._refinement(refinement);
|
|
651
724
|
}
|
|
652
725
|
optional() {
|
|
653
|
-
return ZodOptional.create(this);
|
|
726
|
+
return ZodOptional.create(this, this._def);
|
|
654
727
|
}
|
|
655
728
|
nullable() {
|
|
656
|
-
return ZodNullable.create(this);
|
|
729
|
+
return ZodNullable.create(this, this._def);
|
|
657
730
|
}
|
|
658
731
|
nullish() {
|
|
659
|
-
return this.
|
|
732
|
+
return this.nullable().optional();
|
|
660
733
|
}
|
|
661
734
|
array() {
|
|
662
|
-
return ZodArray.create(this);
|
|
735
|
+
return ZodArray.create(this, this._def);
|
|
663
736
|
}
|
|
664
737
|
promise() {
|
|
665
|
-
return ZodPromise.create(this);
|
|
738
|
+
return ZodPromise.create(this, this._def);
|
|
666
739
|
}
|
|
667
740
|
or(option) {
|
|
668
|
-
return ZodUnion.create([this, option]);
|
|
741
|
+
return ZodUnion.create([this, option], this._def);
|
|
669
742
|
}
|
|
670
743
|
and(incoming) {
|
|
671
|
-
return ZodIntersection.create(this, incoming);
|
|
744
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
672
745
|
}
|
|
673
746
|
transform(transform) {
|
|
674
747
|
return new ZodEffects({
|
|
748
|
+
...processCreateParams(this._def),
|
|
675
749
|
schema: this,
|
|
676
750
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
677
751
|
effect: { type: "transform", transform }
|
|
@@ -680,6 +754,7 @@ var ZodType = class {
|
|
|
680
754
|
default(def) {
|
|
681
755
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
682
756
|
return new ZodDefault({
|
|
757
|
+
...processCreateParams(this._def),
|
|
683
758
|
innerType: this,
|
|
684
759
|
defaultValue: defaultValueFunc,
|
|
685
760
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -689,14 +764,15 @@ var ZodType = class {
|
|
|
689
764
|
return new ZodBranded({
|
|
690
765
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
691
766
|
type: this,
|
|
692
|
-
...processCreateParams(
|
|
767
|
+
...processCreateParams(this._def)
|
|
693
768
|
});
|
|
694
769
|
}
|
|
695
770
|
catch(def) {
|
|
696
|
-
const
|
|
771
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
|
697
772
|
return new ZodCatch({
|
|
773
|
+
...processCreateParams(this._def),
|
|
698
774
|
innerType: this,
|
|
699
|
-
|
|
775
|
+
catchValue: catchValueFunc,
|
|
700
776
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
701
777
|
});
|
|
702
778
|
}
|
|
@@ -710,6 +786,9 @@ var ZodType = class {
|
|
|
710
786
|
pipe(target) {
|
|
711
787
|
return ZodPipeline.create(this, target);
|
|
712
788
|
}
|
|
789
|
+
readonly() {
|
|
790
|
+
return ZodReadonly.create(this);
|
|
791
|
+
}
|
|
713
792
|
isOptional() {
|
|
714
793
|
return this.safeParse(void 0).success;
|
|
715
794
|
}
|
|
@@ -719,43 +798,54 @@ var ZodType = class {
|
|
|
719
798
|
};
|
|
720
799
|
__name(ZodType, "ZodType");
|
|
721
800
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
722
|
-
var
|
|
723
|
-
var
|
|
724
|
-
var
|
|
801
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
802
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
803
|
+
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;
|
|
804
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
805
|
+
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)?)??$/;
|
|
806
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
807
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
808
|
+
var emojiRegex;
|
|
809
|
+
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])$/;
|
|
810
|
+
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})))$/;
|
|
811
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
812
|
+
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])))`;
|
|
813
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
814
|
+
function timeRegexSource(args) {
|
|
815
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
725
816
|
if (args.precision) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
730
|
-
}
|
|
731
|
-
} else if (args.precision === 0) {
|
|
732
|
-
if (args.offset) {
|
|
733
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
734
|
-
} else {
|
|
735
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
736
|
-
}
|
|
737
|
-
} else {
|
|
738
|
-
if (args.offset) {
|
|
739
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
740
|
-
} else {
|
|
741
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
742
|
-
}
|
|
817
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
818
|
+
} else if (args.precision == null) {
|
|
819
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
743
820
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
821
|
+
return regex;
|
|
822
|
+
}
|
|
823
|
+
__name(timeRegexSource, "timeRegexSource");
|
|
824
|
+
function timeRegex(args) {
|
|
825
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
826
|
+
}
|
|
827
|
+
__name(timeRegex, "timeRegex");
|
|
828
|
+
function datetimeRegex(args) {
|
|
829
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
830
|
+
const opts = [];
|
|
831
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
832
|
+
if (args.offset)
|
|
833
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
834
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
835
|
+
return new RegExp(`^${regex}$`);
|
|
836
|
+
}
|
|
837
|
+
__name(datetimeRegex, "datetimeRegex");
|
|
838
|
+
function isValidIP(ip, version) {
|
|
839
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
840
|
+
return true;
|
|
758
841
|
}
|
|
842
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
843
|
+
return true;
|
|
844
|
+
}
|
|
845
|
+
return false;
|
|
846
|
+
}
|
|
847
|
+
__name(isValidIP, "isValidIP");
|
|
848
|
+
var ZodString = class extends ZodType {
|
|
759
849
|
_parse(input) {
|
|
760
850
|
if (this._def.coerce) {
|
|
761
851
|
input.data = String(input.data);
|
|
@@ -763,14 +853,11 @@ var ZodString = class extends ZodType {
|
|
|
763
853
|
const parsedType = this._getType(input);
|
|
764
854
|
if (parsedType !== ZodParsedType.string) {
|
|
765
855
|
const ctx2 = this._getOrReturnCtx(input);
|
|
766
|
-
addIssueToContext(
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
received: ctx2.parsedType
|
|
772
|
-
}
|
|
773
|
-
);
|
|
856
|
+
addIssueToContext(ctx2, {
|
|
857
|
+
code: ZodIssueCode.invalid_type,
|
|
858
|
+
expected: ZodParsedType.string,
|
|
859
|
+
received: ctx2.parsedType
|
|
860
|
+
});
|
|
774
861
|
return INVALID;
|
|
775
862
|
}
|
|
776
863
|
const status = new ParseStatus();
|
|
@@ -838,6 +925,19 @@ var ZodString = class extends ZodType {
|
|
|
838
925
|
});
|
|
839
926
|
status.dirty();
|
|
840
927
|
}
|
|
928
|
+
} else if (check.kind === "emoji") {
|
|
929
|
+
if (!emojiRegex) {
|
|
930
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
931
|
+
}
|
|
932
|
+
if (!emojiRegex.test(input.data)) {
|
|
933
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
934
|
+
addIssueToContext(ctx, {
|
|
935
|
+
validation: "emoji",
|
|
936
|
+
code: ZodIssueCode.invalid_string,
|
|
937
|
+
message: check.message
|
|
938
|
+
});
|
|
939
|
+
status.dirty();
|
|
940
|
+
}
|
|
841
941
|
} else if (check.kind === "uuid") {
|
|
842
942
|
if (!uuidRegex.test(input.data)) {
|
|
843
943
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -848,6 +948,16 @@ var ZodString = class extends ZodType {
|
|
|
848
948
|
});
|
|
849
949
|
status.dirty();
|
|
850
950
|
}
|
|
951
|
+
} else if (check.kind === "nanoid") {
|
|
952
|
+
if (!nanoidRegex.test(input.data)) {
|
|
953
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
954
|
+
addIssueToContext(ctx, {
|
|
955
|
+
validation: "nanoid",
|
|
956
|
+
code: ZodIssueCode.invalid_string,
|
|
957
|
+
message: check.message
|
|
958
|
+
});
|
|
959
|
+
status.dirty();
|
|
960
|
+
}
|
|
851
961
|
} else if (check.kind === "cuid") {
|
|
852
962
|
if (!cuidRegex.test(input.data)) {
|
|
853
963
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -858,6 +968,26 @@ var ZodString = class extends ZodType {
|
|
|
858
968
|
});
|
|
859
969
|
status.dirty();
|
|
860
970
|
}
|
|
971
|
+
} else if (check.kind === "cuid2") {
|
|
972
|
+
if (!cuid2Regex.test(input.data)) {
|
|
973
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
974
|
+
addIssueToContext(ctx, {
|
|
975
|
+
validation: "cuid2",
|
|
976
|
+
code: ZodIssueCode.invalid_string,
|
|
977
|
+
message: check.message
|
|
978
|
+
});
|
|
979
|
+
status.dirty();
|
|
980
|
+
}
|
|
981
|
+
} else if (check.kind === "ulid") {
|
|
982
|
+
if (!ulidRegex.test(input.data)) {
|
|
983
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
984
|
+
addIssueToContext(ctx, {
|
|
985
|
+
validation: "ulid",
|
|
986
|
+
code: ZodIssueCode.invalid_string,
|
|
987
|
+
message: check.message
|
|
988
|
+
});
|
|
989
|
+
status.dirty();
|
|
990
|
+
}
|
|
861
991
|
} else if (check.kind === "url") {
|
|
862
992
|
try {
|
|
863
993
|
new URL(input.data);
|
|
@@ -884,6 +1014,20 @@ var ZodString = class extends ZodType {
|
|
|
884
1014
|
}
|
|
885
1015
|
} else if (check.kind === "trim") {
|
|
886
1016
|
input.data = input.data.trim();
|
|
1017
|
+
} else if (check.kind === "includes") {
|
|
1018
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
1019
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1020
|
+
addIssueToContext(ctx, {
|
|
1021
|
+
code: ZodIssueCode.invalid_string,
|
|
1022
|
+
validation: { includes: check.value, position: check.position },
|
|
1023
|
+
message: check.message
|
|
1024
|
+
});
|
|
1025
|
+
status.dirty();
|
|
1026
|
+
}
|
|
1027
|
+
} else if (check.kind === "toLowerCase") {
|
|
1028
|
+
input.data = input.data.toLowerCase();
|
|
1029
|
+
} else if (check.kind === "toUpperCase") {
|
|
1030
|
+
input.data = input.data.toUpperCase();
|
|
887
1031
|
} else if (check.kind === "startsWith") {
|
|
888
1032
|
if (!input.data.startsWith(check.value)) {
|
|
889
1033
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -915,12 +1059,71 @@ var ZodString = class extends ZodType {
|
|
|
915
1059
|
});
|
|
916
1060
|
status.dirty();
|
|
917
1061
|
}
|
|
1062
|
+
} else if (check.kind === "date") {
|
|
1063
|
+
const regex = dateRegex;
|
|
1064
|
+
if (!regex.test(input.data)) {
|
|
1065
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1066
|
+
addIssueToContext(ctx, {
|
|
1067
|
+
code: ZodIssueCode.invalid_string,
|
|
1068
|
+
validation: "date",
|
|
1069
|
+
message: check.message
|
|
1070
|
+
});
|
|
1071
|
+
status.dirty();
|
|
1072
|
+
}
|
|
1073
|
+
} else if (check.kind === "time") {
|
|
1074
|
+
const regex = timeRegex(check);
|
|
1075
|
+
if (!regex.test(input.data)) {
|
|
1076
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1077
|
+
addIssueToContext(ctx, {
|
|
1078
|
+
code: ZodIssueCode.invalid_string,
|
|
1079
|
+
validation: "time",
|
|
1080
|
+
message: check.message
|
|
1081
|
+
});
|
|
1082
|
+
status.dirty();
|
|
1083
|
+
}
|
|
1084
|
+
} else if (check.kind === "duration") {
|
|
1085
|
+
if (!durationRegex.test(input.data)) {
|
|
1086
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1087
|
+
addIssueToContext(ctx, {
|
|
1088
|
+
validation: "duration",
|
|
1089
|
+
code: ZodIssueCode.invalid_string,
|
|
1090
|
+
message: check.message
|
|
1091
|
+
});
|
|
1092
|
+
status.dirty();
|
|
1093
|
+
}
|
|
1094
|
+
} else if (check.kind === "ip") {
|
|
1095
|
+
if (!isValidIP(input.data, check.version)) {
|
|
1096
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1097
|
+
addIssueToContext(ctx, {
|
|
1098
|
+
validation: "ip",
|
|
1099
|
+
code: ZodIssueCode.invalid_string,
|
|
1100
|
+
message: check.message
|
|
1101
|
+
});
|
|
1102
|
+
status.dirty();
|
|
1103
|
+
}
|
|
1104
|
+
} else if (check.kind === "base64") {
|
|
1105
|
+
if (!base64Regex.test(input.data)) {
|
|
1106
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1107
|
+
addIssueToContext(ctx, {
|
|
1108
|
+
validation: "base64",
|
|
1109
|
+
code: ZodIssueCode.invalid_string,
|
|
1110
|
+
message: check.message
|
|
1111
|
+
});
|
|
1112
|
+
status.dirty();
|
|
1113
|
+
}
|
|
918
1114
|
} else {
|
|
919
1115
|
util.assertNever(check);
|
|
920
1116
|
}
|
|
921
1117
|
}
|
|
922
1118
|
return { status: status.value, value: input.data };
|
|
923
1119
|
}
|
|
1120
|
+
_regex(regex, validation, message) {
|
|
1121
|
+
return this.refinement((data) => regex.test(data), {
|
|
1122
|
+
validation,
|
|
1123
|
+
code: ZodIssueCode.invalid_string,
|
|
1124
|
+
...errorUtil.errToObj(message)
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
924
1127
|
_addCheck(check) {
|
|
925
1128
|
return new ZodString({
|
|
926
1129
|
...this._def,
|
|
@@ -933,19 +1136,38 @@ var ZodString = class extends ZodType {
|
|
|
933
1136
|
url(message) {
|
|
934
1137
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
935
1138
|
}
|
|
1139
|
+
emoji(message) {
|
|
1140
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
1141
|
+
}
|
|
936
1142
|
uuid(message) {
|
|
937
1143
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
938
1144
|
}
|
|
1145
|
+
nanoid(message) {
|
|
1146
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1147
|
+
}
|
|
939
1148
|
cuid(message) {
|
|
940
1149
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
941
1150
|
}
|
|
1151
|
+
cuid2(message) {
|
|
1152
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
1153
|
+
}
|
|
1154
|
+
ulid(message) {
|
|
1155
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1156
|
+
}
|
|
1157
|
+
base64(message) {
|
|
1158
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1159
|
+
}
|
|
1160
|
+
ip(options) {
|
|
1161
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1162
|
+
}
|
|
942
1163
|
datetime(options) {
|
|
943
|
-
var _a;
|
|
1164
|
+
var _a, _b;
|
|
944
1165
|
if (typeof options === "string") {
|
|
945
1166
|
return this._addCheck({
|
|
946
1167
|
kind: "datetime",
|
|
947
1168
|
precision: null,
|
|
948
1169
|
offset: false,
|
|
1170
|
+
local: false,
|
|
949
1171
|
message: options
|
|
950
1172
|
});
|
|
951
1173
|
}
|
|
@@ -953,9 +1175,30 @@ var ZodString = class extends ZodType {
|
|
|
953
1175
|
kind: "datetime",
|
|
954
1176
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
955
1177
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1178
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1179
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
date(message) {
|
|
1183
|
+
return this._addCheck({ kind: "date", message });
|
|
1184
|
+
}
|
|
1185
|
+
time(options) {
|
|
1186
|
+
if (typeof options === "string") {
|
|
1187
|
+
return this._addCheck({
|
|
1188
|
+
kind: "time",
|
|
1189
|
+
precision: null,
|
|
1190
|
+
message: options
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
return this._addCheck({
|
|
1194
|
+
kind: "time",
|
|
1195
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
956
1196
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
957
1197
|
});
|
|
958
1198
|
}
|
|
1199
|
+
duration(message) {
|
|
1200
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1201
|
+
}
|
|
959
1202
|
regex(regex, message) {
|
|
960
1203
|
return this._addCheck({
|
|
961
1204
|
kind: "regex",
|
|
@@ -963,6 +1206,14 @@ var ZodString = class extends ZodType {
|
|
|
963
1206
|
...errorUtil.errToObj(message)
|
|
964
1207
|
});
|
|
965
1208
|
}
|
|
1209
|
+
includes(value, options) {
|
|
1210
|
+
return this._addCheck({
|
|
1211
|
+
kind: "includes",
|
|
1212
|
+
value,
|
|
1213
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
1214
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
966
1217
|
startsWith(value, message) {
|
|
967
1218
|
return this._addCheck({
|
|
968
1219
|
kind: "startsWith",
|
|
@@ -998,21 +1249,69 @@ var ZodString = class extends ZodType {
|
|
|
998
1249
|
...errorUtil.errToObj(message)
|
|
999
1250
|
});
|
|
1000
1251
|
}
|
|
1252
|
+
nonempty(message) {
|
|
1253
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1254
|
+
}
|
|
1255
|
+
trim() {
|
|
1256
|
+
return new ZodString({
|
|
1257
|
+
...this._def,
|
|
1258
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
toLowerCase() {
|
|
1262
|
+
return new ZodString({
|
|
1263
|
+
...this._def,
|
|
1264
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
toUpperCase() {
|
|
1268
|
+
return new ZodString({
|
|
1269
|
+
...this._def,
|
|
1270
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1001
1273
|
get isDatetime() {
|
|
1002
1274
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1003
1275
|
}
|
|
1276
|
+
get isDate() {
|
|
1277
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1278
|
+
}
|
|
1279
|
+
get isTime() {
|
|
1280
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1281
|
+
}
|
|
1282
|
+
get isDuration() {
|
|
1283
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1284
|
+
}
|
|
1004
1285
|
get isEmail() {
|
|
1005
1286
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1006
1287
|
}
|
|
1007
1288
|
get isURL() {
|
|
1008
1289
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
1009
1290
|
}
|
|
1291
|
+
get isEmoji() {
|
|
1292
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
1293
|
+
}
|
|
1010
1294
|
get isUUID() {
|
|
1011
1295
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1012
1296
|
}
|
|
1297
|
+
get isNANOID() {
|
|
1298
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1299
|
+
}
|
|
1013
1300
|
get isCUID() {
|
|
1014
1301
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1015
1302
|
}
|
|
1303
|
+
get isCUID2() {
|
|
1304
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
1305
|
+
}
|
|
1306
|
+
get isULID() {
|
|
1307
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
1308
|
+
}
|
|
1309
|
+
get isIP() {
|
|
1310
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1311
|
+
}
|
|
1312
|
+
get isBase64() {
|
|
1313
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1314
|
+
}
|
|
1016
1315
|
get minLength() {
|
|
1017
1316
|
let min = null;
|
|
1018
1317
|
for (const ch of this._def.checks) {
|
|
@@ -1224,6 +1523,19 @@ var ZodNumber = class extends ZodType {
|
|
|
1224
1523
|
message: errorUtil.toString(message)
|
|
1225
1524
|
});
|
|
1226
1525
|
}
|
|
1526
|
+
safe(message) {
|
|
1527
|
+
return this._addCheck({
|
|
1528
|
+
kind: "min",
|
|
1529
|
+
inclusive: true,
|
|
1530
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
1531
|
+
message: errorUtil.toString(message)
|
|
1532
|
+
})._addCheck({
|
|
1533
|
+
kind: "max",
|
|
1534
|
+
inclusive: true,
|
|
1535
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
1536
|
+
message: errorUtil.toString(message)
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1227
1539
|
get minValue() {
|
|
1228
1540
|
let min = null;
|
|
1229
1541
|
for (const ch of this._def.checks) {
|
|
@@ -1245,7 +1557,22 @@ var ZodNumber = class extends ZodType {
|
|
|
1245
1557
|
return max;
|
|
1246
1558
|
}
|
|
1247
1559
|
get isInt() {
|
|
1248
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
1560
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1561
|
+
}
|
|
1562
|
+
get isFinite() {
|
|
1563
|
+
let max = null, min = null;
|
|
1564
|
+
for (const ch of this._def.checks) {
|
|
1565
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1566
|
+
return true;
|
|
1567
|
+
} else if (ch.kind === "min") {
|
|
1568
|
+
if (min === null || ch.value > min)
|
|
1569
|
+
min = ch.value;
|
|
1570
|
+
} else if (ch.kind === "max") {
|
|
1571
|
+
if (max === null || ch.value < max)
|
|
1572
|
+
max = ch.value;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
1249
1576
|
}
|
|
1250
1577
|
};
|
|
1251
1578
|
__name(ZodNumber, "ZodNumber");
|
|
@@ -1258,27 +1585,167 @@ ZodNumber.create = (params) => {
|
|
|
1258
1585
|
});
|
|
1259
1586
|
};
|
|
1260
1587
|
var ZodBigInt = class extends ZodType {
|
|
1588
|
+
constructor() {
|
|
1589
|
+
super(...arguments);
|
|
1590
|
+
this.min = this.gte;
|
|
1591
|
+
this.max = this.lte;
|
|
1592
|
+
}
|
|
1261
1593
|
_parse(input) {
|
|
1262
1594
|
if (this._def.coerce) {
|
|
1263
1595
|
input.data = BigInt(input.data);
|
|
1264
1596
|
}
|
|
1265
1597
|
const parsedType = this._getType(input);
|
|
1266
1598
|
if (parsedType !== ZodParsedType.bigint) {
|
|
1267
|
-
const
|
|
1268
|
-
addIssueToContext(
|
|
1599
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1600
|
+
addIssueToContext(ctx2, {
|
|
1269
1601
|
code: ZodIssueCode.invalid_type,
|
|
1270
1602
|
expected: ZodParsedType.bigint,
|
|
1271
|
-
received:
|
|
1603
|
+
received: ctx2.parsedType
|
|
1272
1604
|
});
|
|
1273
1605
|
return INVALID;
|
|
1274
1606
|
}
|
|
1275
|
-
|
|
1607
|
+
let ctx = void 0;
|
|
1608
|
+
const status = new ParseStatus();
|
|
1609
|
+
for (const check of this._def.checks) {
|
|
1610
|
+
if (check.kind === "min") {
|
|
1611
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1612
|
+
if (tooSmall) {
|
|
1613
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1614
|
+
addIssueToContext(ctx, {
|
|
1615
|
+
code: ZodIssueCode.too_small,
|
|
1616
|
+
type: "bigint",
|
|
1617
|
+
minimum: check.value,
|
|
1618
|
+
inclusive: check.inclusive,
|
|
1619
|
+
message: check.message
|
|
1620
|
+
});
|
|
1621
|
+
status.dirty();
|
|
1622
|
+
}
|
|
1623
|
+
} else if (check.kind === "max") {
|
|
1624
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1625
|
+
if (tooBig) {
|
|
1626
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1627
|
+
addIssueToContext(ctx, {
|
|
1628
|
+
code: ZodIssueCode.too_big,
|
|
1629
|
+
type: "bigint",
|
|
1630
|
+
maximum: check.value,
|
|
1631
|
+
inclusive: check.inclusive,
|
|
1632
|
+
message: check.message
|
|
1633
|
+
});
|
|
1634
|
+
status.dirty();
|
|
1635
|
+
}
|
|
1636
|
+
} else if (check.kind === "multipleOf") {
|
|
1637
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
1638
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1639
|
+
addIssueToContext(ctx, {
|
|
1640
|
+
code: ZodIssueCode.not_multiple_of,
|
|
1641
|
+
multipleOf: check.value,
|
|
1642
|
+
message: check.message
|
|
1643
|
+
});
|
|
1644
|
+
status.dirty();
|
|
1645
|
+
}
|
|
1646
|
+
} else {
|
|
1647
|
+
util.assertNever(check);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return { status: status.value, value: input.data };
|
|
1651
|
+
}
|
|
1652
|
+
gte(value, message) {
|
|
1653
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1654
|
+
}
|
|
1655
|
+
gt(value, message) {
|
|
1656
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
1657
|
+
}
|
|
1658
|
+
lte(value, message) {
|
|
1659
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
1660
|
+
}
|
|
1661
|
+
lt(value, message) {
|
|
1662
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1663
|
+
}
|
|
1664
|
+
setLimit(kind, value, inclusive, message) {
|
|
1665
|
+
return new ZodBigInt({
|
|
1666
|
+
...this._def,
|
|
1667
|
+
checks: [
|
|
1668
|
+
...this._def.checks,
|
|
1669
|
+
{
|
|
1670
|
+
kind,
|
|
1671
|
+
value,
|
|
1672
|
+
inclusive,
|
|
1673
|
+
message: errorUtil.toString(message)
|
|
1674
|
+
}
|
|
1675
|
+
]
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
_addCheck(check) {
|
|
1679
|
+
return new ZodBigInt({
|
|
1680
|
+
...this._def,
|
|
1681
|
+
checks: [...this._def.checks, check]
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
positive(message) {
|
|
1685
|
+
return this._addCheck({
|
|
1686
|
+
kind: "min",
|
|
1687
|
+
value: BigInt(0),
|
|
1688
|
+
inclusive: false,
|
|
1689
|
+
message: errorUtil.toString(message)
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
negative(message) {
|
|
1693
|
+
return this._addCheck({
|
|
1694
|
+
kind: "max",
|
|
1695
|
+
value: BigInt(0),
|
|
1696
|
+
inclusive: false,
|
|
1697
|
+
message: errorUtil.toString(message)
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
nonpositive(message) {
|
|
1701
|
+
return this._addCheck({
|
|
1702
|
+
kind: "max",
|
|
1703
|
+
value: BigInt(0),
|
|
1704
|
+
inclusive: true,
|
|
1705
|
+
message: errorUtil.toString(message)
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
nonnegative(message) {
|
|
1709
|
+
return this._addCheck({
|
|
1710
|
+
kind: "min",
|
|
1711
|
+
value: BigInt(0),
|
|
1712
|
+
inclusive: true,
|
|
1713
|
+
message: errorUtil.toString(message)
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
multipleOf(value, message) {
|
|
1717
|
+
return this._addCheck({
|
|
1718
|
+
kind: "multipleOf",
|
|
1719
|
+
value,
|
|
1720
|
+
message: errorUtil.toString(message)
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
get minValue() {
|
|
1724
|
+
let min = null;
|
|
1725
|
+
for (const ch of this._def.checks) {
|
|
1726
|
+
if (ch.kind === "min") {
|
|
1727
|
+
if (min === null || ch.value > min)
|
|
1728
|
+
min = ch.value;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
return min;
|
|
1732
|
+
}
|
|
1733
|
+
get maxValue() {
|
|
1734
|
+
let max = null;
|
|
1735
|
+
for (const ch of this._def.checks) {
|
|
1736
|
+
if (ch.kind === "max") {
|
|
1737
|
+
if (max === null || ch.value < max)
|
|
1738
|
+
max = ch.value;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
return max;
|
|
1276
1742
|
}
|
|
1277
1743
|
};
|
|
1278
1744
|
__name(ZodBigInt, "ZodBigInt");
|
|
1279
1745
|
ZodBigInt.create = (params) => {
|
|
1280
1746
|
var _a;
|
|
1281
1747
|
return new ZodBigInt({
|
|
1748
|
+
checks: [],
|
|
1282
1749
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1283
1750
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
1284
1751
|
...processCreateParams(params)
|
|
@@ -1613,13 +2080,13 @@ var ZodArray = class extends ZodType {
|
|
|
1613
2080
|
}
|
|
1614
2081
|
}
|
|
1615
2082
|
if (ctx.common.async) {
|
|
1616
|
-
return Promise.all(ctx.data.map((item, i2) => {
|
|
2083
|
+
return Promise.all([...ctx.data].map((item, i2) => {
|
|
1617
2084
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
1618
2085
|
})).then((result2) => {
|
|
1619
2086
|
return ParseStatus.mergeArray(status, result2);
|
|
1620
2087
|
});
|
|
1621
2088
|
}
|
|
1622
|
-
const result = ctx.data.map((item, i2) => {
|
|
2089
|
+
const result = [...ctx.data].map((item, i2) => {
|
|
1623
2090
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
1624
2091
|
});
|
|
1625
2092
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -1660,24 +2127,6 @@ ZodArray.create = (schema, params) => {
|
|
|
1660
2127
|
...processCreateParams(params)
|
|
1661
2128
|
});
|
|
1662
2129
|
};
|
|
1663
|
-
var objectUtil;
|
|
1664
|
-
(function(objectUtil2) {
|
|
1665
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
1666
|
-
return {
|
|
1667
|
-
...first,
|
|
1668
|
-
...second
|
|
1669
|
-
};
|
|
1670
|
-
};
|
|
1671
|
-
})(objectUtil || (objectUtil = {}));
|
|
1672
|
-
var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
|
|
1673
|
-
return new ZodObject({
|
|
1674
|
-
...def,
|
|
1675
|
-
shape: () => ({
|
|
1676
|
-
...def.shape(),
|
|
1677
|
-
...augmentation
|
|
1678
|
-
})
|
|
1679
|
-
});
|
|
1680
|
-
}, "AugmentFactory");
|
|
1681
2130
|
function deepPartialify(schema) {
|
|
1682
2131
|
if (schema instanceof ZodObject) {
|
|
1683
2132
|
const newShape = {};
|
|
@@ -1690,7 +2139,10 @@ function deepPartialify(schema) {
|
|
|
1690
2139
|
shape: () => newShape
|
|
1691
2140
|
});
|
|
1692
2141
|
} else if (schema instanceof ZodArray) {
|
|
1693
|
-
return ZodArray
|
|
2142
|
+
return new ZodArray({
|
|
2143
|
+
...schema._def,
|
|
2144
|
+
type: deepPartialify(schema.element)
|
|
2145
|
+
});
|
|
1694
2146
|
} else if (schema instanceof ZodOptional) {
|
|
1695
2147
|
return ZodOptional.create(deepPartialify(schema.unwrap()));
|
|
1696
2148
|
} else if (schema instanceof ZodNullable) {
|
|
@@ -1707,8 +2159,7 @@ var ZodObject = class extends ZodType {
|
|
|
1707
2159
|
super(...arguments);
|
|
1708
2160
|
this._cached = null;
|
|
1709
2161
|
this.nonstrict = this.passthrough;
|
|
1710
|
-
this.augment =
|
|
1711
|
-
this.extend = AugmentFactory(this._def);
|
|
2162
|
+
this.augment = this.extend;
|
|
1712
2163
|
}
|
|
1713
2164
|
_getCached() {
|
|
1714
2165
|
if (this._cached !== null)
|
|
@@ -1788,9 +2239,10 @@ var ZodObject = class extends ZodType {
|
|
|
1788
2239
|
const syncPairs = [];
|
|
1789
2240
|
for (const pair of pairs) {
|
|
1790
2241
|
const key = await pair.key;
|
|
2242
|
+
const value = await pair.value;
|
|
1791
2243
|
syncPairs.push({
|
|
1792
2244
|
key,
|
|
1793
|
-
value
|
|
2245
|
+
value,
|
|
1794
2246
|
alwaysSet: pair.alwaysSet
|
|
1795
2247
|
});
|
|
1796
2248
|
}
|
|
@@ -1837,18 +2289,30 @@ var ZodObject = class extends ZodType {
|
|
|
1837
2289
|
unknownKeys: "passthrough"
|
|
1838
2290
|
});
|
|
1839
2291
|
}
|
|
1840
|
-
|
|
1841
|
-
return
|
|
2292
|
+
extend(augmentation) {
|
|
2293
|
+
return new ZodObject({
|
|
2294
|
+
...this._def,
|
|
2295
|
+
shape: () => ({
|
|
2296
|
+
...this._def.shape(),
|
|
2297
|
+
...augmentation
|
|
2298
|
+
})
|
|
2299
|
+
});
|
|
1842
2300
|
}
|
|
1843
2301
|
merge(merging) {
|
|
1844
2302
|
const merged = new ZodObject({
|
|
1845
2303
|
unknownKeys: merging._def.unknownKeys,
|
|
1846
2304
|
catchall: merging._def.catchall,
|
|
1847
|
-
shape: () =>
|
|
2305
|
+
shape: () => ({
|
|
2306
|
+
...this._def.shape(),
|
|
2307
|
+
...merging._def.shape()
|
|
2308
|
+
}),
|
|
1848
2309
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
1849
2310
|
});
|
|
1850
2311
|
return merged;
|
|
1851
2312
|
}
|
|
2313
|
+
setKey(key, schema) {
|
|
2314
|
+
return this.augment({ [key]: schema });
|
|
2315
|
+
}
|
|
1852
2316
|
catchall(index) {
|
|
1853
2317
|
return new ZodObject({
|
|
1854
2318
|
...this._def,
|
|
@@ -1857,9 +2321,10 @@ var ZodObject = class extends ZodType {
|
|
|
1857
2321
|
}
|
|
1858
2322
|
pick(mask) {
|
|
1859
2323
|
const shape = {};
|
|
1860
|
-
util.objectKeys(mask).
|
|
1861
|
-
if (this.shape[key])
|
|
2324
|
+
util.objectKeys(mask).forEach((key) => {
|
|
2325
|
+
if (mask[key] && this.shape[key]) {
|
|
1862
2326
|
shape[key] = this.shape[key];
|
|
2327
|
+
}
|
|
1863
2328
|
});
|
|
1864
2329
|
return new ZodObject({
|
|
1865
2330
|
...this._def,
|
|
@@ -1868,8 +2333,8 @@ var ZodObject = class extends ZodType {
|
|
|
1868
2333
|
}
|
|
1869
2334
|
omit(mask) {
|
|
1870
2335
|
const shape = {};
|
|
1871
|
-
util.objectKeys(this.shape).
|
|
1872
|
-
if (
|
|
2336
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2337
|
+
if (!mask[key]) {
|
|
1873
2338
|
shape[key] = this.shape[key];
|
|
1874
2339
|
}
|
|
1875
2340
|
});
|
|
@@ -1883,24 +2348,14 @@ var ZodObject = class extends ZodType {
|
|
|
1883
2348
|
}
|
|
1884
2349
|
partial(mask) {
|
|
1885
2350
|
const newShape = {};
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
newShape[key] = this.shape[key].optional();
|
|
1892
|
-
}
|
|
1893
|
-
});
|
|
1894
|
-
return new ZodObject({
|
|
1895
|
-
...this._def,
|
|
1896
|
-
shape: () => newShape
|
|
1897
|
-
});
|
|
1898
|
-
} else {
|
|
1899
|
-
for (const key in this.shape) {
|
|
1900
|
-
const fieldSchema = this.shape[key];
|
|
2351
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2352
|
+
const fieldSchema = this.shape[key];
|
|
2353
|
+
if (mask && !mask[key]) {
|
|
2354
|
+
newShape[key] = fieldSchema;
|
|
2355
|
+
} else {
|
|
1901
2356
|
newShape[key] = fieldSchema.optional();
|
|
1902
2357
|
}
|
|
1903
|
-
}
|
|
2358
|
+
});
|
|
1904
2359
|
return new ZodObject({
|
|
1905
2360
|
...this._def,
|
|
1906
2361
|
shape: () => newShape
|
|
@@ -1908,21 +2363,10 @@ var ZodObject = class extends ZodType {
|
|
|
1908
2363
|
}
|
|
1909
2364
|
required(mask) {
|
|
1910
2365
|
const newShape = {};
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
} else {
|
|
1916
|
-
const fieldSchema = this.shape[key];
|
|
1917
|
-
let newField = fieldSchema;
|
|
1918
|
-
while (newField instanceof ZodOptional) {
|
|
1919
|
-
newField = newField._def.innerType;
|
|
1920
|
-
}
|
|
1921
|
-
newShape[key] = newField;
|
|
1922
|
-
}
|
|
1923
|
-
});
|
|
1924
|
-
} else {
|
|
1925
|
-
for (const key in this.shape) {
|
|
2366
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
2367
|
+
if (mask && !mask[key]) {
|
|
2368
|
+
newShape[key] = this.shape[key];
|
|
2369
|
+
} else {
|
|
1926
2370
|
const fieldSchema = this.shape[key];
|
|
1927
2371
|
let newField = fieldSchema;
|
|
1928
2372
|
while (newField instanceof ZodOptional) {
|
|
@@ -1930,7 +2374,7 @@ var ZodObject = class extends ZodType {
|
|
|
1930
2374
|
}
|
|
1931
2375
|
newShape[key] = newField;
|
|
1932
2376
|
}
|
|
1933
|
-
}
|
|
2377
|
+
});
|
|
1934
2378
|
return new ZodObject({
|
|
1935
2379
|
...this._def,
|
|
1936
2380
|
shape: () => newShape
|
|
@@ -2071,15 +2515,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
|
|
|
2071
2515
|
} else if (type instanceof ZodEnum) {
|
|
2072
2516
|
return type.options;
|
|
2073
2517
|
} else if (type instanceof ZodNativeEnum) {
|
|
2074
|
-
return
|
|
2518
|
+
return util.objectValues(type.enum);
|
|
2075
2519
|
} else if (type instanceof ZodDefault) {
|
|
2076
2520
|
return getDiscriminator(type._def.innerType);
|
|
2077
2521
|
} else if (type instanceof ZodUndefined) {
|
|
2078
2522
|
return [void 0];
|
|
2079
2523
|
} else if (type instanceof ZodNull) {
|
|
2080
2524
|
return [null];
|
|
2525
|
+
} else if (type instanceof ZodOptional) {
|
|
2526
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2527
|
+
} else if (type instanceof ZodNullable) {
|
|
2528
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2529
|
+
} else if (type instanceof ZodBranded) {
|
|
2530
|
+
return getDiscriminator(type.unwrap());
|
|
2531
|
+
} else if (type instanceof ZodReadonly) {
|
|
2532
|
+
return getDiscriminator(type.unwrap());
|
|
2533
|
+
} else if (type instanceof ZodCatch) {
|
|
2534
|
+
return getDiscriminator(type._def.innerType);
|
|
2081
2535
|
} else {
|
|
2082
|
-
return
|
|
2536
|
+
return [];
|
|
2083
2537
|
}
|
|
2084
2538
|
}, "getDiscriminator");
|
|
2085
2539
|
var ZodDiscriminatedUnion = class extends ZodType {
|
|
@@ -2131,7 +2585,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2131
2585
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2132
2586
|
for (const type of options) {
|
|
2133
2587
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2134
|
-
if (!discriminatorValues) {
|
|
2588
|
+
if (!discriminatorValues.length) {
|
|
2135
2589
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2136
2590
|
}
|
|
2137
2591
|
for (const value of discriminatorValues) {
|
|
@@ -2276,7 +2730,7 @@ var ZodTuple = class extends ZodType {
|
|
|
2276
2730
|
});
|
|
2277
2731
|
status.dirty();
|
|
2278
2732
|
}
|
|
2279
|
-
const items = ctx.data.map((item, itemIndex) => {
|
|
2733
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
2280
2734
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
2281
2735
|
if (!schema)
|
|
2282
2736
|
return null;
|
|
@@ -2335,7 +2789,8 @@ var ZodRecord = class extends ZodType {
|
|
|
2335
2789
|
for (const key in ctx.data) {
|
|
2336
2790
|
pairs.push({
|
|
2337
2791
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
2338
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
2792
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
2793
|
+
alwaysSet: key in ctx.data
|
|
2339
2794
|
});
|
|
2340
2795
|
}
|
|
2341
2796
|
if (ctx.common.async) {
|
|
@@ -2366,6 +2821,12 @@ var ZodRecord = class extends ZodType {
|
|
|
2366
2821
|
};
|
|
2367
2822
|
__name(ZodRecord, "ZodRecord");
|
|
2368
2823
|
var ZodMap = class extends ZodType {
|
|
2824
|
+
get keySchema() {
|
|
2825
|
+
return this._def.keyType;
|
|
2826
|
+
}
|
|
2827
|
+
get valueSchema() {
|
|
2828
|
+
return this._def.valueType;
|
|
2829
|
+
}
|
|
2369
2830
|
_parse(input) {
|
|
2370
2831
|
const { status, ctx } = this._processInputParams(input);
|
|
2371
2832
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -2565,27 +3026,29 @@ var ZodFunction = class extends ZodType {
|
|
|
2565
3026
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
2566
3027
|
const fn = ctx.data;
|
|
2567
3028
|
if (this._def.returns instanceof ZodPromise) {
|
|
2568
|
-
|
|
3029
|
+
const me = this;
|
|
3030
|
+
return OK(async function(...args) {
|
|
2569
3031
|
const error = new ZodError([]);
|
|
2570
|
-
const parsedArgs = await
|
|
3032
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e2) => {
|
|
2571
3033
|
error.addIssue(makeArgsIssue(args, e2));
|
|
2572
3034
|
throw error;
|
|
2573
3035
|
});
|
|
2574
|
-
const result = await fn
|
|
2575
|
-
const parsedReturns = await
|
|
3036
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3037
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e2) => {
|
|
2576
3038
|
error.addIssue(makeReturnsIssue(result, e2));
|
|
2577
3039
|
throw error;
|
|
2578
3040
|
});
|
|
2579
3041
|
return parsedReturns;
|
|
2580
3042
|
});
|
|
2581
3043
|
} else {
|
|
2582
|
-
|
|
2583
|
-
|
|
3044
|
+
const me = this;
|
|
3045
|
+
return OK(function(...args) {
|
|
3046
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
2584
3047
|
if (!parsedArgs.success) {
|
|
2585
3048
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
2586
3049
|
}
|
|
2587
|
-
const result = fn
|
|
2588
|
-
const parsedReturns =
|
|
3050
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3051
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
2589
3052
|
if (!parsedReturns.success) {
|
|
2590
3053
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
2591
3054
|
}
|
|
@@ -2652,6 +3115,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
2652
3115
|
if (input.data !== this._def.value) {
|
|
2653
3116
|
const ctx = this._getOrReturnCtx(input);
|
|
2654
3117
|
addIssueToContext(ctx, {
|
|
3118
|
+
received: ctx.data,
|
|
2655
3119
|
code: ZodIssueCode.invalid_literal,
|
|
2656
3120
|
expected: this._def.value
|
|
2657
3121
|
});
|
|
@@ -2680,6 +3144,10 @@ function createZodEnum(values, params) {
|
|
|
2680
3144
|
}
|
|
2681
3145
|
__name(createZodEnum, "createZodEnum");
|
|
2682
3146
|
var ZodEnum = class extends ZodType {
|
|
3147
|
+
constructor() {
|
|
3148
|
+
super(...arguments);
|
|
3149
|
+
_ZodEnum_cache.set(this, void 0);
|
|
3150
|
+
}
|
|
2683
3151
|
_parse(input) {
|
|
2684
3152
|
if (typeof input.data !== "string") {
|
|
2685
3153
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2691,7 +3159,10 @@ var ZodEnum = class extends ZodType {
|
|
|
2691
3159
|
});
|
|
2692
3160
|
return INVALID;
|
|
2693
3161
|
}
|
|
2694
|
-
if (this
|
|
3162
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
3163
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
3164
|
+
}
|
|
3165
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
2695
3166
|
const ctx = this._getOrReturnCtx(input);
|
|
2696
3167
|
const expectedValues = this._def.values;
|
|
2697
3168
|
addIssueToContext(ctx, {
|
|
@@ -2727,10 +3198,27 @@ var ZodEnum = class extends ZodType {
|
|
|
2727
3198
|
}
|
|
2728
3199
|
return enumValues;
|
|
2729
3200
|
}
|
|
3201
|
+
extract(values, newDef = this._def) {
|
|
3202
|
+
return ZodEnum.create(values, {
|
|
3203
|
+
...this._def,
|
|
3204
|
+
...newDef
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
exclude(values, newDef = this._def) {
|
|
3208
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3209
|
+
...this._def,
|
|
3210
|
+
...newDef
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
2730
3213
|
};
|
|
2731
3214
|
__name(ZodEnum, "ZodEnum");
|
|
3215
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2732
3216
|
ZodEnum.create = createZodEnum;
|
|
2733
3217
|
var ZodNativeEnum = class extends ZodType {
|
|
3218
|
+
constructor() {
|
|
3219
|
+
super(...arguments);
|
|
3220
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
3221
|
+
}
|
|
2734
3222
|
_parse(input) {
|
|
2735
3223
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
2736
3224
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2743,7 +3231,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
2743
3231
|
});
|
|
2744
3232
|
return INVALID;
|
|
2745
3233
|
}
|
|
2746
|
-
if (
|
|
3234
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
3235
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
3236
|
+
}
|
|
3237
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
2747
3238
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
2748
3239
|
addIssueToContext(ctx, {
|
|
2749
3240
|
received: ctx.data,
|
|
@@ -2759,6 +3250,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
2759
3250
|
}
|
|
2760
3251
|
};
|
|
2761
3252
|
__name(ZodNativeEnum, "ZodNativeEnum");
|
|
3253
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
2762
3254
|
ZodNativeEnum.create = (values, params) => {
|
|
2763
3255
|
return new ZodNativeEnum({
|
|
2764
3256
|
values,
|
|
@@ -2767,6 +3259,9 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
2767
3259
|
});
|
|
2768
3260
|
};
|
|
2769
3261
|
var ZodPromise = class extends ZodType {
|
|
3262
|
+
unwrap() {
|
|
3263
|
+
return this._def.type;
|
|
3264
|
+
}
|
|
2770
3265
|
_parse(input) {
|
|
2771
3266
|
const { ctx } = this._processInputParams(input);
|
|
2772
3267
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -2804,24 +3299,6 @@ var ZodEffects = class extends ZodType {
|
|
|
2804
3299
|
_parse(input) {
|
|
2805
3300
|
const { status, ctx } = this._processInputParams(input);
|
|
2806
3301
|
const effect = this._def.effect || null;
|
|
2807
|
-
if (effect.type === "preprocess") {
|
|
2808
|
-
const processed = effect.transform(ctx.data);
|
|
2809
|
-
if (ctx.common.async) {
|
|
2810
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
2811
|
-
return this._def.schema._parseAsync({
|
|
2812
|
-
data: processed2,
|
|
2813
|
-
path: ctx.path,
|
|
2814
|
-
parent: ctx
|
|
2815
|
-
});
|
|
2816
|
-
});
|
|
2817
|
-
} else {
|
|
2818
|
-
return this._def.schema._parseSync({
|
|
2819
|
-
data: processed,
|
|
2820
|
-
path: ctx.path,
|
|
2821
|
-
parent: ctx
|
|
2822
|
-
});
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
3302
|
const checkCtx = {
|
|
2826
3303
|
addIssue: (arg) => {
|
|
2827
3304
|
addIssueToContext(ctx, arg);
|
|
@@ -2836,6 +3313,42 @@ var ZodEffects = class extends ZodType {
|
|
|
2836
3313
|
}
|
|
2837
3314
|
};
|
|
2838
3315
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3316
|
+
if (effect.type === "preprocess") {
|
|
3317
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3318
|
+
if (ctx.common.async) {
|
|
3319
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3320
|
+
if (status.value === "aborted")
|
|
3321
|
+
return INVALID;
|
|
3322
|
+
const result = await this._def.schema._parseAsync({
|
|
3323
|
+
data: processed2,
|
|
3324
|
+
path: ctx.path,
|
|
3325
|
+
parent: ctx
|
|
3326
|
+
});
|
|
3327
|
+
if (result.status === "aborted")
|
|
3328
|
+
return INVALID;
|
|
3329
|
+
if (result.status === "dirty")
|
|
3330
|
+
return DIRTY(result.value);
|
|
3331
|
+
if (status.value === "dirty")
|
|
3332
|
+
return DIRTY(result.value);
|
|
3333
|
+
return result;
|
|
3334
|
+
});
|
|
3335
|
+
} else {
|
|
3336
|
+
if (status.value === "aborted")
|
|
3337
|
+
return INVALID;
|
|
3338
|
+
const result = this._def.schema._parseSync({
|
|
3339
|
+
data: processed,
|
|
3340
|
+
path: ctx.path,
|
|
3341
|
+
parent: ctx
|
|
3342
|
+
});
|
|
3343
|
+
if (result.status === "aborted")
|
|
3344
|
+
return INVALID;
|
|
3345
|
+
if (result.status === "dirty")
|
|
3346
|
+
return DIRTY(result.value);
|
|
3347
|
+
if (status.value === "dirty")
|
|
3348
|
+
return DIRTY(result.value);
|
|
3349
|
+
return result;
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
2839
3352
|
if (effect.type === "refinement") {
|
|
2840
3353
|
const executeRefinement = /* @__PURE__ */ __name((acc) => {
|
|
2841
3354
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -2982,26 +3495,45 @@ ZodDefault.create = (type, params) => {
|
|
|
2982
3495
|
var ZodCatch = class extends ZodType {
|
|
2983
3496
|
_parse(input) {
|
|
2984
3497
|
const { ctx } = this._processInputParams(input);
|
|
3498
|
+
const newCtx = {
|
|
3499
|
+
...ctx,
|
|
3500
|
+
common: {
|
|
3501
|
+
...ctx.common,
|
|
3502
|
+
issues: []
|
|
3503
|
+
}
|
|
3504
|
+
};
|
|
2985
3505
|
const result = this._def.innerType._parse({
|
|
2986
|
-
data:
|
|
2987
|
-
path:
|
|
2988
|
-
parent:
|
|
3506
|
+
data: newCtx.data,
|
|
3507
|
+
path: newCtx.path,
|
|
3508
|
+
parent: {
|
|
3509
|
+
...newCtx
|
|
3510
|
+
}
|
|
2989
3511
|
});
|
|
2990
3512
|
if (isAsync(result)) {
|
|
2991
3513
|
return result.then((result2) => {
|
|
2992
3514
|
return {
|
|
2993
3515
|
status: "valid",
|
|
2994
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
3516
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
3517
|
+
get error() {
|
|
3518
|
+
return new ZodError(newCtx.common.issues);
|
|
3519
|
+
},
|
|
3520
|
+
input: newCtx.data
|
|
3521
|
+
})
|
|
2995
3522
|
};
|
|
2996
3523
|
});
|
|
2997
3524
|
} else {
|
|
2998
3525
|
return {
|
|
2999
3526
|
status: "valid",
|
|
3000
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
3527
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
3528
|
+
get error() {
|
|
3529
|
+
return new ZodError(newCtx.common.issues);
|
|
3530
|
+
},
|
|
3531
|
+
input: newCtx.data
|
|
3532
|
+
})
|
|
3001
3533
|
};
|
|
3002
3534
|
}
|
|
3003
3535
|
}
|
|
3004
|
-
|
|
3536
|
+
removeCatch() {
|
|
3005
3537
|
return this._def.innerType;
|
|
3006
3538
|
}
|
|
3007
3539
|
};
|
|
@@ -3010,7 +3542,7 @@ ZodCatch.create = (type, params) => {
|
|
|
3010
3542
|
return new ZodCatch({
|
|
3011
3543
|
innerType: type,
|
|
3012
3544
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
3013
|
-
|
|
3545
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
3014
3546
|
...processCreateParams(params)
|
|
3015
3547
|
});
|
|
3016
3548
|
};
|
|
@@ -3108,17 +3640,43 @@ var ZodPipeline = class extends ZodType {
|
|
|
3108
3640
|
}
|
|
3109
3641
|
};
|
|
3110
3642
|
__name(ZodPipeline, "ZodPipeline");
|
|
3111
|
-
var
|
|
3643
|
+
var ZodReadonly = class extends ZodType {
|
|
3644
|
+
_parse(input) {
|
|
3645
|
+
const result = this._def.innerType._parse(input);
|
|
3646
|
+
const freeze = /* @__PURE__ */ __name((data) => {
|
|
3647
|
+
if (isValid(data)) {
|
|
3648
|
+
data.value = Object.freeze(data.value);
|
|
3649
|
+
}
|
|
3650
|
+
return data;
|
|
3651
|
+
}, "freeze");
|
|
3652
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3653
|
+
}
|
|
3654
|
+
unwrap() {
|
|
3655
|
+
return this._def.innerType;
|
|
3656
|
+
}
|
|
3657
|
+
};
|
|
3658
|
+
__name(ZodReadonly, "ZodReadonly");
|
|
3659
|
+
ZodReadonly.create = (type, params) => {
|
|
3660
|
+
return new ZodReadonly({
|
|
3661
|
+
innerType: type,
|
|
3662
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3663
|
+
...processCreateParams(params)
|
|
3664
|
+
});
|
|
3665
|
+
};
|
|
3666
|
+
function custom(check, params = {}, fatal) {
|
|
3112
3667
|
if (check)
|
|
3113
3668
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3669
|
+
var _a, _b;
|
|
3114
3670
|
if (!check(data)) {
|
|
3115
|
-
const p = typeof params === "function" ? params(data) : params;
|
|
3671
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3672
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3116
3673
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3117
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
|
3674
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3118
3675
|
}
|
|
3119
3676
|
});
|
|
3120
3677
|
return ZodAny.create();
|
|
3121
|
-
}
|
|
3678
|
+
}
|
|
3679
|
+
__name(custom, "custom");
|
|
3122
3680
|
var late = {
|
|
3123
3681
|
object: ZodObject.lazycreate
|
|
3124
3682
|
};
|
|
@@ -3159,10 +3717,11 @@ var ZodFirstPartyTypeKind;
|
|
|
3159
3717
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3160
3718
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3161
3719
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3720
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3162
3721
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3163
3722
|
var instanceOfType = /* @__PURE__ */ __name((cls, params = {
|
|
3164
3723
|
message: `Input not instance of ${cls.name}`
|
|
3165
|
-
}) => custom((data) => data instanceof cls, params
|
|
3724
|
+
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
|
3166
3725
|
var stringType = ZodString.create;
|
|
3167
3726
|
var numberType = ZodNumber.create;
|
|
3168
3727
|
var nanType = ZodNaN.create;
|
|
@@ -3203,12 +3762,15 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
|
|
|
3203
3762
|
var coerce = {
|
|
3204
3763
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
3205
3764
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
3206
|
-
boolean: (arg) => ZodBoolean.create({
|
|
3765
|
+
boolean: (arg) => ZodBoolean.create({
|
|
3766
|
+
...arg,
|
|
3767
|
+
coerce: true
|
|
3768
|
+
}),
|
|
3207
3769
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
3208
3770
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3209
3771
|
};
|
|
3210
3772
|
var NEVER = INVALID;
|
|
3211
|
-
var
|
|
3773
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
3212
3774
|
__proto__: null,
|
|
3213
3775
|
defaultErrorMap: errorMap,
|
|
3214
3776
|
setErrorMap,
|
|
@@ -3227,9 +3789,13 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3227
3789
|
get util() {
|
|
3228
3790
|
return util;
|
|
3229
3791
|
},
|
|
3792
|
+
get objectUtil() {
|
|
3793
|
+
return objectUtil;
|
|
3794
|
+
},
|
|
3230
3795
|
ZodParsedType,
|
|
3231
3796
|
getParsedType,
|
|
3232
3797
|
ZodType,
|
|
3798
|
+
datetimeRegex,
|
|
3233
3799
|
ZodString,
|
|
3234
3800
|
ZodNumber,
|
|
3235
3801
|
ZodBigInt,
|
|
@@ -3243,9 +3809,6 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3243
3809
|
ZodNever,
|
|
3244
3810
|
ZodVoid,
|
|
3245
3811
|
ZodArray,
|
|
3246
|
-
get objectUtil() {
|
|
3247
|
-
return objectUtil;
|
|
3248
|
-
},
|
|
3249
3812
|
ZodObject,
|
|
3250
3813
|
ZodUnion,
|
|
3251
3814
|
ZodDiscriminatedUnion,
|
|
@@ -3270,6 +3833,7 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3270
3833
|
BRAND,
|
|
3271
3834
|
ZodBranded,
|
|
3272
3835
|
ZodPipeline,
|
|
3836
|
+
ZodReadonly,
|
|
3273
3837
|
custom,
|
|
3274
3838
|
Schema: ZodType,
|
|
3275
3839
|
ZodSchema: ZodType,
|
|
@@ -3323,38 +3887,140 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
3323
3887
|
ZodError
|
|
3324
3888
|
});
|
|
3325
3889
|
|
|
3890
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZodSymbols.chunk.mjs
|
|
3891
|
+
var currentSymbol = Symbol("current");
|
|
3892
|
+
var previousSymbol = Symbol("previous");
|
|
3893
|
+
|
|
3894
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZod.chunk.mjs
|
|
3895
|
+
var mergeOpenApi = /* @__PURE__ */ __name((openapi, {
|
|
3896
|
+
ref: _ref,
|
|
3897
|
+
refType: _refType,
|
|
3898
|
+
param: _param,
|
|
3899
|
+
header: _header,
|
|
3900
|
+
...rest
|
|
3901
|
+
} = {}) => ({
|
|
3902
|
+
...rest,
|
|
3903
|
+
...openapi
|
|
3904
|
+
}), "mergeOpenApi");
|
|
3905
|
+
function extendZodWithOpenApi(zod) {
|
|
3906
|
+
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3909
|
+
zod.ZodType.prototype.openapi = function(openapi) {
|
|
3910
|
+
const { zodOpenApi, ...rest } = this._def;
|
|
3911
|
+
const result = new this.constructor({
|
|
3912
|
+
...rest,
|
|
3913
|
+
zodOpenApi: {
|
|
3914
|
+
openapi: mergeOpenApi(
|
|
3915
|
+
openapi,
|
|
3916
|
+
zodOpenApi == null ? void 0 : zodOpenApi.openapi
|
|
3917
|
+
)
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
result._def.zodOpenApi[currentSymbol] = result;
|
|
3921
|
+
if (zodOpenApi) {
|
|
3922
|
+
result._def.zodOpenApi[previousSymbol] = this;
|
|
3923
|
+
}
|
|
3924
|
+
return result;
|
|
3925
|
+
};
|
|
3926
|
+
const zodDescribe = zod.ZodType.prototype.describe;
|
|
3927
|
+
zod.ZodType.prototype.describe = function(...args) {
|
|
3928
|
+
const result = zodDescribe.apply(this, args);
|
|
3929
|
+
const def = result._def;
|
|
3930
|
+
if (def.zodOpenApi) {
|
|
3931
|
+
const cloned = { ...def.zodOpenApi };
|
|
3932
|
+
cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
|
|
3933
|
+
cloned[previousSymbol] = this;
|
|
3934
|
+
cloned[currentSymbol] = result;
|
|
3935
|
+
def.zodOpenApi = cloned;
|
|
3936
|
+
} else {
|
|
3937
|
+
def.zodOpenApi = {
|
|
3938
|
+
openapi: { description: args[0] },
|
|
3939
|
+
[currentSymbol]: result
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3942
|
+
return result;
|
|
3943
|
+
};
|
|
3944
|
+
const zodObjectExtend = zod.ZodObject.prototype.extend;
|
|
3945
|
+
zod.ZodObject.prototype.extend = function(...args) {
|
|
3946
|
+
const extendResult = zodObjectExtend.apply(this, args);
|
|
3947
|
+
const zodOpenApi = extendResult._def.zodOpenApi;
|
|
3948
|
+
if (zodOpenApi) {
|
|
3949
|
+
const cloned = { ...zodOpenApi };
|
|
3950
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
3951
|
+
cloned[previousSymbol] = this;
|
|
3952
|
+
extendResult._def.zodOpenApi = cloned;
|
|
3953
|
+
} else {
|
|
3954
|
+
extendResult._def.zodOpenApi = {
|
|
3955
|
+
[previousSymbol]: this
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
return extendResult;
|
|
3959
|
+
};
|
|
3960
|
+
const zodObjectOmit = zod.ZodObject.prototype.omit;
|
|
3961
|
+
zod.ZodObject.prototype.omit = function(...args) {
|
|
3962
|
+
const omitResult = zodObjectOmit.apply(this, args);
|
|
3963
|
+
const zodOpenApi = omitResult._def.zodOpenApi;
|
|
3964
|
+
if (zodOpenApi) {
|
|
3965
|
+
const cloned = { ...zodOpenApi };
|
|
3966
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
3967
|
+
delete cloned[previousSymbol];
|
|
3968
|
+
delete cloned[currentSymbol];
|
|
3969
|
+
omitResult._def.zodOpenApi = cloned;
|
|
3970
|
+
}
|
|
3971
|
+
return omitResult;
|
|
3972
|
+
};
|
|
3973
|
+
const zodObjectPick = zod.ZodObject.prototype.pick;
|
|
3974
|
+
zod.ZodObject.prototype.pick = function(...args) {
|
|
3975
|
+
const pickResult = zodObjectPick.apply(this, args);
|
|
3976
|
+
const zodOpenApi = pickResult._def.zodOpenApi;
|
|
3977
|
+
if (zodOpenApi) {
|
|
3978
|
+
const cloned = { ...zodOpenApi };
|
|
3979
|
+
cloned.openapi = mergeOpenApi({}, cloned.openapi);
|
|
3980
|
+
delete cloned[previousSymbol];
|
|
3981
|
+
delete cloned[currentSymbol];
|
|
3982
|
+
pickResult._def.zodOpenApi = cloned;
|
|
3983
|
+
}
|
|
3984
|
+
return pickResult;
|
|
3985
|
+
};
|
|
3986
|
+
}
|
|
3987
|
+
__name(extendZodWithOpenApi, "extendZodWithOpenApi");
|
|
3988
|
+
|
|
3989
|
+
// ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extend.mjs
|
|
3990
|
+
extendZodWithOpenApi(z);
|
|
3991
|
+
|
|
3326
3992
|
// ../../learn-card-types/dist/types.esm.js
|
|
3327
3993
|
var __defProp2 = Object.defineProperty;
|
|
3328
3994
|
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
3329
|
-
var ContextValidator =
|
|
3330
|
-
var AchievementCriteriaValidator =
|
|
3331
|
-
type:
|
|
3332
|
-
narrative:
|
|
3995
|
+
var ContextValidator = z.array(z.string().or(z.record(z.any())));
|
|
3996
|
+
var AchievementCriteriaValidator = z.object({
|
|
3997
|
+
type: z.string().optional(),
|
|
3998
|
+
narrative: z.string().optional()
|
|
3333
3999
|
});
|
|
3334
|
-
var ImageValidator =
|
|
3335
|
-
|
|
3336
|
-
id:
|
|
3337
|
-
type:
|
|
3338
|
-
caption:
|
|
4000
|
+
var ImageValidator = z.string().or(
|
|
4001
|
+
z.object({
|
|
4002
|
+
id: z.string(),
|
|
4003
|
+
type: z.string(),
|
|
4004
|
+
caption: z.string().optional()
|
|
3339
4005
|
})
|
|
3340
4006
|
);
|
|
3341
|
-
var GeoCoordinatesValidator =
|
|
3342
|
-
type:
|
|
3343
|
-
latitude:
|
|
3344
|
-
longitude:
|
|
4007
|
+
var GeoCoordinatesValidator = z.object({
|
|
4008
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4009
|
+
latitude: z.number(),
|
|
4010
|
+
longitude: z.number()
|
|
3345
4011
|
});
|
|
3346
|
-
var AddressValidator =
|
|
3347
|
-
type:
|
|
3348
|
-
addressCountry:
|
|
3349
|
-
addressCountryCode:
|
|
3350
|
-
addressRegion:
|
|
3351
|
-
addressLocality:
|
|
3352
|
-
streetAddress:
|
|
3353
|
-
postOfficeBoxNumber:
|
|
3354
|
-
postalCode:
|
|
4012
|
+
var AddressValidator = z.object({
|
|
4013
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4014
|
+
addressCountry: z.string().optional(),
|
|
4015
|
+
addressCountryCode: z.string().optional(),
|
|
4016
|
+
addressRegion: z.string().optional(),
|
|
4017
|
+
addressLocality: z.string().optional(),
|
|
4018
|
+
streetAddress: z.string().optional(),
|
|
4019
|
+
postOfficeBoxNumber: z.string().optional(),
|
|
4020
|
+
postalCode: z.string().optional(),
|
|
3355
4021
|
geo: GeoCoordinatesValidator.optional()
|
|
3356
4022
|
});
|
|
3357
|
-
var IdentifierTypeValidator =
|
|
4023
|
+
var IdentifierTypeValidator = z.enum([
|
|
3358
4024
|
"sourcedId",
|
|
3359
4025
|
"systemId",
|
|
3360
4026
|
"productId",
|
|
@@ -3373,140 +4039,140 @@ var IdentifierTypeValidator = mod.enum([
|
|
|
3373
4039
|
"ltiPlatformId",
|
|
3374
4040
|
"ltiUserId",
|
|
3375
4041
|
"identifier"
|
|
3376
|
-
]).or(
|
|
3377
|
-
var IdentifierEntryValidator =
|
|
3378
|
-
type:
|
|
3379
|
-
identifier:
|
|
4042
|
+
]).or(z.string());
|
|
4043
|
+
var IdentifierEntryValidator = z.object({
|
|
4044
|
+
type: z.string().min(1).or(z.string().array().nonempty()),
|
|
4045
|
+
identifier: z.string(),
|
|
3380
4046
|
identifierType: IdentifierTypeValidator
|
|
3381
4047
|
});
|
|
3382
|
-
var ProfileValidator =
|
|
3383
|
-
|
|
3384
|
-
id:
|
|
3385
|
-
type:
|
|
3386
|
-
name:
|
|
3387
|
-
url:
|
|
3388
|
-
phone:
|
|
3389
|
-
description:
|
|
3390
|
-
endorsement:
|
|
4048
|
+
var ProfileValidator = z.string().or(
|
|
4049
|
+
z.object({
|
|
4050
|
+
id: z.string().optional(),
|
|
4051
|
+
type: z.string().or(z.string().array().nonempty().optional()),
|
|
4052
|
+
name: z.string().optional(),
|
|
4053
|
+
url: z.string().optional(),
|
|
4054
|
+
phone: z.string().optional(),
|
|
4055
|
+
description: z.string().optional(),
|
|
4056
|
+
endorsement: z.any().array().optional(),
|
|
3391
4057
|
image: ImageValidator.optional(),
|
|
3392
|
-
email:
|
|
4058
|
+
email: z.string().email().optional(),
|
|
3393
4059
|
address: AddressValidator.optional(),
|
|
3394
4060
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3395
|
-
official:
|
|
3396
|
-
parentOrg:
|
|
3397
|
-
familyName:
|
|
3398
|
-
givenName:
|
|
3399
|
-
additionalName:
|
|
3400
|
-
patronymicName:
|
|
3401
|
-
honorificPrefix:
|
|
3402
|
-
honorificSuffix:
|
|
3403
|
-
familyNamePrefix:
|
|
3404
|
-
dateOfBirth:
|
|
3405
|
-
}).catchall(
|
|
4061
|
+
official: z.string().optional(),
|
|
4062
|
+
parentOrg: z.any().optional(),
|
|
4063
|
+
familyName: z.string().optional(),
|
|
4064
|
+
givenName: z.string().optional(),
|
|
4065
|
+
additionalName: z.string().optional(),
|
|
4066
|
+
patronymicName: z.string().optional(),
|
|
4067
|
+
honorificPrefix: z.string().optional(),
|
|
4068
|
+
honorificSuffix: z.string().optional(),
|
|
4069
|
+
familyNamePrefix: z.string().optional(),
|
|
4070
|
+
dateOfBirth: z.string().optional()
|
|
4071
|
+
}).catchall(z.any())
|
|
3406
4072
|
);
|
|
3407
|
-
var CredentialSubjectValidator =
|
|
3408
|
-
var CredentialStatusValidator =
|
|
3409
|
-
var CredentialSchemaValidator =
|
|
3410
|
-
var RefreshServiceValidator =
|
|
3411
|
-
var TermsOfUseValidator =
|
|
3412
|
-
var VC2EvidenceValidator =
|
|
3413
|
-
var UnsignedVCValidator =
|
|
4073
|
+
var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
|
|
4074
|
+
var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
|
|
4075
|
+
var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
|
|
4076
|
+
var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
|
|
4077
|
+
var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
|
|
4078
|
+
var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
|
|
4079
|
+
var UnsignedVCValidator = z.object({
|
|
3414
4080
|
"@context": ContextValidator,
|
|
3415
|
-
id:
|
|
3416
|
-
type:
|
|
4081
|
+
id: z.string().optional(),
|
|
4082
|
+
type: z.string().array().nonempty(),
|
|
3417
4083
|
issuer: ProfileValidator,
|
|
3418
4084
|
credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
|
|
3419
4085
|
refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
|
|
3420
4086
|
credentialSchema: CredentialSchemaValidator.or(
|
|
3421
4087
|
CredentialSchemaValidator.array()
|
|
3422
4088
|
).optional(),
|
|
3423
|
-
issuanceDate:
|
|
3424
|
-
expirationDate:
|
|
4089
|
+
issuanceDate: z.string().optional(),
|
|
4090
|
+
expirationDate: z.string().optional(),
|
|
3425
4091
|
credentialStatus: CredentialStatusValidator.or(
|
|
3426
4092
|
CredentialStatusValidator.array()
|
|
3427
4093
|
).optional(),
|
|
3428
|
-
name:
|
|
3429
|
-
description:
|
|
3430
|
-
validFrom:
|
|
3431
|
-
validUntil:
|
|
4094
|
+
name: z.string().optional(),
|
|
4095
|
+
description: z.string().optional(),
|
|
4096
|
+
validFrom: z.string().optional(),
|
|
4097
|
+
validUntil: z.string().optional(),
|
|
3432
4098
|
status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
|
|
3433
4099
|
termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
|
|
3434
4100
|
evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
|
|
3435
|
-
}).catchall(
|
|
3436
|
-
var ProofValidator =
|
|
3437
|
-
type:
|
|
3438
|
-
created:
|
|
3439
|
-
challenge:
|
|
3440
|
-
domain:
|
|
3441
|
-
nonce:
|
|
3442
|
-
proofPurpose:
|
|
3443
|
-
verificationMethod:
|
|
3444
|
-
jws:
|
|
3445
|
-
}).catchall(
|
|
4101
|
+
}).catchall(z.any());
|
|
4102
|
+
var ProofValidator = z.object({
|
|
4103
|
+
type: z.string(),
|
|
4104
|
+
created: z.string(),
|
|
4105
|
+
challenge: z.string().optional(),
|
|
4106
|
+
domain: z.string().optional(),
|
|
4107
|
+
nonce: z.string().optional(),
|
|
4108
|
+
proofPurpose: z.string(),
|
|
4109
|
+
verificationMethod: z.string(),
|
|
4110
|
+
jws: z.string().optional()
|
|
4111
|
+
}).catchall(z.any());
|
|
3446
4112
|
var VCValidator = UnsignedVCValidator.extend({
|
|
3447
4113
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3448
4114
|
});
|
|
3449
|
-
var UnsignedVPValidator =
|
|
4115
|
+
var UnsignedVPValidator = z.object({
|
|
3450
4116
|
"@context": ContextValidator,
|
|
3451
|
-
id:
|
|
3452
|
-
type:
|
|
4117
|
+
id: z.string().optional(),
|
|
4118
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
3453
4119
|
verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
|
|
3454
|
-
holder:
|
|
3455
|
-
}).catchall(
|
|
4120
|
+
holder: z.string().optional()
|
|
4121
|
+
}).catchall(z.any());
|
|
3456
4122
|
var VPValidator = UnsignedVPValidator.extend({
|
|
3457
4123
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3458
4124
|
});
|
|
3459
|
-
var JWKValidator =
|
|
3460
|
-
kty:
|
|
3461
|
-
crv:
|
|
3462
|
-
x:
|
|
3463
|
-
y:
|
|
3464
|
-
n:
|
|
3465
|
-
d:
|
|
4125
|
+
var JWKValidator = z.object({
|
|
4126
|
+
kty: z.string(),
|
|
4127
|
+
crv: z.string(),
|
|
4128
|
+
x: z.string(),
|
|
4129
|
+
y: z.string().optional(),
|
|
4130
|
+
n: z.string().optional(),
|
|
4131
|
+
d: z.string().optional()
|
|
3466
4132
|
});
|
|
3467
|
-
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d:
|
|
3468
|
-
var JWERecipientHeaderValidator =
|
|
3469
|
-
alg:
|
|
3470
|
-
iv:
|
|
3471
|
-
tag:
|
|
4133
|
+
var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
|
|
4134
|
+
var JWERecipientHeaderValidator = z.object({
|
|
4135
|
+
alg: z.string(),
|
|
4136
|
+
iv: z.string(),
|
|
4137
|
+
tag: z.string(),
|
|
3472
4138
|
epk: JWKValidator.partial().optional(),
|
|
3473
|
-
kid:
|
|
3474
|
-
apv:
|
|
3475
|
-
apu:
|
|
4139
|
+
kid: z.string().optional(),
|
|
4140
|
+
apv: z.string().optional(),
|
|
4141
|
+
apu: z.string().optional()
|
|
3476
4142
|
});
|
|
3477
|
-
var JWERecipientValidator =
|
|
4143
|
+
var JWERecipientValidator = z.object({
|
|
3478
4144
|
header: JWERecipientHeaderValidator,
|
|
3479
|
-
encrypted_key:
|
|
4145
|
+
encrypted_key: z.string()
|
|
3480
4146
|
});
|
|
3481
|
-
var JWEValidator =
|
|
3482
|
-
protected:
|
|
3483
|
-
iv:
|
|
3484
|
-
ciphertext:
|
|
3485
|
-
tag:
|
|
3486
|
-
aad:
|
|
4147
|
+
var JWEValidator = z.object({
|
|
4148
|
+
protected: z.string(),
|
|
4149
|
+
iv: z.string(),
|
|
4150
|
+
ciphertext: z.string(),
|
|
4151
|
+
tag: z.string(),
|
|
4152
|
+
aad: z.string().optional(),
|
|
3487
4153
|
recipients: JWERecipientValidator.array().optional()
|
|
3488
4154
|
});
|
|
3489
|
-
var VerificationMethodValidator =
|
|
3490
|
-
|
|
4155
|
+
var VerificationMethodValidator = z.string().or(
|
|
4156
|
+
z.object({
|
|
3491
4157
|
"@context": ContextValidator.optional(),
|
|
3492
|
-
id:
|
|
3493
|
-
type:
|
|
3494
|
-
controller:
|
|
4158
|
+
id: z.string(),
|
|
4159
|
+
type: z.string(),
|
|
4160
|
+
controller: z.string(),
|
|
3495
4161
|
publicKeyJwk: JWKValidator.optional(),
|
|
3496
|
-
publicKeyBase58:
|
|
3497
|
-
blockChainAccountId:
|
|
3498
|
-
}).catchall(
|
|
4162
|
+
publicKeyBase58: z.string().optional(),
|
|
4163
|
+
blockChainAccountId: z.string().optional()
|
|
4164
|
+
}).catchall(z.any())
|
|
3499
4165
|
);
|
|
3500
|
-
var ServiceValidator =
|
|
3501
|
-
id:
|
|
3502
|
-
type:
|
|
3503
|
-
serviceEndpoint:
|
|
3504
|
-
}).catchall(
|
|
3505
|
-
var DidDocumentValidator =
|
|
4166
|
+
var ServiceValidator = z.object({
|
|
4167
|
+
id: z.string(),
|
|
4168
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4169
|
+
serviceEndpoint: z.any().or(z.any().array().nonempty())
|
|
4170
|
+
}).catchall(z.any());
|
|
4171
|
+
var DidDocumentValidator = z.object({
|
|
3506
4172
|
"@context": ContextValidator,
|
|
3507
|
-
id:
|
|
3508
|
-
alsoKnownAs:
|
|
3509
|
-
controller:
|
|
4173
|
+
id: z.string(),
|
|
4174
|
+
alsoKnownAs: z.string().optional(),
|
|
4175
|
+
controller: z.string().or(z.string().array().nonempty()).optional(),
|
|
3510
4176
|
verificationMethod: VerificationMethodValidator.array().optional(),
|
|
3511
4177
|
authentication: VerificationMethodValidator.array().optional(),
|
|
3512
4178
|
assertionMethod: VerificationMethodValidator.array().optional(),
|
|
@@ -3516,8 +4182,8 @@ var DidDocumentValidator = mod.object({
|
|
|
3516
4182
|
publicKey: VerificationMethodValidator.array().optional(),
|
|
3517
4183
|
service: ServiceValidator.array().optional(),
|
|
3518
4184
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3519
|
-
}).catchall(
|
|
3520
|
-
var AlignmentTargetTypeValidator =
|
|
4185
|
+
}).catchall(z.any());
|
|
4186
|
+
var AlignmentTargetTypeValidator = z.enum([
|
|
3521
4187
|
"ceasn:Competency",
|
|
3522
4188
|
"ceterms:Credential",
|
|
3523
4189
|
"CFItem",
|
|
@@ -3525,17 +4191,17 @@ var AlignmentTargetTypeValidator = mod.enum([
|
|
|
3525
4191
|
"CFRubricCriterion",
|
|
3526
4192
|
"CFRubricCriterionLevel",
|
|
3527
4193
|
"CTDL"
|
|
3528
|
-
]).or(
|
|
3529
|
-
var AlignmentValidator =
|
|
3530
|
-
type:
|
|
3531
|
-
targetCode:
|
|
3532
|
-
targetDescription:
|
|
3533
|
-
targetName:
|
|
3534
|
-
targetFramework:
|
|
4194
|
+
]).or(z.string());
|
|
4195
|
+
var AlignmentValidator = z.object({
|
|
4196
|
+
type: z.string().array().nonempty(),
|
|
4197
|
+
targetCode: z.string().optional(),
|
|
4198
|
+
targetDescription: z.string().optional(),
|
|
4199
|
+
targetName: z.string(),
|
|
4200
|
+
targetFramework: z.string().optional(),
|
|
3535
4201
|
targetType: AlignmentTargetTypeValidator.optional(),
|
|
3536
|
-
targetUrl:
|
|
4202
|
+
targetUrl: z.string()
|
|
3537
4203
|
});
|
|
3538
|
-
var KnownAchievementTypeValidator =
|
|
4204
|
+
var KnownAchievementTypeValidator = z.enum([
|
|
3539
4205
|
"Achievement",
|
|
3540
4206
|
"ApprenticeshipCertificate",
|
|
3541
4207
|
"Assessment",
|
|
@@ -3568,23 +4234,23 @@ var KnownAchievementTypeValidator = mod.enum([
|
|
|
3568
4234
|
"ResearchDoctorate",
|
|
3569
4235
|
"SecondarySchoolDiploma"
|
|
3570
4236
|
]);
|
|
3571
|
-
var AchievementTypeValidator = KnownAchievementTypeValidator.or(
|
|
3572
|
-
var CriteriaValidator =
|
|
3573
|
-
var EndorsementSubjectValidator =
|
|
3574
|
-
id:
|
|
3575
|
-
type:
|
|
3576
|
-
endorsementComment:
|
|
4237
|
+
var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
|
|
4238
|
+
var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
|
|
4239
|
+
var EndorsementSubjectValidator = z.object({
|
|
4240
|
+
id: z.string(),
|
|
4241
|
+
type: z.string().array().nonempty(),
|
|
4242
|
+
endorsementComment: z.string().optional()
|
|
3577
4243
|
});
|
|
3578
4244
|
var EndorsementCredentialValidator = UnsignedVCValidator.extend({
|
|
3579
4245
|
credentialSubject: EndorsementSubjectValidator,
|
|
3580
4246
|
proof: ProofValidator.or(ProofValidator.array()).optional()
|
|
3581
4247
|
});
|
|
3582
|
-
var RelatedValidator =
|
|
3583
|
-
id:
|
|
3584
|
-
"@language":
|
|
3585
|
-
version:
|
|
4248
|
+
var RelatedValidator = z.object({
|
|
4249
|
+
id: z.string(),
|
|
4250
|
+
"@language": z.string().optional(),
|
|
4251
|
+
version: z.string().optional()
|
|
3586
4252
|
});
|
|
3587
|
-
var ResultTypeValidator =
|
|
4253
|
+
var ResultTypeValidator = z.enum([
|
|
3588
4254
|
"GradePointAverage",
|
|
3589
4255
|
"LetterGrade",
|
|
3590
4256
|
"Percent",
|
|
@@ -3597,59 +4263,59 @@ var ResultTypeValidator = mod.enum([
|
|
|
3597
4263
|
"RubricScore",
|
|
3598
4264
|
"ScaledScore",
|
|
3599
4265
|
"Status"
|
|
3600
|
-
]).or(
|
|
3601
|
-
var RubricCriterionValidator =
|
|
3602
|
-
id:
|
|
3603
|
-
type:
|
|
4266
|
+
]).or(z.string());
|
|
4267
|
+
var RubricCriterionValidator = z.object({
|
|
4268
|
+
id: z.string(),
|
|
4269
|
+
type: z.string().array().nonempty(),
|
|
3604
4270
|
alignment: AlignmentValidator.array().optional(),
|
|
3605
|
-
description:
|
|
3606
|
-
level:
|
|
3607
|
-
name:
|
|
3608
|
-
points:
|
|
3609
|
-
}).catchall(
|
|
3610
|
-
var ResultDescriptionValidator =
|
|
3611
|
-
id:
|
|
3612
|
-
type:
|
|
4271
|
+
description: z.string().optional(),
|
|
4272
|
+
level: z.string().optional(),
|
|
4273
|
+
name: z.string(),
|
|
4274
|
+
points: z.string().optional()
|
|
4275
|
+
}).catchall(z.any());
|
|
4276
|
+
var ResultDescriptionValidator = z.object({
|
|
4277
|
+
id: z.string(),
|
|
4278
|
+
type: z.string().array().nonempty(),
|
|
3613
4279
|
alignment: AlignmentValidator.array().optional(),
|
|
3614
|
-
allowedValue:
|
|
3615
|
-
name:
|
|
3616
|
-
requiredLevel:
|
|
3617
|
-
requiredValue:
|
|
4280
|
+
allowedValue: z.string().array().optional(),
|
|
4281
|
+
name: z.string(),
|
|
4282
|
+
requiredLevel: z.string().optional(),
|
|
4283
|
+
requiredValue: z.string().optional(),
|
|
3618
4284
|
resultType: ResultTypeValidator,
|
|
3619
4285
|
rubricCriterionLevel: RubricCriterionValidator.array().optional(),
|
|
3620
|
-
valueMax:
|
|
3621
|
-
valueMin:
|
|
3622
|
-
}).catchall(
|
|
3623
|
-
var AchievementValidator =
|
|
3624
|
-
id:
|
|
3625
|
-
type:
|
|
4286
|
+
valueMax: z.string().optional(),
|
|
4287
|
+
valueMin: z.string().optional()
|
|
4288
|
+
}).catchall(z.any());
|
|
4289
|
+
var AchievementValidator = z.object({
|
|
4290
|
+
id: z.string().optional(),
|
|
4291
|
+
type: z.string().array().nonempty(),
|
|
3626
4292
|
alignment: AlignmentValidator.array().optional(),
|
|
3627
4293
|
achievementType: AchievementTypeValidator.optional(),
|
|
3628
4294
|
creator: ProfileValidator.optional(),
|
|
3629
|
-
creditsAvailable:
|
|
4295
|
+
creditsAvailable: z.number().optional(),
|
|
3630
4296
|
criteria: CriteriaValidator,
|
|
3631
|
-
description:
|
|
4297
|
+
description: z.string(),
|
|
3632
4298
|
endorsement: EndorsementCredentialValidator.array().optional(),
|
|
3633
|
-
fieldOfStudy:
|
|
3634
|
-
humanCode:
|
|
4299
|
+
fieldOfStudy: z.string().optional(),
|
|
4300
|
+
humanCode: z.string().optional(),
|
|
3635
4301
|
image: ImageValidator.optional(),
|
|
3636
|
-
"@language":
|
|
3637
|
-
name:
|
|
4302
|
+
"@language": z.string().optional(),
|
|
4303
|
+
name: z.string(),
|
|
3638
4304
|
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
|
3639
4305
|
related: RelatedValidator.array().optional(),
|
|
3640
4306
|
resultDescription: ResultDescriptionValidator.array().optional(),
|
|
3641
|
-
specialization:
|
|
3642
|
-
tag:
|
|
3643
|
-
version:
|
|
3644
|
-
}).catchall(
|
|
3645
|
-
var IdentityObjectValidator =
|
|
3646
|
-
type:
|
|
3647
|
-
hashed:
|
|
3648
|
-
identityHash:
|
|
3649
|
-
identityType:
|
|
3650
|
-
salt:
|
|
4307
|
+
specialization: z.string().optional(),
|
|
4308
|
+
tag: z.string().array().optional(),
|
|
4309
|
+
version: z.string().optional()
|
|
4310
|
+
}).catchall(z.any());
|
|
4311
|
+
var IdentityObjectValidator = z.object({
|
|
4312
|
+
type: z.string(),
|
|
4313
|
+
hashed: z.boolean(),
|
|
4314
|
+
identityHash: z.string(),
|
|
4315
|
+
identityType: z.string(),
|
|
4316
|
+
salt: z.string().optional()
|
|
3651
4317
|
});
|
|
3652
|
-
var ResultStatusTypeValidator =
|
|
4318
|
+
var ResultStatusTypeValidator = z.enum([
|
|
3653
4319
|
"Completed",
|
|
3654
4320
|
"Enrolled",
|
|
3655
4321
|
"Failed",
|
|
@@ -3657,42 +4323,42 @@ var ResultStatusTypeValidator = mod.enum([
|
|
|
3657
4323
|
"OnHold",
|
|
3658
4324
|
"Withdrew"
|
|
3659
4325
|
]);
|
|
3660
|
-
var ResultValidator =
|
|
3661
|
-
type:
|
|
3662
|
-
achievedLevel:
|
|
4326
|
+
var ResultValidator = z.object({
|
|
4327
|
+
type: z.string().array().nonempty(),
|
|
4328
|
+
achievedLevel: z.string().optional(),
|
|
3663
4329
|
alignment: AlignmentValidator.array().optional(),
|
|
3664
|
-
resultDescription:
|
|
4330
|
+
resultDescription: z.string().optional(),
|
|
3665
4331
|
status: ResultStatusTypeValidator.optional(),
|
|
3666
|
-
value:
|
|
3667
|
-
}).catchall(
|
|
3668
|
-
var AchievementSubjectValidator =
|
|
3669
|
-
id:
|
|
3670
|
-
type:
|
|
3671
|
-
activityEndDate:
|
|
3672
|
-
activityStartDate:
|
|
3673
|
-
creditsEarned:
|
|
4332
|
+
value: z.string().optional()
|
|
4333
|
+
}).catchall(z.any());
|
|
4334
|
+
var AchievementSubjectValidator = z.object({
|
|
4335
|
+
id: z.string().optional(),
|
|
4336
|
+
type: z.string().array().nonempty(),
|
|
4337
|
+
activityEndDate: z.string().optional(),
|
|
4338
|
+
activityStartDate: z.string().optional(),
|
|
4339
|
+
creditsEarned: z.number().optional(),
|
|
3674
4340
|
achievement: AchievementValidator.optional(),
|
|
3675
4341
|
identifier: IdentityObjectValidator.array().optional(),
|
|
3676
4342
|
image: ImageValidator.optional(),
|
|
3677
|
-
licenseNumber:
|
|
3678
|
-
narrative:
|
|
4343
|
+
licenseNumber: z.string().optional(),
|
|
4344
|
+
narrative: z.string().optional(),
|
|
3679
4345
|
result: ResultValidator.array().optional(),
|
|
3680
|
-
role:
|
|
4346
|
+
role: z.string().optional(),
|
|
3681
4347
|
source: ProfileValidator.optional(),
|
|
3682
|
-
term:
|
|
3683
|
-
}).catchall(
|
|
3684
|
-
var EvidenceValidator =
|
|
3685
|
-
id:
|
|
3686
|
-
type:
|
|
3687
|
-
narrative:
|
|
3688
|
-
name:
|
|
3689
|
-
description:
|
|
3690
|
-
genre:
|
|
3691
|
-
audience:
|
|
3692
|
-
}).catchall(
|
|
4348
|
+
term: z.string().optional()
|
|
4349
|
+
}).catchall(z.any());
|
|
4350
|
+
var EvidenceValidator = z.object({
|
|
4351
|
+
id: z.string().optional(),
|
|
4352
|
+
type: z.string().or(z.string().array().nonempty()),
|
|
4353
|
+
narrative: z.string().optional(),
|
|
4354
|
+
name: z.string().optional(),
|
|
4355
|
+
description: z.string().optional(),
|
|
4356
|
+
genre: z.string().optional(),
|
|
4357
|
+
audience: z.string().optional()
|
|
4358
|
+
}).catchall(z.any());
|
|
3693
4359
|
var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
3694
|
-
name:
|
|
3695
|
-
description:
|
|
4360
|
+
name: z.string().optional(),
|
|
4361
|
+
description: z.string().optional(),
|
|
3696
4362
|
image: ImageValidator.optional(),
|
|
3697
4363
|
credentialSubject: AchievementSubjectValidator.or(
|
|
3698
4364
|
AchievementSubjectValidator.array()
|
|
@@ -3703,42 +4369,42 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
|
3703
4369
|
var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
|
|
3704
4370
|
proof: ProofValidator.or(ProofValidator.array())
|
|
3705
4371
|
});
|
|
3706
|
-
var VerificationCheckValidator =
|
|
3707
|
-
checks:
|
|
3708
|
-
warnings:
|
|
3709
|
-
errors:
|
|
4372
|
+
var VerificationCheckValidator = z.object({
|
|
4373
|
+
checks: z.string().array(),
|
|
4374
|
+
warnings: z.string().array(),
|
|
4375
|
+
errors: z.string().array()
|
|
3710
4376
|
});
|
|
3711
|
-
var VerificationStatusValidator =
|
|
4377
|
+
var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
|
|
3712
4378
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
|
3713
|
-
var VerificationItemValidator =
|
|
3714
|
-
check:
|
|
4379
|
+
var VerificationItemValidator = z.object({
|
|
4380
|
+
check: z.string(),
|
|
3715
4381
|
status: VerificationStatusValidator,
|
|
3716
|
-
message:
|
|
3717
|
-
details:
|
|
4382
|
+
message: z.string().optional(),
|
|
4383
|
+
details: z.string().optional()
|
|
3718
4384
|
});
|
|
3719
|
-
var CredentialInfoValidator =
|
|
3720
|
-
title:
|
|
3721
|
-
createdAt:
|
|
4385
|
+
var CredentialInfoValidator = z.object({
|
|
4386
|
+
title: z.string().optional(),
|
|
4387
|
+
createdAt: z.string().optional(),
|
|
3722
4388
|
issuer: ProfileValidator.optional(),
|
|
3723
4389
|
issuee: ProfileValidator.optional(),
|
|
3724
4390
|
credentialSubject: CredentialSubjectValidator.optional()
|
|
3725
4391
|
});
|
|
3726
|
-
var CredentialRecordValidator =
|
|
3727
|
-
var PaginationOptionsValidator =
|
|
3728
|
-
limit:
|
|
3729
|
-
cursor:
|
|
3730
|
-
sort:
|
|
4392
|
+
var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
|
|
4393
|
+
var PaginationOptionsValidator = z.object({
|
|
4394
|
+
limit: z.number(),
|
|
4395
|
+
cursor: z.string().optional(),
|
|
4396
|
+
sort: z.string().optional()
|
|
3731
4397
|
});
|
|
3732
|
-
var PaginationResponseValidator =
|
|
3733
|
-
cursor:
|
|
3734
|
-
hasMore:
|
|
4398
|
+
var PaginationResponseValidator = z.object({
|
|
4399
|
+
cursor: z.string().optional(),
|
|
4400
|
+
hasMore: z.boolean()
|
|
3735
4401
|
});
|
|
3736
|
-
var EncryptedRecordValidator =
|
|
4402
|
+
var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator, fields: z.string().array() }).catchall(z.any());
|
|
3737
4403
|
var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
|
|
3738
4404
|
records: EncryptedRecordValidator.array()
|
|
3739
4405
|
});
|
|
3740
4406
|
var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
|
|
3741
|
-
id:
|
|
4407
|
+
id: z.string()
|
|
3742
4408
|
});
|
|
3743
4409
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
|
3744
4410
|
records: EncryptedCredentialRecordValidator.array()
|
|
@@ -3749,8 +4415,8 @@ var parseRegexString = /* @__PURE__ */ __name2((regexStr) => {
|
|
|
3749
4415
|
throw new Error("Invalid RegExp string format");
|
|
3750
4416
|
return { pattern: match2[1], flags: match2[2] };
|
|
3751
4417
|
}, "parseRegexString");
|
|
3752
|
-
var RegExpValidator =
|
|
3753
|
-
|
|
4418
|
+
var RegExpValidator = z.instanceof(RegExp).or(
|
|
4419
|
+
z.string().refine(
|
|
3754
4420
|
(str) => {
|
|
3755
4421
|
try {
|
|
3756
4422
|
parseRegexString(str);
|
|
@@ -3771,71 +4437,71 @@ var RegExpValidator = mod.instanceof(RegExp).or(
|
|
|
3771
4437
|
}
|
|
3772
4438
|
})
|
|
3773
4439
|
);
|
|
3774
|
-
var StringQuery =
|
|
3775
|
-
var LCNProfileDisplayValidator =
|
|
3776
|
-
backgroundColor:
|
|
3777
|
-
backgroundImage:
|
|
3778
|
-
fadeBackgroundImage:
|
|
3779
|
-
repeatBackgroundImage:
|
|
3780
|
-
fontColor:
|
|
3781
|
-
accentColor:
|
|
3782
|
-
accentFontColor:
|
|
3783
|
-
idBackgroundImage:
|
|
3784
|
-
fadeIdBackgroundImage:
|
|
3785
|
-
idBackgroundColor:
|
|
3786
|
-
repeatIdBackgroundImage:
|
|
4440
|
+
var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
|
|
4441
|
+
var LCNProfileDisplayValidator = z.object({
|
|
4442
|
+
backgroundColor: z.string().optional(),
|
|
4443
|
+
backgroundImage: z.string().optional(),
|
|
4444
|
+
fadeBackgroundImage: z.boolean().optional(),
|
|
4445
|
+
repeatBackgroundImage: z.boolean().optional(),
|
|
4446
|
+
fontColor: z.string().optional(),
|
|
4447
|
+
accentColor: z.string().optional(),
|
|
4448
|
+
accentFontColor: z.string().optional(),
|
|
4449
|
+
idBackgroundImage: z.string().optional(),
|
|
4450
|
+
fadeIdBackgroundImage: z.boolean().optional(),
|
|
4451
|
+
idBackgroundColor: z.string().optional(),
|
|
4452
|
+
repeatIdBackgroundImage: z.boolean().optional()
|
|
3787
4453
|
});
|
|
3788
|
-
var LCNProfileValidator =
|
|
3789
|
-
profileId:
|
|
3790
|
-
displayName:
|
|
3791
|
-
shortBio:
|
|
3792
|
-
bio:
|
|
3793
|
-
did:
|
|
3794
|
-
isPrivate:
|
|
3795
|
-
email:
|
|
3796
|
-
image:
|
|
3797
|
-
heroImage:
|
|
3798
|
-
websiteLink:
|
|
3799
|
-
isServiceProfile:
|
|
3800
|
-
type:
|
|
3801
|
-
notificationsWebhook:
|
|
4454
|
+
var LCNProfileValidator = z.object({
|
|
4455
|
+
profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
|
|
4456
|
+
displayName: z.string().default("").describe("Human-readable display name for the profile."),
|
|
4457
|
+
shortBio: z.string().default("").describe("Short bio for the profile."),
|
|
4458
|
+
bio: z.string().default("").describe("Longer bio for the profile."),
|
|
4459
|
+
did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
|
|
4460
|
+
isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
|
|
4461
|
+
email: z.string().optional().describe("Contact email address for the profile."),
|
|
4462
|
+
image: z.string().optional().describe("Profile image URL for the profile."),
|
|
4463
|
+
heroImage: z.string().optional().describe("Hero image URL for the profile."),
|
|
4464
|
+
websiteLink: z.string().optional().describe("Website link for the profile."),
|
|
4465
|
+
isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
|
|
4466
|
+
type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
|
|
4467
|
+
notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
|
|
3802
4468
|
display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
|
|
3803
|
-
role:
|
|
3804
|
-
dob:
|
|
4469
|
+
role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
|
|
4470
|
+
dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
|
|
3805
4471
|
});
|
|
3806
|
-
var LCNProfileQueryValidator =
|
|
4472
|
+
var LCNProfileQueryValidator = z.object({
|
|
3807
4473
|
profileId: StringQuery,
|
|
3808
4474
|
displayName: StringQuery,
|
|
3809
4475
|
shortBio: StringQuery,
|
|
3810
4476
|
bio: StringQuery,
|
|
3811
4477
|
email: StringQuery,
|
|
3812
4478
|
websiteLink: StringQuery,
|
|
3813
|
-
isServiceProfile:
|
|
4479
|
+
isServiceProfile: z.boolean(),
|
|
3814
4480
|
type: StringQuery
|
|
3815
4481
|
}).partial();
|
|
3816
4482
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
|
3817
4483
|
records: LCNProfileValidator.array()
|
|
3818
4484
|
});
|
|
3819
|
-
var LCNProfileConnectionStatusEnum =
|
|
4485
|
+
var LCNProfileConnectionStatusEnum = z.enum([
|
|
3820
4486
|
"CONNECTED",
|
|
3821
4487
|
"PENDING_REQUEST_SENT",
|
|
3822
4488
|
"PENDING_REQUEST_RECEIVED",
|
|
3823
4489
|
"NOT_CONNECTED"
|
|
3824
4490
|
]);
|
|
3825
|
-
var LCNProfileManagerValidator =
|
|
3826
|
-
id:
|
|
3827
|
-
created:
|
|
3828
|
-
displayName:
|
|
3829
|
-
shortBio:
|
|
3830
|
-
bio:
|
|
3831
|
-
email:
|
|
3832
|
-
image:
|
|
3833
|
-
heroImage:
|
|
4491
|
+
var LCNProfileManagerValidator = z.object({
|
|
4492
|
+
id: z.string(),
|
|
4493
|
+
created: z.string(),
|
|
4494
|
+
displayName: z.string().default("").optional(),
|
|
4495
|
+
shortBio: z.string().default("").optional(),
|
|
4496
|
+
bio: z.string().default("").optional(),
|
|
4497
|
+
email: z.string().optional(),
|
|
4498
|
+
image: z.string().optional(),
|
|
4499
|
+
heroImage: z.string().optional()
|
|
3834
4500
|
});
|
|
3835
4501
|
var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
|
|
3836
|
-
records: LCNProfileManagerValidator.extend({ did:
|
|
4502
|
+
records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
|
|
3837
4503
|
});
|
|
3838
|
-
var LCNProfileManagerQueryValidator =
|
|
4504
|
+
var LCNProfileManagerQueryValidator = z.object({
|
|
3839
4505
|
id: StringQuery,
|
|
3840
4506
|
displayName: StringQuery,
|
|
3841
4507
|
shortBio: StringQuery,
|
|
@@ -3843,296 +4509,297 @@ var LCNProfileManagerQueryValidator = mod.object({
|
|
|
3843
4509
|
email: StringQuery
|
|
3844
4510
|
}).partial();
|
|
3845
4511
|
var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
|
|
3846
|
-
records:
|
|
4512
|
+
records: z.object({
|
|
3847
4513
|
profile: LCNProfileValidator,
|
|
3848
|
-
manager: LCNProfileManagerValidator.extend({ did:
|
|
4514
|
+
manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
|
|
3849
4515
|
}).array()
|
|
3850
4516
|
});
|
|
3851
|
-
var SentCredentialInfoValidator =
|
|
3852
|
-
uri:
|
|
3853
|
-
to:
|
|
3854
|
-
from:
|
|
3855
|
-
sent:
|
|
3856
|
-
received:
|
|
4517
|
+
var SentCredentialInfoValidator = z.object({
|
|
4518
|
+
uri: z.string(),
|
|
4519
|
+
to: z.string(),
|
|
4520
|
+
from: z.string(),
|
|
4521
|
+
sent: z.string().datetime(),
|
|
4522
|
+
received: z.string().datetime().optional()
|
|
3857
4523
|
});
|
|
3858
|
-
var BoostPermissionsValidator =
|
|
3859
|
-
role:
|
|
3860
|
-
canEdit:
|
|
3861
|
-
canIssue:
|
|
3862
|
-
canRevoke:
|
|
3863
|
-
canManagePermissions:
|
|
3864
|
-
canIssueChildren:
|
|
3865
|
-
canCreateChildren:
|
|
3866
|
-
canEditChildren:
|
|
3867
|
-
canRevokeChildren:
|
|
3868
|
-
canManageChildrenPermissions:
|
|
3869
|
-
canManageChildrenProfiles:
|
|
3870
|
-
canViewAnalytics:
|
|
4524
|
+
var BoostPermissionsValidator = z.object({
|
|
4525
|
+
role: z.string(),
|
|
4526
|
+
canEdit: z.boolean(),
|
|
4527
|
+
canIssue: z.boolean(),
|
|
4528
|
+
canRevoke: z.boolean(),
|
|
4529
|
+
canManagePermissions: z.boolean(),
|
|
4530
|
+
canIssueChildren: z.string(),
|
|
4531
|
+
canCreateChildren: z.string(),
|
|
4532
|
+
canEditChildren: z.string(),
|
|
4533
|
+
canRevokeChildren: z.string(),
|
|
4534
|
+
canManageChildrenPermissions: z.string(),
|
|
4535
|
+
canManageChildrenProfiles: z.boolean().default(false).optional(),
|
|
4536
|
+
canViewAnalytics: z.boolean()
|
|
3871
4537
|
});
|
|
3872
|
-
var BoostPermissionsQueryValidator =
|
|
4538
|
+
var BoostPermissionsQueryValidator = z.object({
|
|
3873
4539
|
role: StringQuery,
|
|
3874
|
-
canEdit:
|
|
3875
|
-
canIssue:
|
|
3876
|
-
canRevoke:
|
|
3877
|
-
canManagePermissions:
|
|
4540
|
+
canEdit: z.boolean(),
|
|
4541
|
+
canIssue: z.boolean(),
|
|
4542
|
+
canRevoke: z.boolean(),
|
|
4543
|
+
canManagePermissions: z.boolean(),
|
|
3878
4544
|
canIssueChildren: StringQuery,
|
|
3879
4545
|
canCreateChildren: StringQuery,
|
|
3880
4546
|
canEditChildren: StringQuery,
|
|
3881
4547
|
canRevokeChildren: StringQuery,
|
|
3882
4548
|
canManageChildrenPermissions: StringQuery,
|
|
3883
|
-
canManageChildrenProfiles:
|
|
3884
|
-
canViewAnalytics:
|
|
4549
|
+
canManageChildrenProfiles: z.boolean(),
|
|
4550
|
+
canViewAnalytics: z.boolean()
|
|
3885
4551
|
}).partial();
|
|
3886
|
-
var ClaimHookTypeValidator =
|
|
3887
|
-
var ClaimHookValidator =
|
|
3888
|
-
|
|
3889
|
-
type:
|
|
3890
|
-
data:
|
|
3891
|
-
claimUri:
|
|
3892
|
-
targetUri:
|
|
4552
|
+
var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
|
|
4553
|
+
var ClaimHookValidator = z.discriminatedUnion("type", [
|
|
4554
|
+
z.object({
|
|
4555
|
+
type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
|
|
4556
|
+
data: z.object({
|
|
4557
|
+
claimUri: z.string(),
|
|
4558
|
+
targetUri: z.string(),
|
|
3893
4559
|
permissions: BoostPermissionsValidator.partial()
|
|
3894
4560
|
})
|
|
3895
4561
|
}),
|
|
3896
|
-
|
|
3897
|
-
type:
|
|
3898
|
-
data:
|
|
4562
|
+
z.object({
|
|
4563
|
+
type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
|
|
4564
|
+
data: z.object({ claimUri: z.string(), targetUri: z.string() })
|
|
3899
4565
|
})
|
|
3900
4566
|
]);
|
|
3901
|
-
var ClaimHookQueryValidator =
|
|
4567
|
+
var ClaimHookQueryValidator = z.object({
|
|
3902
4568
|
type: StringQuery,
|
|
3903
|
-
data:
|
|
4569
|
+
data: z.object({
|
|
3904
4570
|
claimUri: StringQuery,
|
|
3905
4571
|
targetUri: StringQuery,
|
|
3906
4572
|
permissions: BoostPermissionsQueryValidator
|
|
3907
4573
|
})
|
|
3908
4574
|
}).deepPartial();
|
|
3909
|
-
var FullClaimHookValidator =
|
|
4575
|
+
var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
|
|
3910
4576
|
var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
|
|
3911
4577
|
records: FullClaimHookValidator.array()
|
|
3912
4578
|
});
|
|
3913
|
-
var LCNBoostStatus =
|
|
3914
|
-
var BoostValidator =
|
|
3915
|
-
uri:
|
|
3916
|
-
name:
|
|
3917
|
-
type:
|
|
3918
|
-
category:
|
|
4579
|
+
var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
|
|
4580
|
+
var BoostValidator = z.object({
|
|
4581
|
+
uri: z.string(),
|
|
4582
|
+
name: z.string().optional(),
|
|
4583
|
+
type: z.string().optional(),
|
|
4584
|
+
category: z.string().optional(),
|
|
3919
4585
|
status: LCNBoostStatus.optional(),
|
|
3920
|
-
autoConnectRecipients:
|
|
3921
|
-
meta:
|
|
3922
|
-
claimPermissions: BoostPermissionsValidator.optional()
|
|
4586
|
+
autoConnectRecipients: z.boolean().optional(),
|
|
4587
|
+
meta: z.record(z.any()).optional(),
|
|
4588
|
+
claimPermissions: BoostPermissionsValidator.optional(),
|
|
4589
|
+
allowAnyoneToCreateChildren: z.boolean().optional()
|
|
3923
4590
|
});
|
|
3924
|
-
var BoostQueryValidator =
|
|
4591
|
+
var BoostQueryValidator = z.object({
|
|
3925
4592
|
uri: StringQuery,
|
|
3926
4593
|
name: StringQuery,
|
|
3927
4594
|
type: StringQuery,
|
|
3928
4595
|
category: StringQuery,
|
|
3929
|
-
meta:
|
|
3930
|
-
status: LCNBoostStatus.or(
|
|
3931
|
-
autoConnectRecipients:
|
|
4596
|
+
meta: z.record(StringQuery),
|
|
4597
|
+
status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
|
|
4598
|
+
autoConnectRecipients: z.boolean()
|
|
3932
4599
|
}).partial();
|
|
3933
4600
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
|
3934
4601
|
records: BoostValidator.array()
|
|
3935
4602
|
});
|
|
3936
|
-
var BoostRecipientValidator =
|
|
4603
|
+
var BoostRecipientValidator = z.object({
|
|
3937
4604
|
to: LCNProfileValidator,
|
|
3938
|
-
from:
|
|
3939
|
-
received:
|
|
3940
|
-
uri:
|
|
4605
|
+
from: z.string(),
|
|
4606
|
+
received: z.string().optional(),
|
|
4607
|
+
uri: z.string().optional()
|
|
3941
4608
|
});
|
|
3942
4609
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
3943
4610
|
records: BoostRecipientValidator.array()
|
|
3944
4611
|
});
|
|
3945
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
|
3946
|
-
endpoint:
|
|
3947
|
-
name:
|
|
3948
|
-
did:
|
|
4612
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
|
|
4613
|
+
endpoint: z.string(),
|
|
4614
|
+
name: z.string(),
|
|
4615
|
+
did: z.string().optional()
|
|
3949
4616
|
});
|
|
3950
|
-
var LCNBoostClaimLinkOptionsValidator =
|
|
3951
|
-
ttlSeconds:
|
|
3952
|
-
totalUses:
|
|
4617
|
+
var LCNBoostClaimLinkOptionsValidator = z.object({
|
|
4618
|
+
ttlSeconds: z.number().optional(),
|
|
4619
|
+
totalUses: z.number().optional()
|
|
3953
4620
|
});
|
|
3954
|
-
var LCNSigningAuthorityValidator =
|
|
3955
|
-
endpoint:
|
|
4621
|
+
var LCNSigningAuthorityValidator = z.object({
|
|
4622
|
+
endpoint: z.string()
|
|
3956
4623
|
});
|
|
3957
|
-
var LCNSigningAuthorityForUserValidator =
|
|
4624
|
+
var LCNSigningAuthorityForUserValidator = z.object({
|
|
3958
4625
|
signingAuthority: LCNSigningAuthorityValidator,
|
|
3959
|
-
relationship:
|
|
3960
|
-
name:
|
|
4626
|
+
relationship: z.object({
|
|
4627
|
+
name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
|
|
3961
4628
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
|
3962
4629
|
}),
|
|
3963
|
-
did:
|
|
4630
|
+
did: z.string()
|
|
3964
4631
|
})
|
|
3965
4632
|
});
|
|
3966
|
-
var AutoBoostConfigValidator =
|
|
3967
|
-
boostUri:
|
|
3968
|
-
signingAuthority:
|
|
3969
|
-
endpoint:
|
|
3970
|
-
name:
|
|
4633
|
+
var AutoBoostConfigValidator = z.object({
|
|
4634
|
+
boostUri: z.string(),
|
|
4635
|
+
signingAuthority: z.object({
|
|
4636
|
+
endpoint: z.string(),
|
|
4637
|
+
name: z.string()
|
|
3971
4638
|
})
|
|
3972
4639
|
});
|
|
3973
|
-
var ConsentFlowTermsStatusValidator =
|
|
3974
|
-
var ConsentFlowContractValidator =
|
|
3975
|
-
read:
|
|
3976
|
-
anonymize:
|
|
3977
|
-
credentials:
|
|
3978
|
-
personal:
|
|
4640
|
+
var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
|
|
4641
|
+
var ConsentFlowContractValidator = z.object({
|
|
4642
|
+
read: z.object({
|
|
4643
|
+
anonymize: z.boolean().optional(),
|
|
4644
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4645
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
3979
4646
|
}).default({}),
|
|
3980
|
-
write:
|
|
3981
|
-
credentials:
|
|
3982
|
-
personal:
|
|
4647
|
+
write: z.object({
|
|
4648
|
+
credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
|
|
4649
|
+
personal: z.record(z.object({ required: z.boolean() })).default({})
|
|
3983
4650
|
}).default({})
|
|
3984
4651
|
});
|
|
3985
|
-
var ConsentFlowContractDetailsValidator =
|
|
4652
|
+
var ConsentFlowContractDetailsValidator = z.object({
|
|
3986
4653
|
contract: ConsentFlowContractValidator,
|
|
3987
4654
|
owner: LCNProfileValidator,
|
|
3988
|
-
name:
|
|
3989
|
-
subtitle:
|
|
3990
|
-
description:
|
|
3991
|
-
reasonForAccessing:
|
|
3992
|
-
image:
|
|
3993
|
-
uri:
|
|
3994
|
-
needsGuardianConsent:
|
|
3995
|
-
redirectUrl:
|
|
3996
|
-
frontDoorBoostUri:
|
|
3997
|
-
createdAt:
|
|
3998
|
-
updatedAt:
|
|
3999
|
-
expiresAt:
|
|
4000
|
-
autoBoosts:
|
|
4001
|
-
writers:
|
|
4655
|
+
name: z.string(),
|
|
4656
|
+
subtitle: z.string().optional(),
|
|
4657
|
+
description: z.string().optional(),
|
|
4658
|
+
reasonForAccessing: z.string().optional(),
|
|
4659
|
+
image: z.string().optional(),
|
|
4660
|
+
uri: z.string(),
|
|
4661
|
+
needsGuardianConsent: z.boolean().optional(),
|
|
4662
|
+
redirectUrl: z.string().optional(),
|
|
4663
|
+
frontDoorBoostUri: z.string().optional(),
|
|
4664
|
+
createdAt: z.string(),
|
|
4665
|
+
updatedAt: z.string(),
|
|
4666
|
+
expiresAt: z.string().optional(),
|
|
4667
|
+
autoBoosts: z.string().array().optional(),
|
|
4668
|
+
writers: z.array(LCNProfileValidator).optional()
|
|
4002
4669
|
});
|
|
4003
4670
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
|
4004
4671
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
|
4005
4672
|
});
|
|
4006
|
-
var ConsentFlowContractDataValidator =
|
|
4007
|
-
credentials:
|
|
4008
|
-
personal:
|
|
4009
|
-
date:
|
|
4673
|
+
var ConsentFlowContractDataValidator = z.object({
|
|
4674
|
+
credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
|
|
4675
|
+
personal: z.record(z.string()).default({}),
|
|
4676
|
+
date: z.string()
|
|
4010
4677
|
});
|
|
4011
4678
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
|
4012
4679
|
records: ConsentFlowContractDataValidator.array()
|
|
4013
4680
|
});
|
|
4014
|
-
var ConsentFlowContractDataForDidValidator =
|
|
4015
|
-
credentials:
|
|
4016
|
-
personal:
|
|
4017
|
-
date:
|
|
4018
|
-
contractUri:
|
|
4681
|
+
var ConsentFlowContractDataForDidValidator = z.object({
|
|
4682
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
|
4683
|
+
personal: z.record(z.string()).default({}),
|
|
4684
|
+
date: z.string(),
|
|
4685
|
+
contractUri: z.string()
|
|
4019
4686
|
});
|
|
4020
4687
|
var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
4021
4688
|
records: ConsentFlowContractDataForDidValidator.array()
|
|
4022
4689
|
});
|
|
4023
|
-
var ConsentFlowTermValidator =
|
|
4024
|
-
sharing:
|
|
4025
|
-
shared:
|
|
4026
|
-
shareAll:
|
|
4027
|
-
shareUntil:
|
|
4690
|
+
var ConsentFlowTermValidator = z.object({
|
|
4691
|
+
sharing: z.boolean().optional(),
|
|
4692
|
+
shared: z.string().array().optional(),
|
|
4693
|
+
shareAll: z.boolean().optional(),
|
|
4694
|
+
shareUntil: z.string().optional()
|
|
4028
4695
|
});
|
|
4029
|
-
var ConsentFlowTermsValidator =
|
|
4030
|
-
read:
|
|
4031
|
-
anonymize:
|
|
4032
|
-
credentials:
|
|
4033
|
-
shareAll:
|
|
4034
|
-
sharing:
|
|
4035
|
-
categories:
|
|
4696
|
+
var ConsentFlowTermsValidator = z.object({
|
|
4697
|
+
read: z.object({
|
|
4698
|
+
anonymize: z.boolean().optional(),
|
|
4699
|
+
credentials: z.object({
|
|
4700
|
+
shareAll: z.boolean().optional(),
|
|
4701
|
+
sharing: z.boolean().optional(),
|
|
4702
|
+
categories: z.record(ConsentFlowTermValidator).default({})
|
|
4036
4703
|
}).default({}),
|
|
4037
|
-
personal:
|
|
4704
|
+
personal: z.record(z.string()).default({})
|
|
4038
4705
|
}).default({}),
|
|
4039
|
-
write:
|
|
4040
|
-
credentials:
|
|
4041
|
-
personal:
|
|
4706
|
+
write: z.object({
|
|
4707
|
+
credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
|
|
4708
|
+
personal: z.record(z.boolean()).default({})
|
|
4042
4709
|
}).default({}),
|
|
4043
|
-
deniedWriters:
|
|
4710
|
+
deniedWriters: z.array(z.string()).optional()
|
|
4044
4711
|
});
|
|
4045
4712
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
|
4046
|
-
records:
|
|
4047
|
-
expiresAt:
|
|
4048
|
-
oneTime:
|
|
4713
|
+
records: z.object({
|
|
4714
|
+
expiresAt: z.string().optional(),
|
|
4715
|
+
oneTime: z.boolean().optional(),
|
|
4049
4716
|
terms: ConsentFlowTermsValidator,
|
|
4050
4717
|
contract: ConsentFlowContractDetailsValidator,
|
|
4051
|
-
uri:
|
|
4718
|
+
uri: z.string(),
|
|
4052
4719
|
consenter: LCNProfileValidator,
|
|
4053
4720
|
status: ConsentFlowTermsStatusValidator
|
|
4054
4721
|
}).array()
|
|
4055
4722
|
});
|
|
4056
|
-
var ConsentFlowContractQueryValidator =
|
|
4057
|
-
read:
|
|
4058
|
-
anonymize:
|
|
4059
|
-
credentials:
|
|
4060
|
-
categories:
|
|
4723
|
+
var ConsentFlowContractQueryValidator = z.object({
|
|
4724
|
+
read: z.object({
|
|
4725
|
+
anonymize: z.boolean().optional(),
|
|
4726
|
+
credentials: z.object({
|
|
4727
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4061
4728
|
}).optional(),
|
|
4062
|
-
personal:
|
|
4729
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4063
4730
|
}).optional(),
|
|
4064
|
-
write:
|
|
4065
|
-
credentials:
|
|
4066
|
-
categories:
|
|
4731
|
+
write: z.object({
|
|
4732
|
+
credentials: z.object({
|
|
4733
|
+
categories: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4067
4734
|
}).optional(),
|
|
4068
|
-
personal:
|
|
4735
|
+
personal: z.record(z.object({ required: z.boolean().optional() })).optional()
|
|
4069
4736
|
}).optional()
|
|
4070
4737
|
});
|
|
4071
|
-
var ConsentFlowDataQueryValidator =
|
|
4072
|
-
anonymize:
|
|
4073
|
-
credentials:
|
|
4074
|
-
personal:
|
|
4738
|
+
var ConsentFlowDataQueryValidator = z.object({
|
|
4739
|
+
anonymize: z.boolean().optional(),
|
|
4740
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4741
|
+
personal: z.record(z.boolean()).optional()
|
|
4075
4742
|
});
|
|
4076
|
-
var ConsentFlowDataForDidQueryValidator =
|
|
4077
|
-
credentials:
|
|
4078
|
-
personal:
|
|
4743
|
+
var ConsentFlowDataForDidQueryValidator = z.object({
|
|
4744
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4745
|
+
personal: z.record(z.boolean()).optional(),
|
|
4079
4746
|
id: StringQuery.optional()
|
|
4080
4747
|
});
|
|
4081
|
-
var ConsentFlowTermsQueryValidator =
|
|
4082
|
-
read:
|
|
4083
|
-
anonymize:
|
|
4084
|
-
credentials:
|
|
4085
|
-
shareAll:
|
|
4086
|
-
sharing:
|
|
4087
|
-
categories:
|
|
4748
|
+
var ConsentFlowTermsQueryValidator = z.object({
|
|
4749
|
+
read: z.object({
|
|
4750
|
+
anonymize: z.boolean().optional(),
|
|
4751
|
+
credentials: z.object({
|
|
4752
|
+
shareAll: z.boolean().optional(),
|
|
4753
|
+
sharing: z.boolean().optional(),
|
|
4754
|
+
categories: z.record(ConsentFlowTermValidator.optional()).optional()
|
|
4088
4755
|
}).optional(),
|
|
4089
|
-
personal:
|
|
4756
|
+
personal: z.record(z.string()).optional()
|
|
4090
4757
|
}).optional(),
|
|
4091
|
-
write:
|
|
4092
|
-
credentials:
|
|
4093
|
-
personal:
|
|
4758
|
+
write: z.object({
|
|
4759
|
+
credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
|
|
4760
|
+
personal: z.record(z.boolean()).optional()
|
|
4094
4761
|
}).optional()
|
|
4095
4762
|
});
|
|
4096
|
-
var ConsentFlowTransactionActionValidator =
|
|
4763
|
+
var ConsentFlowTransactionActionValidator = z.enum([
|
|
4097
4764
|
"consent",
|
|
4098
4765
|
"update",
|
|
4099
4766
|
"sync",
|
|
4100
4767
|
"withdraw",
|
|
4101
4768
|
"write"
|
|
4102
4769
|
]);
|
|
4103
|
-
var ConsentFlowTransactionsQueryValidator =
|
|
4770
|
+
var ConsentFlowTransactionsQueryValidator = z.object({
|
|
4104
4771
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
|
4105
4772
|
action: ConsentFlowTransactionActionValidator.or(
|
|
4106
4773
|
ConsentFlowTransactionActionValidator.array()
|
|
4107
4774
|
).optional(),
|
|
4108
|
-
date:
|
|
4109
|
-
expiresAt:
|
|
4110
|
-
oneTime:
|
|
4775
|
+
date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
4776
|
+
expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
|
|
4777
|
+
oneTime: z.boolean().optional()
|
|
4111
4778
|
});
|
|
4112
|
-
var ConsentFlowTransactionValidator =
|
|
4113
|
-
expiresAt:
|
|
4114
|
-
oneTime:
|
|
4779
|
+
var ConsentFlowTransactionValidator = z.object({
|
|
4780
|
+
expiresAt: z.string().optional(),
|
|
4781
|
+
oneTime: z.boolean().optional(),
|
|
4115
4782
|
terms: ConsentFlowTermsValidator.optional(),
|
|
4116
|
-
id:
|
|
4783
|
+
id: z.string(),
|
|
4117
4784
|
action: ConsentFlowTransactionActionValidator,
|
|
4118
|
-
date:
|
|
4119
|
-
uris:
|
|
4785
|
+
date: z.string(),
|
|
4786
|
+
uris: z.string().array().optional()
|
|
4120
4787
|
});
|
|
4121
4788
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
|
4122
4789
|
records: ConsentFlowTransactionValidator.array()
|
|
4123
4790
|
});
|
|
4124
|
-
var ContractCredentialValidator =
|
|
4125
|
-
credentialUri:
|
|
4126
|
-
termsUri:
|
|
4127
|
-
contractUri:
|
|
4128
|
-
boostUri:
|
|
4129
|
-
category:
|
|
4130
|
-
date:
|
|
4791
|
+
var ContractCredentialValidator = z.object({
|
|
4792
|
+
credentialUri: z.string(),
|
|
4793
|
+
termsUri: z.string(),
|
|
4794
|
+
contractUri: z.string(),
|
|
4795
|
+
boostUri: z.string(),
|
|
4796
|
+
category: z.string().optional(),
|
|
4797
|
+
date: z.string()
|
|
4131
4798
|
});
|
|
4132
4799
|
var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
|
|
4133
4800
|
records: ContractCredentialValidator.array()
|
|
4134
4801
|
});
|
|
4135
|
-
var LCNNotificationTypeEnumValidator =
|
|
4802
|
+
var LCNNotificationTypeEnumValidator = z.enum([
|
|
4136
4803
|
"CONNECTION_REQUEST",
|
|
4137
4804
|
"CONNECTION_ACCEPTED",
|
|
4138
4805
|
"CREDENTIAL_RECEIVED",
|
|
@@ -4143,40 +4810,40 @@ var LCNNotificationTypeEnumValidator = mod.enum([
|
|
|
4143
4810
|
"PRESENTATION_RECEIVED",
|
|
4144
4811
|
"CONSENT_FLOW_TRANSACTION"
|
|
4145
4812
|
]);
|
|
4146
|
-
var LCNNotificationMessageValidator =
|
|
4147
|
-
title:
|
|
4148
|
-
body:
|
|
4813
|
+
var LCNNotificationMessageValidator = z.object({
|
|
4814
|
+
title: z.string().optional(),
|
|
4815
|
+
body: z.string().optional()
|
|
4149
4816
|
});
|
|
4150
|
-
var LCNNotificationDataValidator =
|
|
4151
|
-
vcUris:
|
|
4152
|
-
vpUris:
|
|
4817
|
+
var LCNNotificationDataValidator = z.object({
|
|
4818
|
+
vcUris: z.array(z.string()).optional(),
|
|
4819
|
+
vpUris: z.array(z.string()).optional(),
|
|
4153
4820
|
transaction: ConsentFlowTransactionValidator.optional()
|
|
4154
4821
|
});
|
|
4155
|
-
var LCNNotificationValidator =
|
|
4822
|
+
var LCNNotificationValidator = z.object({
|
|
4156
4823
|
type: LCNNotificationTypeEnumValidator,
|
|
4157
|
-
to: LCNProfileValidator.partial().and(
|
|
4158
|
-
from: LCNProfileValidator.partial().and(
|
|
4824
|
+
to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
4825
|
+
from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
|
|
4159
4826
|
message: LCNNotificationMessageValidator.optional(),
|
|
4160
4827
|
data: LCNNotificationDataValidator.optional(),
|
|
4161
|
-
sent:
|
|
4828
|
+
sent: z.string().datetime().optional()
|
|
4162
4829
|
});
|
|
4163
4830
|
var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
|
|
4164
|
-
var AuthGrantValidator =
|
|
4165
|
-
id:
|
|
4166
|
-
name:
|
|
4167
|
-
description:
|
|
4168
|
-
challenge:
|
|
4169
|
-
status:
|
|
4831
|
+
var AuthGrantValidator = z.object({
|
|
4832
|
+
id: z.string(),
|
|
4833
|
+
name: z.string(),
|
|
4834
|
+
description: z.string().optional(),
|
|
4835
|
+
challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
|
|
4836
|
+
status: z.enum(["revoked", "active"], {
|
|
4170
4837
|
required_error: "Status is required",
|
|
4171
4838
|
invalid_type_error: "Status must be either active or revoked"
|
|
4172
4839
|
}),
|
|
4173
|
-
scope:
|
|
4174
|
-
createdAt:
|
|
4175
|
-
expiresAt:
|
|
4840
|
+
scope: z.string(),
|
|
4841
|
+
createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
|
|
4842
|
+
expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
|
|
4176
4843
|
});
|
|
4177
|
-
var FlatAuthGrantValidator =
|
|
4178
|
-
var AuthGrantStatusValidator =
|
|
4179
|
-
var AuthGrantQueryValidator =
|
|
4844
|
+
var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
|
|
4845
|
+
var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
|
|
4846
|
+
var AuthGrantQueryValidator = z.object({
|
|
4180
4847
|
id: StringQuery,
|
|
4181
4848
|
name: StringQuery,
|
|
4182
4849
|
description: StringQuery,
|
|
@@ -5035,7 +5702,7 @@ var formatters2 = {
|
|
|
5035
5702
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
5036
5703
|
}
|
|
5037
5704
|
}, "O"),
|
|
5038
|
-
z: /* @__PURE__ */ __name(function
|
|
5705
|
+
z: /* @__PURE__ */ __name(function z2(date, token, _localize, options) {
|
|
5039
5706
|
var originalDate = options._originalDate || date;
|
|
5040
5707
|
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
5041
5708
|
switch (token) {
|