@deliverart/sdk-js-customer 0.0.4 → 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.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +156 -181
- package/dist/index.d.cts +406 -304
- package/dist/index.d.ts +406 -304
- package/dist/index.js +139 -165
- package/package.json +5 -5
- package/src/models.ts +41 -12
- package/src/requests/customer-addresses/CreateCustomerAddress.ts +6 -10
- package/src/requests/customer-addresses/DeleteCustomerAddress.ts +5 -2
- package/src/requests/customer-addresses/GetCustomerAddressDetails.ts +7 -4
- package/src/requests/customer-addresses/GetCustomerAddresses.ts +5 -4
- package/src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts +7 -4
- package/src/requests/customer-addresses/UpdateCustomerAddress.ts +5 -9
- package/src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts +6 -5
- package/src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts +5 -2
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts +10 -5
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts +7 -4
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts +7 -4
- package/src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts +6 -5
- package/src/requests/customers/CreateCustomer.ts +5 -5
- package/src/requests/customers/DeleteCustomer.ts +5 -2
- package/src/requests/customers/GetCustomerDetails.ts +8 -4
- package/src/requests/customers/GetCustomers.ts +7 -32
- package/src/requests/customers/UpdateCustomer.ts +5 -5
- package/src/types.ts +16 -58
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -44,17 +44,18 @@ __export(index_exports, {
|
|
|
44
44
|
createCustomerInputSchema: () => createCustomerInputSchema,
|
|
45
45
|
createCustomerResponseSchema: () => createCustomerResponseSchema,
|
|
46
46
|
customerAddressDetailsSchema: () => customerAddressDetailsSchema,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
customerAddressIriSchema: () => customerAddressIriSchema,
|
|
48
|
+
customerAddressNullableIriSchema: () => customerAddressNullableIriSchema,
|
|
49
49
|
customerAddressSchema: () => customerAddressSchema,
|
|
50
50
|
customerBusinessProfileDetailsSchema: () => customerBusinessProfileDetailsSchema,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
customerBusinessProfileIriSchema: () => customerBusinessProfileIriSchema,
|
|
52
|
+
customerBusinessProfileNullableIriSchema: () => customerBusinessProfileNullableIriSchema,
|
|
53
53
|
customerBusinessProfileSchema: () => customerBusinessProfileSchema,
|
|
54
54
|
customerDetailsSchema: () => customerDetailsSchema,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
customerIriSchema: () => customerIriSchema,
|
|
56
|
+
customerNullableIriSchema: () => customerNullableIriSchema,
|
|
57
57
|
customerSchema: () => customerSchema,
|
|
58
|
+
customersQuerySchema: () => customersQuerySchema,
|
|
58
59
|
deleteCustomerAddressInputSchema: () => deleteCustomerAddressInputSchema,
|
|
59
60
|
deleteCustomerAddressResponseSchema: () => deleteCustomerAddressResponseSchema,
|
|
60
61
|
deleteCustomerBusinessProfileInputSchema: () => deleteCustomerBusinessProfileInputSchema,
|
|
@@ -98,69 +99,41 @@ __export(index_exports, {
|
|
|
98
99
|
module.exports = __toCommonJS(index_exports);
|
|
99
100
|
|
|
100
101
|
// src/models.ts
|
|
101
|
-
var
|
|
102
|
+
var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
|
|
102
103
|
var import_sdk_js_point_of_sale = require("@deliverart/sdk-js-point-of-sale");
|
|
103
104
|
var import_sdk_js_user = require("@deliverart/sdk-js-user");
|
|
104
|
-
var
|
|
105
|
+
var import_zod = require("zod");
|
|
105
106
|
|
|
106
107
|
// src/types.ts
|
|
107
|
-
var
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
108
|
+
var import_sdk_js_global_types = require("@deliverart/sdk-js-global-types");
|
|
109
|
+
var customerIriSchema = (0, import_sdk_js_global_types.iriSchema)("/customers/:id");
|
|
110
|
+
var customerNullableIriSchema = (0, import_sdk_js_global_types.iriNullableSchema)("/customers/:id");
|
|
111
|
+
var customerAddressIriSchema = (0, import_sdk_js_global_types.iriSchema)("/customers/address/:id");
|
|
112
|
+
var customerAddressNullableIriSchema = (0, import_sdk_js_global_types.iriNullableSchema)("/customers/address/:id");
|
|
113
|
+
var customerBusinessProfileIriSchema = (0, import_sdk_js_global_types.iriSchema)("/customers/business_profiles/:id");
|
|
114
|
+
var customerBusinessProfileNullableIriSchema = (0, import_sdk_js_global_types.iriNullableSchema)(
|
|
115
|
+
"/customers/business_profiles/:id"
|
|
143
116
|
);
|
|
144
117
|
|
|
145
118
|
// src/models.ts
|
|
146
|
-
var customerSchema =
|
|
147
|
-
id:
|
|
148
|
-
firstName:
|
|
149
|
-
lastName:
|
|
150
|
-
email:
|
|
151
|
-
phoneNumber:
|
|
152
|
-
hasBusinessProfiles:
|
|
153
|
-
hasAddresses:
|
|
154
|
-
ordersPlaced:
|
|
155
|
-
totalSpent:
|
|
156
|
-
createdAt:
|
|
157
|
-
updatedAt:
|
|
119
|
+
var customerSchema = import_zod.z.object({
|
|
120
|
+
id: import_zod.z.string(),
|
|
121
|
+
firstName: import_zod.z.string().nullable(),
|
|
122
|
+
lastName: import_zod.z.string().nullable(),
|
|
123
|
+
email: import_zod.z.string().email().nullable(),
|
|
124
|
+
phoneNumber: import_zod.z.string().nullable(),
|
|
125
|
+
hasBusinessProfiles: import_zod.z.boolean(),
|
|
126
|
+
hasAddresses: import_zod.z.boolean(),
|
|
127
|
+
ordersPlaced: import_zod.z.number(),
|
|
128
|
+
totalSpent: import_zod.z.string(),
|
|
129
|
+
createdAt: import_sdk_js_global_types2.datetimeSchema,
|
|
130
|
+
updatedAt: import_sdk_js_global_types2.datetimeSchema
|
|
158
131
|
});
|
|
159
132
|
var customerDetailsSchema = customerSchema.extend({
|
|
160
|
-
pointOfSale: import_sdk_js_point_of_sale.
|
|
161
|
-
owner: import_sdk_js_user.
|
|
162
|
-
addresses:
|
|
163
|
-
businessProfiles:
|
|
133
|
+
pointOfSale: import_sdk_js_point_of_sale.pointOfSaleNullableIriSchema,
|
|
134
|
+
owner: import_sdk_js_user.userNullableIriSchema,
|
|
135
|
+
addresses: import_zod.z.array(customerAddressIriSchema),
|
|
136
|
+
businessProfiles: import_zod.z.array(customerBusinessProfileIriSchema)
|
|
164
137
|
});
|
|
165
138
|
var writableCreateCustomerSchema = customerDetailsSchema.pick({
|
|
166
139
|
pointOfSale: true,
|
|
@@ -172,15 +145,15 @@ var writableCreateCustomerSchema = customerDetailsSchema.pick({
|
|
|
172
145
|
var writableCustomerSchema = writableCreateCustomerSchema.omit({
|
|
173
146
|
pointOfSale: true
|
|
174
147
|
});
|
|
175
|
-
var customerAddressSchema =
|
|
176
|
-
id:
|
|
177
|
-
address:
|
|
178
|
-
location:
|
|
179
|
-
createdAt:
|
|
180
|
-
updatedAt:
|
|
148
|
+
var customerAddressSchema = import_zod.z.object({
|
|
149
|
+
id: import_zod.z.string(),
|
|
150
|
+
address: import_sdk_js_global_types2.addressSchema,
|
|
151
|
+
location: import_sdk_js_global_types2.locationSchema,
|
|
152
|
+
createdAt: import_sdk_js_global_types2.datetimeSchema,
|
|
153
|
+
updatedAt: import_sdk_js_global_types2.datetimeSchema
|
|
181
154
|
});
|
|
182
155
|
var customerAddressDetailsSchema = customerAddressSchema.extend({
|
|
183
|
-
customer:
|
|
156
|
+
customer: customerIriSchema
|
|
184
157
|
});
|
|
185
158
|
var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
|
|
186
159
|
customer: true,
|
|
@@ -189,18 +162,18 @@ var writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
|
|
|
189
162
|
var writableCustomerAddressSchema = writableCreateCustomerAddressSchema.omit({
|
|
190
163
|
customer: true
|
|
191
164
|
});
|
|
192
|
-
var customerBusinessProfileSchema =
|
|
193
|
-
id:
|
|
194
|
-
businessName:
|
|
195
|
-
vat:
|
|
196
|
-
taxCode:
|
|
197
|
-
billingAddress:
|
|
198
|
-
billingData:
|
|
199
|
-
createdAt:
|
|
200
|
-
updatedAt:
|
|
165
|
+
var customerBusinessProfileSchema = import_zod.z.object({
|
|
166
|
+
id: import_zod.z.string(),
|
|
167
|
+
businessName: import_zod.z.string(),
|
|
168
|
+
vat: import_zod.z.string(),
|
|
169
|
+
taxCode: import_zod.z.string(),
|
|
170
|
+
billingAddress: import_sdk_js_global_types2.addressSchema,
|
|
171
|
+
billingData: import_sdk_js_global_types2.billingDataSchema,
|
|
172
|
+
createdAt: import_sdk_js_global_types2.datetimeSchema,
|
|
173
|
+
updatedAt: import_sdk_js_global_types2.datetimeSchema
|
|
201
174
|
});
|
|
202
175
|
var customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
|
|
203
|
-
customer:
|
|
176
|
+
customer: customerIriSchema
|
|
204
177
|
});
|
|
205
178
|
var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetailsSchema.pick({
|
|
206
179
|
customer: true,
|
|
@@ -213,6 +186,29 @@ var writableCreateCustomerBusinessProfileSchema = customerBusinessProfileDetails
|
|
|
213
186
|
var writableCustomerBusinessProfileSchema = writableCreateCustomerBusinessProfileSchema.omit({
|
|
214
187
|
customer: true
|
|
215
188
|
});
|
|
189
|
+
var customersQuerySchema = import_zod.z.object({
|
|
190
|
+
firstName: import_zod.z.string().optional(),
|
|
191
|
+
lastName: import_zod.z.string().optional(),
|
|
192
|
+
email: import_zod.z.string().optional(),
|
|
193
|
+
phoneNumber: import_zod.z.string().optional(),
|
|
194
|
+
hasBusinessProfiles: import_zod.z.coerce.boolean().optional(),
|
|
195
|
+
hasAddresses: import_zod.z.coerce.boolean().optional(),
|
|
196
|
+
"ordersPlaced[between]": import_zod.z.coerce.number().optional(),
|
|
197
|
+
"ordersPlaced[gt]": import_zod.z.coerce.number().optional(),
|
|
198
|
+
"ordersPlaced[gte]": import_zod.z.coerce.number().optional(),
|
|
199
|
+
"ordersPlaced[lt]": import_zod.z.coerce.number().optional(),
|
|
200
|
+
"ordersPlaced[lte]": import_zod.z.coerce.number().optional(),
|
|
201
|
+
"totalSpent[between]": import_zod.z.coerce.number().optional(),
|
|
202
|
+
"totalSpent[gt]": import_zod.z.coerce.string().optional(),
|
|
203
|
+
"totalSpent[gte]": import_zod.z.coerce.string().optional(),
|
|
204
|
+
"totalSpent[lt]": import_zod.z.coerce.string().optional(),
|
|
205
|
+
"totalSpent[lte]": import_zod.z.coerce.string().optional(),
|
|
206
|
+
"order[firstName]": import_sdk_js_global_types2.sortDirSchema.optional(),
|
|
207
|
+
"order[lastName]": import_sdk_js_global_types2.sortDirSchema.optional(),
|
|
208
|
+
"order[createdAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
|
|
209
|
+
"order[updatedAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
|
|
210
|
+
page: import_zod.z.coerce.number().optional()
|
|
211
|
+
}).merge(import_sdk_js_global_types2.timestampsFilterSchema);
|
|
216
212
|
|
|
217
213
|
// src/requests/customer-addresses/CreateCustomerAddress.ts
|
|
218
214
|
var import_sdk_js_core = require("@deliverart/sdk-js-core");
|
|
@@ -236,9 +232,9 @@ var CreateCustomerAddress = class extends import_sdk_js_core.AbstractApiRequest
|
|
|
236
232
|
|
|
237
233
|
// src/requests/customer-addresses/DeleteCustomerAddress.ts
|
|
238
234
|
var import_sdk_js_core2 = require("@deliverart/sdk-js-core");
|
|
239
|
-
var
|
|
240
|
-
var deleteCustomerAddressInputSchema =
|
|
241
|
-
var deleteCustomerAddressResponseSchema =
|
|
235
|
+
var import_zod2 = require("zod");
|
|
236
|
+
var deleteCustomerAddressInputSchema = import_zod2.z.undefined();
|
|
237
|
+
var deleteCustomerAddressResponseSchema = import_zod2.z.undefined();
|
|
242
238
|
var DeleteCustomerAddress = class extends import_sdk_js_core2.AbstractApiRequest {
|
|
243
239
|
method = "DELETE";
|
|
244
240
|
contentType = "application/json";
|
|
@@ -249,7 +245,7 @@ var DeleteCustomerAddress = class extends import_sdk_js_core2.AbstractApiRequest
|
|
|
249
245
|
headersSchema = void 0;
|
|
250
246
|
customerAddressId;
|
|
251
247
|
constructor(customerAddressId) {
|
|
252
|
-
super();
|
|
248
|
+
super(void 0);
|
|
253
249
|
this.customerAddressId = customerAddressId;
|
|
254
250
|
}
|
|
255
251
|
getPath() {
|
|
@@ -259,8 +255,8 @@ var DeleteCustomerAddress = class extends import_sdk_js_core2.AbstractApiRequest
|
|
|
259
255
|
|
|
260
256
|
// src/requests/customer-addresses/GetCustomerAddressDetails.ts
|
|
261
257
|
var import_sdk_js_core3 = require("@deliverart/sdk-js-core");
|
|
262
|
-
var
|
|
263
|
-
var getCustomerAddressDetailsInputSchema =
|
|
258
|
+
var import_zod3 = require("zod");
|
|
259
|
+
var getCustomerAddressDetailsInputSchema = import_zod3.z.undefined();
|
|
264
260
|
var getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema;
|
|
265
261
|
var GetCustomerAddressDetails = class extends import_sdk_js_core3.AbstractApiRequest {
|
|
266
262
|
method = "GET";
|
|
@@ -272,7 +268,7 @@ var GetCustomerAddressDetails = class extends import_sdk_js_core3.AbstractApiReq
|
|
|
272
268
|
headersSchema = void 0;
|
|
273
269
|
customerAddressId;
|
|
274
270
|
constructor(customerAddressId) {
|
|
275
|
-
super();
|
|
271
|
+
super(void 0);
|
|
276
272
|
this.customerAddressId = customerAddressId;
|
|
277
273
|
}
|
|
278
274
|
getPath() {
|
|
@@ -282,15 +278,15 @@ var GetCustomerAddressDetails = class extends import_sdk_js_core3.AbstractApiReq
|
|
|
282
278
|
|
|
283
279
|
// src/requests/customer-addresses/GetCustomerAddresses.ts
|
|
284
280
|
var import_sdk_js_core4 = require("@deliverart/sdk-js-core");
|
|
285
|
-
var
|
|
286
|
-
var
|
|
287
|
-
var getCustomerAddressesQuerySchema =
|
|
288
|
-
"order[createdAt]":
|
|
289
|
-
"order[updatedAt]":
|
|
290
|
-
page:
|
|
291
|
-
}).merge(
|
|
292
|
-
var
|
|
293
|
-
var
|
|
281
|
+
var import_sdk_js_global_types3 = require("@deliverart/sdk-js-global-types");
|
|
282
|
+
var import_zod4 = require("zod");
|
|
283
|
+
var getCustomerAddressesQuerySchema = import_zod4.z.object({
|
|
284
|
+
"order[createdAt]": import_sdk_js_global_types3.sortDirSchema.optional(),
|
|
285
|
+
"order[updatedAt]": import_sdk_js_global_types3.sortDirSchema.optional(),
|
|
286
|
+
page: import_zod4.z.coerce.number().optional()
|
|
287
|
+
}).merge(import_sdk_js_global_types3.timestampsFilterSchema);
|
|
288
|
+
var getCustomerAddressesInputSchema = import_zod4.z.undefined();
|
|
289
|
+
var getCustomerAddressesResponseSchema = (0, import_sdk_js_global_types3.createPaginatedSchema)(customerAddressSchema);
|
|
294
290
|
var GetCustomerAddresses = class extends import_sdk_js_core4.AbstractApiRequest {
|
|
295
291
|
method = "GET";
|
|
296
292
|
contentType = "application/json";
|
|
@@ -306,24 +302,24 @@ var GetCustomerAddresses = class extends import_sdk_js_core4.AbstractApiRequest
|
|
|
306
302
|
return "/customers/addresses";
|
|
307
303
|
}
|
|
308
304
|
parseResponse(data, rawResponse) {
|
|
309
|
-
const customerAddresses =
|
|
305
|
+
const customerAddresses = import_zod4.z.array(customerAddressSchema).parse(data);
|
|
310
306
|
return this.validateOutput({
|
|
311
307
|
data: customerAddresses,
|
|
312
|
-
pagination: (0,
|
|
308
|
+
pagination: (0, import_sdk_js_global_types3.responseToPagination)(rawResponse)
|
|
313
309
|
});
|
|
314
310
|
}
|
|
315
311
|
};
|
|
316
312
|
|
|
317
313
|
// src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts
|
|
318
314
|
var import_sdk_js_core5 = require("@deliverart/sdk-js-core");
|
|
319
|
-
var
|
|
320
|
-
var
|
|
321
|
-
var getCustomerAddressesForCustomerQuerySchema =
|
|
322
|
-
"order[createdAt]":
|
|
323
|
-
"order[updatedAt]":
|
|
324
|
-
}).merge(
|
|
325
|
-
var
|
|
326
|
-
var
|
|
315
|
+
var import_sdk_js_global_types4 = require("@deliverart/sdk-js-global-types");
|
|
316
|
+
var import_zod5 = require("zod");
|
|
317
|
+
var getCustomerAddressesForCustomerQuerySchema = import_zod5.z.object({
|
|
318
|
+
"order[createdAt]": import_sdk_js_global_types4.sortDirSchema.optional(),
|
|
319
|
+
"order[updatedAt]": import_sdk_js_global_types4.sortDirSchema.optional()
|
|
320
|
+
}).merge(import_sdk_js_global_types4.timestampsFilterSchema);
|
|
321
|
+
var getCustomerAddressesForCustomerInputSchema = import_zod5.z.undefined();
|
|
322
|
+
var getCustomerAddressesForCustomerResponseSchema = import_zod5.z.array(customerAddressSchema);
|
|
327
323
|
var GetCustomerAddressesForCustomer = class extends import_sdk_js_core5.AbstractApiRequest {
|
|
328
324
|
method = "GET";
|
|
329
325
|
contentType = "application/json";
|
|
@@ -341,7 +337,7 @@ var GetCustomerAddressesForCustomer = class extends import_sdk_js_core5.Abstract
|
|
|
341
337
|
return `/customers/${this.customerId}/addresses`;
|
|
342
338
|
}
|
|
343
339
|
parseResponse(data) {
|
|
344
|
-
return
|
|
340
|
+
return import_zod5.z.array(customerAddressSchema).parse(data);
|
|
345
341
|
}
|
|
346
342
|
};
|
|
347
343
|
|
|
@@ -389,9 +385,9 @@ var CreateCustomerBusinessProfile = class extends import_sdk_js_core7.AbstractAp
|
|
|
389
385
|
|
|
390
386
|
// src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts
|
|
391
387
|
var import_sdk_js_core8 = require("@deliverart/sdk-js-core");
|
|
392
|
-
var
|
|
393
|
-
var deleteCustomerBusinessProfileInputSchema =
|
|
394
|
-
var deleteCustomerBusinessProfileResponseSchema =
|
|
388
|
+
var import_zod6 = require("zod");
|
|
389
|
+
var deleteCustomerBusinessProfileInputSchema = import_zod6.z.undefined();
|
|
390
|
+
var deleteCustomerBusinessProfileResponseSchema = import_zod6.z.undefined();
|
|
395
391
|
var DeleteCustomerBusinessProfile = class extends import_sdk_js_core8.AbstractApiRequest {
|
|
396
392
|
method = "DELETE";
|
|
397
393
|
contentType = "application/json";
|
|
@@ -402,7 +398,7 @@ var DeleteCustomerBusinessProfile = class extends import_sdk_js_core8.AbstractAp
|
|
|
402
398
|
headersSchema = void 0;
|
|
403
399
|
customerBusinessProfileId;
|
|
404
400
|
constructor(customerBusinessProfileId) {
|
|
405
|
-
super();
|
|
401
|
+
super(void 0);
|
|
406
402
|
this.customerBusinessProfileId = customerBusinessProfileId;
|
|
407
403
|
}
|
|
408
404
|
getPath() {
|
|
@@ -412,8 +408,8 @@ var DeleteCustomerBusinessProfile = class extends import_sdk_js_core8.AbstractAp
|
|
|
412
408
|
|
|
413
409
|
// src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts
|
|
414
410
|
var import_sdk_js_core9 = require("@deliverart/sdk-js-core");
|
|
415
|
-
var
|
|
416
|
-
var getCustomerBusinessProfileDetailsInputSchema =
|
|
411
|
+
var import_zod7 = require("zod");
|
|
412
|
+
var getCustomerBusinessProfileDetailsInputSchema = import_zod7.z.undefined();
|
|
417
413
|
var getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema;
|
|
418
414
|
var GetCustomerBusinessProfileDetails = class extends import_sdk_js_core9.AbstractApiRequest {
|
|
419
415
|
method = "GET";
|
|
@@ -425,7 +421,7 @@ var GetCustomerBusinessProfileDetails = class extends import_sdk_js_core9.Abstra
|
|
|
425
421
|
headersSchema = void 0;
|
|
426
422
|
customerBusinessProfileId;
|
|
427
423
|
constructor(customerBusinessProfileId) {
|
|
428
|
-
super();
|
|
424
|
+
super(void 0);
|
|
429
425
|
this.customerBusinessProfileId = customerBusinessProfileId;
|
|
430
426
|
}
|
|
431
427
|
getPath() {
|
|
@@ -435,21 +431,21 @@ var GetCustomerBusinessProfileDetails = class extends import_sdk_js_core9.Abstra
|
|
|
435
431
|
|
|
436
432
|
// src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts
|
|
437
433
|
var import_sdk_js_core10 = require("@deliverart/sdk-js-core");
|
|
438
|
-
var
|
|
439
|
-
var
|
|
440
|
-
var getCustomerBusinessProfilesQuerySchema =
|
|
441
|
-
"order[businessName]":
|
|
442
|
-
"order[createdAt]":
|
|
443
|
-
"order[updatedAt]":
|
|
444
|
-
businessName:
|
|
445
|
-
vat:
|
|
446
|
-
taxCode:
|
|
447
|
-
page:
|
|
448
|
-
}).merge(
|
|
449
|
-
var
|
|
434
|
+
var import_sdk_js_global_types5 = require("@deliverart/sdk-js-global-types");
|
|
435
|
+
var import_zod8 = require("zod");
|
|
436
|
+
var getCustomerBusinessProfilesQuerySchema = import_zod8.z.object({
|
|
437
|
+
"order[businessName]": import_sdk_js_global_types5.sortDirSchema.optional(),
|
|
438
|
+
"order[createdAt]": import_sdk_js_global_types5.sortDirSchema.optional(),
|
|
439
|
+
"order[updatedAt]": import_sdk_js_global_types5.sortDirSchema.optional(),
|
|
440
|
+
businessName: import_zod8.z.string().optional(),
|
|
441
|
+
vat: import_zod8.z.string().optional(),
|
|
442
|
+
taxCode: import_zod8.z.string().optional(),
|
|
443
|
+
page: import_zod8.z.coerce.number().optional()
|
|
444
|
+
}).merge(import_sdk_js_global_types5.timestampsFilterSchema);
|
|
445
|
+
var getCustomerBusinessProfilesInputSchema = import_zod8.z.undefined();
|
|
446
|
+
var getCustomerBusinessProfilesResponseSchema = (0, import_sdk_js_global_types5.createPaginatedSchema)(
|
|
450
447
|
customerBusinessProfileSchema
|
|
451
448
|
);
|
|
452
|
-
var getCustomerBusinessProfilesInputSchema = import_zod9.z.undefined();
|
|
453
449
|
var GetCustomerBusinessProfiles = class extends import_sdk_js_core10.AbstractApiRequest {
|
|
454
450
|
method = "GET";
|
|
455
451
|
contentType = "application/json";
|
|
@@ -465,30 +461,30 @@ var GetCustomerBusinessProfiles = class extends import_sdk_js_core10.AbstractApi
|
|
|
465
461
|
return "/customers/business_profiles";
|
|
466
462
|
}
|
|
467
463
|
parseResponse(data, rawResponse) {
|
|
468
|
-
const customerBusinessProfiles =
|
|
464
|
+
const customerBusinessProfiles = import_zod8.z.array(customerBusinessProfileSchema).parse(data);
|
|
469
465
|
return this.validateOutput({
|
|
470
466
|
data: customerBusinessProfiles,
|
|
471
|
-
pagination: (0,
|
|
467
|
+
pagination: (0, import_sdk_js_global_types5.responseToPagination)(rawResponse)
|
|
472
468
|
});
|
|
473
469
|
}
|
|
474
470
|
};
|
|
475
471
|
|
|
476
472
|
// src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts
|
|
477
473
|
var import_sdk_js_core11 = require("@deliverart/sdk-js-core");
|
|
478
|
-
var
|
|
479
|
-
var
|
|
480
|
-
var getCustomerBusinessProfilesForCustomerQuerySchema =
|
|
481
|
-
"order[businessName]":
|
|
482
|
-
"order[createdAt]":
|
|
483
|
-
"order[updatedAt]":
|
|
484
|
-
businessName:
|
|
485
|
-
vat:
|
|
486
|
-
taxCode:
|
|
487
|
-
}).merge(
|
|
488
|
-
var
|
|
474
|
+
var import_sdk_js_global_types6 = require("@deliverart/sdk-js-global-types");
|
|
475
|
+
var import_zod9 = require("zod");
|
|
476
|
+
var getCustomerBusinessProfilesForCustomerQuerySchema = import_zod9.z.object({
|
|
477
|
+
"order[businessName]": import_sdk_js_global_types6.sortDirSchema.optional(),
|
|
478
|
+
"order[createdAt]": import_sdk_js_global_types6.sortDirSchema.optional(),
|
|
479
|
+
"order[updatedAt]": import_sdk_js_global_types6.sortDirSchema.optional(),
|
|
480
|
+
businessName: import_zod9.z.string().optional(),
|
|
481
|
+
vat: import_zod9.z.string().optional(),
|
|
482
|
+
taxCode: import_zod9.z.string().optional()
|
|
483
|
+
}).merge(import_sdk_js_global_types6.timestampsFilterSchema);
|
|
484
|
+
var getCustomerBusinessProfilesForCustomerInputSchema = import_zod9.z.undefined();
|
|
485
|
+
var getCustomerBusinessProfilesForCustomerResponseSchema = import_zod9.z.array(
|
|
489
486
|
customerBusinessProfileSchema
|
|
490
487
|
);
|
|
491
|
-
var getCustomerBusinessProfilesForCustomerInputSchema = import_zod10.z.undefined();
|
|
492
488
|
var GetCustomerBusinessProfilesForCustomer = class extends import_sdk_js_core11.AbstractApiRequest {
|
|
493
489
|
method = "GET";
|
|
494
490
|
contentType = "application/json";
|
|
@@ -506,7 +502,7 @@ var GetCustomerBusinessProfilesForCustomer = class extends import_sdk_js_core11.
|
|
|
506
502
|
return `/customers/${this.customerId}/business_profiles`;
|
|
507
503
|
}
|
|
508
504
|
parseResponse(data) {
|
|
509
|
-
return
|
|
505
|
+
return import_zod9.z.array(customerBusinessProfileSchema).parse(data);
|
|
510
506
|
}
|
|
511
507
|
};
|
|
512
508
|
|
|
@@ -554,9 +550,9 @@ var CreateCustomer = class extends import_sdk_js_core13.AbstractApiRequest {
|
|
|
554
550
|
|
|
555
551
|
// src/requests/customers/DeleteCustomer.ts
|
|
556
552
|
var import_sdk_js_core14 = require("@deliverart/sdk-js-core");
|
|
557
|
-
var
|
|
558
|
-
var deleteCustomerInputSchema =
|
|
559
|
-
var deleteCustomerResponseSchema =
|
|
553
|
+
var import_zod10 = require("zod");
|
|
554
|
+
var deleteCustomerInputSchema = import_zod10.z.undefined();
|
|
555
|
+
var deleteCustomerResponseSchema = import_zod10.z.undefined();
|
|
560
556
|
var DeleteCustomer = class extends import_sdk_js_core14.AbstractApiRequest {
|
|
561
557
|
method = "DELETE";
|
|
562
558
|
contentType = "application/json";
|
|
@@ -567,7 +563,7 @@ var DeleteCustomer = class extends import_sdk_js_core14.AbstractApiRequest {
|
|
|
567
563
|
headersSchema = void 0;
|
|
568
564
|
customerId;
|
|
569
565
|
constructor(customerId) {
|
|
570
|
-
super();
|
|
566
|
+
super(void 0);
|
|
571
567
|
this.customerId = customerId;
|
|
572
568
|
}
|
|
573
569
|
getPath() {
|
|
@@ -577,8 +573,8 @@ var DeleteCustomer = class extends import_sdk_js_core14.AbstractApiRequest {
|
|
|
577
573
|
|
|
578
574
|
// src/requests/customers/GetCustomerDetails.ts
|
|
579
575
|
var import_sdk_js_core15 = require("@deliverart/sdk-js-core");
|
|
580
|
-
var
|
|
581
|
-
var getCustomerDetailsInputSchema =
|
|
576
|
+
var import_zod11 = require("zod");
|
|
577
|
+
var getCustomerDetailsInputSchema = import_zod11.z.undefined();
|
|
582
578
|
var getCustomerDetailsResponseSchema = customerDetailsSchema;
|
|
583
579
|
var GetCustomerDetails = class extends import_sdk_js_core15.AbstractApiRequest {
|
|
584
580
|
method = "GET";
|
|
@@ -590,7 +586,7 @@ var GetCustomerDetails = class extends import_sdk_js_core15.AbstractApiRequest {
|
|
|
590
586
|
headersSchema = void 0;
|
|
591
587
|
customerId;
|
|
592
588
|
constructor(customerId) {
|
|
593
|
-
super();
|
|
589
|
+
super(void 0);
|
|
594
590
|
this.customerId = customerId;
|
|
595
591
|
}
|
|
596
592
|
getPath() {
|
|
@@ -600,33 +596,11 @@ var GetCustomerDetails = class extends import_sdk_js_core15.AbstractApiRequest {
|
|
|
600
596
|
|
|
601
597
|
// src/requests/customers/GetCustomers.ts
|
|
602
598
|
var import_sdk_js_core16 = require("@deliverart/sdk-js-core");
|
|
603
|
-
var
|
|
604
|
-
var
|
|
605
|
-
var getCustomersQuerySchema =
|
|
606
|
-
|
|
607
|
-
|
|
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();
|
|
599
|
+
var import_sdk_js_global_types7 = require("@deliverart/sdk-js-global-types");
|
|
600
|
+
var import_zod12 = require("zod");
|
|
601
|
+
var getCustomersQuerySchema = customersQuerySchema;
|
|
602
|
+
var getCustomersInputSchema = import_zod12.z.undefined();
|
|
603
|
+
var getCustomersResponseSchema = (0, import_sdk_js_global_types7.createPaginatedSchema)(customerSchema);
|
|
630
604
|
var GetCustomers = class extends import_sdk_js_core16.AbstractApiRequest {
|
|
631
605
|
method = "GET";
|
|
632
606
|
contentType = "application/json";
|
|
@@ -642,8 +616,8 @@ var GetCustomers = class extends import_sdk_js_core16.AbstractApiRequest {
|
|
|
642
616
|
return "/customers";
|
|
643
617
|
}
|
|
644
618
|
parseResponse(data, rawResponse) {
|
|
645
|
-
const customers =
|
|
646
|
-
return this.validateOutput({ data: customers, pagination: (0,
|
|
619
|
+
const customers = import_zod12.z.array(customerSchema).parse(data);
|
|
620
|
+
return this.validateOutput({ data: customers, pagination: (0, import_sdk_js_global_types7.responseToPagination)(rawResponse) });
|
|
647
621
|
}
|
|
648
622
|
};
|
|
649
623
|
|
|
@@ -694,17 +668,18 @@ var UpdateCustomer = class extends import_sdk_js_core17.AbstractApiRequest {
|
|
|
694
668
|
createCustomerInputSchema,
|
|
695
669
|
createCustomerResponseSchema,
|
|
696
670
|
customerAddressDetailsSchema,
|
|
697
|
-
|
|
698
|
-
|
|
671
|
+
customerAddressIriSchema,
|
|
672
|
+
customerAddressNullableIriSchema,
|
|
699
673
|
customerAddressSchema,
|
|
700
674
|
customerBusinessProfileDetailsSchema,
|
|
701
|
-
|
|
702
|
-
|
|
675
|
+
customerBusinessProfileIriSchema,
|
|
676
|
+
customerBusinessProfileNullableIriSchema,
|
|
703
677
|
customerBusinessProfileSchema,
|
|
704
678
|
customerDetailsSchema,
|
|
705
|
-
|
|
706
|
-
|
|
679
|
+
customerIriSchema,
|
|
680
|
+
customerNullableIriSchema,
|
|
707
681
|
customerSchema,
|
|
682
|
+
customersQuerySchema,
|
|
708
683
|
deleteCustomerAddressInputSchema,
|
|
709
684
|
deleteCustomerAddressResponseSchema,
|
|
710
685
|
deleteCustomerBusinessProfileInputSchema,
|