@medusajs/cart 0.0.4-snapshot-20240718073308 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/dist/index.d.ts +4 -6
  2. package/dist/index.js +20 -5
  3. package/dist/initialize/index.d.ts +4 -0
  4. package/dist/initialize/index.js +16 -0
  5. package/dist/joiner-config.d.ts +14 -0
  6. package/dist/joiner-config.js +86 -0
  7. package/dist/loaders/connection.d.ts +4 -0
  8. package/dist/loaders/connection.js +41 -0
  9. package/dist/loaders/container.d.ts +2 -0
  10. package/dist/loaders/container.js +34 -0
  11. package/dist/loaders/index.d.ts +2 -0
  12. package/dist/loaders/index.js +18 -0
  13. package/dist/migrations/Migration20240222170223.d.ts +0 -1
  14. package/dist/models/address.d.ts +1 -2
  15. package/dist/models/adjustment-line.d.ts +1 -2
  16. package/dist/models/cart.d.ts +4 -5
  17. package/dist/models/index.d.ts +0 -1
  18. package/dist/models/line-item-adjustment.d.ts +1 -3
  19. package/dist/models/line-item-adjustment.js +1 -1
  20. package/dist/models/line-item-tax-line.d.ts +1 -3
  21. package/dist/models/line-item-tax-line.js +1 -1
  22. package/dist/models/line-item.d.ts +3 -4
  23. package/dist/models/line-item.js +4 -4
  24. package/dist/models/shipping-method-adjustment.d.ts +1 -3
  25. package/dist/models/shipping-method-adjustment.js +1 -1
  26. package/dist/models/shipping-method-tax-line.d.ts +1 -3
  27. package/dist/models/shipping-method-tax-line.js +1 -1
  28. package/dist/models/shipping-method.d.ts +3 -4
  29. package/dist/models/shipping-method.js +2 -2
  30. package/dist/models/tax-line.d.ts +1 -2
  31. package/dist/module-definition.d.ts +4 -0
  32. package/dist/module-definition.js +50 -0
  33. package/dist/repositories/index.d.ts +1 -0
  34. package/dist/repositories/index.js +5 -0
  35. package/dist/scripts/bin/run-seed.d.ts +3 -0
  36. package/dist/scripts/bin/run-seed.js +38 -0
  37. package/dist/scripts/seed.d.ts +4 -0
  38. package/dist/scripts/seed.js +54 -0
  39. package/dist/services/cart-module.d.ts +33 -35
  40. package/dist/services/cart-module.js +46 -46
  41. package/dist/services/index.d.ts +0 -1
  42. package/dist/types/address.d.ts +0 -1
  43. package/dist/types/cart.d.ts +0 -1
  44. package/dist/types/index.d.ts +0 -1
  45. package/dist/types/line-item-adjustment.d.ts +0 -1
  46. package/dist/types/line-item-tax-line.d.ts +0 -1
  47. package/dist/types/line-item.d.ts +0 -1
  48. package/dist/types/shipping-method-adjustment.d.ts +0 -1
  49. package/dist/types/shipping-method-tax-line.d.ts +0 -1
  50. package/dist/types/shipping-method.d.ts +0 -1
  51. package/dist/types/tax-line.d.ts +0 -1
  52. package/package.json +13 -7
  53. package/dist/index.d.ts.map +0 -1
  54. package/dist/migrations/Migration20240222170223.d.ts.map +0 -1
  55. package/dist/models/address.d.ts.map +0 -1
  56. package/dist/models/adjustment-line.d.ts.map +0 -1
  57. package/dist/models/cart.d.ts.map +0 -1
  58. package/dist/models/index.d.ts.map +0 -1
  59. package/dist/models/line-item-adjustment.d.ts.map +0 -1
  60. package/dist/models/line-item-tax-line.d.ts.map +0 -1
  61. package/dist/models/line-item.d.ts.map +0 -1
  62. package/dist/models/shipping-method-adjustment.d.ts.map +0 -1
  63. package/dist/models/shipping-method-tax-line.d.ts.map +0 -1
  64. package/dist/models/shipping-method.d.ts.map +0 -1
  65. package/dist/models/tax-line.d.ts.map +0 -1
  66. package/dist/services/cart-module.d.ts.map +0 -1
  67. package/dist/services/index.d.ts.map +0 -1
  68. package/dist/types/address.d.ts.map +0 -1
  69. package/dist/types/cart.d.ts.map +0 -1
  70. package/dist/types/index.d.ts.map +0 -1
  71. package/dist/types/line-item-adjustment.d.ts.map +0 -1
  72. package/dist/types/line-item-tax-line.d.ts.map +0 -1
  73. package/dist/types/line-item.d.ts.map +0 -1
  74. package/dist/types/shipping-method-adjustment.d.ts.map +0 -1
  75. package/dist/types/shipping-method-tax-line.d.ts.map +0 -1
  76. package/dist/types/shipping-method.d.ts.map +0 -1
  77. package/dist/types/tax-line.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { CartModuleService } from "./services";
2
- declare const _default: import("@medusajs/types").ModuleExports<typeof CartModuleService> & {
3
- linkable: Record<string, any>;
4
- };
5
- export default _default;
6
- //# sourceMappingURL=index.d.ts.map
1
+ import { moduleDefinition, revertMigration, runMigrations } from "./module-definition";
2
+ export default moduleDefinition;
3
+ export { revertMigration, runMigrations };
4
+ export * from "./initialize";
package/dist/index.js CHANGED
@@ -1,7 +1,22 @@
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const services_1 = require("./services");
4
- const utils_1 = require("@medusajs/utils");
5
- exports.default = (0, utils_1.Module)(utils_1.Modules.CART, {
6
- service: services_1.CartModuleService,
7
- });
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);
@@ -0,0 +1,4 @@
1
+ import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
2
+ import { ICartModuleService, ModulesSdkTypes } from "@medusajs/types";
3
+ import { InitializeModuleInjectableDependencies } from "../types";
4
+ export declare const initialize: (options?: ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ExternalModuleDeclaration | InternalModuleDeclaration, injectedDependencies?: InitializeModuleInjectableDependencies) => Promise<ICartModuleService>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialize = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ const module_definition_1 = require("../module-definition");
6
+ const initialize = async (options, injectedDependencies) => {
7
+ const loaded = await modules_sdk_1.MedusaModule.bootstrap({
8
+ moduleKey: modules_sdk_1.Modules.CART,
9
+ defaultPath: modules_sdk_1.MODULE_PACKAGE_NAMES[modules_sdk_1.Modules.CART],
10
+ declaration: options,
11
+ injectedDependencies,
12
+ moduleExports: module_definition_1.moduleDefinition,
13
+ });
14
+ return loaded[modules_sdk_1.Modules.CART];
15
+ };
16
+ exports.initialize = initialize;
@@ -0,0 +1,14 @@
1
+ import { ModuleJoinerConfig } from "@medusajs/types";
2
+ import { MapToConfig } from "@medusajs/utils";
3
+ export declare const LinkableKeys: {
4
+ cart_id: string;
5
+ line_item_id: string;
6
+ shipping_method_id: string;
7
+ address_id: string;
8
+ line_item_adjustment_id: string;
9
+ shipping_method_adjustment_id: string;
10
+ line_item_tax_line_id: string;
11
+ shipping_method_tax_line_id: string;
12
+ };
13
+ export declare const entityNameToLinkableKeysMap: MapToConfig;
14
+ export declare const joinerConfig: ModuleJoinerConfig;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.joinerConfig = exports.entityNameToLinkableKeysMap = exports.LinkableKeys = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ const _models_1 = require("./models");
6
+ exports.LinkableKeys = {
7
+ cart_id: _models_1.Cart.name,
8
+ line_item_id: _models_1.LineItem.name,
9
+ shipping_method_id: _models_1.ShippingMethod.name,
10
+ address_id: _models_1.Address.name,
11
+ line_item_adjustment_id: _models_1.LineItemAdjustment.name,
12
+ shipping_method_adjustment_id: _models_1.ShippingMethodAdjustment.name,
13
+ line_item_tax_line_id: _models_1.LineItemTaxLine.name,
14
+ shipping_method_tax_line_id: _models_1.ShippingMethodTaxLine.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.CART,
27
+ primaryKeys: ["id"],
28
+ linkableKeys: exports.LinkableKeys,
29
+ alias: [
30
+ {
31
+ name: ["cart", "carts"],
32
+ args: {
33
+ entity: _models_1.Cart.name,
34
+ },
35
+ },
36
+ {
37
+ name: ["line_item", "line_items"],
38
+ args: {
39
+ entity: _models_1.LineItem.name,
40
+ methodSuffix: "LineItems",
41
+ },
42
+ },
43
+ {
44
+ name: ["shipping_method", "shipping_methods"],
45
+ args: {
46
+ entity: _models_1.ShippingMethod.name,
47
+ methodSuffix: "ShippingMethods",
48
+ },
49
+ },
50
+ {
51
+ name: ["address", "addresses"],
52
+ args: {
53
+ entity: _models_1.Address.name,
54
+ methodSuffix: "Addresses",
55
+ },
56
+ },
57
+ {
58
+ name: ["line_item_adjustment", "line_item_adjustments"],
59
+ args: {
60
+ entity: _models_1.LineItemAdjustment.name,
61
+ methodSuffix: "LineItemAdjustments",
62
+ },
63
+ },
64
+ {
65
+ name: ["shipping_method_adjustment", "shipping_method_adjustments"],
66
+ args: {
67
+ entity: _models_1.ShippingMethodAdjustment.name,
68
+ methodSuffix: "ShippingMethodAdjustments",
69
+ },
70
+ },
71
+ {
72
+ name: ["line_item_tax_line", "line_item_tax_lines"],
73
+ args: {
74
+ entity: _models_1.LineItemTaxLine.name,
75
+ methodSuffix: "LineItemTaxLines",
76
+ },
77
+ },
78
+ {
79
+ name: ["shipping_method_tax_line", "shipping_method_tax_lines"],
80
+ args: {
81
+ entity: _models_1.ShippingMethodTaxLine.name,
82
+ methodSuffix: "ShippingMethodTaxLines",
83
+ },
84
+ },
85
+ ],
86
+ };
@@ -0,0 +1,4 @@
1
+ import { InternalModuleDeclaration, LoaderOptions } from "@medusajs/modules-sdk";
2
+ import { ModulesSdkTypes } from "@medusajs/types";
3
+ declare const _default: ({ options, container, logger, }: LoaderOptions<ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions>, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>;
4
+ export default _default;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
27
+ const utils_1 = require("@medusajs/utils");
28
+ const CartModels = __importStar(require("../models"));
29
+ exports.default = async ({ options, container, logger, }, moduleDeclaration) => {
30
+ const entities = Object.values(CartModels);
31
+ const pathToMigrations = __dirname + "/../migrations";
32
+ await utils_1.ModulesSdkUtils.mikroOrmConnectionLoader({
33
+ moduleName: modules_sdk_1.Modules.CART,
34
+ entities,
35
+ container,
36
+ options,
37
+ moduleDeclaration,
38
+ logger,
39
+ pathToMigrations,
40
+ });
41
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: ({ container, options }: import("@medusajs/types").LoaderOptions) => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const utils_1 = require("@medusajs/utils");
27
+ const ModuleModels = __importStar(require("../models"));
28
+ const ModuleRepositories = __importStar(require("../repositories"));
29
+ const ModuleServices = __importStar(require("../services"));
30
+ exports.default = utils_1.ModulesSdkUtils.moduleContainerLoaderFactory({
31
+ moduleModels: ModuleModels,
32
+ moduleRepositories: ModuleRepositories,
33
+ moduleServices: ModuleServices,
34
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./connection";
2
+ export * from "./container";
@@ -0,0 +1,18 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./connection"), exports);
18
+ __exportStar(require("./container"), exports);
@@ -2,4 +2,3 @@ import { Migration } from "@mikro-orm/migrations";
2
2
  export declare class Migration20240222170223 extends Migration {
3
3
  up(): Promise<void>;
4
4
  }
5
- //# sourceMappingURL=Migration20240222170223.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { DAL } from "@medusajs/types";
2
2
  import { OptionalProps } from "@mikro-orm/core";
3
- type OptionalAddressProps = DAL.SoftDeletableModelDateColumns;
3
+ type OptionalAddressProps = DAL.SoftDeletableEntityDateColumns;
4
4
  export default class Address {
5
5
  [OptionalProps]: OptionalAddressProps;
6
6
  id: string;
@@ -23,4 +23,3 @@ export default class Address {
23
23
  onInit(): void;
24
24
  }
25
25
  export {};
26
- //# sourceMappingURL=address.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { DAL } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
3
  import { OptionalProps } from "@mikro-orm/core";
4
- type OptionalAdjustmentLineProps = DAL.SoftDeletableModelDateColumns;
4
+ type OptionalAdjustmentLineProps = DAL.SoftDeletableEntityDateColumns;
5
5
  /**
6
6
  * As per the Mikro ORM docs, superclasses should use the abstract class definition
7
7
  * Source: https://mikro-orm.io/docs/inheritance-mapping
@@ -19,4 +19,3 @@ export default abstract class AdjustmentLine {
19
19
  updated_at: Date;
20
20
  }
21
21
  export {};
22
- //# sourceMappingURL=adjustment-line.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { DAL } from "@medusajs/types";
2
- import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
2
+ import { Collection, OptionalProps } from "@mikro-orm/core";
3
3
  import Address from "./address";
4
4
  import LineItem from "./line-item";
5
5
  import ShippingMethod from "./shipping-method";
6
- type OptionalCartProps = "shipping_address" | "billing_address" | DAL.SoftDeletableModelDateColumns;
6
+ type OptionalCartProps = "shipping_address" | "billing_address" | DAL.SoftDeletableEntityDateColumns;
7
7
  export default class Cart {
8
8
  [OptionalProps]?: OptionalCartProps;
9
9
  id: string;
@@ -13,9 +13,9 @@ export default class Cart {
13
13
  email: string | null;
14
14
  currency_code: string;
15
15
  shipping_address_id: string | null;
16
- shipping_address: Rel<Address> | null;
16
+ shipping_address: Address | null;
17
17
  billing_address_id: string | null;
18
- billing_address: Rel<Address> | null;
18
+ billing_address: Address | null;
19
19
  metadata: Record<string, unknown> | null;
20
20
  items: Collection<LineItem, object>;
21
21
  shipping_methods: Collection<ShippingMethod, object>;
@@ -26,4 +26,3 @@ export default class Cart {
26
26
  onInit(): void;
27
27
  }
28
28
  export {};
29
- //# sourceMappingURL=cart.d.ts.map
@@ -6,4 +6,3 @@ export { default as LineItemTaxLine } from "./line-item-tax-line";
6
6
  export { default as ShippingMethod } from "./shipping-method";
7
7
  export { default as ShippingMethodAdjustment } from "./shipping-method-adjustment";
8
8
  export { default as ShippingMethodTaxLine } from "./shipping-method-tax-line";
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,10 @@
1
- import { Rel } from "@mikro-orm/core";
2
1
  import AdjustmentLine from "./adjustment-line";
3
2
  import LineItem from "./line-item";
4
3
  export default class LineItemAdjustment extends AdjustmentLine {
5
- item: Rel<LineItem>;
4
+ item: LineItem;
6
5
  item_id: string;
7
6
  promotion_id: string | null;
8
7
  deleted_at: Date | null;
9
8
  onCreate(): void;
10
9
  onInit(): void;
11
10
  }
12
- //# sourceMappingURL=line-item-adjustment.d.ts.map
@@ -48,7 +48,7 @@ let LineItemAdjustment = class LineItemAdjustment extends adjustment_line_1.defa
48
48
  };
49
49
  __decorate([
50
50
  (0, core_1.ManyToOne)({ entity: () => line_item_1.default, persist: false }),
51
- __metadata("design:type", Object)
51
+ __metadata("design:type", line_item_1.default)
52
52
  ], LineItemAdjustment.prototype, "item", void 0);
53
53
  __decorate([
54
54
  LineItemIdIndex(),
@@ -1,12 +1,10 @@
1
- import { Rel } from "@mikro-orm/core";
2
1
  import LineItem from "./line-item";
3
2
  import TaxLine from "./tax-line";
4
3
  export default class LineItemTaxLine extends TaxLine {
5
- item: Rel<LineItem>;
4
+ item: LineItem;
6
5
  item_id: string;
7
6
  tax_rate_id: string | null;
8
7
  deleted_at: Date | null;
9
8
  onCreate(): void;
10
9
  onInit(): void;
11
10
  }
12
- //# sourceMappingURL=line-item-tax-line.d.ts.map
@@ -48,7 +48,7 @@ let LineItemTaxLine = class LineItemTaxLine extends tax_line_1.default {
48
48
  };
49
49
  __decorate([
50
50
  (0, core_1.ManyToOne)({ entity: () => line_item_1.default, persist: false }),
51
- __metadata("design:type", Object)
51
+ __metadata("design:type", line_item_1.default)
52
52
  ], LineItemTaxLine.prototype, "item", void 0);
53
53
  __decorate([
54
54
  LineItemIdIndex(),
@@ -1,15 +1,15 @@
1
1
  import { BigNumberRawValue, DAL } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
- import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
3
+ import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import Cart from "./cart";
5
5
  import LineItemAdjustment from "./line-item-adjustment";
6
6
  import LineItemTaxLine from "./line-item-tax-line";
7
- type OptionalLineItemProps = "is_discoutable" | "is_tax_inclusive" | "compare_at_unit_price" | "requires_shipping" | "cart" | DAL.SoftDeletableModelDateColumns;
7
+ type OptionalLineItemProps = "is_discoutable" | "is_tax_inclusive" | "compare_at_unit_price" | "requires_shipping" | "cart" | DAL.SoftDeletableEntityDateColumns;
8
8
  export default class LineItem {
9
9
  [OptionalProps]?: OptionalLineItemProps;
10
10
  id: string;
11
11
  cart_id: string;
12
- cart: Rel<Cart>;
12
+ cart: Cart;
13
13
  title: string;
14
14
  subtitle: string | null;
15
15
  thumbnail: string | null;
@@ -43,4 +43,3 @@ export default class LineItem {
43
43
  onInit(): void;
44
44
  }
45
45
  export {};
46
- //# sourceMappingURL=line-item.d.ts.map
@@ -89,7 +89,7 @@ __decorate([
89
89
  ], LineItem.prototype, "cart_id", void 0);
90
90
  __decorate([
91
91
  (0, core_1.ManyToOne)({ entity: () => cart_1.default, persist: false }),
92
- __metadata("design:type", Object)
92
+ __metadata("design:type", cart_1.default)
93
93
  ], LineItem.prototype, "cart", void 0);
94
94
  __decorate([
95
95
  (0, core_1.Property)({ columnType: "text" }),
@@ -159,15 +159,15 @@ __decorate([
159
159
  ], LineItem.prototype, "variant_option_values", void 0);
160
160
  __decorate([
161
161
  (0, core_1.Property)({ columnType: "boolean" }),
162
- __metadata("design:type", Boolean)
162
+ __metadata("design:type", Object)
163
163
  ], LineItem.prototype, "requires_shipping", void 0);
164
164
  __decorate([
165
165
  (0, core_1.Property)({ columnType: "boolean" }),
166
- __metadata("design:type", Boolean)
166
+ __metadata("design:type", Object)
167
167
  ], LineItem.prototype, "is_discountable", void 0);
168
168
  __decorate([
169
169
  (0, core_1.Property)({ columnType: "boolean" }),
170
- __metadata("design:type", Boolean)
170
+ __metadata("design:type", Object)
171
171
  ], LineItem.prototype, "is_tax_inclusive", void 0);
172
172
  __decorate([
173
173
  (0, utils_1.MikroOrmBigNumberProperty)({ nullable: true }),
@@ -1,12 +1,10 @@
1
- import { Rel } from "@mikro-orm/core";
2
1
  import AdjustmentLine from "./adjustment-line";
3
2
  import ShippingMethod from "./shipping-method";
4
3
  export default class ShippingMethodAdjustment extends AdjustmentLine {
5
- shipping_method: Rel<ShippingMethod>;
4
+ shipping_method: ShippingMethod;
6
5
  shipping_method_id: string;
7
6
  promotion_id: string | null;
8
7
  deleted_at: Date | null;
9
8
  onCreate(): void;
10
9
  onInit(): void;
11
10
  }
12
- //# sourceMappingURL=shipping-method-adjustment.d.ts.map
@@ -48,7 +48,7 @@ let ShippingMethodAdjustment = class ShippingMethodAdjustment extends adjustment
48
48
  };
49
49
  __decorate([
50
50
  (0, core_1.ManyToOne)({ entity: () => shipping_method_1.default, persist: false }),
51
- __metadata("design:type", Object)
51
+ __metadata("design:type", shipping_method_1.default)
52
52
  ], ShippingMethodAdjustment.prototype, "shipping_method", void 0);
53
53
  __decorate([
54
54
  ShippingMethodIdIndex(),
@@ -1,12 +1,10 @@
1
- import { Rel } from "@mikro-orm/core";
2
1
  import ShippingMethod from "./shipping-method";
3
2
  import TaxLine from "./tax-line";
4
3
  export default class ShippingMethodTaxLine extends TaxLine {
5
- shipping_method: Rel<ShippingMethod>;
4
+ shipping_method: ShippingMethod;
6
5
  shipping_method_id: string;
7
6
  tax_rate_id: string | null;
8
7
  deleted_at: Date | null;
9
8
  onCreate(): void;
10
9
  onInit(): void;
11
10
  }
12
- //# sourceMappingURL=shipping-method-tax-line.d.ts.map
@@ -48,7 +48,7 @@ let ShippingMethodTaxLine = class ShippingMethodTaxLine extends tax_line_1.defau
48
48
  };
49
49
  __decorate([
50
50
  (0, core_1.ManyToOne)({ entity: () => shipping_method_1.default, persist: false }),
51
- __metadata("design:type", Object)
51
+ __metadata("design:type", shipping_method_1.default)
52
52
  ], ShippingMethodTaxLine.prototype, "shipping_method", void 0);
53
53
  __decorate([
54
54
  ShippingMethodIdIndex(),
@@ -1,15 +1,15 @@
1
1
  import { BigNumberRawValue, DAL } from "@medusajs/types";
2
2
  import { BigNumber } from "@medusajs/utils";
3
- import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
3
+ import { Collection, OptionalProps } from "@mikro-orm/core";
4
4
  import Cart from "./cart";
5
5
  import ShippingMethodAdjustment from "./shipping-method-adjustment";
6
6
  import ShippingMethodTaxLine from "./shipping-method-tax-line";
7
- type OptionalShippingMethodProps = "cart" | "is_tax_inclusive" | DAL.SoftDeletableModelDateColumns;
7
+ type OptionalShippingMethodProps = "cart" | "is_tax_inclusive" | DAL.SoftDeletableEntityDateColumns;
8
8
  export default class ShippingMethod {
9
9
  [OptionalProps]?: OptionalShippingMethodProps;
10
10
  id: string;
11
11
  cart_id: string;
12
- cart: Rel<Cart>;
12
+ cart: Cart;
13
13
  name: string;
14
14
  description: string | null;
15
15
  amount: BigNumber | number;
@@ -27,4 +27,3 @@ export default class ShippingMethod {
27
27
  onInit(): void;
28
28
  }
29
29
  export {};
30
- //# sourceMappingURL=shipping-method.d.ts.map
@@ -68,7 +68,7 @@ __decorate([
68
68
  ], ShippingMethod.prototype, "cart_id", void 0);
69
69
  __decorate([
70
70
  (0, core_1.ManyToOne)({ entity: () => cart_1.default, persist: false }),
71
- __metadata("design:type", Object)
71
+ __metadata("design:type", cart_1.default)
72
72
  ], ShippingMethod.prototype, "cart", void 0);
73
73
  __decorate([
74
74
  (0, core_1.Property)({ columnType: "text" }),
@@ -88,7 +88,7 @@ __decorate([
88
88
  ], ShippingMethod.prototype, "raw_amount", void 0);
89
89
  __decorate([
90
90
  (0, core_1.Property)({ columnType: "boolean" }),
91
- __metadata("design:type", Boolean)
91
+ __metadata("design:type", Object)
92
92
  ], ShippingMethod.prototype, "is_tax_inclusive", void 0);
93
93
  __decorate([
94
94
  ShippingOptionIdIndex(),
@@ -1,6 +1,6 @@
1
1
  import { DAL } from "@medusajs/types";
2
2
  import { OptionalProps } from "@mikro-orm/core";
3
- type OptionalTaxLineProps = DAL.SoftDeletableModelDateColumns;
3
+ type OptionalTaxLineProps = DAL.SoftDeletableEntityDateColumns;
4
4
  /**
5
5
  * As per the Mikro ORM docs, superclasses should use the abstract class definition
6
6
  * Source: https://mikro-orm.io/docs/inheritance-mapping
@@ -17,4 +17,3 @@ export default abstract class TaxLine {
17
17
  updated_at: Date;
18
18
  }
19
19
  export {};
20
- //# sourceMappingURL=tax-line.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { ModuleExports } from "@medusajs/types";
2
+ export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
3
+ export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
4
+ export declare const moduleDefinition: ModuleExports;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.moduleDefinition = exports.revertMigration = exports.runMigrations = void 0;
30
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
31
+ const utils_1 = require("@medusajs/utils");
32
+ const Models = __importStar(require("./models"));
33
+ const connection_1 = __importDefault(require("./loaders/connection"));
34
+ const container_1 = __importDefault(require("./loaders/container"));
35
+ const services_1 = require("./services");
36
+ const migrationScriptOptions = {
37
+ moduleName: modules_sdk_1.Modules.CART,
38
+ models: Models,
39
+ pathToMigrations: __dirname + "/migrations",
40
+ };
41
+ exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
42
+ exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
43
+ const service = services_1.CartModuleService;
44
+ const loaders = [container_1.default, connection_1.default];
45
+ exports.moduleDefinition = {
46
+ service,
47
+ loaders,
48
+ runMigrations: exports.runMigrations,
49
+ revertMigration: exports.revertMigration,
50
+ };
@@ -0,0 +1 @@
1
+ export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
@@ -0,0 +1,5 @@
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; } });
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ declare const _default: Promise<void>;
3
+ export default _default;