@medusajs/promotion 0.0.5-snapshot-20240607093839 → 0.0.5-snapshot-20240701122250

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +5 -2
  4. package/dist/joiner-config.d.ts +3 -8
  5. package/dist/joiner-config.d.ts.map +1 -1
  6. package/dist/joiner-config.js +10 -35
  7. package/dist/migrations/Migration20240617102917.d.ts +6 -0
  8. package/dist/migrations/Migration20240617102917.d.ts.map +1 -0
  9. package/dist/migrations/Migration20240617102917.js +15 -0
  10. package/dist/migrations/Migration20240624153824.d.ts +6 -0
  11. package/dist/migrations/Migration20240624153824.d.ts.map +1 -0
  12. package/dist/migrations/Migration20240624153824.js +15 -0
  13. package/dist/models/application-method.d.ts +2 -2
  14. package/dist/models/application-method.d.ts.map +1 -1
  15. package/dist/models/application-method.js +1 -1
  16. package/dist/models/campaign-budget.d.ts +2 -2
  17. package/dist/models/campaign-budget.d.ts.map +1 -1
  18. package/dist/models/campaign.d.ts +2 -2
  19. package/dist/models/campaign.d.ts.map +1 -1
  20. package/dist/models/campaign.js +9 -5
  21. package/dist/models/promotion-rule-value.d.ts +2 -1
  22. package/dist/models/promotion-rule-value.d.ts.map +1 -1
  23. package/dist/models/promotion-rule-value.js +1 -1
  24. package/dist/models/promotion-rule.d.ts.map +1 -1
  25. package/dist/models/promotion.d.ts +3 -3
  26. package/dist/models/promotion.d.ts.map +1 -1
  27. package/dist/models/promotion.js +1 -1
  28. package/dist/services/promotion-module.d.ts +27 -24
  29. package/dist/services/promotion-module.d.ts.map +1 -1
  30. package/dist/services/promotion-module.js +28 -25
  31. package/dist/types/application-method.d.ts +2 -2
  32. package/dist/types/application-method.d.ts.map +1 -1
  33. package/dist/types/campaign.d.ts +6 -6
  34. package/dist/types/campaign.d.ts.map +1 -1
  35. package/package.json +7 -10
  36. package/dist/module-definition.d.ts +0 -3
  37. package/dist/module-definition.d.ts.map +0 -1
  38. package/dist/module-definition.js +0 -8
  39. package/dist/repositories/index.d.ts +0 -2
  40. package/dist/repositories/index.d.ts.map +0 -1
  41. package/dist/repositories/index.js +0 -5
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import { moduleDefinition } from "./module-definition";
1
+ import { ModuleExports } from "@medusajs/types";
2
+ declare const moduleDefinition: ModuleExports;
2
3
  export default moduleDefinition;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,eAAe,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,QAAA,MAAM,gBAAgB,EAAE,aAEvB,CAAA;AACD,eAAe,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const module_definition_1 = require("./module-definition");
4
- exports.default = module_definition_1.moduleDefinition;
3
+ const _services_1 = require("./services");
4
+ const moduleDefinition = {
5
+ service: _services_1.PromotionModuleService,
6
+ };
7
+ exports.default = moduleDefinition;
@@ -1,9 +1,4 @@
1
- import { ModuleJoinerConfig } from "@medusajs/types";
2
- export declare const LinkableKeys: {
3
- promotion_id: string;
4
- campaign_id: string;
5
- promotion_rule_id: string;
6
- };
7
- export declare const entityNameToLinkableKeysMap: import("@medusajs/utils").MapToConfig;
8
- export declare const joinerConfig: ModuleJoinerConfig;
1
+ import { MapToConfig } from "@medusajs/utils";
2
+ export declare const joinerConfig: Omit<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys"> & Required<Pick<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys">>;
3
+ export declare const entityNameToLinkableKeysMap: MapToConfig;
9
4
  //# sourceMappingURL=joiner-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"joiner-config.d.ts","sourceRoot":"","sources":["../src/joiner-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAIpD,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,eAAO,MAAM,2BAA2B,uCAAwC,CAAA;AAEhF,eAAO,MAAM,YAAY,EAAE,kBA0B1B,CAAA"}
1
+ {"version":3,"file":"joiner-config.d.ts","sourceRoot":"","sources":["../src/joiner-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAEZ,MAAM,iBAAiB,CAAA;AAGxB,eAAO,MAAM,YAAY,uOAOvB,CAAA;AAEF,eAAO,MAAM,2BAA2B,EAAE,WACqB,CAAA"}
@@ -1,39 +1,14 @@
1
1
  "use strict";
2
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");
3
+ exports.entityNameToLinkableKeysMap = exports.joinerConfig = void 0;
5
4
  const utils_1 = require("@medusajs/utils");
6
5
  const _models_1 = require("./models");
7
- exports.LinkableKeys = {
8
- promotion_id: _models_1.Promotion.name,
9
- campaign_id: _models_1.Campaign.name,
10
- promotion_rule_id: _models_1.PromotionRule.name,
11
- };
12
- exports.entityNameToLinkableKeysMap = (0, utils_1.generateLinkableKeysMap)(exports.LinkableKeys);
13
- exports.joinerConfig = {
14
- serviceName: modules_sdk_1.Modules.PROMOTION,
15
- primaryKeys: ["id"],
16
- linkableKeys: exports.LinkableKeys,
17
- alias: [
18
- {
19
- name: ["promotion", "promotions"],
20
- args: {
21
- entity: _models_1.Promotion.name,
22
- },
23
- },
24
- {
25
- name: ["campaign", "campaigns"],
26
- args: {
27
- entity: _models_1.Campaign.name,
28
- methodSuffix: "Campaigns",
29
- },
30
- },
31
- {
32
- name: ["promotion_rule", "promotion_rules"],
33
- args: {
34
- entity: _models_1.PromotionRule.name,
35
- methodSuffix: "PromotionRules",
36
- },
37
- },
38
- ],
39
- };
6
+ exports.joinerConfig = (0, utils_1.defineJoinerConfig)(utils_1.Modules.PROMOTION, {
7
+ entityQueryingConfig: [_models_1.Promotion, _models_1.Campaign, _models_1.PromotionRule],
8
+ linkableKeys: {
9
+ promotion_id: _models_1.Promotion.name,
10
+ campaign_id: _models_1.Campaign.name,
11
+ promotion_rule_id: _models_1.PromotionRule.name,
12
+ },
13
+ });
14
+ exports.entityNameToLinkableKeysMap = (0, utils_1.buildEntitiesNameToLinkableKeysMap)(exports.joinerConfig.linkableKeys);
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ export declare class Migration20240617102917 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20240617102917.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,15 @@
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;
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ export declare class Migration20240624153824 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20240624153824.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,15 @@
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;
@@ -1,6 +1,6 @@
1
1
  import { ApplicationMethodAllocationValues, ApplicationMethodTargetTypeValues, ApplicationMethodTypeValues, BigNumberRawValue } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
- import { Collection } from "@mikro-orm/core";
3
+ import { Collection, Rel } from "@mikro-orm/core";
4
4
  import Promotion from "./promotion";
5
5
  import PromotionRule from "./promotion-rule";
6
6
  export default class ApplicationMethod {
@@ -14,7 +14,7 @@ export default class ApplicationMethod {
14
14
  type: ApplicationMethodTypeValues;
15
15
  target_type: ApplicationMethodTargetTypeValues;
16
16
  allocation?: ApplicationMethodAllocationValues;
17
- promotion: Promotion;
17
+ promotion: Rel<Promotion>;
18
18
  target_rules: Collection<PromotionRule, object>;
19
19
  buy_rules: Collection<PromotionRule, object>;
20
20
  created_at: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"application-method.d.ts","sourceRoot":"","sources":["../../src/models/application-method.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,SAAS,EAMV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,UAAU,EAUX,MAAM,iBAAiB,CAAA;AACxB,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAW5C,MAAM,CAAC,OAAO,OAAO,iBAAiB;IAEpC,EAAE,EAAG,MAAM,CAAA;IAGX,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;IAGhC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAInC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAO;IAGnC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAO;IAGnC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAO;IAGxC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAO;IAI7C,IAAI,EAAE,2BAA2B,CAAA;IAIjC,WAAW,EAAE,iCAAiC,CAAA;IAO9C,UAAU,CAAC,EAAE,iCAAiC,CAAA;IAM9C,SAAS,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G9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -91,7 +91,7 @@ __decorate([
91
91
  entity: () => promotion_1.default,
92
92
  onDelete: "cascade",
93
93
  }),
94
- __metadata("design:type", promotion_1.default)
94
+ __metadata("design:type", Object)
95
95
  ], ApplicationMethod.prototype, "promotion", void 0);
96
96
  __decorate([
97
97
  (0, core_1.ManyToMany)(() => promotion_rule_1.default, "method_target_rules", {
@@ -1,13 +1,13 @@
1
1
  import { BigNumberRawValue, CampaignBudgetTypeValues, DAL } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
- import { OptionalProps } from "@mikro-orm/core";
3
+ import { OptionalProps, Rel } from "@mikro-orm/core";
4
4
  import Campaign from "./campaign";
5
5
  type OptionalFields = "description" | "limit" | "used" | DAL.SoftDeletableEntityDateColumns;
6
6
  export default class CampaignBudget {
7
7
  [OptionalProps]?: OptionalFields;
8
8
  id: string;
9
9
  type: CampaignBudgetTypeValues;
10
- campaign: Campaign | null;
10
+ campaign: Rel<Campaign> | null;
11
11
  currency_code: string | null;
12
12
  limit: BigNumber | number | null;
13
13
  raw_limit: BigNumberRawValue | null;
@@ -1 +1 @@
1
- {"version":3,"file":"campaign-budget.d.ts","sourceRoot":"","sources":["../../src/models/campaign-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,SAAS,EAKV,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAQL,aAAa,EAGd,MAAM,iBAAiB,CAAA;AACxB,OAAO,QAAQ,MAAM,YAAY,CAAA;AAEjC,KAAK,cAAc,GACf,aAAa,GACb,OAAO,GACP,MAAM,GACN,GAAG,CAAC,8BAA8B,CAAA;AAItC,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAGhC,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAE,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E,iBAAiB,CAAA;IAO3B,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -1,5 +1,5 @@
1
1
  import { DAL } from "@medusajs/types";
2
- import { Collection, OptionalProps } from "@mikro-orm/core";
2
+ import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
3
3
  import CampaignBudget from "./campaign-budget";
4
4
  import Promotion from "./promotion";
5
5
  type OptionalRelations = "budget";
@@ -12,7 +12,7 @@ export default class Campaign {
12
12
  campaign_identifier: string;
13
13
  starts_at: Date | null;
14
14
  ends_at: Date | null;
15
- budget: CampaignBudget | null;
15
+ budget: Rel<CampaignBudget> | null;
16
16
  promotions: Collection<Promotion, object>;
17
17
  created_at: Date;
18
18
  updated_at: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/models/campaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAErC,OAAO,EAEL,UAAU,EAMV,aAAa,EAId,MAAM,iBAAiB,CAAA;AACxB,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAC9C,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC,KAAK,iBAAiB,GAAG,QAAQ,CAAA;AACjC,KAAK,cAAc,GACf,aAAa,GACb,WAAW,GACX,SAAS,GACT,GAAG,CAAC,8BAA8B,CAAA;AAItC,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,GAAG,iBAAiB,CAAA;IAGpD,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAO;IAOjC,mBAAmB,EAAE,MAAM,CAAA;IAM3B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAO;IAM7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/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const campaign_budget_1 = __importDefault(require("./campaign-budget"));
18
18
  const promotion_1 = __importDefault(require("./promotion"));
19
+ const tableName = "promotion_campaign";
20
+ const CampaignUniqueCampaignIdentifier = (0, utils_1.createPsqlIndexStatementHelper)({
21
+ tableName,
22
+ columns: ["campaign_identifier"],
23
+ unique: true,
24
+ where: "deleted_at IS NULL",
25
+ });
19
26
  let Campaign = class Campaign {
20
27
  constructor() {
21
28
  this.description = null;
@@ -48,10 +55,7 @@ __decorate([
48
55
  ], Campaign.prototype, "description", void 0);
49
56
  __decorate([
50
57
  (0, core_1.Property)({ columnType: "text" }),
51
- (0, core_1.Unique)({
52
- name: "IDX_campaign_identifier_unique",
53
- properties: ["campaign_identifier"],
54
- }),
58
+ CampaignUniqueCampaignIdentifier.MikroORMIndex(),
55
59
  __metadata("design:type", String)
56
60
  ], Campaign.prototype, "campaign_identifier", void 0);
57
61
  __decorate([
@@ -115,7 +119,7 @@ __decorate([
115
119
  __metadata("design:returntype", void 0)
116
120
  ], Campaign.prototype, "onInit", null);
117
121
  Campaign = __decorate([
118
- (0, core_1.Entity)({ tableName: "promotion_campaign" }),
122
+ (0, core_1.Entity)({ tableName }),
119
123
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
120
124
  ], Campaign);
121
125
  exports.default = Campaign;
@@ -1,7 +1,8 @@
1
+ import { Rel } from "@mikro-orm/core";
1
2
  import PromotionRule from "./promotion-rule";
2
3
  export default class PromotionRuleValue {
3
4
  id: string;
4
- promotion_rule: PromotionRule;
5
+ promotion_rule: Rel<PromotionRule>;
5
6
  value: string;
6
7
  created_at: Date;
7
8
  updated_at: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-rule-value.d.ts","sourceRoot":"","sources":["../../src/models/promotion-rule-value.ts"],"names":[],"mappings":"AAUA,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAErC,EAAE,EAAG,MAAM,CAAA;IAOX,cAAc,EAAE,aAAa,CAAA;IAG7B,KAAK,EAAE,MAAM,CAAA;IAOb,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
1
+ {"version":3,"file":"promotion-rule-value.d.ts","sourceRoot":"","sources":["../../src/models/promotion-rule-value.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAI5C,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAErC,EAAE,EAAG,MAAM,CAAA;IAOX,cAAc,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;IAGlC,KAAK,EAAE,MAAM,CAAA;IAOb,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -36,7 +36,7 @@ __decorate([
36
36
  fieldName: "promotion_rule_id",
37
37
  index: "IDX_promotion_rule_promotion_rule_value_id",
38
38
  }),
39
- __metadata("design:type", promotion_rule_1.default)
39
+ __metadata("design:type", Object)
40
40
  ], PromotionRuleValue.prototype, "promotion_rule", void 0);
41
41
  __decorate([
42
42
  (0, core_1.Property)({ columnType: "text" }),
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-rule.d.ts","sourceRoot":"","sources":["../../src/models/promotion-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAA;AAElE,OAAO,EAGL,UAAU,EAQV,aAAa,EAGd,MAAM,iBAAiB,CAAA;AACxB,OAAO,iBAAiB,MAAM,sBAAsB,CAAA;AACpD,OAAO,SAAS,MAAM,aAAa,CA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,IAAI,CAAO;IAIjC,SAAS,EAAE,MAAM,CAAA;IAIjB,QAAQ,EAAE,2BAA2B,CAAA;IAKrC,MAAM,yCAAgD;IAGtD,UAAU,gCAAuC;IAMjD,mBAAmB,wCAA+C;IAMlE,gBAAgB,wCAA+C;IAO/D,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -1,5 +1,5 @@
1
1
  import { DAL, PromotionTypeValues } from "@medusajs/types";
2
- import { Collection, OptionalProps } from "@mikro-orm/core";
2
+ import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
3
3
  import ApplicationMethod from "./application-method";
4
4
  import Campaign from "./campaign";
5
5
  import PromotionRule from "./promotion-rule";
@@ -10,10 +10,10 @@ export default class Promotion {
10
10
  id: string;
11
11
  code: string;
12
12
  campaign_id: string | null;
13
- campaign: Campaign | null;
13
+ campaign: Rel<Campaign> | null;
14
14
  is_automatic: boolean;
15
15
  type: PromotionTypeValues;
16
- application_method: ApplicationMethod;
16
+ application_method: Rel<ApplicationMethod>;
17
17
  rules: Collection<PromotionRule, object>;
18
18
  created_at: Date;
19
19
  updated_at: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../src/models/promotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAO1D,OAAO,EAEL,UAAU,EASV,aAAa,EAId,MAAM,iBAAiB,CAAA;AACxB,OAAO,iBAAiB,MAAM,sBAAsB,CAAA;AACpD,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAE5C,KAAK,cAAc,GAAG,cAAc,GAAG,GAAG,CAAC,8BAA8B,CAAA;AACzE,KAAK,iBAAiB,GAAG,oBAAoB,GAAG,UAAU,CAAA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G9B,YAAY,EAAE,OAAO,CAAQ;IAI7B,IAAI,EAAE,mBAAmB,CAAA;IAOzB,kBAAkB,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAA;IAO1C,KAAK,oCAA2C;IAOhD,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -74,7 +74,7 @@ __decorate([
74
74
  mappedBy: (am) => am.promotion,
75
75
  cascade: ["soft-remove"],
76
76
  }),
77
- __metadata("design:type", application_method_1.default)
77
+ __metadata("design:type", Object)
78
78
  ], Promotion.prototype, "application_method", void 0);
79
79
  __decorate([
80
80
  (0, core_1.ManyToMany)(() => promotion_rule_1.default, "promotions", {
@@ -4,14 +4,17 @@ import { ApplicationMethod, Campaign, CampaignBudget, Promotion, PromotionRule,
4
4
  import { ApplicationMethodRuleTypes } from "../types";
5
5
  type InjectedDependencies = {
6
6
  baseRepository: DAL.RepositoryService;
7
- promotionService: ModulesSdkTypes.InternalModuleService<any>;
8
- applicationMethodService: ModulesSdkTypes.InternalModuleService<any>;
9
- promotionRuleService: ModulesSdkTypes.InternalModuleService<any>;
10
- promotionRuleValueService: ModulesSdkTypes.InternalModuleService<any>;
11
- campaignService: ModulesSdkTypes.InternalModuleService<any>;
12
- campaignBudgetService: ModulesSdkTypes.InternalModuleService<any>;
7
+ promotionService: ModulesSdkTypes.IMedusaInternalService<any>;
8
+ applicationMethodService: ModulesSdkTypes.IMedusaInternalService<any>;
9
+ promotionRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
10
+ promotionRuleValueService: ModulesSdkTypes.IMedusaInternalService<any>;
11
+ campaignService: ModulesSdkTypes.IMedusaInternalService<any>;
12
+ campaignBudgetService: ModulesSdkTypes.IMedusaInternalService<any>;
13
13
  };
14
- declare const PromotionModuleService_base: new (container: InjectedDependencies) => ModulesSdkUtils.AbstractModuleService<InjectedDependencies, PromotionTypes.PromotionDTO, {
14
+ declare const PromotionModuleService_base: new (...args: any[]) => ModulesSdkUtils.AbstractModuleService<{
15
+ Promotion: {
16
+ dto: PromotionTypes.PromotionDTO;
17
+ };
15
18
  ApplicationMethod: {
16
19
  dto: PromotionTypes.ApplicationMethodDTO;
17
20
  };
@@ -28,31 +31,31 @@ declare const PromotionModuleService_base: new (container: InjectedDependencies)
28
31
  dto: PromotionTypes.PromotionRuleValueDTO;
29
32
  };
30
33
  }>;
31
- export default class PromotionModuleService<TApplicationMethod extends ApplicationMethod = ApplicationMethod, TPromotion extends Promotion = Promotion, TPromotionRule extends PromotionRule = PromotionRule, TPromotionRuleValue extends PromotionRuleValue = PromotionRuleValue, TCampaign extends Campaign = Campaign, TCampaignBudget extends CampaignBudget = CampaignBudget> extends PromotionModuleService_base implements PromotionTypes.IPromotionModuleService {
34
+ export default class PromotionModuleService extends PromotionModuleService_base implements PromotionTypes.IPromotionModuleService {
32
35
  protected readonly moduleDeclaration: InternalModuleDeclaration;
33
36
  protected baseRepository_: DAL.RepositoryService;
34
- protected promotionService_: ModulesSdkTypes.InternalModuleService<TPromotion>;
35
- protected applicationMethodService_: ModulesSdkTypes.InternalModuleService<TApplicationMethod>;
36
- protected promotionRuleService_: ModulesSdkTypes.InternalModuleService<TPromotionRule>;
37
- protected promotionRuleValueService_: ModulesSdkTypes.InternalModuleService<TPromotionRuleValue>;
38
- protected campaignService_: ModulesSdkTypes.InternalModuleService<TCampaign>;
39
- protected campaignBudgetService_: ModulesSdkTypes.InternalModuleService<TCampaignBudget>;
37
+ protected promotionService_: ModulesSdkTypes.IMedusaInternalService<Promotion>;
38
+ protected applicationMethodService_: ModulesSdkTypes.IMedusaInternalService<ApplicationMethod>;
39
+ protected promotionRuleService_: ModulesSdkTypes.IMedusaInternalService<PromotionRule>;
40
+ protected promotionRuleValueService_: ModulesSdkTypes.IMedusaInternalService<PromotionRuleValue>;
41
+ protected campaignService_: ModulesSdkTypes.IMedusaInternalService<Campaign>;
42
+ protected campaignBudgetService_: ModulesSdkTypes.IMedusaInternalService<CampaignBudget>;
40
43
  constructor({ baseRepository, promotionService, applicationMethodService, promotionRuleService, promotionRuleValueService, campaignService, campaignBudgetService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
41
44
  __joinerConfig(): ModuleJoinerConfig;
42
45
  registerUsage(computedActions: PromotionTypes.UsageComputedActions[], sharedContext?: Context): Promise<void>;
43
46
  computeActions(promotionCodes: string[], applicationContext: PromotionTypes.ComputeActionContext, options?: PromotionTypes.ComputeActionOptions, sharedContext?: Context): Promise<PromotionTypes.ComputeActions[]>;
44
- create(data: PromotionTypes.CreatePromotionDTO, sharedContext?: Context): Promise<PromotionTypes.PromotionDTO>;
45
- create(data: PromotionTypes.CreatePromotionDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionDTO[]>;
46
- protected create_(data: PromotionTypes.CreatePromotionDTO[], sharedContext?: Context): Promise<TPromotion[]>;
47
- update(data: PromotionTypes.UpdatePromotionDTO, sharedContext?: Context): Promise<PromotionTypes.PromotionDTO>;
48
- update(data: PromotionTypes.UpdatePromotionDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionDTO[]>;
49
- protected update_(data: PromotionTypes.UpdatePromotionDTO[], sharedContext?: Context): Promise<TPromotion[]>;
47
+ createPromotions(data: PromotionTypes.CreatePromotionDTO, sharedContext?: Context): Promise<PromotionTypes.PromotionDTO>;
48
+ createPromotions(data: PromotionTypes.CreatePromotionDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionDTO[]>;
49
+ protected createPromotions_(data: PromotionTypes.CreatePromotionDTO[], sharedContext?: Context): Promise<Promotion[]>;
50
+ updatePromotions(data: PromotionTypes.UpdatePromotionDTO, sharedContext?: Context): Promise<PromotionTypes.PromotionDTO>;
51
+ updatePromotions(data: PromotionTypes.UpdatePromotionDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionDTO[]>;
52
+ protected updatePromotions_(data: PromotionTypes.UpdatePromotionDTO[], sharedContext?: Context): Promise<Promotion[]>;
50
53
  updatePromotionRules(data: PromotionTypes.UpdatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionRuleDTO[]>;
51
- protected updatePromotionRules_(data: PromotionTypes.UpdatePromotionRuleDTO[], sharedContext?: Context): Promise<TPromotionRule[]>;
54
+ protected updatePromotionRules_(data: PromotionTypes.UpdatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionRule[]>;
52
55
  addPromotionRules(promotionId: string, rulesData: PromotionTypes.CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionRuleDTO[]>;
53
56
  addPromotionTargetRules(promotionId: string, rulesData: PromotionTypes.CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionRuleDTO[]>;
54
57
  addPromotionBuyRules(promotionId: string, rulesData: PromotionTypes.CreatePromotionRuleDTO[], sharedContext?: Context): Promise<PromotionTypes.PromotionRuleDTO[]>;
55
- protected createPromotionRulesAndValues_(rulesData: PromotionTypes.CreatePromotionRuleDTO[], relationName: "promotions" | "method_target_rules" | "method_buy_rules", relation: Promotion | ApplicationMethod, sharedContext?: Context): Promise<TPromotionRule[]>;
58
+ protected createPromotionRulesAndValues_(rulesData: PromotionTypes.CreatePromotionRuleDTO[], relationName: "promotions" | "method_target_rules" | "method_buy_rules", relation: Promotion | ApplicationMethod, sharedContext?: Context): Promise<PromotionRule[]>;
56
59
  removePromotionRules(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
57
60
  protected removePromotionRules_(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
58
61
  removePromotionTargetRules(promotionId: string, ruleIds: string[], sharedContext?: Context): Promise<void>;
@@ -60,14 +63,14 @@ export default class PromotionModuleService<TApplicationMethod extends Applicati
60
63
  protected removeApplicationMethodRules_(promotionId: string, ruleIds: string[], relation: ApplicationMethodRuleTypes.TARGET_RULES | ApplicationMethodRuleTypes.BUY_RULES, sharedContext?: Context): Promise<void>;
61
64
  createCampaigns(data: PromotionTypes.CreateCampaignDTO, sharedContext?: Context): Promise<PromotionTypes.CampaignDTO>;
62
65
  createCampaigns(data: PromotionTypes.CreateCampaignDTO[], sharedContext?: Context): Promise<PromotionTypes.CampaignDTO[]>;
63
- protected createCampaigns_(data: PromotionTypes.CreateCampaignDTO[], sharedContext?: Context): Promise<TCampaign[]>;
66
+ protected createCampaigns_(data: PromotionTypes.CreateCampaignDTO[], sharedContext?: Context): Promise<Campaign[]>;
64
67
  protected validateCampaignBudgetData(data: {
65
68
  type?: CampaignBudgetTypeValues;
66
69
  currency_code?: string | null;
67
70
  }): void;
68
71
  updateCampaigns(data: PromotionTypes.UpdateCampaignDTO, sharedContext?: Context): Promise<PromotionTypes.CampaignDTO>;
69
72
  updateCampaigns(data: PromotionTypes.UpdateCampaignDTO[], sharedContext?: Context): Promise<PromotionTypes.CampaignDTO[]>;
70
- protected updateCampaigns_(data: PromotionTypes.UpdateCampaignDTO[], sharedContext?: Context): Promise<TCampaign[]>;
73
+ protected updateCampaigns_(data: PromotionTypes.UpdateCampaignDTO[], sharedContext?: Context): Promise<Campaign[]>;
71
74
  addPromotionsToCampaign(data: PromotionTypes.AddPromotionsToCampaignDTO, sharedContext?: Context): Promise<{
72
75
  ids: string[];
73
76
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-module.d.ts","sourceRoot":"","sources":["../../src/services/promotion-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,OAAO,EACP,GAAG,EACH,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAUL,eAAe,EAQhB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,aAAa,EACb,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,0BAA0B,EAU3B,MAAM,QAAQ,CAAA;AA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ACnB,IAAI,EAAE,cAAc,CAAC,iBAAiB,EACtC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC;IAEhC,eAAe,CACnB,IAAI,EAAE,cAAc,CAAC,iBAAiB,EAAE,EACxC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;cAuBxB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,CAAC,iBAAiB,EAAE,EACvB,aAAa,GAAE,OAAY;IAsExC,uBAAuB,CAC3B,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC/C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;cAWb,wBAAwB,CACtC,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC9B,aAAa,GAAE,OAAY;IAmDxC,4BAA4B,CAChC,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC/C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;cAOb,6BAA6B,CAC3C,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC9B,aAAa,GAAE,OAAY;CAiC/C"}
1
+ {"version":3,"file":"promotion-module.d.ts","sourceRoot":"","sources":["../../src/services/promotion-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,OAAO,EACP,GAAG,EACH,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAgBL,eAAe,EAGhB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,aAAa,EACb,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,0BAA0B,EAU3B,MAAM,QAAQ,CAAA;AAWf,KAAK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AAC,EAAE,OAAO,GACtB,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;cAuBxB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,CAAC,iBAAiB,EAAE,EACvB,aAAa,GAAE,OAAY;IAsExC,uBAAuB,CAC3B,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC/C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;cAWb,wBAAwB,CACtC,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC9B,aAAa,GAAE,OAAY;IAmDxC,4BAA4B,CAChC,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC/C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;cAOb,6BAA6B,CAC3C,IAAI,EAAE,cAAc,CAAC,0BAA0B,EAC9B,aAAa,GAAE,OAAY;CAiC/C"}
@@ -18,14 +18,14 @@ const _models_1 = require("../models");
18
18
  const _types_1 = require("../types");
19
19
  const _utils_1 = require("../utils");
20
20
  const joiner_config_1 = require("../joiner-config");
21
- const generateMethodForModels = [
22
- _models_1.ApplicationMethod,
23
- _models_1.Campaign,
24
- _models_1.CampaignBudget,
25
- _models_1.PromotionRule,
26
- _models_1.PromotionRuleValue,
27
- ];
28
- class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFactory(_models_1.Promotion, generateMethodForModels, joiner_config_1.entityNameToLinkableKeysMap) {
21
+ class PromotionModuleService extends (0, utils_1.MedusaService)({
22
+ Promotion: _models_1.Promotion,
23
+ ApplicationMethod: _models_1.ApplicationMethod,
24
+ Campaign: _models_1.Campaign,
25
+ CampaignBudget: _models_1.CampaignBudget,
26
+ PromotionRule: _models_1.PromotionRule,
27
+ PromotionRuleValue: _models_1.PromotionRuleValue,
28
+ }, joiner_config_1.entityNameToLinkableKeysMap) {
29
29
  constructor({ baseRepository, promotionService, applicationMethodService, promotionRuleService, promotionRuleValueService, campaignService, campaignBudgetService, }, moduleDeclaration) {
30
30
  // @ts-ignore
31
31
  super(...arguments);
@@ -47,7 +47,7 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
47
47
  .filter(Boolean);
48
48
  const promotionCodeCampaignBudgetMap = new Map();
49
49
  const promotionCodeUsageMap = new Map();
50
- const existingPromotions = await this.list({ code: promotionCodes }, { relations: ["application_method", "campaign", "campaign.budget"] }, sharedContext);
50
+ const existingPromotions = await this.listPromotions({ code: promotionCodes }, { relations: ["application_method", "campaign", "campaign.budget"] }, sharedContext);
51
51
  const existingPromotionsMap = new Map(existingPromotions.map((promotion) => [promotion.code, promotion]));
52
52
  for (let computedAction of computedActions) {
53
53
  if (!_utils_1.ComputeActionUtils.canRegisterUsage(computedAction)) {
@@ -103,7 +103,7 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
103
103
  const methodIdPromoValueMap = new Map();
104
104
  const automaticPromotions = preventAutoPromotions
105
105
  ? []
106
- : await this.list({ is_automatic: true }, { select: ["code"], take: null }, sharedContext);
106
+ : await this.listPromotions({ is_automatic: true }, { select: ["code"], take: null }, sharedContext);
107
107
  // Promotions we need to apply includes all the codes that are passed as an argument
108
108
  // to this method, along with any automatic promotions that can be applied to the context
109
109
  const automaticPromotionCodes = automaticPromotions.map((p) => p.code);
@@ -131,7 +131,7 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
131
131
  }
132
132
  });
133
133
  });
134
- const promotions = await this.list({
134
+ const promotions = await this.listPromotions({
135
135
  code: [
136
136
  ...promotionCodesToApply,
137
137
  ...appliedItemCodes,
@@ -211,10 +211,10 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
211
211
  (0, utils_1.transformPropertiesToBigNumber)(computedActions, { include: ["amount"] });
212
212
  return computedActions;
213
213
  }
214
- async create(data, sharedContext = {}) {
214
+ async createPromotions(data, sharedContext = {}) {
215
215
  const input = Array.isArray(data) ? data : [data];
216
- const createdPromotions = await this.create_(input, sharedContext);
217
- const promotions = await this.list({ id: createdPromotions.map((p) => p.id) }, {
216
+ const createdPromotions = await this.createPromotions_(input, sharedContext);
217
+ const promotions = await this.listPromotions({ id: createdPromotions.map((p) => p.id) }, {
218
218
  relations: [
219
219
  "application_method",
220
220
  "application_method.target_rules",
@@ -230,7 +230,7 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
230
230
  }, sharedContext);
231
231
  return Array.isArray(data) ? promotions : promotions[0];
232
232
  }
233
- async create_(data, sharedContext = {}) {
233
+ async createPromotions_(data, sharedContext = {}) {
234
234
  const promotionsData = [];
235
235
  const applicationMethodsData = [];
236
236
  const campaignsData = [];
@@ -326,10 +326,10 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
326
326
  }
327
327
  return createdPromotions;
328
328
  }
329
- async update(data, sharedContext = {}) {
329
+ async updatePromotions(data, sharedContext = {}) {
330
330
  const input = Array.isArray(data) ? data : [data];
331
- const updatedPromotions = await this.update_(input, sharedContext);
332
- const promotions = await this.list({ id: updatedPromotions.map((p) => p.id) }, {
331
+ const updatedPromotions = await this.updatePromotions_(input, sharedContext);
332
+ const promotions = await this.listPromotions({ id: updatedPromotions.map((p) => p.id) }, {
333
333
  relations: [
334
334
  "application_method",
335
335
  "application_method.target_rules",
@@ -343,7 +343,7 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
343
343
  }, sharedContext);
344
344
  return Array.isArray(data) ? promotions : promotions[0];
345
345
  }
346
- async update_(data, sharedContext = {}) {
346
+ async updatePromotions_(data, sharedContext = {}) {
347
347
  const promotionIds = data.map((d) => d.id);
348
348
  const existingPromotions = await this.promotionService_.list({ id: promotionIds }, { relations: ["application_method"] });
349
349
  const existingCampaigns = await this.campaignService_.list({ id: data.map((d) => d.campaign_id).filter((d) => (0, utils_1.isPresent)(d)) }, { relations: ["budget"] });
@@ -390,9 +390,10 @@ class PromotionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServi
390
390
  }
391
391
  return updatedPromotions;
392
392
  }
393
+ // @ts-ignore
393
394
  async updatePromotionRules(data, sharedContext = {}) {
394
395
  const updatedPromotionRules = await this.updatePromotionRules_(data, sharedContext);
395
- return this.listPromotionRules({ id: updatedPromotionRules.map((r) => r.id) }, { relations: ["values"] }, sharedContext);
396
+ return await this.listPromotionRules({ id: updatedPromotionRules.map((r) => r.id) }, { relations: ["values"] }, sharedContext);
396
397
  }
397
398
  async updatePromotionRules_(data, sharedContext = {}) {
398
399
  const promotionRuleIds = data.map((d) => d.id);
@@ -671,30 +672,32 @@ __decorate([
671
672
  __metadata("design:type", Function),
672
673
  __metadata("design:paramtypes", [Object, Object]),
673
674
  __metadata("design:returntype", Promise)
674
- ], PromotionModuleService.prototype, "create", null);
675
+ ], PromotionModuleService.prototype, "createPromotions", null);
675
676
  __decorate([
676
677
  (0, utils_1.InjectTransactionManager)("baseRepository_"),
677
678
  __param(1, (0, utils_1.MedusaContext)()),
678
679
  __metadata("design:type", Function),
679
680
  __metadata("design:paramtypes", [Array, Object]),
680
681
  __metadata("design:returntype", Promise)
681
- ], PromotionModuleService.prototype, "create_", null);
682
+ ], PromotionModuleService.prototype, "createPromotions_", null);
682
683
  __decorate([
683
684
  (0, utils_1.InjectManager)("baseRepository_"),
684
685
  __param(1, (0, utils_1.MedusaContext)()),
685
686
  __metadata("design:type", Function),
686
687
  __metadata("design:paramtypes", [Object, Object]),
687
688
  __metadata("design:returntype", Promise)
688
- ], PromotionModuleService.prototype, "update", null);
689
+ ], PromotionModuleService.prototype, "updatePromotions", null);
689
690
  __decorate([
690
691
  (0, utils_1.InjectTransactionManager)("baseRepository_"),
691
692
  __param(1, (0, utils_1.MedusaContext)()),
692
693
  __metadata("design:type", Function),
693
694
  __metadata("design:paramtypes", [Array, Object]),
694
695
  __metadata("design:returntype", Promise)
695
- ], PromotionModuleService.prototype, "update_", null);
696
+ ], PromotionModuleService.prototype, "updatePromotions_", null);
696
697
  __decorate([
697
- (0, utils_1.InjectManager)("baseRepository_"),
698
+ (0, utils_1.InjectManager)("baseRepository_")
699
+ // @ts-ignore
700
+ ,
698
701
  __param(1, (0, utils_1.MedusaContext)()),
699
702
  __metadata("design:type", Function),
700
703
  __metadata("design:paramtypes", [Array, Object]),
@@ -5,7 +5,7 @@ export interface CreateApplicationMethodDTO {
5
5
  target_type: ApplicationMethodTargetTypeValues;
6
6
  allocation?: ApplicationMethodAllocationValues;
7
7
  value?: BigNumberInput;
8
- currency_code: string;
8
+ currency_code?: string | null;
9
9
  promotion: Promotion | string | PromotionDTO;
10
10
  max_quantity?: BigNumberInput | null;
11
11
  buy_rules_min_quantity?: BigNumberInput | null;
@@ -17,7 +17,7 @@ export interface UpdateApplicationMethodDTO {
17
17
  target_type?: ApplicationMethodTargetTypeValues;
18
18
  allocation?: ApplicationMethodAllocationValues;
19
19
  value?: BigNumberInput;
20
- currency_code?: string;
20
+ currency_code?: string | null;
21
21
  promotion?: Promotion | string | PromotionDTO;
22
22
  max_quantity?: BigNumberInput | null;
23
23
  buy_rules_min_quantity?: BigNumberInput | null;
@@ -1 +1 @@
1
- {"version":3,"file":"application-method.d.ts","sourceRoot":"","sources":["../../src/types/application-method.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,2BAA2B,EAC3B,cAAc,EACd,YAAY,EACb,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,2BAA2B,CAAA;IACjC,WAAW,EAAE,iCAAiC,CAAA;IAC9C,UAAU,CAAC,EAAE,iCAAiC,CAAA;IAC9C,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAA;IAC5C,YAAY,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AAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC1C;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,2BAA2B,CAAA;IAClC,WAAW,CAAC,EAAE,iCAAiC,CAAA;IAC/C,UAAU,CAAC,EAAE,iCAAiC,CAAA;IAC9C,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAA;IAC7C,YAAY,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACpC,sBAAsB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAC9C,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC1C"}
@@ -2,19 +2,19 @@ import { PromotionDTO } from "@medusajs/types";
2
2
  import { Promotion } from "../models";
3
3
  export interface CreateCampaignDTO {
4
4
  name: string;
5
- description?: string;
5
+ description?: string | null;
6
6
  campaign_identifier: string;
7
- starts_at?: Date;
8
- ends_at?: Date;
7
+ starts_at?: Date | null;
8
+ ends_at?: Date | null;
9
9
  promotions?: (PromotionDTO | Promotion)[];
10
10
  }
11
11
  export interface UpdateCampaignDTO {
12
12
  id: string;
13
13
  name?: string;
14
- description?: string;
14
+ description?: string | null;
15
15
  campaign_identifier?: string;
16
- starts_at?: Date;
17
- ends_at?: Date;
16
+ starts_at?: Date | null;
17
+ ends_at?: Date | null;
18
18
  promotions?: (PromotionDTO | Promotion)[];
19
19
  }
20
20
  //# sourceMappingURL=campaign.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/types/campaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,MAAM,WAAW,iB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AS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAA;CAC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/promotion",
3
- "version": "0.0.5-snapshot-20240607093839",
3
+ "version": "0.0.5-snapshot-20240701122250",
4
4
  "description": "Medusa Promotion module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,10 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "engines": {
11
- "node": ">=16"
12
- },
13
- "bin": {
14
- "medusa-promotion-seed": "dist/scripts/bin/run-seed.js"
11
+ "node": ">=20"
15
12
  },
16
13
  "repository": {
17
14
  "type": "git",
@@ -37,11 +34,11 @@
37
34
  "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
38
35
  },
39
36
  "devDependencies": {
40
- "@medusajs/types": "1.12.0-snapshot-20240607093839",
37
+ "@medusajs/types": "1.12.0-snapshot-20240701122250",
41
38
  "@mikro-orm/cli": "5.9.7",
42
39
  "cross-env": "^5.2.1",
43
- "jest": "^29.6.3",
44
- "medusa-test-utils": "1.1.45-snapshot-20240607093839",
40
+ "jest": "^29.7.0",
41
+ "medusa-test-utils": "1.1.45-snapshot-20240701122250",
45
42
  "rimraf": "^3.0.2",
46
43
  "ts-jest": "^29.1.1",
47
44
  "ts-node": "^10.9.1",
@@ -49,8 +46,8 @@
49
46
  "typescript": "^5.1.6"
50
47
  },
51
48
  "dependencies": {
52
- "@medusajs/modules-sdk": "1.13.0-snapshot-20240607093839",
53
- "@medusajs/utils": "1.12.0-snapshot-20240607093839",
49
+ "@medusajs/modules-sdk": "1.13.0-snapshot-20240701122250",
50
+ "@medusajs/utils": "1.12.0-snapshot-20240701122250",
54
51
  "@mikro-orm/core": "5.9.7",
55
52
  "@mikro-orm/migrations": "5.9.7",
56
53
  "@mikro-orm/postgresql": "5.9.7",
@@ -1,3 +0,0 @@
1
- import { ModuleExports } from "@medusajs/types";
2
- export declare const moduleDefinition: ModuleExports;
3
- //# sourceMappingURL=module-definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-definition.d.ts","sourceRoot":"","sources":["../src/module-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAK/C,eAAO,MAAM,gBAAgB,EAAE,aAE9B,CAAA"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moduleDefinition = void 0;
4
- const _services_1 = require("./services");
5
- const service = _services_1.PromotionModuleService;
6
- exports.moduleDefinition = {
7
- service,
8
- };
@@ -1,2 +0,0 @@
1
- export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseRepository = void 0;
4
- var utils_1 = require("@medusajs/utils");
5
- Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return utils_1.MikroOrmBaseRepository; } });