@medusajs/pricing 3.0.0-snapshot-20250408170244 → 3.0.0-snapshot-20250409125618
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/Migration20250408145122.d.ts +6 -0
- package/dist/migrations/Migration20250408145122.d.ts.map +1 -0
- package/dist/migrations/Migration20250408145122.js +18 -0
- package/dist/migrations/Migration20250408145122.js.map +1 -0
- package/dist/migrations/Migration20250409122219.d.ts +6 -0
- package/dist/migrations/Migration20250409122219.d.ts.map +1 -0
- package/dist/migrations/Migration20250409122219.js +14 -0
- package/dist/migrations/Migration20250409122219.js.map +1 -0
- package/dist/models/price-list-rule.d.ts.map +1 -1
- package/dist/models/price-list-rule.js +4 -0
- package/dist/models/price-list-rule.js.map +1 -1
- package/dist/models/price-rule.d.ts.map +1 -1
- package/dist/models/price-rule.js +12 -0
- package/dist/models/price-rule.js.map +1 -1
- package/dist/repositories/pricing.d.ts.map +1 -1
- package/dist/repositories/pricing.js +171 -159
- package/dist/repositories/pricing.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20250408145122.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20250408145122.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAErC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAOnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAOrC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Migration20250408145122 = void 0;
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
5
|
+
class Migration20250408145122 extends migrations_1.Migration {
|
6
|
+
async up() {
|
7
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_price_list_rule_attribute" ON "price_list_rule" (attribute) WHERE deleted_at IS NULL;`);
|
8
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_price_rule_attribute_value" ON "price_rule" (attribute, value) WHERE deleted_at IS NULL;`);
|
9
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_price_rule_operator_value" ON "price_rule" (operator, value) WHERE deleted_at IS NULL;`);
|
10
|
+
}
|
11
|
+
async down() {
|
12
|
+
this.addSql(`drop index if exists "IDX_price_list_rule_attribute";`);
|
13
|
+
this.addSql(`drop index if exists "IDX_price_rule_attribute_value";`);
|
14
|
+
this.addSql(`drop index if exists "IDX_price_rule_operator_value";`);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
exports.Migration20250408145122 = Migration20250408145122;
|
18
|
+
//# sourceMappingURL=Migration20250408145122.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20250408145122.js","sourceRoot":"","sources":["../../src/migrations/Migration20250408145122.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAElD,MAAa,uBAAwB,SAAQ,sBAAS;IAE3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,uHAAuH,CAAC,CAAC;QAErI,IAAI,CAAC,MAAM,CAAC,0HAA0H,CAAC,CAAC;QACxI,IAAI,CAAC,MAAM,CAAC,wHAAwH,CAAC,CAAC;IACxI,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,uDAAuD,CAAC,CAAC;QAErE,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,uDAAuD,CAAC,CAAC;IACvE,CAAC;CAEF;AAhBD,0DAgBC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20250409122219.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20250409122219.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAErC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAInB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAIrC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Migration20250409122219 = void 0;
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
5
|
+
class Migration20250409122219 extends migrations_1.Migration {
|
6
|
+
async up() {
|
7
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_price_rule_attribute" ON "price_rule" (attribute) WHERE deleted_at IS NULL;`);
|
8
|
+
}
|
9
|
+
async down() {
|
10
|
+
this.addSql(`drop index if exists "IDX_price_rule_attribute";`);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
exports.Migration20250409122219 = Migration20250409122219;
|
14
|
+
//# sourceMappingURL=Migration20250409122219.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20250409122219.js","sourceRoot":"","sources":["../../src/migrations/Migration20250409122219.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAElD,MAAa,uBAAwB,SAAQ,sBAAS;IAE3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,6GAA6G,CAAC,CAAC;IAC7H,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;CAEF;AAVD,0DAUC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-list-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"price-list-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAkBf,CAAA;AAEJ,eAAe,aAAa,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-list-rule.js","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,8DAAoC;AAEpC,MAAM,aAAa,GAAG,aAAK;KACxB,MAAM,CAAC,eAAe,EAAE;IACvB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE;IACvB,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,oBAAS,EAAE;QAC3C,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;CACH,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,eAAe,CAAC;QACrB,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC,CAAA;AAEJ,kBAAe,aAAa,CAAA"}
|
1
|
+
{"version":3,"file":"price-list-rule.js","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,8DAAoC;AAEpC,MAAM,aAAa,GAAG,aAAK;KACxB,MAAM,CAAC,eAAe,EAAE;IACvB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE;IACvB,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,oBAAS,EAAE;QAC3C,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;CACH,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,eAAe,CAAC;QACrB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,WAAW,CAAC;QACjB,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC,CAAA;AAEJ,kBAAe,aAAa,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAGtE,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"price-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAGtE,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA6BX,CAAA;AAEJ,eAAe,SAAS,CAAA"}
|
@@ -22,6 +22,18 @@ const PriceRule = utils_1.model
|
|
22
22
|
where: "deleted_at IS NULL",
|
23
23
|
unique: true,
|
24
24
|
},
|
25
|
+
{
|
26
|
+
on: ["attribute"],
|
27
|
+
where: "deleted_at IS NULL",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
on: ["attribute", "value"],
|
31
|
+
where: "deleted_at IS NULL",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
on: ["operator", "value"],
|
35
|
+
where: "deleted_at IS NULL",
|
36
|
+
},
|
25
37
|
]);
|
26
38
|
exports.default = PriceRule;
|
27
39
|
//# sourceMappingURL=price-rule.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-rule.js","sourceRoot":"","sources":["../../src/models/price-rule.ts"],"names":[],"mappings":";;;;;AAAA,qDAAsE;AACtE,oDAA2B;AAE3B,MAAM,SAAS,GAAG,aAAK;KACpB,MAAM,CAAC,WAAW,EAAE;IACnB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE;IACvB,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;IACnB,QAAQ,EAAE,aAAK,CAAC,IAAI,CAAC,2BAAmB,CAAC,CAAC,OAAO,CAAC,2BAAmB,CAAC,EAAE,CAAC;IACzE,QAAQ,EAAE,aAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,KAAK,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,eAAK,EAAE;QAClC,QAAQ,EAAE,aAAa;KACxB,CAAC;CACH,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC;QACzC,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAA;AAEJ,kBAAe,SAAS,CAAA"}
|
1
|
+
{"version":3,"file":"price-rule.js","sourceRoot":"","sources":["../../src/models/price-rule.ts"],"names":[],"mappings":";;;;;AAAA,qDAAsE;AACtE,oDAA2B;AAE3B,MAAM,SAAS,GAAG,aAAK;KACpB,MAAM,CAAC,WAAW,EAAE;IACnB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE;IACvB,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;IACnB,QAAQ,EAAE,aAAK,CAAC,IAAI,CAAC,2BAAmB,CAAC,CAAC,OAAO,CAAC,2BAAmB,CAAC,EAAE,CAAC;IACzE,QAAQ,EAAE,aAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,KAAK,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,eAAK,EAAE;QAClC,QAAQ,EAAE,aAAa;KACxB,CAAC;CACH,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC;QACzC,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,IAAI;KACb;IACD;QACE,EAAE,EAAE,CAAC,WAAW,CAAC;QACjB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;QAC1B,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;QACzB,KAAK,EAAE,oBAAoB;KAC5B;CACF,CAAC,CAAA;AAEJ,kBAAe,SAAS,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,
|
1
|
+
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAEb,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,cAAc,EACd,wBAAwB,EACzB,MAAM,2BAA2B,CAAA;AAKlC,qBAAa,iBACX,SAAQ,YACR,YAAW,wBAAwB;;IAQ7B,eAAe,CACnB,cAAc,EAAE,cAAc,EAC9B,cAAc,GAAE,cAAgC,EAChD,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAgPpC"}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PricingRepository = void 0;
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
// Simple cache implementation
|
5
6
|
class PricingRepository extends utils_1.MikroOrmBase {
|
6
7
|
constructor() {
|
7
8
|
// @ts-ignore
|
@@ -12,197 +13,208 @@ class PricingRepository extends utils_1.MikroOrmBase {
|
|
12
13
|
const manager = this.getActiveManager(sharedContext);
|
13
14
|
const knex = manager.getKnex();
|
14
15
|
const context = pricingContext.context || {};
|
15
|
-
//
|
16
|
-
// We should potentially think of reserved words in pricingContext that can't be used in rules
|
17
|
-
// or have a separate pricing options that accept things like quantity, price_list_id and other
|
18
|
-
// pricing module features
|
16
|
+
// Extract quantity and currency from context
|
19
17
|
const quantity = context.quantity;
|
20
18
|
delete context.quantity;
|
21
|
-
// Currency code
|
19
|
+
// Currency code is required
|
22
20
|
const currencyCode = context.currency_code;
|
23
21
|
delete context.currency_code;
|
24
22
|
if (!currencyCode) {
|
25
23
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Method calculatePrices requires currency_code in the pricing context`);
|
26
24
|
}
|
27
|
-
|
28
|
-
// Only if the context is present do we need to query the database.
|
29
|
-
// We don't get anything from the db otherwise.
|
30
|
-
if (!isContextPresent) {
|
31
|
-
return [];
|
32
|
-
}
|
33
|
-
// We query the rule tables to get all whitelisted rule attributes
|
34
|
-
// This will help cleanup the query and do a db query on only necessary rule attributes.
|
35
|
-
const priceRuleAttributesQuery = knex("price_rule")
|
36
|
-
.distinct("attribute")
|
37
|
-
.pluck("attribute");
|
38
|
-
const priceListRuleAttributesQuery = knex("price_list_rule")
|
39
|
-
.distinct("attribute")
|
40
|
-
.pluck("attribute");
|
41
|
-
const [ruleAttributes, priceListRuleAttributes] = await (0, utils_1.promiseAll)([
|
42
|
-
priceRuleAttributesQuery,
|
43
|
-
priceListRuleAttributesQuery,
|
44
|
-
]);
|
45
|
-
const allowedRuleAttributes = [
|
46
|
-
...ruleAttributes,
|
47
|
-
...priceListRuleAttributes,
|
48
|
-
];
|
25
|
+
// Generate flatten key-value pairs for rule matching
|
49
26
|
const flattenedKeyValuePairs = (0, utils_1.flattenObjectToKeyValuePairs)(context);
|
50
|
-
|
27
|
+
// First filter by value presence
|
28
|
+
const candidateContext = Object.entries(flattenedKeyValuePairs).filter(([, value]) => {
|
51
29
|
const isValuePresent = !Array.isArray(value) && (0, utils_1.isPresent)(value);
|
52
30
|
const isArrayPresent = Array.isArray(value) && value.flat(1).length;
|
53
|
-
return
|
54
|
-
(isValuePresent || isArrayPresent));
|
31
|
+
return isValuePresent || isArrayPresent;
|
55
32
|
});
|
56
|
-
//
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
33
|
+
// If we have potential context keys, efficiently check which ones exist in rules
|
34
|
+
const flattenedContext = candidateContext;
|
35
|
+
// if (candidateContext.length > 0) {
|
36
|
+
// const contextKeys = candidateContext.map(([key]) => key)
|
37
|
+
// // Efficient query to check if keys exist in either rule table
|
38
|
+
// // This avoids fetching ALL rule attributes - only checks our specific keys
|
39
|
+
// const existingKeys = await knex
|
40
|
+
// .raw(
|
41
|
+
// `
|
42
|
+
// SELECT DISTINCT attribute
|
43
|
+
// FROM (
|
44
|
+
// SELECT attribute FROM price_rule WHERE attribute IN (${contextKeys
|
45
|
+
// .map(() => "?")
|
46
|
+
// .join(",")})
|
47
|
+
// UNION
|
48
|
+
// SELECT attribute FROM price_list_rule WHERE attribute IN (${contextKeys
|
49
|
+
// .map(() => "?")
|
50
|
+
// .join(",")})
|
51
|
+
// ) AS combined_attributes
|
52
|
+
// `,
|
53
|
+
// [...contextKeys, ...contextKeys]
|
54
|
+
// )
|
55
|
+
// .then((result) => result.rows.map((row) => row.attribute))
|
56
|
+
// // Filter context to only include keys that exist in rules
|
57
|
+
// flattenedContext = candidateContext.filter(([key]) =>
|
58
|
+
// existingKeys.includes(key)
|
59
|
+
// )
|
60
|
+
// }
|
61
|
+
const hasComplexContext = flattenedContext.length > 0;
|
62
|
+
// Base query with efficient index lookups
|
63
|
+
const query = knex
|
61
64
|
.select({
|
62
65
|
id: "price.id",
|
66
|
+
price_set_id: "price.price_set_id",
|
63
67
|
amount: "price.amount",
|
64
68
|
raw_amount: "price.raw_amount",
|
65
69
|
min_quantity: "price.min_quantity",
|
66
70
|
max_quantity: "price.max_quantity",
|
67
71
|
currency_code: "price.currency_code",
|
68
|
-
deleted_at: "price.deleted_at",
|
69
|
-
price_set_id: "price.price_set_id",
|
70
|
-
rules_count: "price.rules_count",
|
71
72
|
price_list_id: "price.price_list_id",
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
})
|
76
|
-
.leftJoin("price_rule as pr", "pr.price_id", "price.id")
|
77
|
-
.leftJoin("price_list as pl", function () {
|
78
|
-
this.on("pl.id", "price.price_list_id").andOn("pl.status", knex.raw("?", [utils_1.PriceListStatus.ACTIVE]));
|
73
|
+
price_list_type: "pl.type",
|
74
|
+
rules_count: "price.rules_count",
|
75
|
+
price_list_rules_count: "pl.rules_count",
|
79
76
|
})
|
80
|
-
.
|
81
|
-
.
|
82
|
-
.
|
83
|
-
.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
.where("
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
.
|
97
|
-
|
98
|
-
|
99
|
-
|
77
|
+
.from("price")
|
78
|
+
.whereIn("price.price_set_id", pricingFilters.id)
|
79
|
+
.andWhere("price.currency_code", currencyCode)
|
80
|
+
.whereNull("price.deleted_at");
|
81
|
+
// Apply quantity filter
|
82
|
+
if (quantity !== undefined) {
|
83
|
+
query.andWhere(function () {
|
84
|
+
this.where(function () {
|
85
|
+
this.where("price.min_quantity", "<=", quantity).andWhere("price.max_quantity", ">=", quantity);
|
86
|
+
}).orWhere(function () {
|
87
|
+
this.whereNull("price.min_quantity").whereNull("price.max_quantity");
|
88
|
+
});
|
89
|
+
});
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
query.andWhere(function () {
|
93
|
+
this.where("price.min_quantity", "<=", 1).orWhereNull("price.min_quantity");
|
94
|
+
});
|
95
|
+
}
|
96
|
+
// Efficient price list join with index usage
|
97
|
+
query.leftJoin("price_list as pl", function () {
|
98
|
+
this.on("pl.id", "=", "price.price_list_id")
|
99
|
+
.andOn("pl.status", "=", knex.raw("?", [utils_1.PriceListStatus.ACTIVE]))
|
100
|
+
.andOn(function () {
|
101
|
+
this.onNull("pl.deleted_at");
|
100
102
|
})
|
101
|
-
.
|
102
|
-
|
103
|
-
.where("pr.operator", "lte")
|
104
|
-
.whereRaw("? <= pr.value::numeric", [value]);
|
103
|
+
.andOn(function () {
|
104
|
+
this.onNull("pl.starts_at").orOn("pl.starts_at", "<=", knex.fn.now());
|
105
105
|
})
|
106
|
-
.
|
107
|
-
|
108
|
-
.where("pr.operator", "eq")
|
109
|
-
.whereRaw("? = pr.value::numeric", [value]);
|
110
|
-
});
|
111
|
-
};
|
112
|
-
priceSubQueryKnex.orWhere((priceBuilder) => {
|
113
|
-
priceBuilder
|
114
|
-
.whereNull("price.price_list_id")
|
115
|
-
.andWhere((withoutPriceListBuilder) => {
|
116
|
-
for (const [key, value] of flattenedContext) {
|
117
|
-
withoutPriceListBuilder.orWhere((orBuilder) => {
|
118
|
-
orBuilder.where("pr.attribute", key);
|
119
|
-
if (typeof value === "number") {
|
120
|
-
buildOperatorQueries(orBuilder, value);
|
121
|
-
}
|
122
|
-
else {
|
123
|
-
const normalizeValue = Array.isArray(value) ? value : [value];
|
124
|
-
orBuilder.whereIn("pr.value", normalizeValue);
|
125
|
-
}
|
126
|
-
});
|
127
|
-
}
|
128
|
-
withoutPriceListBuilder.orWhere("price.rules_count", "=", 0);
|
106
|
+
.andOn(function () {
|
107
|
+
this.onNull("pl.ends_at").orOn("pl.ends_at", ">=", knex.fn.now());
|
129
108
|
});
|
130
109
|
});
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
110
|
+
// OPTIMIZATION: Only add complex rule filtering when necessary
|
111
|
+
if (hasComplexContext) {
|
112
|
+
// For price rules - direct check that ALL rules match
|
113
|
+
const priceRuleConditions = knex.raw(`
|
114
|
+
(
|
115
|
+
price.rules_count = 0 OR
|
116
|
+
(
|
117
|
+
/* Count all matching rules and compare to total rule count */
|
118
|
+
SELECT COUNT(*)
|
119
|
+
FROM price_rule pr
|
120
|
+
WHERE pr.price_id = price.id
|
121
|
+
AND pr.deleted_at IS NULL
|
122
|
+
AND (
|
123
|
+
${flattenedContext
|
124
|
+
.map(([key, value]) => {
|
125
|
+
if (typeof value === "number") {
|
126
|
+
return `
|
127
|
+
(pr.attribute = ? AND (
|
128
|
+
(pr.operator = 'eq' AND pr.value = ?) OR
|
129
|
+
(pr.operator = 'gt' AND ? > pr.value::numeric) OR
|
130
|
+
(pr.operator = 'gte' AND ? >= pr.value::numeric) OR
|
131
|
+
(pr.operator = 'lt' AND ? < pr.value::numeric) OR
|
132
|
+
(pr.operator = 'lte' AND ? <= pr.value::numeric)
|
133
|
+
))
|
134
|
+
`;
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
const normalizeValue = Array.isArray(value)
|
138
|
+
? value
|
139
|
+
: [value];
|
140
|
+
const placeholders = normalizeValue.map(() => "?").join(",");
|
141
|
+
return `(pr.attribute = ? AND pr.value IN (${placeholders}))`;
|
142
|
+
}
|
136
143
|
})
|
137
|
-
.
|
138
|
-
|
144
|
+
.join(" OR ")}
|
145
|
+
)
|
146
|
+
) = (
|
147
|
+
/* Get total rule count */
|
148
|
+
SELECT COUNT(*)
|
149
|
+
FROM price_rule pr
|
150
|
+
WHERE pr.price_id = price.id
|
151
|
+
AND pr.deleted_at IS NULL
|
152
|
+
)
|
153
|
+
)
|
154
|
+
`, flattenedContext.flatMap(([key, value]) => {
|
155
|
+
if (typeof value === "number") {
|
156
|
+
return [key, value.toString(), value, value, value, value];
|
157
|
+
}
|
158
|
+
else {
|
159
|
+
const normalizeValue = Array.isArray(value) ? value : [value];
|
160
|
+
return [key, ...normalizeValue];
|
161
|
+
}
|
162
|
+
}));
|
163
|
+
// For price list rules - direct check that ALL rules match
|
164
|
+
const priceListRuleConditions = knex.raw(`
|
165
|
+
(
|
166
|
+
pl.rules_count = 0 OR
|
167
|
+
(
|
168
|
+
/* Count all matching rules and compare to total rule count */
|
169
|
+
SELECT COUNT(*)
|
170
|
+
FROM price_list_rule plr
|
171
|
+
WHERE plr.price_list_id = pl.id
|
172
|
+
AND plr.deleted_at IS NULL
|
173
|
+
AND (
|
174
|
+
${flattenedContext
|
175
|
+
.map(([key, value]) => {
|
176
|
+
return `(plr.attribute = ? AND plr.value @> ?)`;
|
139
177
|
})
|
140
|
-
.
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
162
|
-
});
|
163
|
-
}
|
164
|
-
contextBuilder.andWhere("price.rules_count", ">", 0);
|
165
|
-
});
|
166
|
-
this.orWhere("price.rules_count", "=", 0);
|
178
|
+
.join(" OR ")}
|
179
|
+
)
|
180
|
+
) = (
|
181
|
+
/* Get total rule count */
|
182
|
+
SELECT COUNT(*)
|
183
|
+
FROM price_list_rule plr
|
184
|
+
WHERE plr.price_list_id = pl.id
|
185
|
+
AND plr.deleted_at IS NULL
|
186
|
+
)
|
187
|
+
)
|
188
|
+
`, flattenedContext.flatMap(([key, value]) => {
|
189
|
+
return [key, JSON.stringify(Array.isArray(value) ? value : [value])];
|
190
|
+
}));
|
191
|
+
query.where((qb) => {
|
192
|
+
qb.whereNull("price.price_list_id")
|
193
|
+
.andWhereRaw(priceRuleConditions)
|
194
|
+
.orWhere((qb2) => {
|
195
|
+
qb2
|
196
|
+
.whereNotNull("price.price_list_id")
|
197
|
+
.whereRaw(priceListRuleConditions)
|
198
|
+
.andWhereRaw(priceRuleConditions);
|
167
199
|
});
|
168
200
|
});
|
169
|
-
});
|
170
|
-
const priceSetQueryKnex = knex({
|
171
|
-
ps: "price_set",
|
172
|
-
})
|
173
|
-
.select({
|
174
|
-
id: "price.id",
|
175
|
-
price_set_id: "ps.id",
|
176
|
-
amount: "price.amount",
|
177
|
-
raw_amount: "price.raw_amount",
|
178
|
-
min_quantity: "price.min_quantity",
|
179
|
-
max_quantity: "price.max_quantity",
|
180
|
-
currency_code: "price.currency_code",
|
181
|
-
rules_count: "price.rules_count",
|
182
|
-
pl_rules_count: "price.pl_rules_count",
|
183
|
-
price_list_type: "price.pl_type",
|
184
|
-
price_list_id: "price.price_list_id",
|
185
|
-
all_rules_count: knex.raw("COALESCE(price.rules_count, 0) + COALESCE(price.pl_rules_count, 0)"),
|
186
|
-
})
|
187
|
-
.join(priceSubQueryKnex.as("price"), "price.price_set_id", "ps.id")
|
188
|
-
.whereIn("ps.id", pricingFilters.id)
|
189
|
-
.andWhere("price.currency_code", "=", currencyCode)
|
190
|
-
.whereNull("price.deleted_at")
|
191
|
-
.orderBy([
|
192
|
-
{ column: "price.has_price_list", order: "asc" },
|
193
|
-
{ column: "all_rules_count", order: "desc" },
|
194
|
-
{ column: "amount", order: "asc" },
|
195
|
-
]);
|
196
|
-
if (quantity) {
|
197
|
-
priceSetQueryKnex.where("price.min_quantity", "<=", quantity);
|
198
|
-
priceSetQueryKnex.andWhere("price.max_quantity", ">=", quantity);
|
199
201
|
}
|
200
202
|
else {
|
201
|
-
|
202
|
-
|
203
|
+
// Simple case - just get prices with no rules or price lists with no rules
|
204
|
+
query.where(function () {
|
205
|
+
this.where("price.rules_count", 0).orWhere(function () {
|
206
|
+
this.whereNotNull("price.price_list_id").where("pl.rules_count", 0);
|
207
|
+
});
|
203
208
|
});
|
204
209
|
}
|
205
|
-
|
210
|
+
// Optimized ordering to help query planner and preserve price list precedence
|
211
|
+
query
|
212
|
+
.orderByRaw("price.price_list_id IS NOT NULL DESC")
|
213
|
+
.orderByRaw("price.rules_count + COALESCE(pl.rules_count, 0) DESC") // More specific rules first
|
214
|
+
.orderBy("pl.id", "asc") // Order by price list ID to ensure first created price list takes precedence
|
215
|
+
.orderBy("price.amount", "asc"); // For non-price list prices, cheaper ones first
|
216
|
+
// Execute the optimized query
|
217
|
+
return await query;
|
206
218
|
}
|
207
219
|
}
|
208
220
|
exports.PricingRepository = PricingRepository;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":";;;AAAA,qDAMkC;AAWlC,8BAA8B;AAE9B,MAAa,iBACX,SAAQ,oBAAY;IAGpB;QACE,aAAa;QACb,8CAA8C;QAC9C,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,cAA8B,EAC9B,iBAAiC,EAAE,OAAO,EAAE,EAAE,EAAE,EAChD,gBAAyB,EAAE;QAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAmB,aAAa,CAAC,CAAA;QACtE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAA;QAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,EAAE,CAAA;QAE5C,6CAA6C;QAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QACjC,OAAO,OAAO,CAAC,QAAQ,CAAA;QAEvB,4BAA4B;QAC5B,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAA;QAC1C,OAAO,OAAO,CAAC,aAAa,CAAA;QAE5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sEAAsE,CACvE,CAAA;QACH,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N,2EAA2E;YAC3E,KAAK,CAAC,KAAK,CAAC;gBACV,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;oBAGzC,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAA;gBACrE,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,8EAA8E;QAC9E,KAAK;aACF,UAAU,CAAC,sCAAsC,CAAC;aAClD,UAAU,CAAC,sDAAsD,CAAC,CAAC,4BAA4B;aAC/F,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,6EAA6E;aACrG,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA,CAAC,gDAAgD;QAElF,8BAA8B;QAC9B,OAAO,MAAM,KAAK,CAAA;IACpB,CAAC;CACF;AA9PD,8CA8PC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["../src/index.ts","../src/joiner-config.ts","../src/migrations/Migration20230929122253.ts","../src/migrations/Migration20240322094407.ts","../src/migrations/Migration20240322113359.ts","../src/migrations/Migration20240322120125.ts","../src/migrations/Migration20240626133555.ts","../src/migrations/Migration20240704094505.ts","../src/migrations/Migration20241127114534.ts","../src/migrations/Migration20241127223829.ts","../src/migrations/Migration20241128055359.ts","../src/migrations/Migration20241212190401.ts","../src/models/index.ts","../src/models/price-list-rule.ts","../src/models/price-list.ts","../src/models/price-preference.ts","../src/models/price-rule.ts","../src/models/price-set.ts","../src/models/price.ts","../src/repositories/index.ts","../src/repositories/pricing.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/pricing-module.ts","../src/services/__tests__/index.spec.ts","../src/types/index.ts","../src/types/services/index.ts","../src/utils/events.ts","../src/utils/index.ts","../src/utils/validate-price-list-dates.ts"],"version":"5.6.2"}
|
1
|
+
{"root":["../src/index.ts","../src/joiner-config.ts","../src/migrations/Migration20230929122253.ts","../src/migrations/Migration20240322094407.ts","../src/migrations/Migration20240322113359.ts","../src/migrations/Migration20240322120125.ts","../src/migrations/Migration20240626133555.ts","../src/migrations/Migration20240704094505.ts","../src/migrations/Migration20241127114534.ts","../src/migrations/Migration20241127223829.ts","../src/migrations/Migration20241128055359.ts","../src/migrations/Migration20241212190401.ts","../src/migrations/Migration20250408145122.ts","../src/migrations/Migration20250409122219.ts","../src/models/index.ts","../src/models/price-list-rule.ts","../src/models/price-list.ts","../src/models/price-preference.ts","../src/models/price-rule.ts","../src/models/price-set.ts","../src/models/price.ts","../src/repositories/index.ts","../src/repositories/pricing.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/pricing-module.ts","../src/services/__tests__/index.spec.ts","../src/types/index.ts","../src/types/services/index.ts","../src/utils/events.ts","../src/utils/index.ts","../src/utils/validate-price-list-dates.ts"],"version":"5.6.2"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/pricing",
|
3
|
-
"version": "3.0.0-snapshot-
|
3
|
+
"version": "3.0.0-snapshot-20250409125618",
|
4
4
|
"description": "Medusa Pricing module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -36,8 +36,8 @@
|
|
36
36
|
"orm:cache:clear": " MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts medusa-mikro-orm cache:clear"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@medusajs/framework": "3.0.0-snapshot-
|
40
|
-
"@medusajs/test-utils": "3.0.0-snapshot-
|
39
|
+
"@medusajs/framework": "3.0.0-snapshot-20250409125618",
|
40
|
+
"@medusajs/test-utils": "3.0.0-snapshot-20250409125618",
|
41
41
|
"@mikro-orm/cli": "6.4.3",
|
42
42
|
"@mikro-orm/core": "6.4.3",
|
43
43
|
"@mikro-orm/migrations": "6.4.3",
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"typescript": "^5.6.2"
|
51
51
|
},
|
52
52
|
"peerDependencies": {
|
53
|
-
"@medusajs/framework": "3.0.0-snapshot-
|
53
|
+
"@medusajs/framework": "3.0.0-snapshot-20250409125618",
|
54
54
|
"@mikro-orm/core": "6.4.3",
|
55
55
|
"@mikro-orm/migrations": "6.4.3",
|
56
56
|
"@mikro-orm/postgresql": "6.4.3",
|