@medusajs/tax 0.1.2 → 1.0.0-rc-20241001083650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/dist/index.d.ts +6 -7
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +9 -24
  4. package/dist/index.js.map +1 -0
  5. package/dist/loaders/providers.d.ts +2 -2
  6. package/dist/loaders/providers.d.ts.map +1 -0
  7. package/dist/loaders/providers.js +2 -1
  8. package/dist/loaders/providers.js.map +1 -0
  9. package/dist/migrations/Migration20240227090331.d.ts +1 -0
  10. package/dist/migrations/Migration20240227090331.d.ts.map +1 -0
  11. package/dist/migrations/Migration20240227090331.js +2 -1
  12. package/dist/migrations/Migration20240227090331.js.map +1 -0
  13. package/dist/migrations/Migration20240710135844.d.ts +6 -0
  14. package/dist/migrations/Migration20240710135844.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240710135844.js +18 -0
  16. package/dist/migrations/Migration20240710135844.js.map +1 -0
  17. package/dist/migrations/Migration20240924114005.d.ts +6 -0
  18. package/dist/migrations/Migration20240924114005.d.ts.map +1 -0
  19. package/dist/migrations/Migration20240924114005.js +15 -0
  20. package/dist/migrations/Migration20240924114005.js.map +1 -0
  21. package/dist/models/index.d.ts +1 -0
  22. package/dist/models/index.d.ts.map +1 -0
  23. package/dist/models/index.js +1 -0
  24. package/dist/models/index.js.map +1 -0
  25. package/dist/models/tax-provider.d.ts +1 -0
  26. package/dist/models/tax-provider.d.ts.map +1 -0
  27. package/dist/models/tax-provider.js +1 -0
  28. package/dist/models/tax-provider.js.map +1 -0
  29. package/dist/models/tax-rate-rule.d.ts +5 -4
  30. package/dist/models/tax-rate-rule.d.ts.map +1 -0
  31. package/dist/models/tax-rate-rule.js +9 -7
  32. package/dist/models/tax-rate-rule.js.map +1 -0
  33. package/dist/models/tax-rate.d.ts +6 -5
  34. package/dist/models/tax-rate.d.ts.map +1 -0
  35. package/dist/models/tax-rate.js +13 -12
  36. package/dist/models/tax-rate.js.map +1 -0
  37. package/dist/models/tax-region.d.ts +7 -5
  38. package/dist/models/tax-region.d.ts.map +1 -0
  39. package/dist/models/tax-region.js +21 -9
  40. package/dist/models/tax-region.js.map +1 -0
  41. package/dist/providers/index.d.ts +1 -0
  42. package/dist/providers/index.d.ts.map +1 -0
  43. package/dist/providers/index.js +1 -0
  44. package/dist/providers/index.js.map +1 -0
  45. package/dist/providers/system.d.ts +2 -1
  46. package/dist/providers/system.d.ts.map +1 -0
  47. package/dist/providers/system.js +1 -0
  48. package/dist/providers/system.js.map +1 -0
  49. package/dist/services/index.d.ts +1 -0
  50. package/dist/services/index.d.ts.map +1 -0
  51. package/dist/services/index.js +1 -0
  52. package/dist/services/index.js.map +1 -0
  53. package/dist/services/tax-module-service.d.ts +27 -24
  54. package/dist/services/tax-module-service.d.ts.map +1 -0
  55. package/dist/services/tax-module-service.js +32 -35
  56. package/dist/services/tax-module-service.js.map +1 -0
  57. package/dist/tsconfig.tsbuildinfo +1 -0
  58. package/package.json +20 -21
  59. package/dist/joiner-config.d.ts +0 -5
  60. package/dist/joiner-config.js +0 -54
  61. package/dist/module-definition.d.ts +0 -2
  62. package/dist/module-definition.js +0 -61
  63. package/dist/scripts/bin/run-seed.d.ts +0 -3
  64. package/dist/scripts/bin/run-seed.js +0 -48
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA"}
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TaxModuleService = void 0;
7
7
  var tax_module_service_1 = require("./tax-module-service");
8
8
  Object.defineProperty(exports, "TaxModuleService", { enumerable: true, get: function () { return __importDefault(tax_module_service_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAkE;AAAzD,uIAAA,OAAO,OAAoB"}
@@ -1,15 +1,18 @@
1
- import { Context, DAL, ITaxModuleService, ITaxProvider, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, TaxRegionDTO, TaxTypes } from "@medusajs/types";
2
- import { ModulesSdkUtils } from "@medusajs/utils";
1
+ import { Context, DAL, InternalModuleDeclaration, ITaxModuleService, ITaxProvider, ModulesSdkTypes, TaxRegionDTO, TaxTypes } from "@medusajs/framework/types";
2
+ import { ModulesSdkUtils } from "@medusajs/framework/utils";
3
3
  import { TaxProvider, TaxRate, TaxRateRule, TaxRegion } from "../models";
4
4
  type InjectedDependencies = {
5
5
  baseRepository: DAL.RepositoryService;
6
- taxRateService: ModulesSdkTypes.InternalModuleService<any>;
7
- taxRegionService: ModulesSdkTypes.InternalModuleService<any>;
8
- taxRateRuleService: ModulesSdkTypes.InternalModuleService<any>;
9
- taxProviderService: ModulesSdkTypes.InternalModuleService<any>;
6
+ taxRateService: ModulesSdkTypes.IMedusaInternalService<any>;
7
+ taxRegionService: ModulesSdkTypes.IMedusaInternalService<any>;
8
+ taxRateRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
9
+ taxProviderService: ModulesSdkTypes.IMedusaInternalService<any>;
10
10
  [key: `tp_${string}`]: ITaxProvider;
11
11
  };
12
- declare const TaxModuleService_base: new (container: InjectedDependencies) => ModulesSdkUtils.AbstractModuleService<InjectedDependencies, TaxTypes.TaxRateDTO, {
12
+ declare const TaxModuleService_base: ModulesSdkUtils.MedusaServiceReturnType<{
13
+ TaxRate: {
14
+ dto: TaxTypes.TaxRateDTO;
15
+ };
13
16
  TaxRegion: {
14
17
  dto: TaxTypes.TaxRegionDTO;
15
18
  };
@@ -20,27 +23,26 @@ declare const TaxModuleService_base: new (container: InjectedDependencies) => Mo
20
23
  dto: TaxTypes.TaxProviderDTO;
21
24
  };
22
25
  }>;
23
- export default class TaxModuleService<TTaxRate extends TaxRate = TaxRate, TTaxRegion extends TaxRegion = TaxRegion, TTaxRateRule extends TaxRateRule = TaxRateRule, TTaxProvider extends TaxProvider = TaxProvider> extends TaxModuleService_base implements ITaxModuleService {
26
+ export default class TaxModuleService extends TaxModuleService_base implements ITaxModuleService {
24
27
  protected readonly moduleDeclaration: InternalModuleDeclaration;
25
28
  protected readonly container_: InjectedDependencies;
26
29
  protected baseRepository_: DAL.RepositoryService;
27
- protected taxRateService_: ModulesSdkTypes.InternalModuleService<TTaxRate>;
28
- protected taxRegionService_: ModulesSdkTypes.InternalModuleService<TTaxRegion>;
29
- protected taxRateRuleService_: ModulesSdkTypes.InternalModuleService<TTaxRateRule>;
30
- protected taxProviderService_: ModulesSdkTypes.InternalModuleService<TTaxProvider>;
30
+ protected taxRateService_: ModulesSdkTypes.IMedusaInternalService<TaxRate>;
31
+ protected taxRegionService_: ModulesSdkTypes.IMedusaInternalService<TaxRegion>;
32
+ protected taxRateRuleService_: ModulesSdkTypes.IMedusaInternalService<TaxRateRule>;
33
+ protected taxProviderService_: ModulesSdkTypes.IMedusaInternalService<TaxProvider>;
31
34
  constructor({ baseRepository, taxRateService, taxRegionService, taxRateRuleService, taxProviderService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
32
- __joinerConfig(): ModuleJoinerConfig;
33
- create(data: TaxTypes.CreateTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
34
- create(data: TaxTypes.CreateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
35
- protected create_(data: TaxTypes.CreateTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
36
- update(id: string, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
37
- update(ids: string[], data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
38
- update(selector: TaxTypes.FilterableTaxRateProps, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
39
- protected update_(idOrSelector: string | string[] | TaxTypes.FilterableTaxRateProps, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TTaxRate>;
35
+ createTaxRates(data: TaxTypes.CreateTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
36
+ createTaxRates(data: TaxTypes.CreateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
37
+ protected createTaxRates_(data: TaxTypes.CreateTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
38
+ updateTaxRates(id: string, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
39
+ updateTaxRates(ids: string[], data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
40
+ updateTaxRates(selector: TaxTypes.FilterableTaxRateProps, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
41
+ protected updateTaxRates_(idOrSelector: string | string[] | TaxTypes.FilterableTaxRateProps, data: TaxTypes.UpdateTaxRateDTO, sharedContext?: Context): Promise<TaxRate>;
40
42
  private setTaxRateRulesForTaxRates;
41
43
  private getTaxRateIdsFromSelector;
42
- upsert(data: TaxTypes.UpsertTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
43
- upsert(data: TaxTypes.UpsertTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
44
+ upsertTaxRates(data: TaxTypes.UpsertTaxRateDTO[], sharedContext?: Context): Promise<TaxTypes.TaxRateDTO[]>;
45
+ upsertTaxRates(data: TaxTypes.UpsertTaxRateDTO, sharedContext?: Context): Promise<TaxTypes.TaxRateDTO>;
44
46
  createTaxRegions(data: TaxTypes.CreateTaxRegionDTO, sharedContext?: Context): Promise<TaxRegionDTO>;
45
47
  createTaxRegions(data: TaxTypes.CreateTaxRegionDTO[], sharedContext?: Context): Promise<TaxRegionDTO[]>;
46
48
  createTaxRegions_(data: TaxTypes.CreateTaxRegionDTO[], sharedContext?: Context): Promise<TaxRegionDTO[]>;
@@ -52,10 +54,11 @@ export default class TaxModuleService<TTaxRate extends TaxRate = TaxRate, TTaxRe
52
54
  private normalizeTaxCalculationContext;
53
55
  private prepareTaxRegionInputForCreate;
54
56
  private verifyProvinceToCountryMatch;
55
- private getTaxRatesForItem;
56
- private getTaxRateQueryForItem;
57
+ private geTaxRatesForItem;
58
+ private geTaxRateQueryForItem;
57
59
  private checkRuleMatches;
58
60
  private prioritizeRates;
59
61
  private normalizeRegionCodes;
60
62
  }
61
63
  export {};
64
+ //# sourceMappingURL=tax-module-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-module-service.d.ts","sourceRoot":"","sources":["../../src/services/tax-module-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,QAAQ,EACT,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAOL,eAAe,EAEhB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEtE,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,cAAc,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC3D,gBAAgB,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC7D,kBAAkB,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC/D,kBAAkB,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC/D,CAAC,GAAG,EAAE,MAAM,MAAM,EAAE,GAAG,YAAY,CAAA;CACpC,CAA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CAAC,kBAAkB,EAAE,EACnC,aAAa,GAAE,OAAY;IAmC7B,kBAAkB,CAChB,IAAI,EAAE,QAAQ,CAAC,oBAAoB,EACnC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IACnC,kBAAkB,CAChB,IAAI,EAAE,QAAQ,CAAC,oBAAoB,EAAE,EACrC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;IAa/B,mBAAmB,CACvB,IAAI,EAAE,QAAQ,CAAC,oBAAoB,EAAE,EACpB,aAAa,GAAE,OAAY;IAYxC,WAAW,CACf,KAAK,EAAE,CAAC,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAChE,kBAAkB,EAAE,QAAQ,CAAC,qBAAqB,EACjC,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YA0DvD,uBAAuB;IA8CrC,OAAO,CAAC,8BAA8B;IAetC,OAAO,CAAC,8BAA8B;YAmCxB,4BAA4B;YAmC5B,iBAAiB;IAgC/B,OAAO,CAAC,qBAAqB;IA+B7B,OAAO,CAAC,gBAAgB;IAwCxB,OAAO,CAAC,eAAe;IAuCvB,OAAO,CAAC,oBAAoB;CA0B7B"}
@@ -12,12 +12,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const types_1 = require("@medusajs/types");
16
- const utils_1 = require("@medusajs/utils");
15
+ const types_1 = require("@medusajs/framework/types");
16
+ const utils_1 = require("@medusajs/framework/utils");
17
17
  const _models_1 = require("../models");
18
- const joiner_config_1 = require("../joiner-config");
19
- const generateForModels = [_models_1.TaxRegion, _models_1.TaxRateRule, _models_1.TaxProvider];
20
- class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFactory(_models_1.TaxRate, generateForModels, joiner_config_1.entityNameToLinkableKeysMap) {
18
+ const generateForModels = { TaxRate: _models_1.TaxRate, TaxRegion: _models_1.TaxRegion, TaxRateRule: _models_1.TaxRateRule, TaxProvider: _models_1.TaxProvider };
19
+ class TaxModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateForModels) {
21
20
  constructor({ baseRepository, taxRateService, taxRegionService, taxRateRuleService, taxProviderService, }, moduleDeclaration) {
22
21
  // @ts-ignore
23
22
  super(...arguments);
@@ -29,15 +28,12 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
29
28
  this.taxRateRuleService_ = taxRateRuleService;
30
29
  this.taxProviderService_ = taxProviderService;
31
30
  }
32
- __joinerConfig() {
33
- return joiner_config_1.joinerConfig;
34
- }
35
- async create(data, sharedContext = {}) {
31
+ async createTaxRates(data, sharedContext = {}) {
36
32
  const input = Array.isArray(data) ? data : [data];
37
- const rates = await this.create_(input, sharedContext);
33
+ const rates = await this.createTaxRates_(input, sharedContext);
38
34
  return Array.isArray(data) ? rates : rates[0];
39
35
  }
40
- async create_(data, sharedContext = {}) {
36
+ async createTaxRates_(data, sharedContext = {}) {
41
37
  const [rules, rateData] = data.reduce((acc, region) => {
42
38
  const { rules, ...rest } = region;
43
39
  acc[0].push(rules);
@@ -67,12 +63,12 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
67
63
  populate: true,
68
64
  });
69
65
  }
70
- async update(selector, data, sharedContext = {}) {
71
- const rates = await this.update_(selector, data, sharedContext);
66
+ async updateTaxRates(selector, data, sharedContext = {}) {
67
+ const rates = await this.updateTaxRates_(selector, data, sharedContext);
72
68
  const serialized = await this.baseRepository_.serialize(rates, { populate: true });
73
69
  return (0, utils_1.isString)(selector) ? serialized[0] : serialized;
74
70
  }
75
- async update_(idOrSelector, data, sharedContext = {}) {
71
+ async updateTaxRates_(idOrSelector, data, sharedContext = {}) {
76
72
  const selector = Array.isArray(idOrSelector) || (0, utils_1.isString)(idOrSelector)
77
73
  ? { id: idOrSelector }
78
74
  : idOrSelector;
@@ -118,7 +114,7 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
118
114
  const rates = await this.taxRateService_.list(idOrSelector, { select: ["id"] }, sharedContext);
119
115
  return rates.map((r) => r.id);
120
116
  }
121
- async upsert(data, sharedContext = {}) {
117
+ async upsertTaxRates(data, sharedContext = {}) {
122
118
  const result = await this.taxRateService_.upsert(data, sharedContext);
123
119
  const serialized = await this.baseRepository_.serialize(result, { populate: true });
124
120
  return Array.isArray(data) ? serialized : serialized[0];
@@ -144,7 +140,7 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
144
140
  })
145
141
  .filter(Boolean);
146
142
  if (rates.length !== 0) {
147
- await this.create(rates, sharedContext);
143
+ await this.createTaxRates(rates, sharedContext);
148
144
  }
149
145
  return await this.baseRepository_.serialize(regions, { populate: true });
150
146
  }
@@ -175,15 +171,15 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
175
171
  }, {}, sharedContext);
176
172
  const parentRegion = regions.find((r) => r.province_code === null);
177
173
  if (!parentRegion) {
178
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "No parent region found for country");
174
+ return [];
179
175
  }
180
176
  const toReturn = await (0, utils_1.promiseAll)(items.map(async (item) => {
181
177
  const regionIds = regions.map((r) => r.id);
182
- const rateQuery = this.getTaxRateQueryForItem(item, regionIds);
178
+ const rateQuery = this.geTaxRateQueryForItem(item, regionIds);
183
179
  const candidateRates = await this.taxRateService_.list(rateQuery, {
184
180
  relations: ["tax_region", "rules"],
185
181
  }, sharedContext);
186
- const applicableRates = await this.getTaxRatesForItem(item, candidateRates);
182
+ const applicableRates = await this.geTaxRatesForItem(item, candidateRates);
187
183
  return {
188
184
  rates: applicableRates,
189
185
  item,
@@ -274,7 +270,7 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
274
270
  }
275
271
  }
276
272
  }
277
- async getTaxRatesForItem(item, rates) {
273
+ async geTaxRatesForItem(item, rates) {
278
274
  if (!rates.length) {
279
275
  return [];
280
276
  }
@@ -294,7 +290,7 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
294
290
  }
295
291
  return ratesToReturn;
296
292
  }
297
- getTaxRateQueryForItem(item, regionIds) {
293
+ geTaxRateQueryForItem(item, regionIds) {
298
294
  const isShipping = "shipping_option_id" in item;
299
295
  let ruleQuery = isShipping
300
296
  ? [
@@ -386,65 +382,66 @@ class TaxModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFact
386
382
  }
387
383
  exports.default = TaxModuleService;
388
384
  __decorate([
389
- (0, utils_1.InjectManager)("baseRepository_"),
385
+ (0, utils_1.InjectManager)(),
390
386
  __param(1, (0, utils_1.MedusaContext)()),
391
387
  __metadata("design:type", Function),
392
388
  __metadata("design:paramtypes", [Object, Object]),
393
389
  __metadata("design:returntype", Promise)
394
- ], TaxModuleService.prototype, "create", null);
390
+ ], TaxModuleService.prototype, "createTaxRates", null);
395
391
  __decorate([
396
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
392
+ (0, utils_1.InjectTransactionManager)(),
397
393
  __param(1, (0, utils_1.MedusaContext)()),
398
394
  __metadata("design:type", Function),
399
395
  __metadata("design:paramtypes", [Array, Object]),
400
396
  __metadata("design:returntype", Promise)
401
- ], TaxModuleService.prototype, "create_", null);
397
+ ], TaxModuleService.prototype, "createTaxRates_", null);
402
398
  __decorate([
403
- (0, utils_1.InjectManager)("baseRepository_"),
399
+ (0, utils_1.InjectManager)(),
404
400
  __param(2, (0, utils_1.MedusaContext)()),
405
401
  __metadata("design:type", Function),
406
402
  __metadata("design:paramtypes", [Object, Object, Object]),
407
403
  __metadata("design:returntype", Promise)
408
- ], TaxModuleService.prototype, "update", null);
404
+ ], TaxModuleService.prototype, "updateTaxRates", null);
409
405
  __decorate([
410
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
406
+ (0, utils_1.InjectTransactionManager)(),
411
407
  __param(2, (0, utils_1.MedusaContext)()),
412
408
  __metadata("design:type", Function),
413
409
  __metadata("design:paramtypes", [Object, Object, Object]),
414
410
  __metadata("design:returntype", Promise)
415
- ], TaxModuleService.prototype, "update_", null);
411
+ ], TaxModuleService.prototype, "updateTaxRates_", null);
416
412
  __decorate([
417
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
413
+ (0, utils_1.InjectTransactionManager)(),
418
414
  __param(1, (0, utils_1.MedusaContext)()),
419
415
  __metadata("design:type", Function),
420
416
  __metadata("design:paramtypes", [Object, Object]),
421
417
  __metadata("design:returntype", Promise)
422
- ], TaxModuleService.prototype, "upsert", null);
418
+ ], TaxModuleService.prototype, "upsertTaxRates", null);
423
419
  __decorate([
424
- (0, utils_1.InjectManager)("baseRepository_"),
420
+ (0, utils_1.InjectManager)(),
425
421
  __param(1, (0, utils_1.MedusaContext)()),
426
422
  __metadata("design:type", Function),
427
423
  __metadata("design:paramtypes", [Object, Object]),
428
424
  __metadata("design:returntype", Promise)
429
425
  ], TaxModuleService.prototype, "createTaxRegions", null);
430
426
  __decorate([
431
- (0, utils_1.InjectManager)("baseRepository_"),
427
+ (0, utils_1.InjectManager)(),
432
428
  __param(1, (0, utils_1.MedusaContext)()),
433
429
  __metadata("design:type", Function),
434
430
  __metadata("design:paramtypes", [Object, Object]),
435
431
  __metadata("design:returntype", Promise)
436
432
  ], TaxModuleService.prototype, "createTaxRateRules", null);
437
433
  __decorate([
438
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
434
+ (0, utils_1.InjectTransactionManager)(),
439
435
  __param(1, (0, utils_1.MedusaContext)()),
440
436
  __metadata("design:type", Function),
441
437
  __metadata("design:paramtypes", [Array, Object]),
442
438
  __metadata("design:returntype", Promise)
443
439
  ], TaxModuleService.prototype, "createTaxRateRules_", null);
444
440
  __decorate([
445
- (0, utils_1.InjectManager)("baseRepository_"),
441
+ (0, utils_1.InjectManager)(),
446
442
  __param(2, (0, utils_1.MedusaContext)()),
447
443
  __metadata("design:type", Function),
448
444
  __metadata("design:paramtypes", [Array, Object, Object]),
449
445
  __metadata("design:returntype", Promise)
450
446
  ], TaxModuleService.prototype, "getTaxLines", null);
447
+ //# sourceMappingURL=tax-module-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-module-service.js","sourceRoot":"","sources":["../../src/services/tax-module-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDASkC;AAClC,qDASkC;AAClC,qCAAsE;AAWtE,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAP,iBAAO,EAAE,SAAS,EAAT,mBAAS,EAAE,WAAW,EAAX,qBAAW,EAAE,WAAW,EAAX,qBAAW,EAAE,CAAA;AAO1E,MAAqB,gBACnB,SAAQ,uBAAe,CAAC,aAAa,CAKlC,iBAAiB,CAAC;IAUrB,YACE,EACE,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACG,EACJ,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAK/D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;QACzC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC7C,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;IAC/C,CAAC;IAcK,AAAN,KAAK,CAAC,cAAc,CAClB,IAA6D,EAC5C,gBAAyB,EAAE;QAE5C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,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IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;sDAOjB;AAcK;IADL,IAAA,qBAAa,GAAE;IAGb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;wDAKjB;AAiDK;IADL,IAAA,qBAAa,GAAE;IAGb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;0DAKjB;AAGK;IADL,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;2DASjB;AAGK;IADL,IAAA,qBAAa,GAAE;IAIb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;mDAyDjB"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/loaders/providers.ts","../src/migrations/migration20240227090331.ts","../src/migrations/migration20240710135844.ts","../src/migrations/migration20240924114005.ts","../src/models/index.ts","../src/models/tax-provider.ts","../src/models/tax-rate-rule.ts","../src/models/tax-rate.ts","../src/models/tax-region.ts","../src/providers/index.ts","../src/providers/system.ts","../src/services/index.ts","../src/services/tax-module-service.ts","../src/services/__tests__/noop.ts"],"version":"5.6.2"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@medusajs/tax",
3
- "version": "0.1.2",
3
+ "version": "1.0.0-rc-20241001083650",
4
4
  "description": "Medusa Tax module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist"
8
+ "dist",
9
+ "!dist/**/__tests__",
10
+ "!dist/**/__mocks__",
11
+ "!dist/**/__fixtures__"
9
12
  ],
10
13
  "engines": {
11
- "node": ">=16"
12
- },
13
- "bin": {
14
- "medusa-tax-seed": "dist/scripts/bin/run-seed.js"
14
+ "node": ">=20"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "scripts": {
27
27
  "watch": "tsc --build --watch",
28
28
  "watch:test": "tsc --build tsconfig.spec.json --watch",
29
- "prepublishOnly": "cross-env NODE_ENV=production tsc --build && tsc-alias -p tsconfig.json",
30
- "build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
29
+ "resolve:aliases": "tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && tsc-alias -p tsconfig.resolved.json && rimraf tsconfig.resolved.json",
30
+ "build": "rimraf dist && tsc --build && npm run resolve:aliases",
31
31
  "test": "jest --runInBand --bail --forceExit -- src/**/__tests__/**/*.ts",
32
32
  "test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.spec.ts",
33
33
  "migration:generate": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:generate",
@@ -37,25 +37,24 @@
37
37
  "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
38
38
  },
39
39
  "devDependencies": {
40
+ "@medusajs/framework": "1.0.0-rc-20241001083650",
40
41
  "@mikro-orm/cli": "5.9.7",
41
- "cross-env": "^5.2.1",
42
- "jest": "^29.6.3",
43
- "medusa-test-utils": "^1.1.45",
42
+ "@mikro-orm/core": "5.9.7",
43
+ "@mikro-orm/migrations": "5.9.7",
44
+ "@mikro-orm/postgresql": "5.9.7",
45
+ "@swc/core": "^1.7.28",
46
+ "@swc/jest": "^0.2.36",
47
+ "jest": "^29.7.0",
48
+ "medusa-test-utils": "2.0.0-rc-20241001083650",
44
49
  "rimraf": "^3.0.2",
45
- "ts-jest": "^29.1.1",
46
- "ts-node": "^10.9.1",
47
50
  "tsc-alias": "^1.8.6",
48
- "typescript": "^5.1.6"
51
+ "typescript": "^5.6.2"
49
52
  },
50
- "dependencies": {
51
- "@medusajs/modules-sdk": "^1.12.12",
52
- "@medusajs/types": "^1.11.17",
53
- "@medusajs/utils": "^1.11.10",
53
+ "peerDependencies": {
54
+ "@medusajs/framework": "1.0.0-rc-20241001083650",
54
55
  "@mikro-orm/core": "5.9.7",
55
56
  "@mikro-orm/migrations": "5.9.7",
56
57
  "@mikro-orm/postgresql": "5.9.7",
57
- "awilix": "^8.0.0",
58
- "dotenv": "^16.4.5",
59
- "knex": "2.4.2"
58
+ "awilix": "^8.0.1"
60
59
  }
61
60
  }
@@ -1,5 +0,0 @@
1
- import { ModuleJoinerConfig } from "@medusajs/types";
2
- import { MapToConfig } from "@medusajs/utils";
3
- export declare const LinkableKeys: Record<string, string>;
4
- export declare const entityNameToLinkableKeysMap: MapToConfig;
5
- export declare const joinerConfig: ModuleJoinerConfig;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joinerConfig = exports.entityNameToLinkableKeysMap = exports.LinkableKeys = void 0;
4
- const modules_sdk_1 = require("@medusajs/modules-sdk");
5
- const _models_1 = require("./models");
6
- exports.LinkableKeys = {
7
- tax_rate_id: _models_1.TaxRate.name,
8
- tax_region_id: _models_1.TaxRegion.name,
9
- tax_rate_rule_id: _models_1.TaxRateRule.name,
10
- tax_provider_id: _models_1.TaxProvider.name,
11
- };
12
- const entityLinkableKeysMap = {};
13
- Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
14
- entityLinkableKeysMap[value] ?? (entityLinkableKeysMap[value] = []);
15
- entityLinkableKeysMap[value].push({
16
- mapTo: key,
17
- valueFrom: key.split("_").pop(),
18
- });
19
- });
20
- exports.entityNameToLinkableKeysMap = entityLinkableKeysMap;
21
- exports.joinerConfig = {
22
- serviceName: modules_sdk_1.Modules.TAX,
23
- primaryKeys: ["id"],
24
- linkableKeys: exports.LinkableKeys,
25
- alias: [
26
- {
27
- name: ["tax_rate", "tax_rates"],
28
- args: {
29
- entity: _models_1.TaxRate.name,
30
- },
31
- },
32
- {
33
- name: ["tax_region", "tax_regions"],
34
- args: {
35
- entity: _models_1.TaxRegion.name,
36
- methodSuffix: "TaxRegions",
37
- },
38
- },
39
- {
40
- name: ["tax_rate_rule", "tax_rate_rules"],
41
- args: {
42
- entity: _models_1.TaxRateRule.name,
43
- methodSuffix: "TaxRateRules",
44
- },
45
- },
46
- {
47
- name: ["tax_provider", "tax_providers"],
48
- args: {
49
- entity: _models_1.TaxProvider.name,
50
- methodSuffix: "TaxProviders",
51
- },
52
- },
53
- ],
54
- };
@@ -1,2 +0,0 @@
1
- import { ModuleExports } from "@medusajs/types";
2
- export declare const moduleDefinition: ModuleExports;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.moduleDefinition = void 0;
30
- const utils_1 = require("@medusajs/utils");
31
- const modules_sdk_1 = require("@medusajs/modules-sdk");
32
- const Models = __importStar(require("./models"));
33
- const ModuleModels = __importStar(require("./models"));
34
- const ModuleServices = __importStar(require("./services"));
35
- const _services_1 = require("./services");
36
- const providers_1 = __importDefault(require("./loaders/providers"));
37
- const migrationScriptOptions = {
38
- moduleName: modules_sdk_1.Modules.TAX,
39
- models: Models,
40
- pathToMigrations: __dirname + "/migrations",
41
- };
42
- const runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
43
- const revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
44
- const containerLoader = utils_1.ModulesSdkUtils.moduleContainerLoaderFactory({
45
- moduleModels: ModuleModels,
46
- moduleRepositories: { BaseRepository: utils_1.MikroOrmBaseRepository },
47
- moduleServices: ModuleServices,
48
- });
49
- const connectionLoader = utils_1.ModulesSdkUtils.mikroOrmConnectionLoaderFactory({
50
- moduleName: modules_sdk_1.Modules.TAX,
51
- moduleModels: Object.values(Models),
52
- migrationsPath: __dirname + "/migrations",
53
- });
54
- const service = _services_1.TaxModuleService;
55
- const loaders = [containerLoader, connectionLoader, providers_1.default];
56
- exports.moduleDefinition = {
57
- service,
58
- loaders,
59
- revertMigration,
60
- runMigrations,
61
- };
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- declare const _default: Promise<void>;
3
- export default _default;
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- const modules_sdk_1 = require("@medusajs/modules-sdk");
28
- const utils_1 = require("@medusajs/utils");
29
- const Models = __importStar(require("../../models"));
30
- const os_1 = require("os");
31
- const args = process.argv;
32
- const path = args.pop();
33
- exports.default = (async () => {
34
- const { config } = await Promise.resolve().then(() => __importStar(require("dotenv")));
35
- config();
36
- if (!path) {
37
- throw new Error(`filePath is required.${os_1.EOL}Example: medusa-tax-seed <filePath>`);
38
- }
39
- const run = utils_1.ModulesSdkUtils.buildSeedScript({
40
- moduleName: modules_sdk_1.Modules.TAX,
41
- models: Models,
42
- pathToMigrations: __dirname + "/../../migrations",
43
- seedHandler: async ({ manager, data }) => {
44
- // TODO: Add seed logic
45
- },
46
- });
47
- await run({ path });
48
- })();