@deliverart/sdk-js-customer 0.0.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 (36) hide show
  1. package/.changeset/config.json +11 -0
  2. package/.github/workflows/workflow.yml +47 -0
  3. package/.prettierrc +7 -0
  4. package/CHANGELOG.md +37 -0
  5. package/README.md +3 -0
  6. package/dist/index.cjs +747 -0
  7. package/dist/index.d.cts +4485 -0
  8. package/dist/index.d.ts +4485 -0
  9. package/dist/index.js +667 -0
  10. package/eslint.config.js +41 -0
  11. package/package.json +48 -0
  12. package/src/index.ts +3 -0
  13. package/src/models.ts +102 -0
  14. package/src/requests/customer-addresses/CreateCustomerAddress.ts +36 -0
  15. package/src/requests/customer-addresses/DeleteCustomerAddress.ts +27 -0
  16. package/src/requests/customer-addresses/GetCustomerAddressDetails.ts +33 -0
  17. package/src/requests/customer-addresses/GetCustomerAddresses.ts +57 -0
  18. package/src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts +55 -0
  19. package/src/requests/customer-addresses/UpdateCustomerAddress.ts +39 -0
  20. package/src/requests/customer-addresses/index.ts +6 -0
  21. package/src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts +39 -0
  22. package/src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts +27 -0
  23. package/src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts +33 -0
  24. package/src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts +67 -0
  25. package/src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts +61 -0
  26. package/src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts +42 -0
  27. package/src/requests/customer-business-profiles/index.ts +6 -0
  28. package/src/requests/customers/CreateCustomer.ts +32 -0
  29. package/src/requests/customers/DeleteCustomer.ts +27 -0
  30. package/src/requests/customers/GetCustomerDetails.ts +30 -0
  31. package/src/requests/customers/GetCustomers.ts +72 -0
  32. package/src/requests/customers/UpdateCustomer.ts +35 -0
  33. package/src/requests/customers/index.ts +5 -0
  34. package/src/requests/index.ts +3 -0
  35. package/src/types.ts +66 -0
  36. package/tsconfig.json +15 -0
package/dist/index.js ADDED
@@ -0,0 +1,667 @@
1
+ // src/models.ts
2
+ import {
3
+ addressSchema,
4
+ billingDataSchema,
5
+ datetimeSchema,
6
+ locationSchema
7
+ } from "@deliverart/sdk-js-global-types";
8
+ import { pointOfSaleNullablePathSchema } from "@deliverart/sdk-js-point-of-sale";
9
+ import { userNullablePathSchema } from "@deliverart/sdk-js-user";
10
+ import { z as z2 } from "zod";
11
+
12
+ // src/types.ts
13
+ import { z } from "zod";
14
+ var customerPathSchema = z.string().refine((val) => /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
15
+ message: "Invalid customer path format"
16
+ });
17
+ var customerNullablePathSchema = z.string().nullable().refine(
18
+ (val) => {
19
+ if (!val) return true;
20
+ return /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
21
+ },
22
+ {
23
+ message: "Invalid customer path format"
24
+ }
25
+ );
26
+ var customerAddressPathSchema = z.string().refine((val) => /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
27
+ message: "Invalid customerAddress path format"
28
+ });
29
+ var customerAddressNullablePathSchema = z.string().nullable().refine(
30
+ (val) => {
31
+ if (!val) return true;
32
+ return /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
33
+ },
34
+ {
35
+ message: "Invalid customerAddress path format"
36
+ }
37
+ );
38
+ var customerBusinessProfilePathSchema = z.string().refine((val) => /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
39
+ message: "Invalid customerBusinessProfile path format"
40
+ });
41
+ var customerBusinessProfileNullablePathSchema = z.string().nullable().refine(
42
+ (val) => {
43
+ if (!val) return true;
44
+ return /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
45
+ },
46
+ {
47
+ message: "Invalid customerBusinessProfile path format"
48
+ }
49
+ );
50
+
51
+ // src/models.ts
52
+ var customerSchema = z2.object({
53
+ id: z2.string(),
54
+ firstName: z2.string().nullable(),
55
+ lastName: z2.string().nullable(),
56
+ email: z2.string().email().nullable(),
57
+ phoneNumber: z2.string().nullable(),
58
+ hasBusinessProfiles: z2.boolean(),
59
+ hasAddresses: z2.boolean(),
60
+ ordersPlaced: z2.number(),
61
+ totalSpent: z2.number(),
62
+ createdAt: datetimeSchema,
63
+ updatedAt: datetimeSchema
64
+ });
65
+ var customerDetailsSchema = customerSchema.extend({
66
+ pointOfSale: pointOfSaleNullablePathSchema,
67
+ owner: userNullablePathSchema,
68
+ addresses: z2.array(customerAddressPathSchema),
69
+ businessProfiles: z2.array(customerBusinessProfilePathSchema)
70
+ });
71
+ var writableCreateCustomerSchema = customerDetailsSchema.pick({
72
+ pointOfSale: true,
73
+ firstName: true,
74
+ lastName: true,
75
+ email: true,
76
+ phoneNumber: true
77
+ });
78
+ var writableCustomerSchema = writableCreateCustomerSchema.omit({
79
+ pointOfSale: true
80
+ });
81
+ var customerAddressSchema = z2.object({
82
+ id: z2.string(),
83
+ address: addressSchema,
84
+ location: locationSchema,
85
+ createdAt: datetimeSchema,
86
+ updatedAt: datetimeSchema
87
+ });
88
+ var customerAddressDetailsSchema = customerAddressSchema.extend({
89
+ customer: customerPathSchema
90
+ });
91
+ var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
92
+ customer: true,
93
+ address: true
94
+ });
95
+ var writableCustomerAddressSchema = writableCreateCustomerAddressSchema.omit({
96
+ customer: true
97
+ });
98
+ var customerBusinessProfileSchema = z2.object({
99
+ id: z2.string(),
100
+ businessName: z2.string(),
101
+ vat: z2.string(),
102
+ taxCode: z2.string(),
103
+ billingAddress: addressSchema,
104
+ billingData: billingDataSchema,
105
+ createdAt: datetimeSchema,
106
+ updatedAt: datetimeSchema
107
+ });
108
+ var customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
109
+ customer: customerPathSchema
110
+ });
111
+ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetailsSchema.pick({
112
+ customer: true,
113
+ businessName: true,
114
+ vat: true,
115
+ taxCode: true,
116
+ billingAddress: true,
117
+ billingData: true
118
+ });
119
+ var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
120
+ customer: true
121
+ });
122
+
123
+ // src/requests/customer-addresses/CreateCustomerAddress.ts
124
+ import { AbstractApiRequest } from "@deliverart/sdk-js-core";
125
+ var createCustomerAddressInputSchema = writableCreateCustomerAddressSchema.required();
126
+ var createCustomerAddressResponseSchema = customerAddressDetailsSchema;
127
+ var CreateCustomerAddress = class extends AbstractApiRequest {
128
+ method = "POST";
129
+ contentType = "application/json";
130
+ accept = "application/json";
131
+ inputSchema = createCustomerAddressInputSchema;
132
+ outputSchema = createCustomerAddressResponseSchema;
133
+ querySchema = void 0;
134
+ headersSchema = void 0;
135
+ constructor(input) {
136
+ super(input);
137
+ }
138
+ getPath() {
139
+ return "/customers/addresses";
140
+ }
141
+ };
142
+
143
+ // src/requests/customer-addresses/DeleteCustomerAddress.ts
144
+ import { AbstractApiRequest as AbstractApiRequest2 } from "@deliverart/sdk-js-core";
145
+ import { z as z3 } from "zod";
146
+ var deleteCustomerAddressInputSchema = z3.undefined();
147
+ var deleteCustomerAddressResponseSchema = z3.undefined();
148
+ var DeleteCustomerAddress = class extends AbstractApiRequest2 {
149
+ method = "DELETE";
150
+ contentType = "application/json";
151
+ accept = "application/json";
152
+ inputSchema = deleteCustomerAddressInputSchema;
153
+ outputSchema = deleteCustomerAddressResponseSchema;
154
+ querySchema = void 0;
155
+ headersSchema = void 0;
156
+ customerAddressId;
157
+ constructor(customerAddressId) {
158
+ super();
159
+ this.customerAddressId = customerAddressId;
160
+ }
161
+ getPath() {
162
+ return `/customers/addresses/${this.customerAddressId}`;
163
+ }
164
+ };
165
+
166
+ // src/requests/customer-addresses/GetCustomerAddressDetails.ts
167
+ import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
168
+ import { z as z4 } from "zod";
169
+ var getCustomerAddressDetailsInputSchema = z4.undefined();
170
+ var getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema;
171
+ var GetCustomerAddressDetails = class extends AbstractApiRequest3 {
172
+ method = "GET";
173
+ contentType = "application/json";
174
+ accept = "application/json";
175
+ inputSchema = getCustomerAddressDetailsInputSchema;
176
+ outputSchema = getCustomerAddressDetailsResponseSchema;
177
+ querySchema = void 0;
178
+ headersSchema = void 0;
179
+ customerAddressId;
180
+ constructor(customerAddressId) {
181
+ super();
182
+ this.customerAddressId = customerAddressId;
183
+ }
184
+ getPath() {
185
+ return `/customers/addresses/${this.customerAddressId}`;
186
+ }
187
+ };
188
+
189
+ // src/requests/customer-addresses/GetCustomerAddresses.ts
190
+ import { AbstractApiRequest as AbstractApiRequest4 } from "@deliverart/sdk-js-core";
191
+ import {
192
+ createPaginatedSchema,
193
+ responseToPagination,
194
+ sortDirSchema,
195
+ timestampsFilterSchema
196
+ } from "@deliverart/sdk-js-global-types";
197
+ import { z as z5 } from "zod";
198
+ var getCustomerAddressesQuerySchema = z5.object({
199
+ "order[createdAt]": sortDirSchema.optional(),
200
+ "order[updatedAt]": sortDirSchema.optional(),
201
+ page: z5.coerce.number().optional()
202
+ }).merge(timestampsFilterSchema);
203
+ var getCustomerAddressesResponseSchema = createPaginatedSchema(customerAddressSchema);
204
+ var getCustomerAddressesInputSchema = z5.undefined();
205
+ var GetCustomerAddresses = class extends AbstractApiRequest4 {
206
+ method = "GET";
207
+ contentType = "application/json";
208
+ accept = "application/json";
209
+ inputSchema = getCustomerAddressesInputSchema;
210
+ outputSchema = getCustomerAddressesResponseSchema;
211
+ querySchema = getCustomerAddressesQuerySchema;
212
+ headersSchema = void 0;
213
+ constructor(options) {
214
+ super(void 0, options);
215
+ }
216
+ getPath() {
217
+ return "/customers/addresses";
218
+ }
219
+ parseResponse(data, rawResponse) {
220
+ const customerAddresses = z5.array(customerAddressSchema).parse(data);
221
+ return this.validateOutput({
222
+ data: customerAddresses,
223
+ pagination: responseToPagination(rawResponse)
224
+ });
225
+ }
226
+ };
227
+
228
+ // src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts
229
+ import { AbstractApiRequest as AbstractApiRequest5 } from "@deliverart/sdk-js-core";
230
+ import { sortDirSchema as sortDirSchema2, timestampsFilterSchema as timestampsFilterSchema2 } from "@deliverart/sdk-js-global-types";
231
+ import { z as z6 } from "zod";
232
+ var getCustomerAddressesForCustomerQuerySchema = z6.object({
233
+ "order[createdAt]": sortDirSchema2.optional(),
234
+ "order[updatedAt]": sortDirSchema2.optional()
235
+ }).merge(timestampsFilterSchema2);
236
+ var getCustomerAddressesForCustomerResponseSchema = z6.array(customerAddressSchema);
237
+ var getCustomerAddressesForCustomerInputSchema = z6.undefined();
238
+ var GetCustomerAddressesForCustomer = class extends AbstractApiRequest5 {
239
+ method = "GET";
240
+ contentType = "application/json";
241
+ accept = "application/json";
242
+ inputSchema = getCustomerAddressesForCustomerInputSchema;
243
+ outputSchema = getCustomerAddressesForCustomerResponseSchema;
244
+ querySchema = getCustomerAddressesForCustomerQuerySchema;
245
+ headersSchema = void 0;
246
+ customerId;
247
+ constructor(customerId, options) {
248
+ super(void 0, options);
249
+ this.customerId = customerId;
250
+ }
251
+ getPath() {
252
+ return `/customers/${this.customerId}/addresses`;
253
+ }
254
+ parseResponse(data) {
255
+ return z6.array(customerAddressSchema).parse(data);
256
+ }
257
+ };
258
+
259
+ // src/requests/customer-addresses/UpdateCustomerAddress.ts
260
+ import { AbstractApiRequest as AbstractApiRequest6 } from "@deliverart/sdk-js-core";
261
+ var updateCustomerAddressInputSchema = writableCustomerAddressSchema.partial();
262
+ var updateCustomerAddressResponseSchema = customerAddressDetailsSchema;
263
+ var UpdateCustomerAddress = class extends AbstractApiRequest6 {
264
+ method = "PATCH";
265
+ contentType = "application/merge-patch+json";
266
+ accept = "application/json";
267
+ inputSchema = updateCustomerAddressInputSchema;
268
+ outputSchema = updateCustomerAddressResponseSchema;
269
+ querySchema = void 0;
270
+ headersSchema = void 0;
271
+ customerId;
272
+ constructor(customerId, input) {
273
+ super(input);
274
+ this.customerId = customerId;
275
+ }
276
+ getPath() {
277
+ return `/customers/addresses/${this.customerId}`;
278
+ }
279
+ };
280
+
281
+ // src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts
282
+ import { AbstractApiRequest as AbstractApiRequest7 } from "@deliverart/sdk-js-core";
283
+ var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required();
284
+ var createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
285
+ var CreateCustomerBusinessProfile = class extends AbstractApiRequest7 {
286
+ method = "POST";
287
+ contentType = "application/json";
288
+ accept = "application/json";
289
+ inputSchema = createCustomerBusinessProfileInputSchema;
290
+ outputSchema = createCustomerBusinessProfileResponseSchema;
291
+ querySchema = void 0;
292
+ headersSchema = void 0;
293
+ constructor(input) {
294
+ super(input);
295
+ }
296
+ getPath() {
297
+ return "/customers/business_profiles";
298
+ }
299
+ };
300
+
301
+ // src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts
302
+ import { AbstractApiRequest as AbstractApiRequest8 } from "@deliverart/sdk-js-core";
303
+ import { z as z7 } from "zod";
304
+ var deleteCustomerBusinessProfileInputSchema = z7.undefined();
305
+ var deleteCustomerBusinessProfileResponseSchema = z7.undefined();
306
+ var DeleteCustomerBusinessProfile = class extends AbstractApiRequest8 {
307
+ method = "DELETE";
308
+ contentType = "application/json";
309
+ accept = "application/json";
310
+ inputSchema = deleteCustomerBusinessProfileInputSchema;
311
+ outputSchema = deleteCustomerBusinessProfileResponseSchema;
312
+ querySchema = void 0;
313
+ headersSchema = void 0;
314
+ customerBusinessProfileId;
315
+ constructor(customerBusinessProfileId) {
316
+ super();
317
+ this.customerBusinessProfileId = customerBusinessProfileId;
318
+ }
319
+ getPath() {
320
+ return `/customers/business_profiles/${this.customerBusinessProfileId}`;
321
+ }
322
+ };
323
+
324
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts
325
+ import { AbstractApiRequest as AbstractApiRequest9 } from "@deliverart/sdk-js-core";
326
+ import { z as z8 } from "zod";
327
+ var getCustomerBusinessProfileDetailsInputSchema = z8.undefined();
328
+ var getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema;
329
+ var GetCustomerBusinessProfileDetails = class extends AbstractApiRequest9 {
330
+ method = "GET";
331
+ contentType = "application/json";
332
+ accept = "application/json";
333
+ inputSchema = getCustomerBusinessProfileDetailsInputSchema;
334
+ outputSchema = getCustomerBusinessProfileDetailsResponseSchema;
335
+ querySchema = void 0;
336
+ headersSchema = void 0;
337
+ customerBusinessProfileId;
338
+ constructor(customerBusinessProfileId) {
339
+ super();
340
+ this.customerBusinessProfileId = customerBusinessProfileId;
341
+ }
342
+ getPath() {
343
+ return `/customers/business_profiles/${this.customerBusinessProfileId}`;
344
+ }
345
+ };
346
+
347
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts
348
+ import { AbstractApiRequest as AbstractApiRequest10 } from "@deliverart/sdk-js-core";
349
+ import {
350
+ createPaginatedSchema as createPaginatedSchema2,
351
+ responseToPagination as responseToPagination2,
352
+ sortDirSchema as sortDirSchema3,
353
+ timestampsFilterSchema as timestampsFilterSchema3
354
+ } from "@deliverart/sdk-js-global-types";
355
+ import { z as z9 } from "zod";
356
+ var getCustomerBusinessProfilesQuerySchema = z9.object({
357
+ "order[businessName]": sortDirSchema3.optional(),
358
+ "order[createdAt]": sortDirSchema3.optional(),
359
+ "order[updatedAt]": sortDirSchema3.optional(),
360
+ businessName: z9.string().optional(),
361
+ vat: z9.string().optional(),
362
+ taxCode: z9.string().optional(),
363
+ page: z9.coerce.number().optional()
364
+ }).merge(timestampsFilterSchema3);
365
+ var getCustomerBusinessProfilesResponseSchema = createPaginatedSchema2(
366
+ customerBusinessProfileSchema
367
+ );
368
+ var getCustomerBusinessProfilesInputSchema = z9.undefined();
369
+ var GetCustomerBusinessProfiles = class extends AbstractApiRequest10 {
370
+ method = "GET";
371
+ contentType = "application/json";
372
+ accept = "application/json";
373
+ inputSchema = getCustomerBusinessProfilesInputSchema;
374
+ outputSchema = getCustomerBusinessProfilesResponseSchema;
375
+ querySchema = getCustomerBusinessProfilesQuerySchema;
376
+ headersSchema = void 0;
377
+ constructor(options) {
378
+ super(void 0, options);
379
+ }
380
+ getPath() {
381
+ return "/customers/business_profiles";
382
+ }
383
+ parseResponse(data, rawResponse) {
384
+ const customerBusinessProfiles = z9.array(customerBusinessProfileSchema).parse(data);
385
+ return this.validateOutput({
386
+ data: customerBusinessProfiles,
387
+ pagination: responseToPagination2(rawResponse)
388
+ });
389
+ }
390
+ };
391
+
392
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts
393
+ import { AbstractApiRequest as AbstractApiRequest11 } from "@deliverart/sdk-js-core";
394
+ import { sortDirSchema as sortDirSchema4, timestampsFilterSchema as timestampsFilterSchema4 } from "@deliverart/sdk-js-global-types";
395
+ import { z as z10 } from "zod";
396
+ var getCustomerBusinessProfilesForCustomerQuerySchema = z10.object({
397
+ "order[businessName]": sortDirSchema4.optional(),
398
+ "order[createdAt]": sortDirSchema4.optional(),
399
+ "order[updatedAt]": sortDirSchema4.optional(),
400
+ businessName: z10.string().optional(),
401
+ vat: z10.string().optional(),
402
+ taxCode: z10.string().optional()
403
+ }).merge(timestampsFilterSchema4);
404
+ var getCustomerBusinessProfilesForCustomerResponseSchema = z10.array(
405
+ customerBusinessProfileSchema
406
+ );
407
+ var getCustomerBusinessProfilesForCustomerInputSchema = z10.undefined();
408
+ var GetCustomerBusinessProfilesForCustomer = class extends AbstractApiRequest11 {
409
+ method = "GET";
410
+ contentType = "application/json";
411
+ accept = "application/json";
412
+ inputSchema = getCustomerBusinessProfilesForCustomerInputSchema;
413
+ outputSchema = getCustomerBusinessProfilesForCustomerResponseSchema;
414
+ querySchema = getCustomerBusinessProfilesForCustomerQuerySchema;
415
+ headersSchema = void 0;
416
+ customerId;
417
+ constructor(customerId, options) {
418
+ super(void 0, options);
419
+ this.customerId = customerId;
420
+ }
421
+ getPath() {
422
+ return `/customers/${this.customerId}/business_profiles`;
423
+ }
424
+ parseResponse(data) {
425
+ return z10.array(customerBusinessProfileSchema).parse(data);
426
+ }
427
+ };
428
+
429
+ // src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts
430
+ import { AbstractApiRequest as AbstractApiRequest12 } from "@deliverart/sdk-js-core";
431
+ var updateCustomerBusinessProfileInputSchema = writableCustomerBusinessProfileSchema.partial();
432
+ var updateCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
433
+ var UpdateCustomerBusinessProfile = class extends AbstractApiRequest12 {
434
+ method = "PATCH";
435
+ contentType = "application/merge-patch+json";
436
+ accept = "application/json";
437
+ inputSchema = updateCustomerBusinessProfileInputSchema;
438
+ outputSchema = updateCustomerBusinessProfileResponseSchema;
439
+ querySchema = void 0;
440
+ headersSchema = void 0;
441
+ customerId;
442
+ constructor(customerId, input) {
443
+ super(input);
444
+ this.customerId = customerId;
445
+ }
446
+ getPath() {
447
+ return `/customers/business_profiles/${this.customerId}`;
448
+ }
449
+ };
450
+
451
+ // src/requests/customers/CreateCustomer.ts
452
+ import { AbstractApiRequest as AbstractApiRequest13 } from "@deliverart/sdk-js-core";
453
+ var createCustomerInputSchema = writableCreateCustomerSchema.required();
454
+ var createCustomerResponseSchema = customerDetailsSchema;
455
+ var CreateCustomer = class extends AbstractApiRequest13 {
456
+ method = "POST";
457
+ contentType = "application/json";
458
+ accept = "application/json";
459
+ inputSchema = createCustomerInputSchema;
460
+ outputSchema = createCustomerResponseSchema;
461
+ querySchema = void 0;
462
+ headersSchema = void 0;
463
+ constructor(input) {
464
+ super(input);
465
+ }
466
+ getPath() {
467
+ return "/customers";
468
+ }
469
+ };
470
+
471
+ // src/requests/customers/DeleteCustomer.ts
472
+ import { AbstractApiRequest as AbstractApiRequest14 } from "@deliverart/sdk-js-core";
473
+ import { z as z11 } from "zod";
474
+ var deleteCustomerInputSchema = z11.undefined();
475
+ var deleteCustomerResponseSchema = z11.undefined();
476
+ var DeleteCustomer = class extends AbstractApiRequest14 {
477
+ method = "DELETE";
478
+ contentType = "application/json";
479
+ accept = "application/json";
480
+ inputSchema = deleteCustomerInputSchema;
481
+ outputSchema = deleteCustomerResponseSchema;
482
+ querySchema = void 0;
483
+ headersSchema = void 0;
484
+ customerId;
485
+ constructor(customerId) {
486
+ super();
487
+ this.customerId = customerId;
488
+ }
489
+ getPath() {
490
+ return `/customers/${this.customerId}`;
491
+ }
492
+ };
493
+
494
+ // src/requests/customers/GetCustomerDetails.ts
495
+ import { AbstractApiRequest as AbstractApiRequest15 } from "@deliverart/sdk-js-core";
496
+ import { z as z12 } from "zod";
497
+ var getCustomerDetailsInputSchema = z12.undefined();
498
+ var getCustomerDetailsResponseSchema = customerDetailsSchema;
499
+ var GetCustomerDetails = class extends AbstractApiRequest15 {
500
+ method = "GET";
501
+ contentType = "application/json";
502
+ accept = "application/json";
503
+ inputSchema = getCustomerDetailsInputSchema;
504
+ outputSchema = getCustomerDetailsResponseSchema;
505
+ querySchema = void 0;
506
+ headersSchema = void 0;
507
+ customerId;
508
+ constructor(customerId) {
509
+ super();
510
+ this.customerId = customerId;
511
+ }
512
+ getPath() {
513
+ return `/customers/${this.customerId}`;
514
+ }
515
+ };
516
+
517
+ // src/requests/customers/GetCustomers.ts
518
+ import { AbstractApiRequest as AbstractApiRequest16 } from "@deliverart/sdk-js-core";
519
+ import {
520
+ createPaginatedSchema as createPaginatedSchema3,
521
+ responseToPagination as responseToPagination3,
522
+ sortDirSchema as sortDirSchema5,
523
+ timestampsFilterSchema as timestampsFilterSchema5
524
+ } from "@deliverart/sdk-js-global-types";
525
+ import { z as z13 } from "zod";
526
+ var getCustomersQuerySchema = z13.object({
527
+ firstName: z13.string().optional(),
528
+ lastName: z13.string().optional(),
529
+ email: z13.string().optional(),
530
+ phoneNumber: z13.string().optional(),
531
+ hasBusinessProfiles: z13.coerce.boolean().optional(),
532
+ hasAddresses: z13.coerce.boolean().optional(),
533
+ "ordersPlaced[between]": z13.coerce.number().optional(),
534
+ "ordersPlaced[gt]": z13.coerce.number().optional(),
535
+ "ordersPlaced[gte]": z13.coerce.number().optional(),
536
+ "ordersPlaced[lt]": z13.coerce.number().optional(),
537
+ "ordersPlaced[lte]": z13.coerce.number().optional(),
538
+ "totalSpent[between]": z13.coerce.number().optional(),
539
+ "totalSpent[gt]": z13.coerce.number().optional(),
540
+ "totalSpent[gte]": z13.coerce.number().optional(),
541
+ "totalSpent[lt]": z13.coerce.number().optional(),
542
+ "totalSpent[lte]": z13.coerce.number().optional(),
543
+ "order[firstName]": sortDirSchema5.optional(),
544
+ "order[lastName]": sortDirSchema5.optional(),
545
+ "order[createdAt]": sortDirSchema5.optional(),
546
+ "order[updatedAt]": sortDirSchema5.optional(),
547
+ page: z13.coerce.number().optional()
548
+ }).merge(timestampsFilterSchema5);
549
+ var getCustomersResponseSchema = createPaginatedSchema3(customerSchema);
550
+ var getCustomersInputSchema = z13.undefined();
551
+ var GetCustomers = class extends AbstractApiRequest16 {
552
+ method = "GET";
553
+ contentType = "application/json";
554
+ accept = "application/json";
555
+ inputSchema = getCustomersInputSchema;
556
+ outputSchema = getCustomersResponseSchema;
557
+ querySchema = getCustomersQuerySchema;
558
+ headersSchema = void 0;
559
+ constructor(options) {
560
+ super(void 0, options);
561
+ }
562
+ getPath() {
563
+ return "/customers";
564
+ }
565
+ parseResponse(data, rawResponse) {
566
+ const customers = z13.array(customerSchema).parse(data);
567
+ return this.validateOutput({ data: customers, pagination: responseToPagination3(rawResponse) });
568
+ }
569
+ };
570
+
571
+ // src/requests/customers/UpdateCustomer.ts
572
+ import { AbstractApiRequest as AbstractApiRequest17 } from "@deliverart/sdk-js-core";
573
+ var updateCustomerInputSchema = writableCustomerSchema.partial();
574
+ var updateCustomerResponseSchema = customerDetailsSchema;
575
+ var UpdateCustomer = class extends AbstractApiRequest17 {
576
+ method = "PATCH";
577
+ contentType = "application/merge-patch+json";
578
+ accept = "application/json";
579
+ inputSchema = updateCustomerInputSchema;
580
+ outputSchema = updateCustomerResponseSchema;
581
+ querySchema = void 0;
582
+ headersSchema = void 0;
583
+ customerId;
584
+ constructor(customerId, input) {
585
+ super(input);
586
+ this.customerId = customerId;
587
+ }
588
+ getPath() {
589
+ return `/customers/${this.customerId}`;
590
+ }
591
+ };
592
+ export {
593
+ CreateCustomer,
594
+ CreateCustomerAddress,
595
+ CreateCustomerBusinessProfile,
596
+ DeleteCustomer,
597
+ DeleteCustomerAddress,
598
+ DeleteCustomerBusinessProfile,
599
+ GetCustomerAddressDetails,
600
+ GetCustomerAddresses,
601
+ GetCustomerAddressesForCustomer,
602
+ GetCustomerBusinessProfileDetails,
603
+ GetCustomerBusinessProfiles,
604
+ GetCustomerBusinessProfilesForCustomer,
605
+ GetCustomerDetails,
606
+ GetCustomers,
607
+ UpdateCustomer,
608
+ UpdateCustomerAddress,
609
+ UpdateCustomerBusinessProfile,
610
+ createCustomerAddressInputSchema,
611
+ createCustomerAddressResponseSchema,
612
+ createCustomerBusinessProfileInputSchema,
613
+ createCustomerBusinessProfileResponseSchema,
614
+ createCustomerInputSchema,
615
+ createCustomerResponseSchema,
616
+ customerAddressDetailsSchema,
617
+ customerAddressNullablePathSchema,
618
+ customerAddressPathSchema,
619
+ customerAddressSchema,
620
+ customerBusinessProfileDetailsSchema,
621
+ customerBusinessProfileNullablePathSchema,
622
+ customerBusinessProfilePathSchema,
623
+ customerBusinessProfileSchema,
624
+ customerDetailsSchema,
625
+ customerNullablePathSchema,
626
+ customerPathSchema,
627
+ customerSchema,
628
+ deleteCustomerAddressInputSchema,
629
+ deleteCustomerAddressResponseSchema,
630
+ deleteCustomerBusinessProfileInputSchema,
631
+ deleteCustomerBusinessProfileResponseSchema,
632
+ deleteCustomerInputSchema,
633
+ deleteCustomerResponseSchema,
634
+ getCustomerAddressDetailsInputSchema,
635
+ getCustomerAddressDetailsResponseSchema,
636
+ getCustomerAddressesForCustomerInputSchema,
637
+ getCustomerAddressesForCustomerQuerySchema,
638
+ getCustomerAddressesForCustomerResponseSchema,
639
+ getCustomerAddressesInputSchema,
640
+ getCustomerAddressesQuerySchema,
641
+ getCustomerAddressesResponseSchema,
642
+ getCustomerBusinessProfileDetailsInputSchema,
643
+ getCustomerBusinessProfileDetailsResponseSchema,
644
+ getCustomerBusinessProfilesForCustomerInputSchema,
645
+ getCustomerBusinessProfilesForCustomerQuerySchema,
646
+ getCustomerBusinessProfilesForCustomerResponseSchema,
647
+ getCustomerBusinessProfilesInputSchema,
648
+ getCustomerBusinessProfilesQuerySchema,
649
+ getCustomerBusinessProfilesResponseSchema,
650
+ getCustomerDetailsInputSchema,
651
+ getCustomerDetailsResponseSchema,
652
+ getCustomersInputSchema,
653
+ getCustomersQuerySchema,
654
+ getCustomersResponseSchema,
655
+ updateCustomerAddressInputSchema,
656
+ updateCustomerAddressResponseSchema,
657
+ updateCustomerBusinessProfileInputSchema,
658
+ updateCustomerBusinessProfileResponseSchema,
659
+ updateCustomerInputSchema,
660
+ updateCustomerResponseSchema,
661
+ writableCreateCustomerAddressSchema,
662
+ writableCreateCustomerBusinessProfileSchema,
663
+ writableCreateCustomerSchema,
664
+ writableCustomerAddressSchema,
665
+ writableCustomerBusinessProfileSchema,
666
+ writableCustomerSchema
667
+ };
@@ -0,0 +1,41 @@
1
+ /* eslint-disable */
2
+ // eslint.config.js per @typescript-eslint v8
3
+ import js from '@eslint/js'
4
+ import prettier from 'eslint-config-prettier'
5
+ import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
6
+ import tsPlugin from '@typescript-eslint/eslint-plugin'
7
+ import tsParser from '@typescript-eslint/parser'
8
+
9
+ export default [
10
+ js.configs.recommended,
11
+ {
12
+ files: ['**/*.ts'],
13
+ languageOptions: {
14
+ parser: tsParser,
15
+ globals: {
16
+ process: 'readonly',
17
+ fetch: 'readonly',
18
+ Request: 'readonly',
19
+ Response: 'readonly',
20
+ Headers: 'readonly',
21
+ },
22
+ parserOptions: {
23
+ project: ['./tsconfig.json'],
24
+ tsconfigRootDir: process.cwd(),
25
+ sourceType: 'module',
26
+ },
27
+ },
28
+ plugins: {
29
+ '@typescript-eslint': tsPlugin,
30
+ 'simple-import-sort': simpleImportSortPlugin,
31
+ },
32
+ rules: {
33
+ 'simple-import-sort/imports': 'error',
34
+ 'simple-import-sort/exports': 'error',
35
+ '@typescript-eslint/no-unused-vars': 'warn',
36
+ },
37
+ },
38
+ prettier,
39
+ ]
40
+
41
+ export const ignores = ['dist', 'node_modules']