@medusajs/pricing 0.2.0-snapshot-20240429113131 → 1.0.0-rc-20241001083650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +6 -9
  4. package/dist/index.js.map +1 -0
  5. package/dist/joiner-config.d.ts +2 -10
  6. package/dist/joiner-config.d.ts.map +1 -0
  7. package/dist/joiner-config.js +6 -48
  8. package/dist/joiner-config.js.map +1 -0
  9. package/dist/migrations/Migration20230929122253.d.ts +1 -0
  10. package/dist/migrations/Migration20230929122253.d.ts.map +1 -0
  11. package/dist/migrations/Migration20230929122253.js +1 -0
  12. package/dist/migrations/Migration20230929122253.js.map +1 -0
  13. package/dist/migrations/Migration20240322094407.d.ts +1 -0
  14. package/dist/migrations/Migration20240322094407.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240322094407.js +1 -0
  16. package/dist/migrations/Migration20240322094407.js.map +1 -0
  17. package/dist/migrations/Migration20240322113359.d.ts +1 -0
  18. package/dist/migrations/Migration20240322113359.d.ts.map +1 -0
  19. package/dist/migrations/Migration20240322113359.js +1 -0
  20. package/dist/migrations/Migration20240322113359.js.map +1 -0
  21. package/dist/migrations/Migration20240322120125.d.ts +1 -0
  22. package/dist/migrations/Migration20240322120125.d.ts.map +1 -0
  23. package/dist/migrations/Migration20240322120125.js +1 -0
  24. package/dist/migrations/Migration20240322120125.js.map +1 -0
  25. package/dist/migrations/Migration20240626133555.d.ts +5 -0
  26. package/dist/migrations/Migration20240626133555.d.ts.map +1 -0
  27. package/dist/migrations/Migration20240626133555.js +34 -0
  28. package/dist/migrations/Migration20240626133555.js.map +1 -0
  29. package/dist/migrations/Migration20240704094505.d.ts +6 -0
  30. package/dist/migrations/Migration20240704094505.d.ts.map +1 -0
  31. package/dist/migrations/Migration20240704094505.js +16 -0
  32. package/dist/migrations/Migration20240704094505.js.map +1 -0
  33. package/dist/models/index.d.ts +2 -3
  34. package/dist/models/index.d.ts.map +1 -0
  35. package/dist/models/index.js +4 -7
  36. package/dist/models/index.js.map +1 -0
  37. package/dist/models/price-list-rule.d.ts +7 -9
  38. package/dist/models/price-list-rule.d.ts.map +1 -0
  39. package/dist/models/price-list-rule.js +10 -30
  40. package/dist/models/price-list-rule.js.map +1 -0
  41. package/dist/models/price-list.d.ts +4 -5
  42. package/dist/models/price-list.d.ts.map +1 -0
  43. package/dist/models/price-list.js +2 -10
  44. package/dist/models/price-list.js.map +1 -0
  45. package/dist/models/price-preference.d.ts +13 -0
  46. package/dist/models/price-preference.d.ts.map +1 -0
  47. package/dist/models/{rule-type.js → price-preference.js} +37 -41
  48. package/dist/models/price-preference.js.map +1 -0
  49. package/dist/models/price-rule.d.ts +6 -10
  50. package/dist/models/price-rule.d.ts.map +1 -0
  51. package/dist/models/price-rule.js +8 -46
  52. package/dist/models/price-rule.js.map +1 -0
  53. package/dist/models/price-set.d.ts +1 -4
  54. package/dist/models/price-set.d.ts.map +1 -0
  55. package/dist/models/price-set.js +2 -20
  56. package/dist/models/price-set.js.map +1 -0
  57. package/dist/models/price.d.ts +7 -6
  58. package/dist/models/price.d.ts.map +1 -0
  59. package/dist/models/price.js +7 -6
  60. package/dist/models/price.js.map +1 -0
  61. package/dist/repositories/index.d.ts +2 -1
  62. package/dist/repositories/index.d.ts.map +1 -0
  63. package/dist/repositories/index.js +2 -1
  64. package/dist/repositories/index.js.map +1 -0
  65. package/dist/repositories/pricing.d.ts +3 -2
  66. package/dist/repositories/pricing.d.ts.map +1 -0
  67. package/dist/repositories/pricing.js +41 -45
  68. package/dist/repositories/pricing.js.map +1 -0
  69. package/dist/schema/index.d.ts +2 -1
  70. package/dist/schema/index.d.ts.map +1 -0
  71. package/dist/schema/index.js +48 -4
  72. package/dist/schema/index.js.map +1 -0
  73. package/dist/services/index.d.ts +1 -2
  74. package/dist/services/index.d.ts.map +1 -0
  75. package/dist/services/index.js +2 -5
  76. package/dist/services/index.js.map +1 -0
  77. package/dist/services/pricing-module.d.ts +66 -53
  78. package/dist/services/pricing-module.d.ts.map +1 -0
  79. package/dist/services/pricing-module.js +625 -631
  80. package/dist/services/pricing-module.js.map +1 -0
  81. package/dist/tsconfig.tsbuildinfo +1 -0
  82. package/dist/types/index.d.ts +2 -1
  83. package/dist/types/index.d.ts.map +1 -0
  84. package/dist/types/index.js +1 -0
  85. package/dist/types/index.js.map +1 -0
  86. package/dist/types/services/index.d.ts +30 -2
  87. package/dist/types/services/index.d.ts.map +1 -0
  88. package/dist/types/services/index.js +1 -16
  89. package/dist/types/services/index.js.map +1 -0
  90. package/dist/utils/events.d.ts +83 -0
  91. package/dist/utils/events.d.ts.map +1 -0
  92. package/dist/utils/events.js +67 -0
  93. package/dist/utils/events.js.map +1 -0
  94. package/dist/utils/index.d.ts +2 -0
  95. package/dist/utils/index.d.ts.map +1 -0
  96. package/dist/utils/index.js +2 -0
  97. package/dist/utils/index.js.map +1 -0
  98. package/dist/utils/validate-price-list-dates.d.ts +1 -0
  99. package/dist/utils/validate-price-list-dates.d.ts.map +1 -0
  100. package/dist/utils/validate-price-list-dates.js +2 -1
  101. package/dist/utils/validate-price-list-dates.js.map +1 -0
  102. package/package.json +20 -21
  103. package/dist/initialize/index.d.ts +0 -4
  104. package/dist/initialize/index.js +0 -17
  105. package/dist/loaders/connection.d.ts +0 -4
  106. package/dist/loaders/connection.js +0 -40
  107. package/dist/loaders/container.d.ts +0 -2
  108. package/dist/loaders/container.js +0 -34
  109. package/dist/loaders/index.d.ts +0 -2
  110. package/dist/loaders/index.js +0 -18
  111. package/dist/models/price-list-rule-value.d.ts +0 -17
  112. package/dist/models/price-list-rule-value.js +0 -102
  113. package/dist/models/price-set-rule-type.d.ts +0 -10
  114. package/dist/models/price-set-rule-type.js +0 -108
  115. package/dist/models/rule-type.d.ts +0 -17
  116. package/dist/module-definition.d.ts +0 -4
  117. package/dist/module-definition.js +0 -50
  118. package/dist/scripts/bin/run-seed.d.ts +0 -3
  119. package/dist/scripts/bin/run-seed.js +0 -38
  120. package/dist/scripts/seed.d.ts +0 -4
  121. package/dist/scripts/seed.js +0 -67
  122. package/dist/services/price-list.d.ts +0 -16
  123. package/dist/services/price-list.js +0 -34
  124. package/dist/services/rule-type.d.ts +0 -15
  125. package/dist/services/rule-type.js +0 -53
  126. package/dist/types/services/price-list.d.ts +0 -18
  127. package/dist/types/services/price-list.js +0 -2
  128. package/dist/types/services/price-set.d.ts +0 -4
  129. package/dist/types/services/price-set.js +0 -2
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { moduleDefinition, revertMigration, runMigrations } from "./module-definition";
2
- export default moduleDefinition;
3
- export { revertMigration, runMigrations };
4
- export * from "./initialize";
5
- export * from "./models";
6
- export * from "./services";
1
+ import { PricingModuleService } from "./services";
2
+ declare const _default: import("@medusajs/types").ModuleExports<typeof PricingModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
7
6
  export * from "./types";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;;;;AAEhD,wBAEE;AAEF,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -14,13 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  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);
23
- // TODO: remove export from models and services
24
- __exportStar(require("./models"), exports);
25
- __exportStar(require("./services"), exports);
17
+ const utils_1 = require("@medusajs/framework/utils");
18
+ const _services_1 = require("./services");
19
+ exports.default = (0, utils_1.Module)(utils_1.Modules.PRICING, {
20
+ service: _services_1.PricingModuleService,
21
+ });
26
22
  __exportStar(require("./types"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAA2D;AAC3D,yCAAgD;AAEhD,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,OAAO,EAAE;IACrC,OAAO,EAAE,gCAAoB;CAC9B,CAAC,CAAA;AAEF,0CAAuB"}
@@ -1,10 +1,2 @@
1
- import { ModuleJoinerConfig } from "@medusajs/types";
2
- import { MapToConfig } from "@medusajs/utils";
3
- export declare const LinkableKeys: {
4
- price_set_id: string;
5
- price_list_id: string;
6
- price_id: string;
7
- rule_type_id: string;
8
- };
9
- export declare const entityNameToLinkableKeysMap: MapToConfig;
10
- 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">>;
2
+ //# sourceMappingURL=joiner-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joiner-config.d.ts","sourceRoot":"","sources":["../src/joiner-config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,uOAGvB,CAAA"}
@@ -3,54 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.joinerConfig = exports.entityNameToLinkableKeysMap = exports.LinkableKeys = void 0;
7
- const modules_sdk_1 = require("@medusajs/modules-sdk");
6
+ exports.joinerConfig = void 0;
7
+ const utils_1 = require("@medusajs/framework/utils");
8
8
  const _models_1 = require("./models");
9
9
  const schema_1 = __importDefault(require("./schema"));
10
- exports.LinkableKeys = {
11
- price_set_id: _models_1.PriceSet.name,
12
- price_list_id: _models_1.PriceList.name,
13
- price_id: _models_1.Price.name,
14
- rule_type_id: _models_1.RuleType.name,
15
- };
16
- const entityLinkableKeysMap = {};
17
- Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
18
- entityLinkableKeysMap[value] ?? (entityLinkableKeysMap[value] = []);
19
- entityLinkableKeysMap[value].push({
20
- mapTo: key,
21
- valueFrom: key.split("_").pop(),
22
- });
23
- });
24
- exports.entityNameToLinkableKeysMap = entityLinkableKeysMap;
25
- exports.joinerConfig = {
26
- serviceName: modules_sdk_1.Modules.PRICING,
27
- primaryKeys: ["id"],
28
- linkableKeys: exports.LinkableKeys,
10
+ exports.joinerConfig = (0, utils_1.defineJoinerConfig)(utils_1.Modules.PRICING, {
29
11
  schema: schema_1.default,
30
- alias: [
31
- {
32
- name: ["price_set", "price_sets"],
33
- args: {
34
- entity: "PriceSet",
35
- },
36
- },
37
- {
38
- name: ["price_list", "price_lists"],
39
- args: {
40
- methodSuffix: "PriceLists",
41
- },
42
- },
43
- {
44
- name: ["price", "prices"],
45
- args: {
46
- methodSuffix: "Prices",
47
- },
48
- },
49
- {
50
- name: ["rule_type", "rule_types"],
51
- args: {
52
- methodSuffix: "RuleTypes",
53
- },
54
- },
55
- ],
56
- };
12
+ models: [_models_1.PriceSet, _models_1.PriceList, _models_1.Price, _models_1.PricePreference],
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,qCAAqE;AACrE,sDAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,0BAAkB,EAAC,eAAO,CAAC,OAAO,EAAE;IAC9D,MAAM,EAAN,gBAAM;IACN,MAAM,EAAE,CAAC,kBAAQ,EAAE,mBAAS,EAAE,eAAK,EAAE,yBAAe,CAAC;CACtD,CAAC,CAAA"}
@@ -2,3 +2,4 @@ import { Migration } from "@mikro-orm/migrations";
2
2
  export declare class Migration20230929122253 extends Migration {
3
3
  up(): Promise<void>;
4
4
  }
5
+ //# sourceMappingURL=Migration20230929122253.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20230929122253.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20230929122253.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAkO1B"}
@@ -75,3 +75,4 @@ class Migration20230929122253 extends migrations_1.Migration {
75
75
  }
76
76
  }
77
77
  exports.Migration20230929122253 = Migration20230929122253;
78
+ //# sourceMappingURL=Migration20230929122253.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20230929122253.js","sourceRoot":"","sources":["../../src/migrations/Migration20230929122253.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,yWAAyW,CAC1W,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iOAAiO,CAClO,CAAA;QAED,IAAI,CAAC,MAAM,CACT,6WAA6W,CAC9W,CAAA;QAED,IAAI,CAAC,MAAM,CACT,+FAA+F,CAChG,CAAA;QAED,IAAI,CAAC,MAAM,CACT,sUAAsU,CACvU,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iTAAiT,CAClT,CAAA;QAED,IAAI,CAAC,MAAM,CACT,sZAAsZ,CACvZ,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iKAAiK,CAClK,CAAA;QACD,IAAI,CAAC,MAA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,CAAA;QAED,IAAI,CAAC,MAAM,CACT,mKAAmK,CACpK,CAAA;QAED,IAAI,CAAC,MAAM,CACT,yFAAyF,CAC1F,CAAA;QAED,IAAI,CAAC,MAAM,CAAC,mDAAmD,CAAC,CAAA;QAEhE,IAAI,CAAC,MAAM,CACT,mFAAmF,CACpF,CAAA;QAED,IAAI,CAAC,MAAM,CACT,2GAA2G,CAC5G,CAAA;IACH,CAAC;CACF;AAnOD,0DAmOC"}
@@ -3,3 +3,4 @@ export declare class Migration20240322094407 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322094407.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322094407.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322094407.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAE9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAInB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAM5B"}
@@ -13,3 +13,4 @@ class Migration20240322094407 extends migrations_1.Migration {
13
13
  }
14
14
  }
15
15
  exports.Migration20240322094407 = Migration20240322094407;
16
+ //# sourceMappingURL=Migration20240322094407.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322094407.js","sourceRoot":"","sources":["../../src/migrations/Migration20240322094407.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAElD,MAAa,uBAAwB,SAAQ,sBAAS;IAEpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CAAC,yWAAyW,CAAC,CAAC;QACvX,IAAI,CAAC,MAAM,CAAC,yHAAyH,CAAC,CAAC;QACvI,IAAI,CAAC,MAAM,CAAC,uHAAuH,CAAC,CAAC;IACvI,CAAC;CAEF;AAZD,0DAYC"}
@@ -3,3 +3,4 @@ export declare class Migration20240322113359 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322113359.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322113359.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322113359.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAcnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAa5B"}
@@ -17,3 +17,4 @@ class Migration20240322113359 extends migrations_1.Migration {
17
17
  }
18
18
  }
19
19
  exports.Migration20240322113359 = Migration20240322113359;
20
+ //# sourceMappingURL=Migration20240322113359.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322113359.js","sourceRoot":"","sources":["../../src/migrations/Migration20240322113359.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,6FAA6F,CAC9F,CAAA;QAED,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CACT,yKAAyK,CAC1K,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yHAAyH,CAC1H,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT,6FAA6F,CAC9F,CAAA;QAED,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CACT,yKAAyK,CAC1K,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yHAAyH,CAC1H,CAAA;IACH,CAAC;CACF;AA5BD,0DA4BC"}
@@ -3,3 +3,4 @@ export declare class Migration20240322120125 extends Migration {
3
3
  up(): Promise<void>;
4
4
  down(): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=Migration20240322120125.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322120125.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240322120125.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAOnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B"}
@@ -13,3 +13,4 @@ class Migration20240322120125 extends migrations_1.Migration {
13
13
  }
14
14
  }
15
15
  exports.Migration20240322120125 = Migration20240322120125;
16
+ //# sourceMappingURL=Migration20240322120125.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240322120125.js","sourceRoot":"","sources":["../../src/migrations/Migration20240322120125.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CACT,oJAAoJ,CACrJ,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT,qEAAqE,CACtE,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yHAAyH,CAC1H,CAAA;IACH,CAAC;CACF;AAhBD,0DAgBC"}
@@ -0,0 +1,5 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ export declare class Migration20240626133555 extends Migration {
3
+ up(): Promise<void>;
4
+ }
5
+ //# sourceMappingURL=Migration20240626133555.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240626133555.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240626133555.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAoE1B"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20240626133555 = void 0;
4
+ const migrations_1 = require("@mikro-orm/migrations");
5
+ class Migration20240626133555 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql('alter table if exists "price_list_rule" add column if not exists "value" jsonb;');
8
+ // TODO: Added on 28.06.2024, Drop defaults after a while.
9
+ this.addSql('alter table if exists "price_list_rule" add column if not exists "attribute" text not null DEFAULT \'\';');
10
+ this.addSql('alter table if exists "price_rule" add column if not exists "attribute" text not null DEFAULT \'\';');
11
+ /* DATA MIGRATION */
12
+ this.addSql("update price_rule set attribute = (SELECT rule_attribute FROM rule_type WHERE rule_type.id = price_rule.rule_type_id);");
13
+ this.addSql("update price_list_rule set value = (SELECT array_to_json(ARRAY(SELECT value FROM price_list_rule_value WHERE price_list_rule_value.price_list_rule_id = price_list_rule.id))::jsonb);");
14
+ this.addSql("update price_list_rule set attribute = (SELECT rule_attribute FROM rule_type WHERE rule_type.id = price_list_rule.rule_type_id);");
15
+ /* DATA MIGRATION END */
16
+ this.addSql('alter table if exists "price_set_rule_type" drop constraint if exists "price_set_rule_type_rule_type_id_foreign";');
17
+ this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_rule_type_id_foreign";');
18
+ this.addSql('alter table if exists "price_list_rule" drop constraint if exists "price_list_rule_rule_type_id_foreign";');
19
+ this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_price_set_id_foreign";');
20
+ this.addSql('drop index if exists "IDX_price_list_rule_rule_type_id_unique";');
21
+ this.addSql('drop index if exists "IDX_price_rule_price_set_id";');
22
+ this.addSql('drop index if exists "IDX_price_rule_rule_type_id";');
23
+ this.addSql('drop index if exists "IDX_price_rule_price_id_unique";');
24
+ this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_attribute_unique" ON "price_rule" (price_id, attribute) WHERE deleted_at IS NULL;');
25
+ this.addSql('alter table if exists "price_rule" drop column if exists "price_set_id";');
26
+ this.addSql('alter table if exists "price_rule" drop column if exists "rule_type_id";');
27
+ this.addSql('alter table if exists "price_list_rule" drop column if exists "rule_type_id";');
28
+ this.addSql('drop table if exists "rule_type" cascade;');
29
+ this.addSql('drop table if exists "price_set_rule_type" cascade;');
30
+ this.addSql('drop table if exists "price_list_rule_value" cascade;');
31
+ }
32
+ }
33
+ exports.Migration20240626133555 = Migration20240626133555;
34
+ //# sourceMappingURL=Migration20240626133555.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240626133555.js","sourceRoot":"","sources":["../../src/migrations/Migration20240626133555.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,iFAAiF,CAClF,CAAA;QAED,0DAA0D;QAC1D,IAAI,CAAC,MAAM,CACT,0GAA0G,CAC3G,CAAA;QAED,IAAI,CAAC,MAAM,CACT,qGAAqG,CACtG,CAAA;QAED,oBAAoB;QACpB,IAAI,CAAC,MAAM,CACT,wHAAwH,CACzH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,uLAAuL,CACxL,CAAA;QACD,IAAI,CAAC,MAAM,CACT,kIAAkI,CACnI,CAAA;QACD,wBAAwB;QAExB,IAAI,CAAC,MAAM,CACT,mHAAmH,CACpH,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iGAAiG,CAClG,CAAA;QAED,IAAI,CAAC,MAAM,CACT,2GAA2G,CAC5G,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iGAAiG,CAClG,CAAA;QAED,IAAI,CAAC,MAAM,CACT,iEAAiE,CAClE,CAAA;QACD,IAAI,CAAC,MAAM,CAAC,qDAAqD,CAAC,CAAA;QAClE,IAAI,CAAC,MAAM,CAAC,qDAAqD,CAAC,CAAA;QAClE,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CACT,8IAA8I,CAC/I,CAAA;QAED,IAAI,CAAC,MAAM,CACT,0EAA0E,CAC3E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,0EAA0E,CAC3E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,+EAA+E,CAChF,CAAA;QAED,IAAI,CAAC,MAAM,CAAC,2CAA2C,CAAC,CAAA;QAExD,IAAI,CAAC,MAAM,CAAC,qDAAqD,CAAC,CAAA;QAElE,IAAI,CAAC,MAAM,CAAC,uDAAuD,CAAC,CAAA;IACtE,CAAC;CACF;AArED,0DAqEC"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+ export declare class Migration20240704094505 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20240704094505.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240704094505.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240704094505.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,uBAAwB,SAAQ,SAAS;IAE9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAMnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAI5B"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20240704094505 = void 0;
4
+ const migrations_1 = require("@mikro-orm/migrations");
5
+ class Migration20240704094505 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql('create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));');
8
+ this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;');
9
+ this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;');
10
+ }
11
+ async down() {
12
+ this.addSql('drop table if exists "price_preference" cascade;');
13
+ }
14
+ }
15
+ exports.Migration20240704094505 = Migration20240704094505;
16
+ //# sourceMappingURL=Migration20240704094505.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240704094505.js","sourceRoot":"","sources":["../../src/migrations/Migration20240704094505.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAElD,MAAa,uBAAwB,SAAQ,sBAAS;IAEpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CAAC,8VAA8V,CAAC,CAAC;QAC5W,IAAI,CAAC,MAAM,CAAC,+HAA+H,CAAC,CAAC;QAC7I,IAAI,CAAC,MAAM,CAAC,6IAA6I,CAAC,CAAC;IAC7J,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;CAEF;AAZD,0DAYC"}
@@ -1,8 +1,7 @@
1
1
  export { default as Price } from "./price";
2
2
  export { default as PriceList } from "./price-list";
3
3
  export { default as PriceListRule } from "./price-list-rule";
4
- export { default as PriceListRuleValue } from "./price-list-rule-value";
5
4
  export { default as PriceRule } from "./price-rule";
6
5
  export { default as PriceSet } from "./price-set";
7
- export { default as PriceSetRuleType } from "./price-set-rule-type";
8
- export { default as RuleType } from "./rule-type";
6
+ export { default as PricePreference } from "./price-preference";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
@@ -3,20 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RuleType = exports.PriceSetRuleType = exports.PriceSet = exports.PriceRule = exports.PriceListRuleValue = exports.PriceListRule = exports.PriceList = exports.Price = void 0;
6
+ exports.PricePreference = exports.PriceSet = exports.PriceRule = exports.PriceListRule = exports.PriceList = exports.Price = void 0;
7
7
  var price_1 = require("./price");
8
8
  Object.defineProperty(exports, "Price", { enumerable: true, get: function () { return __importDefault(price_1).default; } });
9
9
  var price_list_1 = require("./price-list");
10
10
  Object.defineProperty(exports, "PriceList", { enumerable: true, get: function () { return __importDefault(price_list_1).default; } });
11
11
  var price_list_rule_1 = require("./price-list-rule");
12
12
  Object.defineProperty(exports, "PriceListRule", { enumerable: true, get: function () { return __importDefault(price_list_rule_1).default; } });
13
- var price_list_rule_value_1 = require("./price-list-rule-value");
14
- Object.defineProperty(exports, "PriceListRuleValue", { enumerable: true, get: function () { return __importDefault(price_list_rule_value_1).default; } });
15
13
  var price_rule_1 = require("./price-rule");
16
14
  Object.defineProperty(exports, "PriceRule", { enumerable: true, get: function () { return __importDefault(price_rule_1).default; } });
17
15
  var price_set_1 = require("./price-set");
18
16
  Object.defineProperty(exports, "PriceSet", { enumerable: true, get: function () { return __importDefault(price_set_1).default; } });
19
- var price_set_rule_type_1 = require("./price-set-rule-type");
20
- Object.defineProperty(exports, "PriceSetRuleType", { enumerable: true, get: function () { return __importDefault(price_set_rule_type_1).default; } });
21
- var rule_type_1 = require("./rule-type");
22
- Object.defineProperty(exports, "RuleType", { enumerable: true, get: function () { return __importDefault(rule_type_1).default; } });
17
+ var price_preference_1 = require("./price-preference");
18
+ Object.defineProperty(exports, "PricePreference", { enumerable: true, get: function () { return __importDefault(price_preference_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,iCAA0C;AAAjC,+GAAA,OAAO,OAAS;AACzB,2CAAmD;AAA1C,wHAAA,OAAO,OAAa;AAC7B,qDAA4D;AAAnD,iIAAA,OAAO,OAAiB;AACjC,2CAAmD;AAA1C,wHAAA,OAAO,OAAa;AAC7B,yCAAiD;AAAxC,sHAAA,OAAO,OAAY;AAC5B,uDAA+D;AAAtD,oIAAA,OAAO,OAAmB"}
@@ -1,17 +1,14 @@
1
- import { DAL } from "@medusajs/types";
2
- import { Collection, OptionalProps } from "@mikro-orm/core";
1
+ import { DAL } from "@medusajs/framework/types";
2
+ import { OptionalProps, Rel } from "@mikro-orm/core";
3
3
  import PriceList from "./price-list";
4
- import PriceListRuleValue from "./price-list-rule-value";
5
- import RuleType from "./rule-type";
6
- type OptionalFields = DAL.SoftDeletableEntityDateColumns;
4
+ type OptionalFields = DAL.SoftDeletableModelDateColumns;
7
5
  export default class PriceListRule {
8
6
  [OptionalProps]: OptionalFields;
9
7
  id: string;
10
- rule_type_id: string;
11
- rule_type: RuleType;
12
- price_list_rule_values: Collection<PriceListRuleValue, object>;
8
+ attribute: string;
9
+ value: string | string[] | null;
13
10
  price_list_id: string;
14
- price_list: PriceList;
11
+ price_list: Rel<PriceList>;
15
12
  created_at: Date;
16
13
  updated_at: Date;
17
14
  deleted_at: Date | null;
@@ -19,3 +16,4 @@ export default class PriceListRule {
19
16
  onInit(): void;
20
17
  }
21
18
  export {};
19
+ //# sourceMappingURL=price-list-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list-rule.d.ts","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AAM/C,OAAO,EAML,aAAa,EAGb,GAAG,EACJ,MAAM,iBAAiB,CAAA;AACxB,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,KAAK,cAAc,GAAG,GAAG,CAAC,6BAA6B,CAAA;AAiBvD,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,CAAC,aAAa,CAAC,EAAE,cAAc,CAAA;IAG/B,EAAE,EAAG,MAAM,CAAA;IAGX,SAAS,EAAE,MAAM,CAAA;IAGjB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAO;IAStC,aAAa,EAAE,MAAM,CAAA;IAGrB,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAO1B,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,YAAY;IAMZ,MAAM;CAIP"}
@@ -12,23 +12,15 @@ 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 price_list_1 = __importDefault(require("./price-list"));
18
- const price_list_rule_value_1 = __importDefault(require("./price-list-rule-value"));
19
- const rule_type_1 = __importDefault(require("./rule-type"));
20
18
  const tableName = "price_list_rule";
21
19
  const PriceListRuleDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
22
20
  tableName: tableName,
23
21
  columns: "deleted_at",
24
22
  where: "deleted_at IS NOT NULL",
25
23
  });
26
- const PriceListRuleRuleTypeIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
27
- tableName: tableName,
28
- columns: "rule_type_id",
29
- where: "deleted_at IS NULL",
30
- unique: true,
31
- });
32
24
  const PriceListRulePriceListIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
33
25
  tableName: tableName,
34
26
  columns: "price_list_id",
@@ -36,18 +28,16 @@ const PriceListRulePriceListIdIndex = (0, utils_1.createPsqlIndexStatementHelper
36
28
  });
37
29
  let PriceListRule = class PriceListRule {
38
30
  constructor() {
39
- this.price_list_rule_values = new core_1.Collection(this);
31
+ this.value = null;
40
32
  this.deleted_at = null;
41
33
  }
42
34
  beforeCreate() {
43
35
  this.id = (0, utils_1.generateEntityId)(this.id, "plrule");
44
- this.price_list_id ?? (this.price_list_id = this.price_list?.id);
45
- this.rule_type_id ?? (this.rule_type_id = this.rule_type?.id);
36
+ this.price_list_id ??= this.price_list?.id;
46
37
  }
47
38
  onInit() {
48
39
  this.id = (0, utils_1.generateEntityId)(this.id, "plrule");
49
- this.price_list_id ?? (this.price_list_id = this.price_list?.id);
50
- this.rule_type_id ?? (this.rule_type_id = this.rule_type?.id);
40
+ this.price_list_id ??= this.price_list?.id;
51
41
  }
52
42
  };
53
43
  __decorate([
@@ -55,24 +45,13 @@ __decorate([
55
45
  __metadata("design:type", String)
56
46
  ], PriceListRule.prototype, "id", void 0);
57
47
  __decorate([
58
- PriceListRuleRuleTypeIdIndex.MikroORMIndex(),
59
- (0, core_1.ManyToOne)(() => rule_type_1.default, {
60
- columnType: "text",
61
- mapToPk: true,
62
- fieldName: "rule_type_id",
63
- }),
48
+ (0, core_1.Property)({ columnType: "text" }),
64
49
  __metadata("design:type", String)
65
- ], PriceListRule.prototype, "rule_type_id", void 0);
66
- __decorate([
67
- (0, core_1.ManyToOne)(() => rule_type_1.default, { persist: false }),
68
- __metadata("design:type", rule_type_1.default)
69
- ], PriceListRule.prototype, "rule_type", void 0);
50
+ ], PriceListRule.prototype, "attribute", void 0);
70
51
  __decorate([
71
- (0, core_1.OneToMany)(() => price_list_rule_value_1.default, (plrv) => plrv.price_list_rule, {
72
- cascade: [core_1.Cascade.PERSIST, "soft-remove"],
73
- }),
52
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
74
53
  __metadata("design:type", Object)
75
- ], PriceListRule.prototype, "price_list_rule_values", void 0);
54
+ ], PriceListRule.prototype, "value", void 0);
76
55
  __decorate([
77
56
  PriceListRulePriceListIdIndex.MikroORMIndex(),
78
57
  (0, core_1.ManyToOne)(() => price_list_1.default, {
@@ -85,7 +64,7 @@ __decorate([
85
64
  ], PriceListRule.prototype, "price_list_id", void 0);
86
65
  __decorate([
87
66
  (0, core_1.ManyToOne)(() => price_list_1.default, { persist: false }),
88
- __metadata("design:type", price_list_1.default)
67
+ __metadata("design:type", Object)
89
68
  ], PriceListRule.prototype, "price_list", void 0);
90
69
  __decorate([
91
70
  (0, core_1.Property)({
@@ -126,3 +105,4 @@ PriceListRule = __decorate([
126
105
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
127
106
  ], PriceListRule);
128
107
  exports.default = PriceListRule;
108
+ //# sourceMappingURL=price-list-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list-rule.js","sourceRoot":"","sources":["../../src/models/price-list-rule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAIkC;AAClC,0CAUwB;AACxB,8DAAoC;AAIpC,MAAM,SAAS,GAAG,iBAAiB,CAAA;AACnC,MAAM,2BAA2B,GAAG,IAAA,sCAA8B,EAAC;IACjE,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,6BAA6B,GAAG,IAAA,sCAA8B,EAAC;IACnE,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,eA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aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;iDAAA;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;iDAAA;AAIhB;IAFC,2BAA2B,CAAC,aAAa,EAAE;IAC3C,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC1B;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;iDAId;AAGD;IADC,IAAA,aAAM,GAAE;;;;2CAIR;AArDkB,aAAa;IAFjC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,CAAC;IACrB,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,aAAa,CAsDjC;kBAtDoB,aAAa"}
@@ -1,10 +1,9 @@
1
- import { DAL } from "@medusajs/types";
2
- import { PriceListStatus, PriceListType } from "@medusajs/utils";
1
+ import { DAL } from "@medusajs/framework/types";
2
+ import { PriceListStatus, PriceListType } from "@medusajs/framework/utils";
3
3
  import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import Price from "./price";
5
5
  import PriceListRule from "./price-list-rule";
6
- import RuleType from "./rule-type";
7
- type OptionalFields = "starts_at" | "ends_at" | DAL.SoftDeletableEntityDateColumns;
6
+ type OptionalFields = "starts_at" | "ends_at" | DAL.SoftDeletableModelDateColumns;
8
7
  export declare const PriceListIdPrefix = "plist";
9
8
  export default class PriceList {
10
9
  [OptionalProps]: OptionalFields;
@@ -17,7 +16,6 @@ export default class PriceList {
17
16
  ends_at: Date | null;
18
17
  prices: Collection<Price, object>;
19
18
  price_list_rules: Collection<PriceListRule, object>;
20
- rule_types: Collection<RuleType, object>;
21
19
  rules_count: number;
22
20
  created_at: Date;
23
21
  updated_at: Date;
@@ -26,3 +24,4 @@ export default class PriceList {
26
24
  onInit(): void;
27
25
  }
28
26
  export {};
27
+ //# sourceMappingURL=price-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list.d.ts","sourceRoot":"","sources":["../../src/models/price-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AAC/C,OAAO,EAIL,eAAe,EACf,aAAa,EAEd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,UAAU,EAMV,aAAa,EAId,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,aAAa,MAAM,mBAAmB,CAAA;AAE7C,KAAK,cAAc,GACf,WAAW,GACX,SAAS,GACT,GAAG,CAAC,6BAA6B,CAAA;AASrC,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAIxC,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAA;IAG/B,EAAE,EAAG,MAAM,CAAA;IAIX,KAAK,EAAE,MAAM,CAAA;IAIb,WAAW,EAAE,MAAM,CAAA;IAGnB,MAAM,EAAE,eAAe,CAAA;IAGvB,IAAI,EAAE,aAAa,CAAA;IAMnB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAO;IAM7B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAO;IAK3B,MAAM,4BAAmC;IAKzC,gBAAgB,oCAA2C;IAG3D,WAAW,EAAE,MAAM,CAAI;IAOvB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -13,11 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PriceListIdPrefix = void 0;
16
- const utils_1 = require("@medusajs/utils");
16
+ const utils_1 = require("@medusajs/framework/utils");
17
17
  const core_1 = require("@mikro-orm/core");
18
18
  const price_1 = __importDefault(require("./price"));
19
19
  const price_list_rule_1 = __importDefault(require("./price-list-rule"));
20
- const rule_type_1 = __importDefault(require("./rule-type"));
21
20
  const tableName = "price_list";
22
21
  const PriceListDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
23
22
  tableName: tableName,
@@ -31,7 +30,6 @@ let PriceList = class PriceList {
31
30
  this.ends_at = null;
32
31
  this.prices = new core_1.Collection(this);
33
32
  this.price_list_rules = new core_1.Collection(this);
34
- this.rule_types = new core_1.Collection(this);
35
33
  this.rules_count = 0;
36
34
  this.deleted_at = null;
37
35
  }
@@ -90,13 +88,6 @@ __decorate([
90
88
  }),
91
89
  __metadata("design:type", Object)
92
90
  ], PriceList.prototype, "price_list_rules", void 0);
93
- __decorate([
94
- (0, core_1.ManyToMany)({
95
- entity: () => rule_type_1.default,
96
- pivotEntity: () => price_list_rule_1.default,
97
- }),
98
- __metadata("design:type", Object)
99
- ], PriceList.prototype, "rule_types", void 0);
100
91
  __decorate([
101
92
  (0, core_1.Property)({ columnType: "integer", default: 0 }),
102
93
  __metadata("design:type", Number)
@@ -140,3 +131,4 @@ PriceList = __decorate([
140
131
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
141
132
  ], PriceList);
142
133
  exports.default = PriceList;
134
+ //# sourceMappingURL=price-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../src/models/price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qDAOkC;AAClC,0CAawB;AACxB,oDAA2B;AAC3B,wEAA6C;AAO7C,MAAM,SAAS,GAAG,YAAY,CAAA;AAC9B,MAAM,uBAAuB,GAAG,IAAA,sCAA8B,EAAC;IAC7D,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE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aAAM,GAAE;;;;uCAGR;AAxEkB,SAAS;IAF7B,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,CAAC;IACrB,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,SAAS,CAyE7B;kBAzEoB,SAAS"}
@@ -0,0 +1,13 @@
1
+ export declare const uniquePreferenceRuleIndexName = "IDX_price_preference_attribute_value";
2
+ export default class PricePreference {
3
+ id: string;
4
+ attribute: string;
5
+ value: string | null;
6
+ is_tax_inclusive: boolean;
7
+ created_at: Date;
8
+ updated_at: Date;
9
+ deleted_at: Date | null;
10
+ onCreate(): void;
11
+ onInit(): void;
12
+ }
13
+ //# sourceMappingURL=price-preference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-preference.d.ts","sourceRoot":"","sources":["../../src/models/price-preference.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,6BAA6B,yCACF,CAAA;AAkBxC,MAAM,CAAC,OAAO,OAAO,eAAe;IAElC,EAAE,EAAE,MAAM,CAAA;IAGV,SAAS,EAAE,MAAM,CAAA;IAGjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAO;IAG3B,gBAAgB,EAAE,OAAO,CAAA;IAOzB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}