feat: Workflow engine modules (#6128)

This commit is contained in:
Carlos R. L. Rodrigues
2024-01-23 10:08:08 -03:00
committed by GitHub
parent d85fee42ee
commit 302323916b
119 changed files with 5339 additions and 263 deletions

Binary file not shown.

View File

@@ -16,6 +16,7 @@ export enum Modules {
PRICING = "pricingService",
PROMOTION = "promotion",
AUTHENTICATION = "authentication",
WORKFLOW_ENGINE = "workflows",
CART = "cart",
CUSTOMER = "customer",
PAYMENT = "payment",
@@ -30,6 +31,7 @@ export enum ModuleRegistrationName {
PRICING = "pricingModuleService",
PROMOTION = "promotionModuleService",
AUTHENTICATION = "authenticationModuleService",
WORKFLOW_ENGINE = "workflowsModuleService",
CART = "cartModuleService",
CUSTOMER = "customerModuleService",
PAYMENT = "paymentModuleService",
@@ -45,6 +47,7 @@ export const MODULE_PACKAGE_NAMES = {
[Modules.PRICING]: "@medusajs/pricing",
[Modules.PROMOTION]: "@medusajs/promotion",
[Modules.AUTHENTICATION]: "@medusajs/authentication",
[Modules.WORKFLOW_ENGINE]: "@medusajs/workflow-engine-inmemory",
[Modules.CART]: "@medusajs/cart",
[Modules.CUSTOMER]: "@medusajs/customer",
[Modules.PAYMENT]: "@medusajs/payment",
@@ -165,6 +168,20 @@ export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.WORKFLOW_ENGINE]: {
key: Modules.WORKFLOW_ENGINE,
registrationName: ModuleRegistrationName.WORKFLOW_ENGINE,
defaultPackage: false,
label: upperCaseFirst(ModuleRegistrationName.WORKFLOW_ENGINE),
isRequired: false,
canOverride: true,
isQueryable: true,
dependencies: ["logger"],
defaultModuleDeclaration: {
scope: MODULE_SCOPE.INTERNAL,
resources: MODULE_RESOURCE_TYPE.SHARED,
},
},
[Modules.CART]: {
key: Modules.CART,
registrationName: ModuleRegistrationName.CART,

View File

@@ -245,6 +245,12 @@ export async function MedusaApp({
registerCustomJoinerConfigs(servicesConfig ?? [])
if (
sharedResourcesConfig?.database?.connection &&
!injectedDependencies[ContainerRegistrationKeys.PG_CONNECTION]
) {
injectedDependencies[ContainerRegistrationKeys.PG_CONNECTION] =
sharedResourcesConfig.database.connection
} else if (
dbData.clientUrl &&
!injectedDependencies[ContainerRegistrationKeys.PG_CONNECTION]
) {