@medusajs/link-modules 0.2.12-snapshot-20240523103337 → 0.2.12-snapshot-20240523153451

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,26 +30,21 @@ exports.CartPromotion = {
30
30
  serviceName: modules_sdk_1.Modules.PROMOTION,
31
31
  primaryKey: "id",
32
32
  foreignKey: "promotion_id",
33
- alias: "promotion",
33
+ alias: "promotions",
34
34
  },
35
35
  ],
36
36
  extends: [
37
37
  {
38
38
  serviceName: modules_sdk_1.Modules.CART,
39
+ fieldAlias: {
40
+ promotions: "cart_link.promotions",
41
+ },
39
42
  relationship: {
40
43
  serviceName: utils_1.LINKS.CartPromotion,
41
44
  primaryKey: "cart_id",
42
45
  foreignKey: "id",
43
46
  alias: "cart_link",
44
- },
45
- },
46
- {
47
- serviceName: modules_sdk_1.Modules.PROMOTION,
48
- relationship: {
49
- serviceName: utils_1.LINKS.CartPromotion,
50
- primaryKey: "promotion_id",
51
- foreignKey: "id",
52
- alias: "promotion_link",
47
+ isList: true,
53
48
  },
54
49
  },
55
50
  ],
@@ -28,7 +28,6 @@ exports.CustomerAuth = {
28
28
  },
29
29
  {
30
30
  serviceName: modules_sdk_1.Modules.AUTH,
31
- isInternalService: true,
32
31
  primaryKey: "id",
33
32
  foreignKey: "auth_identity_id",
34
33
  alias: "auth",
@@ -28,7 +28,6 @@ exports.ProductSalesChannel = {
28
28
  },
29
29
  {
30
30
  serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
31
- isInternalService: true,
32
31
  primaryKey: "id",
33
32
  foreignKey: "sales_channel_id",
34
33
  alias: "sales_channel",
@@ -52,7 +51,6 @@ exports.ProductSalesChannel = {
52
51
  serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
53
52
  relationship: {
54
53
  serviceName: utils_1.LINKS.ProductSalesChannel,
55
- isInternalService: true,
56
54
  primaryKey: "sales_channel_id",
57
55
  foreignKey: "id",
58
56
  alias: "products_link",
@@ -22,8 +22,6 @@ exports.ProductVariantPriceSet = {
22
22
  relationships: [
23
23
  {
24
24
  serviceName: modules_sdk_1.Modules.PRODUCT,
25
- // TODO: Remove this when product module is the default product service
26
- isInternalService: true,
27
25
  primaryKey: "id",
28
26
  foreignKey: "variant_id",
29
27
  alias: "variant",
@@ -3,6 +3,7 @@ export * from "./cart-product";
3
3
  export * from "./cart-region";
4
4
  export * from "./cart-sales-channel";
5
5
  export * from "./inventory-level-stock-location";
6
+ export * from "./line-item-adjustment-promotion";
6
7
  export * from "./order-customer";
7
8
  export * from "./order-product";
8
9
  export * from "./order-sales-channel";
@@ -19,6 +19,7 @@ __exportStar(require("./cart-product"), exports);
19
19
  __exportStar(require("./cart-region"), exports);
20
20
  __exportStar(require("./cart-sales-channel"), exports);
21
21
  __exportStar(require("./inventory-level-stock-location"), exports);
22
+ __exportStar(require("./line-item-adjustment-promotion"), exports);
22
23
  __exportStar(require("./order-customer"), exports);
23
24
  __exportStar(require("./order-product"), exports);
24
25
  __exportStar(require("./order-sales-channel"), exports);
@@ -0,0 +1,2 @@
1
+ import { ModuleJoinerConfig } from "@medusajs/types";
2
+ export declare const LineItemAdjustmentPromotion: ModuleJoinerConfig;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LineItemAdjustmentPromotion = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ exports.LineItemAdjustmentPromotion = {
6
+ isLink: true,
7
+ isReadOnlyLink: true,
8
+ extends: [
9
+ {
10
+ serviceName: modules_sdk_1.Modules.CART,
11
+ relationship: {
12
+ serviceName: modules_sdk_1.Modules.PROMOTION,
13
+ primaryKey: "id",
14
+ foreignKey: "promotion_id",
15
+ alias: "promotion",
16
+ },
17
+ },
18
+ ],
19
+ };
@@ -28,7 +28,6 @@ exports.UserAuth = {
28
28
  },
29
29
  {
30
30
  serviceName: modules_sdk_1.Modules.AUTH,
31
- isInternalService: true,
32
31
  primaryKey: "id",
33
32
  foreignKey: "auth_identity_id",
34
33
  alias: "auth",
@@ -68,10 +68,8 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
68
68
  continue;
69
69
  }
70
70
  }
71
- else if ((!primary.isInternalService &&
72
- !modulesLoadedKeys.includes(primary.serviceName)) ||
73
- (!foreign.isInternalService &&
74
- !modulesLoadedKeys.includes(foreign.serviceName))) {
71
+ else if (!modulesLoadedKeys.includes(primary.serviceName) ||
72
+ !modulesLoadedKeys.includes(foreign.serviceName)) {
75
73
  continue;
76
74
  }
77
75
  const logger = injectedDependencies?.[utils_1.ContainerRegistrationKeys.LOGGER] ?? console;
@@ -17,9 +17,7 @@ function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { lo
17
17
  let typeDef = "";
18
18
  for (const extend of joinerConfig.extends ?? []) {
19
19
  const extendedModule = modules_sdk_1.MedusaModule.getModuleInstance(extend.serviceName);
20
- if (!isReadOnlyLink &&
21
- !extendedModule &&
22
- !extend.relationship.isInternalService) {
20
+ if (!extendedModule) {
23
21
  throw new Error(`Module ${extend.serviceName} not found. Please verify that the module is configured and installed, also the module must be loaded before the link modules.`);
24
22
  }
25
23
  const extJoinerConfig = modules_sdk_1.MedusaModule.getJoinerConfig(extend.relationship.serviceName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/link-modules",
3
- "version": "0.2.12-snapshot-20240523103337",
3
+ "version": "0.2.12-snapshot-20240523153451",
4
4
  "description": "Medusa Default Link Modules Package and Definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,9 +39,9 @@
39
39
  "typescript": "^5.1.6"
40
40
  },
41
41
  "dependencies": {
42
- "@medusajs/modules-sdk": "1.13.0-snapshot-20240523103337",
43
- "@medusajs/types": "1.12.0-snapshot-20240523103337",
44
- "@medusajs/utils": "1.12.0-snapshot-20240523103337",
42
+ "@medusajs/modules-sdk": "1.13.0-snapshot-20240523153451",
43
+ "@medusajs/types": "1.12.0-snapshot-20240523153451",
44
+ "@medusajs/utils": "1.12.0-snapshot-20240523153451",
45
45
  "@mikro-orm/core": "5.9.7",
46
46
  "@mikro-orm/postgresql": "5.9.7",
47
47
  "awilix": "^8.0.0"