@deliverart/sdk-js-customer 0.0.3 → 0.0.5
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 +38 -17
- package/dist/index.d.cts +248 -248
- package/dist/index.d.ts +248 -248
- package/dist/index.js +38 -17
- package/package.json +5 -5
- package/src/models.ts +1 -1
- package/src/requests/customers/GetCustomers.ts +4 -4
- package/src/types.ts +36 -12
package/dist/index.js
CHANGED
|
@@ -11,37 +11,58 @@ import { z as z2 } from "zod";
|
|
|
11
11
|
|
|
12
12
|
// src/types.ts
|
|
13
13
|
import { z } from "zod";
|
|
14
|
-
var customerPathSchema = z.string().refine(
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
);
|
|
17
22
|
var customerNullablePathSchema = z.string().nullable().refine(
|
|
18
23
|
(val) => {
|
|
19
24
|
if (!val) return true;
|
|
20
|
-
return /^\/customers\/[
|
|
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
|
+
);
|
|
21
28
|
},
|
|
22
29
|
{
|
|
23
30
|
message: "Invalid customer path format"
|
|
24
31
|
}
|
|
25
32
|
);
|
|
26
|
-
var customerAddressPathSchema = z.string().refine(
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
);
|
|
29
41
|
var customerAddressNullablePathSchema = z.string().nullable().refine(
|
|
30
42
|
(val) => {
|
|
31
43
|
if (!val) return true;
|
|
32
|
-
return /^\/customers\/addresses\/[
|
|
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
|
+
);
|
|
33
47
|
},
|
|
34
48
|
{
|
|
35
49
|
message: "Invalid customerAddress path format"
|
|
36
50
|
}
|
|
37
51
|
);
|
|
38
|
-
var customerBusinessProfilePathSchema = z.string().refine(
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
);
|
|
41
60
|
var customerBusinessProfileNullablePathSchema = z.string().nullable().refine(
|
|
42
61
|
(val) => {
|
|
43
62
|
if (!val) return true;
|
|
44
|
-
return /^\/customers\/business_profiles\/[
|
|
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
|
+
);
|
|
45
66
|
},
|
|
46
67
|
{
|
|
47
68
|
message: "Invalid customerBusinessProfile path format"
|
|
@@ -58,7 +79,7 @@ var customerSchema = z2.object({
|
|
|
58
79
|
hasBusinessProfiles: z2.boolean(),
|
|
59
80
|
hasAddresses: z2.boolean(),
|
|
60
81
|
ordersPlaced: z2.number(),
|
|
61
|
-
totalSpent: z2.
|
|
82
|
+
totalSpent: z2.string(),
|
|
62
83
|
createdAt: datetimeSchema,
|
|
63
84
|
updatedAt: datetimeSchema
|
|
64
85
|
});
|
|
@@ -536,10 +557,10 @@ var getCustomersQuerySchema = z13.object({
|
|
|
536
557
|
"ordersPlaced[lt]": z13.coerce.number().optional(),
|
|
537
558
|
"ordersPlaced[lte]": z13.coerce.number().optional(),
|
|
538
559
|
"totalSpent[between]": z13.coerce.number().optional(),
|
|
539
|
-
"totalSpent[gt]": z13.coerce.
|
|
540
|
-
"totalSpent[gte]": z13.coerce.
|
|
541
|
-
"totalSpent[lt]": z13.coerce.
|
|
542
|
-
"totalSpent[lte]": z13.coerce.
|
|
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(),
|
|
543
564
|
"order[firstName]": sortDirSchema5.optional(),
|
|
544
565
|
"order[lastName]": sortDirSchema5.optional(),
|
|
545
566
|
"order[createdAt]": sortDirSchema5.optional(),
|
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.
|
|
4
|
+
"version": "0.0.5",
|
|
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.
|
|
16
|
-
"@deliverart/sdk-js-global-types": "0.0.
|
|
17
|
-
"@deliverart/sdk-js-point-of-sale": "0.0.
|
|
18
|
-
"@deliverart/sdk-js-user": "0.2.
|
|
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",
|
|
19
19
|
"axios": "1.9.0",
|
|
20
20
|
"zod": "3.25.67"
|
|
21
21
|
},
|
package/src/models.ts
CHANGED
|
@@ -25,10 +25,10 @@ export const getCustomersQuerySchema = z
|
|
|
25
25
|
'ordersPlaced[lt]': z.coerce.number().optional(),
|
|
26
26
|
'ordersPlaced[lte]': z.coerce.number().optional(),
|
|
27
27
|
'totalSpent[between]': z.coerce.number().optional(),
|
|
28
|
-
'totalSpent[gt]': z.coerce.
|
|
29
|
-
'totalSpent[gte]': z.coerce.
|
|
30
|
-
'totalSpent[lt]': z.coerce.
|
|
31
|
-
'totalSpent[lte]': z.coerce.
|
|
28
|
+
'totalSpent[gt]': z.coerce.string().optional(),
|
|
29
|
+
'totalSpent[gte]': z.coerce.string().optional(),
|
|
30
|
+
'totalSpent[lt]': z.coerce.string().optional(),
|
|
31
|
+
'totalSpent[lte]': z.coerce.string().optional(),
|
|
32
32
|
'order[firstName]': sortDirSchema.optional(),
|
|
33
33
|
'order[lastName]': sortDirSchema.optional(),
|
|
34
34
|
'order[createdAt]': sortDirSchema.optional(),
|
package/src/types.ts
CHANGED
|
@@ -2,9 +2,15 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
export const customerPathSchema = z
|
|
4
4
|
.string()
|
|
5
|
-
.refine(
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
.refine(
|
|
6
|
+
val =>
|
|
7
|
+
/^\/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(
|
|
8
|
+
val,
|
|
9
|
+
),
|
|
10
|
+
{
|
|
11
|
+
message: 'Invalid customer path format',
|
|
12
|
+
},
|
|
13
|
+
)
|
|
8
14
|
export type CustomerPath = z.infer<typeof customerPathSchema>
|
|
9
15
|
|
|
10
16
|
export const customerNullablePathSchema = z
|
|
@@ -13,7 +19,9 @@ export const customerNullablePathSchema = z
|
|
|
13
19
|
.refine(
|
|
14
20
|
val => {
|
|
15
21
|
if (!val) return true
|
|
16
|
-
return /^\/customers\/[
|
|
22
|
+
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(
|
|
23
|
+
val,
|
|
24
|
+
)
|
|
17
25
|
},
|
|
18
26
|
{
|
|
19
27
|
message: 'Invalid customer path format',
|
|
@@ -23,9 +31,15 @@ export type CustomerNullablePath = z.infer<typeof customerNullablePathSchema>
|
|
|
23
31
|
|
|
24
32
|
export const customerAddressPathSchema = z
|
|
25
33
|
.string()
|
|
26
|
-
.refine(
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
.refine(
|
|
35
|
+
val =>
|
|
36
|
+
/^\/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(
|
|
37
|
+
val,
|
|
38
|
+
),
|
|
39
|
+
{
|
|
40
|
+
message: 'Invalid customerAddress path format',
|
|
41
|
+
},
|
|
42
|
+
)
|
|
29
43
|
export type CustomerAddressPath = z.infer<typeof customerAddressPathSchema>
|
|
30
44
|
|
|
31
45
|
export const customerAddressNullablePathSchema = z
|
|
@@ -34,7 +48,9 @@ export const customerAddressNullablePathSchema = z
|
|
|
34
48
|
.refine(
|
|
35
49
|
val => {
|
|
36
50
|
if (!val) return true
|
|
37
|
-
return /^\/customers\/addresses\/[
|
|
51
|
+
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(
|
|
52
|
+
val,
|
|
53
|
+
)
|
|
38
54
|
},
|
|
39
55
|
{
|
|
40
56
|
message: 'Invalid customerAddress path format',
|
|
@@ -44,9 +60,15 @@ export type CustomerAddressNullablePath = z.infer<typeof customerAddressNullable
|
|
|
44
60
|
|
|
45
61
|
export const customerBusinessProfilePathSchema = z
|
|
46
62
|
.string()
|
|
47
|
-
.refine(
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
.refine(
|
|
64
|
+
val =>
|
|
65
|
+
/^\/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(
|
|
66
|
+
val,
|
|
67
|
+
),
|
|
68
|
+
{
|
|
69
|
+
message: 'Invalid customerBusinessProfile path format',
|
|
70
|
+
},
|
|
71
|
+
)
|
|
50
72
|
export type CustomerBusinessProfilePath = z.infer<typeof customerBusinessProfilePathSchema>
|
|
51
73
|
|
|
52
74
|
export const customerBusinessProfileNullablePathSchema = z
|
|
@@ -55,7 +77,9 @@ export const customerBusinessProfileNullablePathSchema = z
|
|
|
55
77
|
.refine(
|
|
56
78
|
val => {
|
|
57
79
|
if (!val) return true
|
|
58
|
-
return /^\/customers\/business_profiles\/[
|
|
80
|
+
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(
|
|
81
|
+
val,
|
|
82
|
+
)
|
|
59
83
|
},
|
|
60
84
|
{
|
|
61
85
|
message: 'Invalid customerBusinessProfile path format',
|