@medusajs/link-modules 0.2.12-snapshot-20240718073308 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. package/dist/definitions/{readonly/cart-customer.d.ts → cart-customer.d.ts} +0 -1
  2. package/dist/definitions/{readonly/cart-customer.js → cart-customer.js} +5 -11
  3. package/dist/definitions/cart-payment-collection.d.ts +0 -1
  4. package/dist/definitions/cart-payment-collection.js +5 -10
  5. package/dist/definitions/cart-promotion.d.ts +0 -1
  6. package/dist/definitions/cart-promotion.js +14 -14
  7. package/dist/definitions/{readonly/cart-region.d.ts → cart-region.d.ts} +0 -1
  8. package/dist/definitions/{readonly/cart-region.js → cart-region.js} +5 -11
  9. package/dist/definitions/{readonly/cart-sales-channel.d.ts → cart-sales-channel.d.ts} +0 -1
  10. package/dist/definitions/{readonly/cart-sales-channel.js → cart-sales-channel.js} +5 -11
  11. package/dist/definitions/fulfillment-set-location.d.ts +1 -2
  12. package/dist/definitions/fulfillment-set-location.js +30 -35
  13. package/dist/definitions/index.d.ts +9 -5
  14. package/dist/definitions/index.js +9 -4
  15. package/dist/definitions/{readonly/inventory-level-stock-location.d.ts → inventory-level-stock-location.d.ts} +0 -1
  16. package/dist/definitions/{readonly/inventory-level-stock-location.js → inventory-level-stock-location.js} +3 -6
  17. package/dist/definitions/{readonly/order-customer.d.ts → order-customer.d.ts} +0 -1
  18. package/dist/definitions/{readonly/order-customer.js → order-customer.js} +5 -11
  19. package/dist/definitions/order-promotion.d.ts +0 -1
  20. package/dist/definitions/order-promotion.js +7 -15
  21. package/dist/definitions/{readonly/order-region.d.ts → order-region.d.ts} +0 -1
  22. package/dist/definitions/{readonly/order-region.js → order-region.js} +5 -11
  23. package/dist/definitions/{readonly/order-sales-channel.d.ts → order-sales-channel.d.ts} +0 -1
  24. package/dist/definitions/order-sales-channel.js +67 -0
  25. package/dist/definitions/product-sales-channel.d.ts +0 -1
  26. package/dist/definitions/product-sales-channel.js +7 -10
  27. package/dist/definitions/product-shipping-profile.d.ts +2 -0
  28. package/dist/definitions/product-shipping-profile.js +61 -0
  29. package/dist/definitions/product-variant-inventory-item.d.ts +0 -1
  30. package/dist/definitions/product-variant-inventory-item.js +7 -13
  31. package/dist/definitions/product-variant-price-set.d.ts +0 -1
  32. package/dist/definitions/product-variant-price-set.js +8 -9
  33. package/dist/definitions/publishable-api-key-sales-channel.d.ts +0 -1
  34. package/dist/definitions/publishable-api-key-sales-channel.js +5 -10
  35. package/dist/definitions/region-payment-provider.d.ts +0 -1
  36. package/dist/definitions/region-payment-provider.js +5 -7
  37. package/dist/definitions/sales-channel-location.d.ts +0 -1
  38. package/dist/definitions/sales-channel-location.js +5 -10
  39. package/dist/definitions/shipping-option-price-set.d.ts +0 -1
  40. package/dist/definitions/shipping-option-price-set.js +5 -7
  41. package/dist/definitions/store-default-currency.d.ts +2 -0
  42. package/dist/definitions/store-default-currency.js +19 -0
  43. package/dist/index.d.ts +0 -1
  44. package/dist/initialize/index.d.ts +0 -2
  45. package/dist/initialize/index.js +14 -30
  46. package/dist/initialize/module-definition.d.ts +0 -1
  47. package/dist/loaders/connection.d.ts +0 -1
  48. package/dist/loaders/container.d.ts +0 -1
  49. package/dist/loaders/index.d.ts +0 -1
  50. package/dist/migration/index.d.ts +0 -2
  51. package/dist/migration/index.js +7 -31
  52. package/dist/repositories/index.d.ts +0 -1
  53. package/dist/repositories/link.d.ts +4 -6
  54. package/dist/services/dynamic-service-class.d.ts +0 -1
  55. package/dist/services/dynamic-service-class.js +0 -7
  56. package/dist/services/index.d.ts +0 -1
  57. package/dist/services/link-module-service.d.ts +0 -1
  58. package/dist/services/link-module-service.js +36 -28
  59. package/dist/services/link.d.ts +0 -1
  60. package/dist/types/index.d.ts +0 -1
  61. package/dist/utils/compose-link-name.d.ts +0 -1
  62. package/dist/utils/generate-entity.d.ts +0 -1
  63. package/dist/utils/generate-schema.d.ts +0 -1
  64. package/dist/utils/generate-schema.js +4 -5
  65. package/dist/utils/index.d.ts +0 -1
  66. package/dist/utils/index.js +2 -2
  67. package/package.json +7 -6
  68. package/dist/definitions/cart-payment-collection.d.ts.map +0 -1
  69. package/dist/definitions/cart-promotion.d.ts.map +0 -1
  70. package/dist/definitions/fulfillment-set-location.d.ts.map +0 -1
  71. package/dist/definitions/index.d.ts.map +0 -1
  72. package/dist/definitions/order-cart.d.ts +0 -3
  73. package/dist/definitions/order-cart.d.ts.map +0 -1
  74. package/dist/definitions/order-cart.js +0 -67
  75. package/dist/definitions/order-claim-payment-collection.d.ts +0 -3
  76. package/dist/definitions/order-claim-payment-collection.d.ts.map +0 -1
  77. package/dist/definitions/order-claim-payment-collection.js +0 -73
  78. package/dist/definitions/order-exchange-payment-collection.d.ts +0 -3
  79. package/dist/definitions/order-exchange-payment-collection.d.ts.map +0 -1
  80. package/dist/definitions/order-exchange-payment-collection.js +0 -73
  81. package/dist/definitions/order-fulfillment.d.ts +0 -3
  82. package/dist/definitions/order-fulfillment.d.ts.map +0 -1
  83. package/dist/definitions/order-fulfillment.js +0 -66
  84. package/dist/definitions/order-payment-collection.d.ts +0 -3
  85. package/dist/definitions/order-payment-collection.d.ts.map +0 -1
  86. package/dist/definitions/order-payment-collection.js +0 -70
  87. package/dist/definitions/order-promotion.d.ts.map +0 -1
  88. package/dist/definitions/product-sales-channel.d.ts.map +0 -1
  89. package/dist/definitions/product-variant-inventory-item.d.ts.map +0 -1
  90. package/dist/definitions/product-variant-price-set.d.ts.map +0 -1
  91. package/dist/definitions/publishable-api-key-sales-channel.d.ts.map +0 -1
  92. package/dist/definitions/readonly/cart-customer.d.ts.map +0 -1
  93. package/dist/definitions/readonly/cart-product.d.ts +0 -3
  94. package/dist/definitions/readonly/cart-product.d.ts.map +0 -1
  95. package/dist/definitions/readonly/cart-product.js +0 -47
  96. package/dist/definitions/readonly/cart-region.d.ts.map +0 -1
  97. package/dist/definitions/readonly/cart-sales-channel.d.ts.map +0 -1
  98. package/dist/definitions/readonly/index.d.ts +0 -12
  99. package/dist/definitions/readonly/index.d.ts.map +0 -1
  100. package/dist/definitions/readonly/index.js +0 -27
  101. package/dist/definitions/readonly/inventory-level-stock-location.d.ts.map +0 -1
  102. package/dist/definitions/readonly/line-item-adjustment-promotion.d.ts +0 -3
  103. package/dist/definitions/readonly/line-item-adjustment-promotion.d.ts.map +0 -1
  104. package/dist/definitions/readonly/line-item-adjustment-promotion.js +0 -22
  105. package/dist/definitions/readonly/order-customer.d.ts.map +0 -1
  106. package/dist/definitions/readonly/order-product.d.ts +0 -3
  107. package/dist/definitions/readonly/order-product.d.ts.map +0 -1
  108. package/dist/definitions/readonly/order-product.js +0 -47
  109. package/dist/definitions/readonly/order-region.d.ts.map +0 -1
  110. package/dist/definitions/readonly/order-sales-channel.d.ts.map +0 -1
  111. package/dist/definitions/readonly/order-sales-channel.js +0 -35
  112. package/dist/definitions/readonly/store-currency.d.ts +0 -3
  113. package/dist/definitions/readonly/store-currency.d.ts.map +0 -1
  114. package/dist/definitions/readonly/store-currency.js +0 -22
  115. package/dist/definitions/region-payment-provider.d.ts.map +0 -1
  116. package/dist/definitions/sales-channel-location.d.ts.map +0 -1
  117. package/dist/definitions/shipping-option-price-set.d.ts.map +0 -1
  118. package/dist/index.d.ts.map +0 -1
  119. package/dist/initialize/index.d.ts.map +0 -1
  120. package/dist/initialize/module-definition.d.ts.map +0 -1
  121. package/dist/loaders/connection.d.ts.map +0 -1
  122. package/dist/loaders/container.d.ts.map +0 -1
  123. package/dist/loaders/index.d.ts.map +0 -1
  124. package/dist/migration/index.d.ts.map +0 -1
  125. package/dist/repositories/index.d.ts.map +0 -1
  126. package/dist/repositories/link.d.ts.map +0 -1
  127. package/dist/services/dynamic-service-class.d.ts.map +0 -1
  128. package/dist/services/index.d.ts.map +0 -1
  129. package/dist/services/link-module-service.d.ts.map +0 -1
  130. package/dist/services/link.d.ts.map +0 -1
  131. package/dist/types/index.d.ts.map +0 -1
  132. package/dist/utils/compose-link-name.d.ts.map +0 -1
  133. package/dist/utils/generate-entity.d.ts.map +0 -1
  134. package/dist/utils/generate-schema.d.ts.map +0 -1
  135. package/dist/utils/index.d.ts.map +0 -1
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderSalesChannel = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ const utils_1 = require("@medusajs/utils");
6
+ exports.OrderSalesChannel = {
7
+ serviceName: utils_1.LINKS.OrderSalesChannel,
8
+ isLink: true,
9
+ databaseConfig: {
10
+ tableName: "order_sales_channel",
11
+ idPrefix: "ordersc",
12
+ },
13
+ alias: [
14
+ {
15
+ name: "order_sales_channel",
16
+ },
17
+ {
18
+ name: "order_sales_channels",
19
+ },
20
+ ],
21
+ primaryKeys: ["id", "order_id", "sales_channel_id"],
22
+ relationships: [
23
+ {
24
+ serviceName: modules_sdk_1.Modules.ORDER,
25
+ isInternalService: true,
26
+ primaryKey: "id",
27
+ foreignKey: "order_id",
28
+ alias: "order",
29
+ },
30
+ {
31
+ serviceName: "salesChannelService",
32
+ isInternalService: true,
33
+ primaryKey: "id",
34
+ foreignKey: "sales_channel_id",
35
+ alias: "sales_channel",
36
+ },
37
+ ],
38
+ extends: [
39
+ {
40
+ serviceName: modules_sdk_1.Modules.ORDER,
41
+ fieldAlias: {
42
+ sales_channel: "sales_channel_link.sales_channel",
43
+ },
44
+ relationship: {
45
+ serviceName: utils_1.LINKS.OrderSalesChannel,
46
+ isInternalService: true,
47
+ primaryKey: "order_id",
48
+ foreignKey: "id",
49
+ alias: "sales_channel_link",
50
+ },
51
+ },
52
+ {
53
+ serviceName: "salesChannelService",
54
+ fieldAlias: {
55
+ orders: "order_link.order",
56
+ },
57
+ relationship: {
58
+ serviceName: utils_1.LINKS.OrderSalesChannel,
59
+ isInternalService: true,
60
+ primaryKey: "sales_channel_id",
61
+ foreignKey: "id",
62
+ alias: "order_link",
63
+ isList: true,
64
+ },
65
+ },
66
+ ],
67
+ };
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const ProductSalesChannel: ModuleJoinerConfig;
3
- //# sourceMappingURL=product-sales-channel.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductSalesChannel = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.ProductSalesChannel = {
6
7
  serviceName: utils_1.LINKS.ProductSalesChannel,
@@ -20,27 +21,22 @@ exports.ProductSalesChannel = {
20
21
  primaryKeys: ["id", "product_id", "sales_channel_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.PRODUCT,
24
+ serviceName: modules_sdk_1.Modules.PRODUCT,
24
25
  primaryKey: "id",
25
26
  foreignKey: "product_id",
26
27
  alias: "product",
27
- args: {
28
- methodSuffix: "Products",
29
- },
30
28
  },
31
29
  {
32
- serviceName: utils_1.Modules.SALES_CHANNEL,
30
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
31
+ isInternalService: true,
33
32
  primaryKey: "id",
34
33
  foreignKey: "sales_channel_id",
35
34
  alias: "sales_channel",
36
- args: {
37
- methodSuffix: "SalesChannels",
38
- },
39
35
  },
40
36
  ],
41
37
  extends: [
42
38
  {
43
- serviceName: utils_1.Modules.PRODUCT,
39
+ serviceName: modules_sdk_1.Modules.PRODUCT,
44
40
  fieldAlias: {
45
41
  sales_channels: "sales_channels_link.sales_channel",
46
42
  },
@@ -53,9 +49,10 @@ exports.ProductSalesChannel = {
53
49
  },
54
50
  },
55
51
  {
56
- serviceName: utils_1.Modules.SALES_CHANNEL,
52
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
57
53
  relationship: {
58
54
  serviceName: utils_1.LINKS.ProductSalesChannel,
55
+ isInternalService: true,
59
56
  primaryKey: "sales_channel_id",
60
57
  foreignKey: "id",
61
58
  alias: "products_link",
@@ -0,0 +1,2 @@
1
+ import { ModuleJoinerConfig } from "@medusajs/types";
2
+ export declare const ProductShippingProfile: ModuleJoinerConfig;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductShippingProfile = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ const utils_1 = require("@medusajs/utils");
6
+ exports.ProductShippingProfile = {
7
+ serviceName: utils_1.LINKS.ProductShippingProfile,
8
+ isLink: true,
9
+ databaseConfig: {
10
+ tableName: "product_shipping_profile",
11
+ idPrefix: "psprof",
12
+ },
13
+ alias: [
14
+ {
15
+ name: "product_shipping_profile",
16
+ args: {
17
+ entity: "LinkProductShippingProfile",
18
+ },
19
+ },
20
+ ],
21
+ primaryKeys: ["id", "product_id", "profile_id"],
22
+ relationships: [
23
+ {
24
+ serviceName: modules_sdk_1.Modules.PRODUCT,
25
+ primaryKey: "id",
26
+ foreignKey: "product_id",
27
+ alias: "product",
28
+ },
29
+ {
30
+ serviceName: "shippingProfileService",
31
+ isInternalService: true,
32
+ primaryKey: "id",
33
+ foreignKey: "profile_id",
34
+ alias: "profile",
35
+ },
36
+ ],
37
+ extends: [
38
+ {
39
+ serviceName: modules_sdk_1.Modules.PRODUCT,
40
+ fieldAlias: {
41
+ profile: "shipping_profile.profile",
42
+ },
43
+ relationship: {
44
+ serviceName: utils_1.LINKS.ProductShippingProfile,
45
+ primaryKey: "product_id",
46
+ foreignKey: "id",
47
+ alias: "shipping_profile",
48
+ },
49
+ },
50
+ {
51
+ serviceName: "shippingProfileService",
52
+ relationship: {
53
+ serviceName: utils_1.LINKS.ProductShippingProfile,
54
+ isInternalService: true,
55
+ primaryKey: "profile_id",
56
+ foreignKey: "id",
57
+ alias: "product_link",
58
+ },
59
+ },
60
+ ],
61
+ };
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const ProductVariantInventoryItem: ModuleJoinerConfig;
3
- //# sourceMappingURL=product-variant-inventory-item.d.ts.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductVariantInventoryItem = void 0;
4
4
  const utils_1 = require("@medusajs/utils");
5
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
6
  exports.ProductVariantInventoryItem = {
6
7
  serviceName: utils_1.LINKS.ProductVariantInventoryItem,
7
8
  isLink: true,
@@ -29,31 +30,25 @@ exports.ProductVariantInventoryItem = {
29
30
  primaryKeys: ["id", "variant_id", "inventory_item_id"],
30
31
  relationships: [
31
32
  {
32
- serviceName: utils_1.Modules.PRODUCT,
33
+ serviceName: modules_sdk_1.Modules.PRODUCT,
33
34
  primaryKey: "id",
34
35
  foreignKey: "variant_id",
35
36
  alias: "variant",
36
37
  args: {
37
- methodSuffix: "ProductVariants",
38
+ methodSuffix: "Variants",
38
39
  },
39
40
  },
40
41
  {
41
- serviceName: utils_1.Modules.INVENTORY,
42
+ serviceName: modules_sdk_1.Modules.INVENTORY,
42
43
  primaryKey: "id",
43
44
  foreignKey: "inventory_item_id",
44
45
  alias: "inventory",
45
- args: {
46
- methodSuffix: "InventoryItems",
47
- },
48
46
  deleteCascade: true,
49
47
  },
50
48
  ],
51
49
  extends: [
52
50
  {
53
- serviceName: utils_1.Modules.PRODUCT,
54
- fieldAlias: {
55
- inventory: "inventory_items.inventory",
56
- },
51
+ serviceName: modules_sdk_1.Modules.PRODUCT,
57
52
  relationship: {
58
53
  serviceName: utils_1.LINKS.ProductVariantInventoryItem,
59
54
  primaryKey: "variant_id",
@@ -63,16 +58,15 @@ exports.ProductVariantInventoryItem = {
63
58
  },
64
59
  },
65
60
  {
66
- serviceName: utils_1.Modules.INVENTORY,
61
+ serviceName: modules_sdk_1.Modules.INVENTORY,
67
62
  fieldAlias: {
68
- variants: "variant_link.variant",
63
+ variant: "variant_link.variant",
69
64
  },
70
65
  relationship: {
71
66
  serviceName: utils_1.LINKS.ProductVariantInventoryItem,
72
67
  primaryKey: "inventory_item_id",
73
68
  foreignKey: "id",
74
69
  alias: "variant_link",
75
- isList: true,
76
70
  },
77
71
  },
78
72
  ],
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const ProductVariantPriceSet: ModuleJoinerConfig;
3
- //# sourceMappingURL=product-variant-price-set.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductVariantPriceSet = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.ProductVariantPriceSet = {
6
7
  serviceName: utils_1.LINKS.ProductVariantPriceSet,
@@ -20,31 +21,29 @@ exports.ProductVariantPriceSet = {
20
21
  primaryKeys: ["id", "variant_id", "price_set_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.PRODUCT,
24
+ serviceName: modules_sdk_1.Modules.PRODUCT,
25
+ // TODO: Remove this when product module is the default product service
26
+ isInternalService: true,
24
27
  primaryKey: "id",
25
28
  foreignKey: "variant_id",
26
29
  alias: "variant",
27
30
  args: {
28
- methodSuffix: "ProductVariants",
31
+ methodSuffix: "Variants",
29
32
  },
30
33
  },
31
34
  {
32
- serviceName: utils_1.Modules.PRICING,
35
+ serviceName: modules_sdk_1.Modules.PRICING,
33
36
  primaryKey: "id",
34
37
  foreignKey: "price_set_id",
35
38
  alias: "price_set",
36
- args: {
37
- methodSuffix: "PriceSets",
38
- },
39
39
  deleteCascade: true,
40
40
  },
41
41
  ],
42
42
  extends: [
43
43
  {
44
- serviceName: utils_1.Modules.PRODUCT,
44
+ serviceName: modules_sdk_1.Modules.PRODUCT,
45
45
  fieldAlias: {
46
46
  price_set: "price_set_link.price_set",
47
- prices: "price_set_link.price_set.prices",
48
47
  calculated_price: {
49
48
  path: "price_set_link.price_set.calculated_price",
50
49
  forwardArgumentsOnPath: ["price_set_link.price_set"],
@@ -58,7 +57,7 @@ exports.ProductVariantPriceSet = {
58
57
  },
59
58
  },
60
59
  {
61
- serviceName: utils_1.Modules.PRICING,
60
+ serviceName: modules_sdk_1.Modules.PRICING,
62
61
  relationship: {
63
62
  serviceName: utils_1.LINKS.ProductVariantPriceSet,
64
63
  primaryKey: "price_set_id",
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const PublishableApiKeySalesChannel: ModuleJoinerConfig;
3
- //# sourceMappingURL=publishable-api-key-sales-channel.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PublishableApiKeySalesChannel = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.PublishableApiKeySalesChannel = {
6
7
  serviceName: utils_1.LINKS.PublishableApiKeySalesChannel,
@@ -20,27 +21,21 @@ exports.PublishableApiKeySalesChannel = {
20
21
  primaryKeys: ["id", "publishable_key_id", "sales_channel_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.API_KEY,
24
+ serviceName: modules_sdk_1.Modules.API_KEY,
24
25
  primaryKey: "id",
25
26
  foreignKey: "publishable_key_id",
26
27
  alias: "api_key",
27
- args: {
28
- methodSuffix: "ApiKeys",
29
- },
30
28
  },
31
29
  {
32
- serviceName: utils_1.Modules.SALES_CHANNEL,
30
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
33
31
  primaryKey: "id",
34
32
  foreignKey: "sales_channel_id",
35
33
  alias: "sales_channel",
36
- args: {
37
- methodSuffix: "SalesChannels",
38
- },
39
34
  },
40
35
  ],
41
36
  extends: [
42
37
  {
43
- serviceName: utils_1.Modules.API_KEY,
38
+ serviceName: modules_sdk_1.Modules.API_KEY,
44
39
  fieldAlias: {
45
40
  sales_channels: "sales_channels_link.sales_channel",
46
41
  },
@@ -53,7 +48,7 @@ exports.PublishableApiKeySalesChannel = {
53
48
  },
54
49
  },
55
50
  {
56
- serviceName: utils_1.Modules.SALES_CHANNEL,
51
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
57
52
  fieldAlias: {
58
53
  publishable_api_keys: "api_keys_link.api_key",
59
54
  },
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const RegionPaymentProvider: ModuleJoinerConfig;
3
- //# sourceMappingURL=region-payment-provider.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RegionPaymentProvider = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.RegionPaymentProvider = {
6
7
  serviceName: utils_1.LINKS.RegionPaymentProvider,
@@ -20,16 +21,13 @@ exports.RegionPaymentProvider = {
20
21
  primaryKeys: ["id", "region_id", "payment_provider_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.REGION,
24
+ serviceName: modules_sdk_1.Modules.REGION,
24
25
  primaryKey: "id",
25
26
  foreignKey: "region_id",
26
27
  alias: "region",
27
- args: {
28
- methodSuffix: "Regions",
29
- },
30
28
  },
31
29
  {
32
- serviceName: utils_1.Modules.PAYMENT,
30
+ serviceName: modules_sdk_1.Modules.PAYMENT,
33
31
  primaryKey: "id",
34
32
  foreignKey: "payment_provider_id",
35
33
  alias: "payment_provider",
@@ -38,7 +36,7 @@ exports.RegionPaymentProvider = {
38
36
  ],
39
37
  extends: [
40
38
  {
41
- serviceName: utils_1.Modules.REGION,
39
+ serviceName: modules_sdk_1.Modules.REGION,
42
40
  fieldAlias: {
43
41
  payment_providers: "payment_provider_link.payment_provider",
44
42
  },
@@ -51,7 +49,7 @@ exports.RegionPaymentProvider = {
51
49
  },
52
50
  },
53
51
  {
54
- serviceName: utils_1.Modules.PAYMENT,
52
+ serviceName: modules_sdk_1.Modules.PAYMENT,
55
53
  fieldAlias: {
56
54
  regions: "region_link.region",
57
55
  },
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const SalesChannelLocation: ModuleJoinerConfig;
3
- //# sourceMappingURL=sales-channel-location.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SalesChannelLocation = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.SalesChannelLocation = {
6
7
  serviceName: utils_1.LINKS.SalesChannelLocation,
@@ -20,27 +21,21 @@ exports.SalesChannelLocation = {
20
21
  primaryKeys: ["id", "sales_channel_id", "stock_location_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.SALES_CHANNEL,
24
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
24
25
  primaryKey: "id",
25
26
  foreignKey: "sales_channel_id",
26
27
  alias: "sales_channel",
27
- args: {
28
- methodSuffix: "SalesChannels",
29
- },
30
28
  },
31
29
  {
32
- serviceName: utils_1.Modules.STOCK_LOCATION,
30
+ serviceName: modules_sdk_1.Modules.STOCK_LOCATION,
33
31
  primaryKey: "id",
34
32
  foreignKey: "stock_location_id",
35
33
  alias: "location",
36
- args: {
37
- methodSuffix: "StockLocations",
38
- },
39
34
  },
40
35
  ],
41
36
  extends: [
42
37
  {
43
- serviceName: utils_1.Modules.SALES_CHANNEL,
38
+ serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
44
39
  fieldAlias: {
45
40
  stock_locations: "locations_link.location",
46
41
  },
@@ -53,7 +48,7 @@ exports.SalesChannelLocation = {
53
48
  },
54
49
  },
55
50
  {
56
- serviceName: utils_1.Modules.STOCK_LOCATION,
51
+ serviceName: modules_sdk_1.Modules.STOCK_LOCATION,
57
52
  fieldAlias: {
58
53
  sales_channels: "sales_channels_link.sales_channel",
59
54
  },
@@ -1,3 +1,2 @@
1
1
  import { ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare const ShippingOptionPriceSet: ModuleJoinerConfig;
3
- //# sourceMappingURL=shipping-option-price-set.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ShippingOptionPriceSet = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
4
5
  const utils_1 = require("@medusajs/utils");
5
6
  exports.ShippingOptionPriceSet = {
6
7
  serviceName: utils_1.LINKS.ShippingOptionPriceSet,
@@ -20,7 +21,7 @@ exports.ShippingOptionPriceSet = {
20
21
  primaryKeys: ["id", "shipping_option_id", "price_set_id"],
21
22
  relationships: [
22
23
  {
23
- serviceName: utils_1.Modules.FULFILLMENT,
24
+ serviceName: modules_sdk_1.Modules.FULFILLMENT,
24
25
  primaryKey: "id",
25
26
  foreignKey: "shipping_option_id",
26
27
  alias: "shipping_option",
@@ -29,19 +30,16 @@ exports.ShippingOptionPriceSet = {
29
30
  },
30
31
  },
31
32
  {
32
- serviceName: utils_1.Modules.PRICING,
33
+ serviceName: modules_sdk_1.Modules.PRICING,
33
34
  primaryKey: "id",
34
35
  foreignKey: "price_set_id",
35
36
  alias: "price_set",
36
- args: {
37
- methodSuffix: "PriceSets",
38
- },
39
37
  deleteCascade: true,
40
38
  },
41
39
  ],
42
40
  extends: [
43
41
  {
44
- serviceName: utils_1.Modules.FULFILLMENT,
42
+ serviceName: modules_sdk_1.Modules.FULFILLMENT,
45
43
  fieldAlias: {
46
44
  prices: {
47
45
  path: "price_set_link.price_set.prices",
@@ -60,7 +58,7 @@ exports.ShippingOptionPriceSet = {
60
58
  },
61
59
  },
62
60
  {
63
- serviceName: utils_1.Modules.PRICING,
61
+ serviceName: modules_sdk_1.Modules.PRICING,
64
62
  relationship: {
65
63
  serviceName: utils_1.LINKS.ShippingOptionPriceSet,
66
64
  primaryKey: "price_set_id",
@@ -0,0 +1,2 @@
1
+ import { ModuleJoinerConfig } from "@medusajs/types";
2
+ export declare const StoreDefaultCurrency: ModuleJoinerConfig;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoreDefaultCurrency = void 0;
4
+ const modules_sdk_1 = require("@medusajs/modules-sdk");
5
+ exports.StoreDefaultCurrency = {
6
+ isLink: true,
7
+ isReadOnlyLink: true,
8
+ extends: [
9
+ {
10
+ serviceName: modules_sdk_1.Modules.STORE,
11
+ relationship: {
12
+ serviceName: modules_sdk_1.Modules.CURRENCY,
13
+ primaryKey: "code",
14
+ foreignKey: "default_currency_code",
15
+ alias: "default_currency",
16
+ },
17
+ },
18
+ ],
19
+ };
package/dist/index.d.ts CHANGED
@@ -3,4 +3,3 @@ export * from "./types";
3
3
  export * from "./loaders";
4
4
  export * from "./services";
5
5
  export * from "./utils/compose-link-name";
6
- //# sourceMappingURL=index.d.ts.map
@@ -5,5 +5,3 @@ export declare const initialize: (options?: ModuleServiceInitializeOptions | Mod
5
5
  [link: string]: ILinkModule;
6
6
  }>;
7
7
  export declare function runMigrations({ options, logger, }: Omit<LoaderOptions<ModuleServiceInitializeOptions>, "container">, modulesDefinition?: ModuleJoinerConfig[]): Promise<void>;
8
- export declare function revertMigrations({ options, logger, }: Omit<LoaderOptions<ModuleServiceInitializeOptions>, "container">, modulesDefinition?: ModuleJoinerConfig[]): Promise<void>;
9
- //# sourceMappingURL=index.d.ts.map
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.revertMigrations = exports.runMigrations = exports.initialize = void 0;
26
+ exports.runMigrations = exports.initialize = void 0;
27
27
  const modules_sdk_1 = require("@medusajs/modules-sdk");
28
+ const types_1 = require("@medusajs/types");
28
29
  const utils_1 = require("@medusajs/utils");
29
30
  const linkDefinitions = __importStar(require("../definitions"));
30
31
  const migration_1 = require("../migration");
@@ -44,14 +45,6 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
44
45
  !definition.isReadOnlyLink) {
45
46
  throw new Error(`Foreign key cannot be a composed key.`);
46
47
  }
47
- if (Array.isArray(definition.extraDataFields)) {
48
- const extraDataFields = definition.extraDataFields;
49
- const definedDbFields = Object.keys(definition.databaseConfig?.extraFields || {});
50
- const difference = (0, utils_1.arrayDifference)(extraDataFields, definedDbFields);
51
- if (difference.length) {
52
- throw new Error(`extraDataFields (fieldNames: ${difference.join(",")}) need to be configured under databaseConfig (serviceName: ${definition.serviceName}).`);
53
- }
54
- }
55
48
  const serviceKey = !definition.isReadOnlyLink
56
49
  ? (0, utils_1.lowerCaseFirst)(definition.serviceName ??
57
50
  (0, utils_2.composeLinkName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey))
@@ -75,19 +68,19 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
75
68
  continue;
76
69
  }
77
70
  }
78
- else if (!modulesLoadedKeys.includes(primary.serviceName) ||
79
- !modulesLoadedKeys.includes(foreign.serviceName)) {
71
+ else if ((!primary.isInternalService &&
72
+ !modulesLoadedKeys.includes(primary.serviceName)) ||
73
+ (!foreign.isInternalService &&
74
+ !modulesLoadedKeys.includes(foreign.serviceName))) {
80
75
  continue;
81
76
  }
82
77
  const logger = injectedDependencies?.[utils_1.ContainerRegistrationKeys.LOGGER] ?? console;
83
78
  definition.schema = (0, utils_2.generateGraphQLSchema)(definition, primary, foreign, {
84
79
  logger,
85
80
  });
86
- if (!Array.isArray(definition.alias)) {
87
- definition.alias = definition.alias ? [definition.alias] : [];
88
- }
81
+ definition.alias ?? (definition.alias = []);
89
82
  for (const alias of definition.alias) {
90
- alias.args ??= {};
83
+ alias.args ?? (alias.args = {});
91
84
  alias.args.entity = (0, utils_1.toPascalCase)("Link_" +
92
85
  (definition.databaseConfig?.tableName ??
93
86
  (0, utils_2.composeTableName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey)));
@@ -97,12 +90,12 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
97
90
  key: serviceKey,
98
91
  registrationName: serviceKey,
99
92
  label: serviceKey,
100
- dependencies: [utils_1.ModuleRegistrationName.EVENT_BUS],
93
+ dependencies: [modules_sdk_1.ModuleRegistrationName.EVENT_BUS],
101
94
  defaultModuleDeclaration: {
102
- scope: modules_sdk_1.MODULE_SCOPE.INTERNAL,
95
+ scope: types_1.MODULE_SCOPE.INTERNAL,
103
96
  resources: injectedDependencies?.[utils_1.ContainerRegistrationKeys.PG_CONNECTION]
104
- ? modules_sdk_1.MODULE_RESOURCE_TYPE.SHARED
105
- : modules_sdk_1.MODULE_RESOURCE_TYPE.ISOLATED,
97
+ ? types_1.MODULE_RESOURCE_TYPE.SHARED
98
+ : types_1.MODULE_RESOURCE_TYPE.ISOLATED,
106
99
  },
107
100
  };
108
101
  const loaded = await modules_sdk_1.MedusaModule.bootstrapLink({
@@ -116,7 +109,7 @@ const initialize = async (options, modulesDefinition, injectedDependencies) => {
116
109
  return allLinks;
117
110
  };
118
111
  exports.initialize = initialize;
119
- async function applyMigrationUpOrDown({ options, logger, }, modulesDefinition, revert = false) {
112
+ async function runMigrations({ options, logger, }, modulesDefinition) {
120
113
  const modulesLoadedKeys = modules_sdk_1.MedusaModule.getLoadedModules().map((mod) => Object.keys(mod)[0]);
121
114
  const allLinksToLoad = Object.values(linkDefinitions).concat(modulesDefinition ?? []);
122
115
  const allLinks = new Set();
@@ -138,17 +131,8 @@ async function applyMigrationUpOrDown({ options, logger, }, modulesDefinition, r
138
131
  !modulesLoadedKeys.includes(foreign.serviceName)) {
139
132
  continue;
140
133
  }
141
- const migrate = revert
142
- ? (0, migration_1.getRevertMigration)(definition, serviceKey, primary, foreign)
143
- : (0, migration_1.getMigration)(definition, serviceKey, primary, foreign);
134
+ const migrate = (0, migration_1.getMigration)(definition, serviceKey, primary, foreign);
144
135
  await migrate({ options, logger });
145
136
  }
146
137
  }
147
- async function runMigrations({ options, logger, }, modulesDefinition) {
148
- await applyMigrationUpOrDown({ options, logger }, modulesDefinition);
149
- }
150
138
  exports.runMigrations = runMigrations;
151
- async function revertMigrations({ options, logger, }, modulesDefinition) {
152
- await applyMigrationUpOrDown({ options, logger }, modulesDefinition, true);
153
- }
154
- exports.revertMigrations = revertMigrations;
@@ -1,3 +1,2 @@
1
1
  import { JoinerRelationship, ModuleExports, ModuleJoinerConfig } from "@medusajs/types";
2
2
  export declare function getLinkModuleDefinition(joinerConfig: ModuleJoinerConfig, primary: JoinerRelationship, foreign: JoinerRelationship): ModuleExports;
3
- //# sourceMappingURL=module-definition.d.ts.map