@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/msw.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(msw_exports, {
|
|
|
43
43
|
createProductTypesApiHandlers: () => createProductTypesApiHandlers,
|
|
44
44
|
createSpreadsheetTemplateApiHandlers: () => createSpreadsheetTemplateApiHandlers,
|
|
45
45
|
createTradingPartnerAccessApiHandlers: () => createTradingPartnerAccessApiHandlers,
|
|
46
|
+
createTradingPartnerSettingsApiHandlers: () => createTradingPartnerSettingsApiHandlers,
|
|
46
47
|
createUniqueCriteriaApiHandlers: () => createUniqueCriteriaApiHandlers,
|
|
47
48
|
createWhoAmIApiHandlers: () => createWhoAmIApiHandlers
|
|
48
49
|
});
|
|
@@ -52,7 +53,7 @@ module.exports = __toCommonJS(msw_exports);
|
|
|
52
53
|
var import_zod_mock = require("@anatine/zod-mock");
|
|
53
54
|
var import_msw = require("msw");
|
|
54
55
|
|
|
55
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
56
|
+
// ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
56
57
|
var util;
|
|
57
58
|
(function(util2) {
|
|
58
59
|
util2.assertEqual = (val) => val;
|
|
@@ -206,7 +207,7 @@ var quotelessJson = (obj) => {
|
|
|
206
207
|
const json = JSON.stringify(obj, null, 2);
|
|
207
208
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
208
209
|
};
|
|
209
|
-
var ZodError = class extends Error {
|
|
210
|
+
var ZodError = class _ZodError extends Error {
|
|
210
211
|
constructor(issues) {
|
|
211
212
|
super();
|
|
212
213
|
this.issues = [];
|
|
@@ -264,6 +265,11 @@ var ZodError = class extends Error {
|
|
|
264
265
|
processError(this);
|
|
265
266
|
return fieldErrors;
|
|
266
267
|
}
|
|
268
|
+
static assert(value) {
|
|
269
|
+
if (!(value instanceof _ZodError)) {
|
|
270
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
267
273
|
toString() {
|
|
268
274
|
return this.message;
|
|
269
275
|
}
|
|
@@ -406,6 +412,13 @@ var makeIssue = (params) => {
|
|
|
406
412
|
...issueData,
|
|
407
413
|
path: fullPath
|
|
408
414
|
};
|
|
415
|
+
if (issueData.message !== void 0) {
|
|
416
|
+
return {
|
|
417
|
+
...issueData,
|
|
418
|
+
path: fullPath,
|
|
419
|
+
message: issueData.message
|
|
420
|
+
};
|
|
421
|
+
}
|
|
409
422
|
let errorMessage = "";
|
|
410
423
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
411
424
|
for (const map of maps) {
|
|
@@ -414,11 +427,12 @@ var makeIssue = (params) => {
|
|
|
414
427
|
return {
|
|
415
428
|
...issueData,
|
|
416
429
|
path: fullPath,
|
|
417
|
-
message:
|
|
430
|
+
message: errorMessage
|
|
418
431
|
};
|
|
419
432
|
};
|
|
420
433
|
var EMPTY_PATH = [];
|
|
421
434
|
function addIssueToContext(ctx, issueData) {
|
|
435
|
+
const overrideMap = getErrorMap();
|
|
422
436
|
const issue = makeIssue({
|
|
423
437
|
issueData,
|
|
424
438
|
data: ctx.data,
|
|
@@ -426,14 +440,14 @@ function addIssueToContext(ctx, issueData) {
|
|
|
426
440
|
errorMaps: [
|
|
427
441
|
ctx.common.contextualErrorMap,
|
|
428
442
|
ctx.schemaErrorMap,
|
|
429
|
-
|
|
430
|
-
errorMap
|
|
443
|
+
overrideMap,
|
|
444
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
431
445
|
// then global default map
|
|
432
446
|
].filter((x) => !!x)
|
|
433
447
|
});
|
|
434
448
|
ctx.common.issues.push(issue);
|
|
435
449
|
}
|
|
436
|
-
var ParseStatus = class {
|
|
450
|
+
var ParseStatus = class _ParseStatus {
|
|
437
451
|
constructor() {
|
|
438
452
|
this.value = "valid";
|
|
439
453
|
}
|
|
@@ -459,12 +473,14 @@ var ParseStatus = class {
|
|
|
459
473
|
static async mergeObjectAsync(status, pairs) {
|
|
460
474
|
const syncPairs = [];
|
|
461
475
|
for (const pair of pairs) {
|
|
476
|
+
const key = await pair.key;
|
|
477
|
+
const value = await pair.value;
|
|
462
478
|
syncPairs.push({
|
|
463
|
-
key
|
|
464
|
-
value
|
|
479
|
+
key,
|
|
480
|
+
value
|
|
465
481
|
});
|
|
466
482
|
}
|
|
467
|
-
return
|
|
483
|
+
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
468
484
|
}
|
|
469
485
|
static mergeObjectSync(status, pairs) {
|
|
470
486
|
const finalObject = {};
|
|
@@ -478,7 +494,7 @@ var ParseStatus = class {
|
|
|
478
494
|
status.dirty();
|
|
479
495
|
if (value.status === "dirty")
|
|
480
496
|
status.dirty();
|
|
481
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
497
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
482
498
|
finalObject[key.value] = value.value;
|
|
483
499
|
}
|
|
484
500
|
}
|
|
@@ -494,11 +510,29 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
494
510
|
var isDirty = (x) => x.status === "dirty";
|
|
495
511
|
var isValid = (x) => x.status === "valid";
|
|
496
512
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
513
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
514
|
+
if (kind === "a" && !f)
|
|
515
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
516
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
517
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
518
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
519
|
+
}
|
|
520
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
521
|
+
if (kind === "m")
|
|
522
|
+
throw new TypeError("Private method is not writable");
|
|
523
|
+
if (kind === "a" && !f)
|
|
524
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
525
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
526
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
527
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
528
|
+
}
|
|
497
529
|
var errorUtil;
|
|
498
530
|
(function(errorUtil2) {
|
|
499
531
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
500
532
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
501
533
|
})(errorUtil || (errorUtil = {}));
|
|
534
|
+
var _ZodEnum_cache;
|
|
535
|
+
var _ZodNativeEnum_cache;
|
|
502
536
|
var ParseInputLazyPath = class {
|
|
503
537
|
constructor(parent, value, path, key) {
|
|
504
538
|
this._cachedPath = [];
|
|
@@ -547,12 +581,17 @@ function processCreateParams(params) {
|
|
|
547
581
|
if (errorMap2)
|
|
548
582
|
return { errorMap: errorMap2, description };
|
|
549
583
|
const customMap = (iss, ctx) => {
|
|
550
|
-
|
|
551
|
-
|
|
584
|
+
var _a, _b;
|
|
585
|
+
const { message } = params;
|
|
586
|
+
if (iss.code === "invalid_enum_value") {
|
|
587
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
588
|
+
}
|
|
552
589
|
if (typeof ctx.data === "undefined") {
|
|
553
|
-
return { message:
|
|
590
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
554
591
|
}
|
|
555
|
-
|
|
592
|
+
if (iss.code !== "invalid_type")
|
|
593
|
+
return { message: ctx.defaultError };
|
|
594
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
556
595
|
};
|
|
557
596
|
return { errorMap: customMap, description };
|
|
558
597
|
}
|
|
@@ -581,6 +620,7 @@ var ZodType = class {
|
|
|
581
620
|
this.catch = this.catch.bind(this);
|
|
582
621
|
this.describe = this.describe.bind(this);
|
|
583
622
|
this.pipe = this.pipe.bind(this);
|
|
623
|
+
this.readonly = this.readonly.bind(this);
|
|
584
624
|
this.isNullable = this.isNullable.bind(this);
|
|
585
625
|
this.isOptional = this.isOptional.bind(this);
|
|
586
626
|
}
|
|
@@ -788,6 +828,9 @@ var ZodType = class {
|
|
|
788
828
|
pipe(target) {
|
|
789
829
|
return ZodPipeline.create(this, target);
|
|
790
830
|
}
|
|
831
|
+
readonly() {
|
|
832
|
+
return ZodReadonly.create(this);
|
|
833
|
+
}
|
|
791
834
|
isOptional() {
|
|
792
835
|
return this.safeParse(void 0).success;
|
|
793
836
|
}
|
|
@@ -796,34 +839,40 @@ var ZodType = class {
|
|
|
796
839
|
}
|
|
797
840
|
};
|
|
798
841
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
799
|
-
var cuid2Regex = /^[
|
|
800
|
-
var ulidRegex =
|
|
801
|
-
var uuidRegex = /^
|
|
802
|
-
var
|
|
803
|
-
var
|
|
804
|
-
var
|
|
842
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
843
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
844
|
+
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;
|
|
845
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
846
|
+
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)?)??$/;
|
|
847
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
848
|
+
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
849
|
+
var emojiRegex;
|
|
850
|
+
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])$/;
|
|
805
851
|
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})))$/;
|
|
806
|
-
var
|
|
852
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
853
|
+
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])))`;
|
|
854
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
855
|
+
function timeRegexSource(args) {
|
|
856
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
807
857
|
if (args.precision) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
812
|
-
}
|
|
813
|
-
} else if (args.precision === 0) {
|
|
814
|
-
if (args.offset) {
|
|
815
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
816
|
-
} else {
|
|
817
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
818
|
-
}
|
|
819
|
-
} else {
|
|
820
|
-
if (args.offset) {
|
|
821
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
822
|
-
} else {
|
|
823
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
824
|
-
}
|
|
858
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
859
|
+
} else if (args.precision == null) {
|
|
860
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
825
861
|
}
|
|
826
|
-
|
|
862
|
+
return regex;
|
|
863
|
+
}
|
|
864
|
+
function timeRegex(args) {
|
|
865
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
866
|
+
}
|
|
867
|
+
function datetimeRegex(args) {
|
|
868
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
869
|
+
const opts = [];
|
|
870
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
871
|
+
if (args.offset)
|
|
872
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
873
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
874
|
+
return new RegExp(`^${regex}$`);
|
|
875
|
+
}
|
|
827
876
|
function isValidIP(ip, version) {
|
|
828
877
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
829
878
|
return true;
|
|
@@ -833,28 +882,7 @@ function isValidIP(ip, version) {
|
|
|
833
882
|
}
|
|
834
883
|
return false;
|
|
835
884
|
}
|
|
836
|
-
var ZodString = class extends ZodType {
|
|
837
|
-
constructor() {
|
|
838
|
-
super(...arguments);
|
|
839
|
-
this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
|
|
840
|
-
validation,
|
|
841
|
-
code: ZodIssueCode.invalid_string,
|
|
842
|
-
...errorUtil.errToObj(message)
|
|
843
|
-
});
|
|
844
|
-
this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
|
|
845
|
-
this.trim = () => new ZodString({
|
|
846
|
-
...this._def,
|
|
847
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
848
|
-
});
|
|
849
|
-
this.toLowerCase = () => new ZodString({
|
|
850
|
-
...this._def,
|
|
851
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
852
|
-
});
|
|
853
|
-
this.toUpperCase = () => new ZodString({
|
|
854
|
-
...this._def,
|
|
855
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
856
|
-
});
|
|
857
|
-
}
|
|
885
|
+
var ZodString = class _ZodString extends ZodType {
|
|
858
886
|
_parse(input) {
|
|
859
887
|
if (this._def.coerce) {
|
|
860
888
|
input.data = String(input.data);
|
|
@@ -862,15 +890,11 @@ var ZodString = class extends ZodType {
|
|
|
862
890
|
const parsedType = this._getType(input);
|
|
863
891
|
if (parsedType !== ZodParsedType.string) {
|
|
864
892
|
const ctx2 = this._getOrReturnCtx(input);
|
|
865
|
-
addIssueToContext(
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
received: ctx2.parsedType
|
|
871
|
-
}
|
|
872
|
-
//
|
|
873
|
-
);
|
|
893
|
+
addIssueToContext(ctx2, {
|
|
894
|
+
code: ZodIssueCode.invalid_type,
|
|
895
|
+
expected: ZodParsedType.string,
|
|
896
|
+
received: ctx2.parsedType
|
|
897
|
+
});
|
|
874
898
|
return INVALID;
|
|
875
899
|
}
|
|
876
900
|
const status = new ParseStatus();
|
|
@@ -939,6 +963,9 @@ var ZodString = class extends ZodType {
|
|
|
939
963
|
status.dirty();
|
|
940
964
|
}
|
|
941
965
|
} else if (check.kind === "emoji") {
|
|
966
|
+
if (!emojiRegex) {
|
|
967
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
968
|
+
}
|
|
942
969
|
if (!emojiRegex.test(input.data)) {
|
|
943
970
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
944
971
|
addIssueToContext(ctx, {
|
|
@@ -958,6 +985,16 @@ var ZodString = class extends ZodType {
|
|
|
958
985
|
});
|
|
959
986
|
status.dirty();
|
|
960
987
|
}
|
|
988
|
+
} else if (check.kind === "nanoid") {
|
|
989
|
+
if (!nanoidRegex.test(input.data)) {
|
|
990
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
991
|
+
addIssueToContext(ctx, {
|
|
992
|
+
validation: "nanoid",
|
|
993
|
+
code: ZodIssueCode.invalid_string,
|
|
994
|
+
message: check.message
|
|
995
|
+
});
|
|
996
|
+
status.dirty();
|
|
997
|
+
}
|
|
961
998
|
} else if (check.kind === "cuid") {
|
|
962
999
|
if (!cuidRegex.test(input.data)) {
|
|
963
1000
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1059,6 +1096,38 @@ var ZodString = class extends ZodType {
|
|
|
1059
1096
|
});
|
|
1060
1097
|
status.dirty();
|
|
1061
1098
|
}
|
|
1099
|
+
} else if (check.kind === "date") {
|
|
1100
|
+
const regex = dateRegex;
|
|
1101
|
+
if (!regex.test(input.data)) {
|
|
1102
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1103
|
+
addIssueToContext(ctx, {
|
|
1104
|
+
code: ZodIssueCode.invalid_string,
|
|
1105
|
+
validation: "date",
|
|
1106
|
+
message: check.message
|
|
1107
|
+
});
|
|
1108
|
+
status.dirty();
|
|
1109
|
+
}
|
|
1110
|
+
} else if (check.kind === "time") {
|
|
1111
|
+
const regex = timeRegex(check);
|
|
1112
|
+
if (!regex.test(input.data)) {
|
|
1113
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1114
|
+
addIssueToContext(ctx, {
|
|
1115
|
+
code: ZodIssueCode.invalid_string,
|
|
1116
|
+
validation: "time",
|
|
1117
|
+
message: check.message
|
|
1118
|
+
});
|
|
1119
|
+
status.dirty();
|
|
1120
|
+
}
|
|
1121
|
+
} else if (check.kind === "duration") {
|
|
1122
|
+
if (!durationRegex.test(input.data)) {
|
|
1123
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1124
|
+
addIssueToContext(ctx, {
|
|
1125
|
+
validation: "duration",
|
|
1126
|
+
code: ZodIssueCode.invalid_string,
|
|
1127
|
+
message: check.message
|
|
1128
|
+
});
|
|
1129
|
+
status.dirty();
|
|
1130
|
+
}
|
|
1062
1131
|
} else if (check.kind === "ip") {
|
|
1063
1132
|
if (!isValidIP(input.data, check.version)) {
|
|
1064
1133
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1069,14 +1138,31 @@ var ZodString = class extends ZodType {
|
|
|
1069
1138
|
});
|
|
1070
1139
|
status.dirty();
|
|
1071
1140
|
}
|
|
1141
|
+
} else if (check.kind === "base64") {
|
|
1142
|
+
if (!base64Regex.test(input.data)) {
|
|
1143
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1144
|
+
addIssueToContext(ctx, {
|
|
1145
|
+
validation: "base64",
|
|
1146
|
+
code: ZodIssueCode.invalid_string,
|
|
1147
|
+
message: check.message
|
|
1148
|
+
});
|
|
1149
|
+
status.dirty();
|
|
1150
|
+
}
|
|
1072
1151
|
} else {
|
|
1073
1152
|
util.assertNever(check);
|
|
1074
1153
|
}
|
|
1075
1154
|
}
|
|
1076
1155
|
return { status: status.value, value: input.data };
|
|
1077
1156
|
}
|
|
1157
|
+
_regex(regex, validation, message) {
|
|
1158
|
+
return this.refinement((data) => regex.test(data), {
|
|
1159
|
+
validation,
|
|
1160
|
+
code: ZodIssueCode.invalid_string,
|
|
1161
|
+
...errorUtil.errToObj(message)
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1078
1164
|
_addCheck(check) {
|
|
1079
|
-
return new
|
|
1165
|
+
return new _ZodString({
|
|
1080
1166
|
...this._def,
|
|
1081
1167
|
checks: [...this._def.checks, check]
|
|
1082
1168
|
});
|
|
@@ -1093,6 +1179,9 @@ var ZodString = class extends ZodType {
|
|
|
1093
1179
|
uuid(message) {
|
|
1094
1180
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
1095
1181
|
}
|
|
1182
|
+
nanoid(message) {
|
|
1183
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
1184
|
+
}
|
|
1096
1185
|
cuid(message) {
|
|
1097
1186
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
1098
1187
|
}
|
|
@@ -1102,16 +1191,20 @@ var ZodString = class extends ZodType {
|
|
|
1102
1191
|
ulid(message) {
|
|
1103
1192
|
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
1104
1193
|
}
|
|
1194
|
+
base64(message) {
|
|
1195
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1196
|
+
}
|
|
1105
1197
|
ip(options) {
|
|
1106
1198
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1107
1199
|
}
|
|
1108
1200
|
datetime(options) {
|
|
1109
|
-
var _a;
|
|
1201
|
+
var _a, _b;
|
|
1110
1202
|
if (typeof options === "string") {
|
|
1111
1203
|
return this._addCheck({
|
|
1112
1204
|
kind: "datetime",
|
|
1113
1205
|
precision: null,
|
|
1114
1206
|
offset: false,
|
|
1207
|
+
local: false,
|
|
1115
1208
|
message: options
|
|
1116
1209
|
});
|
|
1117
1210
|
}
|
|
@@ -1119,9 +1212,30 @@ var ZodString = class extends ZodType {
|
|
|
1119
1212
|
kind: "datetime",
|
|
1120
1213
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1121
1214
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
1215
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
1122
1216
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1123
1217
|
});
|
|
1124
1218
|
}
|
|
1219
|
+
date(message) {
|
|
1220
|
+
return this._addCheck({ kind: "date", message });
|
|
1221
|
+
}
|
|
1222
|
+
time(options) {
|
|
1223
|
+
if (typeof options === "string") {
|
|
1224
|
+
return this._addCheck({
|
|
1225
|
+
kind: "time",
|
|
1226
|
+
precision: null,
|
|
1227
|
+
message: options
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
return this._addCheck({
|
|
1231
|
+
kind: "time",
|
|
1232
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1233
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
duration(message) {
|
|
1237
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
1238
|
+
}
|
|
1125
1239
|
regex(regex, message) {
|
|
1126
1240
|
return this._addCheck({
|
|
1127
1241
|
kind: "regex",
|
|
@@ -1172,9 +1286,43 @@ var ZodString = class extends ZodType {
|
|
|
1172
1286
|
...errorUtil.errToObj(message)
|
|
1173
1287
|
});
|
|
1174
1288
|
}
|
|
1289
|
+
/**
|
|
1290
|
+
* @deprecated Use z.string().min(1) instead.
|
|
1291
|
+
* @see {@link ZodString.min}
|
|
1292
|
+
*/
|
|
1293
|
+
nonempty(message) {
|
|
1294
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
1295
|
+
}
|
|
1296
|
+
trim() {
|
|
1297
|
+
return new _ZodString({
|
|
1298
|
+
...this._def,
|
|
1299
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
toLowerCase() {
|
|
1303
|
+
return new _ZodString({
|
|
1304
|
+
...this._def,
|
|
1305
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
toUpperCase() {
|
|
1309
|
+
return new _ZodString({
|
|
1310
|
+
...this._def,
|
|
1311
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1175
1314
|
get isDatetime() {
|
|
1176
1315
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
1177
1316
|
}
|
|
1317
|
+
get isDate() {
|
|
1318
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
1319
|
+
}
|
|
1320
|
+
get isTime() {
|
|
1321
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
1322
|
+
}
|
|
1323
|
+
get isDuration() {
|
|
1324
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
1325
|
+
}
|
|
1178
1326
|
get isEmail() {
|
|
1179
1327
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
1180
1328
|
}
|
|
@@ -1187,6 +1335,9 @@ var ZodString = class extends ZodType {
|
|
|
1187
1335
|
get isUUID() {
|
|
1188
1336
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
1189
1337
|
}
|
|
1338
|
+
get isNANOID() {
|
|
1339
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
1340
|
+
}
|
|
1190
1341
|
get isCUID() {
|
|
1191
1342
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
1192
1343
|
}
|
|
@@ -1199,6 +1350,9 @@ var ZodString = class extends ZodType {
|
|
|
1199
1350
|
get isIP() {
|
|
1200
1351
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1201
1352
|
}
|
|
1353
|
+
get isBase64() {
|
|
1354
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1355
|
+
}
|
|
1202
1356
|
get minLength() {
|
|
1203
1357
|
let min = null;
|
|
1204
1358
|
for (const ch of this._def.checks) {
|
|
@@ -1237,7 +1391,7 @@ function floatSafeRemainder(val, step) {
|
|
|
1237
1391
|
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1238
1392
|
return valInt % stepInt / Math.pow(10, decCount);
|
|
1239
1393
|
}
|
|
1240
|
-
var ZodNumber = class extends ZodType {
|
|
1394
|
+
var ZodNumber = class _ZodNumber extends ZodType {
|
|
1241
1395
|
constructor() {
|
|
1242
1396
|
super(...arguments);
|
|
1243
1397
|
this.min = this.gte;
|
|
@@ -1338,7 +1492,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1338
1492
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1339
1493
|
}
|
|
1340
1494
|
setLimit(kind, value, inclusive, message) {
|
|
1341
|
-
return new
|
|
1495
|
+
return new _ZodNumber({
|
|
1342
1496
|
...this._def,
|
|
1343
1497
|
checks: [
|
|
1344
1498
|
...this._def.checks,
|
|
@@ -1352,7 +1506,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1352
1506
|
});
|
|
1353
1507
|
}
|
|
1354
1508
|
_addCheck(check) {
|
|
1355
|
-
return new
|
|
1509
|
+
return new _ZodNumber({
|
|
1356
1510
|
...this._def,
|
|
1357
1511
|
checks: [...this._def.checks, check]
|
|
1358
1512
|
});
|
|
@@ -1468,7 +1622,7 @@ ZodNumber.create = (params) => {
|
|
|
1468
1622
|
...processCreateParams(params)
|
|
1469
1623
|
});
|
|
1470
1624
|
};
|
|
1471
|
-
var ZodBigInt = class extends ZodType {
|
|
1625
|
+
var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
1472
1626
|
constructor() {
|
|
1473
1627
|
super(...arguments);
|
|
1474
1628
|
this.min = this.gte;
|
|
@@ -1546,7 +1700,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1546
1700
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1547
1701
|
}
|
|
1548
1702
|
setLimit(kind, value, inclusive, message) {
|
|
1549
|
-
return new
|
|
1703
|
+
return new _ZodBigInt({
|
|
1550
1704
|
...this._def,
|
|
1551
1705
|
checks: [
|
|
1552
1706
|
...this._def.checks,
|
|
@@ -1560,7 +1714,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1560
1714
|
});
|
|
1561
1715
|
}
|
|
1562
1716
|
_addCheck(check) {
|
|
1563
|
-
return new
|
|
1717
|
+
return new _ZodBigInt({
|
|
1564
1718
|
...this._def,
|
|
1565
1719
|
checks: [...this._def.checks, check]
|
|
1566
1720
|
});
|
|
@@ -1659,7 +1813,7 @@ ZodBoolean.create = (params) => {
|
|
|
1659
1813
|
...processCreateParams(params)
|
|
1660
1814
|
});
|
|
1661
1815
|
};
|
|
1662
|
-
var ZodDate = class extends ZodType {
|
|
1816
|
+
var ZodDate = class _ZodDate extends ZodType {
|
|
1663
1817
|
_parse(input) {
|
|
1664
1818
|
if (this._def.coerce) {
|
|
1665
1819
|
input.data = new Date(input.data);
|
|
@@ -1720,7 +1874,7 @@ var ZodDate = class extends ZodType {
|
|
|
1720
1874
|
};
|
|
1721
1875
|
}
|
|
1722
1876
|
_addCheck(check) {
|
|
1723
|
-
return new
|
|
1877
|
+
return new _ZodDate({
|
|
1724
1878
|
...this._def,
|
|
1725
1879
|
checks: [...this._def.checks, check]
|
|
1726
1880
|
});
|
|
@@ -1899,7 +2053,7 @@ ZodVoid.create = (params) => {
|
|
|
1899
2053
|
...processCreateParams(params)
|
|
1900
2054
|
});
|
|
1901
2055
|
};
|
|
1902
|
-
var ZodArray = class extends ZodType {
|
|
2056
|
+
var ZodArray = class _ZodArray extends ZodType {
|
|
1903
2057
|
_parse(input) {
|
|
1904
2058
|
const { ctx, status } = this._processInputParams(input);
|
|
1905
2059
|
const def = this._def;
|
|
@@ -1969,19 +2123,19 @@ var ZodArray = class extends ZodType {
|
|
|
1969
2123
|
return this._def.type;
|
|
1970
2124
|
}
|
|
1971
2125
|
min(minLength, message) {
|
|
1972
|
-
return new
|
|
2126
|
+
return new _ZodArray({
|
|
1973
2127
|
...this._def,
|
|
1974
2128
|
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
1975
2129
|
});
|
|
1976
2130
|
}
|
|
1977
2131
|
max(maxLength, message) {
|
|
1978
|
-
return new
|
|
2132
|
+
return new _ZodArray({
|
|
1979
2133
|
...this._def,
|
|
1980
2134
|
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
1981
2135
|
});
|
|
1982
2136
|
}
|
|
1983
2137
|
length(len, message) {
|
|
1984
|
-
return new
|
|
2138
|
+
return new _ZodArray({
|
|
1985
2139
|
...this._def,
|
|
1986
2140
|
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
1987
2141
|
});
|
|
@@ -2026,7 +2180,7 @@ function deepPartialify(schema) {
|
|
|
2026
2180
|
return schema;
|
|
2027
2181
|
}
|
|
2028
2182
|
}
|
|
2029
|
-
var ZodObject = class extends ZodType {
|
|
2183
|
+
var ZodObject = class _ZodObject extends ZodType {
|
|
2030
2184
|
constructor() {
|
|
2031
2185
|
super(...arguments);
|
|
2032
2186
|
this._cached = null;
|
|
@@ -2112,9 +2266,10 @@ var ZodObject = class extends ZodType {
|
|
|
2112
2266
|
const syncPairs = [];
|
|
2113
2267
|
for (const pair of pairs) {
|
|
2114
2268
|
const key = await pair.key;
|
|
2269
|
+
const value = await pair.value;
|
|
2115
2270
|
syncPairs.push({
|
|
2116
2271
|
key,
|
|
2117
|
-
value
|
|
2272
|
+
value,
|
|
2118
2273
|
alwaysSet: pair.alwaysSet
|
|
2119
2274
|
});
|
|
2120
2275
|
}
|
|
@@ -2131,7 +2286,7 @@ var ZodObject = class extends ZodType {
|
|
|
2131
2286
|
}
|
|
2132
2287
|
strict(message) {
|
|
2133
2288
|
errorUtil.errToObj;
|
|
2134
|
-
return new
|
|
2289
|
+
return new _ZodObject({
|
|
2135
2290
|
...this._def,
|
|
2136
2291
|
unknownKeys: "strict",
|
|
2137
2292
|
...message !== void 0 ? {
|
|
@@ -2150,13 +2305,13 @@ var ZodObject = class extends ZodType {
|
|
|
2150
2305
|
});
|
|
2151
2306
|
}
|
|
2152
2307
|
strip() {
|
|
2153
|
-
return new
|
|
2308
|
+
return new _ZodObject({
|
|
2154
2309
|
...this._def,
|
|
2155
2310
|
unknownKeys: "strip"
|
|
2156
2311
|
});
|
|
2157
2312
|
}
|
|
2158
2313
|
passthrough() {
|
|
2159
|
-
return new
|
|
2314
|
+
return new _ZodObject({
|
|
2160
2315
|
...this._def,
|
|
2161
2316
|
unknownKeys: "passthrough"
|
|
2162
2317
|
});
|
|
@@ -2179,7 +2334,7 @@ var ZodObject = class extends ZodType {
|
|
|
2179
2334
|
// }) as any;
|
|
2180
2335
|
// };
|
|
2181
2336
|
extend(augmentation) {
|
|
2182
|
-
return new
|
|
2337
|
+
return new _ZodObject({
|
|
2183
2338
|
...this._def,
|
|
2184
2339
|
shape: () => ({
|
|
2185
2340
|
...this._def.shape(),
|
|
@@ -2193,7 +2348,7 @@ var ZodObject = class extends ZodType {
|
|
|
2193
2348
|
* upgrade if you are experiencing issues.
|
|
2194
2349
|
*/
|
|
2195
2350
|
merge(merging) {
|
|
2196
|
-
const merged = new
|
|
2351
|
+
const merged = new _ZodObject({
|
|
2197
2352
|
unknownKeys: merging._def.unknownKeys,
|
|
2198
2353
|
catchall: merging._def.catchall,
|
|
2199
2354
|
shape: () => ({
|
|
@@ -2264,7 +2419,7 @@ var ZodObject = class extends ZodType {
|
|
|
2264
2419
|
// return merged;
|
|
2265
2420
|
// }
|
|
2266
2421
|
catchall(index) {
|
|
2267
|
-
return new
|
|
2422
|
+
return new _ZodObject({
|
|
2268
2423
|
...this._def,
|
|
2269
2424
|
catchall: index
|
|
2270
2425
|
});
|
|
@@ -2276,7 +2431,7 @@ var ZodObject = class extends ZodType {
|
|
|
2276
2431
|
shape[key] = this.shape[key];
|
|
2277
2432
|
}
|
|
2278
2433
|
});
|
|
2279
|
-
return new
|
|
2434
|
+
return new _ZodObject({
|
|
2280
2435
|
...this._def,
|
|
2281
2436
|
shape: () => shape
|
|
2282
2437
|
});
|
|
@@ -2288,7 +2443,7 @@ var ZodObject = class extends ZodType {
|
|
|
2288
2443
|
shape[key] = this.shape[key];
|
|
2289
2444
|
}
|
|
2290
2445
|
});
|
|
2291
|
-
return new
|
|
2446
|
+
return new _ZodObject({
|
|
2292
2447
|
...this._def,
|
|
2293
2448
|
shape: () => shape
|
|
2294
2449
|
});
|
|
@@ -2309,7 +2464,7 @@ var ZodObject = class extends ZodType {
|
|
|
2309
2464
|
newShape[key] = fieldSchema.optional();
|
|
2310
2465
|
}
|
|
2311
2466
|
});
|
|
2312
|
-
return new
|
|
2467
|
+
return new _ZodObject({
|
|
2313
2468
|
...this._def,
|
|
2314
2469
|
shape: () => newShape
|
|
2315
2470
|
});
|
|
@@ -2328,7 +2483,7 @@ var ZodObject = class extends ZodType {
|
|
|
2328
2483
|
newShape[key] = newField;
|
|
2329
2484
|
}
|
|
2330
2485
|
});
|
|
2331
|
-
return new
|
|
2486
|
+
return new _ZodObject({
|
|
2332
2487
|
...this._def,
|
|
2333
2488
|
shape: () => newShape
|
|
2334
2489
|
});
|
|
@@ -2465,18 +2620,28 @@ var getDiscriminator = (type) => {
|
|
|
2465
2620
|
} else if (type instanceof ZodEnum) {
|
|
2466
2621
|
return type.options;
|
|
2467
2622
|
} else if (type instanceof ZodNativeEnum) {
|
|
2468
|
-
return
|
|
2623
|
+
return util.objectValues(type.enum);
|
|
2469
2624
|
} else if (type instanceof ZodDefault) {
|
|
2470
2625
|
return getDiscriminator(type._def.innerType);
|
|
2471
2626
|
} else if (type instanceof ZodUndefined) {
|
|
2472
2627
|
return [void 0];
|
|
2473
2628
|
} else if (type instanceof ZodNull) {
|
|
2474
2629
|
return [null];
|
|
2630
|
+
} else if (type instanceof ZodOptional) {
|
|
2631
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
2632
|
+
} else if (type instanceof ZodNullable) {
|
|
2633
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
2634
|
+
} else if (type instanceof ZodBranded) {
|
|
2635
|
+
return getDiscriminator(type.unwrap());
|
|
2636
|
+
} else if (type instanceof ZodReadonly) {
|
|
2637
|
+
return getDiscriminator(type.unwrap());
|
|
2638
|
+
} else if (type instanceof ZodCatch) {
|
|
2639
|
+
return getDiscriminator(type._def.innerType);
|
|
2475
2640
|
} else {
|
|
2476
|
-
return
|
|
2641
|
+
return [];
|
|
2477
2642
|
}
|
|
2478
2643
|
};
|
|
2479
|
-
var ZodDiscriminatedUnion = class extends ZodType {
|
|
2644
|
+
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
2480
2645
|
_parse(input) {
|
|
2481
2646
|
const { ctx } = this._processInputParams(input);
|
|
2482
2647
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -2533,7 +2698,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2533
2698
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2534
2699
|
for (const type of options) {
|
|
2535
2700
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
2536
|
-
if (!discriminatorValues) {
|
|
2701
|
+
if (!discriminatorValues.length) {
|
|
2537
2702
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
2538
2703
|
}
|
|
2539
2704
|
for (const value of discriminatorValues) {
|
|
@@ -2543,7 +2708,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2543
2708
|
optionsMap.set(value, type);
|
|
2544
2709
|
}
|
|
2545
2710
|
}
|
|
2546
|
-
return new
|
|
2711
|
+
return new _ZodDiscriminatedUnion({
|
|
2547
2712
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
2548
2713
|
discriminator,
|
|
2549
2714
|
options,
|
|
@@ -2643,7 +2808,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
2643
2808
|
...processCreateParams(params)
|
|
2644
2809
|
});
|
|
2645
2810
|
};
|
|
2646
|
-
var ZodTuple = class extends ZodType {
|
|
2811
|
+
var ZodTuple = class _ZodTuple extends ZodType {
|
|
2647
2812
|
_parse(input) {
|
|
2648
2813
|
const { status, ctx } = this._processInputParams(input);
|
|
2649
2814
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -2664,8 +2829,8 @@ var ZodTuple = class extends ZodType {
|
|
|
2664
2829
|
});
|
|
2665
2830
|
return INVALID;
|
|
2666
2831
|
}
|
|
2667
|
-
const
|
|
2668
|
-
if (!
|
|
2832
|
+
const rest16 = this._def.rest;
|
|
2833
|
+
if (!rest16 && ctx.data.length > this._def.items.length) {
|
|
2669
2834
|
addIssueToContext(ctx, {
|
|
2670
2835
|
code: ZodIssueCode.too_big,
|
|
2671
2836
|
maximum: this._def.items.length,
|
|
@@ -2692,10 +2857,10 @@ var ZodTuple = class extends ZodType {
|
|
|
2692
2857
|
get items() {
|
|
2693
2858
|
return this._def.items;
|
|
2694
2859
|
}
|
|
2695
|
-
rest(
|
|
2696
|
-
return new
|
|
2860
|
+
rest(rest16) {
|
|
2861
|
+
return new _ZodTuple({
|
|
2697
2862
|
...this._def,
|
|
2698
|
-
rest:
|
|
2863
|
+
rest: rest16
|
|
2699
2864
|
});
|
|
2700
2865
|
}
|
|
2701
2866
|
};
|
|
@@ -2710,7 +2875,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
2710
2875
|
...processCreateParams(params)
|
|
2711
2876
|
});
|
|
2712
2877
|
};
|
|
2713
|
-
var ZodRecord = class extends ZodType {
|
|
2878
|
+
var ZodRecord = class _ZodRecord extends ZodType {
|
|
2714
2879
|
get keySchema() {
|
|
2715
2880
|
return this._def.keyType;
|
|
2716
2881
|
}
|
|
@@ -2733,7 +2898,8 @@ var ZodRecord = class extends ZodType {
|
|
|
2733
2898
|
for (const key in ctx.data) {
|
|
2734
2899
|
pairs.push({
|
|
2735
2900
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
2736
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
2901
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
2902
|
+
alwaysSet: key in ctx.data
|
|
2737
2903
|
});
|
|
2738
2904
|
}
|
|
2739
2905
|
if (ctx.common.async) {
|
|
@@ -2747,14 +2913,14 @@ var ZodRecord = class extends ZodType {
|
|
|
2747
2913
|
}
|
|
2748
2914
|
static create(first, second, third) {
|
|
2749
2915
|
if (second instanceof ZodType) {
|
|
2750
|
-
return new
|
|
2916
|
+
return new _ZodRecord({
|
|
2751
2917
|
keyType: first,
|
|
2752
2918
|
valueType: second,
|
|
2753
2919
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
2754
2920
|
...processCreateParams(third)
|
|
2755
2921
|
});
|
|
2756
2922
|
}
|
|
2757
|
-
return new
|
|
2923
|
+
return new _ZodRecord({
|
|
2758
2924
|
keyType: ZodString.create(),
|
|
2759
2925
|
valueType: first,
|
|
2760
2926
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
@@ -2763,6 +2929,12 @@ var ZodRecord = class extends ZodType {
|
|
|
2763
2929
|
}
|
|
2764
2930
|
};
|
|
2765
2931
|
var ZodMap = class extends ZodType {
|
|
2932
|
+
get keySchema() {
|
|
2933
|
+
return this._def.keyType;
|
|
2934
|
+
}
|
|
2935
|
+
get valueSchema() {
|
|
2936
|
+
return this._def.valueType;
|
|
2937
|
+
}
|
|
2766
2938
|
_parse(input) {
|
|
2767
2939
|
const { status, ctx } = this._processInputParams(input);
|
|
2768
2940
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -2822,7 +2994,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
2822
2994
|
...processCreateParams(params)
|
|
2823
2995
|
});
|
|
2824
2996
|
};
|
|
2825
|
-
var ZodSet = class extends ZodType {
|
|
2997
|
+
var ZodSet = class _ZodSet extends ZodType {
|
|
2826
2998
|
_parse(input) {
|
|
2827
2999
|
const { status, ctx } = this._processInputParams(input);
|
|
2828
3000
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -2880,13 +3052,13 @@ var ZodSet = class extends ZodType {
|
|
|
2880
3052
|
}
|
|
2881
3053
|
}
|
|
2882
3054
|
min(minSize, message) {
|
|
2883
|
-
return new
|
|
3055
|
+
return new _ZodSet({
|
|
2884
3056
|
...this._def,
|
|
2885
3057
|
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
2886
3058
|
});
|
|
2887
3059
|
}
|
|
2888
3060
|
max(maxSize, message) {
|
|
2889
|
-
return new
|
|
3061
|
+
return new _ZodSet({
|
|
2890
3062
|
...this._def,
|
|
2891
3063
|
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
2892
3064
|
});
|
|
@@ -2907,7 +3079,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
2907
3079
|
...processCreateParams(params)
|
|
2908
3080
|
});
|
|
2909
3081
|
};
|
|
2910
|
-
var ZodFunction = class extends ZodType {
|
|
3082
|
+
var ZodFunction = class _ZodFunction extends ZodType {
|
|
2911
3083
|
constructor() {
|
|
2912
3084
|
super(...arguments);
|
|
2913
3085
|
this.validate = this.implement;
|
|
@@ -2957,27 +3129,29 @@ var ZodFunction = class extends ZodType {
|
|
|
2957
3129
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
2958
3130
|
const fn = ctx.data;
|
|
2959
3131
|
if (this._def.returns instanceof ZodPromise) {
|
|
2960
|
-
|
|
3132
|
+
const me = this;
|
|
3133
|
+
return OK(async function(...args) {
|
|
2961
3134
|
const error = new ZodError([]);
|
|
2962
|
-
const parsedArgs = await
|
|
3135
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
2963
3136
|
error.addIssue(makeArgsIssue(args, e));
|
|
2964
3137
|
throw error;
|
|
2965
3138
|
});
|
|
2966
|
-
const result = await fn
|
|
2967
|
-
const parsedReturns = await
|
|
3139
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3140
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
2968
3141
|
error.addIssue(makeReturnsIssue(result, e));
|
|
2969
3142
|
throw error;
|
|
2970
3143
|
});
|
|
2971
3144
|
return parsedReturns;
|
|
2972
3145
|
});
|
|
2973
3146
|
} else {
|
|
2974
|
-
|
|
2975
|
-
|
|
3147
|
+
const me = this;
|
|
3148
|
+
return OK(function(...args) {
|
|
3149
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
2976
3150
|
if (!parsedArgs.success) {
|
|
2977
3151
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
2978
3152
|
}
|
|
2979
|
-
const result = fn
|
|
2980
|
-
const parsedReturns =
|
|
3153
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3154
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
2981
3155
|
if (!parsedReturns.success) {
|
|
2982
3156
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
2983
3157
|
}
|
|
@@ -2992,13 +3166,13 @@ var ZodFunction = class extends ZodType {
|
|
|
2992
3166
|
return this._def.returns;
|
|
2993
3167
|
}
|
|
2994
3168
|
args(...items) {
|
|
2995
|
-
return new
|
|
3169
|
+
return new _ZodFunction({
|
|
2996
3170
|
...this._def,
|
|
2997
3171
|
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
2998
3172
|
});
|
|
2999
3173
|
}
|
|
3000
3174
|
returns(returnType) {
|
|
3001
|
-
return new
|
|
3175
|
+
return new _ZodFunction({
|
|
3002
3176
|
...this._def,
|
|
3003
3177
|
returns: returnType
|
|
3004
3178
|
});
|
|
@@ -3012,7 +3186,7 @@ var ZodFunction = class extends ZodType {
|
|
|
3012
3186
|
return validatedFunc;
|
|
3013
3187
|
}
|
|
3014
3188
|
static create(args, returns, params) {
|
|
3015
|
-
return new
|
|
3189
|
+
return new _ZodFunction({
|
|
3016
3190
|
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
3017
3191
|
returns: returns || ZodUnknown.create(),
|
|
3018
3192
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
@@ -3068,7 +3242,11 @@ function createZodEnum(values, params) {
|
|
|
3068
3242
|
...processCreateParams(params)
|
|
3069
3243
|
});
|
|
3070
3244
|
}
|
|
3071
|
-
var ZodEnum = class extends ZodType {
|
|
3245
|
+
var ZodEnum = class _ZodEnum extends ZodType {
|
|
3246
|
+
constructor() {
|
|
3247
|
+
super(...arguments);
|
|
3248
|
+
_ZodEnum_cache.set(this, void 0);
|
|
3249
|
+
}
|
|
3072
3250
|
_parse(input) {
|
|
3073
3251
|
if (typeof input.data !== "string") {
|
|
3074
3252
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3080,7 +3258,10 @@ var ZodEnum = class extends ZodType {
|
|
|
3080
3258
|
});
|
|
3081
3259
|
return INVALID;
|
|
3082
3260
|
}
|
|
3083
|
-
if (this
|
|
3261
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
3262
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
3263
|
+
}
|
|
3264
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
3084
3265
|
const ctx = this._getOrReturnCtx(input);
|
|
3085
3266
|
const expectedValues = this._def.values;
|
|
3086
3267
|
addIssueToContext(ctx, {
|
|
@@ -3116,15 +3297,26 @@ var ZodEnum = class extends ZodType {
|
|
|
3116
3297
|
}
|
|
3117
3298
|
return enumValues;
|
|
3118
3299
|
}
|
|
3119
|
-
extract(values) {
|
|
3120
|
-
return
|
|
3300
|
+
extract(values, newDef = this._def) {
|
|
3301
|
+
return _ZodEnum.create(values, {
|
|
3302
|
+
...this._def,
|
|
3303
|
+
...newDef
|
|
3304
|
+
});
|
|
3121
3305
|
}
|
|
3122
|
-
exclude(values) {
|
|
3123
|
-
return
|
|
3306
|
+
exclude(values, newDef = this._def) {
|
|
3307
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
3308
|
+
...this._def,
|
|
3309
|
+
...newDef
|
|
3310
|
+
});
|
|
3124
3311
|
}
|
|
3125
3312
|
};
|
|
3313
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3126
3314
|
ZodEnum.create = createZodEnum;
|
|
3127
3315
|
var ZodNativeEnum = class extends ZodType {
|
|
3316
|
+
constructor() {
|
|
3317
|
+
super(...arguments);
|
|
3318
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
3319
|
+
}
|
|
3128
3320
|
_parse(input) {
|
|
3129
3321
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3130
3322
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3137,7 +3329,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3137
3329
|
});
|
|
3138
3330
|
return INVALID;
|
|
3139
3331
|
}
|
|
3140
|
-
if (
|
|
3332
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
3333
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
3334
|
+
}
|
|
3335
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
3141
3336
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3142
3337
|
addIssueToContext(ctx, {
|
|
3143
3338
|
received: ctx.data,
|
|
@@ -3152,6 +3347,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3152
3347
|
return this._def.values;
|
|
3153
3348
|
}
|
|
3154
3349
|
};
|
|
3350
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3155
3351
|
ZodNativeEnum.create = (values, params) => {
|
|
3156
3352
|
return new ZodNativeEnum({
|
|
3157
3353
|
values,
|
|
@@ -3199,24 +3395,6 @@ var ZodEffects = class extends ZodType {
|
|
|
3199
3395
|
_parse(input) {
|
|
3200
3396
|
const { status, ctx } = this._processInputParams(input);
|
|
3201
3397
|
const effect = this._def.effect || null;
|
|
3202
|
-
if (effect.type === "preprocess") {
|
|
3203
|
-
const processed = effect.transform(ctx.data);
|
|
3204
|
-
if (ctx.common.async) {
|
|
3205
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
3206
|
-
return this._def.schema._parseAsync({
|
|
3207
|
-
data: processed2,
|
|
3208
|
-
path: ctx.path,
|
|
3209
|
-
parent: ctx
|
|
3210
|
-
});
|
|
3211
|
-
});
|
|
3212
|
-
} else {
|
|
3213
|
-
return this._def.schema._parseSync({
|
|
3214
|
-
data: processed,
|
|
3215
|
-
path: ctx.path,
|
|
3216
|
-
parent: ctx
|
|
3217
|
-
});
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
3398
|
const checkCtx = {
|
|
3221
3399
|
addIssue: (arg) => {
|
|
3222
3400
|
addIssueToContext(ctx, arg);
|
|
@@ -3231,6 +3409,42 @@ var ZodEffects = class extends ZodType {
|
|
|
3231
3409
|
}
|
|
3232
3410
|
};
|
|
3233
3411
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
3412
|
+
if (effect.type === "preprocess") {
|
|
3413
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
3414
|
+
if (ctx.common.async) {
|
|
3415
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
3416
|
+
if (status.value === "aborted")
|
|
3417
|
+
return INVALID;
|
|
3418
|
+
const result = await this._def.schema._parseAsync({
|
|
3419
|
+
data: processed2,
|
|
3420
|
+
path: ctx.path,
|
|
3421
|
+
parent: ctx
|
|
3422
|
+
});
|
|
3423
|
+
if (result.status === "aborted")
|
|
3424
|
+
return INVALID;
|
|
3425
|
+
if (result.status === "dirty")
|
|
3426
|
+
return DIRTY(result.value);
|
|
3427
|
+
if (status.value === "dirty")
|
|
3428
|
+
return DIRTY(result.value);
|
|
3429
|
+
return result;
|
|
3430
|
+
});
|
|
3431
|
+
} else {
|
|
3432
|
+
if (status.value === "aborted")
|
|
3433
|
+
return INVALID;
|
|
3434
|
+
const result = this._def.schema._parseSync({
|
|
3435
|
+
data: processed,
|
|
3436
|
+
path: ctx.path,
|
|
3437
|
+
parent: ctx
|
|
3438
|
+
});
|
|
3439
|
+
if (result.status === "aborted")
|
|
3440
|
+
return INVALID;
|
|
3441
|
+
if (result.status === "dirty")
|
|
3442
|
+
return DIRTY(result.value);
|
|
3443
|
+
if (status.value === "dirty")
|
|
3444
|
+
return DIRTY(result.value);
|
|
3445
|
+
return result;
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3234
3448
|
if (effect.type === "refinement") {
|
|
3235
3449
|
const executeRefinement = (acc) => {
|
|
3236
3450
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -3459,7 +3673,7 @@ var ZodBranded = class extends ZodType {
|
|
|
3459
3673
|
return this._def.type;
|
|
3460
3674
|
}
|
|
3461
3675
|
};
|
|
3462
|
-
var ZodPipeline = class extends ZodType {
|
|
3676
|
+
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
3463
3677
|
_parse(input) {
|
|
3464
3678
|
const { status, ctx } = this._processInputParams(input);
|
|
3465
3679
|
if (ctx.common.async) {
|
|
@@ -3507,14 +3721,36 @@ var ZodPipeline = class extends ZodType {
|
|
|
3507
3721
|
}
|
|
3508
3722
|
}
|
|
3509
3723
|
static create(a, b) {
|
|
3510
|
-
return new
|
|
3724
|
+
return new _ZodPipeline({
|
|
3511
3725
|
in: a,
|
|
3512
3726
|
out: b,
|
|
3513
3727
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3514
3728
|
});
|
|
3515
3729
|
}
|
|
3516
3730
|
};
|
|
3517
|
-
var
|
|
3731
|
+
var ZodReadonly = class extends ZodType {
|
|
3732
|
+
_parse(input) {
|
|
3733
|
+
const result = this._def.innerType._parse(input);
|
|
3734
|
+
const freeze = (data) => {
|
|
3735
|
+
if (isValid(data)) {
|
|
3736
|
+
data.value = Object.freeze(data.value);
|
|
3737
|
+
}
|
|
3738
|
+
return data;
|
|
3739
|
+
};
|
|
3740
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3741
|
+
}
|
|
3742
|
+
unwrap() {
|
|
3743
|
+
return this._def.innerType;
|
|
3744
|
+
}
|
|
3745
|
+
};
|
|
3746
|
+
ZodReadonly.create = (type, params) => {
|
|
3747
|
+
return new ZodReadonly({
|
|
3748
|
+
innerType: type,
|
|
3749
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
3750
|
+
...processCreateParams(params)
|
|
3751
|
+
});
|
|
3752
|
+
};
|
|
3753
|
+
function custom(check, params = {}, fatal) {
|
|
3518
3754
|
if (check)
|
|
3519
3755
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3520
3756
|
var _a, _b;
|
|
@@ -3526,7 +3762,7 @@ var custom = (check, params = {}, fatal) => {
|
|
|
3526
3762
|
}
|
|
3527
3763
|
});
|
|
3528
3764
|
return ZodAny.create();
|
|
3529
|
-
}
|
|
3765
|
+
}
|
|
3530
3766
|
var late = {
|
|
3531
3767
|
object: ZodObject.lazycreate
|
|
3532
3768
|
};
|
|
@@ -3567,6 +3803,7 @@ var ZodFirstPartyTypeKind;
|
|
|
3567
3803
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
3568
3804
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
3569
3805
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3806
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3570
3807
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3571
3808
|
var instanceOfType = (cls, params = {
|
|
3572
3809
|
message: `Input not instance of ${cls.name}`
|
|
@@ -3644,6 +3881,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3644
3881
|
ZodParsedType,
|
|
3645
3882
|
getParsedType,
|
|
3646
3883
|
ZodType,
|
|
3884
|
+
datetimeRegex,
|
|
3647
3885
|
ZodString,
|
|
3648
3886
|
ZodNumber,
|
|
3649
3887
|
ZodBigInt,
|
|
@@ -3681,6 +3919,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3681
3919
|
BRAND,
|
|
3682
3920
|
ZodBranded,
|
|
3683
3921
|
ZodPipeline,
|
|
3922
|
+
ZodReadonly,
|
|
3684
3923
|
custom,
|
|
3685
3924
|
Schema: ZodType,
|
|
3686
3925
|
ZodSchema: ZodType,
|
|
@@ -3894,28 +4133,23 @@ var itemCategoriesSearchSchema = z.object({
|
|
|
3894
4133
|
data: z.array(itemCategorySchema)
|
|
3895
4134
|
});
|
|
3896
4135
|
|
|
3897
|
-
// lib/categories/models/
|
|
4136
|
+
// lib/categories/models/ItemHierarchyResponse.ts
|
|
3898
4137
|
var baseHierarchySchema = z.object({
|
|
3899
4138
|
id: z.string(),
|
|
3900
4139
|
name: z.string().nullish(),
|
|
3901
4140
|
description: z.string().nullish(),
|
|
3902
4141
|
type: z.string().nullish()
|
|
3903
4142
|
});
|
|
3904
|
-
var hierarchySchema = baseHierarchySchema.extend(
|
|
3905
|
-
|
|
3906
|
-
child: z.lazy(() => hierarchySchema).nullable()
|
|
3907
|
-
}
|
|
3908
|
-
);
|
|
3909
|
-
|
|
3910
|
-
// lib/categories/models/ItemHierarchy.ts
|
|
3911
|
-
var itemHierarchySchema = z.object({
|
|
3912
|
-
itemId: z.string(),
|
|
3913
|
-
hierarchies: z.array(hierarchySchema)
|
|
4143
|
+
var hierarchySchema = baseHierarchySchema.extend({
|
|
4144
|
+
child: z.lazy(() => hierarchySchema).nullable()
|
|
3914
4145
|
});
|
|
3915
|
-
|
|
3916
|
-
// lib/categories/models/ItemHierarchyResponse.ts
|
|
3917
4146
|
var itemHierarchyResponseSchema = z.object({
|
|
3918
|
-
itemHierarchies: z.array(
|
|
4147
|
+
itemHierarchies: z.array(
|
|
4148
|
+
z.object({
|
|
4149
|
+
itemId: z.string(),
|
|
4150
|
+
hierarchies: z.array(hierarchySchema)
|
|
4151
|
+
})
|
|
4152
|
+
)
|
|
3919
4153
|
});
|
|
3920
4154
|
|
|
3921
4155
|
// lib/categories/index.ts
|
|
@@ -4038,6 +4272,27 @@ var connectionSchema = z.object({
|
|
|
4038
4272
|
partner_org_id: z.string()
|
|
4039
4273
|
});
|
|
4040
4274
|
|
|
4275
|
+
// lib/tradingPartners/models/CompanyRelationshipUpsertBody.ts
|
|
4276
|
+
var companyRelationshipUpsertBodySchema = z.object({
|
|
4277
|
+
supplierId: z.number(),
|
|
4278
|
+
retailerId: z.number(),
|
|
4279
|
+
catalogId: z.number(),
|
|
4280
|
+
active: z.boolean(),
|
|
4281
|
+
applicationType: z.array(z.enum(["ASSORTMENT", "ITEM-XREF"])).default([])
|
|
4282
|
+
});
|
|
4283
|
+
|
|
4284
|
+
// lib/tradingPartners/models/ItemPartner.ts
|
|
4285
|
+
var itemPartnerSchema = z.object({
|
|
4286
|
+
itemPartnerId: z.number(),
|
|
4287
|
+
retailerId: z.number(),
|
|
4288
|
+
supplierId: z.number(),
|
|
4289
|
+
catalogId: z.number(),
|
|
4290
|
+
isActive: z.number(),
|
|
4291
|
+
createdDate: z.string(),
|
|
4292
|
+
modifiedDate: z.string(),
|
|
4293
|
+
applications: z.array(z.enum(["ASSORTMENT", "ITEM-XREF"]))
|
|
4294
|
+
});
|
|
4295
|
+
|
|
4041
4296
|
// lib/tradingPartners/models/TradingPartnerAccessByCompanyId.ts
|
|
4042
4297
|
var tradingPartnerAccessByCompanyIdSchema = z.object({
|
|
4043
4298
|
companyId: z.number(),
|
|
@@ -4060,15 +4315,63 @@ function createTradingPartnerAccessApiHandlers(client) {
|
|
|
4060
4315
|
return import_msw5.rest.get(`${client.getBaseUrl()}${BASE_URL5}/connections`, resolver);
|
|
4061
4316
|
}
|
|
4062
4317
|
getAllTradingPartners.generateData = () => (0, import_zod_mock4.generateMock)(tradingPartnerAccessByCompanyIdSchema);
|
|
4318
|
+
function upsertRelationship(resolver = (_req, res, ctx) => {
|
|
4319
|
+
return res(ctx.status(200));
|
|
4320
|
+
}) {
|
|
4321
|
+
return import_msw5.rest.post(`${client.getBaseUrl()}${BASE_URL5}/upsert-relationship`, resolver);
|
|
4322
|
+
}
|
|
4323
|
+
upsertRelationship.generateData = () => (0, import_zod_mock4.generateMock)(itemPartnerSchema);
|
|
4324
|
+
function upsertHierarchy(resolver = (_req, res, ctx) => {
|
|
4325
|
+
return res(ctx.status(200));
|
|
4326
|
+
}) {
|
|
4327
|
+
return import_msw5.rest.post(`${client.getBaseUrl()}${BASE_URL5}/upsert-hierarchy`, resolver);
|
|
4328
|
+
}
|
|
4063
4329
|
return {
|
|
4064
|
-
getAllTradingPartners
|
|
4330
|
+
getAllTradingPartners,
|
|
4331
|
+
upsertRelationship,
|
|
4332
|
+
upsertHierarchy
|
|
4065
4333
|
};
|
|
4066
4334
|
}
|
|
4067
4335
|
|
|
4068
|
-
// lib/
|
|
4336
|
+
// lib/tradingPartnerSettings/mockHandlers.ts
|
|
4069
4337
|
var import_zod_mock5 = require("@anatine/zod-mock");
|
|
4070
4338
|
var import_msw6 = require("msw");
|
|
4071
4339
|
|
|
4340
|
+
// lib/tradingPartnerSettings/models/RetailerTradingPartnerStages.ts
|
|
4341
|
+
var retailerTradingPartnerStages = z.array(
|
|
4342
|
+
z.enum([
|
|
4343
|
+
"Core",
|
|
4344
|
+
"Core Plus",
|
|
4345
|
+
"Core Advanced",
|
|
4346
|
+
"Enriched",
|
|
4347
|
+
"Standard Requirements"
|
|
4348
|
+
])
|
|
4349
|
+
);
|
|
4350
|
+
|
|
4351
|
+
// lib/tradingPartnerSettings/index.ts
|
|
4352
|
+
var BASE_URL6 = "trading-partner-settings";
|
|
4353
|
+
|
|
4354
|
+
// lib/tradingPartnerSettings/mockHandlers.ts
|
|
4355
|
+
function createTradingPartnerSettingsApiHandlers(client) {
|
|
4356
|
+
function getRetailerStages(resolver = (_req, res, ctx) => {
|
|
4357
|
+
const data = (0, import_zod_mock5.generateMock)(retailerTradingPartnerStages);
|
|
4358
|
+
return res(ctx.status(200), ctx.json(data));
|
|
4359
|
+
}) {
|
|
4360
|
+
return import_msw6.rest.get(
|
|
4361
|
+
`${client.getBaseUrl()}/${BASE_URL6}/stages/retailer-configured`,
|
|
4362
|
+
resolver
|
|
4363
|
+
);
|
|
4364
|
+
}
|
|
4365
|
+
getRetailerStages.generateData = () => (0, import_zod_mock5.generateMock)(retailerTradingPartnerStages);
|
|
4366
|
+
return {
|
|
4367
|
+
getRetailerStages
|
|
4368
|
+
};
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
// lib/whoami/mockHandlers.ts
|
|
4372
|
+
var import_zod_mock6 = require("@anatine/zod-mock");
|
|
4373
|
+
var import_msw7 = require("msw");
|
|
4374
|
+
|
|
4072
4375
|
// lib/whoami/models/IdentityServiceDatetimePreferences.ts
|
|
4073
4376
|
var identityServiceDatetimePreferencesSchema = z.object({
|
|
4074
4377
|
DATE_TIME: z.string(),
|
|
@@ -4163,27 +4466,27 @@ var userAccountSchema = z.object({
|
|
|
4163
4466
|
});
|
|
4164
4467
|
|
|
4165
4468
|
// lib/whoami/index.ts
|
|
4166
|
-
var
|
|
4469
|
+
var BASE_URL7 = "whoami";
|
|
4167
4470
|
|
|
4168
4471
|
// lib/whoami/mockHandlers.ts
|
|
4169
4472
|
function createWhoAmIApiHandlers(client) {
|
|
4170
4473
|
function whoAmI(resolver = (_req, res, ctx) => {
|
|
4171
|
-
const data = (0,
|
|
4474
|
+
const data = (0, import_zod_mock6.generateMock)(userAccountSchema);
|
|
4172
4475
|
return res(ctx.status(200), ctx.json(data));
|
|
4173
4476
|
}) {
|
|
4174
|
-
return
|
|
4477
|
+
return import_msw7.rest.get(`${client.getBaseUrl()}${BASE_URL7}`, resolver);
|
|
4175
4478
|
}
|
|
4176
|
-
whoAmI.generateData = () => (0,
|
|
4479
|
+
whoAmI.generateData = () => (0, import_zod_mock6.generateMock)(userAccountSchema);
|
|
4177
4480
|
return {
|
|
4178
4481
|
whoAmI
|
|
4179
4482
|
};
|
|
4180
4483
|
}
|
|
4181
4484
|
|
|
4182
4485
|
// lib/errors/mockHandlers.ts
|
|
4183
|
-
var
|
|
4184
|
-
var
|
|
4486
|
+
var import_zod_mock7 = require("@anatine/zod-mock");
|
|
4487
|
+
var import_msw8 = require("msw");
|
|
4185
4488
|
|
|
4186
|
-
// lib/items/models/ItemHeader.ts
|
|
4489
|
+
// lib/items/v1/models/ItemHeader.ts
|
|
4187
4490
|
var itemHeaderSchema = z.object({
|
|
4188
4491
|
status: z.string().optional(),
|
|
4189
4492
|
catalogName: z.string(),
|
|
@@ -4199,7 +4502,7 @@ var itemHeaderSchema = z.object({
|
|
|
4199
4502
|
itemInfoId: z.string()
|
|
4200
4503
|
});
|
|
4201
4504
|
|
|
4202
|
-
// lib/items/models/PhaseEnum.ts
|
|
4505
|
+
// lib/items/v1/models/PhaseEnum.ts
|
|
4203
4506
|
var phaseEnumSchema = z.enum([
|
|
4204
4507
|
"CORE",
|
|
4205
4508
|
"CORE_PLUS",
|
|
@@ -4208,7 +4511,7 @@ var phaseEnumSchema = z.enum([
|
|
|
4208
4511
|
"STANDARD_REQUIREMENTS"
|
|
4209
4512
|
]);
|
|
4210
4513
|
|
|
4211
|
-
// lib/items/models/TradingPartnerStage.ts
|
|
4514
|
+
// lib/items/v1/models/TradingPartnerStage.ts
|
|
4212
4515
|
var tradingPartnerStageSchema = z.object({
|
|
4213
4516
|
companyId: z.number(),
|
|
4214
4517
|
companyName: z.string(),
|
|
@@ -4216,7 +4519,7 @@ var tradingPartnerStageSchema = z.object({
|
|
|
4216
4519
|
isValid: z.boolean()
|
|
4217
4520
|
});
|
|
4218
4521
|
|
|
4219
|
-
// lib/items/models/ItemMap.ts
|
|
4522
|
+
// lib/items/v1/models/ItemMap.ts
|
|
4220
4523
|
var itemMapSchema = z.object({
|
|
4221
4524
|
rn: z.number().optional(),
|
|
4222
4525
|
iteminfoid: z.string(),
|
|
@@ -4239,13 +4542,13 @@ var itemMapSchema = z.object({
|
|
|
4239
4542
|
productsizedescription: z.array(z.string()).nullish()
|
|
4240
4543
|
}).passthrough();
|
|
4241
4544
|
|
|
4242
|
-
// lib/items/models/ItemTable.ts
|
|
4545
|
+
// lib/items/v1/models/ItemTable.ts
|
|
4243
4546
|
var itemTableSchema = z.object({
|
|
4244
4547
|
headers: itemHeaderSchema,
|
|
4245
4548
|
itemMaps: z.array(itemMapSchema)
|
|
4246
4549
|
});
|
|
4247
4550
|
|
|
4248
|
-
// lib/items/models/ItemSearchView.ts
|
|
4551
|
+
// lib/items/v1/models/ItemSearchView.ts
|
|
4249
4552
|
var itemSearchViewSchema = z.object({
|
|
4250
4553
|
itemTable: itemTableSchema,
|
|
4251
4554
|
hasNext: z.boolean(),
|
|
@@ -4519,7 +4822,7 @@ var companyBriefByOrgSchema = z.object({
|
|
|
4519
4822
|
dc4Id: z.number()
|
|
4520
4823
|
});
|
|
4521
4824
|
|
|
4522
|
-
// lib/items/models/AttributeDetail.ts
|
|
4825
|
+
// lib/items/v1/models/AttributeDetail.ts
|
|
4523
4826
|
var attributeDetailSchema = z.object({
|
|
4524
4827
|
type: attrDatatypeNameEnumSchema,
|
|
4525
4828
|
name: z.string(),
|
|
@@ -4529,23 +4832,23 @@ var attributeDetailSchema = z.object({
|
|
|
4529
4832
|
orderBy: z.number().or(z.string()).nullish()
|
|
4530
4833
|
});
|
|
4531
4834
|
|
|
4532
|
-
// lib/items/models/CategoryEnum.ts
|
|
4835
|
+
// lib/items/v1/models/CategoryEnum.ts
|
|
4533
4836
|
var categoryEnumSchema = z.enum([
|
|
4534
|
-
"
|
|
4837
|
+
"ALIAS",
|
|
4535
4838
|
"CATALOG",
|
|
4536
4839
|
"EXPORT",
|
|
4537
|
-
"LABEL",
|
|
4538
4840
|
"LEGACY_PRODUCT_TYPE",
|
|
4539
4841
|
"PRODUCT_CLASSIFICATION",
|
|
4540
4842
|
"PRODUCT_CODE",
|
|
4541
4843
|
"SELECTION_CODE",
|
|
4844
|
+
"TAG",
|
|
4542
4845
|
"TAXONOMY_ROOT"
|
|
4543
4846
|
]);
|
|
4544
4847
|
|
|
4545
|
-
// lib/items/models/ComponentDetails.ts
|
|
4848
|
+
// lib/items/v1/models/ComponentDetails.ts
|
|
4546
4849
|
var componentDetailsSchema = z.object({
|
|
4547
4850
|
itemInfoId: z.number(),
|
|
4548
|
-
description: z.string(),
|
|
4851
|
+
description: z.string().nullish(),
|
|
4549
4852
|
saleable: z.boolean(),
|
|
4550
4853
|
valid: z.boolean(),
|
|
4551
4854
|
uniqueCriteria: z.array(
|
|
@@ -4556,43 +4859,43 @@ var componentDetailsSchema = z.object({
|
|
|
4556
4859
|
)
|
|
4557
4860
|
});
|
|
4558
4861
|
|
|
4559
|
-
// lib/items/models/RepeatableGroup.ts
|
|
4862
|
+
// lib/items/v1/models/RepeatableGroup.ts
|
|
4560
4863
|
var repeatableGroupSchema = z.object({
|
|
4561
4864
|
repeatableGroupId: z.string(),
|
|
4562
4865
|
repeatableNumber: z.number()
|
|
4563
4866
|
});
|
|
4564
4867
|
|
|
4565
|
-
// lib/items/models/GroupedAttributeList.ts
|
|
4868
|
+
// lib/items/v1/models/GroupedAttributeList.ts
|
|
4566
4869
|
var groupedAttributeListSchema = z.object({
|
|
4567
4870
|
type: z.string(),
|
|
4568
4871
|
rows: z.array(z.array(attributeDetailSchema)),
|
|
4569
4872
|
repeatableGroups: z.array(repeatableGroupSchema)
|
|
4570
4873
|
});
|
|
4571
4874
|
|
|
4572
|
-
// lib/items/models/GroupedAttributes.ts
|
|
4875
|
+
// lib/items/v1/models/GroupedAttributes.ts
|
|
4573
4876
|
var groupedAttributesSchema = z.object({
|
|
4574
4877
|
type: z.string(),
|
|
4575
4878
|
attributes: z.array(attributeDetailSchema),
|
|
4576
4879
|
attributeGroups: z.array(groupedAttributeListSchema)
|
|
4577
4880
|
});
|
|
4578
4881
|
|
|
4579
|
-
// lib/items/models/HierarchyCategory.ts
|
|
4882
|
+
// lib/items/v1/models/HierarchyCategory.ts
|
|
4580
4883
|
var hierarchyCategorySchema = z.object({
|
|
4581
4884
|
name: z.string(),
|
|
4582
4885
|
description: z.string().nullish(),
|
|
4583
4886
|
id: z.number(),
|
|
4584
|
-
companyId: z.number(),
|
|
4887
|
+
companyId: z.number().nullish(),
|
|
4585
4888
|
type: categoryEnumSchema
|
|
4586
4889
|
});
|
|
4587
4890
|
|
|
4588
|
-
// lib/items/models/HierarchyDetails.ts
|
|
4891
|
+
// lib/items/v1/models/HierarchyDetails.ts
|
|
4589
4892
|
var hierarchyDetailsSchema = z.object({
|
|
4590
4893
|
catalogs: z.array(hierarchyCategorySchema),
|
|
4591
4894
|
selectionCodes: z.array(hierarchyCategorySchema),
|
|
4592
4895
|
productCodes: z.array(hierarchyCategorySchema)
|
|
4593
4896
|
});
|
|
4594
4897
|
|
|
4595
|
-
// lib/items/models/PackComponentItemInfo.ts
|
|
4898
|
+
// lib/items/v1/models/PackComponentItemInfo.ts
|
|
4596
4899
|
var packComponentItemInfoSchema = z.object({
|
|
4597
4900
|
companyid: z.number(),
|
|
4598
4901
|
createddate: z.number(),
|
|
@@ -4606,7 +4909,7 @@ var packComponentItemInfoSchema = z.object({
|
|
|
4606
4909
|
attributes: z.record(z.string(), z.string().or(z.array(z.string())))
|
|
4607
4910
|
});
|
|
4608
4911
|
|
|
4609
|
-
// lib/items/models/ItemPrice.ts
|
|
4912
|
+
// lib/items/v1/models/ItemPrice.ts
|
|
4610
4913
|
var itemPriceSchema = z.object({
|
|
4611
4914
|
amount: z.number(),
|
|
4612
4915
|
currency: z.string(),
|
|
@@ -4630,13 +4933,13 @@ var itemPriceSchema = z.object({
|
|
|
4630
4933
|
priceUnitQuantityUOM: z.string().nullish()
|
|
4631
4934
|
});
|
|
4632
4935
|
|
|
4633
|
-
// lib/items/models/PackComponentDetails.ts
|
|
4936
|
+
// lib/items/v1/models/PackComponentDetails.ts
|
|
4634
4937
|
var packComponentDetailsSchema = z.object({
|
|
4635
4938
|
itemInfo: packComponentItemInfoSchema,
|
|
4636
4939
|
itemPrices: z.array(itemPriceSchema)
|
|
4637
4940
|
});
|
|
4638
4941
|
|
|
4639
|
-
// lib/items/models/GroupedItem.ts
|
|
4942
|
+
// lib/items/v1/models/GroupedItem.ts
|
|
4640
4943
|
var groupedItemSchema = z.object({
|
|
4641
4944
|
iteminfoid: z.number(),
|
|
4642
4945
|
companyid: z.number(),
|
|
@@ -4652,12 +4955,12 @@ var groupedItemSchema = z.object({
|
|
|
4652
4955
|
locales: z.array(z.string())
|
|
4653
4956
|
});
|
|
4654
4957
|
|
|
4655
|
-
// lib/items/models/ItemDetailView.ts
|
|
4958
|
+
// lib/items/v1/models/ItemDetailView.ts
|
|
4656
4959
|
var itemDetailViewSchema = z.object({
|
|
4657
4960
|
item: groupedItemSchema
|
|
4658
4961
|
});
|
|
4659
4962
|
|
|
4660
|
-
// lib/items/models/Bulb.ts
|
|
4963
|
+
// lib/items/v1/models/Bulb.ts
|
|
4661
4964
|
var bulbSchema = z.object({
|
|
4662
4965
|
iteminfoid: z.number(),
|
|
4663
4966
|
id: z.number(),
|
|
@@ -4675,14 +4978,14 @@ var bulbSchema = z.object({
|
|
|
4675
4978
|
threewaybulb: z.string()
|
|
4676
4979
|
});
|
|
4677
4980
|
|
|
4678
|
-
// lib/items/models/PackComponent.ts
|
|
4981
|
+
// lib/items/v1/models/PackComponent.ts
|
|
4679
4982
|
var packComponentSchema = z.object({
|
|
4680
4983
|
itemInfoId: z.number().nullish(),
|
|
4681
4984
|
attributes: z.record(z.string(), z.string().or(z.array(z.string()))),
|
|
4682
4985
|
prices: z.array(itemPriceSchema)
|
|
4683
4986
|
});
|
|
4684
4987
|
|
|
4685
|
-
// lib/items/models/MediaItem.ts
|
|
4988
|
+
// lib/items/v1/models/MediaItem.ts
|
|
4686
4989
|
var mediaItemSchema = z.object({
|
|
4687
4990
|
id: z.number(),
|
|
4688
4991
|
iteminfoid: z.number(),
|
|
@@ -4703,7 +5006,7 @@ var mediaItemSchema = z.object({
|
|
|
4703
5006
|
thumbnailflag: z.string().nullish()
|
|
4704
5007
|
});
|
|
4705
5008
|
|
|
4706
|
-
// lib/items/models/ItemDetail.ts
|
|
5009
|
+
// lib/items/v1/models/ItemDetail.ts
|
|
4707
5010
|
var itemDetailSchema = z.object({
|
|
4708
5011
|
attributes: z.record(z.string(), z.any()),
|
|
4709
5012
|
clusters: z.record(
|
|
@@ -4723,13 +5026,13 @@ var itemDetailSchema = z.object({
|
|
|
4723
5026
|
packs: z.array(packComponentSchema)
|
|
4724
5027
|
});
|
|
4725
5028
|
|
|
4726
|
-
// lib/items/models/SpsItemIdResponse.ts
|
|
5029
|
+
// lib/items/v1/models/SpsItemIdResponse.ts
|
|
4727
5030
|
var spsItemIdResponseSchema = z.object({
|
|
4728
5031
|
id: z.string(),
|
|
4729
5032
|
ref: z.string()
|
|
4730
5033
|
});
|
|
4731
5034
|
|
|
4732
|
-
// lib/items/models/ItemOrgStatus.ts
|
|
5035
|
+
// lib/items/v1/models/ItemOrgStatus.ts
|
|
4733
5036
|
var itemOrgStatusSchema = z.object({
|
|
4734
5037
|
org: z.object({
|
|
4735
5038
|
ref: z.string(),
|
|
@@ -4740,13 +5043,13 @@ var itemOrgStatusSchema = z.object({
|
|
|
4740
5043
|
validForRelationship: z.boolean()
|
|
4741
5044
|
});
|
|
4742
5045
|
|
|
4743
|
-
// lib/items/models/ItemStatus.ts
|
|
5046
|
+
// lib/items/v1/models/ItemStatus.ts
|
|
4744
5047
|
var itemStatusSchema = z.object({
|
|
4745
5048
|
itemId: z.string(),
|
|
4746
5049
|
itemOrgStatuses: z.array(itemOrgStatusSchema)
|
|
4747
5050
|
});
|
|
4748
5051
|
|
|
4749
|
-
// lib/items/models/ItemStatusResponse.ts
|
|
5052
|
+
// lib/items/v1/models/ItemStatusResponse.ts
|
|
4750
5053
|
var itemStatusResponseSchema = z.object({
|
|
4751
5054
|
itemStatuses: z.array(itemStatusSchema)
|
|
4752
5055
|
});
|
|
@@ -4775,117 +5078,117 @@ var itemErrorDetailsResultSchema = z.object({
|
|
|
4775
5078
|
});
|
|
4776
5079
|
|
|
4777
5080
|
// lib/errors/index.ts
|
|
4778
|
-
var
|
|
5081
|
+
var BASE_URL8 = "errors";
|
|
4779
5082
|
|
|
4780
5083
|
// lib/errors/mockHandlers.ts
|
|
4781
5084
|
function createErrorsApiHandlers(client) {
|
|
4782
5085
|
function getInvalidItemErrorDetails(resolver = (_req, res, ctx) => {
|
|
4783
|
-
const data = (0,
|
|
5086
|
+
const data = (0, import_zod_mock7.generateMock)(itemErrorDetailsResultSchema);
|
|
4784
5087
|
return res(ctx.status(200), ctx.json(data));
|
|
4785
5088
|
}) {
|
|
4786
|
-
return
|
|
5089
|
+
return import_msw8.rest.get(`${client.getBaseUrl()}${BASE_URL8}/items/:itemInfoId`, resolver);
|
|
4787
5090
|
}
|
|
4788
|
-
getInvalidItemErrorDetails.generateData = () => (0,
|
|
5091
|
+
getInvalidItemErrorDetails.generateData = () => (0, import_zod_mock7.generateMock)(itemErrorDetailsResultSchema);
|
|
4789
5092
|
return {
|
|
4790
5093
|
getInvalidItemErrorDetails
|
|
4791
5094
|
};
|
|
4792
5095
|
}
|
|
4793
5096
|
|
|
4794
5097
|
// lib/locale/mockHandlers.ts
|
|
4795
|
-
var
|
|
5098
|
+
var import_msw9 = require("msw");
|
|
4796
5099
|
|
|
4797
5100
|
// lib/locale/index.ts
|
|
4798
|
-
var
|
|
5101
|
+
var BASE_URL9 = "locale";
|
|
4799
5102
|
|
|
4800
5103
|
// lib/locale/mockHandlers.ts
|
|
4801
|
-
var
|
|
5104
|
+
var import_zod_mock8 = require("@anatine/zod-mock");
|
|
4802
5105
|
function createLocaleApiHandlers(client) {
|
|
4803
5106
|
function getLocale(resolver = (_req, res, ctx) => {
|
|
4804
|
-
const data = (0,
|
|
5107
|
+
const data = (0, import_zod_mock8.generateMock)(z.array(localeSchema));
|
|
4805
5108
|
return res(ctx.status(200), ctx.json(data));
|
|
4806
5109
|
}) {
|
|
4807
|
-
return
|
|
5110
|
+
return import_msw9.rest.get(`${client.getBaseUrl()}${BASE_URL9}`, resolver);
|
|
4808
5111
|
}
|
|
4809
|
-
getLocale.generateData = () => (0,
|
|
5112
|
+
getLocale.generateData = () => (0, import_zod_mock8.generateMock)(z.array(localeSchema));
|
|
4810
5113
|
return {
|
|
4811
5114
|
getLocale
|
|
4812
5115
|
};
|
|
4813
5116
|
}
|
|
4814
5117
|
|
|
4815
|
-
// lib/items/mockHandlers.ts
|
|
4816
|
-
var
|
|
4817
|
-
var
|
|
5118
|
+
// lib/items/v1/mockHandlers.ts
|
|
5119
|
+
var import_zod_mock9 = require("@anatine/zod-mock");
|
|
5120
|
+
var import_msw10 = require("msw");
|
|
4818
5121
|
|
|
4819
|
-
// lib/items/index.ts
|
|
4820
|
-
var
|
|
5122
|
+
// lib/items/v1/index.ts
|
|
5123
|
+
var BASE_URL10 = "items";
|
|
4821
5124
|
|
|
4822
|
-
// lib/items/mockHandlers.ts
|
|
5125
|
+
// lib/items/v1/mockHandlers.ts
|
|
4823
5126
|
function createItemsApiHandlers(client) {
|
|
4824
5127
|
function searchItems(resolver = (_req, res, ctx) => {
|
|
4825
|
-
const data = (0,
|
|
5128
|
+
const data = (0, import_zod_mock9.generateMock)(itemSearchViewSchema);
|
|
4826
5129
|
return res(ctx.status(200), ctx.json(data));
|
|
4827
5130
|
}) {
|
|
4828
|
-
return
|
|
5131
|
+
return import_msw10.rest.get(`${client.getBaseUrl()}${BASE_URL10}`, resolver);
|
|
4829
5132
|
}
|
|
4830
|
-
searchItems.generateData = () => (0,
|
|
5133
|
+
searchItems.generateData = () => (0, import_zod_mock9.generateMock)(itemSearchViewSchema);
|
|
4831
5134
|
function getItem(resolver = (_req, res, ctx) => {
|
|
4832
|
-
const data = (0,
|
|
5135
|
+
const data = (0, import_zod_mock9.generateMock)(itemDetailViewSchema);
|
|
4833
5136
|
return res(ctx.status(200), ctx.json(data));
|
|
4834
5137
|
}) {
|
|
4835
|
-
return
|
|
4836
|
-
`${client.getBaseUrl()}${
|
|
5138
|
+
return import_msw10.rest.get(
|
|
5139
|
+
`${client.getBaseUrl()}${BASE_URL10}/:itemId`,
|
|
4837
5140
|
resolver
|
|
4838
5141
|
);
|
|
4839
5142
|
}
|
|
4840
|
-
getItem.generateData = () => (0,
|
|
5143
|
+
getItem.generateData = () => (0, import_zod_mock9.generateMock)(itemDetailViewSchema);
|
|
4841
5144
|
function updateItem(resolver = (_req, res, ctx) => {
|
|
4842
5145
|
return res(ctx.status(200));
|
|
4843
5146
|
}) {
|
|
4844
|
-
return
|
|
4845
|
-
`${client.getBaseUrl()}${
|
|
5147
|
+
return import_msw10.rest.put(
|
|
5148
|
+
`${client.getBaseUrl()}${BASE_URL10}/details/:itemId`,
|
|
4846
5149
|
resolver
|
|
4847
5150
|
);
|
|
4848
5151
|
}
|
|
4849
5152
|
function deleteItem(resolver = (_req, res, ctx) => {
|
|
4850
5153
|
return res(ctx.status(200));
|
|
4851
5154
|
}) {
|
|
4852
|
-
return
|
|
5155
|
+
return import_msw10.rest.post(`${client.getBaseUrl()}${BASE_URL10}/:itemId`, resolver);
|
|
4853
5156
|
}
|
|
4854
5157
|
function deleteItems(resolver = (_req, res, ctx) => {
|
|
4855
5158
|
return res(ctx.status(200));
|
|
4856
5159
|
}) {
|
|
4857
|
-
return
|
|
5160
|
+
return import_msw10.rest.post(`${client.getBaseUrl()}${BASE_URL10}/items`, resolver);
|
|
4858
5161
|
}
|
|
4859
5162
|
function getItemInfoId(resolver = (_req, res, ctx) => {
|
|
4860
|
-
const data = (0,
|
|
5163
|
+
const data = (0, import_zod_mock9.generateMock)(z.number());
|
|
4861
5164
|
return res(ctx.status(200), ctx.json(data));
|
|
4862
5165
|
}) {
|
|
4863
|
-
return
|
|
4864
|
-
`${client.getBaseUrl()}${
|
|
5166
|
+
return import_msw10.rest.get(
|
|
5167
|
+
`${client.getBaseUrl()}${BASE_URL10}/:spsItemId/itemInfoId`,
|
|
4865
5168
|
resolver
|
|
4866
5169
|
);
|
|
4867
5170
|
}
|
|
4868
|
-
getItemInfoId.generateData = () => (0,
|
|
5171
|
+
getItemInfoId.generateData = () => (0, import_zod_mock9.generateMock)(z.number());
|
|
4869
5172
|
function getSpsItemId(resolver = (_req, res, ctx) => {
|
|
4870
|
-
const data = (0,
|
|
5173
|
+
const data = (0, import_zod_mock9.generateMock)(z.string());
|
|
4871
5174
|
return res(ctx.status(200), ctx.json(data));
|
|
4872
5175
|
}) {
|
|
4873
|
-
return
|
|
4874
|
-
`${client.getBaseUrl()}${
|
|
5176
|
+
return import_msw10.rest.get(
|
|
5177
|
+
`${client.getBaseUrl()}${BASE_URL10}/:itemInfoId/spsItemId`,
|
|
4875
5178
|
resolver
|
|
4876
5179
|
);
|
|
4877
5180
|
}
|
|
4878
|
-
getSpsItemId.generateData = () => (0,
|
|
5181
|
+
getSpsItemId.generateData = () => (0, import_zod_mock9.generateMock)(z.string());
|
|
4879
5182
|
function getItemStatus(resolver = (_req, res, ctx) => {
|
|
4880
|
-
const data = (0,
|
|
5183
|
+
const data = (0, import_zod_mock9.generateMock)(itemStatusResponseSchema);
|
|
4881
5184
|
return res(ctx.status(200), ctx.json(data));
|
|
4882
5185
|
}) {
|
|
4883
|
-
return
|
|
4884
|
-
`${client.getBaseUrl()}${
|
|
5186
|
+
return import_msw10.rest.get(
|
|
5187
|
+
`${client.getBaseUrl()}${BASE_URL10}/status`,
|
|
4885
5188
|
resolver
|
|
4886
5189
|
);
|
|
4887
5190
|
}
|
|
4888
|
-
getItemStatus.generateData = () => (0,
|
|
5191
|
+
getItemStatus.generateData = () => (0, import_zod_mock9.generateMock)(itemStatusResponseSchema);
|
|
4889
5192
|
return {
|
|
4890
5193
|
searchItems,
|
|
4891
5194
|
getItem,
|
|
@@ -4899,58 +5202,58 @@ function createItemsApiHandlers(client) {
|
|
|
4899
5202
|
}
|
|
4900
5203
|
|
|
4901
5204
|
// lib/attributes/mockHandlers.ts
|
|
4902
|
-
var
|
|
5205
|
+
var import_msw11 = require("msw");
|
|
4903
5206
|
|
|
4904
5207
|
// lib/attributes/index.ts
|
|
4905
|
-
var
|
|
5208
|
+
var BASE_URL11 = "attributes";
|
|
4906
5209
|
|
|
4907
5210
|
// lib/attributes/mockHandlers.ts
|
|
4908
|
-
var
|
|
5211
|
+
var import_zod_mock10 = require("@anatine/zod-mock");
|
|
4909
5212
|
function createAttributesApiHandlers(client) {
|
|
4910
5213
|
function getAllAttributes(resolver = (_req, res, ctx) => {
|
|
4911
|
-
const data = (0,
|
|
5214
|
+
const data = (0, import_zod_mock10.generateMock)(z.array(attributeMetaDataSchema));
|
|
4912
5215
|
return res(ctx.status(200), ctx.json(data));
|
|
4913
5216
|
}) {
|
|
4914
|
-
return
|
|
5217
|
+
return import_msw11.rest.get(`${client.getBaseUrl()}${BASE_URL11}`, resolver);
|
|
4915
5218
|
}
|
|
4916
|
-
getAllAttributes.generateData = () => (0,
|
|
5219
|
+
getAllAttributes.generateData = () => (0, import_zod_mock10.generateMock)(attributeMetaDataSchema);
|
|
4917
5220
|
function getAllAttributesByCompany(resolver = (_req, res, ctx) => {
|
|
4918
|
-
const data = (0,
|
|
5221
|
+
const data = (0, import_zod_mock10.generateMock)(attributesByCompanySchema);
|
|
4919
5222
|
return res(ctx.status(200), ctx.json(data));
|
|
4920
5223
|
}) {
|
|
4921
|
-
return
|
|
5224
|
+
return import_msw11.rest.get(`${client.getBaseUrl()}${BASE_URL11}/company`, resolver);
|
|
4922
5225
|
}
|
|
4923
|
-
getAllAttributesByCompany.generateData = () => (0,
|
|
5226
|
+
getAllAttributesByCompany.generateData = () => (0, import_zod_mock10.generateMock)(attributesByCompanySchema);
|
|
4924
5227
|
function getAttributesExtensiveInfo(resolver = (_req, res, ctx) => {
|
|
4925
|
-
const data = (0,
|
|
5228
|
+
const data = (0, import_zod_mock10.generateMock)(z.array(attributeDefinitionSchema));
|
|
4926
5229
|
return res(ctx.status(200), ctx.json(data));
|
|
4927
5230
|
}) {
|
|
4928
|
-
return
|
|
4929
|
-
`${client.getBaseUrl()}${
|
|
5231
|
+
return import_msw11.rest.get(
|
|
5232
|
+
`${client.getBaseUrl()}${BASE_URL11}/registry/editui`,
|
|
4930
5233
|
resolver
|
|
4931
5234
|
);
|
|
4932
5235
|
}
|
|
4933
|
-
getAttributesExtensiveInfo.generateData = () => (0,
|
|
5236
|
+
getAttributesExtensiveInfo.generateData = () => (0, import_zod_mock10.generateMock)(z.array(attributeDefinitionSchema));
|
|
4934
5237
|
function getAttributeValidValues(resolver = (_req, res, ctx) => {
|
|
4935
|
-
const data = (0,
|
|
5238
|
+
const data = (0, import_zod_mock10.generateMock)(z.array(attributeValidValuesSchema));
|
|
4936
5239
|
return res(ctx.status(200), ctx.json(data));
|
|
4937
5240
|
}) {
|
|
4938
|
-
return
|
|
4939
|
-
`${client.getBaseUrl()}${
|
|
5241
|
+
return import_msw11.rest.get(
|
|
5242
|
+
`${client.getBaseUrl()}${BASE_URL11}/registry/attribute/:attributeDbName/values`,
|
|
4940
5243
|
resolver
|
|
4941
5244
|
);
|
|
4942
5245
|
}
|
|
4943
|
-
getAttributeValidValues.generateData = () => (0,
|
|
5246
|
+
getAttributeValidValues.generateData = () => (0, import_zod_mock10.generateMock)(attributeValidValuesSchema);
|
|
4944
5247
|
function getCompanyInterestedAttributes(resolver = (_req, res, ctx) => {
|
|
4945
|
-
const data = (0,
|
|
5248
|
+
const data = (0, import_zod_mock10.generateMock)(z.array(z.string()));
|
|
4946
5249
|
return res(ctx.status(200), ctx.json(data));
|
|
4947
5250
|
}) {
|
|
4948
|
-
return
|
|
4949
|
-
`${client.getBaseUrl()}${
|
|
5251
|
+
return import_msw11.rest.get(
|
|
5252
|
+
`${client.getBaseUrl()}${BASE_URL11}/company/interested-attributes`,
|
|
4950
5253
|
resolver
|
|
4951
5254
|
);
|
|
4952
5255
|
}
|
|
4953
|
-
getCompanyInterestedAttributes.generateData = () => (0,
|
|
5256
|
+
getCompanyInterestedAttributes.generateData = () => (0, import_zod_mock10.generateMock)(z.array(z.string()));
|
|
4954
5257
|
return {
|
|
4955
5258
|
getAllAttributes,
|
|
4956
5259
|
getAllAttributesByCompany,
|
|
@@ -4961,41 +5264,41 @@ function createAttributesApiHandlers(client) {
|
|
|
4961
5264
|
}
|
|
4962
5265
|
|
|
4963
5266
|
// lib/spreadsheetTemplate/mockHandlers.ts
|
|
4964
|
-
var
|
|
5267
|
+
var import_msw12 = require("msw");
|
|
4965
5268
|
|
|
4966
5269
|
// lib/spreadsheetTemplate/index.ts
|
|
4967
|
-
var
|
|
5270
|
+
var BASE_URL12 = "templates";
|
|
4968
5271
|
|
|
4969
5272
|
// lib/spreadsheetTemplate/mockHandlers.ts
|
|
4970
|
-
var
|
|
5273
|
+
var import_zod_mock11 = require("@anatine/zod-mock");
|
|
4971
5274
|
function createSpreadsheetTemplateApiHandlers(client) {
|
|
4972
5275
|
function getTemplates(resolver = (_req, res, ctx) => {
|
|
4973
|
-
const data = (0,
|
|
5276
|
+
const data = (0, import_zod_mock11.generateMock)(z.array(spreadsheetTemplateSchema));
|
|
4974
5277
|
return res(ctx.status(200), ctx.json(data));
|
|
4975
5278
|
}) {
|
|
4976
|
-
return
|
|
5279
|
+
return import_msw12.rest.get(`${client.getBaseUrl()}${BASE_URL12}`, resolver);
|
|
4977
5280
|
}
|
|
4978
|
-
getTemplates.generateData = () => (0,
|
|
5281
|
+
getTemplates.generateData = () => (0, import_zod_mock11.generateMock)(z.array(spreadsheetTemplateSchema));
|
|
4979
5282
|
return {
|
|
4980
5283
|
getTemplates
|
|
4981
5284
|
};
|
|
4982
5285
|
}
|
|
4983
5286
|
|
|
4984
5287
|
// lib/companyFeatures/mockHandlers.ts
|
|
4985
|
-
var
|
|
4986
|
-
var
|
|
5288
|
+
var import_zod_mock12 = require("@anatine/zod-mock");
|
|
5289
|
+
var import_msw13 = require("msw");
|
|
4987
5290
|
|
|
4988
5291
|
// lib/companyFeatures/index.ts
|
|
4989
|
-
var
|
|
5292
|
+
var BASE_URL13 = "feature";
|
|
4990
5293
|
|
|
4991
5294
|
// lib/companyFeatures/mockHandlers.ts
|
|
4992
5295
|
function createCompanyFeaturesApiHandlers(client) {
|
|
4993
5296
|
function checkIfStageItemSetupIsEnabled(resolver = (_req, res, ctx) => {
|
|
4994
|
-
const data = (0,
|
|
5297
|
+
const data = (0, import_zod_mock12.generateMock)(z.boolean());
|
|
4995
5298
|
return res(ctx.status(200), ctx.json(data));
|
|
4996
5299
|
}) {
|
|
4997
|
-
return
|
|
4998
|
-
`${client.getBaseUrl()}${
|
|
5300
|
+
return import_msw13.rest.get(
|
|
5301
|
+
`${client.getBaseUrl()}${BASE_URL13}/isphaseditemsetupenabled`,
|
|
4999
5302
|
resolver
|
|
5000
5303
|
);
|
|
5001
5304
|
}
|
|
@@ -5005,29 +5308,29 @@ function createCompanyFeaturesApiHandlers(client) {
|
|
|
5005
5308
|
}
|
|
5006
5309
|
|
|
5007
5310
|
// lib/featureFlags/mockHandlers.ts
|
|
5008
|
-
var
|
|
5009
|
-
var
|
|
5311
|
+
var import_zod_mock13 = require("@anatine/zod-mock");
|
|
5312
|
+
var import_msw14 = require("msw");
|
|
5010
5313
|
|
|
5011
5314
|
// lib/featureFlags/index.ts
|
|
5012
|
-
var
|
|
5315
|
+
var BASE_URL14 = "feature-flag";
|
|
5013
5316
|
|
|
5014
5317
|
// lib/featureFlags/mockHandlers.ts
|
|
5015
5318
|
function createFeatureFlagsApiHandlers(client) {
|
|
5016
5319
|
function checkEnableItemsApiEndpointsForImports(resolver = (_req, res, ctx) => {
|
|
5017
|
-
const data = (0,
|
|
5320
|
+
const data = (0, import_zod_mock13.generateMock)(z.boolean());
|
|
5018
5321
|
return res(ctx.status(200), ctx.json(data));
|
|
5019
5322
|
}) {
|
|
5020
|
-
return
|
|
5021
|
-
`${client.getBaseUrl()}${
|
|
5323
|
+
return import_msw14.rest.get(
|
|
5324
|
+
`${client.getBaseUrl()}${BASE_URL14}/enable-items-api-endpoints-for-imports/`,
|
|
5022
5325
|
resolver
|
|
5023
5326
|
);
|
|
5024
5327
|
}
|
|
5025
5328
|
function checkEnableItemsLevelMSIS(resolver = (_req, res, ctx) => {
|
|
5026
|
-
const data = (0,
|
|
5329
|
+
const data = (0, import_zod_mock13.generateMock)(z.boolean());
|
|
5027
5330
|
return res(ctx.status(200), ctx.json(data));
|
|
5028
5331
|
}) {
|
|
5029
|
-
return
|
|
5030
|
-
`${client.getBaseUrl()}/${
|
|
5332
|
+
return import_msw14.rest.get(
|
|
5333
|
+
`${client.getBaseUrl()}/${BASE_URL14}/enable-item-level-msis/`,
|
|
5031
5334
|
resolver
|
|
5032
5335
|
);
|
|
5033
5336
|
}
|
|
@@ -5038,31 +5341,31 @@ function createFeatureFlagsApiHandlers(client) {
|
|
|
5038
5341
|
}
|
|
5039
5342
|
|
|
5040
5343
|
// lib/uniqueCriteria/mockHandlers.ts
|
|
5041
|
-
var
|
|
5042
|
-
var
|
|
5344
|
+
var import_zod_mock14 = require("@anatine/zod-mock");
|
|
5345
|
+
var import_msw15 = require("msw");
|
|
5043
5346
|
|
|
5044
5347
|
// lib/uniqueCriteria/index.ts
|
|
5045
|
-
var
|
|
5348
|
+
var BASE_URL15 = "uniquecriteria";
|
|
5046
5349
|
|
|
5047
5350
|
// lib/uniqueCriteria/mockHandlers.ts
|
|
5048
5351
|
function createUniqueCriteriaApiHandlers(client) {
|
|
5049
5352
|
function getUniqueCriteriaByOrg(resolver = (_req, res, ctx) => {
|
|
5050
|
-
const data = (0,
|
|
5353
|
+
const data = (0, import_zod_mock14.generateMock)(z.array(z.string()));
|
|
5051
5354
|
return res(ctx.status(200), ctx.json(data));
|
|
5052
5355
|
}) {
|
|
5053
|
-
return
|
|
5356
|
+
return import_msw15.rest.get(`${client.getBaseUrl()}/${BASE_URL15}/org`, resolver);
|
|
5054
5357
|
}
|
|
5055
|
-
getUniqueCriteriaByOrg.generateData = () => (0,
|
|
5358
|
+
getUniqueCriteriaByOrg.generateData = () => (0, import_zod_mock14.generateMock)(z.array(z.string()));
|
|
5056
5359
|
return {
|
|
5057
5360
|
getUniqueCriteriaByOrg
|
|
5058
5361
|
};
|
|
5059
5362
|
}
|
|
5060
5363
|
|
|
5061
5364
|
// lib/companies/index.ts
|
|
5062
|
-
var
|
|
5365
|
+
var BASE_URL16 = "companys";
|
|
5063
5366
|
function createCompaniesApi(client) {
|
|
5064
5367
|
async function getCompanyBriefInfoByOrg(params, signal) {
|
|
5065
|
-
const data = await client.get(`${
|
|
5368
|
+
const data = await client.get(`${BASE_URL16}/brief`, {
|
|
5066
5369
|
searchParams: params,
|
|
5067
5370
|
signal
|
|
5068
5371
|
}).json();
|
|
@@ -5085,6 +5388,7 @@ function createCompaniesApi(client) {
|
|
|
5085
5388
|
createProductTypesApiHandlers,
|
|
5086
5389
|
createSpreadsheetTemplateApiHandlers,
|
|
5087
5390
|
createTradingPartnerAccessApiHandlers,
|
|
5391
|
+
createTradingPartnerSettingsApiHandlers,
|
|
5088
5392
|
createUniqueCriteriaApiHandlers,
|
|
5089
5393
|
createWhoAmIApiHandlers
|
|
5090
5394
|
});
|