@medusajs/link-modules 0.2.10 → 0.2.11-next-20240425093236
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/cart-payment-collection.js +4 -4
- package/dist/definitions/cart-promotion.js +4 -4
- package/dist/definitions/fulfillment-set-location.js +4 -4
- package/dist/definitions/index.d.ts +3 -0
- package/dist/definitions/index.js +3 -0
- package/dist/definitions/order-customer.d.ts +2 -0
- package/dist/definitions/order-customer.js +29 -0
- package/dist/definitions/order-promotion.d.ts +2 -0
- package/dist/definitions/order-promotion.js +56 -0
- package/dist/definitions/order-region.d.ts +2 -0
- package/dist/definitions/order-region.js +29 -0
- package/dist/definitions/order-sales-channel.js +7 -6
- package/dist/definitions/product-sales-channel.js +4 -4
- package/dist/definitions/product-shipping-profile.js +4 -4
- package/dist/definitions/product-variant-inventory-item.js +7 -4
- package/dist/definitions/product-variant-price-set.js +4 -4
- package/dist/definitions/publishable-api-key-sales-channel.js +9 -13
- package/dist/definitions/region-payment-provider.js +4 -4
- package/dist/definitions/sales-channel-location.js +4 -4
- package/dist/definitions/shipping-option-price-set.js +11 -5
- package/dist/repositories/link.d.ts +1 -0
- package/dist/services/link-module-service.d.ts +1 -1
- package/dist/services/link-module-service.js +14 -9
- package/dist/services/link.d.ts +1 -1
- package/dist/services/link.js +29 -11
- package/package.json +5 -5
- package/dist/links.d.ts +0 -14
- package/dist/links.js +0 -20
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CartPaymentCollection = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.CartPaymentCollection = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.CartPaymentCollection,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "cart_payment_collection",
|
|
@@ -40,7 +40,7 @@ exports.CartPaymentCollection = {
|
|
|
40
40
|
payment_collection: "payment_collection_link.payment_collection",
|
|
41
41
|
},
|
|
42
42
|
relationship: {
|
|
43
|
-
serviceName:
|
|
43
|
+
serviceName: utils_1.LINKS.CartPaymentCollection,
|
|
44
44
|
primaryKey: "cart_id",
|
|
45
45
|
foreignKey: "id",
|
|
46
46
|
alias: "payment_collection_link",
|
|
@@ -52,7 +52,7 @@ exports.CartPaymentCollection = {
|
|
|
52
52
|
cart: "cart_link.cart",
|
|
53
53
|
},
|
|
54
54
|
relationship: {
|
|
55
|
-
serviceName:
|
|
55
|
+
serviceName: utils_1.LINKS.CartPaymentCollection,
|
|
56
56
|
primaryKey: "payment_collection_id",
|
|
57
57
|
foreignKey: "id",
|
|
58
58
|
alias: "cart_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CartPromotion = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.CartPromotion = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.CartPromotion,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "cart_promotion",
|
|
@@ -37,7 +37,7 @@ exports.CartPromotion = {
|
|
|
37
37
|
{
|
|
38
38
|
serviceName: modules_sdk_1.Modules.CART,
|
|
39
39
|
relationship: {
|
|
40
|
-
serviceName:
|
|
40
|
+
serviceName: utils_1.LINKS.CartPromotion,
|
|
41
41
|
primaryKey: "cart_id",
|
|
42
42
|
foreignKey: "id",
|
|
43
43
|
alias: "cart_link",
|
|
@@ -46,7 +46,7 @@ exports.CartPromotion = {
|
|
|
46
46
|
{
|
|
47
47
|
serviceName: modules_sdk_1.Modules.PROMOTION,
|
|
48
48
|
relationship: {
|
|
49
|
-
serviceName:
|
|
49
|
+
serviceName: utils_1.LINKS.CartPromotion,
|
|
50
50
|
primaryKey: "promotion_id",
|
|
51
51
|
foreignKey: "id",
|
|
52
52
|
alias: "promotion_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FulfillmentSetLocation = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.FulfillmentSetLocation = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.FulfillmentSetLocation,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "fulfillment_set_location",
|
|
@@ -40,7 +40,7 @@ exports.FulfillmentSetLocation = {
|
|
|
40
40
|
stock_locations: "locations_link.location",
|
|
41
41
|
},
|
|
42
42
|
relationship: {
|
|
43
|
-
serviceName:
|
|
43
|
+
serviceName: utils_1.LINKS.FulfillmentSetLocation,
|
|
44
44
|
primaryKey: "fulfillment_set_id",
|
|
45
45
|
foreignKey: "id",
|
|
46
46
|
alias: "locations_link",
|
|
@@ -50,7 +50,7 @@ exports.FulfillmentSetLocation = {
|
|
|
50
50
|
{
|
|
51
51
|
serviceName: modules_sdk_1.Modules.STOCK_LOCATION,
|
|
52
52
|
relationship: {
|
|
53
|
-
serviceName:
|
|
53
|
+
serviceName: utils_1.LINKS.FulfillmentSetLocation,
|
|
54
54
|
primaryKey: "stock_location_id",
|
|
55
55
|
foreignKey: "id",
|
|
56
56
|
alias: "fulfillment_set_link",
|
|
@@ -5,6 +5,9 @@ export * from "./cart-region";
|
|
|
5
5
|
export * from "./cart-sales-channel";
|
|
6
6
|
export * from "./fulfillment-set-location";
|
|
7
7
|
export * from "./inventory-level-stock-location";
|
|
8
|
+
export * from "./order-customer";
|
|
9
|
+
export * from "./order-promotion";
|
|
10
|
+
export * from "./order-region";
|
|
8
11
|
export * from "./order-sales-channel";
|
|
9
12
|
export * from "./product-sales-channel";
|
|
10
13
|
export * from "./product-shipping-profile";
|
|
@@ -21,6 +21,9 @@ __exportStar(require("./cart-region"), exports);
|
|
|
21
21
|
__exportStar(require("./cart-sales-channel"), exports);
|
|
22
22
|
__exportStar(require("./fulfillment-set-location"), exports);
|
|
23
23
|
__exportStar(require("./inventory-level-stock-location"), exports);
|
|
24
|
+
__exportStar(require("./order-customer"), exports);
|
|
25
|
+
__exportStar(require("./order-promotion"), exports);
|
|
26
|
+
__exportStar(require("./order-region"), exports);
|
|
24
27
|
__exportStar(require("./order-sales-channel"), exports);
|
|
25
28
|
__exportStar(require("./product-sales-channel"), exports);
|
|
26
29
|
__exportStar(require("./product-shipping-profile"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderCustomer = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
exports.OrderCustomer = {
|
|
6
|
+
isLink: true,
|
|
7
|
+
isReadOnlyLink: true,
|
|
8
|
+
extends: [
|
|
9
|
+
{
|
|
10
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
11
|
+
relationship: {
|
|
12
|
+
serviceName: modules_sdk_1.Modules.CUSTOMER,
|
|
13
|
+
primaryKey: "id",
|
|
14
|
+
foreignKey: "customer_id",
|
|
15
|
+
alias: "customer",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
serviceName: modules_sdk_1.Modules.CUSTOMER,
|
|
20
|
+
relationship: {
|
|
21
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
22
|
+
primaryKey: "customer_id",
|
|
23
|
+
foreignKey: "id",
|
|
24
|
+
alias: "orders",
|
|
25
|
+
isList: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderPromotion = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
|
+
exports.OrderPromotion = {
|
|
7
|
+
serviceName: utils_1.LINKS.OrderPromotion,
|
|
8
|
+
isLink: true,
|
|
9
|
+
databaseConfig: {
|
|
10
|
+
tableName: "order_promotion",
|
|
11
|
+
idPrefix: "orderpromo",
|
|
12
|
+
},
|
|
13
|
+
alias: [
|
|
14
|
+
{
|
|
15
|
+
name: ["order_promotion", "order_promotions"],
|
|
16
|
+
args: {
|
|
17
|
+
entity: "LinkOrderPromotion",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
primaryKeys: ["id", "order_id", "promotion_id"],
|
|
22
|
+
relationships: [
|
|
23
|
+
{
|
|
24
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
25
|
+
primaryKey: "id",
|
|
26
|
+
foreignKey: "order_id",
|
|
27
|
+
alias: "order",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
serviceName: modules_sdk_1.Modules.PROMOTION,
|
|
31
|
+
primaryKey: "id",
|
|
32
|
+
foreignKey: "promotion_id",
|
|
33
|
+
alias: "promotion",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
extends: [
|
|
37
|
+
{
|
|
38
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
39
|
+
relationship: {
|
|
40
|
+
serviceName: utils_1.LINKS.OrderPromotion,
|
|
41
|
+
primaryKey: "order_id",
|
|
42
|
+
foreignKey: "id",
|
|
43
|
+
alias: "order_link",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
serviceName: modules_sdk_1.Modules.PROMOTION,
|
|
48
|
+
relationship: {
|
|
49
|
+
serviceName: utils_1.LINKS.OrderPromotion,
|
|
50
|
+
primaryKey: "promotion_id",
|
|
51
|
+
foreignKey: "id",
|
|
52
|
+
alias: "promotion_link",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderRegion = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
exports.OrderRegion = {
|
|
6
|
+
isLink: true,
|
|
7
|
+
isReadOnlyLink: true,
|
|
8
|
+
extends: [
|
|
9
|
+
{
|
|
10
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
11
|
+
relationship: {
|
|
12
|
+
serviceName: modules_sdk_1.Modules.REGION,
|
|
13
|
+
primaryKey: "id",
|
|
14
|
+
foreignKey: "region_id",
|
|
15
|
+
alias: "region",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
serviceName: modules_sdk_1.Modules.REGION,
|
|
20
|
+
relationship: {
|
|
21
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
22
|
+
primaryKey: "region_id",
|
|
23
|
+
foreignKey: "id",
|
|
24
|
+
alias: "orders",
|
|
25
|
+
isList: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderSalesChannel = void 0;
|
|
4
|
-
const
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
5
6
|
exports.OrderSalesChannel = {
|
|
6
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.OrderSalesChannel,
|
|
7
8
|
isLink: true,
|
|
8
9
|
databaseConfig: {
|
|
9
10
|
tableName: "order_sales_channel",
|
|
@@ -20,7 +21,7 @@ exports.OrderSalesChannel = {
|
|
|
20
21
|
primaryKeys: ["id", "order_id", "sales_channel_id"],
|
|
21
22
|
relationships: [
|
|
22
23
|
{
|
|
23
|
-
serviceName:
|
|
24
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
24
25
|
isInternalService: true,
|
|
25
26
|
primaryKey: "id",
|
|
26
27
|
foreignKey: "order_id",
|
|
@@ -36,12 +37,12 @@ exports.OrderSalesChannel = {
|
|
|
36
37
|
],
|
|
37
38
|
extends: [
|
|
38
39
|
{
|
|
39
|
-
serviceName:
|
|
40
|
+
serviceName: modules_sdk_1.Modules.ORDER,
|
|
40
41
|
fieldAlias: {
|
|
41
42
|
sales_channel: "sales_channel_link.sales_channel",
|
|
42
43
|
},
|
|
43
44
|
relationship: {
|
|
44
|
-
serviceName:
|
|
45
|
+
serviceName: utils_1.LINKS.OrderSalesChannel,
|
|
45
46
|
isInternalService: true,
|
|
46
47
|
primaryKey: "order_id",
|
|
47
48
|
foreignKey: "id",
|
|
@@ -54,7 +55,7 @@ exports.OrderSalesChannel = {
|
|
|
54
55
|
orders: "order_link.order",
|
|
55
56
|
},
|
|
56
57
|
relationship: {
|
|
57
|
-
serviceName:
|
|
58
|
+
serviceName: utils_1.LINKS.OrderSalesChannel,
|
|
58
59
|
isInternalService: true,
|
|
59
60
|
primaryKey: "sales_channel_id",
|
|
60
61
|
foreignKey: "id",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductSalesChannel = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.ProductSalesChannel = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.ProductSalesChannel,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "product_sales_channel",
|
|
@@ -41,7 +41,7 @@ exports.ProductSalesChannel = {
|
|
|
41
41
|
sales_channels: "sales_channels_link.sales_channel",
|
|
42
42
|
},
|
|
43
43
|
relationship: {
|
|
44
|
-
serviceName:
|
|
44
|
+
serviceName: utils_1.LINKS.ProductSalesChannel,
|
|
45
45
|
primaryKey: "product_id",
|
|
46
46
|
foreignKey: "id",
|
|
47
47
|
alias: "sales_channels_link",
|
|
@@ -51,7 +51,7 @@ exports.ProductSalesChannel = {
|
|
|
51
51
|
{
|
|
52
52
|
serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
|
|
53
53
|
relationship: {
|
|
54
|
-
serviceName:
|
|
54
|
+
serviceName: utils_1.LINKS.ProductSalesChannel,
|
|
55
55
|
isInternalService: true,
|
|
56
56
|
primaryKey: "sales_channel_id",
|
|
57
57
|
foreignKey: "id",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductShippingProfile = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.ProductShippingProfile = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.ProductShippingProfile,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "product_shipping_profile",
|
|
@@ -41,7 +41,7 @@ exports.ProductShippingProfile = {
|
|
|
41
41
|
profile: "shipping_profile.profile",
|
|
42
42
|
},
|
|
43
43
|
relationship: {
|
|
44
|
-
serviceName:
|
|
44
|
+
serviceName: utils_1.LINKS.ProductShippingProfile,
|
|
45
45
|
primaryKey: "product_id",
|
|
46
46
|
foreignKey: "id",
|
|
47
47
|
alias: "shipping_profile",
|
|
@@ -50,7 +50,7 @@ exports.ProductShippingProfile = {
|
|
|
50
50
|
{
|
|
51
51
|
serviceName: "shippingProfileService",
|
|
52
52
|
relationship: {
|
|
53
|
-
serviceName:
|
|
53
|
+
serviceName: utils_1.LINKS.ProductShippingProfile,
|
|
54
54
|
isInternalService: true,
|
|
55
55
|
primaryKey: "profile_id",
|
|
56
56
|
foreignKey: "id",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductVariantInventoryItem = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
|
4
5
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const links_1 = require("../links");
|
|
6
6
|
exports.ProductVariantInventoryItem = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.ProductVariantInventoryItem,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "product_variant_inventory_item",
|
|
@@ -50,7 +50,7 @@ exports.ProductVariantInventoryItem = {
|
|
|
50
50
|
{
|
|
51
51
|
serviceName: modules_sdk_1.Modules.PRODUCT,
|
|
52
52
|
relationship: {
|
|
53
|
-
serviceName:
|
|
53
|
+
serviceName: utils_1.LINKS.ProductVariantInventoryItem,
|
|
54
54
|
primaryKey: "variant_id",
|
|
55
55
|
foreignKey: "id",
|
|
56
56
|
alias: "inventory_items",
|
|
@@ -59,8 +59,11 @@ exports.ProductVariantInventoryItem = {
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
serviceName: modules_sdk_1.Modules.INVENTORY,
|
|
62
|
+
fieldAlias: {
|
|
63
|
+
variant: "variant_link.variant",
|
|
64
|
+
},
|
|
62
65
|
relationship: {
|
|
63
|
-
serviceName:
|
|
66
|
+
serviceName: utils_1.LINKS.ProductVariantInventoryItem,
|
|
64
67
|
primaryKey: "inventory_item_id",
|
|
65
68
|
foreignKey: "id",
|
|
66
69
|
alias: "variant_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProductVariantPriceSet = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.ProductVariantPriceSet = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.ProductVariantPriceSet,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "product_variant_price_set",
|
|
@@ -46,7 +46,7 @@ exports.ProductVariantPriceSet = {
|
|
|
46
46
|
price_set: "price_set_link.price_set",
|
|
47
47
|
},
|
|
48
48
|
relationship: {
|
|
49
|
-
serviceName:
|
|
49
|
+
serviceName: utils_1.LINKS.ProductVariantPriceSet,
|
|
50
50
|
primaryKey: "variant_id",
|
|
51
51
|
foreignKey: "id",
|
|
52
52
|
alias: "price_set_link",
|
|
@@ -55,7 +55,7 @@ exports.ProductVariantPriceSet = {
|
|
|
55
55
|
{
|
|
56
56
|
serviceName: modules_sdk_1.Modules.PRICING,
|
|
57
57
|
relationship: {
|
|
58
|
-
serviceName:
|
|
58
|
+
serviceName: utils_1.LINKS.ProductVariantPriceSet,
|
|
59
59
|
primaryKey: "price_set_id",
|
|
60
60
|
foreignKey: "id",
|
|
61
61
|
alias: "variant_link",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PublishableApiKeySalesChannel = void 0;
|
|
4
|
-
const links_1 = require("../links");
|
|
5
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.PublishableApiKeySalesChannel = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.PublishableApiKeySalesChannel,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "publishable_api_key_sales_channel",
|
|
@@ -12,24 +12,22 @@ exports.PublishableApiKeySalesChannel = {
|
|
|
12
12
|
},
|
|
13
13
|
alias: [
|
|
14
14
|
{
|
|
15
|
-
name:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
name: [
|
|
16
|
+
"publishable_api_key_sales_channel",
|
|
17
|
+
"publishable_api_key_sales_channels",
|
|
18
|
+
],
|
|
19
19
|
},
|
|
20
20
|
],
|
|
21
21
|
primaryKeys: ["id", "publishable_key_id", "sales_channel_id"],
|
|
22
22
|
relationships: [
|
|
23
23
|
{
|
|
24
24
|
serviceName: modules_sdk_1.Modules.API_KEY,
|
|
25
|
-
isInternalService: true,
|
|
26
25
|
primaryKey: "id",
|
|
27
26
|
foreignKey: "publishable_key_id",
|
|
28
27
|
alias: "api_key",
|
|
29
28
|
},
|
|
30
29
|
{
|
|
31
30
|
serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
|
|
32
|
-
isInternalService: true,
|
|
33
31
|
primaryKey: "id",
|
|
34
32
|
foreignKey: "sales_channel_id",
|
|
35
33
|
alias: "sales_channel",
|
|
@@ -42,8 +40,7 @@ exports.PublishableApiKeySalesChannel = {
|
|
|
42
40
|
sales_channels: "sales_channels_link.sales_channel",
|
|
43
41
|
},
|
|
44
42
|
relationship: {
|
|
45
|
-
serviceName:
|
|
46
|
-
isInternalService: true,
|
|
43
|
+
serviceName: utils_1.LINKS.PublishableApiKeySalesChannel,
|
|
47
44
|
primaryKey: "publishable_key_id",
|
|
48
45
|
foreignKey: "id",
|
|
49
46
|
alias: "sales_channels_link",
|
|
@@ -53,11 +50,10 @@ exports.PublishableApiKeySalesChannel = {
|
|
|
53
50
|
{
|
|
54
51
|
serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
|
|
55
52
|
fieldAlias: {
|
|
56
|
-
|
|
53
|
+
publishable_api_keys: "api_keys_link.api_key",
|
|
57
54
|
},
|
|
58
55
|
relationship: {
|
|
59
|
-
serviceName:
|
|
60
|
-
isInternalService: true,
|
|
56
|
+
serviceName: utils_1.LINKS.PublishableApiKeySalesChannel,
|
|
61
57
|
primaryKey: "sales_channel_id",
|
|
62
58
|
foreignKey: "id",
|
|
63
59
|
alias: "api_keys_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RegionPaymentProvider = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.RegionPaymentProvider = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.RegionPaymentProvider,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "region_payment_provider",
|
|
@@ -41,7 +41,7 @@ exports.RegionPaymentProvider = {
|
|
|
41
41
|
payment_providers: "payment_provider_link.payment_provider",
|
|
42
42
|
},
|
|
43
43
|
relationship: {
|
|
44
|
-
serviceName:
|
|
44
|
+
serviceName: utils_1.LINKS.RegionPaymentProvider,
|
|
45
45
|
primaryKey: "region_id",
|
|
46
46
|
foreignKey: "id",
|
|
47
47
|
alias: "payment_provider_link",
|
|
@@ -54,7 +54,7 @@ exports.RegionPaymentProvider = {
|
|
|
54
54
|
regions: "region_link.region",
|
|
55
55
|
},
|
|
56
56
|
relationship: {
|
|
57
|
-
serviceName:
|
|
57
|
+
serviceName: utils_1.LINKS.RegionPaymentProvider,
|
|
58
58
|
primaryKey: "payment_provider_id",
|
|
59
59
|
foreignKey: "id",
|
|
60
60
|
alias: "region_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SalesChannelLocation = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.SalesChannelLocation = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.SalesChannelLocation,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "sales_channel_stock_location",
|
|
@@ -40,7 +40,7 @@ exports.SalesChannelLocation = {
|
|
|
40
40
|
stock_locations: "locations_link.location",
|
|
41
41
|
},
|
|
42
42
|
relationship: {
|
|
43
|
-
serviceName:
|
|
43
|
+
serviceName: utils_1.LINKS.SalesChannelLocation,
|
|
44
44
|
primaryKey: "sales_channel_id",
|
|
45
45
|
foreignKey: "id",
|
|
46
46
|
alias: "locations_link",
|
|
@@ -53,7 +53,7 @@ exports.SalesChannelLocation = {
|
|
|
53
53
|
sales_channels: "sales_channels_link.sales_channel",
|
|
54
54
|
},
|
|
55
55
|
relationship: {
|
|
56
|
-
serviceName:
|
|
56
|
+
serviceName: utils_1.LINKS.SalesChannelLocation,
|
|
57
57
|
primaryKey: "stock_location_id",
|
|
58
58
|
foreignKey: "id",
|
|
59
59
|
alias: "sales_channels_link",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShippingOptionPriceSet = void 0;
|
|
4
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
6
|
exports.ShippingOptionPriceSet = {
|
|
7
|
-
serviceName:
|
|
7
|
+
serviceName: utils_1.LINKS.ShippingOptionPriceSet,
|
|
8
8
|
isLink: true,
|
|
9
9
|
databaseConfig: {
|
|
10
10
|
tableName: "shipping_option_price_set",
|
|
@@ -40,17 +40,23 @@ exports.ShippingOptionPriceSet = {
|
|
|
40
40
|
extends: [
|
|
41
41
|
{
|
|
42
42
|
serviceName: modules_sdk_1.Modules.FULFILLMENT,
|
|
43
|
+
fieldAlias: {
|
|
44
|
+
prices: {
|
|
45
|
+
path: "price_set_link.price_set.prices",
|
|
46
|
+
isList: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
43
49
|
relationship: {
|
|
44
|
-
serviceName:
|
|
50
|
+
serviceName: utils_1.LINKS.ShippingOptionPriceSet,
|
|
45
51
|
primaryKey: "shipping_option_id",
|
|
46
52
|
foreignKey: "id",
|
|
47
|
-
alias: "
|
|
53
|
+
alias: "price_set_link",
|
|
48
54
|
},
|
|
49
55
|
},
|
|
50
56
|
{
|
|
51
57
|
serviceName: modules_sdk_1.Modules.PRICING,
|
|
52
58
|
relationship: {
|
|
53
|
-
serviceName:
|
|
59
|
+
serviceName: utils_1.LINKS.ShippingOptionPriceSet,
|
|
54
60
|
primaryKey: "price_set_id",
|
|
55
61
|
foreignKey: "id",
|
|
56
62
|
alias: "shipping_option_link",
|
|
@@ -14,6 +14,7 @@ export declare function getLinkRepository(model: EntitySchema): {
|
|
|
14
14
|
find(options?: import("@medusajs/types").FindOptions<object> | undefined, context?: Context | undefined): Promise<object[]>;
|
|
15
15
|
findAndCount(options?: import("@medusajs/types").FindOptions<object> | undefined, context?: Context | undefined): Promise<[object[], number]>;
|
|
16
16
|
upsert(data: unknown[], context?: Context | undefined): Promise<object[]>;
|
|
17
|
+
upsertWithReplace(data: unknown[], config?: import("@medusajs/types").UpsertWithReplaceConfig<object> | undefined, context?: Context | undefined): Promise<object[]>;
|
|
17
18
|
softDelete(idsOrFilter: string[] | {
|
|
18
19
|
[x: string]: any;
|
|
19
20
|
}, sharedContext?: Context | undefined): Promise<[object[], Record<string, unknown[]>]>;
|
|
@@ -32,7 +32,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
|
|
32
32
|
dismiss(primaryKeyOrBulkData: string | string[] | [string | string[], string][], foreignKeyData?: string, sharedContext?: Context): Promise<object[]>;
|
|
33
33
|
delete(data: any, sharedContext?: Context): Promise<void>;
|
|
34
34
|
softDelete(data: any, { returnLinkableKeys }?: SoftDeleteReturn, sharedContext?: Context): Promise<Record<string, unknown[]> | void>;
|
|
35
|
-
protected softDelete_(data: any, sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
35
|
+
protected softDelete_(data: any[], sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
36
36
|
restore(data: any, { returnLinkableKeys }?: RestoreReturn, sharedContext?: Context): Promise<Record<string, unknown[]> | void>;
|
|
37
37
|
restore_(data: any, sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
38
38
|
}
|
|
@@ -47,10 +47,13 @@ class LinkModuleService {
|
|
|
47
47
|
return this.primaryKey_.concat(this.foreignKey_).includes(name);
|
|
48
48
|
}
|
|
49
49
|
validateFields(data) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const dataToValidate = Array.isArray(data) ? data : [data];
|
|
51
|
+
dataToValidate.forEach((d) => {
|
|
52
|
+
const keys = Object.keys(d);
|
|
53
|
+
if (keys.some((k) => !this.isValidKeyName(k))) {
|
|
54
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Invalid field name provided. Valid field names are ${this.primaryKey_.concat(this.foreignKey_)}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
54
57
|
}
|
|
55
58
|
async retrieve(primaryKeyData, foreignKeyData, sharedContext = {}) {
|
|
56
59
|
const filter = this.buildData(primaryKeyData, foreignKeyData);
|
|
@@ -133,8 +136,9 @@ class LinkModuleService {
|
|
|
133
136
|
})));
|
|
134
137
|
}
|
|
135
138
|
async softDelete(data, { returnLinkableKeys } = {}, sharedContext = {}) {
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
const inputArray = Array.isArray(data) ? data : [data];
|
|
140
|
+
this.validateFields(inputArray);
|
|
141
|
+
let [deletedEntities, cascadedEntitiesMap] = await this.softDelete_(inputArray, sharedContext);
|
|
138
142
|
const pk = this.primaryKey_.join(",");
|
|
139
143
|
const entityNameToLinkableKeysMap = {
|
|
140
144
|
LinkModel: [
|
|
@@ -168,8 +172,9 @@ class LinkModuleService {
|
|
|
168
172
|
return await this.linkService_.softDelete(data, sharedContext);
|
|
169
173
|
}
|
|
170
174
|
async restore(data, { returnLinkableKeys } = {}, sharedContext = {}) {
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
const inputArray = Array.isArray(data) ? data : [data];
|
|
176
|
+
this.validateFields(inputArray);
|
|
177
|
+
let [restoredEntities, cascadedEntitiesMap] = await this.restore_(inputArray, sharedContext);
|
|
173
178
|
const pk = this.primaryKey_.join(",");
|
|
174
179
|
const entityNameToLinkableKeysMap = {
|
|
175
180
|
LinkModel: [
|
|
@@ -256,7 +261,7 @@ __decorate([
|
|
|
256
261
|
(0, utils_1.InjectTransactionManager)(utils_2.shouldForceTransaction, "baseRepository_"),
|
|
257
262
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
258
263
|
__metadata("design:type", Function),
|
|
259
|
-
__metadata("design:paramtypes", [
|
|
264
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
260
265
|
__metadata("design:returntype", Promise)
|
|
261
266
|
], LinkModuleService.prototype, "softDelete_", null);
|
|
262
267
|
__decorate([
|
package/dist/services/link.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export default class LinkService<TEntity> {
|
|
|
10
10
|
create(data: unknown[], sharedContext?: Context): Promise<TEntity[]>;
|
|
11
11
|
dismiss(data: unknown[], sharedContext?: Context): Promise<TEntity[]>;
|
|
12
12
|
delete(data: unknown, sharedContext?: Context): Promise<void>;
|
|
13
|
-
softDelete(data: any, sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
13
|
+
softDelete(data: any[], sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
14
14
|
restore(data: any, sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
package/dist/services/link.js
CHANGED
|
@@ -51,20 +51,38 @@ class LinkService {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
async softDelete(data, sharedContext = {}) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const deleteFilters = {
|
|
55
|
+
$or: data.map((dataEntry) => {
|
|
56
|
+
const filter = {};
|
|
57
|
+
for (const key in dataEntry) {
|
|
58
|
+
filter[key] = {
|
|
59
|
+
$in: Array.isArray(dataEntry[key])
|
|
60
|
+
? dataEntry[key]
|
|
61
|
+
: [dataEntry[key]],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return filter;
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
return await this.linkRepository_.softDelete(deleteFilters, {
|
|
59
68
|
transactionManager: sharedContext.transactionManager,
|
|
60
69
|
});
|
|
61
70
|
}
|
|
62
71
|
async restore(data, sharedContext = {}) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
const restoreFilters = {
|
|
73
|
+
$or: data.map((dataEntry) => {
|
|
74
|
+
const filter = {};
|
|
75
|
+
for (const key in dataEntry) {
|
|
76
|
+
filter[key] = {
|
|
77
|
+
$in: Array.isArray(dataEntry[key])
|
|
78
|
+
? dataEntry[key]
|
|
79
|
+
: [dataEntry[key]],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return filter;
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
return await this.linkRepository_.restore(restoreFilters, {
|
|
68
86
|
transactionManager: sharedContext.transactionManager,
|
|
69
87
|
});
|
|
70
88
|
}
|
|
@@ -109,7 +127,7 @@ __decorate([
|
|
|
109
127
|
(0, utils_1.InjectTransactionManager)(utils_2.doNotForceTransaction, "linkRepository_"),
|
|
110
128
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
111
129
|
__metadata("design:type", Function),
|
|
112
|
-
__metadata("design:paramtypes", [
|
|
130
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
113
131
|
__metadata("design:returntype", Promise)
|
|
114
132
|
], LinkService.prototype, "softDelete", null);
|
|
115
133
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/link-modules",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11-next-20240425093236",
|
|
4
4
|
"description": "Medusa Default Link Modules Package and Definitions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"watch:test": "tsc --build tsconfig.spec.json --watch",
|
|
26
26
|
"prepare": "cross-env NODE_ENV=production yarn run build",
|
|
27
27
|
"build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
|
|
28
|
-
"test": "jest --passWithNoTests --runInBand --bail --forceExit",
|
|
28
|
+
"test": "jest --passWithNoTests --runInBand --bail --forceExit -- src",
|
|
29
29
|
"test:integration": "jest --passWithNoTests"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"typescript": "^5.1.6"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@medusajs/modules-sdk": "
|
|
43
|
-
"@medusajs/types": "
|
|
44
|
-
"@medusajs/utils": "
|
|
42
|
+
"@medusajs/modules-sdk": "1.12.11-next-20240425093236",
|
|
43
|
+
"@medusajs/types": "1.12.0-next-20240425093236",
|
|
44
|
+
"@medusajs/utils": "1.12.0-next-20240425093236",
|
|
45
45
|
"@mikro-orm/core": "5.9.7",
|
|
46
46
|
"@mikro-orm/postgresql": "5.9.7",
|
|
47
47
|
"awilix": "^8.0.0"
|
package/dist/links.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const LINKS: {
|
|
2
|
-
ProductVariantInventoryItem: string;
|
|
3
|
-
ProductVariantPriceSet: string;
|
|
4
|
-
ShippingOptionPriceSet: string;
|
|
5
|
-
CartPaymentCollection: string;
|
|
6
|
-
RegionPaymentProvider: string;
|
|
7
|
-
CartPromotion: string;
|
|
8
|
-
SalesChannelLocation: string;
|
|
9
|
-
FulfillmentSetLocation: string;
|
|
10
|
-
ProductShippingProfile: string;
|
|
11
|
-
ProductSalesChannel: string;
|
|
12
|
-
OrderSalesChannel: string;
|
|
13
|
-
PublishableApiKeySalesChannel: string;
|
|
14
|
-
};
|
package/dist/links.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LINKS = void 0;
|
|
4
|
-
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
exports.LINKS = {
|
|
7
|
-
ProductVariantInventoryItem: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", modules_sdk_1.Modules.INVENTORY, "inventory_item_id"),
|
|
8
|
-
ProductVariantPriceSet: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", modules_sdk_1.Modules.PRICING, "price_set_id"),
|
|
9
|
-
ShippingOptionPriceSet: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.FULFILLMENT, "shipping_option_id", modules_sdk_1.Modules.PRICING, "price_set_id"),
|
|
10
|
-
CartPaymentCollection: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.CART, "cart_id", modules_sdk_1.Modules.PAYMENT, "payment_collection_id"),
|
|
11
|
-
RegionPaymentProvider: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.REGION, "region_id", modules_sdk_1.Modules.PAYMENT, "payment_provider_id"),
|
|
12
|
-
CartPromotion: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.CART, "cart_id", modules_sdk_1.Modules.PROMOTION, "promotion_id"),
|
|
13
|
-
SalesChannelLocation: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.SALES_CHANNEL, "sales_channel_id", modules_sdk_1.Modules.STOCK_LOCATION, "location_id"),
|
|
14
|
-
FulfillmentSetLocation: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.FULFILLMENT, "fulfillment_set_id", modules_sdk_1.Modules.STOCK_LOCATION, "location_id"),
|
|
15
|
-
// Internal services
|
|
16
|
-
ProductShippingProfile: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "variant_id", "shippingProfileService", "profile_id"),
|
|
17
|
-
ProductSalesChannel: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.PRODUCT, "product_id", modules_sdk_1.Modules.SALES_CHANNEL, "sales_channel_id"),
|
|
18
|
-
OrderSalesChannel: (0, utils_1.composeLinkName)("orderService", "order_id", modules_sdk_1.Modules.SALES_CHANNEL, "sales_channel_id"),
|
|
19
|
-
PublishableApiKeySalesChannel: (0, utils_1.composeLinkName)(modules_sdk_1.Modules.API_KEY, "api_key_id", modules_sdk_1.Modules.SALES_CHANNEL, "sales_channel_id"),
|
|
20
|
-
};
|