@medusajs/pricing 0.1.13-snapshot-20240712092102 → 0.1.13-snapshot-20240715110246

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAmB,MAAM,iBAAiB,CAAA;AAE5E,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,cAAc,EACd,wBAAwB,EACzB,MAAM,iBAAiB,CAAA;AAGxB,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;CAmKpC"}
1
+ {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/repositories/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAmB,MAAM,iBAAiB,CAAA;AAE5E,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,cAAc,EACd,wBAAwB,EACzB,MAAM,iBAAiB,CAAA;AAGxB,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;CAqKpC"}
@@ -39,6 +39,7 @@ class PricingRepository extends utils_1.MikroOrmBase {
39
39
  .select({
40
40
  id: "price.id",
41
41
  amount: "price.amount",
42
+ raw_amount: "price.raw_amount",
42
43
  min_quantity: "price.min_quantity",
43
44
  max_quantity: "price.max_quantity",
44
45
  currency_code: "price.currency_code",
@@ -106,6 +107,7 @@ class PricingRepository extends utils_1.MikroOrmBase {
106
107
  id: "price.id",
107
108
  price_set_id: "ps.id",
108
109
  amount: "price.amount",
110
+ raw_amount: "price.raw_amount",
109
111
  min_quantity: "price.min_quantity",
110
112
  max_quantity: "price.max_quantity",
111
113
  currency_code: "price.currency_code",
@@ -1,5 +1,5 @@
1
1
  import { AddPricesDTO, Context, CreatePriceRuleDTO, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, PricePreferenceDTO, PriceSetDTO, PricingContext, PricingFilters, PricingRepositoryService, PricingTypes, UpsertPricePreferenceDTO, UpsertPriceSetDTO } from "@medusajs/types";
2
- import { Price, PriceList, PriceListRule, PriceRule, PriceSet, PricePreference } from "../models";
2
+ import { Price, PriceList, PriceListRule, PricePreference, PriceRule, PriceSet } from "../models";
3
3
  import { ServiceTypes } from "../types";
4
4
  import { CreatePriceListDTO } from "src/types/services";
5
5
  type InjectedDependencies = {
@@ -75,6 +75,8 @@ export default class PricingModuleService extends PricingModuleService_base impl
75
75
  upsertPricePreferences(data: UpsertPricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO>;
76
76
  updatePricePreferences(id: string, data: PricingTypes.UpdatePricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO>;
77
77
  updatePricePreferences(selector: PricingTypes.FilterablePricePreferenceProps, data: PricingTypes.UpdatePricePreferenceDTO, sharedContext?: Context): Promise<PricePreferenceDTO[]>;
78
+ protected createPricePreferences_(data: PricingTypes.CreatePricePreferenceDTO[], sharedContext?: Context): Promise<PricePreference[]>;
79
+ protected updatePricePreferences_(data: PricingTypes.UpdatePricePreferenceDTO[], sharedContext?: Context): Promise<PricePreference[]>;
78
80
  protected createPriceSets_(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSet[]>;
79
81
  protected addPrices_(input: AddPricesDTO[], sharedContext?: Context): Promise<Price[]>;
80
82
  protected createPriceLists_(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"pricing-module.d.ts","sourceRoot":"","sources":["../../src/services/pricing-module.ts"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GAAE,OAAY,GAC1B,OAAO,CAAC,IAAI,CAAC;cAKA,mBAAmB,CACjC,IAAI,EAAE,YAAY,CAAC,qBAAqB,EAAE,EAC1C,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,KAAK,EAAE,CAAC;cAuEH,kBAAkB,CAChC,IAAI,EAAE,YAAY,CAAC,oBAAoB,EAAE,EACzC,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,SAAS,EAAE,CAAC;cA2DP,qBAAqB,CACnC,IAAI,EAAE,YAAY,CAAC,uBAAuB,EAAE,EAC5C,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,SAAS,EAAE,CAAC;IA4DvB,SAAS,CAAC,sBAAsB,CAC9B,IAAI,EAAE,CACF,YAAY,CAAC,kBAAkB,GAC/B,YAAY,CAAC,kBAAkB,GAC/B,kBAAkB,CACrB,EAAE;IAiBL,SAAS,CAAC,uBAAuB,CAC/B,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,SAAS;;;;;;;;;;;;CAS3D"}
@@ -145,12 +145,14 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
145
145
  id: priceSetId,
146
146
  is_calculated_price_price_list: !!calculatedPrice?.price_list_id,
147
147
  is_calculated_price_tax_inclusive: isTaxInclusive(priceRulesPriceMap.get(calculatedPrice.id), pricingPreferences, calculatedPrice.currency_code, pricingContext.context?.region_id),
148
- calculated_amount: parseInt(calculatedPrice?.amount || "") || null,
148
+ calculated_amount: parseFloat(calculatedPrice?.amount || "") || null,
149
+ raw_calculated_amount: calculatedPrice?.raw_amount || null,
149
150
  is_original_price_price_list: !!originalPrice?.price_list_id,
150
151
  is_original_price_tax_inclusive: originalPrice?.id
151
152
  ? isTaxInclusive(priceRulesPriceMap.get(originalPrice.id), pricingPreferences, originalPrice.currency_code || calculatedPrice.currency_code, pricingContext.context?.region_id)
152
153
  : false,
153
- original_amount: parseInt(originalPrice?.amount || "") || null,
154
+ original_amount: parseFloat(originalPrice?.amount || "") || null,
155
+ raw_original_amount: originalPrice?.raw_amount || null,
154
156
  currency_code: calculatedPrice?.currency_code || null,
155
157
  calculated_price: {
156
158
  id: calculatedPrice?.id || null,
@@ -320,7 +322,8 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
320
322
  return await this.baseRepository_.serialize(priceList);
321
323
  }
322
324
  async createPricePreferences(data, sharedContext = {}) {
323
- const preferences = await this.pricePreferenceService_.create(data, sharedContext);
325
+ const normalized = Array.isArray(data) ? data : [data];
326
+ const preferences = await this.createPricePreferences_(normalized, sharedContext);
324
327
  const serialized = await this.baseRepository_.serialize(preferences);
325
328
  return Array.isArray(data) ? serialized : serialized[0];
326
329
  }
@@ -330,10 +333,10 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
330
333
  const forCreate = input.filter((pricePreference) => !pricePreference.id);
331
334
  const operations = [];
332
335
  if (forCreate.length) {
333
- operations.push(this.pricePreferenceService_.create(forCreate, sharedContext));
336
+ operations.push(this.createPricePreferences_(forCreate, sharedContext));
334
337
  }
335
338
  if (forUpdate.length) {
336
- operations.push(this.pricePreferenceService_.update(forUpdate, sharedContext));
339
+ operations.push(this.updatePricePreferences_(forUpdate, sharedContext));
337
340
  }
338
341
  const result = (await (0, utils_1.promiseAll)(operations)).flat();
339
342
  return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
@@ -352,10 +355,21 @@ class PricingModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
352
355
  ...data,
353
356
  }));
354
357
  }
355
- const updateResult = await this.pricePreferenceService_.update(normalizedInput, sharedContext);
358
+ const updateResult = await this.updatePricePreferences_(normalizedInput, sharedContext);
356
359
  const pricePreferences = await this.baseRepository_.serialize(updateResult);
357
360
  return (0, utils_1.isString)(idOrSelector) ? pricePreferences[0] : pricePreferences;
358
361
  }
362
+ async createPricePreferences_(data, sharedContext = {}) {
363
+ const preferences = await this.pricePreferenceService_.create(data.map((d) => ({
364
+ ...d,
365
+ is_tax_inclusive: d.is_tax_inclusive ?? false,
366
+ })), sharedContext);
367
+ return preferences;
368
+ }
369
+ async updatePricePreferences_(data, sharedContext = {}) {
370
+ const preferences = await this.pricePreferenceService_.update(data, sharedContext);
371
+ return preferences;
372
+ }
359
373
  async createPriceSets_(data, sharedContext = {}) {
360
374
  const input = Array.isArray(data) ? data : [data];
361
375
  const toCreate = input.map((inputData) => {
@@ -877,6 +891,20 @@ __decorate([
877
891
  __metadata("design:paramtypes", [Object, Object, Object]),
878
892
  __metadata("design:returntype", Promise)
879
893
  ], PricingModuleService.prototype, "updatePricePreferences", null);
894
+ __decorate([
895
+ (0, utils_1.InjectTransactionManager)("baseRepository_"),
896
+ __param(1, (0, utils_1.MedusaContext)()),
897
+ __metadata("design:type", Function),
898
+ __metadata("design:paramtypes", [Array, Object]),
899
+ __metadata("design:returntype", Promise)
900
+ ], PricingModuleService.prototype, "createPricePreferences_", null);
901
+ __decorate([
902
+ (0, utils_1.InjectTransactionManager)("baseRepository_"),
903
+ __param(1, (0, utils_1.MedusaContext)()),
904
+ __metadata("design:type", Function),
905
+ __metadata("design:paramtypes", [Array, Object]),
906
+ __metadata("design:returntype", Promise)
907
+ ], PricingModuleService.prototype, "updatePricePreferences_", null);
880
908
  __decorate([
881
909
  (0, utils_1.InjectTransactionManager)("baseRepository_"),
882
910
  __param(1, (0, utils_1.MedusaContext)()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/pricing",
3
- "version": "0.1.13-snapshot-20240712092102",
3
+ "version": "0.1.13-snapshot-20240715110246",
4
4
  "description": "Medusa Pricing module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,11 +34,11 @@
34
34
  "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
35
35
  },
36
36
  "devDependencies": {
37
- "@medusajs/types": "1.12.0-snapshot-20240712092102",
37
+ "@medusajs/types": "1.12.0-snapshot-20240715110246",
38
38
  "@mikro-orm/cli": "5.9.7",
39
39
  "cross-env": "^5.2.1",
40
40
  "jest": "^29.7.0",
41
- "medusa-test-utils": "1.1.45-snapshot-20240712092102",
41
+ "medusa-test-utils": "1.1.45-snapshot-20240715110246",
42
42
  "rimraf": "^3.0.2",
43
43
  "ts-jest": "^29.1.1",
44
44
  "ts-node": "^10.9.1",
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.1.6"
47
47
  },
48
48
  "dependencies": {
49
- "@medusajs/utils": "1.12.0-snapshot-20240712092102",
49
+ "@medusajs/utils": "1.12.0-snapshot-20240715110246",
50
50
  "@mikro-orm/core": "5.9.7",
51
51
  "@mikro-orm/migrations": "5.9.7",
52
52
  "@mikro-orm/postgresql": "5.9.7",