@spscommerce/asst-api 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CompanyBriefByOrg-f1bfabb3.d.ts → CompanyBriefByOrg-HsKxilwl.d.ts} +158 -137
- package/dist/{chunk-PUQDOFRT.js → chunk-6FFDMMN5.js} +452 -198
- package/dist/{chunk-FDGLFR7X.js → chunk-C2N5RQWG.js} +104 -51
- package/dist/{index-d94fdfef.d.ts → index-wuCGfJSu.d.ts} +5 -2
- package/dist/index.cjs +623 -239
- package/dist/index.d.cts +617 -0
- package/dist/index.d.ts +327 -10
- package/dist/index.js +84 -4
- package/dist/msw.cjs +601 -297
- package/dist/msw.d.cts +833 -0
- package/dist/msw.d.ts +54 -28
- package/dist/msw.js +124 -88
- package/dist/{zod-ec1cdb27.d.ts → zod-9pZn6tpQ.d.ts} +232 -244
- package/dist/zod.cjs +454 -200
- package/dist/zod.d.cts +5 -0
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +5 -5
- package/package.json +2 -3
package/dist/zod.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(zod_exports, {
|
|
|
42
42
|
bulbSchema: () => bulbSchema,
|
|
43
43
|
categoryEnumSchema: () => categoryEnumSchema,
|
|
44
44
|
companyBriefByOrgSchema: () => companyBriefByOrgSchema,
|
|
45
|
+
companyRelationshipUpsertBodySchema: () => companyRelationshipUpsertBodySchema,
|
|
45
46
|
componentDetailsSchema: () => componentDetailsSchema,
|
|
46
47
|
connectionSchema: () => connectionSchema,
|
|
47
48
|
downLoadItemsParamsSchema: () => downLoadItemsParamsSchema,
|
|
@@ -56,7 +57,6 @@ __export(zod_exports, {
|
|
|
56
57
|
groupedItemSchema: () => groupedItemSchema,
|
|
57
58
|
hierarchyCategorySchema: () => hierarchyCategorySchema,
|
|
58
59
|
hierarchyDetailsSchema: () => hierarchyDetailsSchema,
|
|
59
|
-
hierarchySchema: () => hierarchySchema,
|
|
60
60
|
identityServiceDatetimePreferencesSchema: () => identityServiceDatetimePreferencesSchema,
|
|
61
61
|
identityServiceOrganizationMetadataSchema: () => identityServiceOrganizationMetadataSchema,
|
|
62
62
|
identityServiceOrganizationSchema: () => identityServiceOrganizationSchema,
|
|
@@ -76,8 +76,8 @@ __export(zod_exports, {
|
|
|
76
76
|
itemErrorDetailsSchema: () => itemErrorDetailsSchema,
|
|
77
77
|
itemHeaderSchema: () => itemHeaderSchema,
|
|
78
78
|
itemHierarchyResponseSchema: () => itemHierarchyResponseSchema,
|
|
79
|
-
itemHierarchySchema: () => itemHierarchySchema,
|
|
80
79
|
itemMapSchema: () => itemMapSchema,
|
|
80
|
+
itemPartnerSchema: () => itemPartnerSchema,
|
|
81
81
|
itemPriceSchema: () => itemPriceSchema,
|
|
82
82
|
itemSearchViewSchema: () => itemSearchViewSchema,
|
|
83
83
|
itemTableSchema: () => itemTableSchema,
|
|
@@ -102,7 +102,7 @@ module.exports = __toCommonJS(zod_exports);
|
|
|
102
102
|
// lib/asstClient.ts
|
|
103
103
|
var import_ky_universal = __toESM(require("ky-universal"), 1);
|
|
104
104
|
|
|
105
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
105
|
+
// ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
106
106
|
var util;
|
|
107
107
|
(function(util2) {
|
|
108
108
|
util2.assertEqual = (val) => val;
|
|
@@ -256,7 +256,7 @@ var quotelessJson = (obj) => {
|
|
|
256
256
|
const json = JSON.stringify(obj, null, 2);
|
|
257
257
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
258
258
|
};
|
|
259
|
-
var ZodError = class extends Error {
|
|
259
|
+
var ZodError = class _ZodError extends Error {
|
|
260
260
|
constructor(issues) {
|
|
261
261
|
super();
|
|
262
262
|
this.issues = [];
|
|
@@ -314,6 +314,11 @@ var ZodError = class extends Error {
|
|
|
314
314
|
processError(this);
|
|
315
315
|
return fieldErrors;
|
|
316
316
|
}
|
|
317
|
+
static assert(value) {
|
|
318
|
+
if (!(value instanceof _ZodError)) {
|
|
319
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
317
322
|
toString() {
|
|
318
323
|
return this.message;
|
|
319
324
|
}
|
|
@@ -456,6 +461,13 @@ var makeIssue = (params) => {
|
|
|
456
461
|
...issueData,
|
|
457
462
|
path: fullPath
|
|
458
463
|
};
|
|
464
|
+
if (issueData.message !== void 0) {
|
|
465
|
+
return {
|
|
466
|
+
...issueData,
|
|
467
|
+
path: fullPath,
|
|
468
|
+
message: issueData.message
|
|
469
|
+
};
|
|
470
|
+
}
|
|
459
471
|
let errorMessage = "";
|
|
460
472
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
461
473
|
for (const map of maps) {
|
|
@@ -464,11 +476,12 @@ var makeIssue = (params) => {
|
|
|
464
476
|
return {
|
|
465
477
|
...issueData,
|
|
466
478
|
path: fullPath,
|
|
467
|
-
message:
|
|
479
|
+
message: errorMessage
|
|
468
480
|
};
|
|
469
481
|
};
|
|
470
482
|
var EMPTY_PATH = [];
|
|
471
483
|
function addIssueToContext(ctx, issueData) {
|
|
484
|
+
const overrideMap = getErrorMap();
|
|
472
485
|
const issue = makeIssue({
|
|
473
486
|
issueData,
|
|
474
487
|
data: ctx.data,
|
|
@@ -476,14 +489,14 @@ function addIssueToContext(ctx, issueData) {
|
|
|
476
489
|
errorMaps: [
|
|
477
490
|
ctx.common.contextualErrorMap,
|
|
478
491
|
ctx.schemaErrorMap,
|
|
479
|
-
|
|
480
|
-
errorMap
|
|
492
|
+
overrideMap,
|
|
493
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
481
494
|
// then global default map
|
|
482
495
|
].filter((x) => !!x)
|
|
483
496
|
});
|
|
484
497
|
ctx.common.issues.push(issue);
|
|
485
498
|
}
|
|
486
|
-
var ParseStatus = class {
|
|
499
|
+
var ParseStatus = class _ParseStatus {
|
|
487
500
|
constructor() {
|
|
488
501
|
this.value = "valid";
|
|
489
502
|
}
|
|
@@ -509,12 +522,14 @@ var ParseStatus = class {
|
|
|
509
522
|
static async mergeObjectAsync(status, pairs) {
|
|
510
523
|
const syncPairs = [];
|
|
511
524
|
for (const pair of pairs) {
|
|
525
|
+
const key = await pair.key;
|
|
526
|
+
const value = await pair.value;
|
|
512
527
|
syncPairs.push({
|
|
513
|
-
key
|
|
514
|
-
value
|
|
528
|
+
key,
|
|
529
|
+
value
|
|
515
530
|
});
|
|
516
531
|
}
|
|
517
|
-
return
|
|
532
|
+
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
518
533
|
}
|
|
519
534
|
static mergeObjectSync(status, pairs) {
|
|
520
535
|
const finalObject = {};
|
|
@@ -528,7 +543,7 @@ var ParseStatus = class {
|
|
|
528
543
|
status.dirty();
|
|
529
544
|
if (value.status === "dirty")
|
|
530
545
|
status.dirty();
|
|
531
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
546
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
532
547
|
finalObject[key.value] = value.value;
|
|
533
548
|
}
|
|
534
549
|
}
|
|
@@ -544,11 +559,29 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
544
559
|
var isDirty = (x) => x.status === "dirty";
|
|
545
560
|
var isValid = (x) => x.status === "valid";
|
|
546
561
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
562
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
563
|
+
if (kind === "a" && !f)
|
|
564
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
565
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
566
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
567
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
568
|
+
}
|
|
569
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
570
|
+
if (kind === "m")
|
|
571
|
+
throw new TypeError("Private method is not writable");
|
|
572
|
+
if (kind === "a" && !f)
|
|
573
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
574
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
575
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
576
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
577
|
+
}
|
|
547
578
|
var errorUtil;
|
|
548
579
|
(function(errorUtil2) {
|
|
549
580
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
550
581
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
551
582
|
})(errorUtil || (errorUtil = {}));
|
|
583
|
+
var _ZodEnum_cache;
|
|
584
|
+
var _ZodNativeEnum_cache;
|
|
552
585
|
var ParseInputLazyPath = class {
|
|
553
586
|
constructor(parent, value, path, key) {
|
|
554
587
|
this._cachedPath = [];
|
|
@@ -597,12 +630,17 @@ function processCreateParams(params) {
|
|
|
597
630
|
if (errorMap2)
|
|
598
631
|
return { errorMap: errorMap2, description };
|
|
599
632
|
const customMap = (iss, ctx) => {
|
|
600
|
-
|
|
601
|
-
|
|
633
|
+
var _a, _b;
|
|
634
|
+
const { message } = params;
|
|
635
|
+
if (iss.code === "invalid_enum_value") {
|
|
636
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
637
|
+
}
|
|
602
638
|
if (typeof ctx.data === "undefined") {
|
|
603
|
-
return { message:
|
|
639
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
604
640
|
}
|
|
605
|
-
|
|
641
|
+
if (iss.code !== "invalid_type")
|
|
642
|
+
return { message: ctx.defaultError };
|
|
643
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
606
644
|
};
|
|
607
645
|
return { errorMap: customMap, description };
|
|
608
646
|
}
|
|
@@ -631,6 +669,7 @@ var ZodType = class {
|
|
|
631
669
|
this.catch = this.catch.bind(this);
|
|
632
670
|
this.describe = this.describe.bind(this);
|
|
633
671
|
this.pipe = this.pipe.bind(this);
|
|
672
|
+
this.readonly = this.readonly.bind(this);
|
|
634
673
|
this.isNullable = this.isNullable.bind(this);
|
|
635
674
|
this.isOptional = this.isOptional.bind(this);
|
|
636
675
|
}
|
|
@@ -838,6 +877,9 @@ var ZodType = class {
|
|
|
838
877
|
pipe(target) {
|
|
839
878
|
return ZodPipeline.create(this, target);
|
|
840
879
|
}
|
|
880
|
+
readonly() {
|
|
881
|
+
return ZodReadonly.create(this);
|
|
882
|
+
}
|
|
841
883
|
isOptional() {
|
|
842
884
|
return this.safeParse(void 0).success;
|
|
843
885
|
}
|
|
@@ -846,34 +888,40 @@ var ZodType = class {
|
|
|
846
888
|
}
|
|
847
889
|
};
|
|
848
890
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
849
|
-
var cuid2Regex = /^[
|
|
850
|
-
var ulidRegex =
|
|
851
|
-
var uuidRegex = /^
|
|
852
|
-
var
|
|
853
|
-
var
|
|
854
|
-
var
|
|
891
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
892
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
893
|
+
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;
|
|
894
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
895
|
+
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)?)??$/;
|
|
896
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
897
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
898
|
+
var emojiRegex;
|
|
899
|
+
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])$/;
|
|
855
900
|
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})))$/;
|
|
856
|
-
var
|
|
901
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
902
|
+
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])))`;
|
|
903
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
904
|
+
function timeRegexSource(args) {
|
|
905
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
857
906
|
if (args.precision) {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
862
|
-
}
|
|
863
|
-
} else if (args.precision === 0) {
|
|
864
|
-
if (args.offset) {
|
|
865
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
866
|
-
} else {
|
|
867
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
868
|
-
}
|
|
869
|
-
} else {
|
|
870
|
-
if (args.offset) {
|
|
871
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
872
|
-
} else {
|
|
873
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
874
|
-
}
|
|
907
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
908
|
+
} else if (args.precision == null) {
|
|
909
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
875
910
|
}
|
|
876
|
-
|
|
911
|
+
return regex;
|
|
912
|
+
}
|
|
913
|
+
function timeRegex(args) {
|
|
914
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
915
|
+
}
|
|
916
|
+
function datetimeRegex(args) {
|
|
917
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
918
|
+
const opts = [];
|
|
919
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
920
|
+
if (args.offset)
|
|
921
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
922
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
923
|
+
return new RegExp(`^${regex}$`);
|
|
924
|
+
}
|
|
877
925
|
function isValidIP(ip, version) {
|
|
878
926
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
879
927
|
return true;
|
|
@@ -883,28 +931,7 @@ function isValidIP(ip, version) {
|
|
|
883
931
|
}
|
|
884
932
|
return false;
|
|
885
933
|
}
|
|
886
|
-
var ZodString = class extends ZodType {
|
|
887
|
-
constructor() {
|
|
888
|
-
super(...arguments);
|
|
889
|
-
this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
|
|
890
|
-
validation,
|
|
891
|
-
code: ZodIssueCode.invalid_string,
|
|
892
|
-
...errorUtil.errToObj(message)
|
|
893
|
-
});
|
|
894
|
-
this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
|
|
895
|
-
this.trim = () => new ZodString({
|
|
896
|
-
...this._def,
|
|
897
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
898
|
-
});
|
|
899
|
-
this.toLowerCase = () => new ZodString({
|
|
900
|
-
...this._def,
|
|
901
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
902
|
-
});
|
|
903
|
-
this.toUpperCase = () => new ZodString({
|
|
904
|
-
...this._def,
|
|
905
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
906
|
-
});
|
|
907
|
-
}
|
|
934
|
+
var ZodString = class _ZodString extends ZodType {
|
|
908
935
|
_parse(input) {
|
|
909
936
|
if (this._def.coerce) {
|
|
910
937
|
input.data = String(input.data);
|
|
@@ -912,15 +939,11 @@ var ZodString = class extends ZodType {
|
|
|
912
939
|
const parsedType = this._getType(input);
|
|
913
940
|
if (parsedType !== ZodParsedType.string) {
|
|
914
941
|
const ctx2 = this._getOrReturnCtx(input);
|
|
915
|
-
addIssueToContext(
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
received: ctx2.parsedType
|
|
921
|
-
}
|
|
922
|
-
//
|
|
923
|
-
);
|
|
942
|
+
addIssueToContext(ctx2, {
|
|
943
|
+
code: ZodIssueCode.invalid_type,
|
|
944
|
+
expected: ZodParsedType.string,
|
|
945
|
+
received: ctx2.parsedType
|
|
946
|
+
});
|
|
924
947
|
return INVALID;
|
|
925
948
|
}
|
|
926
949
|
const status = new ParseStatus();
|
|
@@ -989,6 +1012,9 @@ var ZodString = class extends ZodType {
|
|
|
989
1012
|
status.dirty();
|
|
990
1013
|
}
|
|
991
1014
|
} else if (check.kind === "emoji") {
|
|
1015
|
+
if (!emojiRegex) {
|
|
1016
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
1017
|
+
}
|
|
992
1018
|
if (!emojiRegex.test(input.data)) {
|
|
993
1019
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
994
1020
|
addIssueToContext(ctx, {
|
|
@@ -1008,6 +1034,16 @@ var ZodString = class extends ZodType {
|
|
|
1008
1034
|
});
|
|
1009
1035
|
status.dirty();
|
|
1010
1036
|
}
|
|
1037
|
+
} else if (check.kind === "nanoid") {
|
|
1038
|
+
if (!nanoidRegex.test(input.data)) {
|
|
1039
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1040
|
+
addIssueToContext(ctx, {
|
|
1041
|
+
validation: "nanoid",
|
|
1042
|
+
code: ZodIssueCode.invalid_string,
|
|
1043
|
+
message: check.message
|
|
1044
|
+
});
|
|
1045
|
+
status.dirty();
|
|
1046
|
+
}
|
|
1011
1047
|
} else if (check.kind === "cuid") {
|
|
1012
1048
|
if (!cuidRegex.test(input.data)) {
|
|
1013
1049
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1109,6 +1145,38 @@ var ZodString = class extends ZodType {
|
|
|
1109
1145
|
});
|
|
1110
1146
|
status.dirty();
|
|
1111
1147
|
}
|
|
1148
|
+
} else if (check.kind === "date") {
|
|
1149
|
+
const regex = dateRegex;
|
|
1150
|
+
if (!regex.test(input.data)) {
|
|
1151
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1152
|
+
addIssueToContext(ctx, {
|
|
1153
|
+
code: ZodIssueCode.invalid_string,
|
|
1154
|
+
validation: "date",
|
|
1155
|
+
message: check.message
|
|
1156
|
+
});
|
|
1157
|
+
status.dirty();
|
|
1158
|
+
}
|
|
1159
|
+
} else if (check.kind === "time") {
|
|
1160
|
+
const regex = timeRegex(check);
|
|
1161
|
+
if (!regex.test(input.data)) {
|
|
1162
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1163
|
+
addIssueToContext(ctx, {
|
|
1164
|
+
code: ZodIssueCode.invalid_string,
|
|
1165
|
+
validation: "time",
|
|
1166
|
+
message: check.message
|
|
1167
|
+
});
|
|
1168
|
+
status.dirty();
|
|
1169
|
+
}
|
|
1170
|
+
} else if (check.kind === "duration") {
|
|
1171
|
+
if (!durationRegex.test(input.data)) {
|
|
1172
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1173
|
+
addIssueToContext(ctx, {
|
|
1174
|
+
validation: "duration",
|
|
1175
|
+
code: ZodIssueCode.invalid_string,
|
|
1176
|
+
message: check.message
|
|
1177
|
+
});
|
|
1178
|
+
status.dirty();
|
|
1179
|
+
}
|
|
1112
1180
|
} else if (check.kind === "ip") {
|
|
1113
1181
|
if (!isValidIP(input.data, check.version)) {
|
|
1114
1182
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1119,14 +1187,31 @@ var ZodString = class extends ZodType {
|
|
|
1119
1187
|
});
|
|
1120
1188
|
status.dirty();
|
|
1121
1189
|
}
|
|
1190
|
+
} else if (check.kind === "base64") {
|
|
1191
|
+
if (!base64Regex.test(input.data)) {
|
|
1192
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1193
|
+
addIssueToContext(ctx, {
|
|
1194
|
+
validation: "base64",
|
|
1195
|
+
code: ZodIssueCode.invalid_string,
|
|
1196
|
+
message: check.message
|
|
1197
|
+
});
|
|
1198
|
+
status.dirty();
|
|
1199
|
+
}
|
|
1122
1200
|
} else {
|
|
1123
1201
|
util.assertNever(check);
|
|
1124
1202
|
}
|
|
1125
1203
|
}
|
|
1126
1204
|
return { status: status.value, value: input.data };
|
|
1127
1205
|
}
|
|
1206
|
+
_regex(regex, validation, message) {
|
|
1207
|
+
return this.refinement((data) => regex.test(data), {
|
|
1208
|
+
validation,
|
|
1209
|
+
code: ZodIssueCode.invalid_string,
|
|
1210
|
+
...errorUtil.errToObj(message)
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1128
1213
|
_addCheck(check) {
|
|
1129
|
-
return new
|
|
1214
|
+
return new _ZodString({
|
|
1130
1215
|
...this._def,
|
|
1131
1216
|
checks: [...this._def.checks, check]
|
|
1132
1217
|
});
|
|
@@ -1143,6 +1228,9 @@ var ZodString = class extends ZodType {
|
|
|
1143
1228
|
uuid(message) {
|
|
1144
1229
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
1145
1230
|
}
|
|
1231
|
+
nanoid(message) {
|
|
1232
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1233
|
+
}
|
|
1146
1234
|
cuid(message) {
|
|
1147
1235
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
1148
1236
|
}
|
|
@@ -1152,16 +1240,20 @@ var ZodString = class extends ZodType {
|
|
|
1152
1240
|
ulid(message) {
|
|
1153
1241
|
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1154
1242
|
}
|
|
1243
|
+
base64(message) {
|
|
1244
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1245
|
+
}
|
|
1155
1246
|
ip(options) {
|
|
1156
1247
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1157
1248
|
}
|
|
1158
1249
|
datetime(options) {
|
|
1159
|
-
var _a;
|
|
1250
|
+
var _a, _b;
|
|
1160
1251
|
if (typeof options === "string") {
|
|
1161
1252
|
return this._addCheck({
|
|
1162
1253
|
kind: "datetime",
|
|
1163
1254
|
precision: null,
|
|
1164
1255
|
offset: false,
|
|
1256
|
+
local: false,
|
|
1165
1257
|
message: options
|
|
1166
1258
|
});
|
|
1167
1259
|
}
|
|
@@ -1169,9 +1261,30 @@ var ZodString = class extends ZodType {
|
|
|
1169
1261
|
kind: "datetime",
|
|
1170
1262
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1171
1263
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1264
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1265
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
date(message) {
|
|
1269
|
+
return this._addCheck({ kind: "date", message });
|
|
1270
|
+
}
|
|
1271
|
+
time(options) {
|
|
1272
|
+
if (typeof options === "string") {
|
|
1273
|
+
return this._addCheck({
|
|
1274
|
+
kind: "time",
|
|
1275
|
+
precision: null,
|
|
1276
|
+
message: options
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
return this._addCheck({
|
|
1280
|
+
kind: "time",
|
|
1281
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1172
1282
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1173
1283
|
});
|
|
1174
1284
|
}
|
|
1285
|
+
duration(message) {
|
|
1286
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1287
|
+
}
|
|
1175
1288
|
regex(regex, message) {
|
|
1176
1289
|
return this._addCheck({
|
|
1177
1290
|
kind: "regex",
|
|
@@ -1222,9 +1335,43 @@ var ZodString = class extends ZodType {
|
|
|
1222
1335
|
...errorUtil.errToObj(message)
|
|
1223
1336
|
});
|
|
1224
1337
|
}
|
|
1338
|
+
/**
|
|
1339
|
+
* @deprecated Use z.string().min(1) instead.
|
|
1340
|
+
* @see {@link ZodString.min}
|
|
1341
|
+
*/
|
|
1342
|
+
nonempty(message) {
|
|
1343
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1344
|
+
}
|
|
1345
|
+
trim() {
|
|
1346
|
+
return new _ZodString({
|
|
1347
|
+
...this._def,
|
|
1348
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
toLowerCase() {
|
|
1352
|
+
return new _ZodString({
|
|
1353
|
+
...this._def,
|
|
1354
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
toUpperCase() {
|
|
1358
|
+
return new _ZodString({
|
|
1359
|
+
...this._def,
|
|
1360
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1225
1363
|
get isDatetime() {
|
|
1226
1364
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1227
1365
|
}
|
|
1366
|
+
get isDate() {
|
|
1367
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1368
|
+
}
|
|
1369
|
+
get isTime() {
|
|
1370
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1371
|
+
}
|
|
1372
|
+
get isDuration() {
|
|
1373
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1374
|
+
}
|
|
1228
1375
|
get isEmail() {
|
|
1229
1376
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1230
1377
|
}
|
|
@@ -1237,6 +1384,9 @@ var ZodString = class extends ZodType {
|
|
|
1237
1384
|
get isUUID() {
|
|
1238
1385
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1239
1386
|
}
|
|
1387
|
+
get isNANOID() {
|
|
1388
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1389
|
+
}
|
|
1240
1390
|
get isCUID() {
|
|
1241
1391
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1242
1392
|
}
|
|
@@ -1249,6 +1399,9 @@ var ZodString = class extends ZodType {
|
|
|
1249
1399
|
get isIP() {
|
|
1250
1400
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1251
1401
|
}
|
|
1402
|
+
get isBase64() {
|
|
1403
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1404
|
+
}
|
|
1252
1405
|
get minLength() {
|
|
1253
1406
|
let min = null;
|
|
1254
1407
|
for (const ch of this._def.checks) {
|
|
@@ -1287,7 +1440,7 @@ function floatSafeRemainder(val, step) {
|
|
|
1287
1440
|
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1288
1441
|
return valInt % stepInt / Math.pow(10, decCount);
|
|
1289
1442
|
}
|
|
1290
|
-
var ZodNumber = class extends ZodType {
|
|
1443
|
+
var ZodNumber = class _ZodNumber extends ZodType {
|
|
1291
1444
|
constructor() {
|
|
1292
1445
|
super(...arguments);
|
|
1293
1446
|
this.min = this.gte;
|
|
@@ -1388,7 +1541,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1388
1541
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1389
1542
|
}
|
|
1390
1543
|
setLimit(kind, value, inclusive, message) {
|
|
1391
|
-
return new
|
|
1544
|
+
return new _ZodNumber({
|
|
1392
1545
|
...this._def,
|
|
1393
1546
|
checks: [
|
|
1394
1547
|
...this._def.checks,
|
|
@@ -1402,7 +1555,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1402
1555
|
});
|
|
1403
1556
|
}
|
|
1404
1557
|
_addCheck(check) {
|
|
1405
|
-
return new
|
|
1558
|
+
return new _ZodNumber({
|
|
1406
1559
|
...this._def,
|
|
1407
1560
|
checks: [...this._def.checks, check]
|
|
1408
1561
|
});
|
|
@@ -1518,7 +1671,7 @@ ZodNumber.create = (params) => {
|
|
|
1518
1671
|
...processCreateParams(params)
|
|
1519
1672
|
});
|
|
1520
1673
|
};
|
|
1521
|
-
var ZodBigInt = class extends ZodType {
|
|
1674
|
+
var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
1522
1675
|
constructor() {
|
|
1523
1676
|
super(...arguments);
|
|
1524
1677
|
this.min = this.gte;
|
|
@@ -1596,7 +1749,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1596
1749
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1597
1750
|
}
|
|
1598
1751
|
setLimit(kind, value, inclusive, message) {
|
|
1599
|
-
return new
|
|
1752
|
+
return new _ZodBigInt({
|
|
1600
1753
|
...this._def,
|
|
1601
1754
|
checks: [
|
|
1602
1755
|
...this._def.checks,
|
|
@@ -1610,7 +1763,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1610
1763
|
});
|
|
1611
1764
|
}
|
|
1612
1765
|
_addCheck(check) {
|
|
1613
|
-
return new
|
|
1766
|
+
return new _ZodBigInt({
|
|
1614
1767
|
...this._def,
|
|
1615
1768
|
checks: [...this._def.checks, check]
|
|
1616
1769
|
});
|
|
@@ -1709,7 +1862,7 @@ ZodBoolean.create = (params) => {
|
|
|
1709
1862
|
...processCreateParams(params)
|
|
1710
1863
|
});
|
|
1711
1864
|
};
|
|
1712
|
-
var ZodDate = class extends ZodType {
|
|
1865
|
+
var ZodDate = class _ZodDate extends ZodType {
|
|
1713
1866
|
_parse(input) {
|
|
1714
1867
|
if (this._def.coerce) {
|
|
1715
1868
|
input.data = new Date(input.data);
|
|
@@ -1770,7 +1923,7 @@ var ZodDate = class extends ZodType {
|
|
|
1770
1923
|
};
|
|
1771
1924
|
}
|
|
1772
1925
|
_addCheck(check) {
|
|
1773
|
-
return new
|
|
1926
|
+
return new _ZodDate({
|
|
1774
1927
|
...this._def,
|
|
1775
1928
|
checks: [...this._def.checks, check]
|
|
1776
1929
|
});
|
|
@@ -1949,7 +2102,7 @@ ZodVoid.create = (params) => {
|
|
|
1949
2102
|
...processCreateParams(params)
|
|
1950
2103
|
});
|
|
1951
2104
|
};
|
|
1952
|
-
var ZodArray = class extends ZodType {
|
|
2105
|
+
var ZodArray = class _ZodArray extends ZodType {
|
|
1953
2106
|
_parse(input) {
|
|
1954
2107
|
const { ctx, status } = this._processInputParams(input);
|
|
1955
2108
|
const def = this._def;
|
|
@@ -2019,19 +2172,19 @@ var ZodArray = class extends ZodType {
|
|
|
2019
2172
|
return this._def.type;
|
|
2020
2173
|
}
|
|
2021
2174
|
min(minLength, message) {
|
|
2022
|
-
return new
|
|
2175
|
+
return new _ZodArray({
|
|
2023
2176
|
...this._def,
|
|
2024
2177
|
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
2025
2178
|
});
|
|
2026
2179
|
}
|
|
2027
2180
|
max(maxLength, message) {
|
|
2028
|
-
return new
|
|
2181
|
+
return new _ZodArray({
|
|
2029
2182
|
...this._def,
|
|
2030
2183
|
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
2031
2184
|
});
|
|
2032
2185
|
}
|
|
2033
2186
|
length(len, message) {
|
|
2034
|
-
return new
|
|
2187
|
+
return new _ZodArray({
|
|
2035
2188
|
...this._def,
|
|
2036
2189
|
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
2037
2190
|
});
|
|
@@ -2076,7 +2229,7 @@ function deepPartialify(schema) {
|
|
|
2076
2229
|
return schema;
|
|
2077
2230
|
}
|
|
2078
2231
|
}
|
|
2079
|
-
var ZodObject = class extends ZodType {
|
|
2232
|
+
var ZodObject = class _ZodObject extends ZodType {
|
|
2080
2233
|
constructor() {
|
|
2081
2234
|
super(...arguments);
|
|
2082
2235
|
this._cached = null;
|
|
@@ -2162,9 +2315,10 @@ var ZodObject = class extends ZodType {
|
|
|
2162
2315
|
const syncPairs = [];
|
|
2163
2316
|
for (const pair of pairs) {
|
|
2164
2317
|
const key = await pair.key;
|
|
2318
|
+
const value = await pair.value;
|
|
2165
2319
|
syncPairs.push({
|
|
2166
2320
|
key,
|
|
2167
|
-
value
|
|
2321
|
+
value,
|
|
2168
2322
|
alwaysSet: pair.alwaysSet
|
|
2169
2323
|
});
|
|
2170
2324
|
}
|
|
@@ -2181,7 +2335,7 @@ var ZodObject = class extends ZodType {
|
|
|
2181
2335
|
}
|
|
2182
2336
|
strict(message) {
|
|
2183
2337
|
errorUtil.errToObj;
|
|
2184
|
-
return new
|
|
2338
|
+
return new _ZodObject({
|
|
2185
2339
|
...this._def,
|
|
2186
2340
|
unknownKeys: "strict",
|
|
2187
2341
|
...message !== void 0 ? {
|
|
@@ -2200,13 +2354,13 @@ var ZodObject = class extends ZodType {
|
|
|
2200
2354
|
});
|
|
2201
2355
|
}
|
|
2202
2356
|
strip() {
|
|
2203
|
-
return new
|
|
2357
|
+
return new _ZodObject({
|
|
2204
2358
|
...this._def,
|
|
2205
2359
|
unknownKeys: "strip"
|
|
2206
2360
|
});
|
|
2207
2361
|
}
|
|
2208
2362
|
passthrough() {
|
|
2209
|
-
return new
|
|
2363
|
+
return new _ZodObject({
|
|
2210
2364
|
...this._def,
|
|
2211
2365
|
unknownKeys: "passthrough"
|
|
2212
2366
|
});
|
|
@@ -2229,7 +2383,7 @@ var ZodObject = class extends ZodType {
|
|
|
2229
2383
|
// }) as any;
|
|
2230
2384
|
// };
|
|
2231
2385
|
extend(augmentation) {
|
|
2232
|
-
return new
|
|
2386
|
+
return new _ZodObject({
|
|
2233
2387
|
...this._def,
|
|
2234
2388
|
shape: () => ({
|
|
2235
2389
|
...this._def.shape(),
|
|
@@ -2243,7 +2397,7 @@ var ZodObject = class extends ZodType {
|
|
|
2243
2397
|
* upgrade if you are experiencing issues.
|
|
2244
2398
|
*/
|
|
2245
2399
|
merge(merging) {
|
|
2246
|
-
const merged = new
|
|
2400
|
+
const merged = new _ZodObject({
|
|
2247
2401
|
unknownKeys: merging._def.unknownKeys,
|
|
2248
2402
|
catchall: merging._def.catchall,
|
|
2249
2403
|
shape: () => ({
|
|
@@ -2314,7 +2468,7 @@ var ZodObject = class extends ZodType {
|
|
|
2314
2468
|
// return merged;
|
|
2315
2469
|
// }
|
|
2316
2470
|
catchall(index) {
|
|
2317
|
-
return new
|
|
2471
|
+
return new _ZodObject({
|
|
2318
2472
|
...this._def,
|
|
2319
2473
|
catchall: index
|
|
2320
2474
|
});
|
|
@@ -2326,7 +2480,7 @@ var ZodObject = class extends ZodType {
|
|
|
2326
2480
|
shape[key] = this.shape[key];
|
|
2327
2481
|
}
|
|
2328
2482
|
});
|
|
2329
|
-
return new
|
|
2483
|
+
return new _ZodObject({
|
|
2330
2484
|
...this._def,
|
|
2331
2485
|
shape: () => shape
|
|
2332
2486
|
});
|
|
@@ -2338,7 +2492,7 @@ var ZodObject = class extends ZodType {
|
|
|
2338
2492
|
shape[key] = this.shape[key];
|
|
2339
2493
|
}
|
|
2340
2494
|
});
|
|
2341
|
-
return new
|
|
2495
|
+
return new _ZodObject({
|
|
2342
2496
|
...this._def,
|
|
2343
2497
|
shape: () => shape
|
|
2344
2498
|
});
|
|
@@ -2359,7 +2513,7 @@ var ZodObject = class extends ZodType {
|
|
|
2359
2513
|
newShape[key] = fieldSchema.optional();
|
|
2360
2514
|
}
|
|
2361
2515
|
});
|
|
2362
|
-
return new
|
|
2516
|
+
return new _ZodObject({
|
|
2363
2517
|
...this._def,
|
|
2364
2518
|
shape: () => newShape
|
|
2365
2519
|
});
|
|
@@ -2378,7 +2532,7 @@ var ZodObject = class extends ZodType {
|
|
|
2378
2532
|
newShape[key] = newField;
|
|
2379
2533
|
}
|
|
2380
2534
|
});
|
|
2381
|
-
return new
|
|
2535
|
+
return new _ZodObject({
|
|
2382
2536
|
...this._def,
|
|
2383
2537
|
shape: () => newShape
|
|
2384
2538
|
});
|
|
@@ -2515,18 +2669,28 @@ var getDiscriminator = (type) => {
|
|
|
2515
2669
|
} else if (type instanceof ZodEnum) {
|
|
2516
2670
|
return type.options;
|
|
2517
2671
|
} else if (type instanceof ZodNativeEnum) {
|
|
2518
|
-
return
|
|
2672
|
+
return util.objectValues(type.enum);
|
|
2519
2673
|
} else if (type instanceof ZodDefault) {
|
|
2520
2674
|
return getDiscriminator(type._def.innerType);
|
|
2521
2675
|
} else if (type instanceof ZodUndefined) {
|
|
2522
2676
|
return [void 0];
|
|
2523
2677
|
} else if (type instanceof ZodNull) {
|
|
2524
2678
|
return [null];
|
|
2679
|
+
} else if (type instanceof ZodOptional) {
|
|
2680
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2681
|
+
} else if (type instanceof ZodNullable) {
|
|
2682
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2683
|
+
} else if (type instanceof ZodBranded) {
|
|
2684
|
+
return getDiscriminator(type.unwrap());
|
|
2685
|
+
} else if (type instanceof ZodReadonly) {
|
|
2686
|
+
return getDiscriminator(type.unwrap());
|
|
2687
|
+
} else if (type instanceof ZodCatch) {
|
|
2688
|
+
return getDiscriminator(type._def.innerType);
|
|
2525
2689
|
} else {
|
|
2526
|
-
return
|
|
2690
|
+
return [];
|
|
2527
2691
|
}
|
|
2528
2692
|
};
|
|
2529
|
-
var ZodDiscriminatedUnion = class extends ZodType {
|
|
2693
|
+
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
2530
2694
|
_parse(input) {
|
|
2531
2695
|
const { ctx } = this._processInputParams(input);
|
|
2532
2696
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -2583,7 +2747,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2583
2747
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2584
2748
|
for (const type of options) {
|
|
2585
2749
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2586
|
-
if (!discriminatorValues) {
|
|
2750
|
+
if (!discriminatorValues.length) {
|
|
2587
2751
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2588
2752
|
}
|
|
2589
2753
|
for (const value of discriminatorValues) {
|
|
@@ -2593,7 +2757,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2593
2757
|
optionsMap.set(value, type);
|
|
2594
2758
|
}
|
|
2595
2759
|
}
|
|
2596
|
-
return new
|
|
2760
|
+
return new _ZodDiscriminatedUnion({
|
|
2597
2761
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
2598
2762
|
discriminator,
|
|
2599
2763
|
options,
|
|
@@ -2693,7 +2857,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
2693
2857
|
...processCreateParams(params)
|
|
2694
2858
|
});
|
|
2695
2859
|
};
|
|
2696
|
-
var ZodTuple = class extends ZodType {
|
|
2860
|
+
var ZodTuple = class _ZodTuple extends ZodType {
|
|
2697
2861
|
_parse(input) {
|
|
2698
2862
|
const { status, ctx } = this._processInputParams(input);
|
|
2699
2863
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -2743,7 +2907,7 @@ var ZodTuple = class extends ZodType {
|
|
|
2743
2907
|
return this._def.items;
|
|
2744
2908
|
}
|
|
2745
2909
|
rest(rest) {
|
|
2746
|
-
return new
|
|
2910
|
+
return new _ZodTuple({
|
|
2747
2911
|
...this._def,
|
|
2748
2912
|
rest
|
|
2749
2913
|
});
|
|
@@ -2760,7 +2924,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
2760
2924
|
...processCreateParams(params)
|
|
2761
2925
|
});
|
|
2762
2926
|
};
|
|
2763
|
-
var ZodRecord = class extends ZodType {
|
|
2927
|
+
var ZodRecord = class _ZodRecord extends ZodType {
|
|
2764
2928
|
get keySchema() {
|
|
2765
2929
|
return this._def.keyType;
|
|
2766
2930
|
}
|
|
@@ -2783,7 +2947,8 @@ var ZodRecord = class extends ZodType {
|
|
|
2783
2947
|
for (const key in ctx.data) {
|
|
2784
2948
|
pairs.push({
|
|
2785
2949
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
2786
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
2950
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
2951
|
+
alwaysSet: key in ctx.data
|
|
2787
2952
|
});
|
|
2788
2953
|
}
|
|
2789
2954
|
if (ctx.common.async) {
|
|
@@ -2797,14 +2962,14 @@ var ZodRecord = class extends ZodType {
|
|
|
2797
2962
|
}
|
|
2798
2963
|
static create(first, second, third) {
|
|
2799
2964
|
if (second instanceof ZodType) {
|
|
2800
|
-
return new
|
|
2965
|
+
return new _ZodRecord({
|
|
2801
2966
|
keyType: first,
|
|
2802
2967
|
valueType: second,
|
|
2803
2968
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
2804
2969
|
...processCreateParams(third)
|
|
2805
2970
|
});
|
|
2806
2971
|
}
|
|
2807
|
-
return new
|
|
2972
|
+
return new _ZodRecord({
|
|
2808
2973
|
keyType: ZodString.create(),
|
|
2809
2974
|
valueType: first,
|
|
2810
2975
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
@@ -2813,6 +2978,12 @@ var ZodRecord = class extends ZodType {
|
|
|
2813
2978
|
}
|
|
2814
2979
|
};
|
|
2815
2980
|
var ZodMap = class extends ZodType {
|
|
2981
|
+
get keySchema() {
|
|
2982
|
+
return this._def.keyType;
|
|
2983
|
+
}
|
|
2984
|
+
get valueSchema() {
|
|
2985
|
+
return this._def.valueType;
|
|
2986
|
+
}
|
|
2816
2987
|
_parse(input) {
|
|
2817
2988
|
const { status, ctx } = this._processInputParams(input);
|
|
2818
2989
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -2872,7 +3043,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
2872
3043
|
...processCreateParams(params)
|
|
2873
3044
|
});
|
|
2874
3045
|
};
|
|
2875
|
-
var ZodSet = class extends ZodType {
|
|
3046
|
+
var ZodSet = class _ZodSet extends ZodType {
|
|
2876
3047
|
_parse(input) {
|
|
2877
3048
|
const { status, ctx } = this._processInputParams(input);
|
|
2878
3049
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -2930,13 +3101,13 @@ var ZodSet = class extends ZodType {
|
|
|
2930
3101
|
}
|
|
2931
3102
|
}
|
|
2932
3103
|
min(minSize, message) {
|
|
2933
|
-
return new
|
|
3104
|
+
return new _ZodSet({
|
|
2934
3105
|
...this._def,
|
|
2935
3106
|
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
2936
3107
|
});
|
|
2937
3108
|
}
|
|
2938
3109
|
max(maxSize, message) {
|
|
2939
|
-
return new
|
|
3110
|
+
return new _ZodSet({
|
|
2940
3111
|
...this._def,
|
|
2941
3112
|
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
2942
3113
|
});
|
|
@@ -2957,7 +3128,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
2957
3128
|
...processCreateParams(params)
|
|
2958
3129
|
});
|
|
2959
3130
|
};
|
|
2960
|
-
var ZodFunction = class extends ZodType {
|
|
3131
|
+
var ZodFunction = class _ZodFunction extends ZodType {
|
|
2961
3132
|
constructor() {
|
|
2962
3133
|
super(...arguments);
|
|
2963
3134
|
this.validate = this.implement;
|
|
@@ -3007,27 +3178,29 @@ var ZodFunction = class extends ZodType {
|
|
|
3007
3178
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3008
3179
|
const fn = ctx.data;
|
|
3009
3180
|
if (this._def.returns instanceof ZodPromise) {
|
|
3010
|
-
|
|
3181
|
+
const me = this;
|
|
3182
|
+
return OK(async function(...args) {
|
|
3011
3183
|
const error = new ZodError([]);
|
|
3012
|
-
const parsedArgs = await
|
|
3184
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
3013
3185
|
error.addIssue(makeArgsIssue(args, e));
|
|
3014
3186
|
throw error;
|
|
3015
3187
|
});
|
|
3016
|
-
const result = await fn
|
|
3017
|
-
const parsedReturns = await
|
|
3188
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3189
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
3018
3190
|
error.addIssue(makeReturnsIssue(result, e));
|
|
3019
3191
|
throw error;
|
|
3020
3192
|
});
|
|
3021
3193
|
return parsedReturns;
|
|
3022
3194
|
});
|
|
3023
3195
|
} else {
|
|
3024
|
-
|
|
3025
|
-
|
|
3196
|
+
const me = this;
|
|
3197
|
+
return OK(function(...args) {
|
|
3198
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
3026
3199
|
if (!parsedArgs.success) {
|
|
3027
3200
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3028
3201
|
}
|
|
3029
|
-
const result = fn
|
|
3030
|
-
const parsedReturns =
|
|
3202
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3203
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3031
3204
|
if (!parsedReturns.success) {
|
|
3032
3205
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
3033
3206
|
}
|
|
@@ -3042,13 +3215,13 @@ var ZodFunction = class extends ZodType {
|
|
|
3042
3215
|
return this._def.returns;
|
|
3043
3216
|
}
|
|
3044
3217
|
args(...items) {
|
|
3045
|
-
return new
|
|
3218
|
+
return new _ZodFunction({
|
|
3046
3219
|
...this._def,
|
|
3047
3220
|
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
3048
3221
|
});
|
|
3049
3222
|
}
|
|
3050
3223
|
returns(returnType) {
|
|
3051
|
-
return new
|
|
3224
|
+
return new _ZodFunction({
|
|
3052
3225
|
...this._def,
|
|
3053
3226
|
returns: returnType
|
|
3054
3227
|
});
|
|
@@ -3062,7 +3235,7 @@ var ZodFunction = class extends ZodType {
|
|
|
3062
3235
|
return validatedFunc;
|
|
3063
3236
|
}
|
|
3064
3237
|
static create(args, returns, params) {
|
|
3065
|
-
return new
|
|
3238
|
+
return new _ZodFunction({
|
|
3066
3239
|
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
3067
3240
|
returns: returns || ZodUnknown.create(),
|
|
3068
3241
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
@@ -3118,7 +3291,11 @@ function createZodEnum(values, params) {
|
|
|
3118
3291
|
...processCreateParams(params)
|
|
3119
3292
|
});
|
|
3120
3293
|
}
|
|
3121
|
-
var ZodEnum = class extends ZodType {
|
|
3294
|
+
var ZodEnum = class _ZodEnum extends ZodType {
|
|
3295
|
+
constructor() {
|
|
3296
|
+
super(...arguments);
|
|
3297
|
+
_ZodEnum_cache.set(this, void 0);
|
|
3298
|
+
}
|
|
3122
3299
|
_parse(input) {
|
|
3123
3300
|
if (typeof input.data !== "string") {
|
|
3124
3301
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3130,7 +3307,10 @@ var ZodEnum = class extends ZodType {
|
|
|
3130
3307
|
});
|
|
3131
3308
|
return INVALID;
|
|
3132
3309
|
}
|
|
3133
|
-
if (this
|
|
3310
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
3311
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
3312
|
+
}
|
|
3313
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
3134
3314
|
const ctx = this._getOrReturnCtx(input);
|
|
3135
3315
|
const expectedValues = this._def.values;
|
|
3136
3316
|
addIssueToContext(ctx, {
|
|
@@ -3166,15 +3346,26 @@ var ZodEnum = class extends ZodType {
|
|
|
3166
3346
|
}
|
|
3167
3347
|
return enumValues;
|
|
3168
3348
|
}
|
|
3169
|
-
extract(values) {
|
|
3170
|
-
return
|
|
3349
|
+
extract(values, newDef = this._def) {
|
|
3350
|
+
return _ZodEnum.create(values, {
|
|
3351
|
+
...this._def,
|
|
3352
|
+
...newDef
|
|
3353
|
+
});
|
|
3171
3354
|
}
|
|
3172
|
-
exclude(values) {
|
|
3173
|
-
return
|
|
3355
|
+
exclude(values, newDef = this._def) {
|
|
3356
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3357
|
+
...this._def,
|
|
3358
|
+
...newDef
|
|
3359
|
+
});
|
|
3174
3360
|
}
|
|
3175
3361
|
};
|
|
3362
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3176
3363
|
ZodEnum.create = createZodEnum;
|
|
3177
3364
|
var ZodNativeEnum = class extends ZodType {
|
|
3365
|
+
constructor() {
|
|
3366
|
+
super(...arguments);
|
|
3367
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
3368
|
+
}
|
|
3178
3369
|
_parse(input) {
|
|
3179
3370
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3180
3371
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3187,7 +3378,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3187
3378
|
});
|
|
3188
3379
|
return INVALID;
|
|
3189
3380
|
}
|
|
3190
|
-
if (
|
|
3381
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
3382
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
3383
|
+
}
|
|
3384
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
3191
3385
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3192
3386
|
addIssueToContext(ctx, {
|
|
3193
3387
|
received: ctx.data,
|
|
@@ -3202,6 +3396,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3202
3396
|
return this._def.values;
|
|
3203
3397
|
}
|
|
3204
3398
|
};
|
|
3399
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3205
3400
|
ZodNativeEnum.create = (values, params) => {
|
|
3206
3401
|
return new ZodNativeEnum({
|
|
3207
3402
|
values,
|
|
@@ -3249,24 +3444,6 @@ var ZodEffects = class extends ZodType {
|
|
|
3249
3444
|
_parse(input) {
|
|
3250
3445
|
const { status, ctx } = this._processInputParams(input);
|
|
3251
3446
|
const effect = this._def.effect || null;
|
|
3252
|
-
if (effect.type === "preprocess") {
|
|
3253
|
-
const processed = effect.transform(ctx.data);
|
|
3254
|
-
if (ctx.common.async) {
|
|
3255
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
3256
|
-
return this._def.schema._parseAsync({
|
|
3257
|
-
data: processed2,
|
|
3258
|
-
path: ctx.path,
|
|
3259
|
-
parent: ctx
|
|
3260
|
-
});
|
|
3261
|
-
});
|
|
3262
|
-
} else {
|
|
3263
|
-
return this._def.schema._parseSync({
|
|
3264
|
-
data: processed,
|
|
3265
|
-
path: ctx.path,
|
|
3266
|
-
parent: ctx
|
|
3267
|
-
});
|
|
3268
|
-
}
|
|
3269
|
-
}
|
|
3270
3447
|
const checkCtx = {
|
|
3271
3448
|
addIssue: (arg) => {
|
|
3272
3449
|
addIssueToContext(ctx, arg);
|
|
@@ -3281,6 +3458,42 @@ var ZodEffects = class extends ZodType {
|
|
|
3281
3458
|
}
|
|
3282
3459
|
};
|
|
3283
3460
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3461
|
+
if (effect.type === "preprocess") {
|
|
3462
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3463
|
+
if (ctx.common.async) {
|
|
3464
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3465
|
+
if (status.value === "aborted")
|
|
3466
|
+
return INVALID;
|
|
3467
|
+
const result = await this._def.schema._parseAsync({
|
|
3468
|
+
data: processed2,
|
|
3469
|
+
path: ctx.path,
|
|
3470
|
+
parent: ctx
|
|
3471
|
+
});
|
|
3472
|
+
if (result.status === "aborted")
|
|
3473
|
+
return INVALID;
|
|
3474
|
+
if (result.status === "dirty")
|
|
3475
|
+
return DIRTY(result.value);
|
|
3476
|
+
if (status.value === "dirty")
|
|
3477
|
+
return DIRTY(result.value);
|
|
3478
|
+
return result;
|
|
3479
|
+
});
|
|
3480
|
+
} else {
|
|
3481
|
+
if (status.value === "aborted")
|
|
3482
|
+
return INVALID;
|
|
3483
|
+
const result = this._def.schema._parseSync({
|
|
3484
|
+
data: processed,
|
|
3485
|
+
path: ctx.path,
|
|
3486
|
+
parent: ctx
|
|
3487
|
+
});
|
|
3488
|
+
if (result.status === "aborted")
|
|
3489
|
+
return INVALID;
|
|
3490
|
+
if (result.status === "dirty")
|
|
3491
|
+
return DIRTY(result.value);
|
|
3492
|
+
if (status.value === "dirty")
|
|
3493
|
+
return DIRTY(result.value);
|
|
3494
|
+
return result;
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3284
3497
|
if (effect.type === "refinement") {
|
|
3285
3498
|
const executeRefinement = (acc) => {
|
|
3286
3499
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -3509,7 +3722,7 @@ var ZodBranded = class extends ZodType {
|
|
|
3509
3722
|
return this._def.type;
|
|
3510
3723
|
}
|
|
3511
3724
|
};
|
|
3512
|
-
var ZodPipeline = class extends ZodType {
|
|
3725
|
+
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
3513
3726
|
_parse(input) {
|
|
3514
3727
|
const { status, ctx } = this._processInputParams(input);
|
|
3515
3728
|
if (ctx.common.async) {
|
|
@@ -3557,14 +3770,36 @@ var ZodPipeline = class extends ZodType {
|
|
|
3557
3770
|
}
|
|
3558
3771
|
}
|
|
3559
3772
|
static create(a, b) {
|
|
3560
|
-
return new
|
|
3773
|
+
return new _ZodPipeline({
|
|
3561
3774
|
in: a,
|
|
3562
3775
|
out: b,
|
|
3563
3776
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3564
3777
|
});
|
|
3565
3778
|
}
|
|
3566
3779
|
};
|
|
3567
|
-
var
|
|
3780
|
+
var ZodReadonly = class extends ZodType {
|
|
3781
|
+
_parse(input) {
|
|
3782
|
+
const result = this._def.innerType._parse(input);
|
|
3783
|
+
const freeze = (data) => {
|
|
3784
|
+
if (isValid(data)) {
|
|
3785
|
+
data.value = Object.freeze(data.value);
|
|
3786
|
+
}
|
|
3787
|
+
return data;
|
|
3788
|
+
};
|
|
3789
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3790
|
+
}
|
|
3791
|
+
unwrap() {
|
|
3792
|
+
return this._def.innerType;
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
ZodReadonly.create = (type, params) => {
|
|
3796
|
+
return new ZodReadonly({
|
|
3797
|
+
innerType: type,
|
|
3798
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3799
|
+
...processCreateParams(params)
|
|
3800
|
+
});
|
|
3801
|
+
};
|
|
3802
|
+
function custom(check, params = {}, fatal) {
|
|
3568
3803
|
if (check)
|
|
3569
3804
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3570
3805
|
var _a, _b;
|
|
@@ -3576,7 +3811,7 @@ var custom = (check, params = {}, fatal) => {
|
|
|
3576
3811
|
}
|
|
3577
3812
|
});
|
|
3578
3813
|
return ZodAny.create();
|
|
3579
|
-
}
|
|
3814
|
+
}
|
|
3580
3815
|
var late = {
|
|
3581
3816
|
object: ZodObject.lazycreate
|
|
3582
3817
|
};
|
|
@@ -3617,6 +3852,7 @@ var ZodFirstPartyTypeKind;
|
|
|
3617
3852
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3618
3853
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3619
3854
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3855
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3620
3856
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3621
3857
|
var instanceOfType = (cls, params = {
|
|
3622
3858
|
message: `Input not instance of ${cls.name}`
|
|
@@ -3694,6 +3930,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3694
3930
|
ZodParsedType,
|
|
3695
3931
|
getParsedType,
|
|
3696
3932
|
ZodType,
|
|
3933
|
+
datetimeRegex,
|
|
3697
3934
|
ZodString,
|
|
3698
3935
|
ZodNumber,
|
|
3699
3936
|
ZodBigInt,
|
|
@@ -3731,6 +3968,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3731
3968
|
BRAND,
|
|
3732
3969
|
ZodBranded,
|
|
3733
3970
|
ZodPipeline,
|
|
3971
|
+
ZodReadonly,
|
|
3734
3972
|
custom,
|
|
3735
3973
|
Schema: ZodType,
|
|
3736
3974
|
ZodSchema: ZodType,
|
|
@@ -3951,28 +4189,23 @@ var itemCategoriesSearchSchema = z.object({
|
|
|
3951
4189
|
data: z.array(itemCategorySchema)
|
|
3952
4190
|
});
|
|
3953
4191
|
|
|
3954
|
-
// lib/categories/models/
|
|
4192
|
+
// lib/categories/models/ItemHierarchyResponse.ts
|
|
3955
4193
|
var baseHierarchySchema = z.object({
|
|
3956
4194
|
id: z.string(),
|
|
3957
4195
|
name: z.string().nullish(),
|
|
3958
4196
|
description: z.string().nullish(),
|
|
3959
4197
|
type: z.string().nullish()
|
|
3960
4198
|
});
|
|
3961
|
-
var hierarchySchema = baseHierarchySchema.extend(
|
|
3962
|
-
|
|
3963
|
-
child: z.lazy(() => hierarchySchema).nullable()
|
|
3964
|
-
}
|
|
3965
|
-
);
|
|
3966
|
-
|
|
3967
|
-
// lib/categories/models/ItemHierarchy.ts
|
|
3968
|
-
var itemHierarchySchema = z.object({
|
|
3969
|
-
itemId: z.string(),
|
|
3970
|
-
hierarchies: z.array(hierarchySchema)
|
|
4199
|
+
var hierarchySchema = baseHierarchySchema.extend({
|
|
4200
|
+
child: z.lazy(() => hierarchySchema).nullable()
|
|
3971
4201
|
});
|
|
3972
|
-
|
|
3973
|
-
// lib/categories/models/ItemHierarchyResponse.ts
|
|
3974
4202
|
var itemHierarchyResponseSchema = z.object({
|
|
3975
|
-
itemHierarchies: z.array(
|
|
4203
|
+
itemHierarchies: z.array(
|
|
4204
|
+
z.object({
|
|
4205
|
+
itemId: z.string(),
|
|
4206
|
+
hierarchies: z.array(hierarchySchema)
|
|
4207
|
+
})
|
|
4208
|
+
)
|
|
3976
4209
|
});
|
|
3977
4210
|
|
|
3978
4211
|
// lib/attributes/models/AttributeMetaData.ts
|
|
@@ -4129,7 +4362,7 @@ var attributeValidValuesSchema = z.object({
|
|
|
4129
4362
|
attrKeyPair: z.string()
|
|
4130
4363
|
});
|
|
4131
4364
|
|
|
4132
|
-
// lib/items/models/ItemHeader.ts
|
|
4365
|
+
// lib/items/v1/models/ItemHeader.ts
|
|
4133
4366
|
var itemHeaderSchema = z.object({
|
|
4134
4367
|
status: z.string().optional(),
|
|
4135
4368
|
catalogName: z.string(),
|
|
@@ -4145,7 +4378,7 @@ var itemHeaderSchema = z.object({
|
|
|
4145
4378
|
itemInfoId: z.string()
|
|
4146
4379
|
});
|
|
4147
4380
|
|
|
4148
|
-
// lib/items/models/PhaseEnum.ts
|
|
4381
|
+
// lib/items/v1/models/PhaseEnum.ts
|
|
4149
4382
|
var phaseEnumSchema = z.enum([
|
|
4150
4383
|
"CORE",
|
|
4151
4384
|
"CORE_PLUS",
|
|
@@ -4154,7 +4387,7 @@ var phaseEnumSchema = z.enum([
|
|
|
4154
4387
|
"STANDARD_REQUIREMENTS"
|
|
4155
4388
|
]);
|
|
4156
4389
|
|
|
4157
|
-
// lib/items/models/TradingPartnerStage.ts
|
|
4390
|
+
// lib/items/v1/models/TradingPartnerStage.ts
|
|
4158
4391
|
var tradingPartnerStageSchema = z.object({
|
|
4159
4392
|
companyId: z.number(),
|
|
4160
4393
|
companyName: z.string(),
|
|
@@ -4162,7 +4395,7 @@ var tradingPartnerStageSchema = z.object({
|
|
|
4162
4395
|
isValid: z.boolean()
|
|
4163
4396
|
});
|
|
4164
4397
|
|
|
4165
|
-
// lib/items/models/ItemMap.ts
|
|
4398
|
+
// lib/items/v1/models/ItemMap.ts
|
|
4166
4399
|
var itemMapSchema = z.object({
|
|
4167
4400
|
rn: z.number().optional(),
|
|
4168
4401
|
iteminfoid: z.string(),
|
|
@@ -4185,20 +4418,20 @@ var itemMapSchema = z.object({
|
|
|
4185
4418
|
productsizedescription: z.array(z.string()).nullish()
|
|
4186
4419
|
}).passthrough();
|
|
4187
4420
|
|
|
4188
|
-
// lib/items/models/ItemTable.ts
|
|
4421
|
+
// lib/items/v1/models/ItemTable.ts
|
|
4189
4422
|
var itemTableSchema = z.object({
|
|
4190
4423
|
headers: itemHeaderSchema,
|
|
4191
4424
|
itemMaps: z.array(itemMapSchema)
|
|
4192
4425
|
});
|
|
4193
4426
|
|
|
4194
|
-
// lib/items/models/ItemSearchView.ts
|
|
4427
|
+
// lib/items/v1/models/ItemSearchView.ts
|
|
4195
4428
|
var itemSearchViewSchema = z.object({
|
|
4196
4429
|
itemTable: itemTableSchema,
|
|
4197
4430
|
hasNext: z.boolean(),
|
|
4198
4431
|
count: z.number()
|
|
4199
4432
|
});
|
|
4200
4433
|
|
|
4201
|
-
// lib/items/models/AttributeDetail.ts
|
|
4434
|
+
// lib/items/v1/models/AttributeDetail.ts
|
|
4202
4435
|
var attributeDetailSchema = z.object({
|
|
4203
4436
|
type: attrDatatypeNameEnumSchema,
|
|
4204
4437
|
name: z.string(),
|
|
@@ -4208,23 +4441,23 @@ var attributeDetailSchema = z.object({
|
|
|
4208
4441
|
orderBy: z.number().or(z.string()).nullish()
|
|
4209
4442
|
});
|
|
4210
4443
|
|
|
4211
|
-
// lib/items/models/CategoryEnum.ts
|
|
4444
|
+
// lib/items/v1/models/CategoryEnum.ts
|
|
4212
4445
|
var categoryEnumSchema = z.enum([
|
|
4213
|
-
"
|
|
4446
|
+
"ALIAS",
|
|
4214
4447
|
"CATALOG",
|
|
4215
4448
|
"EXPORT",
|
|
4216
|
-
"LABEL",
|
|
4217
4449
|
"LEGACY_PRODUCT_TYPE",
|
|
4218
4450
|
"PRODUCT_CLASSIFICATION",
|
|
4219
4451
|
"PRODUCT_CODE",
|
|
4220
4452
|
"SELECTION_CODE",
|
|
4453
|
+
"TAG",
|
|
4221
4454
|
"TAXONOMY_ROOT"
|
|
4222
4455
|
]);
|
|
4223
4456
|
|
|
4224
|
-
// lib/items/models/ComponentDetails.ts
|
|
4457
|
+
// lib/items/v1/models/ComponentDetails.ts
|
|
4225
4458
|
var componentDetailsSchema = z.object({
|
|
4226
4459
|
itemInfoId: z.number(),
|
|
4227
|
-
description: z.string(),
|
|
4460
|
+
description: z.string().nullish(),
|
|
4228
4461
|
saleable: z.boolean(),
|
|
4229
4462
|
valid: z.boolean(),
|
|
4230
4463
|
uniqueCriteria: z.array(
|
|
@@ -4235,43 +4468,43 @@ var componentDetailsSchema = z.object({
|
|
|
4235
4468
|
)
|
|
4236
4469
|
});
|
|
4237
4470
|
|
|
4238
|
-
// lib/items/models/RepeatableGroup.ts
|
|
4471
|
+
// lib/items/v1/models/RepeatableGroup.ts
|
|
4239
4472
|
var repeatableGroupSchema = z.object({
|
|
4240
4473
|
repeatableGroupId: z.string(),
|
|
4241
4474
|
repeatableNumber: z.number()
|
|
4242
4475
|
});
|
|
4243
4476
|
|
|
4244
|
-
// lib/items/models/GroupedAttributeList.ts
|
|
4477
|
+
// lib/items/v1/models/GroupedAttributeList.ts
|
|
4245
4478
|
var groupedAttributeListSchema = z.object({
|
|
4246
4479
|
type: z.string(),
|
|
4247
4480
|
rows: z.array(z.array(attributeDetailSchema)),
|
|
4248
4481
|
repeatableGroups: z.array(repeatableGroupSchema)
|
|
4249
4482
|
});
|
|
4250
4483
|
|
|
4251
|
-
// lib/items/models/GroupedAttributes.ts
|
|
4484
|
+
// lib/items/v1/models/GroupedAttributes.ts
|
|
4252
4485
|
var groupedAttributesSchema = z.object({
|
|
4253
4486
|
type: z.string(),
|
|
4254
4487
|
attributes: z.array(attributeDetailSchema),
|
|
4255
4488
|
attributeGroups: z.array(groupedAttributeListSchema)
|
|
4256
4489
|
});
|
|
4257
4490
|
|
|
4258
|
-
// lib/items/models/HierarchyCategory.ts
|
|
4491
|
+
// lib/items/v1/models/HierarchyCategory.ts
|
|
4259
4492
|
var hierarchyCategorySchema = z.object({
|
|
4260
4493
|
name: z.string(),
|
|
4261
4494
|
description: z.string().nullish(),
|
|
4262
4495
|
id: z.number(),
|
|
4263
|
-
companyId: z.number(),
|
|
4496
|
+
companyId: z.number().nullish(),
|
|
4264
4497
|
type: categoryEnumSchema
|
|
4265
4498
|
});
|
|
4266
4499
|
|
|
4267
|
-
// lib/items/models/HierarchyDetails.ts
|
|
4500
|
+
// lib/items/v1/models/HierarchyDetails.ts
|
|
4268
4501
|
var hierarchyDetailsSchema = z.object({
|
|
4269
4502
|
catalogs: z.array(hierarchyCategorySchema),
|
|
4270
4503
|
selectionCodes: z.array(hierarchyCategorySchema),
|
|
4271
4504
|
productCodes: z.array(hierarchyCategorySchema)
|
|
4272
4505
|
});
|
|
4273
4506
|
|
|
4274
|
-
// lib/items/models/PackComponentItemInfo.ts
|
|
4507
|
+
// lib/items/v1/models/PackComponentItemInfo.ts
|
|
4275
4508
|
var packComponentItemInfoSchema = z.object({
|
|
4276
4509
|
companyid: z.number(),
|
|
4277
4510
|
createddate: z.number(),
|
|
@@ -4285,7 +4518,7 @@ var packComponentItemInfoSchema = z.object({
|
|
|
4285
4518
|
attributes: z.record(z.string(), z.string().or(z.array(z.string())))
|
|
4286
4519
|
});
|
|
4287
4520
|
|
|
4288
|
-
// lib/items/models/ItemPrice.ts
|
|
4521
|
+
// lib/items/v1/models/ItemPrice.ts
|
|
4289
4522
|
var itemPriceSchema = z.object({
|
|
4290
4523
|
amount: z.number(),
|
|
4291
4524
|
currency: z.string(),
|
|
@@ -4309,13 +4542,13 @@ var itemPriceSchema = z.object({
|
|
|
4309
4542
|
priceUnitQuantityUOM: z.string().nullish()
|
|
4310
4543
|
});
|
|
4311
4544
|
|
|
4312
|
-
// lib/items/models/PackComponentDetails.ts
|
|
4545
|
+
// lib/items/v1/models/PackComponentDetails.ts
|
|
4313
4546
|
var packComponentDetailsSchema = z.object({
|
|
4314
4547
|
itemInfo: packComponentItemInfoSchema,
|
|
4315
4548
|
itemPrices: z.array(itemPriceSchema)
|
|
4316
4549
|
});
|
|
4317
4550
|
|
|
4318
|
-
// lib/items/models/GroupedItem.ts
|
|
4551
|
+
// lib/items/v1/models/GroupedItem.ts
|
|
4319
4552
|
var groupedItemSchema = z.object({
|
|
4320
4553
|
iteminfoid: z.number(),
|
|
4321
4554
|
companyid: z.number(),
|
|
@@ -4331,12 +4564,12 @@ var groupedItemSchema = z.object({
|
|
|
4331
4564
|
locales: z.array(z.string())
|
|
4332
4565
|
});
|
|
4333
4566
|
|
|
4334
|
-
// lib/items/models/ItemDetailView.ts
|
|
4567
|
+
// lib/items/v1/models/ItemDetailView.ts
|
|
4335
4568
|
var itemDetailViewSchema = z.object({
|
|
4336
4569
|
item: groupedItemSchema
|
|
4337
4570
|
});
|
|
4338
4571
|
|
|
4339
|
-
// lib/items/models/Bulb.ts
|
|
4572
|
+
// lib/items/v1/models/Bulb.ts
|
|
4340
4573
|
var bulbSchema = z.object({
|
|
4341
4574
|
iteminfoid: z.number(),
|
|
4342
4575
|
id: z.number(),
|
|
@@ -4354,14 +4587,14 @@ var bulbSchema = z.object({
|
|
|
4354
4587
|
threewaybulb: z.string()
|
|
4355
4588
|
});
|
|
4356
4589
|
|
|
4357
|
-
// lib/items/models/PackComponent.ts
|
|
4590
|
+
// lib/items/v1/models/PackComponent.ts
|
|
4358
4591
|
var packComponentSchema = z.object({
|
|
4359
4592
|
itemInfoId: z.number().nullish(),
|
|
4360
4593
|
attributes: z.record(z.string(), z.string().or(z.array(z.string()))),
|
|
4361
4594
|
prices: z.array(itemPriceSchema)
|
|
4362
4595
|
});
|
|
4363
4596
|
|
|
4364
|
-
// lib/items/models/MediaItem.ts
|
|
4597
|
+
// lib/items/v1/models/MediaItem.ts
|
|
4365
4598
|
var mediaItemSchema = z.object({
|
|
4366
4599
|
id: z.number(),
|
|
4367
4600
|
iteminfoid: z.number(),
|
|
@@ -4382,7 +4615,7 @@ var mediaItemSchema = z.object({
|
|
|
4382
4615
|
thumbnailflag: z.string().nullish()
|
|
4383
4616
|
});
|
|
4384
4617
|
|
|
4385
|
-
// lib/items/models/ItemDetail.ts
|
|
4618
|
+
// lib/items/v1/models/ItemDetail.ts
|
|
4386
4619
|
var itemDetailSchema = z.object({
|
|
4387
4620
|
attributes: z.record(z.string(), z.any()),
|
|
4388
4621
|
clusters: z.record(
|
|
@@ -4402,13 +4635,13 @@ var itemDetailSchema = z.object({
|
|
|
4402
4635
|
packs: z.array(packComponentSchema)
|
|
4403
4636
|
});
|
|
4404
4637
|
|
|
4405
|
-
// lib/items/models/SpsItemIdResponse.ts
|
|
4638
|
+
// lib/items/v1/models/SpsItemIdResponse.ts
|
|
4406
4639
|
var spsItemIdResponseSchema = z.object({
|
|
4407
4640
|
id: z.string(),
|
|
4408
4641
|
ref: z.string()
|
|
4409
4642
|
});
|
|
4410
4643
|
|
|
4411
|
-
// lib/items/models/ItemOrgStatus.ts
|
|
4644
|
+
// lib/items/v1/models/ItemOrgStatus.ts
|
|
4412
4645
|
var itemOrgStatusSchema = z.object({
|
|
4413
4646
|
org: z.object({
|
|
4414
4647
|
ref: z.string(),
|
|
@@ -4419,13 +4652,13 @@ var itemOrgStatusSchema = z.object({
|
|
|
4419
4652
|
validForRelationship: z.boolean()
|
|
4420
4653
|
});
|
|
4421
4654
|
|
|
4422
|
-
// lib/items/models/ItemStatus.ts
|
|
4655
|
+
// lib/items/v1/models/ItemStatus.ts
|
|
4423
4656
|
var itemStatusSchema = z.object({
|
|
4424
4657
|
itemId: z.string(),
|
|
4425
4658
|
itemOrgStatuses: z.array(itemOrgStatusSchema)
|
|
4426
4659
|
});
|
|
4427
4660
|
|
|
4428
|
-
// lib/items/models/ItemStatusResponse.ts
|
|
4661
|
+
// lib/items/v1/models/ItemStatusResponse.ts
|
|
4429
4662
|
var itemStatusResponseSchema = z.object({
|
|
4430
4663
|
itemStatuses: z.array(itemStatusSchema)
|
|
4431
4664
|
});
|
|
@@ -4478,6 +4711,27 @@ var connectionSchema = z.object({
|
|
|
4478
4711
|
partner_org_id: z.string()
|
|
4479
4712
|
});
|
|
4480
4713
|
|
|
4714
|
+
// lib/tradingPartners/models/CompanyRelationshipUpsertBody.ts
|
|
4715
|
+
var companyRelationshipUpsertBodySchema = z.object({
|
|
4716
|
+
supplierId: z.number(),
|
|
4717
|
+
retailerId: z.number(),
|
|
4718
|
+
catalogId: z.number(),
|
|
4719
|
+
active: z.boolean(),
|
|
4720
|
+
applicationType: z.array(z.enum(["ASSORTMENT", "ITEM-XREF"])).default([])
|
|
4721
|
+
});
|
|
4722
|
+
|
|
4723
|
+
// lib/tradingPartners/models/ItemPartner.ts
|
|
4724
|
+
var itemPartnerSchema = z.object({
|
|
4725
|
+
itemPartnerId: z.number(),
|
|
4726
|
+
retailerId: z.number(),
|
|
4727
|
+
supplierId: z.number(),
|
|
4728
|
+
catalogId: z.number(),
|
|
4729
|
+
isActive: z.number(),
|
|
4730
|
+
createdDate: z.string(),
|
|
4731
|
+
modifiedDate: z.string(),
|
|
4732
|
+
applications: z.array(z.enum(["ASSORTMENT", "ITEM-XREF"]))
|
|
4733
|
+
});
|
|
4734
|
+
|
|
4481
4735
|
// lib/tradingPartners/models/TradingPartnerAccessByCompanyId.ts
|
|
4482
4736
|
var tradingPartnerAccessByCompanyIdSchema = z.object({
|
|
4483
4737
|
companyId: z.number(),
|
|
@@ -4629,6 +4883,7 @@ var companyBriefByOrgSchema = z.object({
|
|
|
4629
4883
|
bulbSchema,
|
|
4630
4884
|
categoryEnumSchema,
|
|
4631
4885
|
companyBriefByOrgSchema,
|
|
4886
|
+
companyRelationshipUpsertBodySchema,
|
|
4632
4887
|
componentDetailsSchema,
|
|
4633
4888
|
connectionSchema,
|
|
4634
4889
|
downLoadItemsParamsSchema,
|
|
@@ -4643,7 +4898,6 @@ var companyBriefByOrgSchema = z.object({
|
|
|
4643
4898
|
groupedItemSchema,
|
|
4644
4899
|
hierarchyCategorySchema,
|
|
4645
4900
|
hierarchyDetailsSchema,
|
|
4646
|
-
hierarchySchema,
|
|
4647
4901
|
identityServiceDatetimePreferencesSchema,
|
|
4648
4902
|
identityServiceOrganizationMetadataSchema,
|
|
4649
4903
|
identityServiceOrganizationSchema,
|
|
@@ -4663,8 +4917,8 @@ var companyBriefByOrgSchema = z.object({
|
|
|
4663
4917
|
itemErrorDetailsSchema,
|
|
4664
4918
|
itemHeaderSchema,
|
|
4665
4919
|
itemHierarchyResponseSchema,
|
|
4666
|
-
itemHierarchySchema,
|
|
4667
4920
|
itemMapSchema,
|
|
4921
|
+
itemPartnerSchema,
|
|
4668
4922
|
itemPriceSchema,
|
|
4669
4923
|
itemSearchViewSchema,
|
|
4670
4924
|
itemTableSchema,
|