@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.cjs ADDED
@@ -0,0 +1,747 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ CreateCustomer: () => CreateCustomer,
24
+ CreateCustomerAddress: () => CreateCustomerAddress,
25
+ CreateCustomerBusinessProfile: () => CreateCustomerBusinessProfile,
26
+ DeleteCustomer: () => DeleteCustomer,
27
+ DeleteCustomerAddress: () => DeleteCustomerAddress,
28
+ DeleteCustomerBusinessProfile: () => DeleteCustomerBusinessProfile,
29
+ GetCustomerAddressDetails: () => GetCustomerAddressDetails,
30
+ GetCustomerAddresses: () => GetCustomerAddresses,
31
+ GetCustomerAddressesForCustomer: () => GetCustomerAddressesForCustomer,
32
+ GetCustomerBusinessProfileDetails: () => GetCustomerBusinessProfileDetails,
33
+ GetCustomerBusinessProfiles: () => GetCustomerBusinessProfiles,
34
+ GetCustomerBusinessProfilesForCustomer: () => GetCustomerBusinessProfilesForCustomer,
35
+ GetCustomerDetails: () => GetCustomerDetails,
36
+ GetCustomers: () => GetCustomers,
37
+ UpdateCustomer: () => UpdateCustomer,
38
+ UpdateCustomerAddress: () => UpdateCustomerAddress,
39
+ UpdateCustomerBusinessProfile: () => UpdateCustomerBusinessProfile,
40
+ createCustomerAddressInputSchema: () => createCustomerAddressInputSchema,
41
+ createCustomerAddressResponseSchema: () => createCustomerAddressResponseSchema,
42
+ createCustomerBusinessProfileInputSchema: () => createCustomerBusinessProfileInputSchema,
43
+ createCustomerBusinessProfileResponseSchema: () => createCustomerBusinessProfileResponseSchema,
44
+ createCustomerInputSchema: () => createCustomerInputSchema,
45
+ createCustomerResponseSchema: () => createCustomerResponseSchema,
46
+ customerAddressDetailsSchema: () => customerAddressDetailsSchema,
47
+ customerAddressNullablePathSchema: () => customerAddressNullablePathSchema,
48
+ customerAddressPathSchema: () => customerAddressPathSchema,
49
+ customerAddressSchema: () => customerAddressSchema,
50
+ customerBusinessProfileDetailsSchema: () => customerBusinessProfileDetailsSchema,
51
+ customerBusinessProfileNullablePathSchema: () => customerBusinessProfileNullablePathSchema,
52
+ customerBusinessProfilePathSchema: () => customerBusinessProfilePathSchema,
53
+ customerBusinessProfileSchema: () => customerBusinessProfileSchema,
54
+ customerDetailsSchema: () => customerDetailsSchema,
55
+ customerNullablePathSchema: () => customerNullablePathSchema,
56
+ customerPathSchema: () => customerPathSchema,
57
+ customerSchema: () => customerSchema,
58
+ deleteCustomerAddressInputSchema: () => deleteCustomerAddressInputSchema,
59
+ deleteCustomerAddressResponseSchema: () => deleteCustomerAddressResponseSchema,
60
+ deleteCustomerBusinessProfileInputSchema: () => deleteCustomerBusinessProfileInputSchema,
61
+ deleteCustomerBusinessProfileResponseSchema: () => deleteCustomerBusinessProfileResponseSchema,
62
+ deleteCustomerInputSchema: () => deleteCustomerInputSchema,
63
+ deleteCustomerResponseSchema: () => deleteCustomerResponseSchema,
64
+ getCustomerAddressDetailsInputSchema: () => getCustomerAddressDetailsInputSchema,
65
+ getCustomerAddressDetailsResponseSchema: () => getCustomerAddressDetailsResponseSchema,
66
+ getCustomerAddressesForCustomerInputSchema: () => getCustomerAddressesForCustomerInputSchema,
67
+ getCustomerAddressesForCustomerQuerySchema: () => getCustomerAddressesForCustomerQuerySchema,
68
+ getCustomerAddressesForCustomerResponseSchema: () => getCustomerAddressesForCustomerResponseSchema,
69
+ getCustomerAddressesInputSchema: () => getCustomerAddressesInputSchema,
70
+ getCustomerAddressesQuerySchema: () => getCustomerAddressesQuerySchema,
71
+ getCustomerAddressesResponseSchema: () => getCustomerAddressesResponseSchema,
72
+ getCustomerBusinessProfileDetailsInputSchema: () => getCustomerBusinessProfileDetailsInputSchema,
73
+ getCustomerBusinessProfileDetailsResponseSchema: () => getCustomerBusinessProfileDetailsResponseSchema,
74
+ getCustomerBusinessProfilesForCustomerInputSchema: () => getCustomerBusinessProfilesForCustomerInputSchema,
75
+ getCustomerBusinessProfilesForCustomerQuerySchema: () => getCustomerBusinessProfilesForCustomerQuerySchema,
76
+ getCustomerBusinessProfilesForCustomerResponseSchema: () => getCustomerBusinessProfilesForCustomerResponseSchema,
77
+ getCustomerBusinessProfilesInputSchema: () => getCustomerBusinessProfilesInputSchema,
78
+ getCustomerBusinessProfilesQuerySchema: () => getCustomerBusinessProfilesQuerySchema,
79
+ getCustomerBusinessProfilesResponseSchema: () => getCustomerBusinessProfilesResponseSchema,
80
+ getCustomerDetailsInputSchema: () => getCustomerDetailsInputSchema,
81
+ getCustomerDetailsResponseSchema: () => getCustomerDetailsResponseSchema,
82
+ getCustomersInputSchema: () => getCustomersInputSchema,
83
+ getCustomersQuerySchema: () => getCustomersQuerySchema,
84
+ getCustomersResponseSchema: () => getCustomersResponseSchema,
85
+ updateCustomerAddressInputSchema: () => updateCustomerAddressInputSchema,
86
+ updateCustomerAddressResponseSchema: () => updateCustomerAddressResponseSchema,
87
+ updateCustomerBusinessProfileInputSchema: () => updateCustomerBusinessProfileInputSchema,
88
+ updateCustomerBusinessProfileResponseSchema: () => updateCustomerBusinessProfileResponseSchema,
89
+ updateCustomerInputSchema: () => updateCustomerInputSchema,
90
+ updateCustomerResponseSchema: () => updateCustomerResponseSchema,
91
+ writableCreateCustomerAddressSchema: () => writableCreateCustomerAddressSchema,
92
+ writableCreateCustomerBusinessProfileSchema: () => writableCreateCustomerBusinessProfileSchema,
93
+ writableCreateCustomerSchema: () => writableCreateCustomerSchema,
94
+ writableCustomerAddressSchema: () => writableCustomerAddressSchema,
95
+ writableCustomerBusinessProfileSchema: () => writableCustomerBusinessProfileSchema,
96
+ writableCustomerSchema: () => writableCustomerSchema
97
+ });
98
+ module.exports = __toCommonJS(index_exports);
99
+
100
+ // src/models.ts
101
+ var import_sdk_js_global_types = require("@deliverart/sdk-js-global-types");
102
+ var import_sdk_js_point_of_sale = require("@deliverart/sdk-js-point-of-sale");
103
+ var import_sdk_js_user = require("@deliverart/sdk-js-user");
104
+ var import_zod2 = require("zod");
105
+
106
+ // src/types.ts
107
+ var import_zod = require("zod");
108
+ var customerPathSchema = import_zod.z.string().refine((val) => /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
109
+ message: "Invalid customer path format"
110
+ });
111
+ var customerNullablePathSchema = import_zod.z.string().nullable().refine(
112
+ (val) => {
113
+ if (!val) return true;
114
+ return /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
115
+ },
116
+ {
117
+ message: "Invalid customer path format"
118
+ }
119
+ );
120
+ var customerAddressPathSchema = import_zod.z.string().refine((val) => /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
121
+ message: "Invalid customerAddress path format"
122
+ });
123
+ var customerAddressNullablePathSchema = import_zod.z.string().nullable().refine(
124
+ (val) => {
125
+ if (!val) return true;
126
+ return /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
127
+ },
128
+ {
129
+ message: "Invalid customerAddress path format"
130
+ }
131
+ );
132
+ var customerBusinessProfilePathSchema = import_zod.z.string().refine((val) => /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
133
+ message: "Invalid customerBusinessProfile path format"
134
+ });
135
+ var customerBusinessProfileNullablePathSchema = import_zod.z.string().nullable().refine(
136
+ (val) => {
137
+ if (!val) return true;
138
+ return /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
139
+ },
140
+ {
141
+ message: "Invalid customerBusinessProfile path format"
142
+ }
143
+ );
144
+
145
+ // src/models.ts
146
+ var customerSchema = import_zod2.z.object({
147
+ id: import_zod2.z.string(),
148
+ firstName: import_zod2.z.string().nullable(),
149
+ lastName: import_zod2.z.string().nullable(),
150
+ email: import_zod2.z.string().email().nullable(),
151
+ phoneNumber: import_zod2.z.string().nullable(),
152
+ hasBusinessProfiles: import_zod2.z.boolean(),
153
+ hasAddresses: import_zod2.z.boolean(),
154
+ ordersPlaced: import_zod2.z.number(),
155
+ totalSpent: import_zod2.z.number(),
156
+ createdAt: import_sdk_js_global_types.datetimeSchema,
157
+ updatedAt: import_sdk_js_global_types.datetimeSchema
158
+ });
159
+ var customerDetailsSchema = customerSchema.extend({
160
+ pointOfSale: import_sdk_js_point_of_sale.pointOfSaleNullablePathSchema,
161
+ owner: import_sdk_js_user.userNullablePathSchema,
162
+ addresses: import_zod2.z.array(customerAddressPathSchema),
163
+ businessProfiles: import_zod2.z.array(customerBusinessProfilePathSchema)
164
+ });
165
+ var writableCreateCustomerSchema = customerDetailsSchema.pick({
166
+ pointOfSale: true,
167
+ firstName: true,
168
+ lastName: true,
169
+ email: true,
170
+ phoneNumber: true
171
+ });
172
+ var writableCustomerSchema = writableCreateCustomerSchema.omit({
173
+ pointOfSale: true
174
+ });
175
+ var customerAddressSchema = import_zod2.z.object({
176
+ id: import_zod2.z.string(),
177
+ address: import_sdk_js_global_types.addressSchema,
178
+ location: import_sdk_js_global_types.locationSchema,
179
+ createdAt: import_sdk_js_global_types.datetimeSchema,
180
+ updatedAt: import_sdk_js_global_types.datetimeSchema
181
+ });
182
+ var customerAddressDetailsSchema = customerAddressSchema.extend({
183
+ customer: customerPathSchema
184
+ });
185
+ var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
186
+ customer: true,
187
+ address: true
188
+ });
189
+ var writableCustomerAddressSchema = writableCreateCustomerAddressSchema.omit({
190
+ customer: true
191
+ });
192
+ var customerBusinessProfileSchema = import_zod2.z.object({
193
+ id: import_zod2.z.string(),
194
+ businessName: import_zod2.z.string(),
195
+ vat: import_zod2.z.string(),
196
+ taxCode: import_zod2.z.string(),
197
+ billingAddress: import_sdk_js_global_types.addressSchema,
198
+ billingData: import_sdk_js_global_types.billingDataSchema,
199
+ createdAt: import_sdk_js_global_types.datetimeSchema,
200
+ updatedAt: import_sdk_js_global_types.datetimeSchema
201
+ });
202
+ var customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
203
+ customer: customerPathSchema
204
+ });
205
+ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetailsSchema.pick({
206
+ customer: true,
207
+ businessName: true,
208
+ vat: true,
209
+ taxCode: true,
210
+ billingAddress: true,
211
+ billingData: true
212
+ });
213
+ var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
214
+ customer: true
215
+ });
216
+
217
+ // src/requests/customer-addresses/CreateCustomerAddress.ts
218
+ var import_sdk_js_core = require("@deliverart/sdk-js-core");
219
+ var createCustomerAddressInputSchema = writableCreateCustomerAddressSchema.required();
220
+ var createCustomerAddressResponseSchema = customerAddressDetailsSchema;
221
+ var CreateCustomerAddress = class extends import_sdk_js_core.AbstractApiRequest {
222
+ method = "POST";
223
+ contentType = "application/json";
224
+ accept = "application/json";
225
+ inputSchema = createCustomerAddressInputSchema;
226
+ outputSchema = createCustomerAddressResponseSchema;
227
+ querySchema = void 0;
228
+ headersSchema = void 0;
229
+ constructor(input) {
230
+ super(input);
231
+ }
232
+ getPath() {
233
+ return "/customers/addresses";
234
+ }
235
+ };
236
+
237
+ // src/requests/customer-addresses/DeleteCustomerAddress.ts
238
+ var import_sdk_js_core2 = require("@deliverart/sdk-js-core");
239
+ var import_zod3 = require("zod");
240
+ var deleteCustomerAddressInputSchema = import_zod3.z.undefined();
241
+ var deleteCustomerAddressResponseSchema = import_zod3.z.undefined();
242
+ var DeleteCustomerAddress = class extends import_sdk_js_core2.AbstractApiRequest {
243
+ method = "DELETE";
244
+ contentType = "application/json";
245
+ accept = "application/json";
246
+ inputSchema = deleteCustomerAddressInputSchema;
247
+ outputSchema = deleteCustomerAddressResponseSchema;
248
+ querySchema = void 0;
249
+ headersSchema = void 0;
250
+ customerAddressId;
251
+ constructor(customerAddressId) {
252
+ super();
253
+ this.customerAddressId = customerAddressId;
254
+ }
255
+ getPath() {
256
+ return `/customers/addresses/${this.customerAddressId}`;
257
+ }
258
+ };
259
+
260
+ // src/requests/customer-addresses/GetCustomerAddressDetails.ts
261
+ var import_sdk_js_core3 = require("@deliverart/sdk-js-core");
262
+ var import_zod4 = require("zod");
263
+ var getCustomerAddressDetailsInputSchema = import_zod4.z.undefined();
264
+ var getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema;
265
+ var GetCustomerAddressDetails = class extends import_sdk_js_core3.AbstractApiRequest {
266
+ method = "GET";
267
+ contentType = "application/json";
268
+ accept = "application/json";
269
+ inputSchema = getCustomerAddressDetailsInputSchema;
270
+ outputSchema = getCustomerAddressDetailsResponseSchema;
271
+ querySchema = void 0;
272
+ headersSchema = void 0;
273
+ customerAddressId;
274
+ constructor(customerAddressId) {
275
+ super();
276
+ this.customerAddressId = customerAddressId;
277
+ }
278
+ getPath() {
279
+ return `/customers/addresses/${this.customerAddressId}`;
280
+ }
281
+ };
282
+
283
+ // src/requests/customer-addresses/GetCustomerAddresses.ts
284
+ var import_sdk_js_core4 = require("@deliverart/sdk-js-core");
285
+ var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
286
+ var import_zod5 = require("zod");
287
+ var getCustomerAddressesQuerySchema = import_zod5.z.object({
288
+ "order[createdAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
289
+ "order[updatedAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
290
+ page: import_zod5.z.coerce.number().optional()
291
+ }).merge(import_sdk_js_global_types2.timestampsFilterSchema);
292
+ var getCustomerAddressesResponseSchema = (0, import_sdk_js_global_types2.createPaginatedSchema)(customerAddressSchema);
293
+ var getCustomerAddressesInputSchema = import_zod5.z.undefined();
294
+ var GetCustomerAddresses = class extends import_sdk_js_core4.AbstractApiRequest {
295
+ method = "GET";
296
+ contentType = "application/json";
297
+ accept = "application/json";
298
+ inputSchema = getCustomerAddressesInputSchema;
299
+ outputSchema = getCustomerAddressesResponseSchema;
300
+ querySchema = getCustomerAddressesQuerySchema;
301
+ headersSchema = void 0;
302
+ constructor(options) {
303
+ super(void 0, options);
304
+ }
305
+ getPath() {
306
+ return "/customers/addresses";
307
+ }
308
+ parseResponse(data, rawResponse) {
309
+ const customerAddresses = import_zod5.z.array(customerAddressSchema).parse(data);
310
+ return this.validateOutput({
311
+ data: customerAddresses,
312
+ pagination: (0, import_sdk_js_global_types2.responseToPagination)(rawResponse)
313
+ });
314
+ }
315
+ };
316
+
317
+ // src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts
318
+ var import_sdk_js_core5 = require("@deliverart/sdk-js-core");
319
+ var import_sdk_js_global_types3 = require("@deliverart/sdk-js-global-types");
320
+ var import_zod6 = require("zod");
321
+ var getCustomerAddressesForCustomerQuerySchema = import_zod6.z.object({
322
+ "order[createdAt]": import_sdk_js_global_types3.sortDirSchema.optional(),
323
+ "order[updatedAt]": import_sdk_js_global_types3.sortDirSchema.optional()
324
+ }).merge(import_sdk_js_global_types3.timestampsFilterSchema);
325
+ var getCustomerAddressesForCustomerResponseSchema = import_zod6.z.array(customerAddressSchema);
326
+ var getCustomerAddressesForCustomerInputSchema = import_zod6.z.undefined();
327
+ var GetCustomerAddressesForCustomer = class extends import_sdk_js_core5.AbstractApiRequest {
328
+ method = "GET";
329
+ contentType = "application/json";
330
+ accept = "application/json";
331
+ inputSchema = getCustomerAddressesForCustomerInputSchema;
332
+ outputSchema = getCustomerAddressesForCustomerResponseSchema;
333
+ querySchema = getCustomerAddressesForCustomerQuerySchema;
334
+ headersSchema = void 0;
335
+ customerId;
336
+ constructor(customerId, options) {
337
+ super(void 0, options);
338
+ this.customerId = customerId;
339
+ }
340
+ getPath() {
341
+ return `/customers/${this.customerId}/addresses`;
342
+ }
343
+ parseResponse(data) {
344
+ return import_zod6.z.array(customerAddressSchema).parse(data);
345
+ }
346
+ };
347
+
348
+ // src/requests/customer-addresses/UpdateCustomerAddress.ts
349
+ var import_sdk_js_core6 = require("@deliverart/sdk-js-core");
350
+ var updateCustomerAddressInputSchema = writableCustomerAddressSchema.partial();
351
+ var updateCustomerAddressResponseSchema = customerAddressDetailsSchema;
352
+ var UpdateCustomerAddress = class extends import_sdk_js_core6.AbstractApiRequest {
353
+ method = "PATCH";
354
+ contentType = "application/merge-patch+json";
355
+ accept = "application/json";
356
+ inputSchema = updateCustomerAddressInputSchema;
357
+ outputSchema = updateCustomerAddressResponseSchema;
358
+ querySchema = void 0;
359
+ headersSchema = void 0;
360
+ customerId;
361
+ constructor(customerId, input) {
362
+ super(input);
363
+ this.customerId = customerId;
364
+ }
365
+ getPath() {
366
+ return `/customers/addresses/${this.customerId}`;
367
+ }
368
+ };
369
+
370
+ // src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts
371
+ var import_sdk_js_core7 = require("@deliverart/sdk-js-core");
372
+ var createCustomerBusinessProfileInputSchema = writableCreateCustomerBusinessProfileSchema.required();
373
+ var createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
374
+ var CreateCustomerBusinessProfile = class extends import_sdk_js_core7.AbstractApiRequest {
375
+ method = "POST";
376
+ contentType = "application/json";
377
+ accept = "application/json";
378
+ inputSchema = createCustomerBusinessProfileInputSchema;
379
+ outputSchema = createCustomerBusinessProfileResponseSchema;
380
+ querySchema = void 0;
381
+ headersSchema = void 0;
382
+ constructor(input) {
383
+ super(input);
384
+ }
385
+ getPath() {
386
+ return "/customers/business_profiles";
387
+ }
388
+ };
389
+
390
+ // src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts
391
+ var import_sdk_js_core8 = require("@deliverart/sdk-js-core");
392
+ var import_zod7 = require("zod");
393
+ var deleteCustomerBusinessProfileInputSchema = import_zod7.z.undefined();
394
+ var deleteCustomerBusinessProfileResponseSchema = import_zod7.z.undefined();
395
+ var DeleteCustomerBusinessProfile = class extends import_sdk_js_core8.AbstractApiRequest {
396
+ method = "DELETE";
397
+ contentType = "application/json";
398
+ accept = "application/json";
399
+ inputSchema = deleteCustomerBusinessProfileInputSchema;
400
+ outputSchema = deleteCustomerBusinessProfileResponseSchema;
401
+ querySchema = void 0;
402
+ headersSchema = void 0;
403
+ customerBusinessProfileId;
404
+ constructor(customerBusinessProfileId) {
405
+ super();
406
+ this.customerBusinessProfileId = customerBusinessProfileId;
407
+ }
408
+ getPath() {
409
+ return `/customers/business_profiles/${this.customerBusinessProfileId}`;
410
+ }
411
+ };
412
+
413
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts
414
+ var import_sdk_js_core9 = require("@deliverart/sdk-js-core");
415
+ var import_zod8 = require("zod");
416
+ var getCustomerBusinessProfileDetailsInputSchema = import_zod8.z.undefined();
417
+ var getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema;
418
+ var GetCustomerBusinessProfileDetails = class extends import_sdk_js_core9.AbstractApiRequest {
419
+ method = "GET";
420
+ contentType = "application/json";
421
+ accept = "application/json";
422
+ inputSchema = getCustomerBusinessProfileDetailsInputSchema;
423
+ outputSchema = getCustomerBusinessProfileDetailsResponseSchema;
424
+ querySchema = void 0;
425
+ headersSchema = void 0;
426
+ customerBusinessProfileId;
427
+ constructor(customerBusinessProfileId) {
428
+ super();
429
+ this.customerBusinessProfileId = customerBusinessProfileId;
430
+ }
431
+ getPath() {
432
+ return `/customers/business_profiles/${this.customerBusinessProfileId}`;
433
+ }
434
+ };
435
+
436
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts
437
+ var import_sdk_js_core10 = require("@deliverart/sdk-js-core");
438
+ var import_sdk_js_global_types4 = require("@deliverart/sdk-js-global-types");
439
+ var import_zod9 = require("zod");
440
+ var getCustomerBusinessProfilesQuerySchema = import_zod9.z.object({
441
+ "order[businessName]": import_sdk_js_global_types4.sortDirSchema.optional(),
442
+ "order[createdAt]": import_sdk_js_global_types4.sortDirSchema.optional(),
443
+ "order[updatedAt]": import_sdk_js_global_types4.sortDirSchema.optional(),
444
+ businessName: import_zod9.z.string().optional(),
445
+ vat: import_zod9.z.string().optional(),
446
+ taxCode: import_zod9.z.string().optional(),
447
+ page: import_zod9.z.coerce.number().optional()
448
+ }).merge(import_sdk_js_global_types4.timestampsFilterSchema);
449
+ var getCustomerBusinessProfilesResponseSchema = (0, import_sdk_js_global_types4.createPaginatedSchema)(
450
+ customerBusinessProfileSchema
451
+ );
452
+ var getCustomerBusinessProfilesInputSchema = import_zod9.z.undefined();
453
+ var GetCustomerBusinessProfiles = class extends import_sdk_js_core10.AbstractApiRequest {
454
+ method = "GET";
455
+ contentType = "application/json";
456
+ accept = "application/json";
457
+ inputSchema = getCustomerBusinessProfilesInputSchema;
458
+ outputSchema = getCustomerBusinessProfilesResponseSchema;
459
+ querySchema = getCustomerBusinessProfilesQuerySchema;
460
+ headersSchema = void 0;
461
+ constructor(options) {
462
+ super(void 0, options);
463
+ }
464
+ getPath() {
465
+ return "/customers/business_profiles";
466
+ }
467
+ parseResponse(data, rawResponse) {
468
+ const customerBusinessProfiles = import_zod9.z.array(customerBusinessProfileSchema).parse(data);
469
+ return this.validateOutput({
470
+ data: customerBusinessProfiles,
471
+ pagination: (0, import_sdk_js_global_types4.responseToPagination)(rawResponse)
472
+ });
473
+ }
474
+ };
475
+
476
+ // src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts
477
+ var import_sdk_js_core11 = require("@deliverart/sdk-js-core");
478
+ var import_sdk_js_global_types5 = require("@deliverart/sdk-js-global-types");
479
+ var import_zod10 = require("zod");
480
+ var getCustomerBusinessProfilesForCustomerQuerySchema = import_zod10.z.object({
481
+ "order[businessName]": import_sdk_js_global_types5.sortDirSchema.optional(),
482
+ "order[createdAt]": import_sdk_js_global_types5.sortDirSchema.optional(),
483
+ "order[updatedAt]": import_sdk_js_global_types5.sortDirSchema.optional(),
484
+ businessName: import_zod10.z.string().optional(),
485
+ vat: import_zod10.z.string().optional(),
486
+ taxCode: import_zod10.z.string().optional()
487
+ }).merge(import_sdk_js_global_types5.timestampsFilterSchema);
488
+ var getCustomerBusinessProfilesForCustomerResponseSchema = import_zod10.z.array(
489
+ customerBusinessProfileSchema
490
+ );
491
+ var getCustomerBusinessProfilesForCustomerInputSchema = import_zod10.z.undefined();
492
+ var GetCustomerBusinessProfilesForCustomer = class extends import_sdk_js_core11.AbstractApiRequest {
493
+ method = "GET";
494
+ contentType = "application/json";
495
+ accept = "application/json";
496
+ inputSchema = getCustomerBusinessProfilesForCustomerInputSchema;
497
+ outputSchema = getCustomerBusinessProfilesForCustomerResponseSchema;
498
+ querySchema = getCustomerBusinessProfilesForCustomerQuerySchema;
499
+ headersSchema = void 0;
500
+ customerId;
501
+ constructor(customerId, options) {
502
+ super(void 0, options);
503
+ this.customerId = customerId;
504
+ }
505
+ getPath() {
506
+ return `/customers/${this.customerId}/business_profiles`;
507
+ }
508
+ parseResponse(data) {
509
+ return import_zod10.z.array(customerBusinessProfileSchema).parse(data);
510
+ }
511
+ };
512
+
513
+ // src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts
514
+ var import_sdk_js_core12 = require("@deliverart/sdk-js-core");
515
+ var updateCustomerBusinessProfileInputSchema = writableCustomerBusinessProfileSchema.partial();
516
+ var updateCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema;
517
+ var UpdateCustomerBusinessProfile = class extends import_sdk_js_core12.AbstractApiRequest {
518
+ method = "PATCH";
519
+ contentType = "application/merge-patch+json";
520
+ accept = "application/json";
521
+ inputSchema = updateCustomerBusinessProfileInputSchema;
522
+ outputSchema = updateCustomerBusinessProfileResponseSchema;
523
+ querySchema = void 0;
524
+ headersSchema = void 0;
525
+ customerId;
526
+ constructor(customerId, input) {
527
+ super(input);
528
+ this.customerId = customerId;
529
+ }
530
+ getPath() {
531
+ return `/customers/business_profiles/${this.customerId}`;
532
+ }
533
+ };
534
+
535
+ // src/requests/customers/CreateCustomer.ts
536
+ var import_sdk_js_core13 = require("@deliverart/sdk-js-core");
537
+ var createCustomerInputSchema = writableCreateCustomerSchema.required();
538
+ var createCustomerResponseSchema = customerDetailsSchema;
539
+ var CreateCustomer = class extends import_sdk_js_core13.AbstractApiRequest {
540
+ method = "POST";
541
+ contentType = "application/json";
542
+ accept = "application/json";
543
+ inputSchema = createCustomerInputSchema;
544
+ outputSchema = createCustomerResponseSchema;
545
+ querySchema = void 0;
546
+ headersSchema = void 0;
547
+ constructor(input) {
548
+ super(input);
549
+ }
550
+ getPath() {
551
+ return "/customers";
552
+ }
553
+ };
554
+
555
+ // src/requests/customers/DeleteCustomer.ts
556
+ var import_sdk_js_core14 = require("@deliverart/sdk-js-core");
557
+ var import_zod11 = require("zod");
558
+ var deleteCustomerInputSchema = import_zod11.z.undefined();
559
+ var deleteCustomerResponseSchema = import_zod11.z.undefined();
560
+ var DeleteCustomer = class extends import_sdk_js_core14.AbstractApiRequest {
561
+ method = "DELETE";
562
+ contentType = "application/json";
563
+ accept = "application/json";
564
+ inputSchema = deleteCustomerInputSchema;
565
+ outputSchema = deleteCustomerResponseSchema;
566
+ querySchema = void 0;
567
+ headersSchema = void 0;
568
+ customerId;
569
+ constructor(customerId) {
570
+ super();
571
+ this.customerId = customerId;
572
+ }
573
+ getPath() {
574
+ return `/customers/${this.customerId}`;
575
+ }
576
+ };
577
+
578
+ // src/requests/customers/GetCustomerDetails.ts
579
+ var import_sdk_js_core15 = require("@deliverart/sdk-js-core");
580
+ var import_zod12 = require("zod");
581
+ var getCustomerDetailsInputSchema = import_zod12.z.undefined();
582
+ var getCustomerDetailsResponseSchema = customerDetailsSchema;
583
+ var GetCustomerDetails = class extends import_sdk_js_core15.AbstractApiRequest {
584
+ method = "GET";
585
+ contentType = "application/json";
586
+ accept = "application/json";
587
+ inputSchema = getCustomerDetailsInputSchema;
588
+ outputSchema = getCustomerDetailsResponseSchema;
589
+ querySchema = void 0;
590
+ headersSchema = void 0;
591
+ customerId;
592
+ constructor(customerId) {
593
+ super();
594
+ this.customerId = customerId;
595
+ }
596
+ getPath() {
597
+ return `/customers/${this.customerId}`;
598
+ }
599
+ };
600
+
601
+ // src/requests/customers/GetCustomers.ts
602
+ var import_sdk_js_core16 = require("@deliverart/sdk-js-core");
603
+ var import_sdk_js_global_types6 = require("@deliverart/sdk-js-global-types");
604
+ var import_zod13 = require("zod");
605
+ var getCustomersQuerySchema = import_zod13.z.object({
606
+ firstName: import_zod13.z.string().optional(),
607
+ lastName: import_zod13.z.string().optional(),
608
+ email: import_zod13.z.string().optional(),
609
+ phoneNumber: import_zod13.z.string().optional(),
610
+ hasBusinessProfiles: import_zod13.z.coerce.boolean().optional(),
611
+ hasAddresses: import_zod13.z.coerce.boolean().optional(),
612
+ "ordersPlaced[between]": import_zod13.z.coerce.number().optional(),
613
+ "ordersPlaced[gt]": import_zod13.z.coerce.number().optional(),
614
+ "ordersPlaced[gte]": import_zod13.z.coerce.number().optional(),
615
+ "ordersPlaced[lt]": import_zod13.z.coerce.number().optional(),
616
+ "ordersPlaced[lte]": import_zod13.z.coerce.number().optional(),
617
+ "totalSpent[between]": import_zod13.z.coerce.number().optional(),
618
+ "totalSpent[gt]": import_zod13.z.coerce.number().optional(),
619
+ "totalSpent[gte]": import_zod13.z.coerce.number().optional(),
620
+ "totalSpent[lt]": import_zod13.z.coerce.number().optional(),
621
+ "totalSpent[lte]": import_zod13.z.coerce.number().optional(),
622
+ "order[firstName]": import_sdk_js_global_types6.sortDirSchema.optional(),
623
+ "order[lastName]": import_sdk_js_global_types6.sortDirSchema.optional(),
624
+ "order[createdAt]": import_sdk_js_global_types6.sortDirSchema.optional(),
625
+ "order[updatedAt]": import_sdk_js_global_types6.sortDirSchema.optional(),
626
+ page: import_zod13.z.coerce.number().optional()
627
+ }).merge(import_sdk_js_global_types6.timestampsFilterSchema);
628
+ var getCustomersResponseSchema = (0, import_sdk_js_global_types6.createPaginatedSchema)(customerSchema);
629
+ var getCustomersInputSchema = import_zod13.z.undefined();
630
+ var GetCustomers = class extends import_sdk_js_core16.AbstractApiRequest {
631
+ method = "GET";
632
+ contentType = "application/json";
633
+ accept = "application/json";
634
+ inputSchema = getCustomersInputSchema;
635
+ outputSchema = getCustomersResponseSchema;
636
+ querySchema = getCustomersQuerySchema;
637
+ headersSchema = void 0;
638
+ constructor(options) {
639
+ super(void 0, options);
640
+ }
641
+ getPath() {
642
+ return "/customers";
643
+ }
644
+ parseResponse(data, rawResponse) {
645
+ const customers = import_zod13.z.array(customerSchema).parse(data);
646
+ return this.validateOutput({ data: customers, pagination: (0, import_sdk_js_global_types6.responseToPagination)(rawResponse) });
647
+ }
648
+ };
649
+
650
+ // src/requests/customers/UpdateCustomer.ts
651
+ var import_sdk_js_core17 = require("@deliverart/sdk-js-core");
652
+ var updateCustomerInputSchema = writableCustomerSchema.partial();
653
+ var updateCustomerResponseSchema = customerDetailsSchema;
654
+ var UpdateCustomer = class extends import_sdk_js_core17.AbstractApiRequest {
655
+ method = "PATCH";
656
+ contentType = "application/merge-patch+json";
657
+ accept = "application/json";
658
+ inputSchema = updateCustomerInputSchema;
659
+ outputSchema = updateCustomerResponseSchema;
660
+ querySchema = void 0;
661
+ headersSchema = void 0;
662
+ customerId;
663
+ constructor(customerId, input) {
664
+ super(input);
665
+ this.customerId = customerId;
666
+ }
667
+ getPath() {
668
+ return `/customers/${this.customerId}`;
669
+ }
670
+ };
671
+ // Annotate the CommonJS export names for ESM import in node:
672
+ 0 && (module.exports = {
673
+ CreateCustomer,
674
+ CreateCustomerAddress,
675
+ CreateCustomerBusinessProfile,
676
+ DeleteCustomer,
677
+ DeleteCustomerAddress,
678
+ DeleteCustomerBusinessProfile,
679
+ GetCustomerAddressDetails,
680
+ GetCustomerAddresses,
681
+ GetCustomerAddressesForCustomer,
682
+ GetCustomerBusinessProfileDetails,
683
+ GetCustomerBusinessProfiles,
684
+ GetCustomerBusinessProfilesForCustomer,
685
+ GetCustomerDetails,
686
+ GetCustomers,
687
+ UpdateCustomer,
688
+ UpdateCustomerAddress,
689
+ UpdateCustomerBusinessProfile,
690
+ createCustomerAddressInputSchema,
691
+ createCustomerAddressResponseSchema,
692
+ createCustomerBusinessProfileInputSchema,
693
+ createCustomerBusinessProfileResponseSchema,
694
+ createCustomerInputSchema,
695
+ createCustomerResponseSchema,
696
+ customerAddressDetailsSchema,
697
+ customerAddressNullablePathSchema,
698
+ customerAddressPathSchema,
699
+ customerAddressSchema,
700
+ customerBusinessProfileDetailsSchema,
701
+ customerBusinessProfileNullablePathSchema,
702
+ customerBusinessProfilePathSchema,
703
+ customerBusinessProfileSchema,
704
+ customerDetailsSchema,
705
+ customerNullablePathSchema,
706
+ customerPathSchema,
707
+ customerSchema,
708
+ deleteCustomerAddressInputSchema,
709
+ deleteCustomerAddressResponseSchema,
710
+ deleteCustomerBusinessProfileInputSchema,
711
+ deleteCustomerBusinessProfileResponseSchema,
712
+ deleteCustomerInputSchema,
713
+ deleteCustomerResponseSchema,
714
+ getCustomerAddressDetailsInputSchema,
715
+ getCustomerAddressDetailsResponseSchema,
716
+ getCustomerAddressesForCustomerInputSchema,
717
+ getCustomerAddressesForCustomerQuerySchema,
718
+ getCustomerAddressesForCustomerResponseSchema,
719
+ getCustomerAddressesInputSchema,
720
+ getCustomerAddressesQuerySchema,
721
+ getCustomerAddressesResponseSchema,
722
+ getCustomerBusinessProfileDetailsInputSchema,
723
+ getCustomerBusinessProfileDetailsResponseSchema,
724
+ getCustomerBusinessProfilesForCustomerInputSchema,
725
+ getCustomerBusinessProfilesForCustomerQuerySchema,
726
+ getCustomerBusinessProfilesForCustomerResponseSchema,
727
+ getCustomerBusinessProfilesInputSchema,
728
+ getCustomerBusinessProfilesQuerySchema,
729
+ getCustomerBusinessProfilesResponseSchema,
730
+ getCustomerDetailsInputSchema,
731
+ getCustomerDetailsResponseSchema,
732
+ getCustomersInputSchema,
733
+ getCustomersQuerySchema,
734
+ getCustomersResponseSchema,
735
+ updateCustomerAddressInputSchema,
736
+ updateCustomerAddressResponseSchema,
737
+ updateCustomerBusinessProfileInputSchema,
738
+ updateCustomerBusinessProfileResponseSchema,
739
+ updateCustomerInputSchema,
740
+ updateCustomerResponseSchema,
741
+ writableCreateCustomerAddressSchema,
742
+ writableCreateCustomerBusinessProfileSchema,
743
+ writableCreateCustomerSchema,
744
+ writableCustomerAddressSchema,
745
+ writableCustomerBusinessProfileSchema,
746
+ writableCustomerSchema
747
+ });