@deliverart/sdk-js-customer 0.1.0 → 1.1.1

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