@medusajs/promotion 0.0.5-snapshot-20240717160031 → 0.0.5-snapshot-20240718083016
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -5
- package/dist/initialize/index.d.ts +5 -0
- package/dist/initialize/index.d.ts.map +1 -0
- package/dist/initialize/index.js +16 -0
- package/dist/joiner-config.d.ts +8 -1
- package/dist/joiner-config.d.ts.map +1 -1
- package/dist/joiner-config.js +35 -4
- package/dist/loaders/connection.d.ts +5 -0
- package/dist/loaders/connection.d.ts.map +1 -0
- package/dist/loaders/connection.js +41 -0
- package/dist/loaders/container.d.ts +3 -0
- package/dist/loaders/container.d.ts.map +1 -0
- package/dist/loaders/container.js +34 -0
- package/dist/loaders/index.d.ts +3 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +18 -0
- package/dist/migrations/Migration20240227120221.d.ts.map +1 -1
- package/dist/migrations/Migration20240227120221.js +2 -10
- package/dist/models/application-method.d.ts +6 -4
- package/dist/models/application-method.d.ts.map +1 -1
- package/dist/models/application-method.js +6 -16
- package/dist/models/campaign-budget.d.ts +5 -6
- package/dist/models/campaign-budget.d.ts.map +1 -1
- package/dist/models/campaign-budget.js +4 -8
- package/dist/models/campaign.d.ts +4 -3
- package/dist/models/campaign.d.ts.map +1 -1
- package/dist/models/campaign.js +13 -10
- package/dist/models/promotion-rule-value.d.ts +1 -2
- package/dist/models/promotion-rule-value.d.ts.map +1 -1
- package/dist/models/promotion-rule-value.js +1 -1
- package/dist/models/promotion-rule.d.ts +1 -1
- package/dist/models/promotion-rule.d.ts.map +1 -1
- package/dist/models/promotion.d.ts +4 -5
- package/dist/models/promotion.d.ts.map +1 -1
- package/dist/models/promotion.js +4 -8
- package/dist/module-definition.d.ts +5 -0
- package/dist/module-definition.d.ts.map +1 -0
- package/dist/module-definition.js +50 -0
- package/dist/repositories/campaign.d.ts +16 -0
- package/dist/repositories/campaign.d.ts.map +1 -0
- package/dist/repositories/campaign.js +90 -0
- package/dist/repositories/index.d.ts +3 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +7 -0
- package/dist/services/promotion-module.d.ts +26 -40
- package/dist/services/promotion-module.d.ts.map +1 -1
- package/dist/services/promotion-module.js +62 -189
- package/dist/types/application-method.d.ts +10 -12
- package/dist/types/application-method.d.ts.map +1 -1
- package/dist/types/campaign-budget.d.ts +6 -8
- package/dist/types/campaign-budget.d.ts.map +1 -1
- package/dist/types/campaign.d.ts +8 -6
- package/dist/types/campaign.d.ts.map +1 -1
- package/dist/types/promotion.d.ts +2 -2
- package/dist/types/promotion.d.ts.map +1 -1
- package/dist/utils/compute-actions/buy-get.d.ts +2 -2
- package/dist/utils/compute-actions/buy-get.d.ts.map +1 -1
- package/dist/utils/compute-actions/buy-get.js +12 -12
- package/dist/utils/compute-actions/line-items.d.ts.map +1 -1
- package/dist/utils/compute-actions/line-items.js +4 -4
- package/dist/utils/compute-actions/shipping-methods.d.ts +2 -2
- package/dist/utils/compute-actions/shipping-methods.d.ts.map +1 -1
- package/dist/utils/compute-actions/shipping-methods.js +17 -14
- package/dist/utils/compute-actions/usage.d.ts +2 -2
- package/dist/utils/compute-actions/usage.d.ts.map +1 -1
- package/dist/utils/compute-actions/usage.js +3 -3
- package/dist/utils/validations/application-method.d.ts.map +1 -1
- package/dist/utils/validations/application-method.js +2 -2
- package/package.json +13 -8
- package/dist/migrations/Migration20240617102917.d.ts +0 -6
- package/dist/migrations/Migration20240617102917.d.ts.map +0 -1
- package/dist/migrations/Migration20240617102917.js +0 -15
- package/dist/migrations/Migration20240624153824.d.ts +0 -6
- package/dist/migrations/Migration20240624153824.d.ts.map +0 -1
- package/dist/migrations/Migration20240624153824.js +0 -15
@@ -17,29 +17,29 @@ function getComputedActionsForBuyGet(promotion, itemsContext, methodIdPromoValue
|
|
17
17
|
if (!Array.isArray(buyRules) || !Array.isArray(targetRules)) {
|
18
18
|
return [];
|
19
19
|
}
|
20
|
-
const validQuantity =
|
20
|
+
const validQuantity = itemsContext
|
21
21
|
.filter((item) => (0, validations_1.areRulesValidForContext)(buyRules, item))
|
22
|
-
.
|
22
|
+
.reduce((acc, next) => acc + next.quantity, 0);
|
23
23
|
if (!buyRulesMinQuantity ||
|
24
24
|
!applyToQuantity ||
|
25
|
-
|
25
|
+
buyRulesMinQuantity > validQuantity) {
|
26
26
|
return [];
|
27
27
|
}
|
28
28
|
const validItemsForTargetRules = itemsContext
|
29
29
|
.filter((item) => (0, validations_1.areRulesValidForContext)(targetRules, item))
|
30
30
|
.filter((item) => (0, utils_1.isPresent)(item.subtotal) && (0, utils_1.isPresent)(item.quantity))
|
31
31
|
.sort((a, b) => {
|
32
|
-
const aPrice =
|
33
|
-
const bPrice =
|
34
|
-
return
|
32
|
+
const aPrice = a.subtotal / a.quantity;
|
33
|
+
const bPrice = b.subtotal / b.quantity;
|
34
|
+
return bPrice - aPrice;
|
35
35
|
});
|
36
|
-
let remainingQtyToApply =
|
36
|
+
let remainingQtyToApply = applyToQuantity;
|
37
37
|
for (const method of validItemsForTargetRules) {
|
38
38
|
const appliedPromoValue = methodIdPromoValueMap.get(method.id) ?? 0;
|
39
|
-
const multiplier =
|
40
|
-
const amount =
|
41
|
-
const newRemainingQtyToApply =
|
42
|
-
if (
|
39
|
+
const multiplier = Math.min(method.quantity, remainingQtyToApply);
|
40
|
+
const amount = (method.subtotal / method.quantity) * multiplier;
|
41
|
+
const newRemainingQtyToApply = remainingQtyToApply - multiplier;
|
42
|
+
if (newRemainingQtyToApply < 0 || amount <= 0) {
|
43
43
|
break;
|
44
44
|
}
|
45
45
|
else {
|
@@ -50,7 +50,7 @@ function getComputedActionsForBuyGet(promotion, itemsContext, methodIdPromoValue
|
|
50
50
|
computedActions.push(budgetExceededAction);
|
51
51
|
continue;
|
52
52
|
}
|
53
|
-
methodIdPromoValueMap.set(method.id,
|
53
|
+
methodIdPromoValueMap.set(method.id, appliedPromoValue + amount);
|
54
54
|
computedActions.push({
|
55
55
|
action: utils_1.ComputedActions.ADD_ITEM_ADJUSTMENT,
|
56
56
|
item_id: method.id,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"line-items.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/line-items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,
|
1
|
+
{"version":3,"file":"line-items.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/line-items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,cAAc,EACf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAIL,2BAA2B,IAAI,UAAU,EAE1C,MAAM,iBAAiB,CAAA;AAgBxB,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,UAAU,CAAC,KAAK,CAAC,EAC5D,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,kBAAkB,CAAC,EAAE,iCAAiC,GACrD,cAAc,CAAC,cAAc,EAAE,CASjC;AAED,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,eAAe,EAAE,cAAc,CAAC,oBAAoB,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACjF,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,cAAc,CAAC,cAAc,EAAE,CAIjC;AAED,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,sBAAsB,EAAE,cAAc,CAAC,oBAAoB,EAC3D,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,cAAc,CAAC,cAAc,EAAE,CAOjC"}
|
@@ -32,9 +32,9 @@ function applyPromotionToItems(promotion, items, appliedPromotionsMap, allocatio
|
|
32
32
|
const isTargetShippingMethod = target === utils_1.ApplicationMethodTargetType.SHIPPING_METHODS;
|
33
33
|
const isTargetLineItems = target === utils_1.ApplicationMethodTargetType.ITEMS;
|
34
34
|
const isTargetOrder = target === utils_1.ApplicationMethodTargetType.ORDER;
|
35
|
-
let lineItemsTotal =
|
35
|
+
let lineItemsTotal = 0;
|
36
36
|
if (allocation === utils_1.ApplicationMethodAllocation.ACROSS) {
|
37
|
-
lineItemsTotal = applicableItems.reduce((acc, item) =>
|
37
|
+
lineItemsTotal = applicableItems.reduce((acc, item) => acc + item.subtotal - (appliedPromotionsMap.get(item.id) ?? 0), 0);
|
38
38
|
}
|
39
39
|
for (const item of applicableItems) {
|
40
40
|
const appliedPromoValue = appliedPromotionsMap.get(item.id) ?? 0;
|
@@ -51,7 +51,7 @@ function applyPromotionToItems(promotion, items, appliedPromotionsMap, allocatio
|
|
51
51
|
type: applicationMethod?.type,
|
52
52
|
allocation,
|
53
53
|
}, lineItemsTotal);
|
54
|
-
if (
|
54
|
+
if (amount <= 0) {
|
55
55
|
continue;
|
56
56
|
}
|
57
57
|
const budgetExceededAction = (0, usage_1.computeActionForBudgetExceeded)(promotion, amount);
|
@@ -59,7 +59,7 @@ function applyPromotionToItems(promotion, items, appliedPromotionsMap, allocatio
|
|
59
59
|
computedActions.push(budgetExceededAction);
|
60
60
|
continue;
|
61
61
|
}
|
62
|
-
appliedPromotionsMap.set(item.id,
|
62
|
+
appliedPromotionsMap.set(item.id, appliedPromoValue + amount);
|
63
63
|
if (isTargetLineItems || isTargetOrder) {
|
64
64
|
computedActions.push({
|
65
65
|
action: utils_1.ComputedActions.ADD_ITEM_ADJUSTMENT,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { PromotionTypes } from "@medusajs/types";
|
2
2
|
import { ApplicationMethodTargetType } from "@medusajs/utils";
|
3
3
|
export declare function getComputedActionsForShippingMethods(promotion: PromotionTypes.PromotionDTO, shippingMethodApplicationContext: PromotionTypes.ComputeActionContext[ApplicationMethodTargetType.SHIPPING_METHODS], methodIdPromoValueMap: Map<string, number>): PromotionTypes.ComputeActions[];
|
4
|
-
export declare function applyPromotionToShippingMethods(promotion: PromotionTypes.PromotionDTO, shippingMethods: PromotionTypes.ComputeActionContext[ApplicationMethodTargetType.SHIPPING_METHODS], methodIdPromoValueMap: Map<string,
|
4
|
+
export declare function applyPromotionToShippingMethods(promotion: PromotionTypes.PromotionDTO, shippingMethods: PromotionTypes.ComputeActionContext[ApplicationMethodTargetType.SHIPPING_METHODS], methodIdPromoValueMap: Map<string, number>): PromotionTypes.ComputeActions[];
|
5
5
|
//# sourceMappingURL=shipping-methods.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shipping-methods.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/shipping-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
1
|
+
{"version":3,"file":"shipping-methods.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/shipping-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAEL,2BAA2B,EAI5B,MAAM,iBAAiB,CAAA;AAIxB,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,gCAAgC,EAAE,cAAc,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,EACnH,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,cAAc,CAAC,cAAc,EAAE,CA6BjC;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,cAAc,CAAC,YAAY,EACtC,eAAe,EAAE,cAAc,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,EAClG,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,cAAc,CAAC,cAAc,EAAE,CA0GjC"}
|
@@ -29,13 +29,13 @@ function applyPromotionToShippingMethods(promotion, shippingMethods, methodIdPro
|
|
29
29
|
continue;
|
30
30
|
}
|
31
31
|
const appliedPromoValue = methodIdPromoValueMap.get(method.id) ?? 0;
|
32
|
-
let promotionValue =
|
33
|
-
const applicableTotal =
|
32
|
+
let promotionValue = applicationMethod?.value ?? 0;
|
33
|
+
const applicableTotal = method.subtotal - appliedPromoValue;
|
34
34
|
if (applicationMethod?.type === utils_1.ApplicationMethodType.PERCENTAGE) {
|
35
|
-
promotionValue =
|
35
|
+
promotionValue = (promotionValue / 100) * applicableTotal;
|
36
36
|
}
|
37
|
-
const amount =
|
38
|
-
if (
|
37
|
+
const amount = Math.min(promotionValue, applicableTotal);
|
38
|
+
if (amount <= 0) {
|
39
39
|
continue;
|
40
40
|
}
|
41
41
|
const budgetExceededAction = (0, usage_1.computeActionForBudgetExceeded)(promotion, amount);
|
@@ -43,7 +43,7 @@ function applyPromotionToShippingMethods(promotion, shippingMethods, methodIdPro
|
|
43
43
|
computedActions.push(budgetExceededAction);
|
44
44
|
continue;
|
45
45
|
}
|
46
|
-
methodIdPromoValueMap.set(method.id,
|
46
|
+
methodIdPromoValueMap.set(method.id, appliedPromoValue + amount);
|
47
47
|
computedActions.push({
|
48
48
|
action: utils_1.ComputedActions.ADD_SHIPPING_METHOD_ADJUSTMENT,
|
49
49
|
shipping_method_id: method.id,
|
@@ -55,9 +55,9 @@ function applyPromotionToShippingMethods(promotion, shippingMethods, methodIdPro
|
|
55
55
|
if (allocation === utils_1.ApplicationMethodAllocation.ACROSS) {
|
56
56
|
const totalApplicableValue = shippingMethods.reduce((acc, method) => {
|
57
57
|
const appliedPromoValue = methodIdPromoValueMap.get(method.id) ?? 0;
|
58
|
-
return
|
59
|
-
},
|
60
|
-
if (
|
58
|
+
return acc + (method.subtotal ?? 0) - appliedPromoValue;
|
59
|
+
}, 0);
|
60
|
+
if (totalApplicableValue <= 0) {
|
61
61
|
return computedActions;
|
62
62
|
}
|
63
63
|
for (const method of shippingMethods) {
|
@@ -67,12 +67,15 @@ function applyPromotionToShippingMethods(promotion, shippingMethods, methodIdPro
|
|
67
67
|
const promotionValue = applicationMethod?.value ?? 0;
|
68
68
|
const applicableTotal = method.subtotal;
|
69
69
|
const appliedPromoValue = methodIdPromoValueMap.get(method.id) ?? 0;
|
70
|
-
|
70
|
+
// TODO: should we worry about precision here?
|
71
|
+
let applicablePromotionValue = (applicableTotal / totalApplicableValue) * promotionValue -
|
72
|
+
appliedPromoValue;
|
71
73
|
if (applicationMethod?.type === utils_1.ApplicationMethodType.PERCENTAGE) {
|
72
|
-
applicablePromotionValue =
|
74
|
+
applicablePromotionValue =
|
75
|
+
(promotionValue / 100) * (applicableTotal - appliedPromoValue);
|
73
76
|
}
|
74
|
-
const amount =
|
75
|
-
if (
|
77
|
+
const amount = Math.min(applicablePromotionValue, applicableTotal);
|
78
|
+
if (amount <= 0) {
|
76
79
|
continue;
|
77
80
|
}
|
78
81
|
const budgetExceededAction = (0, usage_1.computeActionForBudgetExceeded)(promotion, amount);
|
@@ -80,7 +83,7 @@ function applyPromotionToShippingMethods(promotion, shippingMethods, methodIdPro
|
|
80
83
|
computedActions.push(budgetExceededAction);
|
81
84
|
continue;
|
82
85
|
}
|
83
|
-
methodIdPromoValueMap.set(method.id,
|
86
|
+
methodIdPromoValueMap.set(method.id, appliedPromoValue + amount);
|
84
87
|
computedActions.push({
|
85
88
|
action: utils_1.ComputedActions.ADD_SHIPPING_METHOD_ADJUSTMENT,
|
86
89
|
shipping_method_id: method.id,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { CampaignBudgetExceededAction, ComputeActions, PromotionDTO } from "@medusajs/types";
|
2
2
|
export declare function canRegisterUsage(computedAction: ComputeActions): boolean;
|
3
|
-
export declare function computeActionForBudgetExceeded(promotion: PromotionDTO, amount:
|
3
|
+
export declare function computeActionForBudgetExceeded(promotion: PromotionDTO, amount: number): CampaignBudgetExceededAction | void;
|
4
4
|
//# sourceMappingURL=usage.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/utils/compute-actions/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,YAAY,EACb,MAAM,iBAAiB,CAAA;AAGxB,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAOxE;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,MAAM,GACb,4BAA4B,GAAG,IAAI,CAmBrC"}
|
@@ -16,9 +16,9 @@ function computeActionForBudgetExceeded(promotion, amount) {
|
|
16
16
|
}
|
17
17
|
const campaignBudgetUsed = campaignBudget.used ?? 0;
|
18
18
|
const totalUsed = campaignBudget.type === utils_1.CampaignBudgetType.SPEND
|
19
|
-
?
|
20
|
-
:
|
21
|
-
if (campaignBudget.limit &&
|
19
|
+
? campaignBudgetUsed + amount
|
20
|
+
: campaignBudgetUsed + 1;
|
21
|
+
if (campaignBudget.limit && totalUsed > campaignBudget.limit) {
|
22
22
|
return {
|
23
23
|
action: utils_1.ComputedActions.CAMPAIGN_BUDGET_EXCEEDED,
|
24
24
|
code: promotion.code,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"application-method.d.ts","sourceRoot":"","sources":["../../../src/utils/validations/application-method.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"application-method.d.ts","sourceRoot":"","sources":["../../../src/utils/validations/application-method.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAA;AAE/E,eAAO,MAAM,4BAA4B,EAAE,MAAM,EAGhD,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAG1C,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,MAAM,EAEhD,CAAA;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,0BAA0B,GAAG,0BAA0B,EAC7D,SAAS,EAAE,SAAS,QA4GrB"}
|
@@ -20,12 +20,12 @@ function validateApplicationMethodAttributes(data, promotion) {
|
|
20
20
|
const targetType = data.target_type || applicationMethod?.target_type;
|
21
21
|
const type = data.type || applicationMethod?.type;
|
22
22
|
const applicationMethodType = data.type || applicationMethod?.type;
|
23
|
-
const value =
|
23
|
+
const value = data.value || applicationMethod.value;
|
24
24
|
const maxQuantity = data.max_quantity || applicationMethod.max_quantity;
|
25
25
|
const allocation = data.allocation || applicationMethod.allocation;
|
26
26
|
const allTargetTypes = Object.values(utils_1.ApplicationMethodTargetType);
|
27
27
|
if (type === utils_1.ApplicationMethodType.PERCENTAGE &&
|
28
|
-
(
|
28
|
+
(typeof value !== "number" || value <= 0 || value > 100)) {
|
29
29
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Application Method value should be a percentage number between 0 and 100`);
|
30
30
|
}
|
31
31
|
if (promotion?.type === utils_1.PromotionType.BUYGET) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/promotion",
|
3
|
-
"version": "0.0.5-snapshot-
|
3
|
+
"version": "0.0.5-snapshot-20240718083016",
|
4
4
|
"description": "Medusa Promotion module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -8,7 +8,10 @@
|
|
8
8
|
"dist"
|
9
9
|
],
|
10
10
|
"engines": {
|
11
|
-
"node": ">=
|
11
|
+
"node": ">=16"
|
12
|
+
},
|
13
|
+
"bin": {
|
14
|
+
"medusa-promotion-seed": "dist/scripts/bin/run-seed.js"
|
12
15
|
},
|
13
16
|
"repository": {
|
14
17
|
"type": "git",
|
@@ -34,12 +37,10 @@
|
|
34
37
|
"orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
|
35
38
|
},
|
36
39
|
"devDependencies": {
|
37
|
-
"@medusajs/modules-sdk": "1.13.0-snapshot-20240717160031",
|
38
|
-
"@medusajs/types": "1.12.0-snapshot-20240717160031",
|
39
40
|
"@mikro-orm/cli": "5.9.7",
|
40
41
|
"cross-env": "^5.2.1",
|
41
|
-
"jest": "^29.
|
42
|
-
"medusa-test-utils": "1.1.45-snapshot-
|
42
|
+
"jest": "^29.6.3",
|
43
|
+
"medusa-test-utils": "1.1.45-snapshot-20240718083016",
|
43
44
|
"rimraf": "^3.0.2",
|
44
45
|
"ts-jest": "^29.1.1",
|
45
46
|
"ts-node": "^10.9.1",
|
@@ -47,10 +48,14 @@
|
|
47
48
|
"typescript": "^5.1.6"
|
48
49
|
},
|
49
50
|
"dependencies": {
|
50
|
-
"@medusajs/
|
51
|
+
"@medusajs/modules-sdk": "1.12.12-snapshot-20240718083016",
|
52
|
+
"@medusajs/types": "1.11.17-snapshot-20240718083016",
|
53
|
+
"@medusajs/utils": "1.11.10-snapshot-20240718083016",
|
51
54
|
"@mikro-orm/core": "5.9.7",
|
52
55
|
"@mikro-orm/migrations": "5.9.7",
|
53
56
|
"@mikro-orm/postgresql": "5.9.7",
|
54
|
-
"awilix": "^8.0.0"
|
57
|
+
"awilix": "^8.0.0",
|
58
|
+
"dotenv": "^16.4.5",
|
59
|
+
"knex": "2.4.2"
|
55
60
|
}
|
56
61
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Migration20240617102917.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240617102917.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAUnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Migration20240617102917 = void 0;
|
4
|
-
const migrations_1 = require("@mikro-orm/migrations");
|
5
|
-
class Migration20240617102917 extends migrations_1.Migration {
|
6
|
-
async up() {
|
7
|
-
this.addSql('alter table "promotion_application_method" alter column "currency_code" type text using ("currency_code"::text);');
|
8
|
-
this.addSql('alter table "promotion_application_method" alter column "currency_code" drop not null;');
|
9
|
-
}
|
10
|
-
async down() {
|
11
|
-
this.addSql('alter table "promotion_application_method" alter column "currency_code" type text using ("currency_code"::text);');
|
12
|
-
this.addSql('alter table "promotion_application_method" alter column "currency_code" set not null;');
|
13
|
-
}
|
14
|
-
}
|
15
|
-
exports.Migration20240617102917 = Migration20240617102917;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Migration20240624153824.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240624153824.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IASnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Migration20240624153824 = void 0;
|
4
|
-
const migrations_1 = require("@mikro-orm/migrations");
|
5
|
-
class Migration20240624153824 extends migrations_1.Migration {
|
6
|
-
async up() {
|
7
|
-
this.addSql('alter table if exists "promotion_campaign" drop constraint if exists "IDX_campaign_identifier_unique";');
|
8
|
-
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_promotion_campaign_campaign_identifier_unique" ON "promotion_campaign" (campaign_identifier) WHERE deleted_at IS NULL;');
|
9
|
-
}
|
10
|
-
async down() {
|
11
|
-
this.addSql('drop index if exists "IDX_promotion_campaign_campaign_identifier_unique";');
|
12
|
-
this.addSql('alter table if exists "promotion_campaign" add constraint "IDX_campaign_identifier_unique" unique ("campaign_identifier");');
|
13
|
-
}
|
14
|
-
}
|
15
|
-
exports.Migration20240624153824 = Migration20240624153824;
|