@medusajs/promotion 0.0.6 → 1.0.0-rc-20241003153304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. package/dist/index.d.ts +5 -4
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -20
  4. package/dist/index.js.map +1 -0
  5. package/dist/joiner-config.d.ts +1 -8
  6. package/dist/joiner-config.d.ts.map +1 -1
  7. package/dist/joiner-config.js +11 -36
  8. package/dist/joiner-config.js.map +1 -0
  9. package/dist/migrations/Migration20240227120221.d.ts.map +1 -1
  10. package/dist/migrations/Migration20240227120221.js +11 -2
  11. package/dist/migrations/Migration20240227120221.js.map +1 -0
  12. package/dist/migrations/Migration20240617102917.d.ts +6 -0
  13. package/dist/migrations/Migration20240617102917.d.ts.map +1 -0
  14. package/dist/migrations/Migration20240617102917.js +16 -0
  15. package/dist/migrations/Migration20240617102917.js.map +1 -0
  16. package/dist/migrations/Migration20240624153824.d.ts +6 -0
  17. package/dist/migrations/Migration20240624153824.d.ts.map +1 -0
  18. package/dist/migrations/Migration20240624153824.js +16 -0
  19. package/dist/migrations/Migration20240624153824.js.map +1 -0
  20. package/dist/models/application-method.d.ts +5 -7
  21. package/dist/models/application-method.d.ts.map +1 -1
  22. package/dist/models/application-method.js +18 -7
  23. package/dist/models/application-method.js.map +1 -0
  24. package/dist/models/campaign-budget.d.ts +8 -7
  25. package/dist/models/campaign-budget.d.ts.map +1 -1
  26. package/dist/models/campaign-budget.js +10 -5
  27. package/dist/models/campaign-budget.js.map +1 -0
  28. package/dist/models/campaign.d.ts +4 -5
  29. package/dist/models/campaign.d.ts.map +1 -1
  30. package/dist/models/campaign.js +12 -14
  31. package/dist/models/campaign.js.map +1 -0
  32. package/dist/models/index.js +1 -0
  33. package/dist/models/index.js.map +1 -0
  34. package/dist/models/promotion-rule-value.d.ts +2 -1
  35. package/dist/models/promotion-rule-value.d.ts.map +1 -1
  36. package/dist/models/promotion-rule-value.js +3 -2
  37. package/dist/models/promotion-rule-value.js.map +1 -0
  38. package/dist/models/promotion-rule.d.ts +2 -2
  39. package/dist/models/promotion-rule.d.ts.map +1 -1
  40. package/dist/models/promotion-rule.js +2 -1
  41. package/dist/models/promotion-rule.js.map +1 -0
  42. package/dist/models/promotion.d.ts +6 -5
  43. package/dist/models/promotion.d.ts.map +1 -1
  44. package/dist/models/promotion.js +10 -5
  45. package/dist/models/promotion.js.map +1 -0
  46. package/dist/schema/index.d.ts +3 -0
  47. package/dist/schema/index.d.ts.map +1 -0
  48. package/dist/schema/index.js +99 -0
  49. package/dist/schema/index.js.map +1 -0
  50. package/dist/services/index.js +1 -0
  51. package/dist/services/index.js.map +1 -0
  52. package/dist/services/promotion-module.d.ts +41 -26
  53. package/dist/services/promotion-module.d.ts.map +1 -1
  54. package/dist/services/promotion-module.js +293 -100
  55. package/dist/services/promotion-module.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -0
  57. package/dist/types/application-method.d.ts +12 -10
  58. package/dist/types/application-method.d.ts.map +1 -1
  59. package/dist/types/application-method.js +1 -0
  60. package/dist/types/application-method.js.map +1 -0
  61. package/dist/types/campaign-budget.d.ts +8 -6
  62. package/dist/types/campaign-budget.d.ts.map +1 -1
  63. package/dist/types/campaign-budget.js +1 -0
  64. package/dist/types/campaign-budget.js.map +1 -0
  65. package/dist/types/campaign.d.ts +7 -9
  66. package/dist/types/campaign.d.ts.map +1 -1
  67. package/dist/types/campaign.js +1 -0
  68. package/dist/types/campaign.js.map +1 -0
  69. package/dist/types/index.d.ts +1 -1
  70. package/dist/types/index.d.ts.map +1 -1
  71. package/dist/types/index.js +1 -0
  72. package/dist/types/index.js.map +1 -0
  73. package/dist/types/promotion-rule-value.d.ts +1 -1
  74. package/dist/types/promotion-rule-value.d.ts.map +1 -1
  75. package/dist/types/promotion-rule-value.js +1 -0
  76. package/dist/types/promotion-rule-value.js.map +1 -0
  77. package/dist/types/promotion-rule.d.ts +1 -1
  78. package/dist/types/promotion-rule.d.ts.map +1 -1
  79. package/dist/types/promotion-rule.js +1 -0
  80. package/dist/types/promotion-rule.js.map +1 -0
  81. package/dist/types/promotion.d.ts +3 -3
  82. package/dist/types/promotion.d.ts.map +1 -1
  83. package/dist/types/promotion.js +1 -0
  84. package/dist/types/promotion.js.map +1 -0
  85. package/dist/utils/compute-actions/buy-get.d.ts +6 -3
  86. package/dist/utils/compute-actions/buy-get.d.ts.map +1 -1
  87. package/dist/utils/compute-actions/buy-get.js +98 -34
  88. package/dist/utils/compute-actions/buy-get.js.map +1 -0
  89. package/dist/utils/compute-actions/index.js +1 -0
  90. package/dist/utils/compute-actions/index.js.map +1 -0
  91. package/dist/utils/compute-actions/line-items.d.ts +2 -2
  92. package/dist/utils/compute-actions/line-items.d.ts.map +1 -1
  93. package/dist/utils/compute-actions/line-items.js +10 -10
  94. package/dist/utils/compute-actions/line-items.js.map +1 -0
  95. package/dist/utils/compute-actions/shipping-methods.d.ts +3 -3
  96. package/dist/utils/compute-actions/shipping-methods.d.ts.map +1 -1
  97. package/dist/utils/compute-actions/shipping-methods.js +20 -22
  98. package/dist/utils/compute-actions/shipping-methods.js.map +1 -0
  99. package/dist/utils/compute-actions/usage.d.ts +2 -3
  100. package/dist/utils/compute-actions/usage.d.ts.map +1 -1
  101. package/dist/utils/compute-actions/usage.js +6 -13
  102. package/dist/utils/compute-actions/usage.js.map +1 -0
  103. package/dist/utils/index.js +1 -0
  104. package/dist/utils/index.js.map +1 -0
  105. package/dist/utils/validations/application-method.d.ts.map +1 -1
  106. package/dist/utils/validations/application-method.js +6 -5
  107. package/dist/utils/validations/application-method.js.map +1 -0
  108. package/dist/utils/validations/index.js +1 -0
  109. package/dist/utils/validations/index.js.map +1 -0
  110. package/dist/utils/validations/promotion-rule.d.ts +2 -2
  111. package/dist/utils/validations/promotion-rule.d.ts.map +1 -1
  112. package/dist/utils/validations/promotion-rule.js +27 -7
  113. package/dist/utils/validations/promotion-rule.js.map +1 -0
  114. package/package.json +25 -26
  115. package/dist/initialize/index.d.ts +0 -5
  116. package/dist/initialize/index.d.ts.map +0 -1
  117. package/dist/initialize/index.js +0 -16
  118. package/dist/loaders/connection.d.ts +0 -5
  119. package/dist/loaders/connection.d.ts.map +0 -1
  120. package/dist/loaders/connection.js +0 -41
  121. package/dist/loaders/container.d.ts +0 -3
  122. package/dist/loaders/container.d.ts.map +0 -1
  123. package/dist/loaders/container.js +0 -34
  124. package/dist/loaders/index.d.ts +0 -3
  125. package/dist/loaders/index.d.ts.map +0 -1
  126. package/dist/loaders/index.js +0 -18
  127. package/dist/module-definition.d.ts +0 -5
  128. package/dist/module-definition.d.ts.map +0 -1
  129. package/dist/module-definition.js +0 -50
  130. package/dist/repositories/campaign.d.ts +0 -16
  131. package/dist/repositories/campaign.d.ts.map +0 -1
  132. package/dist/repositories/campaign.js +0 -90
  133. package/dist/repositories/index.d.ts +0 -3
  134. package/dist/repositories/index.d.ts.map +0 -1
  135. package/dist/repositories/index.js +0 -7
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { moduleDefinition, revertMigration, runMigrations } from "./module-definition";
2
- export default moduleDefinition;
3
- export { revertMigration, runMigrations };
4
- export * from "./initialize";
1
+ import { PromotionModuleService } from "./services";
2
+ declare const _default: import("@medusajs/types").ModuleExports<typeof PromotionModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,qBAAqB,CAAA;AAE5B,eAAe,gBAAgB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAEzC,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;;;;AAElD,wBAEE"}
package/dist/index.js CHANGED
@@ -1,22 +1,8 @@
1
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.runMigrations = exports.revertMigration = void 0;
18
- const module_definition_1 = require("./module-definition");
19
- Object.defineProperty(exports, "revertMigration", { enumerable: true, get: function () { return module_definition_1.revertMigration; } });
20
- Object.defineProperty(exports, "runMigrations", { enumerable: true, get: function () { return module_definition_1.runMigrations; } });
21
- exports.default = module_definition_1.moduleDefinition;
22
- __exportStar(require("./initialize"), exports);
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const _services_1 = require("./services");
5
+ exports.default = (0, utils_1.Module)(utils_1.Modules.PROMOTION, {
6
+ service: _services_1.PromotionModuleService,
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qDAA2D;AAC3D,yCAAkD;AAElD,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,SAAS,EAAE;IACvC,OAAO,EAAE,kCAAsB;CAChC,CAAC,CAAA"}
@@ -1,9 +1,2 @@
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
+ export declare const joinerConfig: Omit<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys"> & Required<Pick<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys">>;
9
2
  //# 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":"AAIA,eAAO,MAAM,YAAY,uOAGvB,CAAA"}
@@ -1,39 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  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 utils_1 = require("@medusajs/utils");
6
+ exports.joinerConfig = void 0;
7
+ const utils_1 = require("@medusajs/framework/utils");
6
8
  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
- };
9
+ const schema_1 = __importDefault(require("./schema"));
10
+ exports.joinerConfig = (0, utils_1.defineJoinerConfig)(utils_1.Modules.PROMOTION, {
11
+ schema: schema_1.default,
12
+ models: [_models_1.Promotion, _models_1.Campaign, _models_1.PromotionRule],
13
+ });
14
+ //# sourceMappingURL=joiner-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joiner-config.js","sourceRoot":"","sources":["../src/joiner-config.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAuE;AACvE,qCAA4D;AAC5D,sDAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,0BAAkB,EAAC,eAAO,CAAC,SAAS,EAAE;IAChE,MAAM,EAAN,gBAAM;IACN,MAAM,EAAE,CAAC,mBAAS,EAAE,kBAAQ,EAAE,uBAAa,CAAC;CAC7C,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Migration20240227120221.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240227120221.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAiH1B"}
1
+ {"version":3,"file":"Migration20240227120221.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240227120221.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAiJ1B"}
@@ -4,9 +4,9 @@ exports.Migration20240227120221 = void 0;
4
4
  const migrations_1 = require("@mikro-orm/migrations");
5
5
  class Migration20240227120221 extends migrations_1.Migration {
6
6
  async up() {
7
- this.addSql('create table if not exists "promotion_campaign" ("id" text not null, "name" text not null, "description" text null, "currency" text null, "campaign_identifier" text not null, "starts_at" timestamptz null, "ends_at" timestamptz null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "promotion_campaign_pkey" primary key ("id"));');
7
+ this.addSql('create table if not exists "promotion_campaign" ("id" text not null, "name" text not null, "description" text null, "campaign_identifier" text not null, "starts_at" timestamptz null, "ends_at" timestamptz null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "promotion_campaign_pkey" primary key ("id"));');
8
8
  this.addSql('alter table if exists "promotion_campaign" add constraint "IDX_campaign_identifier_unique" unique ("campaign_identifier");');
9
- this.addSql('create table if not exists "promotion_campaign_budget" ("id" text not null, "type" text check ("type" in (\'spend\', \'usage\')) not null, "campaign_id" text not null, "limit" numeric null, "raw_limit" jsonb null, "used" numeric null, "raw_used" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "promotion_campaign_budget_pkey" primary key ("id"));');
9
+ this.addSql('create table if not exists "promotion_campaign_budget" ("id" text not null, "type" text check ("type" in (\'spend\', \'usage\')) not null, "campaign_id" text not null, "limit" numeric null, "raw_limit" jsonb null, "used" numeric not null default 0, "raw_used" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "promotion_campaign_budget_pkey" primary key ("id"));');
10
10
  this.addSql('create index if not exists "IDX_campaign_budget_type" on "promotion_campaign_budget" ("type");');
11
11
  this.addSql('alter table if exists "promotion_campaign_budget" add constraint "promotion_campaign_budget_campaign_id_unique" unique ("campaign_id");');
12
12
  this.addSql('create table if not exists "promotion" ("id" text not null, "code" text not null, "campaign_id" text null, "is_automatic" boolean not null default false, "type" text check ("type" in (\'standard\', \'buyget\')) not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "promotion_pkey" primary key ("id"));');
@@ -36,6 +36,15 @@ class Migration20240227120221 extends migrations_1.Migration {
36
36
  this.addSql('alter table if exists "application_method_buy_rules" add constraint "application_method_buy_rules_application_method_id_foreign" foreign key ("application_method_id") references "promotion_application_method" ("id") on update cascade on delete cascade;');
37
37
  this.addSql('alter table if exists "application_method_buy_rules" add constraint "application_method_buy_rules_promotion_rule_id_foreign" foreign key ("promotion_rule_id") references "promotion_rule" ("id") on update cascade on delete cascade;');
38
38
  this.addSql('alter table if exists "promotion_rule_value" add constraint "promotion_rule_value_promotion_rule_id_foreign" foreign key ("promotion_rule_id") references "promotion_rule" ("id") on update cascade on delete cascade;');
39
+ this.addSql('alter table if exists "promotion" drop constraint if exists "promotion_campaign_id_foreign";');
40
+ this.addSql('alter table if exists "promotion" add constraint "promotion_campaign_id_foreign" foreign key ("campaign_id") references "promotion_campaign" ("id") on update cascade on delete set null;');
41
+ this.addSql('alter table if exists "promotion_application_method" add column if not exists "currency_code" text not null;');
42
+ this.addSql('CREATE INDEX IF NOT EXISTS "IDX_promotion_application_method_currency_code" ON "promotion_application_method" (currency_code) WHERE deleted_at IS NOT NULL;');
43
+ this.addSql('alter table "promotion_application_method" alter column "value" type numeric using ("value"::numeric);');
44
+ this.addSql('alter table "promotion_application_method" alter column "raw_value" type jsonb using ("raw_value"::jsonb);');
45
+ this.addSql('alter table "promotion_application_method" alter column "raw_value" set not null;');
46
+ this.addSql('alter table if exists "promotion_campaign_budget" add column if not exists "currency_code" text null;');
39
47
  }
40
48
  }
41
49
  exports.Migration20240227120221 = Migration20240227120221;
50
+ //# sourceMappingURL=Migration20240227120221.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240227120221.js","sourceRoot":"","sources":["../../src/migrations/Migration20240227120221.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,+YAA+Y,CAChZ,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4HAA4H,CAC7H,CAAA;QAED,IAAI,CAAC,MAAM,CACT,udAAud,CACxd,CAAA;QACD,IAAI,CAAC,MAAM,CACT,gGAAgG,CACjG,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yIAAyI,CAC1I,CAAA;QAED,IAAI,CAAC,MAAM,CACT,gZAAgZ,CACjZ,CAAA;QACD,IAAI,CAAC,MAAM,CACT,0EAA0E,CAC3E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,0EAA0E,CAC3E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,+FAA+F,CAChG,CAAA;QAED,IAAI,CAAC,MAAM,CACT,qrBAAqrB,CACtrB,CAAA;QACD,IAAI,CAAC,MAAM,CACT,sGAAsG,CACvG,CAAA;QACD,IAAI,CAAC,MAAM,CACT,oHAAoH,CACrH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,kHAAkH,CACnH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,iJAAiJ,CAClJ,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wZAAwZ,CACzZ,CAAA;QACD,IAAI,CAAC,MAAM,CACT,8FAA8F,CAC/F,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4FAA4F,CAC7F,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wNAAwN,CACzN,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wPAAwP,CACzP,CAAA;QAED,IAAI,CAAC,MAAM,CACT,kPAAkP,CACnP,CAAA;QAED,IAAI,CAAC,MAAM,CACT,+TAA+T,CAChU,CAAA;QACD,IAAI,CAAC,MAAM,CACT,0HAA0H,CAC3H,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wMAAwM,CACzM,CAAA;QAED,IAAI,CAAC,MAAM,CACT,yKAAyK,CAC1K,CAAA;QAED,IAAI,CAAC,MAAM,CACT,yNAAyN,CAC1N,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iNAAiN,CAClN,CAAA;QACD,IAAI,CAAC,MAAM,CACT,gOAAgO,CACjO,CAAA;QAED,IAAI,CAAC,MAAM,CACT,oQAAoQ,CACrQ,CAAA;QACD,IAAI,CAAC,MAAM,CACT,8OAA8O,CAC/O,CAAA;QAED,IAAI,CAAC,MAAM,CACT,8PAA8P,CAC/P,CAAA;QACD,IAAI,CAAC,MAAM,CACT,wOAAwO,CACzO,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wNAAwN,CACzN,CAAA;QAED,IAAI,CAAC,MAAM,CACT,8FAA8F,CAC/F,CAAA;QAED,IAAI,CAAC,MAAM,CACT,2LAA2L,CAC5L,CAAA;QAED,IAAI,CAAC,MAAM,CACT,8GAA8G,CAC/G,CAAA;QAED,IAAI,CAAC,MAAM,CACT,6JAA6J,CAC9J,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wGAAwG,CACzG,CAAA;QAED,IAAI,CAAC,MAAM,CACT,4GAA4G,CAC7G,CAAA;QAED,IAAI,CAAC,MAAM,CACT,mFAAmF,CACpF,CAAA;QAED,IAAI,CAAC,MAAM,CACT,uGAAuG,CACxG,CAAA;IACH,CAAC;CACF;AAlJD,0DAkJC"}
@@ -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,16 @@
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;
16
+ //# sourceMappingURL=Migration20240617102917.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240617102917.js","sourceRoot":"","sources":["../../src/migrations/Migration20240617102917.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,kHAAkH,CACnH,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wFAAwF,CACzF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT,kHAAkH,CACnH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,uFAAuF,CACxF,CAAA;IACH,CAAC;CACF;AAnBD,0DAmBC"}
@@ -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,16 @@
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;
16
+ //# sourceMappingURL=Migration20240624153824.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240624153824.js","sourceRoot":"","sources":["../../src/migrations/Migration20240624153824.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,wGAAwG,CACzG,CAAA;QACD,IAAI,CAAC,MAAM,CACT,+JAA+J,CAChK,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT,2EAA2E,CAC5E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4HAA4H,CAC7H,CAAA;IACH,CAAC;CACF;AAlBD,0DAkBC"}
@@ -1,21 +1,20 @@
1
- import { ApplicationMethodAllocationValues, ApplicationMethodTargetTypeValues, ApplicationMethodTypeValues, BigNumberRawValue, DAL } from "@medusajs/types";
2
- import { BigNumber } from "@medusajs/utils";
3
- import { Collection, OptionalProps } from "@mikro-orm/core";
1
+ import { ApplicationMethodAllocationValues, ApplicationMethodTargetTypeValues, ApplicationMethodTypeValues, BigNumberRawValue } from "@medusajs/framework/types";
2
+ import { BigNumber } from "@medusajs/framework/utils";
3
+ import { Collection, Rel } from "@mikro-orm/core";
4
4
  import Promotion from "./promotion";
5
5
  import PromotionRule from "./promotion-rule";
6
- type OptionalFields = "value" | "max_quantity" | "apply_to_quantity" | "buy_rules_min_quantity" | "allocation" | DAL.SoftDeletableEntityDateColumns;
7
6
  export default class ApplicationMethod {
8
- [OptionalProps]?: OptionalFields;
9
7
  id: string;
10
8
  value: BigNumber | number | null;
11
9
  raw_value: BigNumberRawValue | null;
10
+ currency_code: string | null;
12
11
  max_quantity?: number | null;
13
12
  apply_to_quantity?: number | null;
14
13
  buy_rules_min_quantity?: number | null;
15
14
  type: ApplicationMethodTypeValues;
16
15
  target_type: ApplicationMethodTargetTypeValues;
17
16
  allocation?: ApplicationMethodAllocationValues;
18
- promotion: Promotion;
17
+ promotion: Rel<Promotion>;
19
18
  target_rules: Collection<PromotionRule, object>;
20
19
  buy_rules: Collection<PromotionRule, object>;
21
20
  created_at: Date;
@@ -24,5 +23,4 @@ export default class ApplicationMethod {
24
23
  onCreate(): void;
25
24
  onInit(): void;
26
25
  }
27
- export {};
28
26
  //# sourceMappingURL=application-method.d.ts.map
@@ -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,EACjB,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO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AAG,EACJ,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,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAOzB,YAAY,oCAA2C;IAOvD,SAAS,oCAA2C;IAOpD,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -12,14 +12,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const utils_1 = require("@medusajs/utils");
15
+ const utils_1 = require("@medusajs/framework/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const promotion_1 = __importDefault(require("./promotion"));
18
18
  const promotion_rule_1 = __importDefault(require("./promotion-rule"));
19
+ const tableName = "promotion_application_method";
20
+ const CurrencyCodeIndex = (0, utils_1.createPsqlIndexStatementHelper)({
21
+ tableName,
22
+ columns: "currency_code",
23
+ where: "deleted_at IS NOT NULL",
24
+ });
19
25
  let ApplicationMethod = class ApplicationMethod {
20
26
  constructor() {
21
- this.value = null;
22
- this.raw_value = null;
27
+ this.currency_code = null;
23
28
  this.max_quantity = null;
24
29
  this.apply_to_quantity = null;
25
30
  this.buy_rules_min_quantity = null;
@@ -39,13 +44,18 @@ __decorate([
39
44
  __metadata("design:type", String)
40
45
  ], ApplicationMethod.prototype, "id", void 0);
41
46
  __decorate([
42
- (0, utils_1.MikroOrmBigNumberProperty)({ nullable: true }),
47
+ (0, utils_1.MikroOrmBigNumberProperty)(),
43
48
  __metadata("design:type", Object)
44
49
  ], ApplicationMethod.prototype, "value", void 0);
45
50
  __decorate([
46
- (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
51
+ (0, core_1.Property)({ columnType: "jsonb" }),
47
52
  __metadata("design:type", Object)
48
53
  ], ApplicationMethod.prototype, "raw_value", void 0);
54
+ __decorate([
55
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
56
+ CurrencyCodeIndex.MikroORMIndex(),
57
+ __metadata("design:type", Object)
58
+ ], ApplicationMethod.prototype, "currency_code", void 0);
49
59
  __decorate([
50
60
  (0, core_1.Property)({ columnType: "numeric", nullable: true, serializer: Number }),
51
61
  __metadata("design:type", Object)
@@ -81,7 +91,7 @@ __decorate([
81
91
  entity: () => promotion_1.default,
82
92
  onDelete: "cascade",
83
93
  }),
84
- __metadata("design:type", promotion_1.default)
94
+ __metadata("design:type", Object)
85
95
  ], ApplicationMethod.prototype, "promotion", void 0);
86
96
  __decorate([
87
97
  (0, core_1.ManyToMany)(() => promotion_rule_1.default, "method_target_rules", {
@@ -133,7 +143,8 @@ __decorate([
133
143
  __metadata("design:returntype", void 0)
134
144
  ], ApplicationMethod.prototype, "onInit", null);
135
145
  ApplicationMethod = __decorate([
136
- (0, core_1.Entity)({ tableName: "promotion_application_method" }),
146
+ (0, core_1.Entity)({ tableName }),
137
147
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
138
148
  ], ApplicationMethod);
139
149
  exports.default = ApplicationMethod;
150
+ //# sourceMappingURL=application-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-method.js","sourceRoot":"","sources":["../../src/models/application-method.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAMA,qDAOkC;AAClC,0CAawB;AACxB,4DAAmC;AACnC,sEAA4C;AAE5C,MAAM,SAAS,GAAG,8BAA8B,CAAA;AAChD,MAAM,iBAAiB,GAAG,IAAA,sCAA8B,EAAC;IACvD,SAAS;IACT,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAIa,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAYb,kBAAa,GAAkB,IAAI,CAAA;QAGnC,iBAAY,GAAmB,IAAI,CAAA;QAGnC,sBAAiB,GAAmB,IAAI,CAAA;QAGxC,2BAAsB,GAAmB,IAAI,CAAA;QA4B7C,iBAAY,GAAG,IAAI,iBAAU,CAAqB,IAAI,CAAC,CAAA;QAOvD,cAAS,GAAG,IAAI,iBAAU,CAAqB,IAAI,CAAC,CAAA;QAkBpD,eAAU,GAAgB,IAAI,CAAA;IAWhC,CAAC;IARC,QAAQ;QACN,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAClD,CAAC;IAGD,MAAM;QACJ,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAClD,CAAC;CACF,CAAA;AAnFC;IADC,IAAA,iBAAU,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;;6CACxB;AAGX;IADC,IAAA,iCAAyB,GAAE;;gDACI;AAGhC;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;;oDACC;AAInC;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,Q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AC;;uDACqD;AAOvD;IALC,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,wBAAa,EAAE,kBAAkB,EAAE;QACnD,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,8BAA8B;QAC1C,OAAO,EAAE,CAAC,aAAa,CAAQ;KAChC,CAAC;;oDACkD;AAOpD;IALC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAGhB;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDAC1B;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;iDAGd;AAGD;IADC,IAAA,aAAM,GAAE;;;;+CAGR;AApFkB,iBAAiB;IAFrC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,CAAC;IACrB,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,iBAAiB,CAqFrC;kBArFoB,iBAAiB"}
@@ -1,17 +1,18 @@
1
- import { BigNumberRawValue, CampaignBudgetTypeValues, DAL } from "@medusajs/types";
2
- import { BigNumber } from "@medusajs/utils";
3
- import { OptionalProps } from "@mikro-orm/core";
1
+ import { BigNumberRawValue, CampaignBudgetTypeValues, DAL } from "@medusajs/framework/types";
2
+ import { BigNumber } from "@medusajs/framework/utils";
3
+ import { OptionalProps, Rel } from "@mikro-orm/core";
4
4
  import Campaign from "./campaign";
5
- type OptionalFields = "description" | "limit" | "used" | DAL.SoftDeletableEntityDateColumns;
5
+ type OptionalFields = "description" | "limit" | "used" | DAL.SoftDeletableModelDateColumns;
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
+ currency_code: string | null;
11
12
  limit: BigNumber | number | null;
12
13
  raw_limit: BigNumberRawValue | null;
13
- used: BigNumber | number | null;
14
- raw_used: BigNumberRawValue | null;
14
+ used: BigNumber | number;
15
+ raw_used: BigNumberRawValue;
15
16
  created_at: Date;
16
17
  updated_at: Date;
17
18
  deleted_at: Date | 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,wBAAwB,CAAA;IAK9B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAO;IAGhC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAO;IAGvC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAO;IAG1C,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAO;IAGtC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAO;IAOzC,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":"campaign-budget.d.ts","sourceRoot":"","sources":["../../src/models/campaign-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,GAAG,EACJ,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,SAAS,EAKV,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAQL,aAAa,EAGb,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,QAAQ,MAAM,YAAY,CAAA;AAEjC,KAAK,cAAc,GACf,aAAa,GACb,OAAO,GACP,MAAM,GACN,GAAG,CAAC,6BAA6B,CAAA;AAIrC,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAGhC,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAE,wBAAwB,CAAA;IAK9B,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAO;IAGrC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAO;IAGnC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAO;IAGvC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAO;IAG1C,IAAI,EAAE,SAAS,GAAG,MAAM,CAAI;IAG5B,QAAQ,EAAE,iBAAiB,CAAA;IAO3B,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -12,16 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const utils_1 = require("@medusajs/utils");
15
+ const utils_1 = require("@medusajs/framework/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const campaign_1 = __importDefault(require("./campaign"));
18
18
  let CampaignBudget = class CampaignBudget {
19
19
  constructor() {
20
20
  this.campaign = null;
21
+ this.currency_code = null;
21
22
  this.limit = null;
22
23
  this.raw_limit = null;
23
- this.used = null;
24
- this.raw_used = null;
24
+ this.used = 0;
25
25
  this.deleted_at = null;
26
26
  }
27
27
  onCreate() {
@@ -46,6 +46,10 @@ __decorate([
46
46
  }),
47
47
  __metadata("design:type", Object)
48
48
  ], CampaignBudget.prototype, "campaign", void 0);
49
+ __decorate([
50
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
51
+ __metadata("design:type", Object)
52
+ ], CampaignBudget.prototype, "currency_code", void 0);
49
53
  __decorate([
50
54
  (0, utils_1.MikroOrmBigNumberProperty)({ nullable: true }),
51
55
  __metadata("design:type", Object)
@@ -55,11 +59,11 @@ __decorate([
55
59
  __metadata("design:type", Object)
56
60
  ], CampaignBudget.prototype, "raw_limit", void 0);
57
61
  __decorate([
58
- (0, utils_1.MikroOrmBigNumberProperty)({ nullable: true }),
62
+ (0, utils_1.MikroOrmBigNumberProperty)({ default: 0 }),
59
63
  __metadata("design:type", Object)
60
64
  ], CampaignBudget.prototype, "used", void 0);
61
65
  __decorate([
62
- (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
66
+ (0, core_1.Property)({ columnType: "jsonb" }),
63
67
  __metadata("design:type", Object)
64
68
  ], CampaignBudget.prototype, "raw_used", void 0);
65
69
  __decorate([
@@ -100,3 +104,4 @@ CampaignBudget = __decorate([
100
104
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
101
105
  ], CampaignBudget);
102
106
  exports.default = CampaignBudget;
107
+ //# sourceMappingURL=campaign-budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign-budget.js","sourceRoot":"","sources":["../../src/models/campaign-budget.ts"],"names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CACd;AAG5B;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;;gDACP;AAO3B;IALC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;kDAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;kDAAA;AAGhB;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDAC1B;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;8CAGd;AAGD;IADC,IAAA,aAAM,GAAE;;;;4CAGR;AAxDkB,cAAc;IAFlC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,cAAc,CAyDlC;kBAzDoB,cAAc"}
@@ -1,19 +1,18 @@
1
- import { DAL } from "@medusajs/types";
2
- import { Collection, OptionalProps } from "@mikro-orm/core";
1
+ import { DAL } from "@medusajs/framework/types";
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";
6
- type OptionalFields = "description" | "currency" | "starts_at" | "ends_at" | DAL.SoftDeletableEntityDateColumns;
6
+ type OptionalFields = "description" | "starts_at" | "ends_at" | DAL.SoftDeletableModelDateColumns;
7
7
  export default class Campaign {
8
8
  [OptionalProps]?: OptionalFields | OptionalRelations;
9
9
  id: string;
10
10
  name: string;
11
11
  description: string | null;
12
- currency: string | null;
13
12
  campaign_identifier: string;
14
13
  starts_at: Date | null;
15
14
  ends_at: Date | null;
16
- budget: CampaignBudget | null;
15
+ budget: Rel<CampaignBudget> | null;
17
16
  promotions: Collection<Promotion, object>;
18
17
  created_at: Date;
19
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,UAAU,GACV,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;IAGjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAO;IAO9B,mBAAmB,EAAE,MAAM,CAAA;IAM3B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAO;IAM7B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAO;IAQ3B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAO;IAKpC,UAAU,gCAAkC;IAO5C,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":"campaign.d.ts","sourceRoot":"","sources":["../../src/models/campaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AAO/C,OAAO,EAEL,UAAU,EAMV,aAAa,EAGb,GAAG,EACJ,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,6BAA6B,CAAA;AAYrC,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;IAIjC,mBAAmB,EAAE,MAAM,CAAA;IAM3B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAO;IAM7B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAO;IAQ3B,MAAM,EAAE,GAAG,CAAC,cAAc,CAAC,GAAG,IAAI,CAAO;IAGzC,UAAU,gCAAuC;IAOjD,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -12,14 +12,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const utils_1 = require("@medusajs/utils");
15
+ const utils_1 = require("@medusajs/framework/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;
22
- this.currency = null;
23
29
  this.starts_at = null;
24
30
  this.ends_at = null;
25
31
  this.budget = null;
@@ -47,16 +53,9 @@ __decorate([
47
53
  (0, core_1.Property)({ columnType: "text", nullable: true }),
48
54
  __metadata("design:type", Object)
49
55
  ], Campaign.prototype, "description", void 0);
50
- __decorate([
51
- (0, core_1.Property)({ columnType: "text", nullable: true }),
52
- __metadata("design:type", Object)
53
- ], Campaign.prototype, "currency", void 0);
54
56
  __decorate([
55
57
  (0, core_1.Property)({ columnType: "text" }),
56
- (0, core_1.Unique)({
57
- name: "IDX_campaign_identifier_unique",
58
- properties: ["campaign_identifier"],
59
- }),
58
+ CampaignUniqueCampaignIdentifier.MikroORMIndex(),
60
59
  __metadata("design:type", String)
61
60
  ], Campaign.prototype, "campaign_identifier", void 0);
62
61
  __decorate([
@@ -83,9 +82,7 @@ __decorate([
83
82
  __metadata("design:type", Object)
84
83
  ], Campaign.prototype, "budget", void 0);
85
84
  __decorate([
86
- (0, core_1.OneToMany)(() => promotion_1.default, (promotion) => promotion.campaign, {
87
- orphanRemoval: true,
88
- }),
85
+ (0, core_1.OneToMany)(() => promotion_1.default, (promotion) => promotion.campaign),
89
86
  __metadata("design:type", Object)
90
87
  ], Campaign.prototype, "promotions", void 0);
91
88
  __decorate([
@@ -122,7 +119,8 @@ __decorate([
122
119
  __metadata("design:returntype", void 0)
123
120
  ], Campaign.prototype, "onInit", null);
124
121
  Campaign = __decorate([
125
- (0, core_1.Entity)({ tableName: "promotion_campaign" }),
122
+ (0, core_1.Entity)({ tableName }),
126
123
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
127
124
  ], Campaign);
128
125
  exports.default = Campaign;
126
+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AQ;IAF5B,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,CAAC;IACrB,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,QAAQ,CAoE5B;kBApEoB,QAAQ"}
@@ -16,3 +16,4 @@ var promotion_rule_1 = require("./promotion-rule");
16
16
  Object.defineProperty(exports, "PromotionRule", { enumerable: true, get: function () { return __importDefault(promotion_rule_1).default; } });
17
17
  var promotion_rule_value_1 = require("./promotion-rule-value");
18
18
  Object.defineProperty(exports, "PromotionRuleValue", { enumerable: true, get: function () { return __importDefault(promotion_rule_value_1).default; } });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAmE;AAA1D,wIAAA,OAAO,OAAqB;AACrC,uCAAgD;AAAvC,qHAAA,OAAO,OAAY;AAC5B,qDAA6D;AAApD,kIAAA,OAAO,OAAkB;AAClC,yCAAkD;AAAzC,uHAAA,OAAO,OAAa;AAC7B,mDAA2D;AAAlD,gIAAA,OAAO,OAAiB;AACjC,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB"}
@@ -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"}
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const utils_1 = require("@medusajs/utils");
15
+ const utils_1 = require("@medusajs/framework/utils");
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const promotion_rule_1 = __importDefault(require("./promotion-rule"));
18
18
  let PromotionRuleValue = class PromotionRuleValue {
@@ -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" }),
@@ -80,3 +80,4 @@ PromotionRuleValue = __decorate([
80
80
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
81
81
  ], PromotionRuleValue);
82
82
  exports.default = PromotionRuleValue;
83
+ //# sourceMappingURL=promotion-rule-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-rule-value.js","sourceRoot":"","sources":["../../src/models/promotion-rule-value.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDAAsE;AACtE,0CASwB;AACxB,sEAA4C;AAI7B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QA8Bb,eAAU,GAAgB,IAAI,CAAA;IAWhC,CAAC;IARC,QAAQ;QACN,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAClD,CAAC;IAGD,MAAM;QACJ,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAClD,CAAC;CACF,CAAA;AAvCC;IADC,IAAA,iBAAU,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;;8CACxB;AAOX;IALC,IAAA,gBAAS,EAAC,GAAG,EAAE,CAAC,wBAAa,EAAE;QAC9B,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,mBAAmB;QAC9B,KAAK,EAAE,4CAA4C;KACpD,CAAC;;0DACgC;AAGlC;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;;iDACpB;AAOb;IALC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;sDAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACp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