@spscommerce/asst-api 4.1.1 → 4.2.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.
Files changed (73) hide show
  1. package/package.json +4 -4
  2. package/dist/CompanyBriefByOrg-57oGCtjK.d.ts +0 -3427
  3. package/dist/CompanyBriefByOrg-LTdsUKm4.d.ts +0 -3427
  4. package/dist/CompanyBriefByOrg-itus4RMD.d.cts +0 -131
  5. package/dist/CompanyBriefByOrg-itus4RMD.d.ts +0 -131
  6. package/dist/chunk-27XV7TS2.js +0 -522
  7. package/dist/chunk-2VJS5KPH.js +0 -5182
  8. package/dist/chunk-2W3LZ4AO.js +0 -513
  9. package/dist/chunk-3XNXQYIB.js +0 -521
  10. package/dist/chunk-4C475UZX.js +0 -5164
  11. package/dist/chunk-5AROSGQB.js +0 -5034
  12. package/dist/chunk-7F5CQRS2.js +0 -567
  13. package/dist/chunk-7OEXJIWW.js +0 -565
  14. package/dist/chunk-A22SEYVL.js +0 -530
  15. package/dist/chunk-AH5MG2WF.js +0 -5040
  16. package/dist/chunk-BDSSH6MN.js +0 -574
  17. package/dist/chunk-BFIQVABZ.js +0 -528
  18. package/dist/chunk-BJTO4CRW.js +0 -558
  19. package/dist/chunk-BLMS4KUD.js +0 -5164
  20. package/dist/chunk-BTNVA4NZ.js +0 -568
  21. package/dist/chunk-CNQTNX3M.js +0 -567
  22. package/dist/chunk-CUVSWUIQ.js +0 -5040
  23. package/dist/chunk-DP2ZMQG5.js +0 -4881
  24. package/dist/chunk-EMBJNPTB.js +0 -5040
  25. package/dist/chunk-EO2UMCWY.js +0 -574
  26. package/dist/chunk-FTB465WY.js +0 -575
  27. package/dist/chunk-G6A4EVAL.js +0 -528
  28. package/dist/chunk-GDARBI5R.js +0 -5185
  29. package/dist/chunk-HY2SRD5L.js +0 -5003
  30. package/dist/chunk-ISQ3LQRI.js +0 -565
  31. package/dist/chunk-KKX3CXHP.js +0 -558
  32. package/dist/chunk-LJVJ4SYE.js +0 -568
  33. package/dist/chunk-LYMA4XGG.js +0 -5181
  34. package/dist/chunk-MLAU3LFL.js +0 -527
  35. package/dist/chunk-MQREZR54.js +0 -5164
  36. package/dist/chunk-N4A4BVKV.js +0 -5163
  37. package/dist/chunk-QVEV57JA.js +0 -5185
  38. package/dist/chunk-SI7CWAHC.js +0 -574
  39. package/dist/chunk-SK6U2JDX.js +0 -566
  40. package/dist/chunk-SQBB5K5J.js +0 -574
  41. package/dist/chunk-TQ2IQDSM.js +0 -568
  42. package/dist/chunk-TTT6PM27.js +0 -558
  43. package/dist/chunk-VFMKDLXO.js +0 -570
  44. package/dist/chunk-VKPQOGVS.js +0 -565
  45. package/dist/chunk-VLLI4AYA.js +0 -520
  46. package/dist/chunk-VNFLJ5FV.js +0 -530
  47. package/dist/chunk-WNCDQJEM.js +0 -5034
  48. package/dist/chunk-XYZVRJF3.js +0 -5162
  49. package/dist/chunk-YJCJB4OT.js +0 -79
  50. package/dist/chunk-YJMQ4PGM.js +0 -559
  51. package/dist/chunk-Z6PXGHNC.js +0 -570
  52. package/dist/chunk-ZQ32XEVW.js +0 -79
  53. package/dist/chunk-ZXXDLGW7.js +0 -513
  54. package/dist/index-B8ovDTs5.d.cts +0 -14
  55. package/dist/index-BFKgtuVI.d.ts +0 -14
  56. package/dist/index-Zz-6wNSh.d.ts +0 -106
  57. package/dist/index-fgr_c5Wj.d.ts +0 -106
  58. package/dist/zod-6gU8y6oS.d.cts +0 -6712
  59. package/dist/zod-B4sIVoVX.d.ts +0 -6712
  60. package/dist/zod-BI81QHVK.d.ts +0 -6715
  61. package/dist/zod-BUCQsGOm.d.ts +0 -6712
  62. package/dist/zod-BdDmL7rg.d.ts +0 -6718
  63. package/dist/zod-Bl_5j5Nx.d.ts +0 -6712
  64. package/dist/zod-Bxu34bbp.d.ts +0 -6718
  65. package/dist/zod-C4kEHhO8.d.cts +0 -6718
  66. package/dist/zod-C5pRCHei.d.ts +0 -6712
  67. package/dist/zod-CIacR1Kf.d.cts +0 -6712
  68. package/dist/zod-DBbdP-KT.d.cts +0 -6718
  69. package/dist/zod-DzhoVlw_.d.cts +0 -6712
  70. package/dist/zod-FdtLO2-F.d.cts +0 -6715
  71. package/dist/zod-NE2xXWlK.d.ts +0 -3416
  72. package/dist/zod-lSiFMzqK.d.cts +0 -6712
  73. package/dist/zod-zxqlYYMG.d.ts +0 -3416
@@ -1,5003 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/index.js
8
- var v3_exports = {};
9
- __export(v3_exports, {
10
- BRAND: () => BRAND,
11
- DIRTY: () => DIRTY,
12
- EMPTY_PATH: () => EMPTY_PATH,
13
- INVALID: () => INVALID,
14
- NEVER: () => NEVER,
15
- OK: () => OK,
16
- ParseStatus: () => ParseStatus,
17
- Schema: () => ZodType,
18
- ZodAny: () => ZodAny,
19
- ZodArray: () => ZodArray,
20
- ZodBigInt: () => ZodBigInt,
21
- ZodBoolean: () => ZodBoolean,
22
- ZodBranded: () => ZodBranded,
23
- ZodCatch: () => ZodCatch,
24
- ZodDate: () => ZodDate,
25
- ZodDefault: () => ZodDefault,
26
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
27
- ZodEffects: () => ZodEffects,
28
- ZodEnum: () => ZodEnum,
29
- ZodError: () => ZodError,
30
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
31
- ZodFunction: () => ZodFunction,
32
- ZodIntersection: () => ZodIntersection,
33
- ZodIssueCode: () => ZodIssueCode,
34
- ZodLazy: () => ZodLazy,
35
- ZodLiteral: () => ZodLiteral,
36
- ZodMap: () => ZodMap,
37
- ZodNaN: () => ZodNaN,
38
- ZodNativeEnum: () => ZodNativeEnum,
39
- ZodNever: () => ZodNever,
40
- ZodNull: () => ZodNull,
41
- ZodNullable: () => ZodNullable,
42
- ZodNumber: () => ZodNumber,
43
- ZodObject: () => ZodObject,
44
- ZodOptional: () => ZodOptional,
45
- ZodParsedType: () => ZodParsedType,
46
- ZodPipeline: () => ZodPipeline,
47
- ZodPromise: () => ZodPromise,
48
- ZodReadonly: () => ZodReadonly,
49
- ZodRecord: () => ZodRecord,
50
- ZodSchema: () => ZodType,
51
- ZodSet: () => ZodSet,
52
- ZodString: () => ZodString,
53
- ZodSymbol: () => ZodSymbol,
54
- ZodTransformer: () => ZodEffects,
55
- ZodTuple: () => ZodTuple,
56
- ZodType: () => ZodType,
57
- ZodUndefined: () => ZodUndefined,
58
- ZodUnion: () => ZodUnion,
59
- ZodUnknown: () => ZodUnknown,
60
- ZodVoid: () => ZodVoid,
61
- addIssueToContext: () => addIssueToContext,
62
- any: () => anyType,
63
- array: () => arrayType,
64
- bigint: () => bigIntType,
65
- boolean: () => booleanType,
66
- coerce: () => coerce,
67
- custom: () => custom,
68
- date: () => dateType,
69
- datetimeRegex: () => datetimeRegex,
70
- default: () => v3_default,
71
- defaultErrorMap: () => en_default,
72
- discriminatedUnion: () => discriminatedUnionType,
73
- effect: () => effectsType,
74
- enum: () => enumType,
75
- function: () => functionType,
76
- getErrorMap: () => getErrorMap,
77
- getParsedType: () => getParsedType,
78
- instanceof: () => instanceOfType,
79
- intersection: () => intersectionType,
80
- isAborted: () => isAborted,
81
- isAsync: () => isAsync,
82
- isDirty: () => isDirty,
83
- isValid: () => isValid,
84
- late: () => late,
85
- lazy: () => lazyType,
86
- literal: () => literalType,
87
- makeIssue: () => makeIssue,
88
- map: () => mapType,
89
- nan: () => nanType,
90
- nativeEnum: () => nativeEnumType,
91
- never: () => neverType,
92
- null: () => nullType,
93
- nullable: () => nullableType,
94
- number: () => numberType,
95
- object: () => objectType,
96
- objectUtil: () => objectUtil,
97
- oboolean: () => oboolean,
98
- onumber: () => onumber,
99
- optional: () => optionalType,
100
- ostring: () => ostring,
101
- pipeline: () => pipelineType,
102
- preprocess: () => preprocessType,
103
- promise: () => promiseType,
104
- quotelessJson: () => quotelessJson,
105
- record: () => recordType,
106
- set: () => setType,
107
- setErrorMap: () => setErrorMap,
108
- strictObject: () => strictObjectType,
109
- string: () => stringType,
110
- symbol: () => symbolType,
111
- transformer: () => effectsType,
112
- tuple: () => tupleType,
113
- undefined: () => undefinedType,
114
- union: () => unionType,
115
- unknown: () => unknownType,
116
- util: () => util,
117
- void: () => voidType,
118
- z: () => external_exports
119
- });
120
-
121
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/external.js
122
- var external_exports = {};
123
- __export(external_exports, {
124
- BRAND: () => BRAND,
125
- DIRTY: () => DIRTY,
126
- EMPTY_PATH: () => EMPTY_PATH,
127
- INVALID: () => INVALID,
128
- NEVER: () => NEVER,
129
- OK: () => OK,
130
- ParseStatus: () => ParseStatus,
131
- Schema: () => ZodType,
132
- ZodAny: () => ZodAny,
133
- ZodArray: () => ZodArray,
134
- ZodBigInt: () => ZodBigInt,
135
- ZodBoolean: () => ZodBoolean,
136
- ZodBranded: () => ZodBranded,
137
- ZodCatch: () => ZodCatch,
138
- ZodDate: () => ZodDate,
139
- ZodDefault: () => ZodDefault,
140
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
141
- ZodEffects: () => ZodEffects,
142
- ZodEnum: () => ZodEnum,
143
- ZodError: () => ZodError,
144
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
145
- ZodFunction: () => ZodFunction,
146
- ZodIntersection: () => ZodIntersection,
147
- ZodIssueCode: () => ZodIssueCode,
148
- ZodLazy: () => ZodLazy,
149
- ZodLiteral: () => ZodLiteral,
150
- ZodMap: () => ZodMap,
151
- ZodNaN: () => ZodNaN,
152
- ZodNativeEnum: () => ZodNativeEnum,
153
- ZodNever: () => ZodNever,
154
- ZodNull: () => ZodNull,
155
- ZodNullable: () => ZodNullable,
156
- ZodNumber: () => ZodNumber,
157
- ZodObject: () => ZodObject,
158
- ZodOptional: () => ZodOptional,
159
- ZodParsedType: () => ZodParsedType,
160
- ZodPipeline: () => ZodPipeline,
161
- ZodPromise: () => ZodPromise,
162
- ZodReadonly: () => ZodReadonly,
163
- ZodRecord: () => ZodRecord,
164
- ZodSchema: () => ZodType,
165
- ZodSet: () => ZodSet,
166
- ZodString: () => ZodString,
167
- ZodSymbol: () => ZodSymbol,
168
- ZodTransformer: () => ZodEffects,
169
- ZodTuple: () => ZodTuple,
170
- ZodType: () => ZodType,
171
- ZodUndefined: () => ZodUndefined,
172
- ZodUnion: () => ZodUnion,
173
- ZodUnknown: () => ZodUnknown,
174
- ZodVoid: () => ZodVoid,
175
- addIssueToContext: () => addIssueToContext,
176
- any: () => anyType,
177
- array: () => arrayType,
178
- bigint: () => bigIntType,
179
- boolean: () => booleanType,
180
- coerce: () => coerce,
181
- custom: () => custom,
182
- date: () => dateType,
183
- datetimeRegex: () => datetimeRegex,
184
- defaultErrorMap: () => en_default,
185
- discriminatedUnion: () => discriminatedUnionType,
186
- effect: () => effectsType,
187
- enum: () => enumType,
188
- function: () => functionType,
189
- getErrorMap: () => getErrorMap,
190
- getParsedType: () => getParsedType,
191
- instanceof: () => instanceOfType,
192
- intersection: () => intersectionType,
193
- isAborted: () => isAborted,
194
- isAsync: () => isAsync,
195
- isDirty: () => isDirty,
196
- isValid: () => isValid,
197
- late: () => late,
198
- lazy: () => lazyType,
199
- literal: () => literalType,
200
- makeIssue: () => makeIssue,
201
- map: () => mapType,
202
- nan: () => nanType,
203
- nativeEnum: () => nativeEnumType,
204
- never: () => neverType,
205
- null: () => nullType,
206
- nullable: () => nullableType,
207
- number: () => numberType,
208
- object: () => objectType,
209
- objectUtil: () => objectUtil,
210
- oboolean: () => oboolean,
211
- onumber: () => onumber,
212
- optional: () => optionalType,
213
- ostring: () => ostring,
214
- pipeline: () => pipelineType,
215
- preprocess: () => preprocessType,
216
- promise: () => promiseType,
217
- quotelessJson: () => quotelessJson,
218
- record: () => recordType,
219
- set: () => setType,
220
- setErrorMap: () => setErrorMap,
221
- strictObject: () => strictObjectType,
222
- string: () => stringType,
223
- symbol: () => symbolType,
224
- transformer: () => effectsType,
225
- tuple: () => tupleType,
226
- undefined: () => undefinedType,
227
- union: () => unionType,
228
- unknown: () => unknownType,
229
- util: () => util,
230
- void: () => voidType
231
- });
232
-
233
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/helpers/util.js
234
- var util;
235
- (function(util2) {
236
- util2.assertEqual = (_) => {
237
- };
238
- function assertIs(_arg) {
239
- }
240
- util2.assertIs = assertIs;
241
- function assertNever(_x) {
242
- throw new Error();
243
- }
244
- util2.assertNever = assertNever;
245
- util2.arrayToEnum = (items) => {
246
- const obj = {};
247
- for (const item of items) {
248
- obj[item] = item;
249
- }
250
- return obj;
251
- };
252
- util2.getValidEnumValues = (obj) => {
253
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
254
- const filtered = {};
255
- for (const k of validKeys) {
256
- filtered[k] = obj[k];
257
- }
258
- return util2.objectValues(filtered);
259
- };
260
- util2.objectValues = (obj) => {
261
- return util2.objectKeys(obj).map(function(e) {
262
- return obj[e];
263
- });
264
- };
265
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
266
- const keys = [];
267
- for (const key in object) {
268
- if (Object.prototype.hasOwnProperty.call(object, key)) {
269
- keys.push(key);
270
- }
271
- }
272
- return keys;
273
- };
274
- util2.find = (arr, checker) => {
275
- for (const item of arr) {
276
- if (checker(item))
277
- return item;
278
- }
279
- return void 0;
280
- };
281
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
282
- function joinValues(array, separator = " | ") {
283
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
284
- }
285
- util2.joinValues = joinValues;
286
- util2.jsonStringifyReplacer = (_, value) => {
287
- if (typeof value === "bigint") {
288
- return value.toString();
289
- }
290
- return value;
291
- };
292
- })(util || (util = {}));
293
- var objectUtil;
294
- (function(objectUtil2) {
295
- objectUtil2.mergeShapes = (first, second) => {
296
- return {
297
- ...first,
298
- ...second
299
- // second overwrites first
300
- };
301
- };
302
- })(objectUtil || (objectUtil = {}));
303
- var ZodParsedType = util.arrayToEnum([
304
- "string",
305
- "nan",
306
- "number",
307
- "integer",
308
- "float",
309
- "boolean",
310
- "date",
311
- "bigint",
312
- "symbol",
313
- "function",
314
- "undefined",
315
- "null",
316
- "array",
317
- "object",
318
- "unknown",
319
- "promise",
320
- "void",
321
- "never",
322
- "map",
323
- "set"
324
- ]);
325
- var getParsedType = (data) => {
326
- const t = typeof data;
327
- switch (t) {
328
- case "undefined":
329
- return ZodParsedType.undefined;
330
- case "string":
331
- return ZodParsedType.string;
332
- case "number":
333
- return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
334
- case "boolean":
335
- return ZodParsedType.boolean;
336
- case "function":
337
- return ZodParsedType.function;
338
- case "bigint":
339
- return ZodParsedType.bigint;
340
- case "symbol":
341
- return ZodParsedType.symbol;
342
- case "object":
343
- if (Array.isArray(data)) {
344
- return ZodParsedType.array;
345
- }
346
- if (data === null) {
347
- return ZodParsedType.null;
348
- }
349
- if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
350
- return ZodParsedType.promise;
351
- }
352
- if (typeof Map !== "undefined" && data instanceof Map) {
353
- return ZodParsedType.map;
354
- }
355
- if (typeof Set !== "undefined" && data instanceof Set) {
356
- return ZodParsedType.set;
357
- }
358
- if (typeof Date !== "undefined" && data instanceof Date) {
359
- return ZodParsedType.date;
360
- }
361
- return ZodParsedType.object;
362
- default:
363
- return ZodParsedType.unknown;
364
- }
365
- };
366
-
367
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/ZodError.js
368
- var ZodIssueCode = util.arrayToEnum([
369
- "invalid_type",
370
- "invalid_literal",
371
- "custom",
372
- "invalid_union",
373
- "invalid_union_discriminator",
374
- "invalid_enum_value",
375
- "unrecognized_keys",
376
- "invalid_arguments",
377
- "invalid_return_type",
378
- "invalid_date",
379
- "invalid_string",
380
- "too_small",
381
- "too_big",
382
- "invalid_intersection_types",
383
- "not_multiple_of",
384
- "not_finite"
385
- ]);
386
- var quotelessJson = (obj) => {
387
- const json = JSON.stringify(obj, null, 2);
388
- return json.replace(/"([^"]+)":/g, "$1:");
389
- };
390
- var ZodError = class _ZodError extends Error {
391
- get errors() {
392
- return this.issues;
393
- }
394
- constructor(issues) {
395
- super();
396
- this.issues = [];
397
- this.addIssue = (sub) => {
398
- this.issues = [...this.issues, sub];
399
- };
400
- this.addIssues = (subs = []) => {
401
- this.issues = [...this.issues, ...subs];
402
- };
403
- const actualProto = new.target.prototype;
404
- if (Object.setPrototypeOf) {
405
- Object.setPrototypeOf(this, actualProto);
406
- } else {
407
- this.__proto__ = actualProto;
408
- }
409
- this.name = "ZodError";
410
- this.issues = issues;
411
- }
412
- format(_mapper) {
413
- const mapper = _mapper || function(issue) {
414
- return issue.message;
415
- };
416
- const fieldErrors = { _errors: [] };
417
- const processError = (error) => {
418
- for (const issue of error.issues) {
419
- if (issue.code === "invalid_union") {
420
- issue.unionErrors.map(processError);
421
- } else if (issue.code === "invalid_return_type") {
422
- processError(issue.returnTypeError);
423
- } else if (issue.code === "invalid_arguments") {
424
- processError(issue.argumentsError);
425
- } else if (issue.path.length === 0) {
426
- fieldErrors._errors.push(mapper(issue));
427
- } else {
428
- let curr = fieldErrors;
429
- let i = 0;
430
- while (i < issue.path.length) {
431
- const el = issue.path[i];
432
- const terminal = i === issue.path.length - 1;
433
- if (!terminal) {
434
- curr[el] = curr[el] || { _errors: [] };
435
- } else {
436
- curr[el] = curr[el] || { _errors: [] };
437
- curr[el]._errors.push(mapper(issue));
438
- }
439
- curr = curr[el];
440
- i++;
441
- }
442
- }
443
- }
444
- };
445
- processError(this);
446
- return fieldErrors;
447
- }
448
- static assert(value) {
449
- if (!(value instanceof _ZodError)) {
450
- throw new Error(`Not a ZodError: ${value}`);
451
- }
452
- }
453
- toString() {
454
- return this.message;
455
- }
456
- get message() {
457
- return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
458
- }
459
- get isEmpty() {
460
- return this.issues.length === 0;
461
- }
462
- flatten(mapper = (issue) => issue.message) {
463
- const fieldErrors = {};
464
- const formErrors = [];
465
- for (const sub of this.issues) {
466
- if (sub.path.length > 0) {
467
- const firstEl = sub.path[0];
468
- fieldErrors[firstEl] = fieldErrors[firstEl] || [];
469
- fieldErrors[firstEl].push(mapper(sub));
470
- } else {
471
- formErrors.push(mapper(sub));
472
- }
473
- }
474
- return { formErrors, fieldErrors };
475
- }
476
- get formErrors() {
477
- return this.flatten();
478
- }
479
- };
480
- ZodError.create = (issues) => {
481
- const error = new ZodError(issues);
482
- return error;
483
- };
484
-
485
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/locales/en.js
486
- var errorMap = (issue, _ctx) => {
487
- let message;
488
- switch (issue.code) {
489
- case ZodIssueCode.invalid_type:
490
- if (issue.received === ZodParsedType.undefined) {
491
- message = "Required";
492
- } else {
493
- message = `Expected ${issue.expected}, received ${issue.received}`;
494
- }
495
- break;
496
- case ZodIssueCode.invalid_literal:
497
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
498
- break;
499
- case ZodIssueCode.unrecognized_keys:
500
- message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
501
- break;
502
- case ZodIssueCode.invalid_union:
503
- message = `Invalid input`;
504
- break;
505
- case ZodIssueCode.invalid_union_discriminator:
506
- message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
507
- break;
508
- case ZodIssueCode.invalid_enum_value:
509
- message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
510
- break;
511
- case ZodIssueCode.invalid_arguments:
512
- message = `Invalid function arguments`;
513
- break;
514
- case ZodIssueCode.invalid_return_type:
515
- message = `Invalid function return type`;
516
- break;
517
- case ZodIssueCode.invalid_date:
518
- message = `Invalid date`;
519
- break;
520
- case ZodIssueCode.invalid_string:
521
- if (typeof issue.validation === "object") {
522
- if ("includes" in issue.validation) {
523
- message = `Invalid input: must include "${issue.validation.includes}"`;
524
- if (typeof issue.validation.position === "number") {
525
- message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
526
- }
527
- } else if ("startsWith" in issue.validation) {
528
- message = `Invalid input: must start with "${issue.validation.startsWith}"`;
529
- } else if ("endsWith" in issue.validation) {
530
- message = `Invalid input: must end with "${issue.validation.endsWith}"`;
531
- } else {
532
- util.assertNever(issue.validation);
533
- }
534
- } else if (issue.validation !== "regex") {
535
- message = `Invalid ${issue.validation}`;
536
- } else {
537
- message = "Invalid";
538
- }
539
- break;
540
- case ZodIssueCode.too_small:
541
- if (issue.type === "array")
542
- message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
543
- else if (issue.type === "string")
544
- message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
545
- else if (issue.type === "number")
546
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
547
- else if (issue.type === "bigint")
548
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
549
- else if (issue.type === "date")
550
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
551
- else
552
- message = "Invalid input";
553
- break;
554
- case ZodIssueCode.too_big:
555
- if (issue.type === "array")
556
- message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
557
- else if (issue.type === "string")
558
- message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
559
- else if (issue.type === "number")
560
- message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
561
- else if (issue.type === "bigint")
562
- message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
563
- else if (issue.type === "date")
564
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
565
- else
566
- message = "Invalid input";
567
- break;
568
- case ZodIssueCode.custom:
569
- message = `Invalid input`;
570
- break;
571
- case ZodIssueCode.invalid_intersection_types:
572
- message = `Intersection results could not be merged`;
573
- break;
574
- case ZodIssueCode.not_multiple_of:
575
- message = `Number must be a multiple of ${issue.multipleOf}`;
576
- break;
577
- case ZodIssueCode.not_finite:
578
- message = "Number must be finite";
579
- break;
580
- default:
581
- message = _ctx.defaultError;
582
- util.assertNever(issue);
583
- }
584
- return { message };
585
- };
586
- var en_default = errorMap;
587
-
588
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/errors.js
589
- var overrideErrorMap = en_default;
590
- function setErrorMap(map) {
591
- overrideErrorMap = map;
592
- }
593
- function getErrorMap() {
594
- return overrideErrorMap;
595
- }
596
-
597
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/helpers/parseUtil.js
598
- var makeIssue = (params) => {
599
- const { data, path, errorMaps, issueData } = params;
600
- const fullPath = [...path, ...issueData.path || []];
601
- const fullIssue = {
602
- ...issueData,
603
- path: fullPath
604
- };
605
- if (issueData.message !== void 0) {
606
- return {
607
- ...issueData,
608
- path: fullPath,
609
- message: issueData.message
610
- };
611
- }
612
- let errorMessage = "";
613
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
614
- for (const map of maps) {
615
- errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
616
- }
617
- return {
618
- ...issueData,
619
- path: fullPath,
620
- message: errorMessage
621
- };
622
- };
623
- var EMPTY_PATH = [];
624
- function addIssueToContext(ctx, issueData) {
625
- const overrideMap = getErrorMap();
626
- const issue = makeIssue({
627
- issueData,
628
- data: ctx.data,
629
- path: ctx.path,
630
- errorMaps: [
631
- ctx.common.contextualErrorMap,
632
- // contextual error map is first priority
633
- ctx.schemaErrorMap,
634
- // then schema-bound map if available
635
- overrideMap,
636
- // then global override map
637
- overrideMap === en_default ? void 0 : en_default
638
- // then global default map
639
- ].filter((x) => !!x)
640
- });
641
- ctx.common.issues.push(issue);
642
- }
643
- var ParseStatus = class _ParseStatus {
644
- constructor() {
645
- this.value = "valid";
646
- }
647
- dirty() {
648
- if (this.value === "valid")
649
- this.value = "dirty";
650
- }
651
- abort() {
652
- if (this.value !== "aborted")
653
- this.value = "aborted";
654
- }
655
- static mergeArray(status, results) {
656
- const arrayValue = [];
657
- for (const s of results) {
658
- if (s.status === "aborted")
659
- return INVALID;
660
- if (s.status === "dirty")
661
- status.dirty();
662
- arrayValue.push(s.value);
663
- }
664
- return { status: status.value, value: arrayValue };
665
- }
666
- static async mergeObjectAsync(status, pairs) {
667
- const syncPairs = [];
668
- for (const pair of pairs) {
669
- const key = await pair.key;
670
- const value = await pair.value;
671
- syncPairs.push({
672
- key,
673
- value
674
- });
675
- }
676
- return _ParseStatus.mergeObjectSync(status, syncPairs);
677
- }
678
- static mergeObjectSync(status, pairs) {
679
- const finalObject = {};
680
- for (const pair of pairs) {
681
- const { key, value } = pair;
682
- if (key.status === "aborted")
683
- return INVALID;
684
- if (value.status === "aborted")
685
- return INVALID;
686
- if (key.status === "dirty")
687
- status.dirty();
688
- if (value.status === "dirty")
689
- status.dirty();
690
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
691
- finalObject[key.value] = value.value;
692
- }
693
- }
694
- return { status: status.value, value: finalObject };
695
- }
696
- };
697
- var INVALID = Object.freeze({
698
- status: "aborted"
699
- });
700
- var DIRTY = (value) => ({ status: "dirty", value });
701
- var OK = (value) => ({ status: "valid", value });
702
- var isAborted = (x) => x.status === "aborted";
703
- var isDirty = (x) => x.status === "dirty";
704
- var isValid = (x) => x.status === "valid";
705
- var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
706
-
707
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/helpers/errorUtil.js
708
- var errorUtil;
709
- (function(errorUtil2) {
710
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
711
- errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
712
- })(errorUtil || (errorUtil = {}));
713
-
714
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/types.js
715
- var ParseInputLazyPath = class {
716
- constructor(parent, value, path, key) {
717
- this._cachedPath = [];
718
- this.parent = parent;
719
- this.data = value;
720
- this._path = path;
721
- this._key = key;
722
- }
723
- get path() {
724
- if (!this._cachedPath.length) {
725
- if (Array.isArray(this._key)) {
726
- this._cachedPath.push(...this._path, ...this._key);
727
- } else {
728
- this._cachedPath.push(...this._path, this._key);
729
- }
730
- }
731
- return this._cachedPath;
732
- }
733
- };
734
- var handleResult = (ctx, result) => {
735
- if (isValid(result)) {
736
- return { success: true, data: result.value };
737
- } else {
738
- if (!ctx.common.issues.length) {
739
- throw new Error("Validation failed but no issues detected.");
740
- }
741
- return {
742
- success: false,
743
- get error() {
744
- if (this._error)
745
- return this._error;
746
- const error = new ZodError(ctx.common.issues);
747
- this._error = error;
748
- return this._error;
749
- }
750
- };
751
- }
752
- };
753
- function processCreateParams(params) {
754
- if (!params)
755
- return {};
756
- const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
757
- if (errorMap2 && (invalid_type_error || required_error)) {
758
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
759
- }
760
- if (errorMap2)
761
- return { errorMap: errorMap2, description };
762
- const customMap = (iss, ctx) => {
763
- const { message } = params;
764
- if (iss.code === "invalid_enum_value") {
765
- return { message: message ?? ctx.defaultError };
766
- }
767
- if (typeof ctx.data === "undefined") {
768
- return { message: message ?? required_error ?? ctx.defaultError };
769
- }
770
- if (iss.code !== "invalid_type")
771
- return { message: ctx.defaultError };
772
- return { message: message ?? invalid_type_error ?? ctx.defaultError };
773
- };
774
- return { errorMap: customMap, description };
775
- }
776
- var ZodType = class {
777
- get description() {
778
- return this._def.description;
779
- }
780
- _getType(input) {
781
- return getParsedType(input.data);
782
- }
783
- _getOrReturnCtx(input, ctx) {
784
- return ctx || {
785
- common: input.parent.common,
786
- data: input.data,
787
- parsedType: getParsedType(input.data),
788
- schemaErrorMap: this._def.errorMap,
789
- path: input.path,
790
- parent: input.parent
791
- };
792
- }
793
- _processInputParams(input) {
794
- return {
795
- status: new ParseStatus(),
796
- ctx: {
797
- common: input.parent.common,
798
- data: input.data,
799
- parsedType: getParsedType(input.data),
800
- schemaErrorMap: this._def.errorMap,
801
- path: input.path,
802
- parent: input.parent
803
- }
804
- };
805
- }
806
- _parseSync(input) {
807
- const result = this._parse(input);
808
- if (isAsync(result)) {
809
- throw new Error("Synchronous parse encountered promise.");
810
- }
811
- return result;
812
- }
813
- _parseAsync(input) {
814
- const result = this._parse(input);
815
- return Promise.resolve(result);
816
- }
817
- parse(data, params) {
818
- const result = this.safeParse(data, params);
819
- if (result.success)
820
- return result.data;
821
- throw result.error;
822
- }
823
- safeParse(data, params) {
824
- const ctx = {
825
- common: {
826
- issues: [],
827
- async: params?.async ?? false,
828
- contextualErrorMap: params?.errorMap
829
- },
830
- path: params?.path || [],
831
- schemaErrorMap: this._def.errorMap,
832
- parent: null,
833
- data,
834
- parsedType: getParsedType(data)
835
- };
836
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
837
- return handleResult(ctx, result);
838
- }
839
- "~validate"(data) {
840
- const ctx = {
841
- common: {
842
- issues: [],
843
- async: !!this["~standard"].async
844
- },
845
- path: [],
846
- schemaErrorMap: this._def.errorMap,
847
- parent: null,
848
- data,
849
- parsedType: getParsedType(data)
850
- };
851
- if (!this["~standard"].async) {
852
- try {
853
- const result = this._parseSync({ data, path: [], parent: ctx });
854
- return isValid(result) ? {
855
- value: result.value
856
- } : {
857
- issues: ctx.common.issues
858
- };
859
- } catch (err) {
860
- if (err?.message?.toLowerCase()?.includes("encountered")) {
861
- this["~standard"].async = true;
862
- }
863
- ctx.common = {
864
- issues: [],
865
- async: true
866
- };
867
- }
868
- }
869
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
870
- value: result.value
871
- } : {
872
- issues: ctx.common.issues
873
- });
874
- }
875
- async parseAsync(data, params) {
876
- const result = await this.safeParseAsync(data, params);
877
- if (result.success)
878
- return result.data;
879
- throw result.error;
880
- }
881
- async safeParseAsync(data, params) {
882
- const ctx = {
883
- common: {
884
- issues: [],
885
- contextualErrorMap: params?.errorMap,
886
- async: true
887
- },
888
- path: params?.path || [],
889
- schemaErrorMap: this._def.errorMap,
890
- parent: null,
891
- data,
892
- parsedType: getParsedType(data)
893
- };
894
- const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
895
- const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
896
- return handleResult(ctx, result);
897
- }
898
- refine(check, message) {
899
- const getIssueProperties = (val) => {
900
- if (typeof message === "string" || typeof message === "undefined") {
901
- return { message };
902
- } else if (typeof message === "function") {
903
- return message(val);
904
- } else {
905
- return message;
906
- }
907
- };
908
- return this._refinement((val, ctx) => {
909
- const result = check(val);
910
- const setError = () => ctx.addIssue({
911
- code: ZodIssueCode.custom,
912
- ...getIssueProperties(val)
913
- });
914
- if (typeof Promise !== "undefined" && result instanceof Promise) {
915
- return result.then((data) => {
916
- if (!data) {
917
- setError();
918
- return false;
919
- } else {
920
- return true;
921
- }
922
- });
923
- }
924
- if (!result) {
925
- setError();
926
- return false;
927
- } else {
928
- return true;
929
- }
930
- });
931
- }
932
- refinement(check, refinementData) {
933
- return this._refinement((val, ctx) => {
934
- if (!check(val)) {
935
- ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
936
- return false;
937
- } else {
938
- return true;
939
- }
940
- });
941
- }
942
- _refinement(refinement) {
943
- return new ZodEffects({
944
- schema: this,
945
- typeName: ZodFirstPartyTypeKind.ZodEffects,
946
- effect: { type: "refinement", refinement }
947
- });
948
- }
949
- superRefine(refinement) {
950
- return this._refinement(refinement);
951
- }
952
- constructor(def) {
953
- this.spa = this.safeParseAsync;
954
- this._def = def;
955
- this.parse = this.parse.bind(this);
956
- this.safeParse = this.safeParse.bind(this);
957
- this.parseAsync = this.parseAsync.bind(this);
958
- this.safeParseAsync = this.safeParseAsync.bind(this);
959
- this.spa = this.spa.bind(this);
960
- this.refine = this.refine.bind(this);
961
- this.refinement = this.refinement.bind(this);
962
- this.superRefine = this.superRefine.bind(this);
963
- this.optional = this.optional.bind(this);
964
- this.nullable = this.nullable.bind(this);
965
- this.nullish = this.nullish.bind(this);
966
- this.array = this.array.bind(this);
967
- this.promise = this.promise.bind(this);
968
- this.or = this.or.bind(this);
969
- this.and = this.and.bind(this);
970
- this.transform = this.transform.bind(this);
971
- this.brand = this.brand.bind(this);
972
- this.default = this.default.bind(this);
973
- this.catch = this.catch.bind(this);
974
- this.describe = this.describe.bind(this);
975
- this.pipe = this.pipe.bind(this);
976
- this.readonly = this.readonly.bind(this);
977
- this.isNullable = this.isNullable.bind(this);
978
- this.isOptional = this.isOptional.bind(this);
979
- this["~standard"] = {
980
- version: 1,
981
- vendor: "zod",
982
- validate: (data) => this["~validate"](data)
983
- };
984
- }
985
- optional() {
986
- return ZodOptional.create(this, this._def);
987
- }
988
- nullable() {
989
- return ZodNullable.create(this, this._def);
990
- }
991
- nullish() {
992
- return this.nullable().optional();
993
- }
994
- array() {
995
- return ZodArray.create(this);
996
- }
997
- promise() {
998
- return ZodPromise.create(this, this._def);
999
- }
1000
- or(option) {
1001
- return ZodUnion.create([this, option], this._def);
1002
- }
1003
- and(incoming) {
1004
- return ZodIntersection.create(this, incoming, this._def);
1005
- }
1006
- transform(transform) {
1007
- return new ZodEffects({
1008
- ...processCreateParams(this._def),
1009
- schema: this,
1010
- typeName: ZodFirstPartyTypeKind.ZodEffects,
1011
- effect: { type: "transform", transform }
1012
- });
1013
- }
1014
- default(def) {
1015
- const defaultValueFunc = typeof def === "function" ? def : () => def;
1016
- return new ZodDefault({
1017
- ...processCreateParams(this._def),
1018
- innerType: this,
1019
- defaultValue: defaultValueFunc,
1020
- typeName: ZodFirstPartyTypeKind.ZodDefault
1021
- });
1022
- }
1023
- brand() {
1024
- return new ZodBranded({
1025
- typeName: ZodFirstPartyTypeKind.ZodBranded,
1026
- type: this,
1027
- ...processCreateParams(this._def)
1028
- });
1029
- }
1030
- catch(def) {
1031
- const catchValueFunc = typeof def === "function" ? def : () => def;
1032
- return new ZodCatch({
1033
- ...processCreateParams(this._def),
1034
- innerType: this,
1035
- catchValue: catchValueFunc,
1036
- typeName: ZodFirstPartyTypeKind.ZodCatch
1037
- });
1038
- }
1039
- describe(description) {
1040
- const This = this.constructor;
1041
- return new This({
1042
- ...this._def,
1043
- description
1044
- });
1045
- }
1046
- pipe(target) {
1047
- return ZodPipeline.create(this, target);
1048
- }
1049
- readonly() {
1050
- return ZodReadonly.create(this);
1051
- }
1052
- isOptional() {
1053
- return this.safeParse(void 0).success;
1054
- }
1055
- isNullable() {
1056
- return this.safeParse(null).success;
1057
- }
1058
- };
1059
- var cuidRegex = /^c[^\s-]{8,}$/i;
1060
- var cuid2Regex = /^[0-9a-z]+$/;
1061
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1062
- 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;
1063
- var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1064
- var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1065
- 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)?)??$/;
1066
- var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1067
- var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1068
- var emojiRegex;
1069
- 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])$/;
1070
- var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
1071
- var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
1072
- var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1073
- var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1074
- var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1075
- 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])))`;
1076
- var dateRegex = new RegExp(`^${dateRegexSource}$`);
1077
- function timeRegexSource(args) {
1078
- let secondsRegexSource = `[0-5]\\d`;
1079
- if (args.precision) {
1080
- secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1081
- } else if (args.precision == null) {
1082
- secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1083
- }
1084
- const secondsQuantifier = args.precision ? "+" : "?";
1085
- return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1086
- }
1087
- function timeRegex(args) {
1088
- return new RegExp(`^${timeRegexSource(args)}$`);
1089
- }
1090
- function datetimeRegex(args) {
1091
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
1092
- const opts = [];
1093
- opts.push(args.local ? `Z?` : `Z`);
1094
- if (args.offset)
1095
- opts.push(`([+-]\\d{2}:?\\d{2})`);
1096
- regex = `${regex}(${opts.join("|")})`;
1097
- return new RegExp(`^${regex}$`);
1098
- }
1099
- function isValidIP(ip, version) {
1100
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1101
- return true;
1102
- }
1103
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
1104
- return true;
1105
- }
1106
- return false;
1107
- }
1108
- function isValidJWT(jwt, alg) {
1109
- if (!jwtRegex.test(jwt))
1110
- return false;
1111
- try {
1112
- const [header] = jwt.split(".");
1113
- if (!header)
1114
- return false;
1115
- const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1116
- const decoded = JSON.parse(atob(base64));
1117
- if (typeof decoded !== "object" || decoded === null)
1118
- return false;
1119
- if ("typ" in decoded && decoded?.typ !== "JWT")
1120
- return false;
1121
- if (!decoded.alg)
1122
- return false;
1123
- if (alg && decoded.alg !== alg)
1124
- return false;
1125
- return true;
1126
- } catch {
1127
- return false;
1128
- }
1129
- }
1130
- function isValidCidr(ip, version) {
1131
- if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1132
- return true;
1133
- }
1134
- if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1135
- return true;
1136
- }
1137
- return false;
1138
- }
1139
- var ZodString = class _ZodString extends ZodType {
1140
- _parse(input) {
1141
- if (this._def.coerce) {
1142
- input.data = String(input.data);
1143
- }
1144
- const parsedType = this._getType(input);
1145
- if (parsedType !== ZodParsedType.string) {
1146
- const ctx2 = this._getOrReturnCtx(input);
1147
- addIssueToContext(ctx2, {
1148
- code: ZodIssueCode.invalid_type,
1149
- expected: ZodParsedType.string,
1150
- received: ctx2.parsedType
1151
- });
1152
- return INVALID;
1153
- }
1154
- const status = new ParseStatus();
1155
- let ctx = void 0;
1156
- for (const check of this._def.checks) {
1157
- if (check.kind === "min") {
1158
- if (input.data.length < check.value) {
1159
- ctx = this._getOrReturnCtx(input, ctx);
1160
- addIssueToContext(ctx, {
1161
- code: ZodIssueCode.too_small,
1162
- minimum: check.value,
1163
- type: "string",
1164
- inclusive: true,
1165
- exact: false,
1166
- message: check.message
1167
- });
1168
- status.dirty();
1169
- }
1170
- } else if (check.kind === "max") {
1171
- if (input.data.length > check.value) {
1172
- ctx = this._getOrReturnCtx(input, ctx);
1173
- addIssueToContext(ctx, {
1174
- code: ZodIssueCode.too_big,
1175
- maximum: check.value,
1176
- type: "string",
1177
- inclusive: true,
1178
- exact: false,
1179
- message: check.message
1180
- });
1181
- status.dirty();
1182
- }
1183
- } else if (check.kind === "length") {
1184
- const tooBig = input.data.length > check.value;
1185
- const tooSmall = input.data.length < check.value;
1186
- if (tooBig || tooSmall) {
1187
- ctx = this._getOrReturnCtx(input, ctx);
1188
- if (tooBig) {
1189
- addIssueToContext(ctx, {
1190
- code: ZodIssueCode.too_big,
1191
- maximum: check.value,
1192
- type: "string",
1193
- inclusive: true,
1194
- exact: true,
1195
- message: check.message
1196
- });
1197
- } else if (tooSmall) {
1198
- addIssueToContext(ctx, {
1199
- code: ZodIssueCode.too_small,
1200
- minimum: check.value,
1201
- type: "string",
1202
- inclusive: true,
1203
- exact: true,
1204
- message: check.message
1205
- });
1206
- }
1207
- status.dirty();
1208
- }
1209
- } else if (check.kind === "email") {
1210
- if (!emailRegex.test(input.data)) {
1211
- ctx = this._getOrReturnCtx(input, ctx);
1212
- addIssueToContext(ctx, {
1213
- validation: "email",
1214
- code: ZodIssueCode.invalid_string,
1215
- message: check.message
1216
- });
1217
- status.dirty();
1218
- }
1219
- } else if (check.kind === "emoji") {
1220
- if (!emojiRegex) {
1221
- emojiRegex = new RegExp(_emojiRegex, "u");
1222
- }
1223
- if (!emojiRegex.test(input.data)) {
1224
- ctx = this._getOrReturnCtx(input, ctx);
1225
- addIssueToContext(ctx, {
1226
- validation: "emoji",
1227
- code: ZodIssueCode.invalid_string,
1228
- message: check.message
1229
- });
1230
- status.dirty();
1231
- }
1232
- } else if (check.kind === "uuid") {
1233
- if (!uuidRegex.test(input.data)) {
1234
- ctx = this._getOrReturnCtx(input, ctx);
1235
- addIssueToContext(ctx, {
1236
- validation: "uuid",
1237
- code: ZodIssueCode.invalid_string,
1238
- message: check.message
1239
- });
1240
- status.dirty();
1241
- }
1242
- } else if (check.kind === "nanoid") {
1243
- if (!nanoidRegex.test(input.data)) {
1244
- ctx = this._getOrReturnCtx(input, ctx);
1245
- addIssueToContext(ctx, {
1246
- validation: "nanoid",
1247
- code: ZodIssueCode.invalid_string,
1248
- message: check.message
1249
- });
1250
- status.dirty();
1251
- }
1252
- } else if (check.kind === "cuid") {
1253
- if (!cuidRegex.test(input.data)) {
1254
- ctx = this._getOrReturnCtx(input, ctx);
1255
- addIssueToContext(ctx, {
1256
- validation: "cuid",
1257
- code: ZodIssueCode.invalid_string,
1258
- message: check.message
1259
- });
1260
- status.dirty();
1261
- }
1262
- } else if (check.kind === "cuid2") {
1263
- if (!cuid2Regex.test(input.data)) {
1264
- ctx = this._getOrReturnCtx(input, ctx);
1265
- addIssueToContext(ctx, {
1266
- validation: "cuid2",
1267
- code: ZodIssueCode.invalid_string,
1268
- message: check.message
1269
- });
1270
- status.dirty();
1271
- }
1272
- } else if (check.kind === "ulid") {
1273
- if (!ulidRegex.test(input.data)) {
1274
- ctx = this._getOrReturnCtx(input, ctx);
1275
- addIssueToContext(ctx, {
1276
- validation: "ulid",
1277
- code: ZodIssueCode.invalid_string,
1278
- message: check.message
1279
- });
1280
- status.dirty();
1281
- }
1282
- } else if (check.kind === "url") {
1283
- try {
1284
- new URL(input.data);
1285
- } catch {
1286
- ctx = this._getOrReturnCtx(input, ctx);
1287
- addIssueToContext(ctx, {
1288
- validation: "url",
1289
- code: ZodIssueCode.invalid_string,
1290
- message: check.message
1291
- });
1292
- status.dirty();
1293
- }
1294
- } else if (check.kind === "regex") {
1295
- check.regex.lastIndex = 0;
1296
- const testResult = check.regex.test(input.data);
1297
- if (!testResult) {
1298
- ctx = this._getOrReturnCtx(input, ctx);
1299
- addIssueToContext(ctx, {
1300
- validation: "regex",
1301
- code: ZodIssueCode.invalid_string,
1302
- message: check.message
1303
- });
1304
- status.dirty();
1305
- }
1306
- } else if (check.kind === "trim") {
1307
- input.data = input.data.trim();
1308
- } else if (check.kind === "includes") {
1309
- if (!input.data.includes(check.value, check.position)) {
1310
- ctx = this._getOrReturnCtx(input, ctx);
1311
- addIssueToContext(ctx, {
1312
- code: ZodIssueCode.invalid_string,
1313
- validation: { includes: check.value, position: check.position },
1314
- message: check.message
1315
- });
1316
- status.dirty();
1317
- }
1318
- } else if (check.kind === "toLowerCase") {
1319
- input.data = input.data.toLowerCase();
1320
- } else if (check.kind === "toUpperCase") {
1321
- input.data = input.data.toUpperCase();
1322
- } else if (check.kind === "startsWith") {
1323
- if (!input.data.startsWith(check.value)) {
1324
- ctx = this._getOrReturnCtx(input, ctx);
1325
- addIssueToContext(ctx, {
1326
- code: ZodIssueCode.invalid_string,
1327
- validation: { startsWith: check.value },
1328
- message: check.message
1329
- });
1330
- status.dirty();
1331
- }
1332
- } else if (check.kind === "endsWith") {
1333
- if (!input.data.endsWith(check.value)) {
1334
- ctx = this._getOrReturnCtx(input, ctx);
1335
- addIssueToContext(ctx, {
1336
- code: ZodIssueCode.invalid_string,
1337
- validation: { endsWith: check.value },
1338
- message: check.message
1339
- });
1340
- status.dirty();
1341
- }
1342
- } else if (check.kind === "datetime") {
1343
- const regex = datetimeRegex(check);
1344
- if (!regex.test(input.data)) {
1345
- ctx = this._getOrReturnCtx(input, ctx);
1346
- addIssueToContext(ctx, {
1347
- code: ZodIssueCode.invalid_string,
1348
- validation: "datetime",
1349
- message: check.message
1350
- });
1351
- status.dirty();
1352
- }
1353
- } else if (check.kind === "date") {
1354
- const regex = dateRegex;
1355
- if (!regex.test(input.data)) {
1356
- ctx = this._getOrReturnCtx(input, ctx);
1357
- addIssueToContext(ctx, {
1358
- code: ZodIssueCode.invalid_string,
1359
- validation: "date",
1360
- message: check.message
1361
- });
1362
- status.dirty();
1363
- }
1364
- } else if (check.kind === "time") {
1365
- const regex = timeRegex(check);
1366
- if (!regex.test(input.data)) {
1367
- ctx = this._getOrReturnCtx(input, ctx);
1368
- addIssueToContext(ctx, {
1369
- code: ZodIssueCode.invalid_string,
1370
- validation: "time",
1371
- message: check.message
1372
- });
1373
- status.dirty();
1374
- }
1375
- } else if (check.kind === "duration") {
1376
- if (!durationRegex.test(input.data)) {
1377
- ctx = this._getOrReturnCtx(input, ctx);
1378
- addIssueToContext(ctx, {
1379
- validation: "duration",
1380
- code: ZodIssueCode.invalid_string,
1381
- message: check.message
1382
- });
1383
- status.dirty();
1384
- }
1385
- } else if (check.kind === "ip") {
1386
- if (!isValidIP(input.data, check.version)) {
1387
- ctx = this._getOrReturnCtx(input, ctx);
1388
- addIssueToContext(ctx, {
1389
- validation: "ip",
1390
- code: ZodIssueCode.invalid_string,
1391
- message: check.message
1392
- });
1393
- status.dirty();
1394
- }
1395
- } else if (check.kind === "jwt") {
1396
- if (!isValidJWT(input.data, check.alg)) {
1397
- ctx = this._getOrReturnCtx(input, ctx);
1398
- addIssueToContext(ctx, {
1399
- validation: "jwt",
1400
- code: ZodIssueCode.invalid_string,
1401
- message: check.message
1402
- });
1403
- status.dirty();
1404
- }
1405
- } else if (check.kind === "cidr") {
1406
- if (!isValidCidr(input.data, check.version)) {
1407
- ctx = this._getOrReturnCtx(input, ctx);
1408
- addIssueToContext(ctx, {
1409
- validation: "cidr",
1410
- code: ZodIssueCode.invalid_string,
1411
- message: check.message
1412
- });
1413
- status.dirty();
1414
- }
1415
- } else if (check.kind === "base64") {
1416
- if (!base64Regex.test(input.data)) {
1417
- ctx = this._getOrReturnCtx(input, ctx);
1418
- addIssueToContext(ctx, {
1419
- validation: "base64",
1420
- code: ZodIssueCode.invalid_string,
1421
- message: check.message
1422
- });
1423
- status.dirty();
1424
- }
1425
- } else if (check.kind === "base64url") {
1426
- if (!base64urlRegex.test(input.data)) {
1427
- ctx = this._getOrReturnCtx(input, ctx);
1428
- addIssueToContext(ctx, {
1429
- validation: "base64url",
1430
- code: ZodIssueCode.invalid_string,
1431
- message: check.message
1432
- });
1433
- status.dirty();
1434
- }
1435
- } else {
1436
- util.assertNever(check);
1437
- }
1438
- }
1439
- return { status: status.value, value: input.data };
1440
- }
1441
- _regex(regex, validation, message) {
1442
- return this.refinement((data) => regex.test(data), {
1443
- validation,
1444
- code: ZodIssueCode.invalid_string,
1445
- ...errorUtil.errToObj(message)
1446
- });
1447
- }
1448
- _addCheck(check) {
1449
- return new _ZodString({
1450
- ...this._def,
1451
- checks: [...this._def.checks, check]
1452
- });
1453
- }
1454
- email(message) {
1455
- return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1456
- }
1457
- url(message) {
1458
- return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1459
- }
1460
- emoji(message) {
1461
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1462
- }
1463
- uuid(message) {
1464
- return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1465
- }
1466
- nanoid(message) {
1467
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1468
- }
1469
- cuid(message) {
1470
- return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1471
- }
1472
- cuid2(message) {
1473
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1474
- }
1475
- ulid(message) {
1476
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1477
- }
1478
- base64(message) {
1479
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1480
- }
1481
- base64url(message) {
1482
- return this._addCheck({
1483
- kind: "base64url",
1484
- ...errorUtil.errToObj(message)
1485
- });
1486
- }
1487
- jwt(options) {
1488
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
1489
- }
1490
- ip(options) {
1491
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1492
- }
1493
- cidr(options) {
1494
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
1495
- }
1496
- datetime(options) {
1497
- if (typeof options === "string") {
1498
- return this._addCheck({
1499
- kind: "datetime",
1500
- precision: null,
1501
- offset: false,
1502
- local: false,
1503
- message: options
1504
- });
1505
- }
1506
- return this._addCheck({
1507
- kind: "datetime",
1508
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
1509
- offset: options?.offset ?? false,
1510
- local: options?.local ?? false,
1511
- ...errorUtil.errToObj(options?.message)
1512
- });
1513
- }
1514
- date(message) {
1515
- return this._addCheck({ kind: "date", message });
1516
- }
1517
- time(options) {
1518
- if (typeof options === "string") {
1519
- return this._addCheck({
1520
- kind: "time",
1521
- precision: null,
1522
- message: options
1523
- });
1524
- }
1525
- return this._addCheck({
1526
- kind: "time",
1527
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
1528
- ...errorUtil.errToObj(options?.message)
1529
- });
1530
- }
1531
- duration(message) {
1532
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1533
- }
1534
- regex(regex, message) {
1535
- return this._addCheck({
1536
- kind: "regex",
1537
- regex,
1538
- ...errorUtil.errToObj(message)
1539
- });
1540
- }
1541
- includes(value, options) {
1542
- return this._addCheck({
1543
- kind: "includes",
1544
- value,
1545
- position: options?.position,
1546
- ...errorUtil.errToObj(options?.message)
1547
- });
1548
- }
1549
- startsWith(value, message) {
1550
- return this._addCheck({
1551
- kind: "startsWith",
1552
- value,
1553
- ...errorUtil.errToObj(message)
1554
- });
1555
- }
1556
- endsWith(value, message) {
1557
- return this._addCheck({
1558
- kind: "endsWith",
1559
- value,
1560
- ...errorUtil.errToObj(message)
1561
- });
1562
- }
1563
- min(minLength, message) {
1564
- return this._addCheck({
1565
- kind: "min",
1566
- value: minLength,
1567
- ...errorUtil.errToObj(message)
1568
- });
1569
- }
1570
- max(maxLength, message) {
1571
- return this._addCheck({
1572
- kind: "max",
1573
- value: maxLength,
1574
- ...errorUtil.errToObj(message)
1575
- });
1576
- }
1577
- length(len, message) {
1578
- return this._addCheck({
1579
- kind: "length",
1580
- value: len,
1581
- ...errorUtil.errToObj(message)
1582
- });
1583
- }
1584
- /**
1585
- * Equivalent to `.min(1)`
1586
- */
1587
- nonempty(message) {
1588
- return this.min(1, errorUtil.errToObj(message));
1589
- }
1590
- trim() {
1591
- return new _ZodString({
1592
- ...this._def,
1593
- checks: [...this._def.checks, { kind: "trim" }]
1594
- });
1595
- }
1596
- toLowerCase() {
1597
- return new _ZodString({
1598
- ...this._def,
1599
- checks: [...this._def.checks, { kind: "toLowerCase" }]
1600
- });
1601
- }
1602
- toUpperCase() {
1603
- return new _ZodString({
1604
- ...this._def,
1605
- checks: [...this._def.checks, { kind: "toUpperCase" }]
1606
- });
1607
- }
1608
- get isDatetime() {
1609
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
1610
- }
1611
- get isDate() {
1612
- return !!this._def.checks.find((ch) => ch.kind === "date");
1613
- }
1614
- get isTime() {
1615
- return !!this._def.checks.find((ch) => ch.kind === "time");
1616
- }
1617
- get isDuration() {
1618
- return !!this._def.checks.find((ch) => ch.kind === "duration");
1619
- }
1620
- get isEmail() {
1621
- return !!this._def.checks.find((ch) => ch.kind === "email");
1622
- }
1623
- get isURL() {
1624
- return !!this._def.checks.find((ch) => ch.kind === "url");
1625
- }
1626
- get isEmoji() {
1627
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
1628
- }
1629
- get isUUID() {
1630
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
1631
- }
1632
- get isNANOID() {
1633
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1634
- }
1635
- get isCUID() {
1636
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
1637
- }
1638
- get isCUID2() {
1639
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1640
- }
1641
- get isULID() {
1642
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
1643
- }
1644
- get isIP() {
1645
- return !!this._def.checks.find((ch) => ch.kind === "ip");
1646
- }
1647
- get isCIDR() {
1648
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
1649
- }
1650
- get isBase64() {
1651
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1652
- }
1653
- get isBase64url() {
1654
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
1655
- }
1656
- get minLength() {
1657
- let min = null;
1658
- for (const ch of this._def.checks) {
1659
- if (ch.kind === "min") {
1660
- if (min === null || ch.value > min)
1661
- min = ch.value;
1662
- }
1663
- }
1664
- return min;
1665
- }
1666
- get maxLength() {
1667
- let max = null;
1668
- for (const ch of this._def.checks) {
1669
- if (ch.kind === "max") {
1670
- if (max === null || ch.value < max)
1671
- max = ch.value;
1672
- }
1673
- }
1674
- return max;
1675
- }
1676
- };
1677
- ZodString.create = (params) => {
1678
- return new ZodString({
1679
- checks: [],
1680
- typeName: ZodFirstPartyTypeKind.ZodString,
1681
- coerce: params?.coerce ?? false,
1682
- ...processCreateParams(params)
1683
- });
1684
- };
1685
- function floatSafeRemainder(val, step) {
1686
- const valDecCount = (val.toString().split(".")[1] || "").length;
1687
- const stepDecCount = (step.toString().split(".")[1] || "").length;
1688
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1689
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1690
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1691
- return valInt % stepInt / 10 ** decCount;
1692
- }
1693
- var ZodNumber = class _ZodNumber extends ZodType {
1694
- constructor() {
1695
- super(...arguments);
1696
- this.min = this.gte;
1697
- this.max = this.lte;
1698
- this.step = this.multipleOf;
1699
- }
1700
- _parse(input) {
1701
- if (this._def.coerce) {
1702
- input.data = Number(input.data);
1703
- }
1704
- const parsedType = this._getType(input);
1705
- if (parsedType !== ZodParsedType.number) {
1706
- const ctx2 = this._getOrReturnCtx(input);
1707
- addIssueToContext(ctx2, {
1708
- code: ZodIssueCode.invalid_type,
1709
- expected: ZodParsedType.number,
1710
- received: ctx2.parsedType
1711
- });
1712
- return INVALID;
1713
- }
1714
- let ctx = void 0;
1715
- const status = new ParseStatus();
1716
- for (const check of this._def.checks) {
1717
- if (check.kind === "int") {
1718
- if (!util.isInteger(input.data)) {
1719
- ctx = this._getOrReturnCtx(input, ctx);
1720
- addIssueToContext(ctx, {
1721
- code: ZodIssueCode.invalid_type,
1722
- expected: "integer",
1723
- received: "float",
1724
- message: check.message
1725
- });
1726
- status.dirty();
1727
- }
1728
- } else if (check.kind === "min") {
1729
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1730
- if (tooSmall) {
1731
- ctx = this._getOrReturnCtx(input, ctx);
1732
- addIssueToContext(ctx, {
1733
- code: ZodIssueCode.too_small,
1734
- minimum: check.value,
1735
- type: "number",
1736
- inclusive: check.inclusive,
1737
- exact: false,
1738
- message: check.message
1739
- });
1740
- status.dirty();
1741
- }
1742
- } else if (check.kind === "max") {
1743
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1744
- if (tooBig) {
1745
- ctx = this._getOrReturnCtx(input, ctx);
1746
- addIssueToContext(ctx, {
1747
- code: ZodIssueCode.too_big,
1748
- maximum: check.value,
1749
- type: "number",
1750
- inclusive: check.inclusive,
1751
- exact: false,
1752
- message: check.message
1753
- });
1754
- status.dirty();
1755
- }
1756
- } else if (check.kind === "multipleOf") {
1757
- if (floatSafeRemainder(input.data, check.value) !== 0) {
1758
- ctx = this._getOrReturnCtx(input, ctx);
1759
- addIssueToContext(ctx, {
1760
- code: ZodIssueCode.not_multiple_of,
1761
- multipleOf: check.value,
1762
- message: check.message
1763
- });
1764
- status.dirty();
1765
- }
1766
- } else if (check.kind === "finite") {
1767
- if (!Number.isFinite(input.data)) {
1768
- ctx = this._getOrReturnCtx(input, ctx);
1769
- addIssueToContext(ctx, {
1770
- code: ZodIssueCode.not_finite,
1771
- message: check.message
1772
- });
1773
- status.dirty();
1774
- }
1775
- } else {
1776
- util.assertNever(check);
1777
- }
1778
- }
1779
- return { status: status.value, value: input.data };
1780
- }
1781
- gte(value, message) {
1782
- return this.setLimit("min", value, true, errorUtil.toString(message));
1783
- }
1784
- gt(value, message) {
1785
- return this.setLimit("min", value, false, errorUtil.toString(message));
1786
- }
1787
- lte(value, message) {
1788
- return this.setLimit("max", value, true, errorUtil.toString(message));
1789
- }
1790
- lt(value, message) {
1791
- return this.setLimit("max", value, false, errorUtil.toString(message));
1792
- }
1793
- setLimit(kind, value, inclusive, message) {
1794
- return new _ZodNumber({
1795
- ...this._def,
1796
- checks: [
1797
- ...this._def.checks,
1798
- {
1799
- kind,
1800
- value,
1801
- inclusive,
1802
- message: errorUtil.toString(message)
1803
- }
1804
- ]
1805
- });
1806
- }
1807
- _addCheck(check) {
1808
- return new _ZodNumber({
1809
- ...this._def,
1810
- checks: [...this._def.checks, check]
1811
- });
1812
- }
1813
- int(message) {
1814
- return this._addCheck({
1815
- kind: "int",
1816
- message: errorUtil.toString(message)
1817
- });
1818
- }
1819
- positive(message) {
1820
- return this._addCheck({
1821
- kind: "min",
1822
- value: 0,
1823
- inclusive: false,
1824
- message: errorUtil.toString(message)
1825
- });
1826
- }
1827
- negative(message) {
1828
- return this._addCheck({
1829
- kind: "max",
1830
- value: 0,
1831
- inclusive: false,
1832
- message: errorUtil.toString(message)
1833
- });
1834
- }
1835
- nonpositive(message) {
1836
- return this._addCheck({
1837
- kind: "max",
1838
- value: 0,
1839
- inclusive: true,
1840
- message: errorUtil.toString(message)
1841
- });
1842
- }
1843
- nonnegative(message) {
1844
- return this._addCheck({
1845
- kind: "min",
1846
- value: 0,
1847
- inclusive: true,
1848
- message: errorUtil.toString(message)
1849
- });
1850
- }
1851
- multipleOf(value, message) {
1852
- return this._addCheck({
1853
- kind: "multipleOf",
1854
- value,
1855
- message: errorUtil.toString(message)
1856
- });
1857
- }
1858
- finite(message) {
1859
- return this._addCheck({
1860
- kind: "finite",
1861
- message: errorUtil.toString(message)
1862
- });
1863
- }
1864
- safe(message) {
1865
- return this._addCheck({
1866
- kind: "min",
1867
- inclusive: true,
1868
- value: Number.MIN_SAFE_INTEGER,
1869
- message: errorUtil.toString(message)
1870
- })._addCheck({
1871
- kind: "max",
1872
- inclusive: true,
1873
- value: Number.MAX_SAFE_INTEGER,
1874
- message: errorUtil.toString(message)
1875
- });
1876
- }
1877
- get minValue() {
1878
- let min = null;
1879
- for (const ch of this._def.checks) {
1880
- if (ch.kind === "min") {
1881
- if (min === null || ch.value > min)
1882
- min = ch.value;
1883
- }
1884
- }
1885
- return min;
1886
- }
1887
- get maxValue() {
1888
- let max = null;
1889
- for (const ch of this._def.checks) {
1890
- if (ch.kind === "max") {
1891
- if (max === null || ch.value < max)
1892
- max = ch.value;
1893
- }
1894
- }
1895
- return max;
1896
- }
1897
- get isInt() {
1898
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1899
- }
1900
- get isFinite() {
1901
- let max = null;
1902
- let min = null;
1903
- for (const ch of this._def.checks) {
1904
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1905
- return true;
1906
- } else if (ch.kind === "min") {
1907
- if (min === null || ch.value > min)
1908
- min = ch.value;
1909
- } else if (ch.kind === "max") {
1910
- if (max === null || ch.value < max)
1911
- max = ch.value;
1912
- }
1913
- }
1914
- return Number.isFinite(min) && Number.isFinite(max);
1915
- }
1916
- };
1917
- ZodNumber.create = (params) => {
1918
- return new ZodNumber({
1919
- checks: [],
1920
- typeName: ZodFirstPartyTypeKind.ZodNumber,
1921
- coerce: params?.coerce || false,
1922
- ...processCreateParams(params)
1923
- });
1924
- };
1925
- var ZodBigInt = class _ZodBigInt extends ZodType {
1926
- constructor() {
1927
- super(...arguments);
1928
- this.min = this.gte;
1929
- this.max = this.lte;
1930
- }
1931
- _parse(input) {
1932
- if (this._def.coerce) {
1933
- try {
1934
- input.data = BigInt(input.data);
1935
- } catch {
1936
- return this._getInvalidInput(input);
1937
- }
1938
- }
1939
- const parsedType = this._getType(input);
1940
- if (parsedType !== ZodParsedType.bigint) {
1941
- return this._getInvalidInput(input);
1942
- }
1943
- let ctx = void 0;
1944
- const status = new ParseStatus();
1945
- for (const check of this._def.checks) {
1946
- if (check.kind === "min") {
1947
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1948
- if (tooSmall) {
1949
- ctx = this._getOrReturnCtx(input, ctx);
1950
- addIssueToContext(ctx, {
1951
- code: ZodIssueCode.too_small,
1952
- type: "bigint",
1953
- minimum: check.value,
1954
- inclusive: check.inclusive,
1955
- message: check.message
1956
- });
1957
- status.dirty();
1958
- }
1959
- } else if (check.kind === "max") {
1960
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1961
- if (tooBig) {
1962
- ctx = this._getOrReturnCtx(input, ctx);
1963
- addIssueToContext(ctx, {
1964
- code: ZodIssueCode.too_big,
1965
- type: "bigint",
1966
- maximum: check.value,
1967
- inclusive: check.inclusive,
1968
- message: check.message
1969
- });
1970
- status.dirty();
1971
- }
1972
- } else if (check.kind === "multipleOf") {
1973
- if (input.data % check.value !== BigInt(0)) {
1974
- ctx = this._getOrReturnCtx(input, ctx);
1975
- addIssueToContext(ctx, {
1976
- code: ZodIssueCode.not_multiple_of,
1977
- multipleOf: check.value,
1978
- message: check.message
1979
- });
1980
- status.dirty();
1981
- }
1982
- } else {
1983
- util.assertNever(check);
1984
- }
1985
- }
1986
- return { status: status.value, value: input.data };
1987
- }
1988
- _getInvalidInput(input) {
1989
- const ctx = this._getOrReturnCtx(input);
1990
- addIssueToContext(ctx, {
1991
- code: ZodIssueCode.invalid_type,
1992
- expected: ZodParsedType.bigint,
1993
- received: ctx.parsedType
1994
- });
1995
- return INVALID;
1996
- }
1997
- gte(value, message) {
1998
- return this.setLimit("min", value, true, errorUtil.toString(message));
1999
- }
2000
- gt(value, message) {
2001
- return this.setLimit("min", value, false, errorUtil.toString(message));
2002
- }
2003
- lte(value, message) {
2004
- return this.setLimit("max", value, true, errorUtil.toString(message));
2005
- }
2006
- lt(value, message) {
2007
- return this.setLimit("max", value, false, errorUtil.toString(message));
2008
- }
2009
- setLimit(kind, value, inclusive, message) {
2010
- return new _ZodBigInt({
2011
- ...this._def,
2012
- checks: [
2013
- ...this._def.checks,
2014
- {
2015
- kind,
2016
- value,
2017
- inclusive,
2018
- message: errorUtil.toString(message)
2019
- }
2020
- ]
2021
- });
2022
- }
2023
- _addCheck(check) {
2024
- return new _ZodBigInt({
2025
- ...this._def,
2026
- checks: [...this._def.checks, check]
2027
- });
2028
- }
2029
- positive(message) {
2030
- return this._addCheck({
2031
- kind: "min",
2032
- value: BigInt(0),
2033
- inclusive: false,
2034
- message: errorUtil.toString(message)
2035
- });
2036
- }
2037
- negative(message) {
2038
- return this._addCheck({
2039
- kind: "max",
2040
- value: BigInt(0),
2041
- inclusive: false,
2042
- message: errorUtil.toString(message)
2043
- });
2044
- }
2045
- nonpositive(message) {
2046
- return this._addCheck({
2047
- kind: "max",
2048
- value: BigInt(0),
2049
- inclusive: true,
2050
- message: errorUtil.toString(message)
2051
- });
2052
- }
2053
- nonnegative(message) {
2054
- return this._addCheck({
2055
- kind: "min",
2056
- value: BigInt(0),
2057
- inclusive: true,
2058
- message: errorUtil.toString(message)
2059
- });
2060
- }
2061
- multipleOf(value, message) {
2062
- return this._addCheck({
2063
- kind: "multipleOf",
2064
- value,
2065
- message: errorUtil.toString(message)
2066
- });
2067
- }
2068
- get minValue() {
2069
- let min = null;
2070
- for (const ch of this._def.checks) {
2071
- if (ch.kind === "min") {
2072
- if (min === null || ch.value > min)
2073
- min = ch.value;
2074
- }
2075
- }
2076
- return min;
2077
- }
2078
- get maxValue() {
2079
- let max = null;
2080
- for (const ch of this._def.checks) {
2081
- if (ch.kind === "max") {
2082
- if (max === null || ch.value < max)
2083
- max = ch.value;
2084
- }
2085
- }
2086
- return max;
2087
- }
2088
- };
2089
- ZodBigInt.create = (params) => {
2090
- return new ZodBigInt({
2091
- checks: [],
2092
- typeName: ZodFirstPartyTypeKind.ZodBigInt,
2093
- coerce: params?.coerce ?? false,
2094
- ...processCreateParams(params)
2095
- });
2096
- };
2097
- var ZodBoolean = class extends ZodType {
2098
- _parse(input) {
2099
- if (this._def.coerce) {
2100
- input.data = Boolean(input.data);
2101
- }
2102
- const parsedType = this._getType(input);
2103
- if (parsedType !== ZodParsedType.boolean) {
2104
- const ctx = this._getOrReturnCtx(input);
2105
- addIssueToContext(ctx, {
2106
- code: ZodIssueCode.invalid_type,
2107
- expected: ZodParsedType.boolean,
2108
- received: ctx.parsedType
2109
- });
2110
- return INVALID;
2111
- }
2112
- return OK(input.data);
2113
- }
2114
- };
2115
- ZodBoolean.create = (params) => {
2116
- return new ZodBoolean({
2117
- typeName: ZodFirstPartyTypeKind.ZodBoolean,
2118
- coerce: params?.coerce || false,
2119
- ...processCreateParams(params)
2120
- });
2121
- };
2122
- var ZodDate = class _ZodDate extends ZodType {
2123
- _parse(input) {
2124
- if (this._def.coerce) {
2125
- input.data = new Date(input.data);
2126
- }
2127
- const parsedType = this._getType(input);
2128
- if (parsedType !== ZodParsedType.date) {
2129
- const ctx2 = this._getOrReturnCtx(input);
2130
- addIssueToContext(ctx2, {
2131
- code: ZodIssueCode.invalid_type,
2132
- expected: ZodParsedType.date,
2133
- received: ctx2.parsedType
2134
- });
2135
- return INVALID;
2136
- }
2137
- if (Number.isNaN(input.data.getTime())) {
2138
- const ctx2 = this._getOrReturnCtx(input);
2139
- addIssueToContext(ctx2, {
2140
- code: ZodIssueCode.invalid_date
2141
- });
2142
- return INVALID;
2143
- }
2144
- const status = new ParseStatus();
2145
- let ctx = void 0;
2146
- for (const check of this._def.checks) {
2147
- if (check.kind === "min") {
2148
- if (input.data.getTime() < check.value) {
2149
- ctx = this._getOrReturnCtx(input, ctx);
2150
- addIssueToContext(ctx, {
2151
- code: ZodIssueCode.too_small,
2152
- message: check.message,
2153
- inclusive: true,
2154
- exact: false,
2155
- minimum: check.value,
2156
- type: "date"
2157
- });
2158
- status.dirty();
2159
- }
2160
- } else if (check.kind === "max") {
2161
- if (input.data.getTime() > check.value) {
2162
- ctx = this._getOrReturnCtx(input, ctx);
2163
- addIssueToContext(ctx, {
2164
- code: ZodIssueCode.too_big,
2165
- message: check.message,
2166
- inclusive: true,
2167
- exact: false,
2168
- maximum: check.value,
2169
- type: "date"
2170
- });
2171
- status.dirty();
2172
- }
2173
- } else {
2174
- util.assertNever(check);
2175
- }
2176
- }
2177
- return {
2178
- status: status.value,
2179
- value: new Date(input.data.getTime())
2180
- };
2181
- }
2182
- _addCheck(check) {
2183
- return new _ZodDate({
2184
- ...this._def,
2185
- checks: [...this._def.checks, check]
2186
- });
2187
- }
2188
- min(minDate, message) {
2189
- return this._addCheck({
2190
- kind: "min",
2191
- value: minDate.getTime(),
2192
- message: errorUtil.toString(message)
2193
- });
2194
- }
2195
- max(maxDate, message) {
2196
- return this._addCheck({
2197
- kind: "max",
2198
- value: maxDate.getTime(),
2199
- message: errorUtil.toString(message)
2200
- });
2201
- }
2202
- get minDate() {
2203
- let min = null;
2204
- for (const ch of this._def.checks) {
2205
- if (ch.kind === "min") {
2206
- if (min === null || ch.value > min)
2207
- min = ch.value;
2208
- }
2209
- }
2210
- return min != null ? new Date(min) : null;
2211
- }
2212
- get maxDate() {
2213
- let max = null;
2214
- for (const ch of this._def.checks) {
2215
- if (ch.kind === "max") {
2216
- if (max === null || ch.value < max)
2217
- max = ch.value;
2218
- }
2219
- }
2220
- return max != null ? new Date(max) : null;
2221
- }
2222
- };
2223
- ZodDate.create = (params) => {
2224
- return new ZodDate({
2225
- checks: [],
2226
- coerce: params?.coerce || false,
2227
- typeName: ZodFirstPartyTypeKind.ZodDate,
2228
- ...processCreateParams(params)
2229
- });
2230
- };
2231
- var ZodSymbol = class extends ZodType {
2232
- _parse(input) {
2233
- const parsedType = this._getType(input);
2234
- if (parsedType !== ZodParsedType.symbol) {
2235
- const ctx = this._getOrReturnCtx(input);
2236
- addIssueToContext(ctx, {
2237
- code: ZodIssueCode.invalid_type,
2238
- expected: ZodParsedType.symbol,
2239
- received: ctx.parsedType
2240
- });
2241
- return INVALID;
2242
- }
2243
- return OK(input.data);
2244
- }
2245
- };
2246
- ZodSymbol.create = (params) => {
2247
- return new ZodSymbol({
2248
- typeName: ZodFirstPartyTypeKind.ZodSymbol,
2249
- ...processCreateParams(params)
2250
- });
2251
- };
2252
- var ZodUndefined = class extends ZodType {
2253
- _parse(input) {
2254
- const parsedType = this._getType(input);
2255
- if (parsedType !== ZodParsedType.undefined) {
2256
- const ctx = this._getOrReturnCtx(input);
2257
- addIssueToContext(ctx, {
2258
- code: ZodIssueCode.invalid_type,
2259
- expected: ZodParsedType.undefined,
2260
- received: ctx.parsedType
2261
- });
2262
- return INVALID;
2263
- }
2264
- return OK(input.data);
2265
- }
2266
- };
2267
- ZodUndefined.create = (params) => {
2268
- return new ZodUndefined({
2269
- typeName: ZodFirstPartyTypeKind.ZodUndefined,
2270
- ...processCreateParams(params)
2271
- });
2272
- };
2273
- var ZodNull = class extends ZodType {
2274
- _parse(input) {
2275
- const parsedType = this._getType(input);
2276
- if (parsedType !== ZodParsedType.null) {
2277
- const ctx = this._getOrReturnCtx(input);
2278
- addIssueToContext(ctx, {
2279
- code: ZodIssueCode.invalid_type,
2280
- expected: ZodParsedType.null,
2281
- received: ctx.parsedType
2282
- });
2283
- return INVALID;
2284
- }
2285
- return OK(input.data);
2286
- }
2287
- };
2288
- ZodNull.create = (params) => {
2289
- return new ZodNull({
2290
- typeName: ZodFirstPartyTypeKind.ZodNull,
2291
- ...processCreateParams(params)
2292
- });
2293
- };
2294
- var ZodAny = class extends ZodType {
2295
- constructor() {
2296
- super(...arguments);
2297
- this._any = true;
2298
- }
2299
- _parse(input) {
2300
- return OK(input.data);
2301
- }
2302
- };
2303
- ZodAny.create = (params) => {
2304
- return new ZodAny({
2305
- typeName: ZodFirstPartyTypeKind.ZodAny,
2306
- ...processCreateParams(params)
2307
- });
2308
- };
2309
- var ZodUnknown = class extends ZodType {
2310
- constructor() {
2311
- super(...arguments);
2312
- this._unknown = true;
2313
- }
2314
- _parse(input) {
2315
- return OK(input.data);
2316
- }
2317
- };
2318
- ZodUnknown.create = (params) => {
2319
- return new ZodUnknown({
2320
- typeName: ZodFirstPartyTypeKind.ZodUnknown,
2321
- ...processCreateParams(params)
2322
- });
2323
- };
2324
- var ZodNever = class extends ZodType {
2325
- _parse(input) {
2326
- const ctx = this._getOrReturnCtx(input);
2327
- addIssueToContext(ctx, {
2328
- code: ZodIssueCode.invalid_type,
2329
- expected: ZodParsedType.never,
2330
- received: ctx.parsedType
2331
- });
2332
- return INVALID;
2333
- }
2334
- };
2335
- ZodNever.create = (params) => {
2336
- return new ZodNever({
2337
- typeName: ZodFirstPartyTypeKind.ZodNever,
2338
- ...processCreateParams(params)
2339
- });
2340
- };
2341
- var ZodVoid = class extends ZodType {
2342
- _parse(input) {
2343
- const parsedType = this._getType(input);
2344
- if (parsedType !== ZodParsedType.undefined) {
2345
- const ctx = this._getOrReturnCtx(input);
2346
- addIssueToContext(ctx, {
2347
- code: ZodIssueCode.invalid_type,
2348
- expected: ZodParsedType.void,
2349
- received: ctx.parsedType
2350
- });
2351
- return INVALID;
2352
- }
2353
- return OK(input.data);
2354
- }
2355
- };
2356
- ZodVoid.create = (params) => {
2357
- return new ZodVoid({
2358
- typeName: ZodFirstPartyTypeKind.ZodVoid,
2359
- ...processCreateParams(params)
2360
- });
2361
- };
2362
- var ZodArray = class _ZodArray extends ZodType {
2363
- _parse(input) {
2364
- const { ctx, status } = this._processInputParams(input);
2365
- const def = this._def;
2366
- if (ctx.parsedType !== ZodParsedType.array) {
2367
- addIssueToContext(ctx, {
2368
- code: ZodIssueCode.invalid_type,
2369
- expected: ZodParsedType.array,
2370
- received: ctx.parsedType
2371
- });
2372
- return INVALID;
2373
- }
2374
- if (def.exactLength !== null) {
2375
- const tooBig = ctx.data.length > def.exactLength.value;
2376
- const tooSmall = ctx.data.length < def.exactLength.value;
2377
- if (tooBig || tooSmall) {
2378
- addIssueToContext(ctx, {
2379
- code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2380
- minimum: tooSmall ? def.exactLength.value : void 0,
2381
- maximum: tooBig ? def.exactLength.value : void 0,
2382
- type: "array",
2383
- inclusive: true,
2384
- exact: true,
2385
- message: def.exactLength.message
2386
- });
2387
- status.dirty();
2388
- }
2389
- }
2390
- if (def.minLength !== null) {
2391
- if (ctx.data.length < def.minLength.value) {
2392
- addIssueToContext(ctx, {
2393
- code: ZodIssueCode.too_small,
2394
- minimum: def.minLength.value,
2395
- type: "array",
2396
- inclusive: true,
2397
- exact: false,
2398
- message: def.minLength.message
2399
- });
2400
- status.dirty();
2401
- }
2402
- }
2403
- if (def.maxLength !== null) {
2404
- if (ctx.data.length > def.maxLength.value) {
2405
- addIssueToContext(ctx, {
2406
- code: ZodIssueCode.too_big,
2407
- maximum: def.maxLength.value,
2408
- type: "array",
2409
- inclusive: true,
2410
- exact: false,
2411
- message: def.maxLength.message
2412
- });
2413
- status.dirty();
2414
- }
2415
- }
2416
- if (ctx.common.async) {
2417
- return Promise.all([...ctx.data].map((item, i) => {
2418
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2419
- })).then((result2) => {
2420
- return ParseStatus.mergeArray(status, result2);
2421
- });
2422
- }
2423
- const result = [...ctx.data].map((item, i) => {
2424
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2425
- });
2426
- return ParseStatus.mergeArray(status, result);
2427
- }
2428
- get element() {
2429
- return this._def.type;
2430
- }
2431
- min(minLength, message) {
2432
- return new _ZodArray({
2433
- ...this._def,
2434
- minLength: { value: minLength, message: errorUtil.toString(message) }
2435
- });
2436
- }
2437
- max(maxLength, message) {
2438
- return new _ZodArray({
2439
- ...this._def,
2440
- maxLength: { value: maxLength, message: errorUtil.toString(message) }
2441
- });
2442
- }
2443
- length(len, message) {
2444
- return new _ZodArray({
2445
- ...this._def,
2446
- exactLength: { value: len, message: errorUtil.toString(message) }
2447
- });
2448
- }
2449
- nonempty(message) {
2450
- return this.min(1, message);
2451
- }
2452
- };
2453
- ZodArray.create = (schema, params) => {
2454
- return new ZodArray({
2455
- type: schema,
2456
- minLength: null,
2457
- maxLength: null,
2458
- exactLength: null,
2459
- typeName: ZodFirstPartyTypeKind.ZodArray,
2460
- ...processCreateParams(params)
2461
- });
2462
- };
2463
- function deepPartialify(schema) {
2464
- if (schema instanceof ZodObject) {
2465
- const newShape = {};
2466
- for (const key in schema.shape) {
2467
- const fieldSchema = schema.shape[key];
2468
- newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2469
- }
2470
- return new ZodObject({
2471
- ...schema._def,
2472
- shape: () => newShape
2473
- });
2474
- } else if (schema instanceof ZodArray) {
2475
- return new ZodArray({
2476
- ...schema._def,
2477
- type: deepPartialify(schema.element)
2478
- });
2479
- } else if (schema instanceof ZodOptional) {
2480
- return ZodOptional.create(deepPartialify(schema.unwrap()));
2481
- } else if (schema instanceof ZodNullable) {
2482
- return ZodNullable.create(deepPartialify(schema.unwrap()));
2483
- } else if (schema instanceof ZodTuple) {
2484
- return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2485
- } else {
2486
- return schema;
2487
- }
2488
- }
2489
- var ZodObject = class _ZodObject extends ZodType {
2490
- constructor() {
2491
- super(...arguments);
2492
- this._cached = null;
2493
- this.nonstrict = this.passthrough;
2494
- this.augment = this.extend;
2495
- }
2496
- _getCached() {
2497
- if (this._cached !== null)
2498
- return this._cached;
2499
- const shape = this._def.shape();
2500
- const keys = util.objectKeys(shape);
2501
- this._cached = { shape, keys };
2502
- return this._cached;
2503
- }
2504
- _parse(input) {
2505
- const parsedType = this._getType(input);
2506
- if (parsedType !== ZodParsedType.object) {
2507
- const ctx2 = this._getOrReturnCtx(input);
2508
- addIssueToContext(ctx2, {
2509
- code: ZodIssueCode.invalid_type,
2510
- expected: ZodParsedType.object,
2511
- received: ctx2.parsedType
2512
- });
2513
- return INVALID;
2514
- }
2515
- const { status, ctx } = this._processInputParams(input);
2516
- const { shape, keys: shapeKeys } = this._getCached();
2517
- const extraKeys = [];
2518
- if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2519
- for (const key in ctx.data) {
2520
- if (!shapeKeys.includes(key)) {
2521
- extraKeys.push(key);
2522
- }
2523
- }
2524
- }
2525
- const pairs = [];
2526
- for (const key of shapeKeys) {
2527
- const keyValidator = shape[key];
2528
- const value = ctx.data[key];
2529
- pairs.push({
2530
- key: { status: "valid", value: key },
2531
- value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2532
- alwaysSet: key in ctx.data
2533
- });
2534
- }
2535
- if (this._def.catchall instanceof ZodNever) {
2536
- const unknownKeys = this._def.unknownKeys;
2537
- if (unknownKeys === "passthrough") {
2538
- for (const key of extraKeys) {
2539
- pairs.push({
2540
- key: { status: "valid", value: key },
2541
- value: { status: "valid", value: ctx.data[key] }
2542
- });
2543
- }
2544
- } else if (unknownKeys === "strict") {
2545
- if (extraKeys.length > 0) {
2546
- addIssueToContext(ctx, {
2547
- code: ZodIssueCode.unrecognized_keys,
2548
- keys: extraKeys
2549
- });
2550
- status.dirty();
2551
- }
2552
- } else if (unknownKeys === "strip") {
2553
- } else {
2554
- throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2555
- }
2556
- } else {
2557
- const catchall = this._def.catchall;
2558
- for (const key of extraKeys) {
2559
- const value = ctx.data[key];
2560
- pairs.push({
2561
- key: { status: "valid", value: key },
2562
- value: catchall._parse(
2563
- new ParseInputLazyPath(ctx, value, ctx.path, key)
2564
- //, ctx.child(key), value, getParsedType(value)
2565
- ),
2566
- alwaysSet: key in ctx.data
2567
- });
2568
- }
2569
- }
2570
- if (ctx.common.async) {
2571
- return Promise.resolve().then(async () => {
2572
- const syncPairs = [];
2573
- for (const pair of pairs) {
2574
- const key = await pair.key;
2575
- const value = await pair.value;
2576
- syncPairs.push({
2577
- key,
2578
- value,
2579
- alwaysSet: pair.alwaysSet
2580
- });
2581
- }
2582
- return syncPairs;
2583
- }).then((syncPairs) => {
2584
- return ParseStatus.mergeObjectSync(status, syncPairs);
2585
- });
2586
- } else {
2587
- return ParseStatus.mergeObjectSync(status, pairs);
2588
- }
2589
- }
2590
- get shape() {
2591
- return this._def.shape();
2592
- }
2593
- strict(message) {
2594
- errorUtil.errToObj;
2595
- return new _ZodObject({
2596
- ...this._def,
2597
- unknownKeys: "strict",
2598
- ...message !== void 0 ? {
2599
- errorMap: (issue, ctx) => {
2600
- const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2601
- if (issue.code === "unrecognized_keys")
2602
- return {
2603
- message: errorUtil.errToObj(message).message ?? defaultError
2604
- };
2605
- return {
2606
- message: defaultError
2607
- };
2608
- }
2609
- } : {}
2610
- });
2611
- }
2612
- strip() {
2613
- return new _ZodObject({
2614
- ...this._def,
2615
- unknownKeys: "strip"
2616
- });
2617
- }
2618
- passthrough() {
2619
- return new _ZodObject({
2620
- ...this._def,
2621
- unknownKeys: "passthrough"
2622
- });
2623
- }
2624
- // const AugmentFactory =
2625
- // <Def extends ZodObjectDef>(def: Def) =>
2626
- // <Augmentation extends ZodRawShape>(
2627
- // augmentation: Augmentation
2628
- // ): ZodObject<
2629
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2630
- // Def["unknownKeys"],
2631
- // Def["catchall"]
2632
- // > => {
2633
- // return new ZodObject({
2634
- // ...def,
2635
- // shape: () => ({
2636
- // ...def.shape(),
2637
- // ...augmentation,
2638
- // }),
2639
- // }) as any;
2640
- // };
2641
- extend(augmentation) {
2642
- return new _ZodObject({
2643
- ...this._def,
2644
- shape: () => ({
2645
- ...this._def.shape(),
2646
- ...augmentation
2647
- })
2648
- });
2649
- }
2650
- /**
2651
- * Prior to zod@1.0.12 there was a bug in the
2652
- * inferred type of merged objects. Please
2653
- * upgrade if you are experiencing issues.
2654
- */
2655
- merge(merging) {
2656
- const merged = new _ZodObject({
2657
- unknownKeys: merging._def.unknownKeys,
2658
- catchall: merging._def.catchall,
2659
- shape: () => ({
2660
- ...this._def.shape(),
2661
- ...merging._def.shape()
2662
- }),
2663
- typeName: ZodFirstPartyTypeKind.ZodObject
2664
- });
2665
- return merged;
2666
- }
2667
- // merge<
2668
- // Incoming extends AnyZodObject,
2669
- // Augmentation extends Incoming["shape"],
2670
- // NewOutput extends {
2671
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2672
- // ? Augmentation[k]["_output"]
2673
- // : k extends keyof Output
2674
- // ? Output[k]
2675
- // : never;
2676
- // },
2677
- // NewInput extends {
2678
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2679
- // ? Augmentation[k]["_input"]
2680
- // : k extends keyof Input
2681
- // ? Input[k]
2682
- // : never;
2683
- // }
2684
- // >(
2685
- // merging: Incoming
2686
- // ): ZodObject<
2687
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2688
- // Incoming["_def"]["unknownKeys"],
2689
- // Incoming["_def"]["catchall"],
2690
- // NewOutput,
2691
- // NewInput
2692
- // > {
2693
- // const merged: any = new ZodObject({
2694
- // unknownKeys: merging._def.unknownKeys,
2695
- // catchall: merging._def.catchall,
2696
- // shape: () =>
2697
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2698
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2699
- // }) as any;
2700
- // return merged;
2701
- // }
2702
- setKey(key, schema) {
2703
- return this.augment({ [key]: schema });
2704
- }
2705
- // merge<Incoming extends AnyZodObject>(
2706
- // merging: Incoming
2707
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2708
- // ZodObject<
2709
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2710
- // Incoming["_def"]["unknownKeys"],
2711
- // Incoming["_def"]["catchall"]
2712
- // > {
2713
- // // const mergedShape = objectUtil.mergeShapes(
2714
- // // this._def.shape(),
2715
- // // merging._def.shape()
2716
- // // );
2717
- // const merged: any = new ZodObject({
2718
- // unknownKeys: merging._def.unknownKeys,
2719
- // catchall: merging._def.catchall,
2720
- // shape: () =>
2721
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2722
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2723
- // }) as any;
2724
- // return merged;
2725
- // }
2726
- catchall(index) {
2727
- return new _ZodObject({
2728
- ...this._def,
2729
- catchall: index
2730
- });
2731
- }
2732
- pick(mask) {
2733
- const shape = {};
2734
- for (const key of util.objectKeys(mask)) {
2735
- if (mask[key] && this.shape[key]) {
2736
- shape[key] = this.shape[key];
2737
- }
2738
- }
2739
- return new _ZodObject({
2740
- ...this._def,
2741
- shape: () => shape
2742
- });
2743
- }
2744
- omit(mask) {
2745
- const shape = {};
2746
- for (const key of util.objectKeys(this.shape)) {
2747
- if (!mask[key]) {
2748
- shape[key] = this.shape[key];
2749
- }
2750
- }
2751
- return new _ZodObject({
2752
- ...this._def,
2753
- shape: () => shape
2754
- });
2755
- }
2756
- /**
2757
- * @deprecated
2758
- */
2759
- deepPartial() {
2760
- return deepPartialify(this);
2761
- }
2762
- partial(mask) {
2763
- const newShape = {};
2764
- for (const key of util.objectKeys(this.shape)) {
2765
- const fieldSchema = this.shape[key];
2766
- if (mask && !mask[key]) {
2767
- newShape[key] = fieldSchema;
2768
- } else {
2769
- newShape[key] = fieldSchema.optional();
2770
- }
2771
- }
2772
- return new _ZodObject({
2773
- ...this._def,
2774
- shape: () => newShape
2775
- });
2776
- }
2777
- required(mask) {
2778
- const newShape = {};
2779
- for (const key of util.objectKeys(this.shape)) {
2780
- if (mask && !mask[key]) {
2781
- newShape[key] = this.shape[key];
2782
- } else {
2783
- const fieldSchema = this.shape[key];
2784
- let newField = fieldSchema;
2785
- while (newField instanceof ZodOptional) {
2786
- newField = newField._def.innerType;
2787
- }
2788
- newShape[key] = newField;
2789
- }
2790
- }
2791
- return new _ZodObject({
2792
- ...this._def,
2793
- shape: () => newShape
2794
- });
2795
- }
2796
- keyof() {
2797
- return createZodEnum(util.objectKeys(this.shape));
2798
- }
2799
- };
2800
- ZodObject.create = (shape, params) => {
2801
- return new ZodObject({
2802
- shape: () => shape,
2803
- unknownKeys: "strip",
2804
- catchall: ZodNever.create(),
2805
- typeName: ZodFirstPartyTypeKind.ZodObject,
2806
- ...processCreateParams(params)
2807
- });
2808
- };
2809
- ZodObject.strictCreate = (shape, params) => {
2810
- return new ZodObject({
2811
- shape: () => shape,
2812
- unknownKeys: "strict",
2813
- catchall: ZodNever.create(),
2814
- typeName: ZodFirstPartyTypeKind.ZodObject,
2815
- ...processCreateParams(params)
2816
- });
2817
- };
2818
- ZodObject.lazycreate = (shape, params) => {
2819
- return new ZodObject({
2820
- shape,
2821
- unknownKeys: "strip",
2822
- catchall: ZodNever.create(),
2823
- typeName: ZodFirstPartyTypeKind.ZodObject,
2824
- ...processCreateParams(params)
2825
- });
2826
- };
2827
- var ZodUnion = class extends ZodType {
2828
- _parse(input) {
2829
- const { ctx } = this._processInputParams(input);
2830
- const options = this._def.options;
2831
- function handleResults(results) {
2832
- for (const result of results) {
2833
- if (result.result.status === "valid") {
2834
- return result.result;
2835
- }
2836
- }
2837
- for (const result of results) {
2838
- if (result.result.status === "dirty") {
2839
- ctx.common.issues.push(...result.ctx.common.issues);
2840
- return result.result;
2841
- }
2842
- }
2843
- const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2844
- addIssueToContext(ctx, {
2845
- code: ZodIssueCode.invalid_union,
2846
- unionErrors
2847
- });
2848
- return INVALID;
2849
- }
2850
- if (ctx.common.async) {
2851
- return Promise.all(options.map(async (option) => {
2852
- const childCtx = {
2853
- ...ctx,
2854
- common: {
2855
- ...ctx.common,
2856
- issues: []
2857
- },
2858
- parent: null
2859
- };
2860
- return {
2861
- result: await option._parseAsync({
2862
- data: ctx.data,
2863
- path: ctx.path,
2864
- parent: childCtx
2865
- }),
2866
- ctx: childCtx
2867
- };
2868
- })).then(handleResults);
2869
- } else {
2870
- let dirty = void 0;
2871
- const issues = [];
2872
- for (const option of options) {
2873
- const childCtx = {
2874
- ...ctx,
2875
- common: {
2876
- ...ctx.common,
2877
- issues: []
2878
- },
2879
- parent: null
2880
- };
2881
- const result = option._parseSync({
2882
- data: ctx.data,
2883
- path: ctx.path,
2884
- parent: childCtx
2885
- });
2886
- if (result.status === "valid") {
2887
- return result;
2888
- } else if (result.status === "dirty" && !dirty) {
2889
- dirty = { result, ctx: childCtx };
2890
- }
2891
- if (childCtx.common.issues.length) {
2892
- issues.push(childCtx.common.issues);
2893
- }
2894
- }
2895
- if (dirty) {
2896
- ctx.common.issues.push(...dirty.ctx.common.issues);
2897
- return dirty.result;
2898
- }
2899
- const unionErrors = issues.map((issues2) => new ZodError(issues2));
2900
- addIssueToContext(ctx, {
2901
- code: ZodIssueCode.invalid_union,
2902
- unionErrors
2903
- });
2904
- return INVALID;
2905
- }
2906
- }
2907
- get options() {
2908
- return this._def.options;
2909
- }
2910
- };
2911
- ZodUnion.create = (types, params) => {
2912
- return new ZodUnion({
2913
- options: types,
2914
- typeName: ZodFirstPartyTypeKind.ZodUnion,
2915
- ...processCreateParams(params)
2916
- });
2917
- };
2918
- var getDiscriminator = (type) => {
2919
- if (type instanceof ZodLazy) {
2920
- return getDiscriminator(type.schema);
2921
- } else if (type instanceof ZodEffects) {
2922
- return getDiscriminator(type.innerType());
2923
- } else if (type instanceof ZodLiteral) {
2924
- return [type.value];
2925
- } else if (type instanceof ZodEnum) {
2926
- return type.options;
2927
- } else if (type instanceof ZodNativeEnum) {
2928
- return util.objectValues(type.enum);
2929
- } else if (type instanceof ZodDefault) {
2930
- return getDiscriminator(type._def.innerType);
2931
- } else if (type instanceof ZodUndefined) {
2932
- return [void 0];
2933
- } else if (type instanceof ZodNull) {
2934
- return [null];
2935
- } else if (type instanceof ZodOptional) {
2936
- return [void 0, ...getDiscriminator(type.unwrap())];
2937
- } else if (type instanceof ZodNullable) {
2938
- return [null, ...getDiscriminator(type.unwrap())];
2939
- } else if (type instanceof ZodBranded) {
2940
- return getDiscriminator(type.unwrap());
2941
- } else if (type instanceof ZodReadonly) {
2942
- return getDiscriminator(type.unwrap());
2943
- } else if (type instanceof ZodCatch) {
2944
- return getDiscriminator(type._def.innerType);
2945
- } else {
2946
- return [];
2947
- }
2948
- };
2949
- var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2950
- _parse(input) {
2951
- const { ctx } = this._processInputParams(input);
2952
- if (ctx.parsedType !== ZodParsedType.object) {
2953
- addIssueToContext(ctx, {
2954
- code: ZodIssueCode.invalid_type,
2955
- expected: ZodParsedType.object,
2956
- received: ctx.parsedType
2957
- });
2958
- return INVALID;
2959
- }
2960
- const discriminator = this.discriminator;
2961
- const discriminatorValue = ctx.data[discriminator];
2962
- const option = this.optionsMap.get(discriminatorValue);
2963
- if (!option) {
2964
- addIssueToContext(ctx, {
2965
- code: ZodIssueCode.invalid_union_discriminator,
2966
- options: Array.from(this.optionsMap.keys()),
2967
- path: [discriminator]
2968
- });
2969
- return INVALID;
2970
- }
2971
- if (ctx.common.async) {
2972
- return option._parseAsync({
2973
- data: ctx.data,
2974
- path: ctx.path,
2975
- parent: ctx
2976
- });
2977
- } else {
2978
- return option._parseSync({
2979
- data: ctx.data,
2980
- path: ctx.path,
2981
- parent: ctx
2982
- });
2983
- }
2984
- }
2985
- get discriminator() {
2986
- return this._def.discriminator;
2987
- }
2988
- get options() {
2989
- return this._def.options;
2990
- }
2991
- get optionsMap() {
2992
- return this._def.optionsMap;
2993
- }
2994
- /**
2995
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2996
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2997
- * have a different value for each object in the union.
2998
- * @param discriminator the name of the discriminator property
2999
- * @param types an array of object schemas
3000
- * @param params
3001
- */
3002
- static create(discriminator, options, params) {
3003
- const optionsMap = /* @__PURE__ */ new Map();
3004
- for (const type of options) {
3005
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
3006
- if (!discriminatorValues.length) {
3007
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3008
- }
3009
- for (const value of discriminatorValues) {
3010
- if (optionsMap.has(value)) {
3011
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
3012
- }
3013
- optionsMap.set(value, type);
3014
- }
3015
- }
3016
- return new _ZodDiscriminatedUnion({
3017
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
3018
- discriminator,
3019
- options,
3020
- optionsMap,
3021
- ...processCreateParams(params)
3022
- });
3023
- }
3024
- };
3025
- function mergeValues(a, b) {
3026
- const aType = getParsedType(a);
3027
- const bType = getParsedType(b);
3028
- if (a === b) {
3029
- return { valid: true, data: a };
3030
- } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
3031
- const bKeys = util.objectKeys(b);
3032
- const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
3033
- const newObj = { ...a, ...b };
3034
- for (const key of sharedKeys) {
3035
- const sharedValue = mergeValues(a[key], b[key]);
3036
- if (!sharedValue.valid) {
3037
- return { valid: false };
3038
- }
3039
- newObj[key] = sharedValue.data;
3040
- }
3041
- return { valid: true, data: newObj };
3042
- } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
3043
- if (a.length !== b.length) {
3044
- return { valid: false };
3045
- }
3046
- const newArray = [];
3047
- for (let index = 0; index < a.length; index++) {
3048
- const itemA = a[index];
3049
- const itemB = b[index];
3050
- const sharedValue = mergeValues(itemA, itemB);
3051
- if (!sharedValue.valid) {
3052
- return { valid: false };
3053
- }
3054
- newArray.push(sharedValue.data);
3055
- }
3056
- return { valid: true, data: newArray };
3057
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
3058
- return { valid: true, data: a };
3059
- } else {
3060
- return { valid: false };
3061
- }
3062
- }
3063
- var ZodIntersection = class extends ZodType {
3064
- _parse(input) {
3065
- const { status, ctx } = this._processInputParams(input);
3066
- const handleParsed = (parsedLeft, parsedRight) => {
3067
- if (isAborted(parsedLeft) || isAborted(parsedRight)) {
3068
- return INVALID;
3069
- }
3070
- const merged = mergeValues(parsedLeft.value, parsedRight.value);
3071
- if (!merged.valid) {
3072
- addIssueToContext(ctx, {
3073
- code: ZodIssueCode.invalid_intersection_types
3074
- });
3075
- return INVALID;
3076
- }
3077
- if (isDirty(parsedLeft) || isDirty(parsedRight)) {
3078
- status.dirty();
3079
- }
3080
- return { status: status.value, value: merged.data };
3081
- };
3082
- if (ctx.common.async) {
3083
- return Promise.all([
3084
- this._def.left._parseAsync({
3085
- data: ctx.data,
3086
- path: ctx.path,
3087
- parent: ctx
3088
- }),
3089
- this._def.right._parseAsync({
3090
- data: ctx.data,
3091
- path: ctx.path,
3092
- parent: ctx
3093
- })
3094
- ]).then(([left, right]) => handleParsed(left, right));
3095
- } else {
3096
- return handleParsed(this._def.left._parseSync({
3097
- data: ctx.data,
3098
- path: ctx.path,
3099
- parent: ctx
3100
- }), this._def.right._parseSync({
3101
- data: ctx.data,
3102
- path: ctx.path,
3103
- parent: ctx
3104
- }));
3105
- }
3106
- }
3107
- };
3108
- ZodIntersection.create = (left, right, params) => {
3109
- return new ZodIntersection({
3110
- left,
3111
- right,
3112
- typeName: ZodFirstPartyTypeKind.ZodIntersection,
3113
- ...processCreateParams(params)
3114
- });
3115
- };
3116
- var ZodTuple = class _ZodTuple extends ZodType {
3117
- _parse(input) {
3118
- const { status, ctx } = this._processInputParams(input);
3119
- if (ctx.parsedType !== ZodParsedType.array) {
3120
- addIssueToContext(ctx, {
3121
- code: ZodIssueCode.invalid_type,
3122
- expected: ZodParsedType.array,
3123
- received: ctx.parsedType
3124
- });
3125
- return INVALID;
3126
- }
3127
- if (ctx.data.length < this._def.items.length) {
3128
- addIssueToContext(ctx, {
3129
- code: ZodIssueCode.too_small,
3130
- minimum: this._def.items.length,
3131
- inclusive: true,
3132
- exact: false,
3133
- type: "array"
3134
- });
3135
- return INVALID;
3136
- }
3137
- const rest = this._def.rest;
3138
- if (!rest && ctx.data.length > this._def.items.length) {
3139
- addIssueToContext(ctx, {
3140
- code: ZodIssueCode.too_big,
3141
- maximum: this._def.items.length,
3142
- inclusive: true,
3143
- exact: false,
3144
- type: "array"
3145
- });
3146
- status.dirty();
3147
- }
3148
- const items = [...ctx.data].map((item, itemIndex) => {
3149
- const schema = this._def.items[itemIndex] || this._def.rest;
3150
- if (!schema)
3151
- return null;
3152
- return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
3153
- }).filter((x) => !!x);
3154
- if (ctx.common.async) {
3155
- return Promise.all(items).then((results) => {
3156
- return ParseStatus.mergeArray(status, results);
3157
- });
3158
- } else {
3159
- return ParseStatus.mergeArray(status, items);
3160
- }
3161
- }
3162
- get items() {
3163
- return this._def.items;
3164
- }
3165
- rest(rest) {
3166
- return new _ZodTuple({
3167
- ...this._def,
3168
- rest
3169
- });
3170
- }
3171
- };
3172
- ZodTuple.create = (schemas, params) => {
3173
- if (!Array.isArray(schemas)) {
3174
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3175
- }
3176
- return new ZodTuple({
3177
- items: schemas,
3178
- typeName: ZodFirstPartyTypeKind.ZodTuple,
3179
- rest: null,
3180
- ...processCreateParams(params)
3181
- });
3182
- };
3183
- var ZodRecord = class _ZodRecord extends ZodType {
3184
- get keySchema() {
3185
- return this._def.keyType;
3186
- }
3187
- get valueSchema() {
3188
- return this._def.valueType;
3189
- }
3190
- _parse(input) {
3191
- const { status, ctx } = this._processInputParams(input);
3192
- if (ctx.parsedType !== ZodParsedType.object) {
3193
- addIssueToContext(ctx, {
3194
- code: ZodIssueCode.invalid_type,
3195
- expected: ZodParsedType.object,
3196
- received: ctx.parsedType
3197
- });
3198
- return INVALID;
3199
- }
3200
- const pairs = [];
3201
- const keyType = this._def.keyType;
3202
- const valueType = this._def.valueType;
3203
- for (const key in ctx.data) {
3204
- pairs.push({
3205
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3206
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3207
- alwaysSet: key in ctx.data
3208
- });
3209
- }
3210
- if (ctx.common.async) {
3211
- return ParseStatus.mergeObjectAsync(status, pairs);
3212
- } else {
3213
- return ParseStatus.mergeObjectSync(status, pairs);
3214
- }
3215
- }
3216
- get element() {
3217
- return this._def.valueType;
3218
- }
3219
- static create(first, second, third) {
3220
- if (second instanceof ZodType) {
3221
- return new _ZodRecord({
3222
- keyType: first,
3223
- valueType: second,
3224
- typeName: ZodFirstPartyTypeKind.ZodRecord,
3225
- ...processCreateParams(third)
3226
- });
3227
- }
3228
- return new _ZodRecord({
3229
- keyType: ZodString.create(),
3230
- valueType: first,
3231
- typeName: ZodFirstPartyTypeKind.ZodRecord,
3232
- ...processCreateParams(second)
3233
- });
3234
- }
3235
- };
3236
- var ZodMap = class extends ZodType {
3237
- get keySchema() {
3238
- return this._def.keyType;
3239
- }
3240
- get valueSchema() {
3241
- return this._def.valueType;
3242
- }
3243
- _parse(input) {
3244
- const { status, ctx } = this._processInputParams(input);
3245
- if (ctx.parsedType !== ZodParsedType.map) {
3246
- addIssueToContext(ctx, {
3247
- code: ZodIssueCode.invalid_type,
3248
- expected: ZodParsedType.map,
3249
- received: ctx.parsedType
3250
- });
3251
- return INVALID;
3252
- }
3253
- const keyType = this._def.keyType;
3254
- const valueType = this._def.valueType;
3255
- const pairs = [...ctx.data.entries()].map(([key, value], index) => {
3256
- return {
3257
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
3258
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
3259
- };
3260
- });
3261
- if (ctx.common.async) {
3262
- const finalMap = /* @__PURE__ */ new Map();
3263
- return Promise.resolve().then(async () => {
3264
- for (const pair of pairs) {
3265
- const key = await pair.key;
3266
- const value = await pair.value;
3267
- if (key.status === "aborted" || value.status === "aborted") {
3268
- return INVALID;
3269
- }
3270
- if (key.status === "dirty" || value.status === "dirty") {
3271
- status.dirty();
3272
- }
3273
- finalMap.set(key.value, value.value);
3274
- }
3275
- return { status: status.value, value: finalMap };
3276
- });
3277
- } else {
3278
- const finalMap = /* @__PURE__ */ new Map();
3279
- for (const pair of pairs) {
3280
- const key = pair.key;
3281
- const value = pair.value;
3282
- if (key.status === "aborted" || value.status === "aborted") {
3283
- return INVALID;
3284
- }
3285
- if (key.status === "dirty" || value.status === "dirty") {
3286
- status.dirty();
3287
- }
3288
- finalMap.set(key.value, value.value);
3289
- }
3290
- return { status: status.value, value: finalMap };
3291
- }
3292
- }
3293
- };
3294
- ZodMap.create = (keyType, valueType, params) => {
3295
- return new ZodMap({
3296
- valueType,
3297
- keyType,
3298
- typeName: ZodFirstPartyTypeKind.ZodMap,
3299
- ...processCreateParams(params)
3300
- });
3301
- };
3302
- var ZodSet = class _ZodSet extends ZodType {
3303
- _parse(input) {
3304
- const { status, ctx } = this._processInputParams(input);
3305
- if (ctx.parsedType !== ZodParsedType.set) {
3306
- addIssueToContext(ctx, {
3307
- code: ZodIssueCode.invalid_type,
3308
- expected: ZodParsedType.set,
3309
- received: ctx.parsedType
3310
- });
3311
- return INVALID;
3312
- }
3313
- const def = this._def;
3314
- if (def.minSize !== null) {
3315
- if (ctx.data.size < def.minSize.value) {
3316
- addIssueToContext(ctx, {
3317
- code: ZodIssueCode.too_small,
3318
- minimum: def.minSize.value,
3319
- type: "set",
3320
- inclusive: true,
3321
- exact: false,
3322
- message: def.minSize.message
3323
- });
3324
- status.dirty();
3325
- }
3326
- }
3327
- if (def.maxSize !== null) {
3328
- if (ctx.data.size > def.maxSize.value) {
3329
- addIssueToContext(ctx, {
3330
- code: ZodIssueCode.too_big,
3331
- maximum: def.maxSize.value,
3332
- type: "set",
3333
- inclusive: true,
3334
- exact: false,
3335
- message: def.maxSize.message
3336
- });
3337
- status.dirty();
3338
- }
3339
- }
3340
- const valueType = this._def.valueType;
3341
- function finalizeSet(elements2) {
3342
- const parsedSet = /* @__PURE__ */ new Set();
3343
- for (const element of elements2) {
3344
- if (element.status === "aborted")
3345
- return INVALID;
3346
- if (element.status === "dirty")
3347
- status.dirty();
3348
- parsedSet.add(element.value);
3349
- }
3350
- return { status: status.value, value: parsedSet };
3351
- }
3352
- const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3353
- if (ctx.common.async) {
3354
- return Promise.all(elements).then((elements2) => finalizeSet(elements2));
3355
- } else {
3356
- return finalizeSet(elements);
3357
- }
3358
- }
3359
- min(minSize, message) {
3360
- return new _ZodSet({
3361
- ...this._def,
3362
- minSize: { value: minSize, message: errorUtil.toString(message) }
3363
- });
3364
- }
3365
- max(maxSize, message) {
3366
- return new _ZodSet({
3367
- ...this._def,
3368
- maxSize: { value: maxSize, message: errorUtil.toString(message) }
3369
- });
3370
- }
3371
- size(size, message) {
3372
- return this.min(size, message).max(size, message);
3373
- }
3374
- nonempty(message) {
3375
- return this.min(1, message);
3376
- }
3377
- };
3378
- ZodSet.create = (valueType, params) => {
3379
- return new ZodSet({
3380
- valueType,
3381
- minSize: null,
3382
- maxSize: null,
3383
- typeName: ZodFirstPartyTypeKind.ZodSet,
3384
- ...processCreateParams(params)
3385
- });
3386
- };
3387
- var ZodFunction = class _ZodFunction extends ZodType {
3388
- constructor() {
3389
- super(...arguments);
3390
- this.validate = this.implement;
3391
- }
3392
- _parse(input) {
3393
- const { ctx } = this._processInputParams(input);
3394
- if (ctx.parsedType !== ZodParsedType.function) {
3395
- addIssueToContext(ctx, {
3396
- code: ZodIssueCode.invalid_type,
3397
- expected: ZodParsedType.function,
3398
- received: ctx.parsedType
3399
- });
3400
- return INVALID;
3401
- }
3402
- function makeArgsIssue(args, error) {
3403
- return makeIssue({
3404
- data: args,
3405
- path: ctx.path,
3406
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3407
- issueData: {
3408
- code: ZodIssueCode.invalid_arguments,
3409
- argumentsError: error
3410
- }
3411
- });
3412
- }
3413
- function makeReturnsIssue(returns, error) {
3414
- return makeIssue({
3415
- data: returns,
3416
- path: ctx.path,
3417
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3418
- issueData: {
3419
- code: ZodIssueCode.invalid_return_type,
3420
- returnTypeError: error
3421
- }
3422
- });
3423
- }
3424
- const params = { errorMap: ctx.common.contextualErrorMap };
3425
- const fn = ctx.data;
3426
- if (this._def.returns instanceof ZodPromise) {
3427
- const me = this;
3428
- return OK(async function(...args) {
3429
- const error = new ZodError([]);
3430
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3431
- error.addIssue(makeArgsIssue(args, e));
3432
- throw error;
3433
- });
3434
- const result = await Reflect.apply(fn, this, parsedArgs);
3435
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3436
- error.addIssue(makeReturnsIssue(result, e));
3437
- throw error;
3438
- });
3439
- return parsedReturns;
3440
- });
3441
- } else {
3442
- const me = this;
3443
- return OK(function(...args) {
3444
- const parsedArgs = me._def.args.safeParse(args, params);
3445
- if (!parsedArgs.success) {
3446
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3447
- }
3448
- const result = Reflect.apply(fn, this, parsedArgs.data);
3449
- const parsedReturns = me._def.returns.safeParse(result, params);
3450
- if (!parsedReturns.success) {
3451
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3452
- }
3453
- return parsedReturns.data;
3454
- });
3455
- }
3456
- }
3457
- parameters() {
3458
- return this._def.args;
3459
- }
3460
- returnType() {
3461
- return this._def.returns;
3462
- }
3463
- args(...items) {
3464
- return new _ZodFunction({
3465
- ...this._def,
3466
- args: ZodTuple.create(items).rest(ZodUnknown.create())
3467
- });
3468
- }
3469
- returns(returnType) {
3470
- return new _ZodFunction({
3471
- ...this._def,
3472
- returns: returnType
3473
- });
3474
- }
3475
- implement(func) {
3476
- const validatedFunc = this.parse(func);
3477
- return validatedFunc;
3478
- }
3479
- strictImplement(func) {
3480
- const validatedFunc = this.parse(func);
3481
- return validatedFunc;
3482
- }
3483
- static create(args, returns, params) {
3484
- return new _ZodFunction({
3485
- args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3486
- returns: returns || ZodUnknown.create(),
3487
- typeName: ZodFirstPartyTypeKind.ZodFunction,
3488
- ...processCreateParams(params)
3489
- });
3490
- }
3491
- };
3492
- var ZodLazy = class extends ZodType {
3493
- get schema() {
3494
- return this._def.getter();
3495
- }
3496
- _parse(input) {
3497
- const { ctx } = this._processInputParams(input);
3498
- const lazySchema = this._def.getter();
3499
- return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3500
- }
3501
- };
3502
- ZodLazy.create = (getter, params) => {
3503
- return new ZodLazy({
3504
- getter,
3505
- typeName: ZodFirstPartyTypeKind.ZodLazy,
3506
- ...processCreateParams(params)
3507
- });
3508
- };
3509
- var ZodLiteral = class extends ZodType {
3510
- _parse(input) {
3511
- if (input.data !== this._def.value) {
3512
- const ctx = this._getOrReturnCtx(input);
3513
- addIssueToContext(ctx, {
3514
- received: ctx.data,
3515
- code: ZodIssueCode.invalid_literal,
3516
- expected: this._def.value
3517
- });
3518
- return INVALID;
3519
- }
3520
- return { status: "valid", value: input.data };
3521
- }
3522
- get value() {
3523
- return this._def.value;
3524
- }
3525
- };
3526
- ZodLiteral.create = (value, params) => {
3527
- return new ZodLiteral({
3528
- value,
3529
- typeName: ZodFirstPartyTypeKind.ZodLiteral,
3530
- ...processCreateParams(params)
3531
- });
3532
- };
3533
- function createZodEnum(values, params) {
3534
- return new ZodEnum({
3535
- values,
3536
- typeName: ZodFirstPartyTypeKind.ZodEnum,
3537
- ...processCreateParams(params)
3538
- });
3539
- }
3540
- var ZodEnum = class _ZodEnum extends ZodType {
3541
- _parse(input) {
3542
- if (typeof input.data !== "string") {
3543
- const ctx = this._getOrReturnCtx(input);
3544
- const expectedValues = this._def.values;
3545
- addIssueToContext(ctx, {
3546
- expected: util.joinValues(expectedValues),
3547
- received: ctx.parsedType,
3548
- code: ZodIssueCode.invalid_type
3549
- });
3550
- return INVALID;
3551
- }
3552
- if (!this._cache) {
3553
- this._cache = new Set(this._def.values);
3554
- }
3555
- if (!this._cache.has(input.data)) {
3556
- const ctx = this._getOrReturnCtx(input);
3557
- const expectedValues = this._def.values;
3558
- addIssueToContext(ctx, {
3559
- received: ctx.data,
3560
- code: ZodIssueCode.invalid_enum_value,
3561
- options: expectedValues
3562
- });
3563
- return INVALID;
3564
- }
3565
- return OK(input.data);
3566
- }
3567
- get options() {
3568
- return this._def.values;
3569
- }
3570
- get enum() {
3571
- const enumValues = {};
3572
- for (const val of this._def.values) {
3573
- enumValues[val] = val;
3574
- }
3575
- return enumValues;
3576
- }
3577
- get Values() {
3578
- const enumValues = {};
3579
- for (const val of this._def.values) {
3580
- enumValues[val] = val;
3581
- }
3582
- return enumValues;
3583
- }
3584
- get Enum() {
3585
- const enumValues = {};
3586
- for (const val of this._def.values) {
3587
- enumValues[val] = val;
3588
- }
3589
- return enumValues;
3590
- }
3591
- extract(values, newDef = this._def) {
3592
- return _ZodEnum.create(values, {
3593
- ...this._def,
3594
- ...newDef
3595
- });
3596
- }
3597
- exclude(values, newDef = this._def) {
3598
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3599
- ...this._def,
3600
- ...newDef
3601
- });
3602
- }
3603
- };
3604
- ZodEnum.create = createZodEnum;
3605
- var ZodNativeEnum = class extends ZodType {
3606
- _parse(input) {
3607
- const nativeEnumValues = util.getValidEnumValues(this._def.values);
3608
- const ctx = this._getOrReturnCtx(input);
3609
- if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3610
- const expectedValues = util.objectValues(nativeEnumValues);
3611
- addIssueToContext(ctx, {
3612
- expected: util.joinValues(expectedValues),
3613
- received: ctx.parsedType,
3614
- code: ZodIssueCode.invalid_type
3615
- });
3616
- return INVALID;
3617
- }
3618
- if (!this._cache) {
3619
- this._cache = new Set(util.getValidEnumValues(this._def.values));
3620
- }
3621
- if (!this._cache.has(input.data)) {
3622
- const expectedValues = util.objectValues(nativeEnumValues);
3623
- addIssueToContext(ctx, {
3624
- received: ctx.data,
3625
- code: ZodIssueCode.invalid_enum_value,
3626
- options: expectedValues
3627
- });
3628
- return INVALID;
3629
- }
3630
- return OK(input.data);
3631
- }
3632
- get enum() {
3633
- return this._def.values;
3634
- }
3635
- };
3636
- ZodNativeEnum.create = (values, params) => {
3637
- return new ZodNativeEnum({
3638
- values,
3639
- typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3640
- ...processCreateParams(params)
3641
- });
3642
- };
3643
- var ZodPromise = class extends ZodType {
3644
- unwrap() {
3645
- return this._def.type;
3646
- }
3647
- _parse(input) {
3648
- const { ctx } = this._processInputParams(input);
3649
- if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3650
- addIssueToContext(ctx, {
3651
- code: ZodIssueCode.invalid_type,
3652
- expected: ZodParsedType.promise,
3653
- received: ctx.parsedType
3654
- });
3655
- return INVALID;
3656
- }
3657
- const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3658
- return OK(promisified.then((data) => {
3659
- return this._def.type.parseAsync(data, {
3660
- path: ctx.path,
3661
- errorMap: ctx.common.contextualErrorMap
3662
- });
3663
- }));
3664
- }
3665
- };
3666
- ZodPromise.create = (schema, params) => {
3667
- return new ZodPromise({
3668
- type: schema,
3669
- typeName: ZodFirstPartyTypeKind.ZodPromise,
3670
- ...processCreateParams(params)
3671
- });
3672
- };
3673
- var ZodEffects = class extends ZodType {
3674
- innerType() {
3675
- return this._def.schema;
3676
- }
3677
- sourceType() {
3678
- return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3679
- }
3680
- _parse(input) {
3681
- const { status, ctx } = this._processInputParams(input);
3682
- const effect = this._def.effect || null;
3683
- const checkCtx = {
3684
- addIssue: (arg) => {
3685
- addIssueToContext(ctx, arg);
3686
- if (arg.fatal) {
3687
- status.abort();
3688
- } else {
3689
- status.dirty();
3690
- }
3691
- },
3692
- get path() {
3693
- return ctx.path;
3694
- }
3695
- };
3696
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3697
- if (effect.type === "preprocess") {
3698
- const processed = effect.transform(ctx.data, checkCtx);
3699
- if (ctx.common.async) {
3700
- return Promise.resolve(processed).then(async (processed2) => {
3701
- if (status.value === "aborted")
3702
- return INVALID;
3703
- const result = await this._def.schema._parseAsync({
3704
- data: processed2,
3705
- path: ctx.path,
3706
- parent: ctx
3707
- });
3708
- if (result.status === "aborted")
3709
- return INVALID;
3710
- if (result.status === "dirty")
3711
- return DIRTY(result.value);
3712
- if (status.value === "dirty")
3713
- return DIRTY(result.value);
3714
- return result;
3715
- });
3716
- } else {
3717
- if (status.value === "aborted")
3718
- return INVALID;
3719
- const result = this._def.schema._parseSync({
3720
- data: processed,
3721
- path: ctx.path,
3722
- parent: ctx
3723
- });
3724
- if (result.status === "aborted")
3725
- return INVALID;
3726
- if (result.status === "dirty")
3727
- return DIRTY(result.value);
3728
- if (status.value === "dirty")
3729
- return DIRTY(result.value);
3730
- return result;
3731
- }
3732
- }
3733
- if (effect.type === "refinement") {
3734
- const executeRefinement = (acc) => {
3735
- const result = effect.refinement(acc, checkCtx);
3736
- if (ctx.common.async) {
3737
- return Promise.resolve(result);
3738
- }
3739
- if (result instanceof Promise) {
3740
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3741
- }
3742
- return acc;
3743
- };
3744
- if (ctx.common.async === false) {
3745
- const inner = this._def.schema._parseSync({
3746
- data: ctx.data,
3747
- path: ctx.path,
3748
- parent: ctx
3749
- });
3750
- if (inner.status === "aborted")
3751
- return INVALID;
3752
- if (inner.status === "dirty")
3753
- status.dirty();
3754
- executeRefinement(inner.value);
3755
- return { status: status.value, value: inner.value };
3756
- } else {
3757
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3758
- if (inner.status === "aborted")
3759
- return INVALID;
3760
- if (inner.status === "dirty")
3761
- status.dirty();
3762
- return executeRefinement(inner.value).then(() => {
3763
- return { status: status.value, value: inner.value };
3764
- });
3765
- });
3766
- }
3767
- }
3768
- if (effect.type === "transform") {
3769
- if (ctx.common.async === false) {
3770
- const base = this._def.schema._parseSync({
3771
- data: ctx.data,
3772
- path: ctx.path,
3773
- parent: ctx
3774
- });
3775
- if (!isValid(base))
3776
- return INVALID;
3777
- const result = effect.transform(base.value, checkCtx);
3778
- if (result instanceof Promise) {
3779
- throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3780
- }
3781
- return { status: status.value, value: result };
3782
- } else {
3783
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3784
- if (!isValid(base))
3785
- return INVALID;
3786
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3787
- status: status.value,
3788
- value: result
3789
- }));
3790
- });
3791
- }
3792
- }
3793
- util.assertNever(effect);
3794
- }
3795
- };
3796
- ZodEffects.create = (schema, effect, params) => {
3797
- return new ZodEffects({
3798
- schema,
3799
- typeName: ZodFirstPartyTypeKind.ZodEffects,
3800
- effect,
3801
- ...processCreateParams(params)
3802
- });
3803
- };
3804
- ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3805
- return new ZodEffects({
3806
- schema,
3807
- effect: { type: "preprocess", transform: preprocess },
3808
- typeName: ZodFirstPartyTypeKind.ZodEffects,
3809
- ...processCreateParams(params)
3810
- });
3811
- };
3812
- var ZodOptional = class extends ZodType {
3813
- _parse(input) {
3814
- const parsedType = this._getType(input);
3815
- if (parsedType === ZodParsedType.undefined) {
3816
- return OK(void 0);
3817
- }
3818
- return this._def.innerType._parse(input);
3819
- }
3820
- unwrap() {
3821
- return this._def.innerType;
3822
- }
3823
- };
3824
- ZodOptional.create = (type, params) => {
3825
- return new ZodOptional({
3826
- innerType: type,
3827
- typeName: ZodFirstPartyTypeKind.ZodOptional,
3828
- ...processCreateParams(params)
3829
- });
3830
- };
3831
- var ZodNullable = class extends ZodType {
3832
- _parse(input) {
3833
- const parsedType = this._getType(input);
3834
- if (parsedType === ZodParsedType.null) {
3835
- return OK(null);
3836
- }
3837
- return this._def.innerType._parse(input);
3838
- }
3839
- unwrap() {
3840
- return this._def.innerType;
3841
- }
3842
- };
3843
- ZodNullable.create = (type, params) => {
3844
- return new ZodNullable({
3845
- innerType: type,
3846
- typeName: ZodFirstPartyTypeKind.ZodNullable,
3847
- ...processCreateParams(params)
3848
- });
3849
- };
3850
- var ZodDefault = class extends ZodType {
3851
- _parse(input) {
3852
- const { ctx } = this._processInputParams(input);
3853
- let data = ctx.data;
3854
- if (ctx.parsedType === ZodParsedType.undefined) {
3855
- data = this._def.defaultValue();
3856
- }
3857
- return this._def.innerType._parse({
3858
- data,
3859
- path: ctx.path,
3860
- parent: ctx
3861
- });
3862
- }
3863
- removeDefault() {
3864
- return this._def.innerType;
3865
- }
3866
- };
3867
- ZodDefault.create = (type, params) => {
3868
- return new ZodDefault({
3869
- innerType: type,
3870
- typeName: ZodFirstPartyTypeKind.ZodDefault,
3871
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3872
- ...processCreateParams(params)
3873
- });
3874
- };
3875
- var ZodCatch = class extends ZodType {
3876
- _parse(input) {
3877
- const { ctx } = this._processInputParams(input);
3878
- const newCtx = {
3879
- ...ctx,
3880
- common: {
3881
- ...ctx.common,
3882
- issues: []
3883
- }
3884
- };
3885
- const result = this._def.innerType._parse({
3886
- data: newCtx.data,
3887
- path: newCtx.path,
3888
- parent: {
3889
- ...newCtx
3890
- }
3891
- });
3892
- if (isAsync(result)) {
3893
- return result.then((result2) => {
3894
- return {
3895
- status: "valid",
3896
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
3897
- get error() {
3898
- return new ZodError(newCtx.common.issues);
3899
- },
3900
- input: newCtx.data
3901
- })
3902
- };
3903
- });
3904
- } else {
3905
- return {
3906
- status: "valid",
3907
- value: result.status === "valid" ? result.value : this._def.catchValue({
3908
- get error() {
3909
- return new ZodError(newCtx.common.issues);
3910
- },
3911
- input: newCtx.data
3912
- })
3913
- };
3914
- }
3915
- }
3916
- removeCatch() {
3917
- return this._def.innerType;
3918
- }
3919
- };
3920
- ZodCatch.create = (type, params) => {
3921
- return new ZodCatch({
3922
- innerType: type,
3923
- typeName: ZodFirstPartyTypeKind.ZodCatch,
3924
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3925
- ...processCreateParams(params)
3926
- });
3927
- };
3928
- var ZodNaN = class extends ZodType {
3929
- _parse(input) {
3930
- const parsedType = this._getType(input);
3931
- if (parsedType !== ZodParsedType.nan) {
3932
- const ctx = this._getOrReturnCtx(input);
3933
- addIssueToContext(ctx, {
3934
- code: ZodIssueCode.invalid_type,
3935
- expected: ZodParsedType.nan,
3936
- received: ctx.parsedType
3937
- });
3938
- return INVALID;
3939
- }
3940
- return { status: "valid", value: input.data };
3941
- }
3942
- };
3943
- ZodNaN.create = (params) => {
3944
- return new ZodNaN({
3945
- typeName: ZodFirstPartyTypeKind.ZodNaN,
3946
- ...processCreateParams(params)
3947
- });
3948
- };
3949
- var BRAND = Symbol("zod_brand");
3950
- var ZodBranded = class extends ZodType {
3951
- _parse(input) {
3952
- const { ctx } = this._processInputParams(input);
3953
- const data = ctx.data;
3954
- return this._def.type._parse({
3955
- data,
3956
- path: ctx.path,
3957
- parent: ctx
3958
- });
3959
- }
3960
- unwrap() {
3961
- return this._def.type;
3962
- }
3963
- };
3964
- var ZodPipeline = class _ZodPipeline extends ZodType {
3965
- _parse(input) {
3966
- const { status, ctx } = this._processInputParams(input);
3967
- if (ctx.common.async) {
3968
- const handleAsync = async () => {
3969
- const inResult = await this._def.in._parseAsync({
3970
- data: ctx.data,
3971
- path: ctx.path,
3972
- parent: ctx
3973
- });
3974
- if (inResult.status === "aborted")
3975
- return INVALID;
3976
- if (inResult.status === "dirty") {
3977
- status.dirty();
3978
- return DIRTY(inResult.value);
3979
- } else {
3980
- return this._def.out._parseAsync({
3981
- data: inResult.value,
3982
- path: ctx.path,
3983
- parent: ctx
3984
- });
3985
- }
3986
- };
3987
- return handleAsync();
3988
- } else {
3989
- const inResult = this._def.in._parseSync({
3990
- data: ctx.data,
3991
- path: ctx.path,
3992
- parent: ctx
3993
- });
3994
- if (inResult.status === "aborted")
3995
- return INVALID;
3996
- if (inResult.status === "dirty") {
3997
- status.dirty();
3998
- return {
3999
- status: "dirty",
4000
- value: inResult.value
4001
- };
4002
- } else {
4003
- return this._def.out._parseSync({
4004
- data: inResult.value,
4005
- path: ctx.path,
4006
- parent: ctx
4007
- });
4008
- }
4009
- }
4010
- }
4011
- static create(a, b) {
4012
- return new _ZodPipeline({
4013
- in: a,
4014
- out: b,
4015
- typeName: ZodFirstPartyTypeKind.ZodPipeline
4016
- });
4017
- }
4018
- };
4019
- var ZodReadonly = class extends ZodType {
4020
- _parse(input) {
4021
- const result = this._def.innerType._parse(input);
4022
- const freeze = (data) => {
4023
- if (isValid(data)) {
4024
- data.value = Object.freeze(data.value);
4025
- }
4026
- return data;
4027
- };
4028
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4029
- }
4030
- unwrap() {
4031
- return this._def.innerType;
4032
- }
4033
- };
4034
- ZodReadonly.create = (type, params) => {
4035
- return new ZodReadonly({
4036
- innerType: type,
4037
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
4038
- ...processCreateParams(params)
4039
- });
4040
- };
4041
- function cleanParams(params, data) {
4042
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
4043
- const p2 = typeof p === "string" ? { message: p } : p;
4044
- return p2;
4045
- }
4046
- function custom(check, _params = {}, fatal) {
4047
- if (check)
4048
- return ZodAny.create().superRefine((data, ctx) => {
4049
- const r = check(data);
4050
- if (r instanceof Promise) {
4051
- return r.then((r2) => {
4052
- if (!r2) {
4053
- const params = cleanParams(_params, data);
4054
- const _fatal = params.fatal ?? fatal ?? true;
4055
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4056
- }
4057
- });
4058
- }
4059
- if (!r) {
4060
- const params = cleanParams(_params, data);
4061
- const _fatal = params.fatal ?? fatal ?? true;
4062
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4063
- }
4064
- return;
4065
- });
4066
- return ZodAny.create();
4067
- }
4068
- var late = {
4069
- object: ZodObject.lazycreate
4070
- };
4071
- var ZodFirstPartyTypeKind;
4072
- (function(ZodFirstPartyTypeKind2) {
4073
- ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
4074
- ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
4075
- ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
4076
- ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
4077
- ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
4078
- ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
4079
- ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
4080
- ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
4081
- ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
4082
- ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
4083
- ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
4084
- ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
4085
- ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
4086
- ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
4087
- ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
4088
- ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
4089
- ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
4090
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
4091
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
4092
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
4093
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
4094
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
4095
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
4096
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
4097
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
4098
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
4099
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
4100
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
4101
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
4102
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
4103
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
4104
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
4105
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4106
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4107
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4108
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
4109
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4110
- var instanceOfType = (cls, params = {
4111
- message: `Input not instance of ${cls.name}`
4112
- }) => custom((data) => data instanceof cls, params);
4113
- var stringType = ZodString.create;
4114
- var numberType = ZodNumber.create;
4115
- var nanType = ZodNaN.create;
4116
- var bigIntType = ZodBigInt.create;
4117
- var booleanType = ZodBoolean.create;
4118
- var dateType = ZodDate.create;
4119
- var symbolType = ZodSymbol.create;
4120
- var undefinedType = ZodUndefined.create;
4121
- var nullType = ZodNull.create;
4122
- var anyType = ZodAny.create;
4123
- var unknownType = ZodUnknown.create;
4124
- var neverType = ZodNever.create;
4125
- var voidType = ZodVoid.create;
4126
- var arrayType = ZodArray.create;
4127
- var objectType = ZodObject.create;
4128
- var strictObjectType = ZodObject.strictCreate;
4129
- var unionType = ZodUnion.create;
4130
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
4131
- var intersectionType = ZodIntersection.create;
4132
- var tupleType = ZodTuple.create;
4133
- var recordType = ZodRecord.create;
4134
- var mapType = ZodMap.create;
4135
- var setType = ZodSet.create;
4136
- var functionType = ZodFunction.create;
4137
- var lazyType = ZodLazy.create;
4138
- var literalType = ZodLiteral.create;
4139
- var enumType = ZodEnum.create;
4140
- var nativeEnumType = ZodNativeEnum.create;
4141
- var promiseType = ZodPromise.create;
4142
- var effectsType = ZodEffects.create;
4143
- var optionalType = ZodOptional.create;
4144
- var nullableType = ZodNullable.create;
4145
- var preprocessType = ZodEffects.createWithPreprocess;
4146
- var pipelineType = ZodPipeline.create;
4147
- var ostring = () => stringType().optional();
4148
- var onumber = () => numberType().optional();
4149
- var oboolean = () => booleanType().optional();
4150
- var coerce = {
4151
- string: (arg) => ZodString.create({ ...arg, coerce: true }),
4152
- number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
4153
- boolean: (arg) => ZodBoolean.create({
4154
- ...arg,
4155
- coerce: true
4156
- }),
4157
- bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
4158
- date: (arg) => ZodDate.create({ ...arg, coerce: true })
4159
- };
4160
- var NEVER = INVALID;
4161
-
4162
- // ../../node_modules/.pnpm/zod@3.25.68/node_modules/zod/v3/index.js
4163
- var v3_default = external_exports;
4164
-
4165
- // lib/imports/models/ImportDetail.ts
4166
- var importDetailSchema = v3_exports.object({
4167
- completedAt: v3_exports.number().nullish(),
4168
- errorCount: v3_exports.number(),
4169
- importId: v3_exports.number(),
4170
- name: v3_exports.string(),
4171
- startedAt: v3_exports.string().nullish(),
4172
- status: v3_exports.string(),
4173
- uploadedAt: v3_exports.string()
4174
- });
4175
-
4176
- // lib/imports/models/Import.ts
4177
- var importSchema = v3_exports.object({
4178
- count: v3_exports.number(),
4179
- imports: v3_exports.array(importDetailSchema)
4180
- });
4181
-
4182
- // lib/imports/models/ImportError.ts
4183
- var importErrorSchema = v3_exports.object({
4184
- attribute: v3_exports.string().nullish(),
4185
- description: v3_exports.string(),
4186
- importErrorId: v3_exports.number(),
4187
- row: v3_exports.number()
4188
- });
4189
-
4190
- // lib/imports/models/ImportErrors.ts
4191
- var importErrorsSchema = v3_exports.object({
4192
- count: v3_exports.number(),
4193
- errors: v3_exports.array(importErrorSchema),
4194
- hasNext: v3_exports.boolean(),
4195
- importId: v3_exports.number(),
4196
- totalCount: v3_exports.number()
4197
- });
4198
-
4199
- // lib/imports/models/ImportsStatusEnum.ts
4200
- var importStatusEnumSchema = v3_exports.enum([
4201
- "QUEUED_FOR_IMPORT",
4202
- "IN_PROGRESS",
4203
- "DOC_FAILED",
4204
- "VALIDATION_FAILED",
4205
- "COMPLETED"
4206
- ]);
4207
-
4208
- // lib/imports/models/ImportsStatus.ts
4209
- var importsStatusSchema = v3_exports.object({
4210
- completedAt: v3_exports.string().nullish(),
4211
- docInEventId: v3_exports.string().nullish(),
4212
- errorCount: v3_exports.number().nullish(),
4213
- importId: v3_exports.number(),
4214
- invalidItemCount: v3_exports.number().nullish(),
4215
- name: v3_exports.string().nullish(),
4216
- status: importStatusEnumSchema,
4217
- totalItemCount: v3_exports.number().nullish(),
4218
- validItemCount: v3_exports.number().nullish()
4219
- });
4220
-
4221
- // lib/imports/models/VendorPartnerAttGroups.ts
4222
- var vendorPartnerAttGroupsSchema = v3_exports.object({
4223
- partnerCompanyId: v3_exports.number(),
4224
- partnerCompanyName: v3_exports.string(),
4225
- partnerAttributeGroups: v3_exports.array(v3_exports.number())
4226
- });
4227
-
4228
- // lib/imports/models/GenerateImportTemplateParams.ts
4229
- var generateImportTemplateParamsSchema = v3_exports.object({
4230
- "multi-sheet": v3_exports.boolean(),
4231
- gids: v3_exports.string().optional(),
4232
- productTypeIds: v3_exports.string().optional(),
4233
- groupTypeId: v3_exports.number().optional(),
4234
- includeGuides: v3_exports.boolean().optional()
4235
- });
4236
-
4237
- // lib/productTypes/models/AttrProdType.ts
4238
- var attrProdTypeSchema = v3_exports.object({
4239
- attrProdTypeId: v3_exports.number(),
4240
- productType: v3_exports.string(),
4241
- description: v3_exports.string(),
4242
- createdDate: v3_exports.number(),
4243
- createdBy: v3_exports.string(),
4244
- modifiedDate: v3_exports.number().optional(),
4245
- modifiedBy: v3_exports.string().optional(),
4246
- retailerId: v3_exports.number().optional()
4247
- });
4248
-
4249
- // lib/productTypes/models/PagedResults.ts
4250
- function pagedResultsSchema(resultsType) {
4251
- return v3_exports.object({
4252
- next: v3_exports.string(),
4253
- previous: v3_exports.string(),
4254
- count: v3_exports.number(),
4255
- results: v3_exports.array(resultsType)
4256
- });
4257
- }
4258
-
4259
- // lib/tradingPartners/models/Connection.ts
4260
- var connectionSchema = v3_exports.object({
4261
- catalog_id: v3_exports.number(),
4262
- catalog_name: v3_exports.string().nullable(),
4263
- partner_company_name: v3_exports.string(),
4264
- partner_company_id: v3_exports.number(),
4265
- partner_org_id: v3_exports.string()
4266
- });
4267
-
4268
- // lib/tradingPartners/models/CompanyRelationshipUpsertBody.ts
4269
- var companyRelationshipUpsertBodySchema = v3_exports.object({
4270
- supplierId: v3_exports.number(),
4271
- retailerId: v3_exports.number(),
4272
- catalogId: v3_exports.number(),
4273
- active: v3_exports.boolean(),
4274
- applicationType: v3_exports.array(v3_exports.enum(["ASSORTMENT", "ITEM-XREF", "TEST-ORDER-GENERATOR"])).default([])
4275
- });
4276
-
4277
- // lib/tradingPartners/models/ItemPartner.ts
4278
- var itemPartnerSchema = v3_exports.object({
4279
- itemPartnerId: v3_exports.number(),
4280
- retailerId: v3_exports.number(),
4281
- supplierId: v3_exports.number(),
4282
- catalogId: v3_exports.number(),
4283
- isActive: v3_exports.number(),
4284
- createdDate: v3_exports.string(),
4285
- modifiedDate: v3_exports.string(),
4286
- applications: v3_exports.array(v3_exports.enum(["ASSORTMENT", "ITEM-XREF"]))
4287
- });
4288
-
4289
- // lib/tradingPartners/models/TradingPartnerAccessByCompanyId.ts
4290
- var tradingPartnerAccessByCompanyIdSchema = v3_exports.object({
4291
- companyId: v3_exports.number(),
4292
- companyType: v3_exports.string(),
4293
- identityOrgId: v3_exports.string(),
4294
- companyName: v3_exports.string(),
4295
- count: v3_exports.number(),
4296
- connections: v3_exports.array(connectionSchema)
4297
- });
4298
-
4299
- // lib/categories/models/ItemCategory.ts
4300
- var itemCategorySchema = v3_exports.object({
4301
- categoryid: v3_exports.number(),
4302
- encodedCategoryId: v3_exports.string(),
4303
- companyId: v3_exports.number(),
4304
- name: v3_exports.string(),
4305
- isActive: v3_exports.number(),
4306
- createdDate: v3_exports.number().nullish(),
4307
- categorytimestamp: v3_exports.number().nullish(),
4308
- typeId: v3_exports.number(),
4309
- type: v3_exports.string(),
4310
- categorykey: v3_exports.string().nullish(),
4311
- description: v3_exports.string().nullish(),
4312
- categoryCatalogName: v3_exports.string().nullish()
4313
- });
4314
-
4315
- // lib/categories/models/ItemCategoriesSearch.ts
4316
- var itemCategoriesSearchSchema = v3_exports.object({
4317
- count: v3_exports.number(),
4318
- data: v3_exports.array(itemCategorySchema)
4319
- });
4320
-
4321
- // lib/categories/models/ItemHierarchyResponse.ts
4322
- var baseHierarchySchema = v3_exports.object({
4323
- id: v3_exports.string(),
4324
- name: v3_exports.string().nullish(),
4325
- description: v3_exports.string().nullish(),
4326
- type: v3_exports.string().nullish()
4327
- });
4328
- var hierarchySchema = baseHierarchySchema.extend({
4329
- child: v3_exports.lazy(() => hierarchySchema).nullable()
4330
- });
4331
- var itemHierarchyResponseSchema = v3_exports.object({
4332
- itemHierarchies: v3_exports.array(
4333
- v3_exports.object({
4334
- itemId: v3_exports.string(),
4335
- hierarchies: v3_exports.array(hierarchySchema)
4336
- })
4337
- )
4338
- });
4339
-
4340
- // lib/locale/models/Locale.ts
4341
- var localeSchema = v3_exports.object({
4342
- localeCode: v3_exports.string(),
4343
- localeDescription: v3_exports.string()
4344
- });
4345
-
4346
- // lib/spreadsheetTemplate/models/SpreadsheetTemplateCompany.ts
4347
- var spreadsheetTemplateCompanySchema = v3_exports.object({
4348
- companyName: v3_exports.string(),
4349
- companyId: v3_exports.number(),
4350
- createdAt: v3_exports.number()
4351
- });
4352
-
4353
- // lib/spreadsheetTemplate/models/SpreadsheetTemplate.ts
4354
- var spreadsheetTemplateSchema = v3_exports.object({
4355
- id: v3_exports.number(),
4356
- fileLocation: v3_exports.string(),
4357
- name: v3_exports.string(),
4358
- templateType: v3_exports.string(),
4359
- maxItemsPerDoc: v3_exports.number(),
4360
- companies: v3_exports.array(spreadsheetTemplateCompanySchema),
4361
- createdBy: v3_exports.string().nullish(),
4362
- createdAt: v3_exports.number().nullish(),
4363
- modifiedBy: v3_exports.string().nullish(),
4364
- modifiedAt: v3_exports.number().nullish()
4365
- });
4366
-
4367
- // lib/whoami/models/IdentityServiceDatetimePreferences.ts
4368
- var identityServiceDatetimePreferencesSchema = v3_exports.object({
4369
- DATE_TIME: v3_exports.string(),
4370
- TIME: v3_exports.string(),
4371
- SHORT_DATE: v3_exports.string(),
4372
- LONG_DATETIME: v3_exports.string(),
4373
- LONG_TIME: v3_exports.string(),
4374
- DATE: v3_exports.string()
4375
- });
4376
-
4377
- // lib/whoami/models/IdentityServiceOrganizationMetadata.ts
4378
- var identityServiceOrganizationMetadataSchema = v3_exports.object({
4379
- namespace: v3_exports.string(),
4380
- key: v3_exports.string(),
4381
- value: v3_exports.string()
4382
- });
4383
-
4384
- // lib/whoami/models/IdentityServiceOrganization.ts
4385
- var identityServiceOrganizationSchema = v3_exports.object({
4386
- organization_name: v3_exports.string().optional(),
4387
- organization_site: v3_exports.string().optional(),
4388
- namespace: v3_exports.string().optional(),
4389
- id: v3_exports.string(),
4390
- permissions: v3_exports.array(v3_exports.string()).optional(),
4391
- metadata: identityServiceOrganizationMetadataSchema.optional()
4392
- });
4393
-
4394
- // lib/whoami/models/IdentityServicePreferences.ts
4395
- var identityServicePreferencesSchema = v3_exports.object({
4396
- locale: v3_exports.string(),
4397
- timezone: v3_exports.string(),
4398
- cpUpgrade: v3_exports.string().optional(),
4399
- language: v3_exports.array(v3_exports.string()),
4400
- datetime: identityServiceDatetimePreferencesSchema
4401
- });
4402
-
4403
- // lib/whoami/models/IdentityServiceUser.ts
4404
- var identityServiceUserSchema = v3_exports.object({
4405
- id: v3_exports.string(),
4406
- email: v3_exports.string().optional(),
4407
- first_name: v3_exports.string().optional(),
4408
- last_name: v3_exports.string().optional(),
4409
- job_title: v3_exports.string().optional(),
4410
- externally_managed: v3_exports.boolean().optional(),
4411
- city: v3_exports.string().optional(),
4412
- name: v3_exports.string(),
4413
- state: v3_exports.string().optional(),
4414
- country: v3_exports.string().optional(),
4415
- user_type: v3_exports.string().optional(),
4416
- token_type: v3_exports.string().optional(),
4417
- avatar_image_id: v3_exports.string().optional(),
4418
- avatar_image_url: v3_exports.string().optional(),
4419
- origin_avatar_image_id: v3_exports.string().optional(),
4420
- bio: v3_exports.string().optional(),
4421
- phone_number: v3_exports.string().optional(),
4422
- twitter_handle: v3_exports.string().optional(),
4423
- linkedin_url: v3_exports.string().optional(),
4424
- description: v3_exports.string().optional(),
4425
- preferences: identityServicePreferencesSchema.optional(),
4426
- roles: v3_exports.array(v3_exports.string()),
4427
- organization: identityServiceOrganizationSchema,
4428
- password: v3_exports.string(),
4429
- verified: v3_exports.boolean()
4430
- });
4431
-
4432
- // lib/whoami/models/RegisteredService.ts
4433
- var registeredServiceSchema = v3_exports.object({
4434
- serviceId: v3_exports.number(),
4435
- identityServiceId: v3_exports.number(),
4436
- name: v3_exports.string(),
4437
- isActive: v3_exports.boolean()
4438
- });
4439
-
4440
- // lib/whoami/models/UserAccount.ts
4441
- var userAccountSchema = v3_exports.object({
4442
- identityUser: identityServiceUserSchema,
4443
- companyId: v3_exports.number(),
4444
- companyName: v3_exports.string(),
4445
- name: v3_exports.string(),
4446
- assortmentPartnerCompanyId: v3_exports.number().nullish(),
4447
- retailer: v3_exports.boolean(),
4448
- supplier: v3_exports.boolean(),
4449
- registeredService: registeredServiceSchema,
4450
- uniqueAttributes: v3_exports.array(v3_exports.string()),
4451
- admin: v3_exports.boolean(),
4452
- adminToolUser: v3_exports.boolean(),
4453
- attributeRegistryAdmin: v3_exports.boolean(),
4454
- attributeRegistryDev: v3_exports.boolean(),
4455
- attributeRegistryRsx: v3_exports.boolean(),
4456
- attributeRegistryUser: v3_exports.boolean(),
4457
- attributeRegistryViewer: v3_exports.boolean()
4458
- });
4459
-
4460
- // lib/items/v1/models/ItemHeader.ts
4461
- var itemHeaderSchema = v3_exports.object({
4462
- status: v3_exports.string().optional(),
4463
- catalogName: v3_exports.string(),
4464
- productCodeName: v3_exports.string(),
4465
- selectionCodeName: v3_exports.string(),
4466
- gtin: v3_exports.string(),
4467
- upc: v3_exports.string(),
4468
- ean: v3_exports.string(),
4469
- isbn: v3_exports.string(),
4470
- partNumber: v3_exports.string(),
4471
- lastUpdatedDateString: v3_exports.string(),
4472
- companyId: v3_exports.string(),
4473
- itemInfoId: v3_exports.string()
4474
- });
4475
-
4476
- // lib/items/v1/models/PhaseEnum.ts
4477
- var phaseEnumSchema = v3_exports.enum([
4478
- "CORE",
4479
- "CORE_PLUS",
4480
- "CORE_ADVANCED",
4481
- "ENRICHED",
4482
- "STANDARD_REQUIREMENTS"
4483
- ]);
4484
-
4485
- // lib/items/v1/models/TradingPartnerStage.ts
4486
- var tradingPartnerStageSchema = v3_exports.object({
4487
- companyId: v3_exports.number(),
4488
- companyName: v3_exports.string(),
4489
- stage: v3_exports.nullable(phaseEnumSchema),
4490
- isValid: v3_exports.boolean()
4491
- });
4492
-
4493
- // lib/items/v1/models/ItemMap.ts
4494
- var itemMapSchema = v3_exports.object({
4495
- rn: v3_exports.number().optional(),
4496
- iteminfoid: v3_exports.string(),
4497
- tradingPartnerStages: v3_exports.array(tradingPartnerStageSchema).optional(),
4498
- gtin: v3_exports.string().nullish(),
4499
- catalogname: v3_exports.string().nullish(),
4500
- isbn: v3_exports.string().nullish(),
4501
- lastupdateddatestring: v3_exports.string().nullish(),
4502
- upc: v3_exports.string().nullish(),
4503
- productcodename: v3_exports.string().nullish(),
4504
- ean: v3_exports.string().nullish(),
4505
- selectioncodename: v3_exports.string().nullish(),
4506
- createddatestring: v3_exports.string().nullish(),
4507
- partnumber: v3_exports.string().nullish(),
4508
- consumeravailabledatestring: v3_exports.string().nullish(),
4509
- status: v3_exports.string().nullish(),
4510
- nrfcolorcode: v3_exports.array(v3_exports.string()).nullish(),
4511
- nrfsizecode: v3_exports.array(v3_exports.string()).nullish(),
4512
- productcolordescription: v3_exports.array(v3_exports.string()).nullish(),
4513
- productsizedescription: v3_exports.array(v3_exports.string()).nullish()
4514
- }).passthrough();
4515
-
4516
- // lib/items/v1/models/ItemTable.ts
4517
- var itemTableSchema = v3_exports.object({
4518
- headers: itemHeaderSchema,
4519
- itemMaps: v3_exports.array(itemMapSchema)
4520
- });
4521
-
4522
- // lib/items/v1/models/ItemSearchView.ts
4523
- var itemSearchViewSchema = v3_exports.object({
4524
- itemTable: itemTableSchema,
4525
- hasNext: v3_exports.boolean(),
4526
- count: v3_exports.number()
4527
- });
4528
-
4529
- // lib/items/v1/models/AttrDatatypeNameEnum.ts
4530
- var attrDatatypeNameEnumSchema = v3_exports.enum([
4531
- "TEXT",
4532
- "SET",
4533
- "INTEGER",
4534
- "FLOAT",
4535
- "BOOLEAN",
4536
- "DATE",
4537
- "KEYVALUE",
4538
- "REFERENCE",
4539
- // Not used anymore
4540
- "STRING",
4541
- "REAL"
4542
- ]);
4543
-
4544
- // lib/items/v1/models/AttributeDetail.ts
4545
- var attributeDetailSchema = v3_exports.object({
4546
- type: attrDatatypeNameEnumSchema,
4547
- name: v3_exports.string(),
4548
- value: v3_exports.string().or(v3_exports.number()).or(v3_exports.array(v3_exports.string())).or(v3_exports.array(v3_exports.number())).nullable(),
4549
- label: v3_exports.string(),
4550
- group: v3_exports.string(),
4551
- orderBy: v3_exports.number().or(v3_exports.string()).nullish()
4552
- });
4553
-
4554
- // lib/items/v1/models/CategoryEnum.ts
4555
- var categoryEnumSchema = v3_exports.enum([
4556
- "ALIAS",
4557
- "CATALOG",
4558
- "EXPORT",
4559
- "LEGACY_PRODUCT_TYPE",
4560
- "PRODUCT_CLASSIFICATION",
4561
- "PRODUCT_CODE",
4562
- "SELECTION_CODE",
4563
- "TAG",
4564
- "TAXONOMY_ROOT"
4565
- ]);
4566
-
4567
- // lib/items/v1/models/ComponentDetails.ts
4568
- var componentDetailsSchema = v3_exports.object({
4569
- itemInfoId: v3_exports.number(),
4570
- description: v3_exports.string().nullish(),
4571
- saleable: v3_exports.boolean(),
4572
- valid: v3_exports.boolean(),
4573
- uniqueCriteria: v3_exports.array(
4574
- v3_exports.object({
4575
- name: v3_exports.string(),
4576
- value: v3_exports.string()
4577
- })
4578
- )
4579
- });
4580
-
4581
- // lib/items/v1/models/RepeatableGroup.ts
4582
- var repeatableGroupSchema = v3_exports.object({
4583
- repeatableGroupId: v3_exports.string(),
4584
- repeatableNumber: v3_exports.number()
4585
- });
4586
-
4587
- // lib/items/v1/models/GroupedAttributeList.ts
4588
- var groupedAttributeListSchema = v3_exports.object({
4589
- type: v3_exports.string(),
4590
- rows: v3_exports.array(v3_exports.array(attributeDetailSchema)),
4591
- repeatableGroups: v3_exports.array(repeatableGroupSchema)
4592
- });
4593
-
4594
- // lib/items/v1/models/GroupedAttributes.ts
4595
- var groupedAttributesSchema = v3_exports.object({
4596
- type: v3_exports.string(),
4597
- attributes: v3_exports.array(attributeDetailSchema),
4598
- attributeGroups: v3_exports.array(groupedAttributeListSchema)
4599
- });
4600
-
4601
- // lib/items/v1/models/HierarchyCategory.ts
4602
- var hierarchyCategorySchema = v3_exports.object({
4603
- name: v3_exports.string(),
4604
- description: v3_exports.string().nullish(),
4605
- id: v3_exports.number(),
4606
- companyId: v3_exports.number().nullish(),
4607
- type: categoryEnumSchema
4608
- });
4609
-
4610
- // lib/items/v1/models/HierarchyDetails.ts
4611
- var hierarchyDetailsSchema = v3_exports.object({
4612
- catalogs: v3_exports.array(hierarchyCategorySchema),
4613
- selectionCodes: v3_exports.array(hierarchyCategorySchema),
4614
- productCodes: v3_exports.array(hierarchyCategorySchema)
4615
- });
4616
-
4617
- // lib/items/v1/models/PackComponentItemInfo.ts
4618
- var packComponentItemInfoSchema = v3_exports.object({
4619
- companyid: v3_exports.number(),
4620
- createddate: v3_exports.number(),
4621
- isServiceApi: v3_exports.boolean(),
4622
- isactive: v3_exports.number(),
4623
- isvalid: v3_exports.number(),
4624
- itemType: v3_exports.string(),
4625
- iteminfoid: v3_exports.number(),
4626
- itemtimestamp: v3_exports.number(),
4627
- serviceId: v3_exports.number(),
4628
- attributes: v3_exports.record(v3_exports.string(), v3_exports.string().or(v3_exports.array(v3_exports.string())))
4629
- });
4630
-
4631
- // lib/items/v1/models/ItemPrice.ts
4632
- var itemPriceSchema = v3_exports.object({
4633
- amount: v3_exports.number(),
4634
- currency: v3_exports.string(),
4635
- id: v3_exports.number().nullish(),
4636
- priceDivision: v3_exports.string().nullish(),
4637
- iteminfoid: v3_exports.number().nullish(),
4638
- startdate: v3_exports.string().nullish(),
4639
- enddate: v3_exports.string().nullish(),
4640
- qualifier: v3_exports.string(),
4641
- region: v3_exports.string().nullish(),
4642
- regionqualifier: v3_exports.string().nullish(),
4643
- regiondescription: v3_exports.string().nullish(),
4644
- partnercompanyid: v3_exports.string().nullish(),
4645
- itempricetimestamp: v3_exports.number().nullish(),
4646
- range_type: v3_exports.string().nullish(),
4647
- date_range_type: v3_exports.string().nullish(),
4648
- min_range: v3_exports.number().nullish(),
4649
- gtin: v3_exports.string().nullish(),
4650
- priceConditionDescription: v3_exports.string().nullish(),
4651
- priceUnitQuantity: v3_exports.number().nullish(),
4652
- priceUnitQuantityUOM: v3_exports.string().nullish()
4653
- });
4654
-
4655
- // lib/items/v1/models/PackComponentDetails.ts
4656
- var packComponentDetailsSchema = v3_exports.object({
4657
- itemInfo: packComponentItemInfoSchema,
4658
- itemPrices: v3_exports.array(itemPriceSchema)
4659
- });
4660
-
4661
- // lib/items/v1/models/GroupedItem.ts
4662
- var groupedItemSchema = v3_exports.object({
4663
- iteminfoid: v3_exports.number(),
4664
- companyid: v3_exports.number(),
4665
- status: v3_exports.string(),
4666
- createdDate: v3_exports.string(),
4667
- lastUpdatedDate: v3_exports.string(),
4668
- identifiers: v3_exports.record(v3_exports.string(), v3_exports.any()),
4669
- hierarchyDetails: hierarchyDetailsSchema,
4670
- groupedAttributes: v3_exports.array(groupedAttributesSchema),
4671
- packComponentDetails: v3_exports.array(packComponentDetailsSchema),
4672
- childComponentDetails: v3_exports.array(componentDetailsSchema),
4673
- parentComponentDetails: v3_exports.array(componentDetailsSchema),
4674
- locales: v3_exports.array(v3_exports.string())
4675
- });
4676
-
4677
- // lib/items/v1/models/ItemDetailView.ts
4678
- var itemDetailViewSchema = v3_exports.object({
4679
- item: groupedItemSchema
4680
- });
4681
-
4682
- // lib/items/v1/models/Bulb.ts
4683
- var bulbSchema = v3_exports.object({
4684
- iteminfoid: v3_exports.number(),
4685
- id: v3_exports.number(),
4686
- shape: v3_exports.string(),
4687
- position: v3_exports.number(),
4688
- quantity: v3_exports.number(),
4689
- basetype: v3_exports.string(),
4690
- maxwatt: v3_exports.number(),
4691
- createdat: v3_exports.string(),
4692
- modifiedat: v3_exports.string(),
4693
- bulbtype: v3_exports.string(),
4694
- bulbincluded: v3_exports.string(),
4695
- bulbsize: v3_exports.string(),
4696
- replacementbulb: v3_exports.string(),
4697
- threewaybulb: v3_exports.string()
4698
- });
4699
-
4700
- // lib/items/v1/models/PackComponent.ts
4701
- var packComponentSchema = v3_exports.object({
4702
- itemInfoId: v3_exports.number().nullish(),
4703
- attributes: v3_exports.record(v3_exports.string(), v3_exports.string().or(v3_exports.array(v3_exports.string()))),
4704
- prices: v3_exports.array(itemPriceSchema)
4705
- });
4706
-
4707
- // lib/items/v1/models/MediaItem.ts
4708
- var mediaItemSchema = v3_exports.object({
4709
- id: v3_exports.number(),
4710
- iteminfoid: v3_exports.number(),
4711
- medianame: v3_exports.string(),
4712
- height: v3_exports.number().nullish(),
4713
- filename: v3_exports.string(),
4714
- mediafilename: v3_exports.string().nullish(),
4715
- description: v3_exports.string().nullish(),
4716
- filesize: v3_exports.number().nullish(),
4717
- format: v3_exports.string().nullish(),
4718
- orientation: v3_exports.string().nullish(),
4719
- pixeldensity: v3_exports.string().nullish(),
4720
- purpose: v3_exports.string().nullish(),
4721
- width: v3_exports.number().nullish(),
4722
- mediatype: v3_exports.string(),
4723
- mediaviewtype: v3_exports.string().nullish(),
4724
- compressionquality: v3_exports.string().nullish(),
4725
- thumbnailflag: v3_exports.string().nullish()
4726
- });
4727
-
4728
- // lib/items/v1/models/ItemDetail.ts
4729
- var itemDetailSchema = v3_exports.object({
4730
- attributes: v3_exports.record(v3_exports.string(), v3_exports.any()),
4731
- clusters: v3_exports.record(
4732
- v3_exports.string(),
4733
- v3_exports.array(
4734
- v3_exports.object({
4735
- itemInfoAttributes: v3_exports.record(
4736
- v3_exports.string(),
4737
- v3_exports.string().or(v3_exports.number()).or(v3_exports.boolean())
4738
- )
4739
- })
4740
- )
4741
- ),
4742
- prices: v3_exports.array(itemPriceSchema),
4743
- bulbs: v3_exports.array(bulbSchema),
4744
- media: v3_exports.array(mediaItemSchema),
4745
- packs: v3_exports.array(packComponentSchema)
4746
- });
4747
-
4748
- // lib/items/v1/models/SpsItemIdResponse.ts
4749
- var spsItemIdResponseSchema = v3_exports.object({
4750
- id: v3_exports.string(),
4751
- ref: v3_exports.string()
4752
- });
4753
-
4754
- // lib/items/v1/models/ItemOrgStatus.ts
4755
- var itemOrgStatusSchema = v3_exports.object({
4756
- org: v3_exports.object({
4757
- ref: v3_exports.string(),
4758
- id: v3_exports.string(),
4759
- name: v3_exports.string()
4760
- }),
4761
- lowestInvalidStage: phaseEnumSchema.nullable(),
4762
- validForRelationship: v3_exports.boolean()
4763
- });
4764
-
4765
- // lib/items/v1/models/ItemStatus.ts
4766
- var itemStatusSchema = v3_exports.object({
4767
- itemId: v3_exports.string(),
4768
- itemOrgStatuses: v3_exports.array(itemOrgStatusSchema)
4769
- });
4770
-
4771
- // lib/items/v1/models/ItemStatusResponse.ts
4772
- var itemStatusResponseSchema = v3_exports.object({
4773
- itemStatuses: v3_exports.array(itemStatusSchema)
4774
- });
4775
-
4776
- // lib/errors/v1/models/ItemErrorDetails.ts
4777
- var itemErrorDetailsSchema = v3_exports.object({
4778
- errorMessage: v3_exports.string(),
4779
- attributeName: v3_exports.string().nullable(),
4780
- tradingPartnerNames: v3_exports.array(v3_exports.string()),
4781
- phases: v3_exports.array(phaseEnumSchema),
4782
- attributeDbNames: v3_exports.array(v3_exports.string()),
4783
- tradingPartnerStages: v3_exports.array(tradingPartnerStageSchema),
4784
- repeatableGroupId: v3_exports.string().nullish()
4785
- });
4786
-
4787
- // lib/errors/v1/models/ItemErrorDetailsResult.ts
4788
- var itemErrorDetailsResultSchema = v3_exports.object({
4789
- itemInfoId: v3_exports.number(),
4790
- upc: v3_exports.string().nullish(),
4791
- isbn: v3_exports.string().nullish(),
4792
- gtin: v3_exports.string().nullish(),
4793
- partnumber: v3_exports.string().nullish(),
4794
- ean: v3_exports.string().nullish(),
4795
- itemName: v3_exports.string().nullable(),
4796
- itemErrorDetails: v3_exports.array(itemErrorDetailsSchema)
4797
- });
4798
-
4799
- // lib/items/v2/models/Stage.ts
4800
- var stageSchema = v3_exports.enum([
4801
- "CORE",
4802
- "CORE_PLUS",
4803
- "CORE_ADVANCED",
4804
- "ENRICHED"
4805
- ]);
4806
-
4807
- // lib/items/v2/models/OrgSummary.ts
4808
- var orgSummarySchema = v3_exports.object({
4809
- ref: v3_exports.string(),
4810
- id: v3_exports.string(),
4811
- name: v3_exports.string()
4812
- });
4813
-
4814
- // lib/items/v2/models/ItemOrgStageDetails.ts
4815
- var itemOrgStageDetailsSchema = v3_exports.object({
4816
- /**
4817
- * When called as retailer, the vendor, else when vendor, the retailer.
4818
- * */
4819
- orgSummary: orgSummarySchema,
4820
- /**
4821
- * The company id of the retailer or vendor used for matching ItemOrgStageDetails to TradingPartnerStage for ErrorService
4822
- */
4823
- companyId: v3_exports.number().nullish(),
4824
- /**
4825
- * "Standard Requirements" (null) UNLESS the retailer of the item is MSIS Enabled
4826
- * OTHERWISE the retailer default Stage UNLESS there's a currently active vendor-specific Stage defined
4827
- * OTHERWISE the trading partnership Stage UNLESS there's a currently active Item Level override defined
4828
- * OTHERWISE the item level override */
4829
- stage: stageSchema.nullish(),
4830
- /**
4831
- * If the item is valid for the active stage. Note that for "Standard Requirements" or
4832
- * "Enriched" this cam come directly from the item_doc table, but anything else requires validation
4833
- */
4834
- isValid: v3_exports.boolean(),
4835
- /**
4836
- * Not null if there's an item level policy override for this trading partnership
4837
- */
4838
- itemPolicyId: v3_exports.string().nullish(),
4839
- /**
4840
- * Start date for the Item level Stage if applicable
4841
- */
4842
- startDate: v3_exports.number().transform((num) => new Date(num * 1e3)).nullish(),
4843
- /**
4844
- * End date for the Item level Stage if applicable
4845
- */
4846
- endDate: v3_exports.number().transform((num) => new Date(num * 1e3)).nullish()
4847
- });
4848
-
4849
- // lib/items/v2/models/ItemStatusV2.ts
4850
- var itemStatusV2Schema = v3_exports.object({
4851
- itemId: v3_exports.string(),
4852
- mostRestrictiveRetailerStage: stageSchema.nullable(),
4853
- itemOrgStageDetails: v3_exports.array(itemOrgStageDetailsSchema)
4854
- });
4855
-
4856
- // lib/items/v2/models/ItemStatusV2Response.ts
4857
- var itemStatusV2ResponseSchema = v3_exports.object({
4858
- itemStatuses: v3_exports.array(itemStatusV2Schema)
4859
- });
4860
-
4861
- // lib/errors/v2/models/TradingPartnerStage.ts
4862
- var tradingPartnerStageV2Schema = v3_exports.object({
4863
- companyId: v3_exports.number(),
4864
- companyName: v3_exports.string(),
4865
- stage: stageSchema.nullish(),
4866
- isValid: v3_exports.boolean()
4867
- });
4868
-
4869
- // lib/errors/v2/models/ItemErrorSummary.ts
4870
- var itemErrorSummaryV2Schema = v3_exports.object({
4871
- itemInfoId: v3_exports.number(),
4872
- upc: v3_exports.string().nullish(),
4873
- isbn: v3_exports.string().nullish(),
4874
- gtin: v3_exports.string().nullish(),
4875
- ean: v3_exports.string().nullish(),
4876
- partnumber: v3_exports.string().nullish(),
4877
- colorfamily: v3_exports.string().nullish(),
4878
- fit: v3_exports.string().nullish(),
4879
- productcolordescription: v3_exports.string().nullish(),
4880
- distributioncentercode: v3_exports.string().nullish(),
4881
- accountnumber: v3_exports.string().nullish(),
4882
- erpid: v3_exports.string().nullish(),
4883
- totalErrors: v3_exports.number(),
4884
- tradingPartners: v3_exports.array(v3_exports.string()),
4885
- tradingPartnerIds: v3_exports.array(v3_exports.number()),
4886
- // These are the stages assigned to the TradingPartners, not the stages of the errors
4887
- phases: v3_exports.array(v3_exports.string()),
4888
- // Same thing for the stage property in here: it's the stage of the Item & TradingPartner, not the stage of the error
4889
- tradingPartnerStages: v3_exports.array(tradingPartnerStageV2Schema),
4890
- validatedDate: v3_exports.number().pipe(v3_exports.coerce.date()).nullish()
4891
- });
4892
-
4893
- // lib/errors/v2/models/ItemErrorSummaryResult.ts
4894
- var itemErrorSummaryResultV2Schema = v3_exports.object({
4895
- hasNext: v3_exports.boolean(),
4896
- errors: v3_exports.array(itemErrorSummaryV2Schema)
4897
- });
4898
-
4899
- // lib/errors/v2/models/ItemErrorDetails.ts
4900
- var itemErrorDetailsV2Schema = v3_exports.object({
4901
- errorMessage: v3_exports.string(),
4902
- attributeName: v3_exports.string().nullable(),
4903
- tradingPartnerNames: v3_exports.array(v3_exports.string()),
4904
- phases: v3_exports.array(stageSchema),
4905
- attributeDbNames: v3_exports.array(v3_exports.string()),
4906
- tradingPartnerStages: v3_exports.array(tradingPartnerStageV2Schema),
4907
- repeatableGroupId: v3_exports.string().nullish()
4908
- });
4909
-
4910
- // lib/errors/v2/models/ItemErrorDetailsResult.ts
4911
- var itemErrorDetailsResultV2Schema = v3_exports.object({
4912
- itemInfoId: v3_exports.number(),
4913
- upc: v3_exports.string().nullish(),
4914
- isbn: v3_exports.string().nullish(),
4915
- gtin: v3_exports.string().nullish(),
4916
- partnumber: v3_exports.string().nullish(),
4917
- ean: v3_exports.string().nullish(),
4918
- colorfamily: v3_exports.string().nullish(),
4919
- fit: v3_exports.string().nullish(),
4920
- productcolordescription: v3_exports.string().nullish(),
4921
- distributioncentercode: v3_exports.string().nullish(),
4922
- accountnumber: v3_exports.string().nullish(),
4923
- erpid: v3_exports.string().nullish(),
4924
- itemName: v3_exports.string().nullish(),
4925
- itemErrorDetails: v3_exports.array(itemErrorDetailsV2Schema)
4926
- });
4927
-
4928
- // lib/companies/models/CompanyBriefByOrg.ts
4929
- var companyBriefByOrgSchema = v3_exports.object({
4930
- companyId: v3_exports.number(),
4931
- name: v3_exports.string(),
4932
- orgId: v3_exports.string(),
4933
- companyType: v3_exports.object({
4934
- type: v3_exports.enum(["SUPPLIER", "RETAILER"]),
4935
- display: v3_exports.enum(["SUPPLIER", "RETAILER"])
4936
- }),
4937
- dc4Id: v3_exports.number()
4938
- });
4939
-
4940
- export {
4941
- v3_exports,
4942
- importDetailSchema,
4943
- importSchema,
4944
- importErrorSchema,
4945
- importErrorsSchema,
4946
- importStatusEnumSchema,
4947
- importsStatusSchema,
4948
- vendorPartnerAttGroupsSchema,
4949
- generateImportTemplateParamsSchema,
4950
- attrProdTypeSchema,
4951
- pagedResultsSchema,
4952
- connectionSchema,
4953
- companyRelationshipUpsertBodySchema,
4954
- itemPartnerSchema,
4955
- tradingPartnerAccessByCompanyIdSchema,
4956
- itemCategorySchema,
4957
- itemCategoriesSearchSchema,
4958
- itemHierarchyResponseSchema,
4959
- localeSchema,
4960
- spreadsheetTemplateCompanySchema,
4961
- spreadsheetTemplateSchema,
4962
- identityServiceDatetimePreferencesSchema,
4963
- identityServiceOrganizationMetadataSchema,
4964
- identityServiceOrganizationSchema,
4965
- identityServicePreferencesSchema,
4966
- identityServiceUserSchema,
4967
- registeredServiceSchema,
4968
- userAccountSchema,
4969
- itemHeaderSchema,
4970
- phaseEnumSchema,
4971
- tradingPartnerStageSchema,
4972
- itemMapSchema,
4973
- itemTableSchema,
4974
- itemSearchViewSchema,
4975
- attributeDetailSchema,
4976
- categoryEnumSchema,
4977
- componentDetailsSchema,
4978
- repeatableGroupSchema,
4979
- groupedAttributeListSchema,
4980
- groupedAttributesSchema,
4981
- hierarchyCategorySchema,
4982
- hierarchyDetailsSchema,
4983
- packComponentItemInfoSchema,
4984
- itemPriceSchema,
4985
- packComponentDetailsSchema,
4986
- groupedItemSchema,
4987
- itemDetailViewSchema,
4988
- bulbSchema,
4989
- packComponentSchema,
4990
- mediaItemSchema,
4991
- itemDetailSchema,
4992
- spsItemIdResponseSchema,
4993
- itemStatusResponseSchema,
4994
- itemStatusV2ResponseSchema,
4995
- itemErrorDetailsSchema,
4996
- itemErrorDetailsResultSchema,
4997
- tradingPartnerStageV2Schema,
4998
- itemErrorSummaryV2Schema,
4999
- itemErrorSummaryResultV2Schema,
5000
- itemErrorDetailsV2Schema,
5001
- itemErrorDetailsResultV2Schema,
5002
- companyBriefByOrgSchema
5003
- };