diff --git a/integration-tests/modules/__tests__/cart/store/carts.spec.ts b/integration-tests/modules/__tests__/cart/store/carts.spec.ts index a028f5306a..6097730fc1 100644 --- a/integration-tests/modules/__tests__/cart/store/carts.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/carts.spec.ts @@ -144,18 +144,18 @@ medusaIntegrationTestRunner({ await remoteLink.create([ { - Product: { + [Modules.PRODUCT]: { variant_id: product.variants[0].id, }, - Pricing: { + [Modules.PRICING]: { price_set_id: priceSet.id, }, }, { - Product: { + [Modules.PRODUCT]: { variant_id: product.variants[1].id, }, - Pricing: { + [Modules.PRICING]: { price_set_id: priceSetTwo.id, }, }, @@ -232,8 +232,8 @@ medusaIntegrationTestRunner({ await remoteLink.create([ { - Product: { variant_id: product.variants[0].id }, - Pricing: { price_set_id: priceSet.id }, + [Modules.PRODUCT]: { variant_id: product.variants[0].id }, + [Modules.PRICING]: { price_set_id: priceSet.id }, }, ]) @@ -1080,10 +1080,10 @@ medusaIntegrationTestRunner({ await remoteLink.create([ { - Product: { + [Modules.PRODUCT]: { variant_id: productWithDefaultTax.variants[0].id, }, - Pricing: { price_set_id: priceSetDefaultTax.id }, + [Modules.PRICING]: { price_set_id: priceSetDefaultTax.id }, }, ]) @@ -1212,10 +1212,10 @@ medusaIntegrationTestRunner({ await remoteLink.create([ { - Product: { + [Modules.PRODUCT]: { variant_id: productWithDefaultTax.variants[0].id, }, - Pricing: { price_set_id: priceSetDefaultTax.id }, + [Modules.PRICING]: { price_set_id: priceSetDefaultTax.id }, }, ]) @@ -2104,16 +2104,16 @@ medusaIntegrationTestRunner({ await remoteLink.create([ { - Product: { + [Modules.PRODUCT]: { variant_id: productWithSpecialTax.variants[0].id, }, - Pricing: { price_set_id: priceSet.id }, + [Modules.PRICING]: { price_set_id: priceSet.id }, }, { - Product: { + [Modules.PRODUCT]: { variant_id: productWithDefaultTax.variants[0].id, }, - Pricing: { price_set_id: priceSetDefaultTax.id }, + [Modules.PRICING]: { price_set_id: priceSetDefaultTax.id }, }, { [Modules.CART]: { cart_id: cart.id }, diff --git a/integration-tests/modules/__tests__/link-modules/define-link.spec.ts b/integration-tests/modules/__tests__/link-modules/define-link.spec.ts index 64130a6284..1cbe1d395c 100644 --- a/integration-tests/modules/__tests__/link-modules/define-link.spec.ts +++ b/integration-tests/modules/__tests__/link-modules/define-link.spec.ts @@ -42,7 +42,7 @@ medusaIntegrationTestRunner({ primaryKeys: ["id", "currency_code", "region_id"], relationships: [ { - serviceName: "Currency", + serviceName: "currency", entity: "Currency", primaryKey: "code", foreignKey: "currency_code", @@ -53,7 +53,7 @@ medusaIntegrationTestRunner({ deleteCascade: false, }, { - serviceName: "Region", + serviceName: "region", entity: "Region", primaryKey: "id", foreignKey: "region_id", @@ -66,7 +66,7 @@ medusaIntegrationTestRunner({ ], extends: [ { - serviceName: "Currency", + serviceName: "currency", fieldAlias: { region: { path: "region_link.region", @@ -84,7 +84,7 @@ medusaIntegrationTestRunner({ }, }, { - serviceName: "Region", + serviceName: "region", fieldAlias: { currency: { path: "currency_link.currency", @@ -139,7 +139,7 @@ medusaIntegrationTestRunner({ primaryKeys: ["id", "product_variant_id", "region_id"], relationships: [ { - serviceName: "Product", + serviceName: "product", entity: "ProductVariant", primaryKey: "id", foreignKey: "product_variant_id", @@ -150,7 +150,7 @@ medusaIntegrationTestRunner({ deleteCascade: false, }, { - serviceName: "Region", + serviceName: "region", entity: "Region", primaryKey: "id", foreignKey: "region_id", @@ -163,7 +163,7 @@ medusaIntegrationTestRunner({ ], extends: [ { - serviceName: "Product", + serviceName: "product", fieldAlias: { region: { path: "region_link.region", @@ -181,7 +181,7 @@ medusaIntegrationTestRunner({ }, }, { - serviceName: "Region", + serviceName: "region", fieldAlias: { product_variant: { path: "product_variant_link.product_variant", @@ -241,7 +241,7 @@ medusaIntegrationTestRunner({ primaryKeys: ["id", "currency_code", "region_id"], relationships: [ { - serviceName: "Currency", + serviceName: "currency", entity: "Currency", primaryKey: "code", foreignKey: "currency_code", @@ -252,7 +252,7 @@ medusaIntegrationTestRunner({ deleteCascade: true, }, { - serviceName: "Region", + serviceName: "region", entity: "Region", primaryKey: "id", foreignKey: "region_id", @@ -265,7 +265,7 @@ medusaIntegrationTestRunner({ ], extends: [ { - serviceName: "Currency", + serviceName: "currency", fieldAlias: { region: { path: "region_link.region", @@ -283,7 +283,7 @@ medusaIntegrationTestRunner({ }, }, { - serviceName: "Region", + serviceName: "region", fieldAlias: { currency: { path: "currency_link.currency", @@ -337,7 +337,7 @@ medusaIntegrationTestRunner({ primaryKeys: ["id", "currency_code", "region_id"], relationships: [ { - serviceName: "Currency", + serviceName: "currency", entity: "Currency", primaryKey: "code", foreignKey: "currency_code", @@ -348,7 +348,7 @@ medusaIntegrationTestRunner({ deleteCascade: false, }, { - serviceName: "Region", + serviceName: "region", entity: "Region", primaryKey: "id", foreignKey: "region_id", @@ -361,7 +361,7 @@ medusaIntegrationTestRunner({ ], extends: [ { - serviceName: "Currency", + serviceName: "currency", fieldAlias: { regions: { path: "region_link.region", @@ -379,7 +379,7 @@ medusaIntegrationTestRunner({ }, }, { - serviceName: "Region", + serviceName: "region", fieldAlias: { currency: { path: "currency_link.currency", diff --git a/packages/core/core-flows/src/inventory/steps/attach-inventory-items.ts b/packages/core/core-flows/src/inventory/steps/attach-inventory-items.ts index 56bdbee7ee..3cf7092948 100644 --- a/packages/core/core-flows/src/inventory/steps/attach-inventory-items.ts +++ b/packages/core/core-flows/src/inventory/steps/attach-inventory-items.ts @@ -1,6 +1,6 @@ -import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" +import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk" -import { ContainerRegistrationKeys } from "@medusajs/framework/utils" +import { ContainerRegistrationKeys, Modules } from "@medusajs/framework/utils" export const attachInventoryItemToVariantsStepId = "attach-inventory-items-to-variants-step" @@ -21,10 +21,10 @@ export const attachInventoryItemToVariants = createStep( const linkDefinitions = input .filter(({ tag }) => !!tag) .map(({ inventoryItemId, tag }) => ({ - Product: { + [Modules.PRODUCT]: { variant_id: tag!, }, - Inventory: { + [Modules.INVENTORY]: { inventory_item_id: inventoryItemId, }, })) diff --git a/packages/core/modules-sdk/src/definitions.ts b/packages/core/modules-sdk/src/definitions.ts index cb33ed1a91..8771c702a6 100644 --- a/packages/core/modules-sdk/src/definitions.ts +++ b/packages/core/modules-sdk/src/definitions.ts @@ -1,39 +1,12 @@ import { ModuleDefinition } from "@medusajs/types" import { ContainerRegistrationKeys, + MODULE_PACKAGE_NAMES, Modules, upperCaseFirst, } from "@medusajs/utils" import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types" -export const MODULE_PACKAGE_NAMES = { - [Modules.AUTH]: "@medusajs/medusa/auth", - [Modules.CACHE]: "@medusajs/medusa/cache-inmemory", - [Modules.CART]: "@medusajs/medusa/cart", - [Modules.CUSTOMER]: "@medusajs/medusa/customer", - [Modules.EVENT_BUS]: "@medusajs/medusa/event-bus-local", - [Modules.INVENTORY]: "@medusajs/medusa/inventory-next", // TODO: To be replaced when current `@medusajs/inventory` is deprecated - [Modules.LINK]: "@medusajs/medusa/link-modules", - [Modules.PAYMENT]: "@medusajs/medusa/payment", - [Modules.PRICING]: "@medusajs/medusa/pricing", - [Modules.PRODUCT]: "@medusajs/medusa/product", - [Modules.PROMOTION]: "@medusajs/medusa/promotion", - [Modules.SALES_CHANNEL]: "@medusajs/medusa/sales-channel", - [Modules.FULFILLMENT]: "@medusajs/medusa/fulfillment", - [Modules.STOCK_LOCATION]: "@medusajs/medusa/stock-location-next", // TODO: To be replaced when current `@medusajs/stock-location` is deprecated - [Modules.TAX]: "@medusajs/medusa/tax", - [Modules.USER]: "@medusajs/medusa/user", - [Modules.WORKFLOW_ENGINE]: "@medusajs/medusa/workflow-engine-inmemory", - [Modules.REGION]: "@medusajs/medusa/region", - [Modules.ORDER]: "@medusajs/medusa/order", - [Modules.API_KEY]: "@medusajs/medusa/api-key", - [Modules.STORE]: "@medusajs/medusa/store", - [Modules.CURRENCY]: "@medusajs/medusa/currency", - [Modules.FILE]: "@medusajs/medusa/file", - [Modules.NOTIFICATION]: "@medusajs/medusa/notification", - [Modules.INDEX]: "@medusajs/medusa/index-module", -} - export const ModulesDefinition: { [key: string]: ModuleDefinition } = { diff --git a/packages/core/modules-sdk/src/medusa-app.ts b/packages/core/modules-sdk/src/medusa-app.ts index 35bdca46a5..2befa97488 100644 --- a/packages/core/modules-sdk/src/medusa-app.ts +++ b/packages/core/modules-sdk/src/medusa-app.ts @@ -20,12 +20,12 @@ import { isObject, isString, MedusaError, + MODULE_PACKAGE_NAMES, Modules, ModulesSdkUtils, promiseAll, } from "@medusajs/utils" import { asValue } from "awilix" -import { MODULE_PACKAGE_NAMES } from "./definitions" import { MedusaModule, MigrationOptions, diff --git a/packages/core/utils/src/common/__fixtures__/define-config/github/index.ts b/packages/core/utils/src/common/__fixtures__/define-config/github/index.ts new file mode 100644 index 0000000000..43478ff8f8 --- /dev/null +++ b/packages/core/utils/src/common/__fixtures__/define-config/github/index.ts @@ -0,0 +1,5 @@ +import { Module } from "../../../../modules-sdk" + +export default Module("GithubModuleService", { + service: class GithubModuleService {}, +}) diff --git a/packages/core/utils/src/common/__tests__/define-config.spec.ts b/packages/core/utils/src/common/__tests__/define-config.spec.ts index 046eccc547..eaea563ed0 100644 --- a/packages/core/utils/src/common/__tests__/define-config.spec.ts +++ b/packages/core/utils/src/common/__tests__/define-config.spec.ts @@ -12,8 +12,10 @@ describe("defineConfig", function () { }, "featureFlags": {}, "modules": { - "ApiKey": true, - "Auth": { + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { "options": { "providers": [ { @@ -22,14 +24,24 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/auth", + "resolve": "@medusajs/medusa/auth", }, - "Cache": true, - "Cart": true, - "Currency": true, - "Customer": true, - "EventBus": true, - "File": { + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "cart": { + "resolve": "@medusajs/medusa/cart", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { "options": { "providers": [ { @@ -38,9 +50,9 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/file", + "resolve": "@medusajs/medusa/file", }, - "Fulfillment": { + "fulfillment": { "options": { "providers": [ { @@ -49,10 +61,12 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/fulfillment", + "resolve": "@medusajs/medusa/fulfillment", }, - "Inventory": true, - "Notification": { + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", + }, + "notification": { "options": { "providers": [ { @@ -67,25 +81,47 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/notification", + "resolve": "@medusajs/medusa/notification", }, - "Order": true, - "Payment": true, - "Pricing": true, - "Product": true, - "Promotion": true, - "Region": true, - "SalesChannel": true, - "StockLocation": true, - "Store": true, - "Tax": true, - "User": { + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { "options": { "jwt_secret": "supersecret", }, - "resolve": "@medusajs/user", + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", }, - "Workflows": true, }, "plugins": [], "projectConfig": { @@ -120,8 +156,13 @@ describe("defineConfig", function () { }, "featureFlags": {}, "modules": { - "ApiKey": true, - "Auth": { + "GithubModuleService": { + "resolve": "./modules/github", + }, + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { "options": { "providers": [ { @@ -130,14 +171,24 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/auth", + "resolve": "@medusajs/medusa/auth", }, - "Cache": true, - "Cart": true, - "Currency": true, - "Customer": true, - "EventBus": true, - "File": { + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "cart": { + "resolve": "@medusajs/medusa/cart", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { "options": { "providers": [ { @@ -146,9 +197,9 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/file", + "resolve": "@medusajs/medusa/file", }, - "Fulfillment": { + "fulfillment": { "options": { "providers": [ { @@ -157,13 +208,12 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/fulfillment", + "resolve": "@medusajs/medusa/fulfillment", }, - "GithubModuleService": { - "resolve": "./modules/github", + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", }, - "Inventory": true, - "Notification": { + "notification": { "options": { "providers": [ { @@ -178,25 +228,358 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/notification", + "resolve": "@medusajs/medusa/notification", }, - "Order": true, - "Payment": true, - "Pricing": true, - "Product": true, - "Promotion": true, - "Region": true, - "SalesChannel": true, - "StockLocation": true, - "Store": true, - "Tax": true, - "User": { + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { "options": { "jwt_secret": "supersecret", }, - "resolve": "@medusajs/user", + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", + }, + }, + "plugins": [], + "projectConfig": { + "databaseUrl": "postgres://localhost/medusa-starter-default", + "http": { + "adminCors": "http://localhost:7000,http://localhost:7001,http://localhost:5173", + "authCors": "http://localhost:7000,http://localhost:7001,http://localhost:5173", + "cookieSecret": "supersecret", + "jwtSecret": "supersecret", + "storeCors": "http://localhost:8000", + }, + }, + } + `) + }) + + it("should merge custom modules when an array is provided", function () { + expect( + defineConfig({ + modules: [ + { + resolve: require.resolve("../__fixtures__/define-config/github"), + options: { + apiKey: "test", + }, + }, + ], + }) + ).toMatchInlineSnapshot(` + { + "admin": { + "backendUrl": "http://localhost:9000", + "outDir": ".medusa/admin", + "path": "/app", + }, + "featureFlags": {}, + "modules": { + "GithubModuleService": { + "options": { + "apiKey": "test", + }, + "resolve": "${require.resolve( + "../__fixtures__/define-config/github" + )}", + }, + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { + "options": { + "providers": [ + { + "id": "emailpass", + "resolve": "@medusajs/auth-emailpass", + }, + ], + }, + "resolve": "@medusajs/medusa/auth", + }, + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "cart": { + "resolve": "@medusajs/medusa/cart", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { + "options": { + "providers": [ + { + "id": "local", + "resolve": "@medusajs/file-local-next", + }, + ], + }, + "resolve": "@medusajs/medusa/file", + }, + "fulfillment": { + "options": { + "providers": [ + { + "id": "manual", + "resolve": "@medusajs/fulfillment-manual", + }, + ], + }, + "resolve": "@medusajs/medusa/fulfillment", + }, + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", + }, + "notification": { + "options": { + "providers": [ + { + "id": "local", + "options": { + "channels": [ + "feed", + ], + "name": "Local Notification Provider", + }, + "resolve": "@medusajs/notification-local", + }, + ], + }, + "resolve": "@medusajs/medusa/notification", + }, + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { + "options": { + "jwt_secret": "supersecret", + }, + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", + }, + }, + "plugins": [], + "projectConfig": { + "databaseUrl": "postgres://localhost/medusa-starter-default", + "http": { + "adminCors": "http://localhost:7000,http://localhost:7001,http://localhost:5173", + "authCors": "http://localhost:7000,http://localhost:7001,http://localhost:5173", + "cookieSecret": "supersecret", + "jwtSecret": "supersecret", + "storeCors": "http://localhost:8000", + }, + }, + } + `) + }) + + it("should merge custom modules when an array is provided with a key to override the module registration name", function () { + expect( + defineConfig({ + modules: [ + { + key: "GithubModuleServiceOverride", + resolve: require.resolve("../__fixtures__/define-config/github"), + options: { + apiKey: "test", + }, + }, + ], + }) + ).toMatchInlineSnapshot(` + { + "admin": { + "backendUrl": "http://localhost:9000", + "outDir": ".medusa/admin", + "path": "/app", + }, + "featureFlags": {}, + "modules": { + "GithubModuleServiceOverride": { + "options": { + "apiKey": "test", + }, + "resolve": "${require.resolve( + "../__fixtures__/define-config/github" + )}", + }, + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { + "options": { + "providers": [ + { + "id": "emailpass", + "resolve": "@medusajs/auth-emailpass", + }, + ], + }, + "resolve": "@medusajs/medusa/auth", + }, + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "cart": { + "resolve": "@medusajs/medusa/cart", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { + "options": { + "providers": [ + { + "id": "local", + "resolve": "@medusajs/file-local-next", + }, + ], + }, + "resolve": "@medusajs/medusa/file", + }, + "fulfillment": { + "options": { + "providers": [ + { + "id": "manual", + "resolve": "@medusajs/fulfillment-manual", + }, + ], + }, + "resolve": "@medusajs/medusa/fulfillment", + }, + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", + }, + "notification": { + "options": { + "providers": [ + { + "id": "local", + "options": { + "channels": [ + "feed", + ], + "name": "Local Notification Provider", + }, + "resolve": "@medusajs/notification-local", + }, + ], + }, + "resolve": "@medusajs/medusa/notification", + }, + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { + "options": { + "jwt_secret": "supersecret", + }, + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", }, - "Workflows": true, }, "plugins": [], "projectConfig": { @@ -231,8 +614,10 @@ describe("defineConfig", function () { }, "featureFlags": {}, "modules": { - "ApiKey": true, - "Auth": { + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { "options": { "providers": [ { @@ -241,14 +626,24 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/auth", + "resolve": "@medusajs/medusa/auth", }, - "Cache": true, - "Cart": true, - "Currency": true, - "Customer": true, - "EventBus": true, - "File": { + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "cart": { + "resolve": "@medusajs/medusa/cart", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { "options": { "providers": [ { @@ -257,9 +652,9 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/file", + "resolve": "@medusajs/medusa/file", }, - "Fulfillment": { + "fulfillment": { "options": { "providers": [ { @@ -268,10 +663,12 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/fulfillment", + "resolve": "@medusajs/medusa/fulfillment", }, - "Inventory": true, - "Notification": { + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", + }, + "notification": { "options": { "providers": [ { @@ -286,25 +683,47 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/notification", + "resolve": "@medusajs/medusa/notification", }, - "Order": true, - "Payment": true, - "Pricing": true, - "Product": true, - "Promotion": true, - "Region": true, - "SalesChannel": true, - "StockLocation": true, - "Store": true, - "Tax": true, - "User": { + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { "options": { "jwt_secret": "supersecret", }, - "resolve": "@medusajs/user", + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", }, - "Workflows": true, }, "plugins": [], "projectConfig": { @@ -342,8 +761,10 @@ describe("defineConfig", function () { }, "featureFlags": {}, "modules": { - "ApiKey": true, - "Auth": { + "api_key": { + "resolve": "@medusajs/medusa/api-key", + }, + "auth": { "options": { "providers": [ { @@ -352,13 +773,21 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/auth", + "resolve": "@medusajs/medusa/auth", }, - "Cache": true, - "Currency": true, - "Customer": true, - "EventBus": true, - "File": { + "cache": { + "resolve": "@medusajs/medusa/cache-inmemory", + }, + "currency": { + "resolve": "@medusajs/medusa/currency", + }, + "customer": { + "resolve": "@medusajs/medusa/customer", + }, + "event_bus": { + "resolve": "@medusajs/medusa/event-bus-local", + }, + "file": { "options": { "providers": [ { @@ -367,9 +796,9 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/file", + "resolve": "@medusajs/medusa/file", }, - "Fulfillment": { + "fulfillment": { "options": { "providers": [ { @@ -378,10 +807,12 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/fulfillment", + "resolve": "@medusajs/medusa/fulfillment", }, - "Inventory": true, - "Notification": { + "inventory": { + "resolve": "@medusajs/medusa/inventory-next", + }, + "notification": { "options": { "providers": [ { @@ -396,25 +827,47 @@ describe("defineConfig", function () { }, ], }, - "resolve": "@medusajs/notification", + "resolve": "@medusajs/medusa/notification", }, - "Order": true, - "Payment": true, - "Pricing": true, - "Product": true, - "Promotion": true, - "Region": true, - "SalesChannel": true, - "StockLocation": true, - "Store": true, - "Tax": true, - "User": { + "order": { + "resolve": "@medusajs/medusa/order", + }, + "payment": { + "resolve": "@medusajs/medusa/payment", + }, + "pricing": { + "resolve": "@medusajs/medusa/pricing", + }, + "product": { + "resolve": "@medusajs/medusa/product", + }, + "promotion": { + "resolve": "@medusajs/medusa/promotion", + }, + "region": { + "resolve": "@medusajs/medusa/region", + }, + "sales_channel": { + "resolve": "@medusajs/medusa/sales-channel", + }, + "stock_location": { + "resolve": "@medusajs/medusa/stock-location-next", + }, + "store": { + "resolve": "@medusajs/medusa/store", + }, + "tax": { + "resolve": "@medusajs/medusa/tax", + }, + "user": { "options": { "jwt_secret": "supersecret", }, - "resolve": "@medusajs/user", + "resolve": "@medusajs/medusa/user", + }, + "workflows": { + "resolve": "@medusajs/medusa/workflow-engine-inmemory", }, - "Workflows": true, }, "plugins": [], "projectConfig": { diff --git a/packages/core/utils/src/common/define-config.ts b/packages/core/utils/src/common/define-config.ts index 45856e71c1..db2e489910 100644 --- a/packages/core/utils/src/common/define-config.ts +++ b/packages/core/utils/src/common/define-config.ts @@ -1,5 +1,17 @@ -import { ConfigModule } from "@medusajs/types" -import { Modules } from "../modules-sdk/definition" +import { + ConfigModule, + ExternalModuleDeclaration, + InternalModuleDeclaration, +} from "@medusajs/types" +import { + MODULE_PACKAGE_NAMES, + Modules, + REVERSED_MODULE_PACKAGE_NAMES, +} from "../modules-sdk" +import { isString } from "./is-string" +import { resolveExports } from "./resolve-exports" +import { isObject } from "./is-object" +import { normalizeImportPathWithSource } from "./normalize-import-path-with-source" const DEFAULT_SECRET = "supersecret" const DEFAULT_ADMIN_URL = "http://localhost:9000" @@ -8,6 +20,42 @@ const DEFAULT_DATABASE_URL = "postgres://localhost/medusa-starter-default" const DEFAULT_ADMIN_CORS = "http://localhost:7000,http://localhost:7001,http://localhost:5173" +type InternalModuleDeclarationOverride = InternalModuleDeclaration & { + /** + * Optional key to be used to identify the module, if not provided, it will be inferred from the module joiner config service name. + */ + key?: string + /** + * By default, modules are enabled, if provided as true, this will disable the module entirely. + */ + disable?: boolean +} + +type ExternalModuleDeclarationOverride = ExternalModuleDeclaration & { + /** + * key to be used to identify the module, if not provided, it will be inferred from the module joiner config service name. + */ + key: string + /** + * By default, modules are enabled, if provided as true, this will disable the module entirely. + */ + disable?: boolean +} + +type Config = Partial< + Omit & { + admin: Partial + modules: + | Partial< + InternalModuleDeclarationOverride | ExternalModuleDeclarationOverride + >[] + /** + * @deprecated use the array instead + */ + | ConfigModule["modules"] + } +> + /** * The "defineConfig" helper can be used to define the configuration * of a medusa application. @@ -16,13 +64,7 @@ const DEFAULT_ADMIN_CORS = * make an application work seamlessly, but still provide you the ability * to override configuration as needed. */ -export function defineConfig( - config: Partial< - Omit & { - admin: Partial - } - > = {} -): ConfigModule { +export function defineConfig(config: Config = {}): ConfigModule { const { http, ...restOfProjectConfig } = config.projectConfig || {} /** @@ -61,32 +103,54 @@ export function defineConfig( ...config.featureFlags, } + const modules = resolveModules(config.modules) + + return { + projectConfig, + featureFlags, + plugins: config.plugins || [], + admin, + modules: modules, + } +} + +/** + * The user API allow to use array of modules configuration. This method manage the loading of the user modules + * along side the default modules and re map them to an object. + * + * @param configModules + */ +function resolveModules( + configModules: Config["modules"] +): ConfigModule["modules"] { /** * The default set of modules to always use. The end user can swap * the modules by providing an alternate implementation via their * config. But they can never remove a module from this list. */ - const modules: ConfigModule["modules"] = { - [Modules.CACHE]: true, - [Modules.EVENT_BUS]: true, - [Modules.WORKFLOW_ENGINE]: true, - [Modules.STOCK_LOCATION]: true, - [Modules.INVENTORY]: true, - [Modules.PRODUCT]: true, - [Modules.PRICING]: true, - [Modules.PROMOTION]: true, - [Modules.CUSTOMER]: true, - [Modules.SALES_CHANNEL]: true, - [Modules.CART]: true, - [Modules.REGION]: true, - [Modules.API_KEY]: true, - [Modules.STORE]: true, - [Modules.TAX]: true, - [Modules.CURRENCY]: true, - [Modules.PAYMENT]: true, - [Modules.ORDER]: true, - [Modules.AUTH]: { - resolve: "@medusajs/auth", + const modules: Config["modules"] = [ + { resolve: MODULE_PACKAGE_NAMES[Modules.CACHE] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.EVENT_BUS] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.WORKFLOW_ENGINE] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.STOCK_LOCATION] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.INVENTORY] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.PRODUCT] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.PRICING] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.PROMOTION] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.CUSTOMER] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.SALES_CHANNEL] }, + + { resolve: MODULE_PACKAGE_NAMES[Modules.CART] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.REGION] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.API_KEY] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.STORE] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.TAX] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.CURRENCY] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.PAYMENT] }, + { resolve: MODULE_PACKAGE_NAMES[Modules.ORDER] }, + + { + resolve: MODULE_PACKAGE_NAMES[Modules.AUTH], options: { providers: [ { @@ -96,15 +160,14 @@ export function defineConfig( ], }, }, - - [Modules.USER]: { - resolve: "@medusajs/user", + { + resolve: MODULE_PACKAGE_NAMES[Modules.USER], options: { jwt_secret: process.env.JWT_SECRET ?? DEFAULT_SECRET, }, }, - [Modules.FILE]: { - resolve: "@medusajs/file", + { + resolve: MODULE_PACKAGE_NAMES[Modules.FILE], options: { providers: [ { @@ -114,8 +177,8 @@ export function defineConfig( ], }, }, - [Modules.FULFILLMENT]: { - resolve: "@medusajs/fulfillment", + { + resolve: MODULE_PACKAGE_NAMES[Modules.FULFILLMENT], options: { providers: [ { @@ -125,8 +188,8 @@ export function defineConfig( ], }, }, - [Modules.NOTIFICATION]: { - resolve: "@medusajs/notification", + { + resolve: MODULE_PACKAGE_NAMES[Modules.NOTIFICATION], options: { providers: [ { @@ -140,21 +203,95 @@ export function defineConfig( ], }, }, - ...config.modules, + ] + + /** + * Backward compatibility for the old way of defining modules (object vs array) + */ + if (configModules) { + if (isObject(configModules)) { + const modules_ = (configModules ?? + {}) as unknown as Required["modules"] + + Object.entries(modules_).forEach(([key, moduleConfig]) => { + modules.push({ + key, + ...(isObject(moduleConfig) + ? moduleConfig + : { disable: !moduleConfig }), + }) + }) + } else if (Array.isArray(configModules)) { + const modules_ = (configModules ?? []) as InternalModuleDeclaration[] + modules.push(...modules_) + } else { + throw new Error( + "Invalid modules configuration. Should be an array or object." + ) + } } + const remappedModules = modules.reduce((acc, moduleConfig) => { + if (moduleConfig.scope === "external" && !moduleConfig.key) { + throw new Error( + "External modules configuration must have a 'key'. Please provide a key for the module." + ) + } + + if ("disable" in moduleConfig && "key" in moduleConfig) { + acc[moduleConfig.key!] = moduleConfig + } + + // TODO: handle external modules later + let serviceName: string = + "key" in moduleConfig && moduleConfig.key ? moduleConfig.key : "" + delete moduleConfig.key + + if (!serviceName && "resolve" in moduleConfig) { + if ( + isString(moduleConfig.resolve!) && + REVERSED_MODULE_PACKAGE_NAMES[moduleConfig.resolve!] + ) { + serviceName = REVERSED_MODULE_PACKAGE_NAMES[moduleConfig.resolve!] + acc[serviceName] = moduleConfig + return acc + } + + let resolution = isString(moduleConfig.resolve!) + ? normalizeImportPathWithSource(moduleConfig.resolve as string) + : moduleConfig.resolve + + const moduleExport = isString(resolution) + ? require(resolution) + : resolution + + const defaultExport = resolveExports(moduleExport).default + + const joinerConfig = + typeof defaultExport.service.prototype.__joinerConfig === "function" + ? defaultExport.service.prototype.__joinerConfig() ?? {} + : defaultExport.service.prototype.__joinerConfig ?? {} + + serviceName = joinerConfig.serviceName + + if (!serviceName) { + throw new Error( + `Module ${moduleConfig.resolve} doesn't have a serviceName. Please provide a 'key' for the module or check the service joiner config.` + ) + } + } + + acc[serviceName] = moduleConfig + + return acc + }, {}) + // Remove any modules set to false - Object.keys(modules).forEach((key) => { - if (modules[key] === false) { - delete modules[key] + Object.keys(remappedModules).forEach((key) => { + if (remappedModules[key].disable) { + delete remappedModules[key] } }) - return { - projectConfig, - featureFlags, - plugins: config.plugins || [], - admin, - modules, - } + return remappedModules as ConfigModule["modules"] } diff --git a/packages/core/utils/src/event-bus/__tests__/message-aggregator.spec.ts b/packages/core/utils/src/event-bus/__tests__/message-aggregator.spec.ts index 07f144bdf7..0c05a13b4b 100644 --- a/packages/core/utils/src/event-bus/__tests__/message-aggregator.spec.ts +++ b/packages/core/utils/src/event-bus/__tests__/message-aggregator.spec.ts @@ -10,7 +10,7 @@ describe("MessageAggregator", function () { aggregator.save({ name: "ProductVariant.created", metadata: { - source: "Product", + source: "product", action: "created", object: "ProductVariant", eventGroupId: "1", @@ -20,7 +20,7 @@ describe("MessageAggregator", function () { aggregator.save({ name: "Product.created", metadata: { - source: "Product", + source: "product", action: "created", object: "Product", eventGroupId: "1", @@ -30,7 +30,7 @@ describe("MessageAggregator", function () { aggregator.save({ name: "ProductVariant.created", metadata: { - source: "Product", + source: "product", action: "created", object: "ProductVariant", eventGroupId: "1", @@ -40,7 +40,7 @@ describe("MessageAggregator", function () { aggregator.save({ name: "ProductType.detached", metadata: { - source: "Product", + source: "product", action: "detached", object: "ProductType", eventGroupId: "1", @@ -50,7 +50,7 @@ describe("MessageAggregator", function () { aggregator.save({ name: "ProductVariant.updated", metadata: { - source: "Product", + source: "product", action: "updated", object: "ProductVariant", eventGroupId: "1", @@ -76,7 +76,7 @@ describe("MessageAggregator", function () { { name: "ProductType.detached", metadata: { - source: "Product", + source: "product", action: "detached", object: "ProductType", eventGroupId: "1", @@ -89,7 +89,7 @@ describe("MessageAggregator", function () { { name: "ProductVariant.updated", metadata: { - source: "Product", + source: "product", action: "updated", object: "ProductVariant", eventGroupId: "1", @@ -102,7 +102,7 @@ describe("MessageAggregator", function () { { name: "ProductVariant.created", metadata: { - source: "Product", + source: "product", action: "created", object: "ProductVariant", eventGroupId: "1", @@ -112,7 +112,7 @@ describe("MessageAggregator", function () { { name: "ProductVariant.created", metadata: { - source: "Product", + source: "product", action: "created", object: "ProductVariant", eventGroupId: "1", @@ -125,7 +125,7 @@ describe("MessageAggregator", function () { { name: "Product.created", metadata: { - source: "Product", + source: "product", action: "created", object: "Product", eventGroupId: "1", diff --git a/packages/core/utils/src/modules-sdk/definition.ts b/packages/core/utils/src/modules-sdk/definition.ts index 0e19e8fdd8..4b9b76dc4c 100644 --- a/packages/core/utils/src/modules-sdk/definition.ts +++ b/packages/core/utils/src/modules-sdk/definition.ts @@ -1,31 +1,66 @@ export const Modules = { - AUTH: "Auth", - CACHE: "Cache", - CART: "Cart", - CUSTOMER: "Customer", - EVENT_BUS: "EventBus", - INVENTORY: "Inventory", - LINK: "LinkModules", - PAYMENT: "Payment", - PRICING: "Pricing", - PRODUCT: "Product", - PROMOTION: "Promotion", - SALES_CHANNEL: "SalesChannel", - TAX: "Tax", - FULFILLMENT: "Fulfillment", - STOCK_LOCATION: "StockLocation", - USER: "User", - WORKFLOW_ENGINE: "Workflows", - REGION: "Region", - ORDER: "Order", - API_KEY: "ApiKey", - STORE: "Store", - CURRENCY: "Currency", - FILE: "File", - NOTIFICATION: "Notification", - INDEX: "Index", + AUTH: "auth", + CACHE: "cache", + CART: "cart", + CUSTOMER: "customer", + EVENT_BUS: "event_bus", + INVENTORY: "inventory", + LINK: "link_modules", + PAYMENT: "payment", + PRICING: "pricing", + PRODUCT: "product", + PROMOTION: "promotion", + SALES_CHANNEL: "sales_channel", + TAX: "tax", + FULFILLMENT: "fulfillment", + STOCK_LOCATION: "stock_location", + USER: "user", + WORKFLOW_ENGINE: "workflows", + REGION: "region", + ORDER: "order", + API_KEY: "api_key", + STORE: "store", + CURRENCY: "currency", + FILE: "file", + NOTIFICATION: "notification", + INDEX: "index", } as const +export const MODULE_PACKAGE_NAMES = { + [Modules.AUTH]: "@medusajs/medusa/auth", + [Modules.CACHE]: "@medusajs/medusa/cache-inmemory", + [Modules.CART]: "@medusajs/medusa/cart", + [Modules.CUSTOMER]: "@medusajs/medusa/customer", + [Modules.EVENT_BUS]: "@medusajs/medusa/event-bus-local", + [Modules.INVENTORY]: "@medusajs/medusa/inventory-next", // TODO: To be replaced when current `@medusajs/inventory` is deprecated + [Modules.LINK]: "@medusajs/medusa/link-modules", + [Modules.PAYMENT]: "@medusajs/medusa/payment", + [Modules.PRICING]: "@medusajs/medusa/pricing", + [Modules.PRODUCT]: "@medusajs/medusa/product", + [Modules.PROMOTION]: "@medusajs/medusa/promotion", + [Modules.SALES_CHANNEL]: "@medusajs/medusa/sales-channel", + [Modules.FULFILLMENT]: "@medusajs/medusa/fulfillment", + [Modules.STOCK_LOCATION]: "@medusajs/medusa/stock-location-next", // TODO: To be replaced when current `@medusajs/stock-location` is deprecated + [Modules.TAX]: "@medusajs/medusa/tax", + [Modules.USER]: "@medusajs/medusa/user", + [Modules.WORKFLOW_ENGINE]: "@medusajs/medusa/workflow-engine-inmemory", + [Modules.REGION]: "@medusajs/medusa/region", + [Modules.ORDER]: "@medusajs/medusa/order", + [Modules.API_KEY]: "@medusajs/medusa/api-key", + [Modules.STORE]: "@medusajs/medusa/store", + [Modules.CURRENCY]: "@medusajs/medusa/currency", + [Modules.FILE]: "@medusajs/medusa/file", + [Modules.NOTIFICATION]: "@medusajs/medusa/notification", + [Modules.INDEX]: "@medusajs/medusa/index-module", +} + +export const REVERSED_MODULE_PACKAGE_NAMES = Object.entries( + MODULE_PACKAGE_NAMES +).reduce((acc, [key, value]) => { + acc[value] = key + return acc +}, {}) + /** * Making modules be referenced as a type as well. */ diff --git a/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts b/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts index 89a195aa5c..dd5a9ff671 100644 --- a/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts +++ b/packages/modules/api-key/integration-tests/__tests__/api-key-module-service.spec.ts @@ -56,7 +56,7 @@ moduleIntegrationTestRunner({ linkable: "api_key_id", entity: "ApiKey", primaryKey: "id", - serviceName: "ApiKey", + serviceName: "api_key", field: "apiKey", }, publishable_key_id: { @@ -64,7 +64,7 @@ moduleIntegrationTestRunner({ entity: "ApiKey", linkable: "publishable_key_id", primaryKey: "publishable_key_id", - serviceName: "ApiKey", + serviceName: "api_key", }, }) }) diff --git a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts index 123e79234c..3f8d30dcda 100644 --- a/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts +++ b/packages/modules/auth/integration-tests/__tests__/auth-module-service/index.spec.ts @@ -54,7 +54,7 @@ moduleIntegrationTestRunner({ linkable: "auth_identity_id", entity: "AuthIdentity", primaryKey: "id", - serviceName: "Auth", + serviceName: "auth", field: "authIdentity", }, }) @@ -66,7 +66,7 @@ moduleIntegrationTestRunner({ linkable: "provider_identity_id", entity: "ProviderIdentity", primaryKey: "id", - serviceName: "Auth", + serviceName: "auth", field: "providerIdentity", }, }) diff --git a/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts b/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts index a3212d0565..fa5c2510c4 100644 --- a/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts +++ b/packages/modules/cart/integration-tests/__tests__/services/cart-module/index.spec.ts @@ -36,7 +36,7 @@ moduleIntegrationTestRunner({ linkable: "cart_id", entity: "Cart", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "cart", }, }, @@ -45,7 +45,7 @@ moduleIntegrationTestRunner({ linkable: "address_id", entity: "Address", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "address", }, }, @@ -54,7 +54,7 @@ moduleIntegrationTestRunner({ linkable: "line_item_id", entity: "LineItem", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "lineItem", }, }, @@ -63,7 +63,7 @@ moduleIntegrationTestRunner({ linkable: "line_item_adjustment_id", entity: "LineItemAdjustment", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "lineItemAdjustment", }, }, @@ -72,7 +72,7 @@ moduleIntegrationTestRunner({ linkable: "line_item_tax_line_id", entity: "LineItemTaxLine", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "lineItemTaxLine", }, }, @@ -81,7 +81,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_method_id", entity: "ShippingMethod", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "shippingMethod", }, }, @@ -90,7 +90,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_method_adjustment_id", entity: "ShippingMethodAdjustment", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "shippingMethodAdjustment", }, }, @@ -99,7 +99,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_method_tax_line_id", entity: "ShippingMethodTaxLine", primaryKey: "id", - serviceName: "Cart", + serviceName: "cart", field: "shippingMethodTaxLine", }, }, diff --git a/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts b/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts index 81d85896ad..7f255f7ad5 100644 --- a/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts +++ b/packages/modules/currency/integration-tests/__tests__/currency-module-service.spec.ts @@ -26,7 +26,7 @@ moduleIntegrationTestRunner({ linkable: "currency_code", entity: "Currency", primaryKey: "code", - serviceName: "Currency", + serviceName: "currency", field: "currency", }, }, diff --git a/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts b/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts index 70fa6bf7af..83c94b1c53 100644 --- a/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts +++ b/packages/modules/customer/integration-tests/__tests__/services/customer-module/index.spec.ts @@ -31,7 +31,7 @@ moduleIntegrationTestRunner({ linkable: "customer_address_id", entity: "CustomerAddress", primaryKey: "id", - serviceName: "Customer", + serviceName: "customer", field: "customerAddress", }, }, @@ -40,7 +40,7 @@ moduleIntegrationTestRunner({ linkable: "customer_group_customer_id", entity: "CustomerGroupCustomer", primaryKey: "id", - serviceName: "Customer", + serviceName: "customer", field: "customerGroupCustomer", }, }, @@ -49,7 +49,7 @@ moduleIntegrationTestRunner({ linkable: "customer_group_id", entity: "CustomerGroup", primaryKey: "id", - serviceName: "Customer", + serviceName: "customer", field: "customerGroup", }, }, @@ -58,7 +58,7 @@ moduleIntegrationTestRunner({ linkable: "customer_id", entity: "Customer", primaryKey: "id", - serviceName: "Customer", + serviceName: "customer", field: "customer", }, }, diff --git a/packages/modules/fulfillment/integration-tests/__fixtures__/events.ts b/packages/modules/fulfillment/integration-tests/__fixtures__/events.ts index 8a3b15cb37..ca603d1a2d 100644 --- a/packages/modules/fulfillment/integration-tests/__fixtures__/events.ts +++ b/packages/modules/fulfillment/integration-tests/__fixtures__/events.ts @@ -13,7 +13,7 @@ export function buildExpectedEventMessageShape(options: { metadata: { action: options.action, eventGroupId: options.eventGroupId, - source: "Fulfillment", + source: "fulfillment", object: options.object, }, data: options.data, diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts index 012eaf5a95..fc801f8286 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts @@ -137,7 +137,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_address_id", entity: "FulfillmentAddress", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillmentAddress", }, }, @@ -146,7 +146,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_item_id", entity: "FulfillmentItem", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillmentItem", }, }, @@ -155,7 +155,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_label_id", entity: "FulfillmentLabel", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillmentLabel", }, }, @@ -164,7 +164,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_provider_id", entity: "FulfillmentProvider", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillmentProvider", }, }, @@ -173,7 +173,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_set_id", entity: "FulfillmentSet", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillmentSet", }, }, @@ -182,7 +182,7 @@ moduleIntegrationTestRunner({ linkable: "fulfillment_id", entity: "Fulfillment", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "fulfillment", }, }, @@ -191,7 +191,7 @@ moduleIntegrationTestRunner({ linkable: "geo_zone_id", entity: "GeoZone", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "geoZone", }, }, @@ -200,7 +200,7 @@ moduleIntegrationTestRunner({ linkable: "service_zone_id", entity: "ServiceZone", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "serviceZone", }, }, @@ -209,7 +209,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_option_rule_id", entity: "ShippingOptionRule", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "shippingOptionRule", }, }, @@ -218,7 +218,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_option_type_id", entity: "ShippingOptionType", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "shippingOptionType", }, }, @@ -227,7 +227,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_option_id", entity: "ShippingOption", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "shippingOption", }, }, @@ -236,7 +236,7 @@ moduleIntegrationTestRunner({ linkable: "shipping_profile_id", entity: "ShippingProfile", primaryKey: "id", - serviceName: "Fulfillment", + serviceName: "fulfillment", field: "shippingProfile", }, }, diff --git a/packages/modules/index/src/utils/default-schema.ts b/packages/modules/index/src/utils/default-schema.ts index d788375ff3..b6c370a14b 100644 --- a/packages/modules/index/src/utils/default-schema.ts +++ b/packages/modules/index/src/utils/default-schema.ts @@ -1,18 +1,20 @@ +import { Modules } from "@medusajs/utils" + export const defaultSchema = ` - type Product @Listeners(values: ["Product.product.created", "Product.product.updated", "Product.product.deleted"]) { + type Product @Listeners(values: ["${Modules.PRODUCT}.product.created", "${Modules.PRODUCT}.product.updated", "${Modules.PRODUCT}.product.deleted"]) { id: String title: String variants: [ProductVariant] } - type ProductVariant @Listeners(values: ["Product.product-variant.created", "Product.product-variant.updated", "Product.product-variant.deleted"]) { + type ProductVariant @Listeners(values: ["${Modules.PRODUCT}.product-variant.created", "${Modules.PRODUCT}.product-variant.updated", "${Modules.PRODUCT}.product-variant.deleted"]) { id: String product_id: String sku: String prices: [Price] } - type Price @Listeners(values: ["Pricing.price.created", "Pricing.price.updated", "Pricing.price.deleted"]) { + type Price @Listeners(values: ["${Modules.PRICING}.price.created", "${Modules.PRICING}.price.updated", "${Modules.PRICING}.price.deleted"]) { amount: Int currency_code: String } diff --git a/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts b/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts index b8c1e8c77b..424b82d7a3 100644 --- a/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts +++ b/packages/modules/inventory-next/integration-tests/__tests__/inventory-module-service.spec.ts @@ -31,7 +31,7 @@ moduleIntegrationTestRunner({ entity: "InventoryItem", linkable: "inventory_item_id", primaryKey: "id", - serviceName: "Inventory", + serviceName: "inventory", }, }, inventoryLevel: { @@ -40,7 +40,7 @@ moduleIntegrationTestRunner({ entity: "InventoryLevel", linkable: "inventory_level_id", primaryKey: "id", - serviceName: "Inventory", + serviceName: "inventory", }, }, reservationItem: { @@ -49,7 +49,7 @@ moduleIntegrationTestRunner({ entity: "ReservationItem", linkable: "reservation_item_id", primaryKey: "id", - serviceName: "Inventory", + serviceName: "inventory", }, }, }) diff --git a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts index d30deda473..985140eda7 100644 --- a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts +++ b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts @@ -60,7 +60,7 @@ moduleIntegrationTestRunner({ linkable: "notification_id", entity: "Notification", primaryKey: "id", - serviceName: "Notification", + serviceName: "notification", field: "notification", }, }, diff --git a/packages/modules/order/integration-tests/__tests__/index.spec.ts b/packages/modules/order/integration-tests/__tests__/index.spec.ts index 6e47b50276..9eefcdc3fd 100644 --- a/packages/modules/order/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/order/integration-tests/__tests__/index.spec.ts @@ -35,7 +35,7 @@ moduleIntegrationTestRunner({ linkable: "order_id", entity: "Order", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "order", }, }, @@ -44,7 +44,7 @@ moduleIntegrationTestRunner({ linkable: "order_address_id", entity: "OrderAddress", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderAddress", }, }, @@ -53,7 +53,7 @@ moduleIntegrationTestRunner({ linkable: "order_change_id", entity: "OrderChange", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderChange", }, }, @@ -62,14 +62,14 @@ moduleIntegrationTestRunner({ linkable: "order_claim_id", entity: "OrderClaim", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderClaim", }, claim_id: { linkable: "claim_id", entity: "OrderClaim", primaryKey: "claim_id", - serviceName: "Order", + serviceName: "order", field: "orderClaim", }, }, @@ -78,14 +78,14 @@ moduleIntegrationTestRunner({ linkable: "order_exchange_id", entity: "OrderExchange", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderExchange", }, exchange_id: { linkable: "exchange_id", entity: "OrderExchange", primaryKey: "exchange_id", - serviceName: "Order", + serviceName: "order", field: "orderExchange", }, }, @@ -94,7 +94,7 @@ moduleIntegrationTestRunner({ linkable: "order_line_item_id", entity: "OrderLineItem", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderLineItem", }, }, @@ -103,7 +103,7 @@ moduleIntegrationTestRunner({ linkable: "order_shipping_method_id", entity: "OrderShippingMethod", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderShippingMethod", }, }, @@ -112,7 +112,7 @@ moduleIntegrationTestRunner({ linkable: "order_transaction_id", entity: "OrderTransaction", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "orderTransaction", }, }, @@ -121,7 +121,7 @@ moduleIntegrationTestRunner({ linkable: "return_id", entity: "Return", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "return", }, }, @@ -130,7 +130,7 @@ moduleIntegrationTestRunner({ linkable: "return_reason_id", entity: "ReturnReason", primaryKey: "id", - serviceName: "Order", + serviceName: "order", field: "returnReason", }, }, diff --git a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts index 43bc178af9..ef88599755 100644 --- a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts +++ b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts @@ -37,7 +37,7 @@ moduleIntegrationTestRunner({ linkable: "payment_id", entity: "Payment", primaryKey: "id", - serviceName: "Payment", + serviceName: "payment", field: "payment", }, }, @@ -46,7 +46,7 @@ moduleIntegrationTestRunner({ linkable: "payment_collection_id", entity: "PaymentCollection", primaryKey: "id", - serviceName: "Payment", + serviceName: "payment", field: "paymentCollection", }, }, @@ -55,7 +55,7 @@ moduleIntegrationTestRunner({ linkable: "payment_provider_id", entity: "PaymentProvider", primaryKey: "id", - serviceName: "Payment", + serviceName: "payment", field: "paymentProvider", }, }, @@ -65,7 +65,7 @@ moduleIntegrationTestRunner({ entity: "PaymentSession", linkable: "payment_session_id", primaryKey: "id", - serviceName: "Payment", + serviceName: "payment", }, }, refundReason: { @@ -73,7 +73,7 @@ moduleIntegrationTestRunner({ linkable: "refund_reason_id", entity: "RefundReason", primaryKey: "id", - serviceName: "Payment", + serviceName: "payment", field: "refundReason", }, }, diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/index.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/index.spec.ts index a890de365d..9ebe25f9e3 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/index.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/index.spec.ts @@ -29,7 +29,7 @@ moduleIntegrationTestRunner({ linkable: "price_set_id", entity: "PriceSet", primaryKey: "id", - serviceName: "Pricing", + serviceName: "pricing", field: "priceSet", }, }, @@ -38,7 +38,7 @@ moduleIntegrationTestRunner({ linkable: "price_list_id", entity: "PriceList", primaryKey: "id", - serviceName: "Pricing", + serviceName: "pricing", field: "priceList", }, }, @@ -47,7 +47,7 @@ moduleIntegrationTestRunner({ linkable: "price_id", entity: "Price", primaryKey: "id", - serviceName: "Pricing", + serviceName: "pricing", field: "price", }, }, @@ -56,7 +56,7 @@ moduleIntegrationTestRunner({ linkable: "price_preference_id", entity: "PricePreference", primaryKey: "id", - serviceName: "Pricing", + serviceName: "pricing", field: "pricePreference", }, }, diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts index fcd1888b9a..58cf0a2e83 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-categories.spec.ts @@ -692,7 +692,7 @@ moduleIntegrationTestRunner({ [ expect.objectContaining({ data: { id: productCategoryOne.id }, - name: "Product.product-category.deleted", + name: "product.product-category.deleted", metadata: { action: CommonEvents.DELETED, object: "product_category", diff --git a/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts b/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts index c16b598375..f16acc2be6 100644 --- a/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts +++ b/packages/modules/product/integration-tests/__tests__/product-module-service/product-collections.spec.ts @@ -281,7 +281,7 @@ moduleIntegrationTestRunner({ expect(eventBusSpy).toHaveBeenCalledWith( [ { - name: "Product.product-collection.deleted", + name: "product.product-collection.deleted", data: { id: collectionId }, metadata: { action: CommonEvents.DELETED, diff --git a/packages/modules/product/integration-tests/__tests__/product.ts b/packages/modules/product/integration-tests/__tests__/product.ts index ce91596e5f..d7ac5e1064 100644 --- a/packages/modules/product/integration-tests/__tests__/product.ts +++ b/packages/modules/product/integration-tests/__tests__/product.ts @@ -72,7 +72,7 @@ moduleIntegrationTestRunner({ linkable: "product_id", entity: "Product", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "product", }, }, @@ -81,7 +81,7 @@ moduleIntegrationTestRunner({ linkable: "product_variant_id", entity: "ProductVariant", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productVariant", }, variant_id: { @@ -89,7 +89,7 @@ moduleIntegrationTestRunner({ entity: "ProductVariant", linkable: "variant_id", primaryKey: "variant_id", - serviceName: "Product", + serviceName: "product", }, }, productOption: { @@ -97,7 +97,7 @@ moduleIntegrationTestRunner({ linkable: "product_option_id", entity: "ProductOption", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productOption", }, }, @@ -106,7 +106,7 @@ moduleIntegrationTestRunner({ linkable: "product_type_id", entity: "ProductType", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productType", }, }, @@ -115,7 +115,7 @@ moduleIntegrationTestRunner({ linkable: "product_image_id", entity: "ProductImage", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productImage", }, }, @@ -124,7 +124,7 @@ moduleIntegrationTestRunner({ linkable: "product_tag_id", entity: "ProductTag", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productTag", }, }, @@ -133,7 +133,7 @@ moduleIntegrationTestRunner({ linkable: "product_collection_id", entity: "ProductCollection", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productCollection", }, }, @@ -142,7 +142,7 @@ moduleIntegrationTestRunner({ linkable: "product_category_id", entity: "ProductCategory", primaryKey: "id", - serviceName: "Product", + serviceName: "product", field: "productCategory", }, }, diff --git a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts index ba18128125..75231ad1b1 100644 --- a/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts +++ b/packages/modules/promotion/integration-tests/__tests__/services/promotion-module/promotion.spec.ts @@ -49,7 +49,7 @@ moduleIntegrationTestRunner({ linkable: "promotion_id", entity: "Promotion", primaryKey: "id", - serviceName: "Promotion", + serviceName: "promotion", field: "promotion", }, }, @@ -58,7 +58,7 @@ moduleIntegrationTestRunner({ linkable: "campaign_id", entity: "Campaign", primaryKey: "id", - serviceName: "Promotion", + serviceName: "promotion", field: "campaign", }, }, @@ -67,7 +67,7 @@ moduleIntegrationTestRunner({ linkable: "promotion_rule_id", entity: "PromotionRule", primaryKey: "id", - serviceName: "Promotion", + serviceName: "promotion", field: "promotionRule", }, }, diff --git a/packages/modules/region/integration-tests/__tests__/region-module.spec.ts b/packages/modules/region/integration-tests/__tests__/region-module.spec.ts index 66bb2e2b06..49f34242d8 100644 --- a/packages/modules/region/integration-tests/__tests__/region-module.spec.ts +++ b/packages/modules/region/integration-tests/__tests__/region-module.spec.ts @@ -26,7 +26,7 @@ moduleIntegrationTestRunner({ linkable: "region_id", entity: "Region", primaryKey: "id", - serviceName: "Region", + serviceName: "region", field: "region", }, }, @@ -35,7 +35,7 @@ moduleIntegrationTestRunner({ linkable: "country_iso_2", entity: "Country", primaryKey: "iso_2", - serviceName: "Region", + serviceName: "region", field: "country", }, }, diff --git a/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts b/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts index 805de51364..cac869feec 100644 --- a/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts +++ b/packages/modules/sales-channel/integration-tests/__tests__/services/sales-channel-module.spec.ts @@ -51,7 +51,7 @@ moduleIntegrationTestRunner({ linkable: "sales_channel_id", entity: "SalesChannel", primaryKey: "id", - serviceName: "SalesChannel", + serviceName: "sales_channel", field: "salesChannel", }, }, diff --git a/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts b/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts index 1d77cdd78a..3f55111bcf 100644 --- a/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts +++ b/packages/modules/stock-location-next/integration-tests/__tests__/stock-location-module-service.spec.ts @@ -30,7 +30,7 @@ moduleIntegrationTestRunner({ linkable: "stock_location_address_id", entity: "StockLocationAddress", primaryKey: "id", - serviceName: "StockLocation", + serviceName: "stock_location", field: "stockLocationAddress", }, }, @@ -40,13 +40,13 @@ moduleIntegrationTestRunner({ entity: "StockLocation", linkable: "stock_location_id", primaryKey: "id", - serviceName: "StockLocation", + serviceName: "stock_location", }, location_id: { linkable: "location_id", entity: "StockLocation", primaryKey: "location_id", - serviceName: "StockLocation", + serviceName: "stock_location", field: "stockLocation", }, }, diff --git a/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts b/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts index f672ab5706..15f5198e7d 100644 --- a/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts +++ b/packages/modules/store/integration-tests/__tests__/store-module-service.spec.ts @@ -27,7 +27,7 @@ moduleIntegrationTestRunner({ linkable: "store_id", entity: "Store", primaryKey: "id", - serviceName: "Store", + serviceName: "store", field: "store", }, }, @@ -36,7 +36,7 @@ moduleIntegrationTestRunner({ linkable: "store_currency_id", entity: "StoreCurrency", primaryKey: "id", - serviceName: "Store", + serviceName: "store", field: "storeCurrency", }, }, diff --git a/packages/modules/tax/integration-tests/__tests__/index.spec.ts b/packages/modules/tax/integration-tests/__tests__/index.spec.ts index cfc9282d68..d17c74efeb 100644 --- a/packages/modules/tax/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/tax/integration-tests/__tests__/index.spec.ts @@ -32,7 +32,7 @@ moduleIntegrationTestRunner({ linkable: "tax_rate_id", entity: "TaxRate", primaryKey: "id", - serviceName: "Tax", + serviceName: "tax", field: "taxRate", }, }, @@ -41,7 +41,7 @@ moduleIntegrationTestRunner({ linkable: "tax_region_id", entity: "TaxRegion", primaryKey: "id", - serviceName: "Tax", + serviceName: "tax", field: "taxRegion", }, }, @@ -50,7 +50,7 @@ moduleIntegrationTestRunner({ linkable: "tax_rate_rule_id", entity: "TaxRateRule", primaryKey: "id", - serviceName: "Tax", + serviceName: "tax", field: "taxRateRule", }, }, @@ -59,7 +59,7 @@ moduleIntegrationTestRunner({ linkable: "tax_provider_id", entity: "TaxProvider", primaryKey: "id", - serviceName: "Tax", + serviceName: "tax", field: "taxProvider", }, }, diff --git a/packages/modules/user/integration-tests/__tests__/user.spec.ts b/packages/modules/user/integration-tests/__tests__/user.spec.ts index 302d04d992..b5d8b90296 100644 --- a/packages/modules/user/integration-tests/__tests__/user.spec.ts +++ b/packages/modules/user/integration-tests/__tests__/user.spec.ts @@ -45,7 +45,7 @@ moduleIntegrationTestRunner({ linkable: "user_id", entity: "User", primaryKey: "id", - serviceName: "User", + serviceName: "user", field: "user", }, }, @@ -54,7 +54,7 @@ moduleIntegrationTestRunner({ linkable: "invite_id", entity: "Invite", primaryKey: "id", - serviceName: "User", + serviceName: "user", field: "invite", }, }, diff --git a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts index 171ba16f85..6ee43e3d6c 100644 --- a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts @@ -57,7 +57,7 @@ moduleIntegrationTestRunner({ linkable: "workflow_execution_id", entity: "WorkflowExecution", primaryKey: "id", - serviceName: "Workflows", + serviceName: "workflows", field: "workflowExecution", }, }, diff --git a/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts b/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts index 7248e80a4d..fd05fdac92 100644 --- a/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/workflow-engine-redis/integration-tests/__tests__/index.spec.ts @@ -83,7 +83,7 @@ moduleIntegrationTestRunner({ linkable: "workflow_execution_id", entity: "WorkflowExecution", primaryKey: "id", - serviceName: "Workflows", + serviceName: "workflows", field: "workflowExecution", }, },