@medusajs/types 1.12.0-snapshot-20240405070935 → 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 +174 -53
- 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/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/package.json +1 -1
@@ -4,38 +4,824 @@ import { IModuleService } from "../modules-sdk";
|
|
4
4
|
import { Context } from "../shared-context";
|
5
5
|
import { CampaignDTO, ComputeActionContext, ComputeActions, CreatePromotionDTO, CreatePromotionRuleDTO, FilterableCampaignProps, FilterablePromotionProps, FilterablePromotionRuleProps, PromotionDTO, PromotionRuleDTO, UpdatePromotionDTO, UpdatePromotionRuleDTO } from "./common";
|
6
6
|
import { CreateCampaignDTO, UpdateCampaignDTO } from "./mutations";
|
7
|
+
/**
|
8
|
+
* The main service interface for the Promotion Module.
|
9
|
+
*/
|
7
10
|
export interface IPromotionModuleService extends IModuleService {
|
11
|
+
/**
|
12
|
+
* This method adjusts the budget for each campaign associated with the promotions' specified computed actions.
|
13
|
+
* It adjusts the `used` property of a `CampaignBudget` to account for the adjustment amounts in the specified associated
|
14
|
+
* computed actions.
|
15
|
+
*
|
16
|
+
* @param {ComputeActions[]} computedActions - The computed actions to adjust their promotion's campaign budget.
|
17
|
+
* @returns {Promise<void>} Resolves when the campaign budgets have been adjusted successfully.
|
18
|
+
*
|
19
|
+
* @example
|
20
|
+
* await promotionModuleService.registerUsage([
|
21
|
+
* {
|
22
|
+
* action: "addItemAdjustment",
|
23
|
+
* item_id: "cali_123",
|
24
|
+
* amount: 50,
|
25
|
+
* code: "50OFF",
|
26
|
+
* },
|
27
|
+
* {
|
28
|
+
* action: "addShippingMethodAdjustment",
|
29
|
+
* shipping_method_id: "casm_123",
|
30
|
+
* amount: 5000,
|
31
|
+
* code: "FREESHIPPING",
|
32
|
+
* },
|
33
|
+
* ])
|
34
|
+
*/
|
8
35
|
registerUsage(computedActions: ComputeActions[]): Promise<void>;
|
36
|
+
/**
|
37
|
+
* This method provides the actions to perform on a cart based on the specified promotions
|
38
|
+
* and context.
|
39
|
+
*
|
40
|
+
* @param {string[]} promotionCodesToApply - The promotion codes to be applied on the cart.
|
41
|
+
* @param {ComputeActionContext} applicationContext - The items and shipping methods of the cart.
|
42
|
+
* @param {Record<string, any>} options - Any relevant options that may change how the actions are computed.
|
43
|
+
* @returns {Promise<ComputeActions[]>} The list of computed actions to be applied on the cart.
|
44
|
+
*
|
45
|
+
* @example
|
46
|
+
* const actions = await promotionModuleService.computeActions(
|
47
|
+
* ["50OFF"],
|
48
|
+
* {
|
49
|
+
* items: [
|
50
|
+
* {
|
51
|
+
* id: "cali_123",
|
52
|
+
* quantity: 2,
|
53
|
+
* subtotal: 1000,
|
54
|
+
* },
|
55
|
+
* ],
|
56
|
+
* shipping_methods: [
|
57
|
+
* {
|
58
|
+
* id: "casm_123",
|
59
|
+
* subtotal: 0,
|
60
|
+
* adjustments: [
|
61
|
+
* {
|
62
|
+
* id: "adj_123",
|
63
|
+
* code: "FREESHIPPING",
|
64
|
+
* },
|
65
|
+
* ],
|
66
|
+
* },
|
67
|
+
* ],
|
68
|
+
* }
|
69
|
+
* )
|
70
|
+
*/
|
9
71
|
computeActions(promotionCodesToApply: string[], applicationContext: ComputeActionContext, options?: Record<string, any>): Promise<ComputeActions[]>;
|
72
|
+
/**
|
73
|
+
* This method creates promotions.
|
74
|
+
*
|
75
|
+
* @param {CreatePromotionDTO[]} data - The promotions to be created.
|
76
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
77
|
+
* @returns {Promise<PromotionDTO[]>} The created promotions.
|
78
|
+
*
|
79
|
+
* @example
|
80
|
+
* const promotions = await promotionModuleService.create([
|
81
|
+
* {
|
82
|
+
* code: "50OFF",
|
83
|
+
* type: "standard",
|
84
|
+
* application_method: {
|
85
|
+
* type: "percentage",
|
86
|
+
* target_type: "items",
|
87
|
+
* value: 50,
|
88
|
+
* },
|
89
|
+
* },
|
90
|
+
* {
|
91
|
+
* code: "FREESHIPPING",
|
92
|
+
* type: "standard",
|
93
|
+
* application_method: {
|
94
|
+
* type: "percentage",
|
95
|
+
* target_type: "shipping_methods",
|
96
|
+
* value: 100,
|
97
|
+
* },
|
98
|
+
* },
|
99
|
+
* {
|
100
|
+
* code: "BUY2GET1",
|
101
|
+
* type: "buyget",
|
102
|
+
* application_method: {
|
103
|
+
* type: "fixed",
|
104
|
+
* target_type: "items",
|
105
|
+
* buy_rules_min_quantity: 2,
|
106
|
+
* apply_to_quantity: 1,
|
107
|
+
* buy_rules: [
|
108
|
+
* {
|
109
|
+
* attribute: "SKU",
|
110
|
+
* operator: "eq",
|
111
|
+
* values: ["SHIRT"],
|
112
|
+
* },
|
113
|
+
* ],
|
114
|
+
* },
|
115
|
+
* },
|
116
|
+
* ])
|
117
|
+
*/
|
10
118
|
create(data: CreatePromotionDTO[], sharedContext?: Context): Promise<PromotionDTO[]>;
|
119
|
+
/**
|
120
|
+
* This method creates a promotion.
|
121
|
+
*
|
122
|
+
* @param {CreatePromotionDTO} data - The promotion to be created.
|
123
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
124
|
+
* @returns {Promise<PromotionDTO>} The created promotion.
|
125
|
+
*
|
126
|
+
* @example
|
127
|
+
* const promotionA = await promotionModuleService.create({
|
128
|
+
* code: "50OFF",
|
129
|
+
* type: "standard",
|
130
|
+
* application_method: {
|
131
|
+
* type: "percentage",
|
132
|
+
* target_type: "items",
|
133
|
+
* value: 50,
|
134
|
+
* },
|
135
|
+
* })
|
136
|
+
*
|
137
|
+
* const promotionB = await promotionModuleService.create({
|
138
|
+
* code: "FREESHIPPING",
|
139
|
+
* type: "standard",
|
140
|
+
* application_method: {
|
141
|
+
* type: "percentage",
|
142
|
+
* target_type: "shipping_methods",
|
143
|
+
* value: 100,
|
144
|
+
* },
|
145
|
+
* })
|
146
|
+
*
|
147
|
+
* const promotionC = await promotionModuleService.create({
|
148
|
+
* code: "BUY2GET1",
|
149
|
+
* type: "buyget",
|
150
|
+
* application_method: {
|
151
|
+
* type: "fixed",
|
152
|
+
* target_type: "items",
|
153
|
+
* buy_rules_min_quantity: 2,
|
154
|
+
* apply_to_quantity: 1,
|
155
|
+
* buy_rules: [
|
156
|
+
* {
|
157
|
+
* attribute: "SKU",
|
158
|
+
* operator: "eq",
|
159
|
+
* values: ["SHIRT"],
|
160
|
+
* },
|
161
|
+
* ],
|
162
|
+
* },
|
163
|
+
* })
|
164
|
+
*/
|
11
165
|
create(data: CreatePromotionDTO, sharedContext?: Context): Promise<PromotionDTO>;
|
166
|
+
/**
|
167
|
+
* This method updates existing promotions.
|
168
|
+
*
|
169
|
+
* @param {UpdatePromotionDTO[]} data - The attributes to update in the promotions.
|
170
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
171
|
+
* @returns {Promise<PromotionDTO[]>} The updated promotions.
|
172
|
+
*
|
173
|
+
* @example
|
174
|
+
* const promotions = await promotionModuleService.update([
|
175
|
+
* {
|
176
|
+
* id: "promo_123",
|
177
|
+
* is_automatic: true,
|
178
|
+
* },
|
179
|
+
* ])
|
180
|
+
*/
|
12
181
|
update(data: UpdatePromotionDTO[], sharedContext?: Context): Promise<PromotionDTO[]>;
|
182
|
+
/**
|
183
|
+
* This method updates an existing promotion.
|
184
|
+
*
|
185
|
+
* @param {UpdatePromotionDTO} data - The attributes to update in the promotion.
|
186
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
187
|
+
* @returns {Promise<PromotionDTO>} The updated promotion.
|
188
|
+
*
|
189
|
+
* @example
|
190
|
+
* const promotion = await promotionModuleService.update({
|
191
|
+
* id: "promo_123",
|
192
|
+
* is_automatic: true,
|
193
|
+
* })
|
194
|
+
*/
|
13
195
|
update(data: UpdatePromotionDTO, sharedContext?: Context): Promise<PromotionDTO>;
|
196
|
+
/**
|
197
|
+
* This method retrieves a paginated list of promotions based on optional filters and configuration.
|
198
|
+
*
|
199
|
+
* @param {FilterablePromotionProps} filters - The filters to apply on the retrieved promotions.
|
200
|
+
* @param {FindConfig<PromotionDTO>} config - The configurations determining how the promotion is retrieved. Its properties, such as `select` or `relations`, accept the
|
201
|
+
* attributes or relations associated with a promotion.
|
202
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
203
|
+
* @returns {Promise<PromotionDTO[]>} The list of promotions.
|
204
|
+
*
|
205
|
+
* @example
|
206
|
+
* To retrieve a list of promotions using their IDs:
|
207
|
+
*
|
208
|
+
* ```ts
|
209
|
+
* const promotions = await promotionModuleService.list({
|
210
|
+
* id: ["promo_123", "promo_321"],
|
211
|
+
* })
|
212
|
+
* ```
|
213
|
+
*
|
214
|
+
* To specify relations that should be retrieved within the promotions:
|
215
|
+
*
|
216
|
+
* ```ts
|
217
|
+
* const promotions = await promotionModuleService.list(
|
218
|
+
* {
|
219
|
+
* id: ["promo_123", "promo_321"],
|
220
|
+
* },
|
221
|
+
* {
|
222
|
+
* relations: ["application_method"],
|
223
|
+
* }
|
224
|
+
* )
|
225
|
+
* ```
|
226
|
+
*
|
227
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
228
|
+
*
|
229
|
+
* ```ts
|
230
|
+
* const promotions = await promotionModuleService.list(
|
231
|
+
* {
|
232
|
+
* id: ["promo_123", "promo_321"],
|
233
|
+
* },
|
234
|
+
* {
|
235
|
+
* relations: ["application_method"],
|
236
|
+
* take: 20,
|
237
|
+
* skip: 2,
|
238
|
+
* }
|
239
|
+
* )
|
240
|
+
* ```
|
241
|
+
*/
|
14
242
|
list(filters?: FilterablePromotionProps, config?: FindConfig<PromotionDTO>, sharedContext?: Context): Promise<PromotionDTO[]>;
|
243
|
+
/**
|
244
|
+
* This method retrieves a paginated list of promotions along with the total count of available promotions satisfying the provided filters.
|
245
|
+
*
|
246
|
+
* @param {FilterablePromotionProps} filters - The filters to apply on the retrieved promotions.
|
247
|
+
* @param {FindConfig<PromotionDTO>} config - The configurations determining how the promotion is retrieved. Its properties, such as `select` or `relations`, accept the
|
248
|
+
* attributes or relations associated with a promotion.
|
249
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
250
|
+
* @returns {Promise<[PromotionDTO[], number]>} The list of promotions along with their total count.
|
251
|
+
*
|
252
|
+
* @example
|
253
|
+
* To retrieve a list of promotions using their IDs:
|
254
|
+
*
|
255
|
+
* ```ts
|
256
|
+
* const [promotions, count] =
|
257
|
+
* await promotionModuleService.listAndCount({
|
258
|
+
* id: ["promo_123", "promo_321"],
|
259
|
+
* })
|
260
|
+
* ```
|
261
|
+
*
|
262
|
+
* To specify relations that should be retrieved within the promotions:
|
263
|
+
*
|
264
|
+
* ```ts
|
265
|
+
* const [promotions, count] =
|
266
|
+
* await promotionModuleService.listAndCount(
|
267
|
+
* {
|
268
|
+
* id: ["promo_123", "promo_321"],
|
269
|
+
* },
|
270
|
+
* {
|
271
|
+
* relations: ["application_method"],
|
272
|
+
* }
|
273
|
+
* )
|
274
|
+
* ```
|
275
|
+
*
|
276
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
277
|
+
*
|
278
|
+
* ```ts
|
279
|
+
* const [promotions, count] =
|
280
|
+
* await promotionModuleService.listAndCount(
|
281
|
+
* {
|
282
|
+
* id: ["promo_123", "promo_321"],
|
283
|
+
* },
|
284
|
+
* {
|
285
|
+
* relations: ["application_method"],
|
286
|
+
* take: 20,
|
287
|
+
* skip: 2,
|
288
|
+
* }
|
289
|
+
* )
|
290
|
+
* ```
|
291
|
+
*/
|
15
292
|
listAndCount(filters?: FilterablePromotionProps, config?: FindConfig<PromotionDTO>, sharedContext?: Context): Promise<[PromotionDTO[], number]>;
|
293
|
+
/**
|
294
|
+
* This method retrieves a promotion by its ID.
|
295
|
+
*
|
296
|
+
* @param {string} id - The ID of the promotion.
|
297
|
+
* @param {FindConfig<PromotionDTO>} config - The configurations determining how the promotion is retrieved. Its properties, such as `select` or `relations`, accept the
|
298
|
+
* attributes or relations associated with a promotion.
|
299
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
300
|
+
* @returns {Promise<PromotionDTO>} The retrieved promotion.
|
301
|
+
*
|
302
|
+
* @example
|
303
|
+
* A simple example that retrieves a promotion by its ID:
|
304
|
+
*
|
305
|
+
* ```ts
|
306
|
+
* const promotion =
|
307
|
+
* await promotionModuleService.retrieve("promo_123")
|
308
|
+
* ```
|
309
|
+
*
|
310
|
+
* To specify relations that should be retrieved:
|
311
|
+
*
|
312
|
+
* ```ts
|
313
|
+
* const promotion = await promotionModuleService.retrieve(
|
314
|
+
* "promo_123",
|
315
|
+
* {
|
316
|
+
* relations: ["application_method"],
|
317
|
+
* }
|
318
|
+
* )
|
319
|
+
* ```
|
320
|
+
*/
|
16
321
|
retrieve(id: string, config?: FindConfig<PromotionDTO>, sharedContext?: Context): Promise<PromotionDTO>;
|
322
|
+
/**
|
323
|
+
* This method deletes promotions by their IDs.
|
324
|
+
*
|
325
|
+
* @param {string[]} ids - The IDs of the promotion.
|
326
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
327
|
+
* @returns {Promise<void>} Resolves when the promotions are deleted.
|
328
|
+
*
|
329
|
+
* @example
|
330
|
+
* await promotionModuleService.delete([
|
331
|
+
* "promo_123",
|
332
|
+
* "promo_321",
|
333
|
+
* ])
|
334
|
+
*/
|
17
335
|
delete(ids: string[], sharedContext?: Context): Promise<void>;
|
336
|
+
/**
|
337
|
+
* This method deletes a promotion by its ID.
|
338
|
+
*
|
339
|
+
* @param {string} ids - The IDs of the promotion.
|
340
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
341
|
+
* @returns {Promise<void>} Resolves when the promotion is deleted.
|
342
|
+
*
|
343
|
+
* @example
|
344
|
+
* await promotionModuleService.delete("promo_123")
|
345
|
+
*/
|
18
346
|
delete(ids: string, sharedContext?: Context): Promise<void>;
|
347
|
+
/**
|
348
|
+
* This method soft deletes a promotion by its IDs.
|
349
|
+
*
|
350
|
+
* @param {string | string[]} promotionIds - The list of promotions to soft delete.
|
351
|
+
* @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.
|
352
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
353
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated application method.
|
354
|
+
* The object's keys are the ID attribute names of the promotion entity's relations, such as `application_method_id`, and its value is an array of strings, each being the ID of a record associated
|
355
|
+
* with the promotion through this relation, such as the IDs of associated application method.
|
356
|
+
*
|
357
|
+
* If there are no related records, the promise resolves to `void`.
|
358
|
+
*
|
359
|
+
* @example
|
360
|
+
* await promotionModuleService.softDelete("promo_123")
|
361
|
+
*/
|
19
362
|
softDelete<TReturnableLinkableKeys extends string = string>(promotionIds: string | string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
363
|
+
/**
|
364
|
+
* This method restores soft deleted promotions by their IDs.
|
365
|
+
*
|
366
|
+
* @param {string | string[]} promotionIds - The promotions' IDs.
|
367
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the promotion. You can pass to its `returnLinkableKeys`
|
368
|
+
* property any of the promotion's relation attribute names, such as `application_method_id`.
|
369
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
370
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the ID of associated application method.
|
371
|
+
* The object's keys are the ID attribute names of the promotion entity's relations, such as `application_method_id`,
|
372
|
+
* and its value is an array of strings, each being the ID of the record associated with the promotion through this relation,
|
373
|
+
* such as the IDs of associated application method.
|
374
|
+
*
|
375
|
+
* If there are no related records restored, the promise resolves to `void`.
|
376
|
+
*
|
377
|
+
* @example
|
378
|
+
* await promotionModuleService.restore("promo_123")
|
379
|
+
*/
|
20
380
|
restore<TReturnableLinkableKeys extends string = string>(promotionIds: string | string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
381
|
+
/**
|
382
|
+
* This method adds promotion rules to a promotion.
|
383
|
+
*
|
384
|
+
* @param {string} promotionId - The promotion's ID.
|
385
|
+
* @param {CreatePromotionRuleDTO[]} rulesData - The promotion rules to be created and added to the promotion.
|
386
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
387
|
+
* @returns {Promise<PromotionRuleDTO[]>} The promotion rules created.
|
388
|
+
*
|
389
|
+
* @example
|
390
|
+
* const promotionRules =
|
391
|
+
* await promotionModuleService.addPromotionRules(
|
392
|
+
* "promo_123",
|
393
|
+
* [
|
394
|
+
* {
|
395
|
+
* attribute: "customer_group_id",
|
396
|
+
* operator: "in",
|
397
|
+
* values: ["VIP", "VVIP"],
|
398
|
+
* },
|
399
|
+
* ]
|
400
|
+
* )
|
401
|
+
*/
|
21
402
|
addPromotionRules(promotionId: string, rulesData: CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionRuleDTO[]>;
|
403
|
+
/**
|
404
|
+
* This method adds target promotion rules to a promotion's application method.
|
405
|
+
*
|
406
|
+
* @param {string} promotionId - The promotion's ID.
|
407
|
+
* @param {CreatePromotionRuleDTO[]} rulesData - The promotion rules to be created and added as target rules to the promotion's application method.
|
408
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
409
|
+
* @returns {Promise<PromotionRuleDTO[]>} The created promotion rules.
|
410
|
+
*
|
411
|
+
* @example
|
412
|
+
* const targetPromotionRules =
|
413
|
+
* await promotionModuleService.addPromotionTargetRules(
|
414
|
+
* "promo_123",
|
415
|
+
* [
|
416
|
+
* {
|
417
|
+
* attribute: "SKU",
|
418
|
+
* operator: "eq",
|
419
|
+
* values: "SHIRT",
|
420
|
+
* },
|
421
|
+
* ]
|
422
|
+
* )
|
423
|
+
*/
|
22
424
|
addPromotionTargetRules(promotionId: string, rulesData: CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionRuleDTO[]>;
|
425
|
+
/**
|
426
|
+
* This method adds buy promotion rules to a promotion's application method.
|
427
|
+
*
|
428
|
+
* @param {string} promotionId - The promotion's ID.
|
429
|
+
* @param {CreatePromotionRuleDTO[]} rulesData - The promotion rules to be created and added as buy rules to the promotion's applicatio method.
|
430
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
431
|
+
* @returns {Promise<PromotionRuleDTO[]>} The created promotion rules.
|
432
|
+
*
|
433
|
+
* @example
|
434
|
+
* const buyPromotionRules =
|
435
|
+
* await promotionModuleService.addPromotionBuyRules(
|
436
|
+
* "promo_123",
|
437
|
+
* [
|
438
|
+
* {
|
439
|
+
* attribute: "SKU",
|
440
|
+
* operator: "eq",
|
441
|
+
* values: "SHIRT",
|
442
|
+
* },
|
443
|
+
* ]
|
444
|
+
* )
|
445
|
+
*/
|
23
446
|
addPromotionBuyRules(promotionId: string, rulesData: CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionRuleDTO[]>;
|
447
|
+
/**
|
448
|
+
* This method removes promotion rules from a promotion.
|
449
|
+
*
|
450
|
+
* @param {string} promotionId - The promotion's ID.
|
451
|
+
* @param {string[]} ruleIds - The promotion rules' IDs.
|
452
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
453
|
+
* @returns {Promise<void>} Resolves when the promotion rules are deleted successfully.
|
454
|
+
*
|
455
|
+
* @example
|
456
|
+
* await promotionModuleService.removePromotionRules(
|
457
|
+
* "promo_123",
|
458
|
+
* ["prorul_123", "prorul_321"]
|
459
|
+
* )
|
460
|
+
*/
|
24
461
|
removePromotionRules(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
|
462
|
+
/**
|
463
|
+
* This method removes target promotion rules from a promotion's application method.
|
464
|
+
*
|
465
|
+
* @param {string} promotionId - The promotion's ID.
|
466
|
+
* @param {string[]} ruleIds - The target promotion rules' IDs.
|
467
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
468
|
+
* @returns {Promise<void>} Resolves when the target promotion rules are deleted.
|
469
|
+
*
|
470
|
+
* @example
|
471
|
+
* await promotionModuleService.removePromotionTargetRules(
|
472
|
+
* "promo_123",
|
473
|
+
* ["prorul_123", "prorul_321"]
|
474
|
+
* )
|
475
|
+
*/
|
25
476
|
removePromotionTargetRules(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
|
477
|
+
/**
|
478
|
+
* This method removes buy promotion rules from a promotion's application method.
|
479
|
+
*
|
480
|
+
* @param {string} promotionId - The promotion's ID.
|
481
|
+
* @param {string[]} ruleIds - The buy promotion rules' IDs.
|
482
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
483
|
+
* @returns {Promise<void>} Resolves when the buy promotion rules are deleted.
|
484
|
+
*
|
485
|
+
* @example
|
486
|
+
* await promotionModuleService.removePromotionBuyRules(
|
487
|
+
* "promo_123",
|
488
|
+
* ["prorul_123", "prorul_321"]
|
489
|
+
* )
|
490
|
+
*/
|
26
491
|
removePromotionBuyRules(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
|
492
|
+
/**
|
493
|
+
* This method creates a campaign.
|
494
|
+
*
|
495
|
+
* @param {CreateCampaignDTO} data - The campaign to be created.
|
496
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
497
|
+
* @returns {Promise<CampaignDTO>} The created campaign.
|
498
|
+
*
|
499
|
+
* @example
|
500
|
+
* const campaign = await promotionModuleService.createCampaigns(
|
501
|
+
* {
|
502
|
+
* name: "Summer discounts",
|
503
|
+
* campaign_identifier: "G-123456",
|
504
|
+
* starts_at: new Date("2025-06-01"),
|
505
|
+
* ends_at: new Date("2025-09-01"),
|
506
|
+
* budget: {
|
507
|
+
* type: "usage",
|
508
|
+
* limit: 10,
|
509
|
+
* },
|
510
|
+
* }
|
511
|
+
* )
|
512
|
+
*/
|
27
513
|
createCampaigns(data: CreateCampaignDTO, sharedContext?: Context): Promise<CampaignDTO>;
|
514
|
+
/**
|
515
|
+
* This method creates campaigns.
|
516
|
+
*
|
517
|
+
* @param {CreateCampaignDTO[]} data - The campaigns to be created.
|
518
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
519
|
+
* @returns {Promise<CampaignDTO[]>} The created campaigns.
|
520
|
+
*
|
521
|
+
* @example
|
522
|
+
* const campaigns =
|
523
|
+
* await promotionModuleService.createCampaigns([
|
524
|
+
* {
|
525
|
+
* name: "Summer discounts",
|
526
|
+
* campaign_identifier: "G-123456",
|
527
|
+
* starts_at: new Date("2025-06-01"),
|
528
|
+
* ends_at: new Date("2025-09-01"),
|
529
|
+
* budget: {
|
530
|
+
* type: "usage",
|
531
|
+
* limit: 10,
|
532
|
+
* },
|
533
|
+
* },
|
534
|
+
* ])
|
535
|
+
*/
|
28
536
|
createCampaigns(data: CreateCampaignDTO[], sharedContext?: Context): Promise<CampaignDTO[]>;
|
537
|
+
/**
|
538
|
+
* This method updates existing campaigns.
|
539
|
+
*
|
540
|
+
* @param {UpdateCampaignDTO[]} data - The attributes to update in the campaigns.
|
541
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
542
|
+
* @returns {Promise<CampaignDTO[]>} The updated campaigns.
|
543
|
+
*
|
544
|
+
* @example
|
545
|
+
* const campaigns =
|
546
|
+
* await promotionModuleService.updateCampaigns([
|
547
|
+
* {
|
548
|
+
* id: "procamp_123",
|
549
|
+
* name: "Summer Sales",
|
550
|
+
* },
|
551
|
+
* ])
|
552
|
+
*/
|
29
553
|
updateCampaigns(data: UpdateCampaignDTO[], sharedContext?: Context): Promise<CampaignDTO[]>;
|
554
|
+
/**
|
555
|
+
* This method updates an existing campaign.
|
556
|
+
*
|
557
|
+
* @param {UpdateCampaignDTO} data - The attributes to update in the campaign.
|
558
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
559
|
+
* @returns {Promise<CampaignDTO>} The updated campaign.
|
560
|
+
*
|
561
|
+
* @example
|
562
|
+
* const campaigns =
|
563
|
+
* await promotionModuleService.updateCampaigns({
|
564
|
+
* id: "procamp_123",
|
565
|
+
* name: "Summer Sales",
|
566
|
+
* })
|
567
|
+
*/
|
30
568
|
updateCampaigns(data: UpdateCampaignDTO, sharedContext?: Context): Promise<CampaignDTO>;
|
569
|
+
/**
|
570
|
+
* This method retrieves a paginated list of promotion rules based on optional filters and configuration.
|
571
|
+
*
|
572
|
+
* @param {FilterablePromotionRuleProps} filters - The filters to apply on the retrieved promotion rules.
|
573
|
+
* @param {FindConfig<PromotionRuleDTO>} config - The configurations determining how the promotion rule is retrieved. Its properties, such as `select` or `relations`, accept the
|
574
|
+
* attributes or relations associated with a promotion rule.
|
575
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
576
|
+
* @returns {Promise<PromotionRuleDTO[]>} The list of promotion rules.
|
577
|
+
*
|
578
|
+
* @example
|
579
|
+
* To retrieve a list of promotion rules using their IDs:
|
580
|
+
*
|
581
|
+
* ```ts
|
582
|
+
* const promotionRules =
|
583
|
+
* await promotionModuleService.listPromotionRules({
|
584
|
+
* id: ["prorul_123", "prorul_321"],
|
585
|
+
* })
|
586
|
+
* ```
|
587
|
+
*
|
588
|
+
* To specify relations that should be retrieved within the promotion rules:
|
589
|
+
*
|
590
|
+
* ```ts
|
591
|
+
* const promotionRules =
|
592
|
+
* await promotionModuleService.listPromotionRules(
|
593
|
+
* {
|
594
|
+
* id: ["prorul_123", "prorul_321"],
|
595
|
+
* },
|
596
|
+
* {
|
597
|
+
* relations: ["promotions"],
|
598
|
+
* }
|
599
|
+
* )
|
600
|
+
* ```
|
601
|
+
*
|
602
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
603
|
+
*
|
604
|
+
* ```ts
|
605
|
+
* const promotionRules =
|
606
|
+
* await promotionModuleService.listPromotionRules(
|
607
|
+
* {
|
608
|
+
* id: ["prorul_123", "prorul_321"],
|
609
|
+
* },
|
610
|
+
* {
|
611
|
+
* relations: ["promotions"],
|
612
|
+
* take: 20,
|
613
|
+
* skip: 2,
|
614
|
+
* }
|
615
|
+
* )
|
616
|
+
* ```
|
617
|
+
*/
|
31
618
|
listPromotionRules(filters?: FilterablePromotionRuleProps, config?: FindConfig<PromotionRuleDTO>, sharedContext?: Context): Promise<PromotionRuleDTO[]>;
|
619
|
+
/**
|
620
|
+
* This method updates existing promotion rules.
|
621
|
+
*
|
622
|
+
* @param {UpdatePromotionRuleDTO[]} data - The attributes to update in the promotion rules.
|
623
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
624
|
+
* @returns {Promise<PromotionRuleDTO[]>} The updated promotion rules.
|
625
|
+
*
|
626
|
+
* @example
|
627
|
+
* const promotionRules =
|
628
|
+
* await promotionModuleService.updatePromotionRules([
|
629
|
+
* {
|
630
|
+
* id: "prorul_123",
|
631
|
+
* description: "Only allow VIP customers",
|
632
|
+
* },
|
633
|
+
* ])
|
634
|
+
*/
|
32
635
|
updatePromotionRules(data: UpdatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionRuleDTO[]>;
|
636
|
+
/**
|
637
|
+
* This method retrieves a paginated list of campaigns based on optional filters and configuration.
|
638
|
+
*
|
639
|
+
* @param {FilterableCampaignProps} filters - The filters to apply on the retrieved campaigns.
|
640
|
+
* @param {FindConfig<CampaignDTO>} config - The configurations determining how the campaign is retrieved. Its properties, such as `select` or `relations`, accept the
|
641
|
+
* attributes or relations associated with a campaign.
|
642
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
643
|
+
* @returns {Promise<CampaignDTO[]>} The list of campaigns.
|
644
|
+
*
|
645
|
+
* @example
|
646
|
+
* To retrieve a list of campaigns using their IDs:
|
647
|
+
*
|
648
|
+
* ```ts
|
649
|
+
* const campaigns = await promotionModuleService.listCampaigns({
|
650
|
+
* id: ["procamp_123"],
|
651
|
+
* })
|
652
|
+
* ```
|
653
|
+
*
|
654
|
+
* To specify relations that should be retrieved within the campaigns:
|
655
|
+
*
|
656
|
+
* ```ts
|
657
|
+
* const campaigns = await promotionModuleService.listCampaigns(
|
658
|
+
* {
|
659
|
+
* id: ["procamp_123"],
|
660
|
+
* },
|
661
|
+
* {
|
662
|
+
* relations: ["promotions"],
|
663
|
+
* }
|
664
|
+
* )
|
665
|
+
* ```
|
666
|
+
*
|
667
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
668
|
+
*
|
669
|
+
* ```ts
|
670
|
+
* const campaigns = await promotionModuleService.listCampaigns(
|
671
|
+
* {
|
672
|
+
* id: ["procamp_123"],
|
673
|
+
* },
|
674
|
+
* {
|
675
|
+
* relations: ["promotions"],
|
676
|
+
* take: 20,
|
677
|
+
* skip: 2,
|
678
|
+
* }
|
679
|
+
* )
|
680
|
+
* ```
|
681
|
+
*/
|
33
682
|
listCampaigns(filters?: FilterableCampaignProps, config?: FindConfig<CampaignDTO>, sharedContext?: Context): Promise<CampaignDTO[]>;
|
683
|
+
/**
|
684
|
+
* This method retrieves a paginated list of campaigns along with the total count of available campaigns satisfying the provided filters.
|
685
|
+
*
|
686
|
+
* @param {FilterableCampaignProps} filters - The filters to apply on the retrieved campaigns.
|
687
|
+
* @param {FindConfig<CampaignDTO>} config - The configurations determining how the campaign is retrieved. Its properties, such as `select` or `relations`, accept the
|
688
|
+
* attributes or relations associated with a campaign.
|
689
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
690
|
+
* @returns {Promise<[CampaignDTO[], number]>} The list of campaigns along with their total count.
|
691
|
+
*
|
692
|
+
* @example
|
693
|
+
* To retrieve a list of campaigns using their IDs:
|
694
|
+
*
|
695
|
+
* ```ts
|
696
|
+
* const [campaigns, count] =
|
697
|
+
* await promotionModuleService.listAndCountCampaigns({
|
698
|
+
* id: ["procamp_123"],
|
699
|
+
* })
|
700
|
+
* ```
|
701
|
+
*
|
702
|
+
* To specify relations that should be retrieved within the campaigns:
|
703
|
+
*
|
704
|
+
* ```ts
|
705
|
+
* const [campaigns, count] =
|
706
|
+
* await promotionModuleService.listAndCountCampaigns(
|
707
|
+
* {
|
708
|
+
* id: ["procamp_123"],
|
709
|
+
* },
|
710
|
+
* {
|
711
|
+
* relations: ["promotions"],
|
712
|
+
* }
|
713
|
+
* )
|
714
|
+
* ```
|
715
|
+
*
|
716
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
717
|
+
*
|
718
|
+
* ```ts
|
719
|
+
* const [campaigns, count] =
|
720
|
+
* await promotionModuleService.listAndCountCampaigns(
|
721
|
+
* {
|
722
|
+
* id: ["procamp_123"],
|
723
|
+
* },
|
724
|
+
* {
|
725
|
+
* relations: ["promotions"],
|
726
|
+
* take: 20,
|
727
|
+
* skip: 2,
|
728
|
+
* }
|
729
|
+
* )
|
730
|
+
* ```
|
731
|
+
*/
|
34
732
|
listAndCountCampaigns(filters?: FilterableCampaignProps, config?: FindConfig<CampaignDTO>, sharedContext?: Context): Promise<[CampaignDTO[], number]>;
|
733
|
+
/**
|
734
|
+
* This method retrieves a campaigns by its ID.
|
735
|
+
*
|
736
|
+
* @param {string} id - The ID of the campaigns.
|
737
|
+
* @param {FindConfig<CampaignDTO>} config - The configurations determining how the campaign is retrieved. Its properties, such as `select` or `relations`, accept the
|
738
|
+
* attributes or relations associated with a campaign.
|
739
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
740
|
+
* @returns {Promise<CampaignDTO>} The retrieved campaigns.
|
741
|
+
*
|
742
|
+
* @example
|
743
|
+
* A simple example that retrieves a promotion by its ID:
|
744
|
+
*
|
745
|
+
* ```ts
|
746
|
+
* const campaign =
|
747
|
+
* await promotionModuleService.retrieveCampaign("procamp_123")
|
748
|
+
* ```
|
749
|
+
*
|
750
|
+
* To specify relations that should be retrieved:
|
751
|
+
*
|
752
|
+
* ```ts
|
753
|
+
* const campaign =
|
754
|
+
* await promotionModuleService.retrieveCampaign(
|
755
|
+
* "procamp_123",
|
756
|
+
* {
|
757
|
+
* relations: ["promotions"],
|
758
|
+
* }
|
759
|
+
* )
|
760
|
+
* ```
|
761
|
+
*/
|
35
762
|
retrieveCampaign(id: string, config?: FindConfig<CampaignDTO>, sharedContext?: Context): Promise<CampaignDTO>;
|
763
|
+
/**
|
764
|
+
* This method deletes campaigns by their IDs.
|
765
|
+
*
|
766
|
+
* @param {string[]} ids - The IDs of the campaigns.
|
767
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
768
|
+
* @returns {Promise<void>} Resolves when the campaigns are deleted successfully.
|
769
|
+
*
|
770
|
+
* @example
|
771
|
+
* await promotionModuleService.deleteCampaigns(["procamp_123"])
|
772
|
+
*/
|
36
773
|
deleteCampaigns(ids: string[], sharedContext?: Context): Promise<void>;
|
774
|
+
/**
|
775
|
+
* This method deletes a campaign by its ID.
|
776
|
+
*
|
777
|
+
* @param {string} ids - The IDs of the campaign.
|
778
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
779
|
+
* @returns {Promise<void>} Resolves when the campaign is deleted successfully.
|
780
|
+
*
|
781
|
+
* @example
|
782
|
+
* await promotionModuleService.deleteCampaigns("procamp_123")
|
783
|
+
*/
|
37
784
|
deleteCampaigns(ids: string, sharedContext?: Context): Promise<void>;
|
785
|
+
/**
|
786
|
+
* This method soft deletes campaigns by their IDs.
|
787
|
+
*
|
788
|
+
* @param {string | string[]} campaignIds - The IDs of the campaigns.
|
789
|
+
* @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.
|
790
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
791
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated campaign budget.
|
792
|
+
* The object's keys are the ID attribute names of the campaign entity's relations, such as `budget_id`, and its value is an array of strings, each being the ID of a record associated
|
793
|
+
* with the campaign through this relation, such as the IDs of associated campaign budget.
|
794
|
+
*
|
795
|
+
* If there are no related records, the promise resolves to `void`.
|
796
|
+
*
|
797
|
+
* @example
|
798
|
+
* await promotionModuleService.softDeleteCampaigns(
|
799
|
+
* "procamp_123",
|
800
|
+
* {
|
801
|
+
* returnLinkableKeys: ["budget_id"],
|
802
|
+
* }
|
803
|
+
* )
|
804
|
+
*/
|
38
805
|
softDeleteCampaigns<TReturnableLinkableKeys extends string = string>(campaignIds: string | string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
806
|
+
/**
|
807
|
+
* This method restores soft deleted campaigns by their IDs.
|
808
|
+
*
|
809
|
+
* @param {string | string[]} campaignIds - The IDs of the campaigns
|
810
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the campaigns. You can pass to its `returnLinkableKeys`
|
811
|
+
* property any of the campaign's relation attribute names, such as `budget_id`.
|
812
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
813
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the ID of associated campaign budget.
|
814
|
+
* The object's keys are the ID attribute names of the campaign entity's relations, such as `budget_id`,
|
815
|
+
* and its value is an array of strings, each being the ID of the record associated with the campaign through this relation,
|
816
|
+
* such as the IDs of associated campaign budget.
|
817
|
+
*
|
818
|
+
* If there are no related records restored, the promise resolves to `void`.
|
819
|
+
*
|
820
|
+
* @example
|
821
|
+
* await promotionModuleService.restoreCampaigns("procamp_123", {
|
822
|
+
* returnLinkableKeys: ["budget_id"],
|
823
|
+
* })
|
824
|
+
*/
|
39
825
|
restoreCampaigns<TReturnableLinkableKeys extends string = string>(campaignIds: string | string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
40
826
|
}
|
41
827
|
//# sourceMappingURL=service.d.ts.map
|