@medusajs/link-modules 0.1.0 → 0.1.1-next-20230913180203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
1
  export * from "./inventory-level-stock-location";
2
2
  export * from "./product-variant-inventory-item";
3
- export * from "./product-variant-money-amount";
3
+ export * from "./product-variant-price-set";
4
+ export * from "./product-shipping-profile";
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./inventory-level-stock-location"), exports);
18
18
  __exportStar(require("./product-variant-inventory-item"), exports);
19
- __exportStar(require("./product-variant-money-amount"), exports);
19
+ __exportStar(require("./product-variant-price-set"), exports);
20
+ __exportStar(require("./product-shipping-profile"), exports);
@@ -25,14 +25,18 @@ exports.ProductShippingProfile = {
25
25
  },
26
26
  {
27
27
  serviceName: "shippingProfileService",
28
+ isInternalService: true,
28
29
  primaryKey: "id",
29
30
  foreignKey: "profile_id",
30
- alias: "shipping_profile",
31
+ alias: "profile",
31
32
  },
32
33
  ],
33
34
  extends: [
34
35
  {
35
36
  serviceName: modules_sdk_1.Modules.PRODUCT,
37
+ fieldAlias: {
38
+ profile: "shipping_profile.profile",
39
+ },
36
40
  relationship: {
37
41
  serviceName: links_1.LINKS.ProductShippingProfile,
38
42
  primaryKey: "product_id",
@@ -44,6 +48,7 @@ exports.ProductShippingProfile = {
44
48
  serviceName: "shippingProfileService",
45
49
  relationship: {
46
50
  serviceName: links_1.LINKS.ProductShippingProfile,
51
+ isInternalService: true,
47
52
  primaryKey: "profile_id",
48
53
  foreignKey: "id",
49
54
  alias: "product_link",
@@ -0,0 +1,2 @@
1
+ import { ModuleJoinerConfig } from "@medusajs/types";
2
+ export declare const ProductVariantPriceSet: ModuleJoinerConfig;
@@ -1,24 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductVariantMoneyAmount = void 0;
3
+ exports.ProductVariantPriceSet = void 0;
4
4
  const modules_sdk_1 = require("@medusajs/modules-sdk");
5
5
  const links_1 = require("../links");
6
- exports.ProductVariantMoneyAmount = {
7
- serviceName: links_1.LINKS.ProductVariantMoneyAmount,
6
+ exports.ProductVariantPriceSet = {
7
+ serviceName: links_1.LINKS.ProductVariantPriceSet,
8
8
  isLink: true,
9
9
  databaseConfig: {
10
- tableName: "product_variant_money_amount",
11
- idPrefix: "pvma",
10
+ tableName: "product_variant_price_set",
11
+ idPrefix: "pvps",
12
12
  },
13
13
  alias: [
14
14
  {
15
- name: "product_variant_money_amount",
15
+ name: "product_variant_price_set",
16
16
  },
17
17
  {
18
- name: "product_variant_money_amounts",
18
+ name: "product_variant_price_sets",
19
19
  },
20
20
  ],
21
- primaryKeys: ["id", "variant_id", "money_amount_id"],
21
+ primaryKeys: ["id", "variant_id", "price_set_id"],
22
22
  relationships: [
23
23
  {
24
24
  serviceName: modules_sdk_1.Modules.PRODUCT,
@@ -32,8 +32,8 @@ exports.ProductVariantMoneyAmount = {
32
32
  {
33
33
  serviceName: modules_sdk_1.Modules.PRICING,
34
34
  primaryKey: "id",
35
- foreignKey: "money_amount_id",
36
- alias: "money_amount",
35
+ foreignKey: "price_set_id",
36
+ alias: "price_set",
37
37
  deleteCascade: true,
38
38
  },
39
39
  ],
@@ -41,18 +41,17 @@ exports.ProductVariantMoneyAmount = {
41
41
  {
42
42
  serviceName: modules_sdk_1.Modules.PRODUCT,
43
43
  relationship: {
44
- serviceName: links_1.LINKS.ProductVariantMoneyAmount,
44
+ serviceName: links_1.LINKS.ProductVariantPriceSet,
45
45
  primaryKey: "variant_id",
46
46
  foreignKey: "id",
47
- alias: "prices",
48
- isList: true,
47
+ alias: "price",
49
48
  },
50
49
  },
51
50
  {
52
51
  serviceName: modules_sdk_1.Modules.PRICING,
53
52
  relationship: {
54
- serviceName: links_1.LINKS.ProductVariantMoneyAmount,
55
- primaryKey: "money_amount_id",
53
+ serviceName: links_1.LINKS.ProductVariantPriceSet,
54
+ primaryKey: "price_set_id",
56
55
  foreignKey: "id",
57
56
  alias: "variant_link",
58
57
  },
@@ -68,8 +68,10 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
68
68
  continue;
69
69
  }
70
70
  }
71
- else if (!modulesLoadedKeys.includes(primary.serviceName) ||
72
- !modulesLoadedKeys.includes(foreign.serviceName)) {
71
+ else if ((!primary.isInternalService &&
72
+ !modulesLoadedKeys.includes(primary.serviceName)) ||
73
+ (!foreign.isInternalService &&
74
+ !modulesLoadedKeys.includes(foreign.serviceName))) {
73
75
  continue;
74
76
  }
75
77
  const moduleDefinition = (0, module_definition_1.getLinkModuleDefinition)(definition, primary, foreign);
@@ -111,8 +113,10 @@ async function runMigrations({ options, logger, }, modulesDefinition) {
111
113
  throw new Error(`Link module ${serviceKey} already exists.`);
112
114
  }
113
115
  allLinks.add(serviceKey);
114
- if (!modulesLoadedKeys.includes(primary.serviceName) ||
115
- !modulesLoadedKeys.includes(foreign.serviceName)) {
116
+ if ((!primary.isInternalService &&
117
+ !modulesLoadedKeys.includes(primary.serviceName)) ||
118
+ (!foreign.isInternalService &&
119
+ !modulesLoadedKeys.includes(foreign.serviceName))) {
116
120
  continue;
117
121
  }
118
122
  const migrate = (0, migration_1.getMigration)(definition, serviceKey, primary, foreign);
package/dist/links.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const LINKS: {
2
2
  ProductVariantInventoryItem: string;
3
- ProductVariantMoneyAmount: string;
3
+ ProductVariantPriceSet: string;
4
4
  ProductShippingProfile: string;
5
5
  };
package/dist/links.js CHANGED
@@ -5,7 +5,7 @@ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
5
  const utils_1 = require("./utils");
6
6
  exports.LINKS = {
7
7
  ProductVariantInventoryItem: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", modules_sdk_1.Modules.INVENTORY, "inventory_item_id"),
8
- ProductVariantMoneyAmount: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", modules_sdk_1.Modules.PRICING, "money_amount_id"),
8
+ ProductVariantPriceSet: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", modules_sdk_1.Modules.PRICING, "price_set_id"),
9
9
  // Internal services
10
10
  ProductShippingProfile: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", "shippingProfileService", "profile_id"),
11
11
  };
@@ -20,6 +20,9 @@ export declare function getLinkRepository(model: EntitySchema): {
20
20
  restore(idsOrFilter: string[] | {
21
21
  [x: string]: any;
22
22
  }, { transactionManager: manager }?: Context | undefined): Promise<[object[], Record<string, unknown[]>]>;
23
+ applyFreeTextSearchFilters<T>(findOptions: FindOptions<T & {
24
+ q?: string | undefined;
25
+ }>, retrieveConstraintsToApply: (q: string) => any[]): void;
23
26
  getFreshManager<TManager = unknown>(): TManager;
24
27
  getActiveManager<TManager_1 = unknown>({ transactionManager, manager }?: Context | undefined): TManager_1;
25
28
  transaction<TManager_2 = unknown>(task: (transactionManager: TManager_2) => Promise<any>, options?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/link-modules",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-next-20230913180203",
4
4
  "description": "Medusa Default Link Modules Package and Definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,9 +36,9 @@
36
36
  "typescript": "^5.1.6"
37
37
  },
38
38
  "dependencies": {
39
- "@medusajs/modules-sdk": "^1.10.0",
40
- "@medusajs/types": "^1.11.0",
41
- "@medusajs/utils": "^1.10.0",
39
+ "@medusajs/modules-sdk": "1.11.0-next-20230913180203",
40
+ "@medusajs/types": "1.11.1-next-20230913180203",
41
+ "@medusajs/utils": "1.10.1-next-20230913180203",
42
42
  "@mikro-orm/core": "5.7.12",
43
43
  "@mikro-orm/postgresql": "5.7.12",
44
44
  "awilix": "^8.0.0"
@@ -1,2 +0,0 @@
1
- import { ModuleJoinerConfig } from "@medusajs/types";
2
- export declare const ProductVariantMoneyAmount: ModuleJoinerConfig;