@medusajs/pricing 0.1.12-snapshot-20240430120718 → 0.1.13-snapshot-20240502151008
Sign up to get free protection for your applications and to get access to all the features.
@@ -51,13 +51,13 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.abstractModuleService
|
|
51
51
|
setupCalculatedPriceConfig_(filters, config) {
|
52
52
|
const fieldIdx = config.relations?.indexOf("calculated_price");
|
53
53
|
const shouldCalculatePrice = fieldIdx > -1;
|
54
|
+
const pricingContext = filters.context ?? {};
|
55
|
+
delete filters.context;
|
54
56
|
if (!shouldCalculatePrice) {
|
55
57
|
return;
|
56
58
|
}
|
57
|
-
let pricingContext = filters.context ?? {};
|
58
59
|
// cleanup virtual field "calculated_price"
|
59
60
|
config.relations?.splice(fieldIdx, 1);
|
60
|
-
delete filters.context;
|
61
61
|
return pricingContext;
|
62
62
|
}
|
63
63
|
async list(filters = {}, config = {}, sharedContext = {}) {
|
@@ -314,9 +314,7 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.abstractModuleService
|
|
314
314
|
}
|
315
315
|
async create_(data, sharedContext = {}) {
|
316
316
|
const input = Array.isArray(data) ? data : [data];
|
317
|
-
const ruleAttributes = data
|
318
|
-
.map((d) => d.rules?.map((r) => r.rule_attribute) ?? [])
|
319
|
-
.flat();
|
317
|
+
const ruleAttributes = (0, utils_1.deduplicate)(data.map((d) => d.rules?.map((r) => r.rule_attribute) ?? []).flat());
|
320
318
|
const ruleTypes = await this.ruleTypeService_.list({ rule_attribute: ruleAttributes }, { take: null }, sharedContext);
|
321
319
|
const ruleTypeMap = ruleTypes.reduce((acc, curr) => {
|
322
320
|
acc.set(curr.rule_attribute, curr);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/pricing",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.13-snapshot-20240502151008",
|
4
4
|
"description": "Medusa Pricing module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"@mikro-orm/cli": "5.9.7",
|
41
41
|
"cross-env": "^5.2.1",
|
42
42
|
"jest": "^29.6.3",
|
43
|
-
"medusa-test-utils": "1.1.44
|
43
|
+
"medusa-test-utils": "^1.1.44",
|
44
44
|
"rimraf": "^3.0.2",
|
45
45
|
"ts-jest": "^29.1.1",
|
46
46
|
"ts-node": "^10.9.1",
|
@@ -48,9 +48,9 @@
|
|
48
48
|
"typescript": "^5.1.6"
|
49
49
|
},
|
50
50
|
"dependencies": {
|
51
|
-
"@medusajs/modules-sdk": "1.12.11
|
52
|
-
"@medusajs/types": "1.11.
|
53
|
-
"@medusajs/utils": "1.11.
|
51
|
+
"@medusajs/modules-sdk": "^1.12.11",
|
52
|
+
"@medusajs/types": "1.11.17-snapshot-20240502151008",
|
53
|
+
"@medusajs/utils": "1.11.10-snapshot-20240502151008",
|
54
54
|
"@mikro-orm/core": "5.9.7",
|
55
55
|
"@mikro-orm/migrations": "5.9.7",
|
56
56
|
"@mikro-orm/postgresql": "5.9.7",
|