@deliverart/sdk-js-customer 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.cjs +156 -202
  3. package/dist/index.d.cts +352 -250
  4. package/dist/index.d.ts +352 -250
  5. package/dist/index.js +139 -186
  6. package/package.json +5 -5
  7. package/src/models.ts +40 -11
  8. package/src/requests/customer-addresses/CreateCustomerAddress.ts +6 -10
  9. package/src/requests/customer-addresses/DeleteCustomerAddress.ts +5 -2
  10. package/src/requests/customer-addresses/GetCustomerAddressDetails.ts +7 -4
  11. package/src/requests/customer-addresses/GetCustomerAddresses.ts +5 -4
  12. package/src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts +7 -4
  13. package/src/requests/customer-addresses/UpdateCustomerAddress.ts +5 -9
  14. package/src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts +6 -5
  15. package/src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts +5 -2
  16. package/src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts +10 -5
  17. package/src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts +7 -4
  18. package/src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts +7 -4
  19. package/src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts +6 -5
  20. package/src/requests/customers/CreateCustomer.ts +5 -5
  21. package/src/requests/customers/DeleteCustomer.ts +5 -2
  22. package/src/requests/customers/GetCustomerDetails.ts +8 -4
  23. package/src/requests/customers/GetCustomers.ts +7 -32
  24. package/src/requests/customers/UpdateCustomer.ts +5 -5
  25. package/src/types.ts +16 -82
package/dist/index.js CHANGED
@@ -3,91 +3,44 @@ import {
3
3
  addressSchema,
4
4
  billingDataSchema,
5
5
  datetimeSchema,
6
- locationSchema
6
+ locationSchema,
7
+ sortDirSchema,
8
+ timestampsFilterSchema
7
9
  } 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";
10
+ import { pointOfSaleNullableIriSchema } from "@deliverart/sdk-js-point-of-sale";
11
+ import { userNullableIriSchema } from "@deliverart/sdk-js-user";
12
+ import { z } from "zod";
11
13
 
12
14
  // src/types.ts
13
- import { z } from "zod";
14
- var customerPathSchema = z.string().refine(
15
- (val) => /^\/customers\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
16
- val
17
- ),
18
- {
19
- message: "Invalid customer path format"
20
- }
21
- );
22
- var customerNullablePathSchema = z.string().nullable().refine(
23
- (val) => {
24
- if (!val) return true;
25
- return /^\/customers\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
26
- val
27
- );
28
- },
29
- {
30
- message: "Invalid customer path format"
31
- }
32
- );
33
- var customerAddressPathSchema = z.string().refine(
34
- (val) => /^\/customers\/addresses\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
35
- val
36
- ),
37
- {
38
- message: "Invalid customerAddress path format"
39
- }
40
- );
41
- var customerAddressNullablePathSchema = z.string().nullable().refine(
42
- (val) => {
43
- if (!val) return true;
44
- return /^\/customers\/addresses\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
45
- val
46
- );
47
- },
48
- {
49
- message: "Invalid customerAddress path format"
50
- }
51
- );
52
- var customerBusinessProfilePathSchema = z.string().refine(
53
- (val) => /^\/customers\/business_profiles\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
54
- val
55
- ),
56
- {
57
- message: "Invalid customerBusinessProfile path format"
58
- }
59
- );
60
- var customerBusinessProfileNullablePathSchema = z.string().nullable().refine(
61
- (val) => {
62
- if (!val) return true;
63
- return /^\/customers\/business_profiles\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
64
- val
65
- );
66
- },
67
- {
68
- message: "Invalid customerBusinessProfile path format"
69
- }
15
+ import { iriNullableSchema, iriSchema } from "@deliverart/sdk-js-global-types";
16
+ var customerIriSchema = iriSchema("/customers/:id");
17
+ var customerNullableIriSchema = iriNullableSchema("/customers/:id");
18
+ var customerAddressIriSchema = iriSchema("/customers/address/:id");
19
+ var customerAddressNullableIriSchema = iriNullableSchema("/customers/address/:id");
20
+ var customerBusinessProfileIriSchema = iriSchema("/customers/business_profiles/:id");
21
+ var customerBusinessProfileNullableIriSchema = iriNullableSchema(
22
+ "/customers/business_profiles/:id"
70
23
  );
71
24
 
72
25
  // src/models.ts
73
- var customerSchema = z2.object({
74
- id: z2.string(),
75
- firstName: z2.string().nullable(),
76
- lastName: z2.string().nullable(),
77
- email: z2.string().email().nullable(),
78
- phoneNumber: z2.string().nullable(),
79
- hasBusinessProfiles: z2.boolean(),
80
- hasAddresses: z2.boolean(),
81
- ordersPlaced: z2.number(),
82
- totalSpent: z2.string(),
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(),
83
36
  createdAt: datetimeSchema,
84
37
  updatedAt: datetimeSchema
85
38
  });
86
39
  var customerDetailsSchema = customerSchema.extend({
87
- pointOfSale: pointOfSaleNullablePathSchema,
88
- owner: userNullablePathSchema,
89
- addresses: z2.array(customerAddressPathSchema),
90
- businessProfiles: z2.array(customerBusinessProfilePathSchema)
40
+ pointOfSale: pointOfSaleNullableIriSchema,
41
+ owner: userNullableIriSchema,
42
+ addresses: z.array(customerAddressIriSchema),
43
+ businessProfiles: z.array(customerBusinessProfileIriSchema)
91
44
  });
92
45
  var writableCreateCustomerSchema = customerDetailsSchema.pick({
93
46
  pointOfSale: true,
@@ -99,15 +52,15 @@ var writableCreateCustomerSchema = customerDetailsSchema.pick({
99
52
  var writableCustomerSchema = writableCreateCustomerSchema.omit({
100
53
  pointOfSale: true
101
54
  });
102
- var customerAddressSchema = z2.object({
103
- id: z2.string(),
55
+ var customerAddressSchema = z.object({
56
+ id: z.string(),
104
57
  address: addressSchema,
105
58
  location: locationSchema,
106
59
  createdAt: datetimeSchema,
107
60
  updatedAt: datetimeSchema
108
61
  });
109
62
  var customerAddressDetailsSchema = customerAddressSchema.extend({
110
- customer: customerPathSchema
63
+ customer: customerIriSchema
111
64
  });
112
65
  var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
113
66
  customer: true,
@@ -116,18 +69,18 @@ var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
116
69
  var writableCustomerAddressSchema = writableCreateCustomerAddressSchema.omit({
117
70
  customer: true
118
71
  });
119
- var customerBusinessProfileSchema = z2.object({
120
- id: z2.string(),
121
- businessName: z2.string(),
122
- vat: z2.string(),
123
- taxCode: z2.string(),
72
+ var customerBusinessProfileSchema = z.object({
73
+ id: z.string(),
74
+ businessName: z.string(),
75
+ vat: z.string(),
76
+ taxCode: z.string(),
124
77
  billingAddress: addressSchema,
125
78
  billingData: billingDataSchema,
126
79
  createdAt: datetimeSchema,
127
80
  updatedAt: datetimeSchema
128
81
  });
129
82
  var customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
130
- customer: customerPathSchema
83
+ customer: customerIriSchema
131
84
  });
132
85
  var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetailsSchema.pick({
133
86
  customer: true,
@@ -140,6 +93,29 @@ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetails
140
93
  var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
141
94
  customer: true
142
95
  });
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(),
113
+ "order[firstName]": sortDirSchema.optional(),
114
+ "order[lastName]": sortDirSchema.optional(),
115
+ "order[createdAt]": sortDirSchema.optional(),
116
+ "order[updatedAt]": sortDirSchema.optional(),
117
+ page: z.coerce.number().optional()
118
+ }).merge(timestampsFilterSchema);
143
119
 
144
120
  // src/requests/customer-addresses/CreateCustomerAddress.ts
145
121
  import { AbstractApiRequest } from "@deliverart/sdk-js-core";
@@ -163,9 +139,9 @@ var CreateCustomerAddress = class extends AbstractApiRequest {
163
139
 
164
140
  // src/requests/customer-addresses/DeleteCustomerAddress.ts
165
141
  import { AbstractApiRequest as AbstractApiRequest2 } from "@deliverart/sdk-js-core";
166
- import { z as z3 } from "zod";
167
- var deleteCustomerAddressInputSchema = z3.undefined();
168
- var deleteCustomerAddressResponseSchema = z3.undefined();
142
+ import { z as z2 } from "zod";
143
+ var deleteCustomerAddressInputSchema = z2.undefined();
144
+ var deleteCustomerAddressResponseSchema = z2.undefined();
169
145
  var DeleteCustomerAddress = class extends AbstractApiRequest2 {
170
146
  method = "DELETE";
171
147
  contentType = "application/json";
@@ -176,7 +152,7 @@ var DeleteCustomerAddress = class extends AbstractApiRequest2 {
176
152
  headersSchema = void 0;
177
153
  customerAddressId;
178
154
  constructor(customerAddressId) {
179
- super();
155
+ super(void 0);
180
156
  this.customerAddressId = customerAddressId;
181
157
  }
182
158
  getPath() {
@@ -186,8 +162,8 @@ var DeleteCustomerAddress = class extends AbstractApiRequest2 {
186
162
 
187
163
  // src/requests/customer-addresses/GetCustomerAddressDetails.ts
188
164
  import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
189
- import { z as z4 } from "zod";
190
- var getCustomerAddressDetailsInputSchema = z4.undefined();
165
+ import { z as z3 } from "zod";
166
+ var getCustomerAddressDetailsInputSchema = z3.undefined();
191
167
  var getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema;
192
168
  var GetCustomerAddressDetails = class extends AbstractApiRequest3 {
193
169
  method = "GET";
@@ -199,7 +175,7 @@ var GetCustomerAddressDetails = class extends AbstractApiRequest3 {
199
175
  headersSchema = void 0;
200
176
  customerAddressId;
201
177
  constructor(customerAddressId) {
202
- super();
178
+ super(void 0);
203
179
  this.customerAddressId = customerAddressId;
204
180
  }
205
181
  getPath() {
@@ -212,17 +188,17 @@ import { AbstractApiRequest as AbstractApiRequest4 } from "@deliverart/sdk-js-co
212
188
  import {
213
189
  createPaginatedSchema,
214
190
  responseToPagination,
215
- sortDirSchema,
216
- timestampsFilterSchema
191
+ sortDirSchema as sortDirSchema2,
192
+ timestampsFilterSchema as timestampsFilterSchema2
217
193
  } from "@deliverart/sdk-js-global-types";
218
- import { z as z5 } from "zod";
219
- var getCustomerAddressesQuerySchema = z5.object({
220
- "order[createdAt]": sortDirSchema.optional(),
221
- "order[updatedAt]": sortDirSchema.optional(),
222
- page: z5.coerce.number().optional()
223
- }).merge(timestampsFilterSchema);
194
+ import { z as z4 } from "zod";
195
+ var getCustomerAddressesQuerySchema = z4.object({
196
+ "order[createdAt]": sortDirSchema2.optional(),
197
+ "order[updatedAt]": sortDirSchema2.optional(),
198
+ page: z4.coerce.number().optional()
199
+ }).merge(timestampsFilterSchema2);
200
+ var getCustomerAddressesInputSchema = z4.undefined();
224
201
  var getCustomerAddressesResponseSchema = createPaginatedSchema(customerAddressSchema);
225
- var getCustomerAddressesInputSchema = z5.undefined();
226
202
  var GetCustomerAddresses = class extends AbstractApiRequest4 {
227
203
  method = "GET";
228
204
  contentType = "application/json";
@@ -238,7 +214,7 @@ var GetCustomerAddresses = class extends AbstractApiRequest4 {
238
214
  return "/customers/addresses";
239
215
  }
240
216
  parseResponse(data, rawResponse) {
241
- const customerAddresses = z5.array(customerAddressSchema).parse(data);
217
+ const customerAddresses = z4.array(customerAddressSchema).parse(data);
242
218
  return this.validateOutput({
243
219
  data: customerAddresses,
244
220
  pagination: responseToPagination(rawResponse)
@@ -248,14 +224,14 @@ var GetCustomerAddresses = class extends AbstractApiRequest4 {
248
224
 
249
225
  // src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts
250
226
  import { AbstractApiRequest as AbstractApiRequest5 } from "@deliverart/sdk-js-core";
251
- import { sortDirSchema as sortDirSchema2, timestampsFilterSchema as timestampsFilterSchema2 } from "@deliverart/sdk-js-global-types";
252
- import { z as z6 } from "zod";
253
- var getCustomerAddressesForCustomerQuerySchema = z6.object({
254
- "order[createdAt]": sortDirSchema2.optional(),
255
- "order[updatedAt]": sortDirSchema2.optional()
256
- }).merge(timestampsFilterSchema2);
257
- var getCustomerAddressesForCustomerResponseSchema = z6.array(customerAddressSchema);
258
- var getCustomerAddressesForCustomerInputSchema = z6.undefined();
227
+ 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({
230
+ "order[createdAt]": sortDirSchema3.optional(),
231
+ "order[updatedAt]": sortDirSchema3.optional()
232
+ }).merge(timestampsFilterSchema3);
233
+ var getCustomerAddressesForCustomerInputSchema = z5.undefined();
234
+ var getCustomerAddressesForCustomerResponseSchema = z5.array(customerAddressSchema);
259
235
  var GetCustomerAddressesForCustomer = class extends AbstractApiRequest5 {
260
236
  method = "GET";
261
237
  contentType = "application/json";
@@ -273,7 +249,7 @@ var GetCustomerAddressesForCustomer = class extends AbstractApiRequest5 {
273
249
  return `/customers/${this.customerId}/addresses`;
274
250
  }
275
251
  parseResponse(data) {
276
- return z6.array(customerAddressSchema).parse(data);
252
+ return z5.array(customerAddressSchema).parse(data);
277
253
  }
278
254
  };
279
255
 
@@ -321,9 +297,9 @@ var CreateCustomerBusinessProfile = class extends AbstractApiRequest7 {
321
297
 
322
298
  // src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts
323
299
  import { AbstractApiRequest as AbstractApiRequest8 } from "@deliverart/sdk-js-core";
324
- import { z as z7 } from "zod";
325
- var deleteCustomerBusinessProfileInputSchema = z7.undefined();
326
- var deleteCustomerBusinessProfileResponseSchema = z7.undefined();
300
+ import { z as z6 } from "zod";
301
+ var deleteCustomerBusinessProfileInputSchema = z6.undefined();
302
+ var deleteCustomerBusinessProfileResponseSchema = z6.undefined();
327
303
  var DeleteCustomerBusinessProfile = class extends AbstractApiRequest8 {
328
304
  method = "DELETE";
329
305
  contentType = "application/json";
@@ -334,7 +310,7 @@ var DeleteCustomerBusinessProfile = class extends AbstractApiRequest8 {
334
310
  headersSchema = void 0;
335
311
  customerBusinessProfileId;
336
312
  constructor(customerBusinessProfileId) {
337
- super();
313
+ super(void 0);
338
314
  this.customerBusinessProfileId = customerBusinessProfileId;
339
315
  }
340
316
  getPath() {
@@ -344,8 +320,8 @@ var DeleteCustomerBusinessProfile = class extends AbstractApiRequest8 {
344
320
 
345
321
  // src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts
346
322
  import { AbstractApiRequest as AbstractApiRequest9 } from "@deliverart/sdk-js-core";
347
- import { z as z8 } from "zod";
348
- var getCustomerBusinessProfileDetailsInputSchema = z8.undefined();
323
+ import { z as z7 } from "zod";
324
+ var getCustomerBusinessProfileDetailsInputSchema = z7.undefined();
349
325
  var getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema;
350
326
  var GetCustomerBusinessProfileDetails = class extends AbstractApiRequest9 {
351
327
  method = "GET";
@@ -357,7 +333,7 @@ var GetCustomerBusinessProfileDetails = class extends AbstractApiRequest9 {
357
333
  headersSchema = void 0;
358
334
  customerBusinessProfileId;
359
335
  constructor(customerBusinessProfileId) {
360
- super();
336
+ super(void 0);
361
337
  this.customerBusinessProfileId = customerBusinessProfileId;
362
338
  }
363
339
  getPath() {
@@ -370,23 +346,23 @@ import { AbstractApiRequest as AbstractApiRequest10 } from "@deliverart/sdk-js-c
370
346
  import {
371
347
  createPaginatedSchema as createPaginatedSchema2,
372
348
  responseToPagination as responseToPagination2,
373
- sortDirSchema as sortDirSchema3,
374
- timestampsFilterSchema as timestampsFilterSchema3
349
+ sortDirSchema as sortDirSchema4,
350
+ timestampsFilterSchema as timestampsFilterSchema4
375
351
  } from "@deliverart/sdk-js-global-types";
376
- import { z as z9 } from "zod";
377
- var getCustomerBusinessProfilesQuerySchema = z9.object({
378
- "order[businessName]": sortDirSchema3.optional(),
379
- "order[createdAt]": sortDirSchema3.optional(),
380
- "order[updatedAt]": sortDirSchema3.optional(),
381
- businessName: z9.string().optional(),
382
- vat: z9.string().optional(),
383
- taxCode: z9.string().optional(),
384
- page: z9.coerce.number().optional()
385
- }).merge(timestampsFilterSchema3);
352
+ import { z as z8 } from "zod";
353
+ var getCustomerBusinessProfilesQuerySchema = z8.object({
354
+ "order[businessName]": sortDirSchema4.optional(),
355
+ "order[createdAt]": sortDirSchema4.optional(),
356
+ "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()
361
+ }).merge(timestampsFilterSchema4);
362
+ var getCustomerBusinessProfilesInputSchema = z8.undefined();
386
363
  var getCustomerBusinessProfilesResponseSchema = createPaginatedSchema2(
387
364
  customerBusinessProfileSchema
388
365
  );
389
- var getCustomerBusinessProfilesInputSchema = z9.undefined();
390
366
  var GetCustomerBusinessProfiles = class extends AbstractApiRequest10 {
391
367
  method = "GET";
392
368
  contentType = "application/json";
@@ -402,7 +378,7 @@ var GetCustomerBusinessProfiles = class extends AbstractApiRequest10 {
402
378
  return "/customers/business_profiles";
403
379
  }
404
380
  parseResponse(data, rawResponse) {
405
- const customerBusinessProfiles = z9.array(customerBusinessProfileSchema).parse(data);
381
+ const customerBusinessProfiles = z8.array(customerBusinessProfileSchema).parse(data);
406
382
  return this.validateOutput({
407
383
  data: customerBusinessProfiles,
408
384
  pagination: responseToPagination2(rawResponse)
@@ -412,20 +388,20 @@ var GetCustomerBusinessProfiles = class extends AbstractApiRequest10 {
412
388
 
413
389
  // src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts
414
390
  import { AbstractApiRequest as AbstractApiRequest11 } from "@deliverart/sdk-js-core";
415
- import { sortDirSchema as sortDirSchema4, timestampsFilterSchema as timestampsFilterSchema4 } from "@deliverart/sdk-js-global-types";
416
- import { z as z10 } from "zod";
417
- var getCustomerBusinessProfilesForCustomerQuerySchema = z10.object({
418
- "order[businessName]": sortDirSchema4.optional(),
419
- "order[createdAt]": sortDirSchema4.optional(),
420
- "order[updatedAt]": sortDirSchema4.optional(),
421
- businessName: z10.string().optional(),
422
- vat: z10.string().optional(),
423
- taxCode: z10.string().optional()
424
- }).merge(timestampsFilterSchema4);
425
- var getCustomerBusinessProfilesForCustomerResponseSchema = z10.array(
391
+ 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({
394
+ "order[businessName]": sortDirSchema5.optional(),
395
+ "order[createdAt]": sortDirSchema5.optional(),
396
+ "order[updatedAt]": sortDirSchema5.optional(),
397
+ businessName: z9.string().optional(),
398
+ vat: z9.string().optional(),
399
+ taxCode: z9.string().optional()
400
+ }).merge(timestampsFilterSchema5);
401
+ var getCustomerBusinessProfilesForCustomerInputSchema = z9.undefined();
402
+ var getCustomerBusinessProfilesForCustomerResponseSchema = z9.array(
426
403
  customerBusinessProfileSchema
427
404
  );
428
- var getCustomerBusinessProfilesForCustomerInputSchema = z10.undefined();
429
405
  var GetCustomerBusinessProfilesForCustomer = class extends AbstractApiRequest11 {
430
406
  method = "GET";
431
407
  contentType = "application/json";
@@ -443,7 +419,7 @@ var GetCustomerBusinessProfilesForCustomer = class extends AbstractApiRequest11
443
419
  return `/customers/${this.customerId}/business_profiles`;
444
420
  }
445
421
  parseResponse(data) {
446
- return z10.array(customerBusinessProfileSchema).parse(data);
422
+ return z9.array(customerBusinessProfileSchema).parse(data);
447
423
  }
448
424
  };
449
425
 
@@ -491,9 +467,9 @@ var CreateCustomer = class extends AbstractApiRequest13 {
491
467
 
492
468
  // src/requests/customers/DeleteCustomer.ts
493
469
  import { AbstractApiRequest as AbstractApiRequest14 } from "@deliverart/sdk-js-core";
494
- import { z as z11 } from "zod";
495
- var deleteCustomerInputSchema = z11.undefined();
496
- var deleteCustomerResponseSchema = z11.undefined();
470
+ import { z as z10 } from "zod";
471
+ var deleteCustomerInputSchema = z10.undefined();
472
+ var deleteCustomerResponseSchema = z10.undefined();
497
473
  var DeleteCustomer = class extends AbstractApiRequest14 {
498
474
  method = "DELETE";
499
475
  contentType = "application/json";
@@ -504,7 +480,7 @@ var DeleteCustomer = class extends AbstractApiRequest14 {
504
480
  headersSchema = void 0;
505
481
  customerId;
506
482
  constructor(customerId) {
507
- super();
483
+ super(void 0);
508
484
  this.customerId = customerId;
509
485
  }
510
486
  getPath() {
@@ -514,8 +490,8 @@ var DeleteCustomer = class extends AbstractApiRequest14 {
514
490
 
515
491
  // src/requests/customers/GetCustomerDetails.ts
516
492
  import { AbstractApiRequest as AbstractApiRequest15 } from "@deliverart/sdk-js-core";
517
- import { z as z12 } from "zod";
518
- var getCustomerDetailsInputSchema = z12.undefined();
493
+ import { z as z11 } from "zod";
494
+ var getCustomerDetailsInputSchema = z11.undefined();
519
495
  var getCustomerDetailsResponseSchema = customerDetailsSchema;
520
496
  var GetCustomerDetails = class extends AbstractApiRequest15 {
521
497
  method = "GET";
@@ -527,7 +503,7 @@ var GetCustomerDetails = class extends AbstractApiRequest15 {
527
503
  headersSchema = void 0;
528
504
  customerId;
529
505
  constructor(customerId) {
530
- super();
506
+ super(void 0);
531
507
  this.customerId = customerId;
532
508
  }
533
509
  getPath() {
@@ -539,36 +515,12 @@ var GetCustomerDetails = class extends AbstractApiRequest15 {
539
515
  import { AbstractApiRequest as AbstractApiRequest16 } from "@deliverart/sdk-js-core";
540
516
  import {
541
517
  createPaginatedSchema as createPaginatedSchema3,
542
- responseToPagination as responseToPagination3,
543
- sortDirSchema as sortDirSchema5,
544
- timestampsFilterSchema as timestampsFilterSchema5
518
+ responseToPagination as responseToPagination3
545
519
  } from "@deliverart/sdk-js-global-types";
546
- import { z as z13 } from "zod";
547
- var getCustomersQuerySchema = z13.object({
548
- firstName: z13.string().optional(),
549
- lastName: z13.string().optional(),
550
- email: z13.string().optional(),
551
- phoneNumber: z13.string().optional(),
552
- hasBusinessProfiles: z13.coerce.boolean().optional(),
553
- hasAddresses: z13.coerce.boolean().optional(),
554
- "ordersPlaced[between]": z13.coerce.number().optional(),
555
- "ordersPlaced[gt]": z13.coerce.number().optional(),
556
- "ordersPlaced[gte]": z13.coerce.number().optional(),
557
- "ordersPlaced[lt]": z13.coerce.number().optional(),
558
- "ordersPlaced[lte]": z13.coerce.number().optional(),
559
- "totalSpent[between]": z13.coerce.number().optional(),
560
- "totalSpent[gt]": z13.coerce.string().optional(),
561
- "totalSpent[gte]": z13.coerce.string().optional(),
562
- "totalSpent[lt]": z13.coerce.string().optional(),
563
- "totalSpent[lte]": z13.coerce.string().optional(),
564
- "order[firstName]": sortDirSchema5.optional(),
565
- "order[lastName]": sortDirSchema5.optional(),
566
- "order[createdAt]": sortDirSchema5.optional(),
567
- "order[updatedAt]": sortDirSchema5.optional(),
568
- page: z13.coerce.number().optional()
569
- }).merge(timestampsFilterSchema5);
520
+ import { z as z12 } from "zod";
521
+ var getCustomersQuerySchema = customersQuerySchema;
522
+ var getCustomersInputSchema = z12.undefined();
570
523
  var getCustomersResponseSchema = createPaginatedSchema3(customerSchema);
571
- var getCustomersInputSchema = z13.undefined();
572
524
  var GetCustomers = class extends AbstractApiRequest16 {
573
525
  method = "GET";
574
526
  contentType = "application/json";
@@ -584,7 +536,7 @@ var GetCustomers = class extends AbstractApiRequest16 {
584
536
  return "/customers";
585
537
  }
586
538
  parseResponse(data, rawResponse) {
587
- const customers = z13.array(customerSchema).parse(data);
539
+ const customers = z12.array(customerSchema).parse(data);
588
540
  return this.validateOutput({ data: customers, pagination: responseToPagination3(rawResponse) });
589
541
  }
590
542
  };
@@ -635,17 +587,18 @@ export {
635
587
  createCustomerInputSchema,
636
588
  createCustomerResponseSchema,
637
589
  customerAddressDetailsSchema,
638
- customerAddressNullablePathSchema,
639
- customerAddressPathSchema,
590
+ customerAddressIriSchema,
591
+ customerAddressNullableIriSchema,
640
592
  customerAddressSchema,
641
593
  customerBusinessProfileDetailsSchema,
642
- customerBusinessProfileNullablePathSchema,
643
- customerBusinessProfilePathSchema,
594
+ customerBusinessProfileIriSchema,
595
+ customerBusinessProfileNullableIriSchema,
644
596
  customerBusinessProfileSchema,
645
597
  customerDetailsSchema,
646
- customerNullablePathSchema,
647
- customerPathSchema,
598
+ customerIriSchema,
599
+ customerNullableIriSchema,
648
600
  customerSchema,
601
+ customersQuerySchema,
649
602
  deleteCustomerAddressInputSchema,
650
603
  deleteCustomerAddressResponseSchema,
651
604
  deleteCustomerBusinessProfileInputSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-customer",
3
3
  "description": "Deliverart JavaScript SDK for Customer and CustomerAddress Management",
4
- "version": "0.0.5",
4
+ "version": "0.1.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -12,10 +12,10 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@deliverart/sdk-js-core": "0.1.4",
16
- "@deliverart/sdk-js-global-types": "0.0.16",
17
- "@deliverart/sdk-js-point-of-sale": "0.0.8",
18
- "@deliverart/sdk-js-user": "0.2.7",
15
+ "@deliverart/sdk-js-core": "0.2.0",
16
+ "@deliverart/sdk-js-global-types": "0.0.18",
17
+ "@deliverart/sdk-js-point-of-sale": "0.1.1",
18
+ "@deliverart/sdk-js-user": "0.3.2",
19
19
  "axios": "1.9.0",
20
20
  "zod": "3.25.67"
21
21
  },
package/src/models.ts CHANGED
@@ -3,15 +3,17 @@ import {
3
3
  billingDataSchema,
4
4
  datetimeSchema,
5
5
  locationSchema,
6
+ sortDirSchema,
7
+ timestampsFilterSchema,
6
8
  } from '@deliverart/sdk-js-global-types'
7
- import { pointOfSaleNullablePathSchema } from '@deliverart/sdk-js-point-of-sale'
8
- import { userNullablePathSchema } from '@deliverart/sdk-js-user'
9
+ import { pointOfSaleNullableIriSchema } from '@deliverart/sdk-js-point-of-sale'
10
+ import { userNullableIriSchema } from '@deliverart/sdk-js-user'
9
11
  import { z } from 'zod'
10
12
 
11
13
  import {
12
- customerAddressPathSchema,
13
- customerBusinessProfilePathSchema,
14
- customerPathSchema,
14
+ customerAddressIriSchema,
15
+ customerBusinessProfileIriSchema,
16
+ customerIriSchema,
15
17
  } from './types'
16
18
 
17
19
  export const customerSchema = z.object({
@@ -30,10 +32,10 @@ export const customerSchema = z.object({
30
32
  export type Customer = z.infer<typeof customerSchema>
31
33
 
32
34
  export const customerDetailsSchema = customerSchema.extend({
33
- pointOfSale: pointOfSaleNullablePathSchema,
34
- owner: userNullablePathSchema,
35
- addresses: z.array(customerAddressPathSchema),
36
- businessProfiles: z.array(customerBusinessProfilePathSchema),
35
+ pointOfSale: pointOfSaleNullableIriSchema,
36
+ owner: userNullableIriSchema,
37
+ addresses: z.array(customerAddressIriSchema),
38
+ businessProfiles: z.array(customerBusinessProfileIriSchema),
37
39
  })
38
40
  export type CustomerDetails = z.infer<typeof customerDetailsSchema>
39
41
 
@@ -58,7 +60,7 @@ export const customerAddressSchema = z.object({
58
60
  export type CustomerAddress = z.infer<typeof customerAddressSchema>
59
61
 
60
62
  export const customerAddressDetailsSchema = customerAddressSchema.extend({
61
- customer: customerPathSchema,
63
+ customer: customerIriSchema,
62
64
  })
63
65
  export type CustomerAddressDetails = z.infer<typeof customerAddressDetailsSchema>
64
66
 
@@ -83,7 +85,7 @@ export const customerBusinessProfileSchema = z.object({
83
85
  export type CustomerBusinessProfile = z.infer<typeof customerBusinessProfileSchema>
84
86
 
85
87
  export const customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
86
- customer: customerPathSchema,
88
+ customer: customerIriSchema,
87
89
  })
88
90
  export type CustomerBusinessProfileDetails = z.infer<typeof customerBusinessProfileDetailsSchema>
89
91
 
@@ -100,3 +102,30 @@ export const writableCustomerBusinessProfileSchema =
100
102
  writableCreateCustomerBusinessProfileSchema.omit({
101
103
  customer: true,
102
104
  })
105
+
106
+ export const customersQuerySchema = z
107
+ .object({
108
+ firstName: z.string().optional(),
109
+ lastName: z.string().optional(),
110
+ email: z.string().optional(),
111
+ phoneNumber: z.string().optional(),
112
+ hasBusinessProfiles: z.coerce.boolean().optional(),
113
+ hasAddresses: z.coerce.boolean().optional(),
114
+ 'ordersPlaced[between]': z.coerce.number().optional(),
115
+ 'ordersPlaced[gt]': z.coerce.number().optional(),
116
+ 'ordersPlaced[gte]': z.coerce.number().optional(),
117
+ 'ordersPlaced[lt]': z.coerce.number().optional(),
118
+ 'ordersPlaced[lte]': z.coerce.number().optional(),
119
+ 'totalSpent[between]': z.coerce.number().optional(),
120
+ 'totalSpent[gt]': z.coerce.string().optional(),
121
+ 'totalSpent[gte]': z.coerce.string().optional(),
122
+ 'totalSpent[lt]': z.coerce.string().optional(),
123
+ 'totalSpent[lte]': z.coerce.string().optional(),
124
+ 'order[firstName]': sortDirSchema.optional(),
125
+ 'order[lastName]': sortDirSchema.optional(),
126
+ 'order[createdAt]': sortDirSchema.optional(),
127
+ 'order[updatedAt]': sortDirSchema.optional(),
128
+ page: z.coerce.number().optional(),
129
+ })
130
+ .merge(timestampsFilterSchema)
131
+ export type CustomersQueryParams = z.infer<typeof customersQuerySchema>