Skip to content

Commit

Permalink
chore: remove internal module resources option (#9582)
Browse files Browse the repository at this point in the history
What:
* removes resouces type "shared" or "isolated" from internal modules.
* modules can have an isolated database connection by providing a database config as part of their options on `medusa-config`

CLOSES: FRMW-2593
  • Loading branch information
carlos-r-l-rodrigues authored Oct 17, 2024
1 parent b07dd33 commit 902ac12
Show file tree
Hide file tree
Showing 36 changed files with 75 additions and 258 deletions.
1 change: 0 additions & 1 deletion integration-tests/api/medusa-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = {
[Modules.AUTH]: true,
[Modules.USER]: {
scope: "internal",
resources: "shared",
resolve: "@medusajs/user",
options: {
jwt_secret: "test",
Expand Down
1 change: 0 additions & 1 deletion integration-tests/modules/medusa-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ module.exports = {
},
[Modules.USER]: {
scope: "internal",
resources: "shared",
resolve: "@medusajs/user",
options: {
jwt_secret: "test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const InventoryModule = {
dependencies: [],
defaultModuleDeclaration: {
scope: "internal",
resources: "shared",
},
},
__joinerConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const InventoryStockLocationLink = {
isQueryable: true,
defaultModuleDeclaration: {
scope: "internal",
resources: "shared",
},
},
__joinerConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const ProductInventoryLinkModule = {
isQueryable: true,
defaultModuleDeclaration: {
scope: "internal",
resources: "shared",
},
},
__joinerConfig: {
Expand Down
1 change: 0 additions & 1 deletion packages/core/modules-sdk/src/__mocks__/product-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const ProductModule = {
dependencies: ["eventBusModuleService"],
defaultModuleDeclaration: {
scope: "internal",
resources: "shared",
},
},
__joinerConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const StockLocationModule = {
dependencies: ["eventBusModuleService"],
defaultModuleDeclaration: {
scope: "internal",
resources: "shared",
},
},
__joinerConfig: {
Expand Down
27 changes: 1 addition & 26 deletions packages/core/modules-sdk/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Modules,
upperCaseFirst,
} from "@medusajs/utils"
import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types"
import { MODULE_SCOPE } from "./types"

export const ModulesDefinition: {
[key: string]: ModuleDefinition
Expand All @@ -19,7 +19,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.STOCK_LOCATION]: {
Expand All @@ -31,7 +30,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.INVENTORY]: {
Expand All @@ -43,7 +41,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.CACHE]: {
Expand All @@ -54,7 +51,6 @@ export const ModulesDefinition: {
isQueryable: false,
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.PRODUCT]: {
Expand All @@ -66,7 +62,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS, ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.PRICING]: {
Expand All @@ -78,7 +73,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS, ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.PROMOTION]: {
Expand All @@ -90,7 +84,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.AUTH]: {
Expand All @@ -102,7 +95,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.WORKFLOW_ENGINE]: {
Expand All @@ -115,7 +107,6 @@ export const ModulesDefinition: {
__passSharedContainer: true,
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.SALES_CHANNEL]: {
Expand All @@ -127,7 +118,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.FULFILLMENT]: {
Expand All @@ -139,7 +129,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER, Modules.EVENT_BUS],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.CART]: {
Expand All @@ -151,7 +140,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.CUSTOMER]: {
Expand All @@ -163,7 +151,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.PAYMENT]: {
Expand All @@ -175,7 +162,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.USER]: {
Expand All @@ -187,7 +173,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS, ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.REGION]: {
Expand All @@ -199,7 +184,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.ORDER]: {
Expand All @@ -211,7 +195,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER, Modules.EVENT_BUS],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.TAX]: {
Expand All @@ -223,7 +206,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER, Modules.EVENT_BUS],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.API_KEY]: {
Expand All @@ -235,7 +217,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.STORE]: {
Expand All @@ -247,7 +228,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.CURRENCY]: {
Expand All @@ -259,7 +239,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.FILE]: {
Expand All @@ -271,7 +250,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.NOTIFICATION]: {
Expand All @@ -283,7 +261,6 @@ export const ModulesDefinition: {
dependencies: [Modules.EVENT_BUS, ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.INDEX]: {
Expand All @@ -300,7 +277,6 @@ export const ModulesDefinition: {
],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.LOCKING]: {
Expand All @@ -312,7 +288,6 @@ export const ModulesDefinition: {
dependencies: [ContainerRegistrationKeys.LOGGER],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
}
Expand Down
Loading

0 comments on commit 902ac12

Please sign in to comment.