@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.
- package/dist/definitions/index.d.ts +2 -1
- package/dist/definitions/index.js +2 -1
- package/dist/definitions/product-shipping-profile.js +6 -1
- package/dist/definitions/product-variant-price-set.d.ts +2 -0
- package/dist/definitions/{product-variant-money-amount.js → product-variant-price-set.js} +14 -15
- package/dist/initialize/index.js +8 -4
- package/dist/links.d.ts +1 -1
- package/dist/links.js +1 -1
- package/dist/repositories/link.d.ts +3 -0
- package/package.json +4 -4
- package/dist/definitions/product-variant-money-amount.d.ts +0 -2
|
@@ -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-
|
|
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: "
|
|
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",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ProductVariantPriceSet = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
5
|
const links_1 = require("../links");
|
|
6
|
-
exports.
|
|
7
|
-
serviceName: links_1.LINKS.
|
|
6
|
+
exports.ProductVariantPriceSet = {
|
|
7
|
+
serviceName: links_1.LINKS.ProductVariantPriceSet,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
|
-
tableName: "
|
|
11
|
-
idPrefix: "
|
|
10
|
+
tableName: "product_variant_price_set",
|
|
11
|
+
idPrefix: "pvps",
|
|
12
12
|
},
|
|
13
13
|
alias: [
|
|
14
14
|
{
|
|
15
|
-
name: "
|
|
15
|
+
name: "product_variant_price_set",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
name: "
|
|
18
|
+
name: "product_variant_price_sets",
|
|
19
19
|
},
|
|
20
20
|
],
|
|
21
|
-
primaryKeys: ["id", "variant_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: "
|
|
36
|
-
alias: "
|
|
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.
|
|
44
|
+
serviceName: links_1.LINKS.ProductVariantPriceSet,
|
|
45
45
|
primaryKey: "variant_id",
|
|
46
46
|
foreignKey: "id",
|
|
47
|
-
alias: "
|
|
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.
|
|
55
|
-
primaryKey: "
|
|
53
|
+
serviceName: links_1.LINKS.ProductVariantPriceSet,
|
|
54
|
+
primaryKey: "price_set_id",
|
|
56
55
|
foreignKey: "id",
|
|
57
56
|
alias: "variant_link",
|
|
58
57
|
},
|
package/dist/initialize/index.js
CHANGED
|
@@ -68,8 +68,10 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
|
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
else if (!
|
|
72
|
-
!modulesLoadedKeys.includes(
|
|
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 (!
|
|
115
|
-
!modulesLoadedKeys.includes(
|
|
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
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
|
-
|
|
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.
|
|
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": "
|
|
40
|
-
"@medusajs/types": "
|
|
41
|
-
"@medusajs/utils": "
|
|
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"
|