@medusajs/types 1.12.0-snapshot-20240403120107 → 1.12.0-snapshot-20240405154416
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/common/auth-user.d.ts +21 -16
- package/dist/auth/common/auth-user.d.ts.map +1 -1
- package/dist/auth/common/provider.d.ts +28 -15
- package/dist/auth/common/provider.d.ts.map +1 -1
- package/dist/auth/service.d.ts +137 -75
- package/dist/auth/service.d.ts.map +1 -1
- package/dist/bundles.d.ts +2 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +3 -1
- package/dist/bundles.js.map +1 -1
- package/dist/cart/common.d.ts +443 -62
- package/dist/cart/common.d.ts.map +1 -1
- package/dist/cart/mutations.d.ts +483 -0
- package/dist/cart/mutations.d.ts.map +1 -1
- package/dist/cart/mutations.js.map +1 -1
- package/dist/cart/service.d.ts +1607 -0
- package/dist/cart/service.d.ts.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/rule.d.ts +2 -0
- package/dist/common/rule.d.ts.map +1 -0
- package/dist/common/rule.js +3 -0
- package/dist/common/rule.js.map +1 -0
- package/dist/customer/service.d.ts +445 -197
- package/dist/customer/service.d.ts.map +1 -1
- package/dist/file/common.d.ts +14 -0
- package/dist/file/common.d.ts.map +1 -0
- package/dist/file/common.js +3 -0
- package/dist/file/common.js.map +1 -0
- package/dist/file/index.d.ts +4 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +20 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/mutations.d.ts +18 -0
- package/dist/file/mutations.d.ts.map +1 -0
- package/dist/file/mutations.js +3 -0
- package/dist/file/mutations.js.map +1 -0
- package/dist/file/service.d.ts +76 -0
- package/dist/file/service.d.ts.map +1 -0
- package/dist/file/service.js +3 -0
- package/dist/file/service.js.map +1 -0
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts +2 -2
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts.map +1 -1
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts +22 -0
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts +17 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts +14 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts +12 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts +15 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts +27 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment.js.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts +17 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.js +3 -0
- package/dist/http/fulfillment/admin/geo-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/index.d.ts +13 -0
- package/dist/http/fulfillment/admin/index.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/index.js +29 -0
- package/dist/http/fulfillment/admin/index.js.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts +14 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.js +3 -0
- package/dist/http/fulfillment/admin/service-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts +16 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts +14 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts +31 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts +13 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.js +3 -0
- package/dist/http/fulfillment/admin/shipping-profile.js.map +1 -0
- package/dist/http/fulfillment/index.d.ts +2 -0
- package/dist/http/fulfillment/index.d.ts.map +1 -0
- package/dist/http/fulfillment/index.js +18 -0
- package/dist/http/fulfillment/index.js.map +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +18 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/common/inventory-item.d.ts +55 -64
- package/dist/inventory/common/inventory-item.d.ts.map +1 -1
- package/dist/inventory/common/inventory-level.d.ts +37 -37
- package/dist/inventory/common/inventory-level.d.ts.map +1 -1
- package/dist/inventory/common/reservation-item.d.ts +34 -44
- package/dist/inventory/common/reservation-item.d.ts.map +1 -1
- package/dist/inventory/service-next.d.ts +596 -534
- package/dist/inventory/service-next.d.ts.map +1 -1
- package/dist/payment/common.d.ts +175 -54
- package/dist/payment/common.d.ts.map +1 -1
- package/dist/payment/common.js +3 -3
- package/dist/payment/common.js.map +1 -1
- package/dist/payment/mutations.d.ts +58 -17
- package/dist/payment/mutations.d.ts.map +1 -1
- package/dist/payment/provider.d.ts +128 -43
- package/dist/payment/provider.d.ts.map +1 -1
- package/dist/payment/provider.js.map +1 -1
- package/dist/payment/service.d.ts +460 -39
- package/dist/payment/service.d.ts.map +1 -1
- package/dist/pricing/common/price-list.d.ts +2 -2
- package/dist/pricing/common/price-set.d.ts +6 -4
- package/dist/pricing/common/price-set.d.ts.map +1 -1
- package/dist/pricing/service.d.ts +731 -1695
- package/dist/pricing/service.d.ts.map +1 -1
- package/dist/promotion/common/application-method.d.ts +153 -0
- package/dist/promotion/common/application-method.d.ts.map +1 -1
- package/dist/promotion/common/campaign-budget.d.ts +37 -0
- package/dist/promotion/common/campaign-budget.d.ts.map +1 -1
- package/dist/promotion/common/campaign.d.ts +36 -0
- package/dist/promotion/common/campaign.d.ts.map +1 -1
- package/dist/promotion/common/compute-actions.d.ts +135 -0
- package/dist/promotion/common/compute-actions.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule-value.d.ts +30 -0
- package/dist/promotion/common/promotion-rule-value.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule.d.ts +77 -0
- package/dist/promotion/common/promotion-rule.d.ts.map +1 -1
- package/dist/promotion/common/promotion.d.ts +100 -0
- package/dist/promotion/common/promotion.d.ts.map +1 -1
- package/dist/promotion/mutations.d.ts +84 -0
- package/dist/promotion/mutations.d.ts.map +1 -1
- package/dist/promotion/service.d.ts +786 -0
- package/dist/promotion/service.d.ts.map +1 -1
- package/dist/region/common.d.ts +1 -1
- package/dist/region/common.d.ts.map +1 -1
- package/dist/region/service.d.ts +1 -1
- package/dist/stock-location/common.d.ts +14 -0
- package/dist/stock-location/common.d.ts.map +1 -1
- package/dist/stock-location/service-next.d.ts +178 -186
- package/dist/stock-location/service-next.d.ts.map +1 -1
- package/dist/store/common/store.d.ts +42 -0
- package/dist/store/common/store.d.ts.map +1 -1
- package/dist/store/mutations/store.d.ts +75 -0
- package/dist/store/mutations/store.d.ts.map +1 -1
- package/dist/store/service.d.ts +113 -75
- package/dist/store/service.d.ts.map +1 -1
- package/dist/tax/common.d.ts +298 -10
- package/dist/tax/common.d.ts.map +1 -1
- package/dist/tax/mutations.d.ts +157 -0
- package/dist/tax/mutations.d.ts.map +1 -1
- package/dist/tax/provider.d.ts +126 -0
- package/dist/tax/provider.d.ts.map +1 -1
- package/dist/tax/service.d.ts +600 -0
- package/dist/tax/service.d.ts.map +1 -1
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -1
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/region/create-regions.d.ts +8 -0
- package/dist/workflow/region/create-regions.d.ts.map +1 -0
- package/dist/workflow/region/create-regions.js +3 -0
- package/dist/workflow/region/create-regions.js.map +1 -0
- package/dist/workflow/region/index.d.ts +3 -0
- package/dist/workflow/region/index.d.ts.map +1 -0
- package/dist/workflow/region/index.js +19 -0
- package/dist/workflow/region/index.js.map +1 -0
- package/dist/workflow/region/update-regions.d.ts +9 -0
- package/dist/workflow/region/update-regions.d.ts.map +1 -0
- package/dist/workflow/region/update-regions.js +3 -0
- package/dist/workflow/region/update-regions.js.map +1 -0
- package/package.json +1 -1
@@ -5,7 +5,7 @@ import { Context } from "../shared-context";
|
|
5
5
|
import { CustomerAddressDTO, CustomerDTO, CustomerGroupCustomerDTO, CustomerGroupDTO, FilterableCustomerAddressProps, FilterableCustomerGroupCustomerProps, FilterableCustomerGroupProps, FilterableCustomerProps, GroupCustomerPair } from "./common";
|
6
6
|
import { CreateCustomerAddressDTO, CreateCustomerDTO, CreateCustomerGroupDTO, CustomerGroupUpdatableFields, CustomerUpdatableFields, UpdateCustomerAddressDTO } from "./mutations";
|
7
7
|
/**
|
8
|
-
* The main service interface for the
|
8
|
+
* The main service interface for the Customer Module.
|
9
9
|
*/
|
10
10
|
export interface ICustomerModuleService extends IModuleService {
|
11
11
|
/**
|
@@ -18,77 +18,106 @@ export interface ICustomerModuleService extends IModuleService {
|
|
18
18
|
* @returns {Promise<CustomerDTO>} The retrieved customer.
|
19
19
|
*
|
20
20
|
* @example
|
21
|
-
* A simple example that retrieves a
|
21
|
+
* A simple example that retrieves a customer by its ID:
|
22
22
|
*
|
23
23
|
* ```ts
|
24
|
-
*
|
24
|
+
* const customer =
|
25
|
+
* await customerModuleService.retrieve("cus_123")
|
25
26
|
* ```
|
26
27
|
*
|
27
28
|
* To specify relations that should be retrieved:
|
28
29
|
*
|
29
30
|
* ```ts
|
30
|
-
*
|
31
|
+
* const customer = await customerModuleService.retrieve(
|
32
|
+
* "cus_123",
|
33
|
+
* {
|
34
|
+
* relations: ["groups"],
|
35
|
+
* }
|
36
|
+
* )
|
31
37
|
* ```
|
32
|
-
*
|
33
|
-
*
|
34
38
|
*/
|
35
39
|
retrieve(customerId: string, config?: FindConfig<CustomerDTO>, sharedContext?: Context): Promise<CustomerDTO>;
|
36
40
|
/**
|
37
|
-
* This method creates customers
|
41
|
+
* This method creates customers.
|
38
42
|
*
|
39
43
|
* @param {CreateCustomerDTO[]} data - The customers to be created.
|
40
44
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
41
45
|
* @returns {Promise<CustomerDTO[]>} The created customers.
|
42
46
|
*
|
43
47
|
* @example
|
44
|
-
*
|
48
|
+
* const customers = await customerModuleService.create([
|
49
|
+
* {
|
50
|
+
* email: "john@smith.com",
|
51
|
+
* first_name: "John",
|
52
|
+
* last_name: "Smith",
|
53
|
+
* },
|
54
|
+
* ])
|
45
55
|
*/
|
46
56
|
create(data: CreateCustomerDTO[], sharedContext?: Context): Promise<CustomerDTO[]>;
|
47
57
|
/**
|
48
|
-
* This method creates customer
|
58
|
+
* This method creates a customer.
|
49
59
|
*
|
50
60
|
* @param {CreateCustomerDTO} data - The customer to be created.
|
51
61
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
52
62
|
* @returns {Promise<CustomerDTO>} The created customer.
|
53
63
|
*
|
54
64
|
* @example
|
55
|
-
* {
|
65
|
+
* const customer = await customerModuleService.create({
|
66
|
+
* email: "john@smith.com",
|
67
|
+
* first_name: "John",
|
68
|
+
* last_name: "Smith",
|
69
|
+
* })
|
56
70
|
*/
|
57
71
|
create(data: CreateCustomerDTO, sharedContext?: Context): Promise<CustomerDTO>;
|
58
72
|
/**
|
59
|
-
* This method updates existing customer.
|
73
|
+
* This method updates an existing customer.
|
60
74
|
*
|
61
75
|
* @param {string} customerId - The customer's ID.
|
62
|
-
* @param {CustomerUpdatableFields} data - The
|
76
|
+
* @param {CustomerUpdatableFields} data - The updatable fields of a customer.
|
63
77
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
64
78
|
* @returns {Promise<CustomerDTO>} The updated customer.
|
65
79
|
*
|
66
80
|
* @example
|
67
|
-
*
|
81
|
+
* const customer = await customerModuleService.update(
|
82
|
+
* "cus_123",
|
83
|
+
* {
|
84
|
+
* first_name: "Matt",
|
85
|
+
* }
|
86
|
+
* )
|
68
87
|
*/
|
69
88
|
update(customerId: string, data: CustomerUpdatableFields, sharedContext?: Context): Promise<CustomerDTO>;
|
70
89
|
/**
|
71
90
|
* This method updates existing customers.
|
72
91
|
*
|
73
|
-
* @param {string[]} customerIds - The
|
74
|
-
* @param {CustomerUpdatableFields} data - The
|
92
|
+
* @param {string[]} customerIds - The IDs of customers to update.
|
93
|
+
* @param {CustomerUpdatableFields} data - The attributes to update in the customers.
|
75
94
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
76
95
|
* @returns {Promise<CustomerDTO[]>} The updated customers.
|
77
96
|
*
|
78
97
|
* @example
|
79
|
-
*
|
98
|
+
* const customers = await customerModuleService.update(
|
99
|
+
* ["cus_123", "cus_321"],
|
100
|
+
* {
|
101
|
+
* company_name: "Acme",
|
102
|
+
* }
|
103
|
+
* )
|
80
104
|
*/
|
81
105
|
update(customerIds: string[], data: CustomerUpdatableFields, sharedContext?: Context): Promise<CustomerDTO[]>;
|
82
106
|
/**
|
83
|
-
* This method updates existing customers.
|
107
|
+
* This method updates existing customers.
|
84
108
|
*
|
85
|
-
* @param {FilterableCustomerProps} selector - The filters
|
86
|
-
* @param {CustomerUpdatableFields} data - The
|
109
|
+
* @param {FilterableCustomerProps} selector - The filters that specify which API keys should be updated.
|
110
|
+
* @param {CustomerUpdatableFields} data - The attributes to update in the customers.
|
87
111
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
88
112
|
* @returns {Promise<CustomerDTO[]>} The updated customers.
|
89
113
|
*
|
90
114
|
* @example
|
91
|
-
*
|
115
|
+
* const customers = await customerModuleService.update(
|
116
|
+
* { company_name: "Acme" },
|
117
|
+
* {
|
118
|
+
* company_name: "Acme Inc.",
|
119
|
+
* }
|
120
|
+
* )
|
92
121
|
*/
|
93
122
|
update(selector: FilterableCustomerProps, data: CustomerUpdatableFields, sharedContext?: Context): Promise<CustomerDTO[]>;
|
94
123
|
/**
|
@@ -99,157 +128,192 @@ export interface ICustomerModuleService extends IModuleService {
|
|
99
128
|
* @returns {Promise<void>} Resolves when the customer is deleted successfully.
|
100
129
|
*
|
101
130
|
* @example
|
102
|
-
*
|
131
|
+
* await customerModuleService.delete("cus_123")
|
103
132
|
*/
|
104
133
|
delete(customerId: string, sharedContext?: Context): Promise<void>;
|
105
134
|
/**
|
106
135
|
* This method deletes customers by their IDs.
|
107
136
|
*
|
108
|
-
* @param {string[]} customerIds - The
|
137
|
+
* @param {string[]} customerIds - The IDs of customers.
|
109
138
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
110
139
|
* @returns {Promise<void>} Resolves when the customers are deleted successfully.
|
111
140
|
*
|
112
141
|
* @example
|
113
|
-
*
|
142
|
+
* await customerModuleService.delete(["cus_123", "cus_321"])
|
114
143
|
*/
|
115
144
|
delete(customerIds: string[], sharedContext?: Context): Promise<void>;
|
116
145
|
/**
|
117
|
-
* This method deletes
|
146
|
+
* This method deletes a customer matching the specified filters.
|
118
147
|
*
|
119
|
-
* @param {FilterableCustomerProps} selector - The filters
|
148
|
+
* @param {FilterableCustomerProps} selector - The filters that specify which customers should be deleted.
|
120
149
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
121
|
-
* @returns {Promise<void>} Resolves when the customers are deleted.
|
150
|
+
* @returns {Promise<void>} Resolves when the customers are deleted successfully.
|
122
151
|
*
|
123
152
|
* @example
|
124
|
-
* {
|
153
|
+
* await customerModuleService.delete({
|
154
|
+
* id: ["cus_123"],
|
155
|
+
* })
|
125
156
|
*/
|
126
157
|
delete(selector: FilterableCustomerProps, sharedContext?: Context): Promise<void>;
|
127
158
|
/**
|
128
159
|
* This method creates customer groups.
|
129
160
|
*
|
130
|
-
* @param {CreateCustomerGroupDTO[]} data - The
|
161
|
+
* @param {CreateCustomerGroupDTO[]} data - The customer groups to be created.
|
131
162
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
132
163
|
* @returns {Promise<CustomerGroupDTO[]>} The created customer groups.
|
133
164
|
*
|
134
|
-
*
|
135
165
|
* @privateRemarks
|
136
166
|
* TODO should be pluralized
|
167
|
+
*
|
168
|
+
* @example
|
169
|
+
* const customerGroup =
|
170
|
+
* await customerModuleService.createCustomerGroup([
|
171
|
+
* {
|
172
|
+
* name: "VIP",
|
173
|
+
* },
|
174
|
+
* ])
|
137
175
|
*/
|
138
176
|
createCustomerGroup(data: CreateCustomerGroupDTO[], sharedContext?: Context): Promise<CustomerGroupDTO[]>;
|
139
177
|
/**
|
140
178
|
* This method creates a customer group.
|
141
179
|
*
|
142
|
-
* @param {CreateCustomerGroupDTO} data - The
|
180
|
+
* @param {CreateCustomerGroupDTO} data - The customer group to be created.
|
143
181
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
144
182
|
* @returns {Promise<CustomerGroupDTO>} The created customer group.
|
145
183
|
*
|
146
184
|
* @privateRemarks
|
147
185
|
* TODO should be pluralized
|
186
|
+
*
|
187
|
+
* @example
|
188
|
+
* const customerGroup =
|
189
|
+
* await customerModuleService.createCustomerGroup({
|
190
|
+
* name: "VIP",
|
191
|
+
* })
|
148
192
|
*/
|
149
193
|
createCustomerGroup(data: CreateCustomerGroupDTO, sharedContext?: Context): Promise<CustomerGroupDTO>;
|
150
194
|
/**
|
151
195
|
* This method retrieves a customer group by its ID.
|
152
196
|
*
|
153
|
-
* @param {string} groupId - The group's ID.
|
197
|
+
* @param {string} groupId - The customer group's ID.
|
154
198
|
* @param {FindConfig<CustomerGroupDTO>} config - The configurations determining how the customer group is retrieved. Its properties, such as `select` or `relations`, accept the
|
155
199
|
* attributes or relations associated with a customer group.
|
156
200
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
157
|
-
* @returns {Promise<CustomerGroupDTO>} The retrieved customer group
|
201
|
+
* @returns {Promise<CustomerGroupDTO>} The retrieved customer group.
|
158
202
|
*
|
159
203
|
* @example
|
160
|
-
*
|
161
|
-
*
|
162
|
-
* ```ts
|
163
|
-
* {example-code}
|
164
|
-
* ```
|
165
|
-
*
|
166
|
-
* To specify relations that should be retrieved:
|
167
|
-
*
|
168
|
-
* ```ts
|
169
|
-
* {example-code}
|
170
|
-
* ```
|
171
|
-
*
|
172
|
-
*
|
204
|
+
* const customerGroup =
|
205
|
+
* await customerModuleService.retrieve("cusgroup_123")
|
173
206
|
*/
|
174
207
|
retrieveCustomerGroup(groupId: string, config?: FindConfig<CustomerGroupDTO>, sharedContext?: Context): Promise<CustomerGroupDTO>;
|
175
208
|
/**
|
176
|
-
* This method updates existing customer group.
|
209
|
+
* This method updates an existing customer group.
|
177
210
|
*
|
178
211
|
* @param {string} groupId - The group's ID.
|
179
|
-
* @param {CustomerGroupUpdatableFields} data - The
|
212
|
+
* @param {CustomerGroupUpdatableFields} data - The attributes to update in the customer group.
|
180
213
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
181
214
|
* @returns {Promise<CustomerGroupDTO>} The updated customer group.
|
182
215
|
*
|
183
216
|
* @example
|
184
|
-
*
|
217
|
+
* const customerGroup =
|
218
|
+
* await customerModuleService.updateCustomerGroups(
|
219
|
+
* "cusgroup_123",
|
220
|
+
* {
|
221
|
+
* name: "Very Important",
|
222
|
+
* }
|
223
|
+
* )
|
185
224
|
*/
|
186
225
|
updateCustomerGroups(groupId: string, data: CustomerGroupUpdatableFields, sharedContext?: Context): Promise<CustomerGroupDTO>;
|
187
226
|
/**
|
188
227
|
* This method updates existing customer groups.
|
189
228
|
*
|
190
|
-
* @param {string[]} groupIds - The
|
191
|
-
* @param {CustomerGroupUpdatableFields} data - The
|
229
|
+
* @param {string[]} groupIds - The IDs of customer groups.
|
230
|
+
* @param {CustomerGroupUpdatableFields} data - The attributes to update in the customer groups.
|
192
231
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
193
232
|
* @returns {Promise<CustomerGroupDTO[]>} The updated customer groups.
|
194
233
|
*
|
195
234
|
* @example
|
196
|
-
*
|
235
|
+
* const customerGroups =
|
236
|
+
* await customerModuleService.updateCustomerGroups(
|
237
|
+
* ["cusgroup_123", "cusgroup_321"],
|
238
|
+
* {
|
239
|
+
* name: "Very Important",
|
240
|
+
* }
|
241
|
+
* )
|
197
242
|
*/
|
198
243
|
updateCustomerGroups(groupIds: string[], data: CustomerGroupUpdatableFields, sharedContext?: Context): Promise<CustomerGroupDTO[]>;
|
199
244
|
/**
|
200
|
-
* This method updates existing customer groups.
|
245
|
+
* This method updates existing customer groups.
|
201
246
|
*
|
202
|
-
* @param {FilterableCustomerGroupProps} selector - The filters
|
203
|
-
* @param {CustomerGroupUpdatableFields} data - The
|
247
|
+
* @param {FilterableCustomerGroupProps} selector - The filters that specify which customer groups should be updates.
|
248
|
+
* @param {CustomerGroupUpdatableFields} data - The attributes to update in the customer groups.
|
204
249
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
205
250
|
* @returns {Promise<CustomerGroupDTO[]>} The updated customer groups.
|
206
251
|
*
|
207
252
|
* @example
|
208
|
-
*
|
253
|
+
* const customerGroups =
|
254
|
+
* await customerModuleService.updateCustomerGroups(
|
255
|
+
* {
|
256
|
+
* name: "VIP",
|
257
|
+
* },
|
258
|
+
* {
|
259
|
+
* name: "Very Important",
|
260
|
+
* }
|
261
|
+
* )
|
209
262
|
*/
|
210
263
|
updateCustomerGroups(selector: FilterableCustomerGroupProps, data: CustomerGroupUpdatableFields, sharedContext?: Context): Promise<CustomerGroupDTO[]>;
|
211
264
|
/**
|
212
265
|
* This method deletes a customer group by its ID.
|
213
266
|
*
|
214
|
-
* @param {string} groupId - The group's ID.
|
267
|
+
* @param {string} groupId - The customer group's ID.
|
215
268
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
216
|
-
* @returns {Promise<void>} Resolves when the customer group is deleted.
|
269
|
+
* @returns {Promise<void>} Resolves when the customer group is deleted successfully.
|
217
270
|
*
|
218
271
|
* @example
|
219
|
-
*
|
272
|
+
* await customerModuleService.deleteCustomerGroups(
|
273
|
+
* "cusgroup_123"
|
274
|
+
* )
|
220
275
|
*/
|
221
276
|
deleteCustomerGroups(groupId: string, sharedContext?: Context): Promise<void>;
|
222
277
|
/**
|
223
|
-
* This method deletes customer groups by their
|
278
|
+
* This method deletes customer groups by their IDs.
|
224
279
|
*
|
225
|
-
* @param {string[]} groupIds - The
|
280
|
+
* @param {string[]} groupIds - The IDs of customer groups.
|
226
281
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
227
|
-
* @returns {Promise<void>} Resolves when the customer groups are deleted.
|
282
|
+
* @returns {Promise<void>} Resolves when the customer groups are deleted successfully.
|
228
283
|
*
|
229
284
|
* @example
|
230
|
-
*
|
285
|
+
* await customerModuleService.deleteCustomerGroups([
|
286
|
+
* "cusgroup_123",
|
287
|
+
* "cusgroup_321",
|
288
|
+
* ])
|
231
289
|
*/
|
232
290
|
deleteCustomerGroups(groupIds: string[], sharedContext?: Context): Promise<void>;
|
233
291
|
/**
|
234
|
-
* This method deletes customer groups matching the specified filters
|
292
|
+
* This method deletes customer groups matching the specified filters.
|
235
293
|
*
|
236
|
-
* @param {FilterableCustomerGroupProps} selector - The filters
|
294
|
+
* @param {FilterableCustomerGroupProps} selector - The filters that specify which customer group to delete.
|
237
295
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
238
|
-
* @returns {Promise<void>} Resolves when the customer groups are deleted.
|
296
|
+
* @returns {Promise<void>} Resolves when the customer groups are deleted successfully.
|
239
297
|
*
|
240
298
|
* @example
|
241
|
-
* {
|
299
|
+
* await customerModuleService.deleteCustomerGroups({
|
300
|
+
* name: "VIP",
|
301
|
+
* })
|
242
302
|
*/
|
243
303
|
deleteCustomerGroups(selector: FilterableCustomerGroupProps, sharedContext?: Context): Promise<void>;
|
244
304
|
/**
|
245
|
-
* This method adds
|
305
|
+
* This method adds a customer to a group.
|
246
306
|
*
|
247
307
|
* @param {GroupCustomerPair} groupCustomerPair - The details of the customer and the group it should be added to.
|
248
308
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
249
309
|
* @returns {Promise<{ id: string; }>} The ID of the relation between the customer and the group.
|
250
310
|
*
|
251
311
|
* @example
|
252
|
-
*
|
312
|
+
* const customerGroupCustomerId =
|
313
|
+
* await customerModuleService.addCustomerToGroup({
|
314
|
+
* customer_id: "cus_123",
|
315
|
+
* customer_group_id: "cus_321",
|
316
|
+
* })
|
253
317
|
*/
|
254
318
|
addCustomerToGroup(groupCustomerPair: GroupCustomerPair, sharedContext?: Context): Promise<{
|
255
319
|
/**
|
@@ -260,13 +324,18 @@ export interface ICustomerModuleService extends IModuleService {
|
|
260
324
|
/**
|
261
325
|
* This method adds customers to groups.
|
262
326
|
*
|
263
|
-
* @param {GroupCustomerPair[]} groupCustomerPairs - A list of
|
264
|
-
* group it should be added to.
|
327
|
+
* @param {GroupCustomerPair[]} groupCustomerPairs - A list of items, each being the details of a customer and the group it should be added to.
|
265
328
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
266
|
-
* @returns {Promise<{ id: string; }[]>} The
|
329
|
+
* @returns {Promise<{ id: string; }[]>} The IDs of the relations between each of the customer and group pairs.
|
267
330
|
*
|
268
331
|
* @example
|
269
|
-
*
|
332
|
+
* const customerGroupCustomerIds =
|
333
|
+
* await customerModuleService.addCustomerToGroup([
|
334
|
+
* {
|
335
|
+
* customer_id: "cus_123",
|
336
|
+
* customer_group_id: "cus_321",
|
337
|
+
* },
|
338
|
+
* ])
|
270
339
|
*/
|
271
340
|
addCustomerToGroup(groupCustomerPairs: GroupCustomerPair[], sharedContext?: Context): Promise<{
|
272
341
|
/**
|
@@ -277,82 +346,126 @@ export interface ICustomerModuleService extends IModuleService {
|
|
277
346
|
/**
|
278
347
|
* This method removes a customer from a group.
|
279
348
|
*
|
280
|
-
* @param {GroupCustomerPair} groupCustomerPair - The details of the customer and
|
349
|
+
* @param {GroupCustomerPair} groupCustomerPair - The details of the customer and the group it should be removed from.
|
281
350
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
282
351
|
* @returns {Promise<void>} Resolves when the customer is removed from the group successfully.
|
283
352
|
*
|
284
353
|
* @privateRemarks
|
285
354
|
* TODO should be pluralized
|
355
|
+
*
|
356
|
+
* @example
|
357
|
+
* await customerModuleService.removeCustomerFromGroup({
|
358
|
+
* customer_id: "cus_123",
|
359
|
+
* customer_group_id: "cus_321",
|
360
|
+
* })
|
286
361
|
*/
|
287
362
|
removeCustomerFromGroup(groupCustomerPair: GroupCustomerPair, sharedContext?: Context): Promise<void>;
|
288
363
|
/**
|
289
364
|
* This method removes customers from groups.
|
290
365
|
*
|
291
|
-
* @param {GroupCustomerPair[]} groupCustomerPairs - A list of
|
292
|
-
* group it should be removed from.
|
366
|
+
* @param {GroupCustomerPair[]} groupCustomerPairs - A list of items, each being the details of a customer and the group it should be removed from.
|
293
367
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
294
368
|
* @returns {Promise<void>} Resolves when the customers are removed from the groups successfully.
|
295
369
|
*
|
296
370
|
* @privateRemarks
|
297
371
|
* TODO should be pluralized
|
372
|
+
*
|
373
|
+
* @example
|
374
|
+
* await customerModuleService.removeCustomerFromGroup([
|
375
|
+
* {
|
376
|
+
* customer_id: "cus_123",
|
377
|
+
* customer_group_id: "cus_321",
|
378
|
+
* },
|
379
|
+
* ])
|
298
380
|
*/
|
299
381
|
removeCustomerFromGroup(groupCustomerPairs: GroupCustomerPair[], sharedContext?: Context): Promise<void>;
|
300
382
|
/**
|
301
|
-
* This method adds addresses to
|
383
|
+
* This method adds addresses to customers.
|
302
384
|
*
|
303
|
-
* @param {CreateCustomerAddressDTO[]} addresses -
|
385
|
+
* @param {CreateCustomerAddressDTO[]} addresses - A list of items, each being the details of the address to add to a customer.
|
304
386
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
305
|
-
* @returns {Promise<CustomerAddressDTO[]>} The created
|
387
|
+
* @returns {Promise<CustomerAddressDTO[]>} The list of created addresses.
|
306
388
|
*
|
307
389
|
* @example
|
308
|
-
*
|
390
|
+
* const addresses = await customerModuleService.addAddresses([
|
391
|
+
* {
|
392
|
+
* customer_id: "cus_123",
|
393
|
+
* address_name: "Home",
|
394
|
+
* address_1: "432 Stierlin Rd",
|
395
|
+
* city: "Mountain View",
|
396
|
+
* country_code: "us",
|
397
|
+
* },
|
398
|
+
* ])
|
309
399
|
*/
|
310
400
|
addAddresses(addresses: CreateCustomerAddressDTO[], sharedContext?: Context): Promise<CustomerAddressDTO[]>;
|
311
401
|
/**
|
312
|
-
* This method adds an address to a customer
|
402
|
+
* This method adds an address to a customer.
|
313
403
|
*
|
314
|
-
* @param {CreateCustomerAddressDTO} address - The
|
404
|
+
* @param {CreateCustomerAddressDTO} address - The details of the address to add to a customer.
|
315
405
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
316
|
-
* @returns {Promise<CustomerAddressDTO>} The created
|
406
|
+
* @returns {Promise<CustomerAddressDTO>} The created address.
|
317
407
|
*
|
318
408
|
* @example
|
319
|
-
* {
|
409
|
+
* const address = await customerModuleService.addAddresses({
|
410
|
+
* customer_id: "cus_123",
|
411
|
+
* address_name: "Home",
|
412
|
+
* address_1: "432 Stierlin Rd",
|
413
|
+
* city: "Mountain View",
|
414
|
+
* country_code: "us",
|
415
|
+
* })
|
320
416
|
*/
|
321
417
|
addAddresses(address: CreateCustomerAddressDTO, sharedContext?: Context): Promise<CustomerAddressDTO>;
|
322
418
|
/**
|
323
|
-
* This method updates an
|
419
|
+
* This method updates an address.
|
324
420
|
*
|
325
421
|
* @param {string} addressId - The address's ID.
|
326
|
-
* @param {UpdateCustomerAddressDTO} data - The attributes to update in the
|
422
|
+
* @param {UpdateCustomerAddressDTO} data - The attributes to update in the address.
|
327
423
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
328
|
-
* @returns {Promise<CustomerAddressDTO>} The updated
|
424
|
+
* @returns {Promise<CustomerAddressDTO>} The updated address.
|
329
425
|
*
|
330
426
|
* @example
|
331
|
-
*
|
427
|
+
* const address = await customerModuleService.updateAddresses(
|
428
|
+
* "cuaddr_123",
|
429
|
+
* {
|
430
|
+
* first_name: "John",
|
431
|
+
* last_name: "Smith",
|
432
|
+
* }
|
433
|
+
* )
|
332
434
|
*/
|
333
435
|
updateAddresses(addressId: string, data: UpdateCustomerAddressDTO, sharedContext?: Context): Promise<CustomerAddressDTO>;
|
334
436
|
/**
|
335
437
|
* This method updates existing addresses.
|
336
438
|
*
|
337
|
-
* @param {string[]} addressIds - The
|
338
|
-
* @param {UpdateCustomerAddressDTO} data - The attributes to update in
|
439
|
+
* @param {string[]} addressIds - The IDs of addresses to update.
|
440
|
+
* @param {UpdateCustomerAddressDTO} data - The attributes to update in the addresses.
|
339
441
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
340
|
-
* @returns {Promise<CustomerAddressDTO[]>} The updated
|
442
|
+
* @returns {Promise<CustomerAddressDTO[]>} The updated addresses.
|
341
443
|
*
|
342
444
|
* @example
|
343
|
-
*
|
445
|
+
* const addresses = await customerModuleService.updateAddresses(
|
446
|
+
* ["cuaddr_123", "cuaddr_321"],
|
447
|
+
* {
|
448
|
+
* first_name: "John",
|
449
|
+
* last_name: "Smith",
|
450
|
+
* }
|
451
|
+
* )
|
344
452
|
*/
|
345
453
|
updateAddresses(addressIds: string[], data: UpdateCustomerAddressDTO, sharedContext?: Context): Promise<CustomerAddressDTO[]>;
|
346
454
|
/**
|
347
|
-
* This method updates addresses matching the specified filters
|
455
|
+
* This method updates existing addresses matching the specified filters.
|
348
456
|
*
|
349
|
-
* @param {FilterableCustomerAddressProps} selector - The filters
|
350
|
-
* @param {UpdateCustomerAddressDTO} data - The attributes to update in
|
457
|
+
* @param {FilterableCustomerAddressProps} selector - The filters that specify which address should be updated.
|
458
|
+
* @param {UpdateCustomerAddressDTO} data - The attributes to update in the addresses.
|
351
459
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
352
|
-
* @returns {Promise<CustomerAddressDTO[]>} The updated
|
460
|
+
* @returns {Promise<CustomerAddressDTO[]>} The updated addresses.
|
353
461
|
*
|
354
462
|
* @example
|
355
|
-
*
|
463
|
+
* const addresses = await customerModuleService.updateAddresses(
|
464
|
+
* { first_name: "John" },
|
465
|
+
* {
|
466
|
+
* last_name: "Smith",
|
467
|
+
* }
|
468
|
+
* )
|
356
469
|
*/
|
357
470
|
updateAddresses(selector: FilterableCustomerAddressProps, data: UpdateCustomerAddressDTO, sharedContext?: Context): Promise<CustomerAddressDTO[]>;
|
358
471
|
/**
|
@@ -363,302 +476,437 @@ export interface ICustomerModuleService extends IModuleService {
|
|
363
476
|
* @returns {Promise<void>} Resolves when the address is deleted successfully.
|
364
477
|
*
|
365
478
|
* @example
|
366
|
-
*
|
479
|
+
* await customerModuleService.deleteAddresses("cuaddr_123")
|
367
480
|
*/
|
368
481
|
deleteAddresses(addressId: string, sharedContext?: Context): Promise<void>;
|
369
482
|
/**
|
370
483
|
* This method deletes addresses by their IDs.
|
371
484
|
*
|
372
|
-
* @param {string[]} addressIds - The
|
485
|
+
* @param {string[]} addressIds - The IDs of addresses.
|
373
486
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
374
487
|
* @returns {Promise<void>} Resolves when the addresses are deleted successfully.
|
375
488
|
*
|
376
489
|
* @example
|
377
|
-
*
|
490
|
+
* await customerModuleService.deleteAddresses([
|
491
|
+
* "cuaddr_123",
|
492
|
+
* "cuaddr_321",
|
493
|
+
* ])
|
378
494
|
*/
|
379
495
|
deleteAddresses(addressIds: string[], sharedContext?: Context): Promise<void>;
|
380
496
|
/**
|
381
|
-
* This method deletes addresses matching the specified filters
|
497
|
+
* This method deletes addresses matching the specified filters.
|
382
498
|
*
|
383
|
-
* @param {FilterableCustomerAddressProps} selector - The filters
|
499
|
+
* @param {FilterableCustomerAddressProps} selector - The filters that specify which addresses should be deleted.
|
384
500
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
385
|
-
* @returns {Promise<void>} Resolves when the addresses are deleted.
|
501
|
+
* @returns {Promise<void>} Resolves when the addresses are deleted successfully.
|
386
502
|
*
|
387
503
|
* @example
|
388
|
-
* {
|
504
|
+
* await customerModuleService.deleteAddresses({
|
505
|
+
* first_name: "John",
|
506
|
+
* last_name: "Smith",
|
507
|
+
* })
|
389
508
|
*/
|
390
509
|
deleteAddresses(selector: FilterableCustomerAddressProps, sharedContext?: Context): Promise<void>;
|
391
510
|
/**
|
392
511
|
* This method retrieves a paginated list of addresses based on optional filters and configuration.
|
393
512
|
*
|
394
|
-
* @param {FilterableCustomerAddressProps} filters - The filters to apply on the retrieved
|
395
|
-
* @param {FindConfig<CustomerAddressDTO>} config - The configurations determining how the
|
396
|
-
* attributes or relations associated with a
|
513
|
+
* @param {FilterableCustomerAddressProps} filters - The filters to apply on the retrieved addresss.
|
514
|
+
* @param {FindConfig<CustomerAddressDTO>} config - The configurations determining how the address is retrieved. Its properties, such as `select` or `relations`, accept the
|
515
|
+
* attributes or relations associated with a address.
|
397
516
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
398
517
|
* @returns {Promise<CustomerAddressDTO[]>} The list of addresses.
|
399
518
|
*
|
400
519
|
* @example
|
401
|
-
* To retrieve a list of
|
520
|
+
* To retrieve a list of addresses using their IDs:
|
402
521
|
*
|
403
522
|
* ```ts
|
404
|
-
* {
|
523
|
+
* const addresses = await customerModuleService.listAddresses({
|
524
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
525
|
+
* })
|
405
526
|
* ```
|
406
527
|
*
|
407
|
-
* To specify relations that should be retrieved within the
|
528
|
+
* To specify relations that should be retrieved within the addresses:
|
408
529
|
*
|
409
530
|
* ```ts
|
410
|
-
*
|
531
|
+
* const addresses = await customerModuleService.listAddresses(
|
532
|
+
* {
|
533
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
534
|
+
* },
|
535
|
+
* {
|
536
|
+
* relations: ["customer"],
|
537
|
+
* }
|
538
|
+
* )
|
411
539
|
* ```
|
412
540
|
*
|
413
|
-
* By default, only the first `
|
541
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
414
542
|
*
|
415
543
|
* ```ts
|
416
|
-
*
|
544
|
+
* const addresses = await customerModuleService.listAddresses(
|
545
|
+
* {
|
546
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
547
|
+
* },
|
548
|
+
* {
|
549
|
+
* relations: ["customer"],
|
550
|
+
* take: 20,
|
551
|
+
* skip: 2,
|
552
|
+
* }
|
553
|
+
* )
|
417
554
|
* ```
|
418
|
-
*
|
419
|
-
*
|
420
555
|
*/
|
421
556
|
listAddresses(filters?: FilterableCustomerAddressProps, config?: FindConfig<CustomerAddressDTO>, sharedContext?: Context): Promise<CustomerAddressDTO[]>;
|
422
557
|
/**
|
423
558
|
* This method retrieves a paginated list of addresses along with the total count of available addresses satisfying the provided filters.
|
424
559
|
*
|
425
|
-
* @param {FilterableCustomerAddressProps} filters - The filters to apply on the retrieved
|
426
|
-
* @param {FindConfig<CustomerAddressDTO>} config - The configurations determining how the
|
427
|
-
* attributes or relations associated with a
|
560
|
+
* @param {FilterableCustomerAddressProps} filters - The filters to apply on the retrieved addresss.
|
561
|
+
* @param {FindConfig<CustomerAddressDTO>} config - The configurations determining how the address is retrieved. Its properties, such as `select` or `relations`, accept the
|
562
|
+
* attributes or relations associated with a address.
|
428
563
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
429
564
|
* @returns {Promise<[CustomerAddressDTO[], number]>} The list of addresses along with their total count.
|
430
565
|
*
|
431
566
|
* @example
|
432
|
-
* To retrieve a list of
|
567
|
+
* To retrieve a list of addresses using their IDs:
|
433
568
|
*
|
434
569
|
* ```ts
|
435
|
-
*
|
570
|
+
* const [addresses, count] =
|
571
|
+
* await customerModuleService.listAndCountAddresses({
|
572
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
573
|
+
* })
|
436
574
|
* ```
|
437
575
|
*
|
438
|
-
* To specify relations that should be retrieved within the
|
576
|
+
* To specify relations that should be retrieved within the addresses:
|
439
577
|
*
|
440
578
|
* ```ts
|
441
|
-
*
|
579
|
+
* const [addresses, count] =
|
580
|
+
* await customerModuleService.listAndCountAddresses(
|
581
|
+
* {
|
582
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
583
|
+
* },
|
584
|
+
* {
|
585
|
+
* relations: ["customer"],
|
586
|
+
* }
|
587
|
+
* )
|
442
588
|
* ```
|
443
589
|
*
|
444
|
-
* By default, only the first `
|
590
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
445
591
|
*
|
446
592
|
* ```ts
|
447
|
-
*
|
593
|
+
* const [addresses, count] =
|
594
|
+
* await customerModuleService.listAndCountAddresses(
|
595
|
+
* {
|
596
|
+
* id: ["cuaddr_123", "cuaddr_321"],
|
597
|
+
* },
|
598
|
+
* {
|
599
|
+
* relations: ["customer"],
|
600
|
+
* take: 20,
|
601
|
+
* skip: 2,
|
602
|
+
* }
|
603
|
+
* )
|
448
604
|
* ```
|
449
|
-
*
|
450
|
-
*
|
451
605
|
*/
|
452
606
|
listAndCountAddresses(filters?: FilterableCustomerAddressProps, config?: FindConfig<CustomerAddressDTO>, sharedContext?: Context): Promise<[CustomerAddressDTO[], number]>;
|
453
607
|
/**
|
454
|
-
* This method retrieves a paginated list of customer
|
608
|
+
* This method retrieves a paginated list of relations between customer and groups based on optional filters and configuration.
|
455
609
|
*
|
456
|
-
* @param {FilterableCustomerGroupCustomerProps} filters - The filters to apply on the retrieved customer
|
457
|
-
* @param {FindConfig<CustomerGroupCustomerDTO>} config - The configurations determining how the customer
|
458
|
-
* attributes or relations associated with a customer
|
610
|
+
* @param {FilterableCustomerGroupCustomerProps} filters - The filters to apply on the retrieved customer-group relations.
|
611
|
+
* @param {FindConfig<CustomerGroupCustomerDTO>} config - The configurations determining how the customer-group relations is retrieved. Its properties, such as `select` or `relations`, accept the
|
612
|
+
* attributes or relations associated with a customer-group relations.
|
459
613
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
460
|
-
* @returns {Promise<CustomerGroupCustomerDTO[]>} The list of customer
|
614
|
+
* @returns {Promise<CustomerGroupCustomerDTO[]>} The list of customer-group relations.
|
461
615
|
*
|
462
616
|
* @example
|
463
|
-
* To retrieve a list of
|
617
|
+
* To retrieve a list of customer-group relations using their IDs:
|
464
618
|
*
|
465
619
|
* ```ts
|
466
|
-
*
|
620
|
+
* const customerGroupCustomerRels =
|
621
|
+
* await customerModuleService.listCustomerGroupCustomers({
|
622
|
+
* id: ["cusgc_123"],
|
623
|
+
* })
|
467
624
|
* ```
|
468
625
|
*
|
469
|
-
* To specify relations that should be retrieved within the
|
626
|
+
* To specify relations that should be retrieved within the customer-group relations:
|
470
627
|
*
|
471
628
|
* ```ts
|
472
|
-
*
|
629
|
+
* const customerGroupCustomerRels =
|
630
|
+
* await customerModuleService.listCustomerGroupCustomers(
|
631
|
+
* {
|
632
|
+
* id: ["cusgc_123"],
|
633
|
+
* },
|
634
|
+
* {
|
635
|
+
* relations: ["customer", "customer_group"],
|
636
|
+
* }
|
637
|
+
* )
|
473
638
|
* ```
|
474
639
|
*
|
475
|
-
* By default, only the first `
|
640
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
476
641
|
*
|
477
642
|
* ```ts
|
478
|
-
*
|
643
|
+
* const customerGroupCustomerRels =
|
644
|
+
* await customerModuleService.listCustomerGroupCustomers(
|
645
|
+
* {
|
646
|
+
* id: ["cusgc_123"],
|
647
|
+
* },
|
648
|
+
* {
|
649
|
+
* relations: ["customer", "customer_group"],
|
650
|
+
* take: 20,
|
651
|
+
* skip: 2,
|
652
|
+
* }
|
653
|
+
* )
|
479
654
|
* ```
|
480
|
-
*
|
481
|
-
*
|
482
655
|
*/
|
483
656
|
listCustomerGroupCustomers(filters?: FilterableCustomerGroupCustomerProps, config?: FindConfig<CustomerGroupCustomerDTO>, sharedContext?: Context): Promise<CustomerGroupCustomerDTO[]>;
|
484
657
|
/**
|
485
658
|
* This method retrieves a paginated list of customers based on optional filters and configuration.
|
486
659
|
*
|
487
|
-
* @param {FilterableCustomerProps} filters - The filters to apply on the retrieved
|
660
|
+
* @param {FilterableCustomerProps} filters - The filters to apply on the retrieved customers.
|
488
661
|
* @param {FindConfig<CustomerDTO>} config - The configurations determining how the customer is retrieved. Its properties, such as `select` or `relations`, accept the
|
489
662
|
* attributes or relations associated with a customer.
|
490
663
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
491
664
|
* @returns {Promise<CustomerDTO[]>} The list of customers.
|
492
665
|
*
|
493
666
|
* @example
|
494
|
-
* To retrieve a list of
|
667
|
+
* To retrieve a list of customers using their IDs:
|
495
668
|
*
|
496
669
|
* ```ts
|
497
|
-
* {
|
670
|
+
* const customers = await customerModuleService.list({
|
671
|
+
* id: ["cus_123", "cus_321"],
|
672
|
+
* })
|
498
673
|
* ```
|
499
674
|
*
|
500
|
-
* To specify relations that should be retrieved within the
|
675
|
+
* To specify relations that should be retrieved within the customers:
|
501
676
|
*
|
502
677
|
* ```ts
|
503
|
-
*
|
678
|
+
* const customers = await customerModuleService.list(
|
679
|
+
* {
|
680
|
+
* id: ["cus_123", "cus_321"],
|
681
|
+
* },
|
682
|
+
* {
|
683
|
+
* relations: ["groups"],
|
684
|
+
* }
|
685
|
+
* )
|
504
686
|
* ```
|
505
687
|
*
|
506
|
-
* By default, only the first `
|
688
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
507
689
|
*
|
508
690
|
* ```ts
|
509
|
-
*
|
691
|
+
* const customers = await customerModuleService.list(
|
692
|
+
* {
|
693
|
+
* id: ["cus_123", "cus_321"],
|
694
|
+
* },
|
695
|
+
* {
|
696
|
+
* relations: ["groups"],
|
697
|
+
* take: 20,
|
698
|
+
* skip: 2,
|
699
|
+
* }
|
700
|
+
* )
|
510
701
|
* ```
|
511
|
-
*
|
512
|
-
*
|
513
702
|
*/
|
514
703
|
list(filters?: FilterableCustomerProps, config?: FindConfig<CustomerDTO>, sharedContext?: Context): Promise<CustomerDTO[]>;
|
515
704
|
/**
|
516
705
|
* This method retrieves a paginated list of customers along with the total count of available customers satisfying the provided filters.
|
517
706
|
*
|
518
|
-
* @param {FilterableCustomerProps} filters - The filters to apply on the retrieved
|
707
|
+
* @param {FilterableCustomerProps} filters - The filters to apply on the retrieved customers.
|
519
708
|
* @param {FindConfig<CustomerDTO>} config - The configurations determining how the customer is retrieved. Its properties, such as `select` or `relations`, accept the
|
520
709
|
* attributes or relations associated with a customer.
|
521
710
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
522
711
|
* @returns {Promise<[CustomerDTO[], number]>} The list of customers along with their total count.
|
523
712
|
*
|
524
713
|
* @example
|
525
|
-
* To retrieve a list of
|
714
|
+
* To retrieve a list of customers using their IDs:
|
526
715
|
*
|
527
716
|
* ```ts
|
528
|
-
* {
|
717
|
+
* const [customers, count] = await customerModuleService.list({
|
718
|
+
* id: ["cus_123", "cus_321"],
|
719
|
+
* })
|
529
720
|
* ```
|
530
721
|
*
|
531
|
-
* To specify relations that should be retrieved within the
|
722
|
+
* To specify relations that should be retrieved within the customers:
|
532
723
|
*
|
533
724
|
* ```ts
|
534
|
-
*
|
725
|
+
* const [customers, count] = await customerModuleService.list(
|
726
|
+
* {
|
727
|
+
* id: ["cus_123", "cus_321"],
|
728
|
+
* },
|
729
|
+
* {
|
730
|
+
* relations: ["groups"],
|
731
|
+
* }
|
732
|
+
* )
|
535
733
|
* ```
|
536
734
|
*
|
537
|
-
* By default, only the first `
|
735
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
538
736
|
*
|
539
737
|
* ```ts
|
540
|
-
*
|
738
|
+
* const [customers, count] = await customerModuleService.list(
|
739
|
+
* {
|
740
|
+
* id: ["cus_123", "cus_321"],
|
741
|
+
* },
|
742
|
+
* {
|
743
|
+
* relations: ["groups"],
|
744
|
+
* take: 20,
|
745
|
+
* skip: 2,
|
746
|
+
* }
|
747
|
+
* )
|
541
748
|
* ```
|
542
|
-
*
|
543
|
-
*
|
544
749
|
*/
|
545
750
|
listAndCount(filters?: FilterableCustomerProps, config?: FindConfig<CustomerDTO>, sharedContext?: Context): Promise<[CustomerDTO[], number]>;
|
546
751
|
/**
|
547
752
|
* This method retrieves a paginated list of customer groups based on optional filters and configuration.
|
548
753
|
*
|
549
|
-
* @param {FilterableCustomerGroupProps} filters - The filters to apply on the retrieved customer
|
754
|
+
* @param {FilterableCustomerGroupProps} filters - The filters to apply on the retrieved customer groups.
|
550
755
|
* @param {FindConfig<CustomerGroupDTO>} config - The configurations determining how the customer group is retrieved. Its properties, such as `select` or `relations`, accept the
|
551
756
|
* attributes or relations associated with a customer group.
|
552
757
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
553
758
|
* @returns {Promise<CustomerGroupDTO[]>} The list of customer groups.
|
554
759
|
*
|
555
760
|
* @example
|
556
|
-
* To retrieve a list of
|
761
|
+
* To retrieve a list of customer groups using their IDs:
|
557
762
|
*
|
558
763
|
* ```ts
|
559
|
-
*
|
764
|
+
* const customerGroups =
|
765
|
+
* await customerModuleService.listCustomerGroups({
|
766
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
767
|
+
* })
|
560
768
|
* ```
|
561
769
|
*
|
562
|
-
* To specify relations that should be retrieved within the
|
770
|
+
* To specify relations that should be retrieved within the customer groups:
|
563
771
|
*
|
564
772
|
* ```ts
|
565
|
-
*
|
773
|
+
* const customerGroups =
|
774
|
+
* await customerModuleService.listCustomerGroups(
|
775
|
+
* {
|
776
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
777
|
+
* },
|
778
|
+
* {
|
779
|
+
* relations: ["customers"],
|
780
|
+
* }
|
781
|
+
* )
|
566
782
|
* ```
|
567
783
|
*
|
568
|
-
* By default, only the first `
|
784
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
569
785
|
*
|
570
786
|
* ```ts
|
571
|
-
*
|
787
|
+
* const customerGroups =
|
788
|
+
* await customerModuleService.listCustomerGroups(
|
789
|
+
* {
|
790
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
791
|
+
* },
|
792
|
+
* {
|
793
|
+
* relations: ["customers"],
|
794
|
+
* take: 20,
|
795
|
+
* skip: 2,
|
796
|
+
* }
|
797
|
+
* )
|
572
798
|
* ```
|
573
|
-
*
|
574
|
-
*
|
575
799
|
*/
|
576
800
|
listCustomerGroups(filters?: FilterableCustomerGroupProps, config?: FindConfig<CustomerGroupDTO>, sharedContext?: Context): Promise<CustomerGroupDTO[]>;
|
577
801
|
/**
|
578
802
|
* This method retrieves a paginated list of customer groups along with the total count of available customer groups satisfying the provided filters.
|
579
803
|
*
|
580
|
-
* @param {FilterableCustomerGroupProps} filters - The filters to apply on the retrieved customer
|
804
|
+
* @param {FilterableCustomerGroupProps} filters - The filters to apply on the retrieved customer groups.
|
581
805
|
* @param {FindConfig<CustomerGroupDTO>} config - The configurations determining how the customer group is retrieved. Its properties, such as `select` or `relations`, accept the
|
582
806
|
* attributes or relations associated with a customer group.
|
583
807
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
584
808
|
* @returns {Promise<[CustomerGroupDTO[], number]>} The list of customer groups along with their total count.
|
585
809
|
*
|
586
810
|
* @example
|
587
|
-
* To retrieve a list of
|
811
|
+
* To retrieve a list of customer groups using their IDs:
|
588
812
|
*
|
589
813
|
* ```ts
|
590
|
-
*
|
814
|
+
* const [customerGroups, count] =
|
815
|
+
* await customerModuleService.listCustomerGroups({
|
816
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
817
|
+
* })
|
591
818
|
* ```
|
592
819
|
*
|
593
|
-
* To specify relations that should be retrieved within the
|
820
|
+
* To specify relations that should be retrieved within the customer groups:
|
594
821
|
*
|
595
822
|
* ```ts
|
596
|
-
*
|
823
|
+
* const [customerGroups, count] =
|
824
|
+
* await customerModuleService.listCustomerGroups(
|
825
|
+
* {
|
826
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
827
|
+
* },
|
828
|
+
* {
|
829
|
+
* relations: ["customers"],
|
830
|
+
* }
|
831
|
+
* )
|
597
832
|
* ```
|
598
833
|
*
|
599
|
-
* By default, only the first `
|
834
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
600
835
|
*
|
601
836
|
* ```ts
|
602
|
-
*
|
837
|
+
* const [customerGroups, count] =
|
838
|
+
* await customerModuleService.listCustomerGroups(
|
839
|
+
* {
|
840
|
+
* id: ["cusgroup_123", "cusgroup_321"],
|
841
|
+
* },
|
842
|
+
* {
|
843
|
+
* relations: ["customers"],
|
844
|
+
* take: 20,
|
845
|
+
* skip: 2,
|
846
|
+
* }
|
847
|
+
* )
|
603
848
|
* ```
|
604
|
-
*
|
605
|
-
*
|
606
849
|
*/
|
607
850
|
listAndCountCustomerGroups(filters?: FilterableCustomerGroupProps, config?: FindConfig<CustomerGroupDTO>, sharedContext?: Context): Promise<[CustomerGroupDTO[], number]>;
|
608
851
|
/**
|
609
852
|
* This method soft deletes customers by their IDs.
|
610
853
|
*
|
611
|
-
* @param {string[]} customerIds - The
|
854
|
+
* @param {string[]} customerIds - The IDs of customers.
|
612
855
|
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
|
613
856
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
614
|
-
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>}
|
857
|
+
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated address.
|
858
|
+
* The object's keys are the ID attribute names of the customer entity's relations, such as `address_id`, and its value is an array of strings, each being the ID of a record associated
|
859
|
+
* with the customer through this relation, such as the IDs of associated address.
|
860
|
+
*
|
861
|
+
* If there are no related records, the promise resolves to `void`.
|
615
862
|
*
|
616
863
|
* @example
|
617
|
-
*
|
864
|
+
* await customerModuleService.softDelete(["cus_123"])
|
618
865
|
*/
|
619
866
|
softDelete<TReturnableLinkableKeys extends string = string>(customerIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<TReturnableLinkableKeys, string[]> | void>;
|
620
867
|
/**
|
621
|
-
* This method restores soft deleted
|
868
|
+
* This method restores soft deleted customer by their IDs.
|
622
869
|
*
|
623
|
-
* @param {string[]} customerIds - The
|
624
|
-
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the
|
625
|
-
* property any of the customer's relation attribute names, such as `
|
870
|
+
* @param {string[]} customerIds - The IDs of customers.
|
871
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the customer. You can pass to its `returnLinkableKeys`
|
872
|
+
* property any of the customer's relation attribute names, such as `groups`.
|
626
873
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
627
|
-
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were restored
|
628
|
-
*
|
629
|
-
* and its value is an array of strings, each being the ID of the record associated with the customer through this relation,
|
630
|
-
* such as the IDs of associated addresses.
|
874
|
+
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were restored.
|
875
|
+
* If there are no related records restored, the promise resolves to `void`.
|
631
876
|
*
|
632
877
|
* @example
|
633
|
-
*
|
878
|
+
* await customerModuleService.restore(["cus_123"])
|
634
879
|
*/
|
635
880
|
restore<TReturnableLinkableKeys extends string = string>(customerIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<TReturnableLinkableKeys, string[]> | void>;
|
636
881
|
/**
|
637
882
|
* This method soft deletes customer groups by their IDs.
|
638
883
|
*
|
639
|
-
* @param {string[]} groupIds - The
|
884
|
+
* @param {string[]} groupIds - The IDs of customer groups.
|
640
885
|
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
|
641
886
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
642
|
-
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>}
|
887
|
+
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were also soft deleted.
|
888
|
+
* If there are no related records, the promise resolves to `void`.
|
643
889
|
*
|
644
890
|
* @example
|
645
|
-
*
|
891
|
+
* await customerModuleService.softDeleteCustomerGroups([
|
892
|
+
* "cusgroup_123",
|
893
|
+
* ])
|
646
894
|
*/
|
647
895
|
softDeleteCustomerGroups<TReturnableLinkableKeys extends string = string>(groupIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<TReturnableLinkableKeys, string[]> | void>;
|
648
896
|
/**
|
649
|
-
* This method restores soft deleted customer
|
897
|
+
* This method restores a soft deleted customer group by its IDs.
|
650
898
|
*
|
651
|
-
* @param {string[]} groupIds - The
|
652
|
-
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the customer
|
899
|
+
* @param {string[]} groupIds - The IDs of customer groups.
|
900
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the customer groups. You can pass to its `returnLinkableKeys`
|
653
901
|
* property any of the customer group's relation attribute names, such as `customers`.
|
654
902
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
655
|
-
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were restored
|
656
|
-
*
|
657
|
-
* and its value is an array of strings, each being the ID of the record associated with the customer through this relation,
|
658
|
-
* such as the IDs of associated customer.
|
903
|
+
* @returns {Promise<void | Record<TReturnableLinkableKeys, string[]>>} An object that includes the IDs of related records that were restored.
|
904
|
+
* If there are no related records restored, the promise resolves to `void`.
|
659
905
|
*
|
660
906
|
* @example
|
661
|
-
*
|
907
|
+
* await customerModuleService.restoreCustomerGroups([
|
908
|
+
* "cusgroup_123",
|
909
|
+
* ])
|
662
910
|
*/
|
663
911
|
restoreCustomerGroups<TReturnableLinkableKeys extends string = string>(groupIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<TReturnableLinkableKeys, string[]> | void>;
|
664
912
|
}
|