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