Files
medusa-store/packages/modules/workflow-engine-redis/src/module-definition.ts
Adrien de Peretti 63623422fe chore(): Autoload module resources (#7291)
**What**
- automatically build and consume connection and container loader if not exported by the module
- therefore load the services and repositories automatically, including baseRepository
- automatically build run and revert migrations if not provided
- cleaup modules to remove extra unnecessary bits and pieces
- remove the `initializeFactory` in favor of using `medusaApp`

Should drastically improve the module building DX by removing a lot of boilerplate to handle by the user, that plus the base entity should simplify quite a lot the flow cc @shahednasser 

**Note**
I had to choose a way to identify connection and container loader from the exported loader from the module. I decided to go with named function `connectionLoader` and `containerLoader`, also, now the factories will return named function so if the user use the factories we are providing to build those loaders, the function will also be named and identified
2024-05-13 12:12:36 +00:00

13 lines
351 B
TypeScript

import { ModuleExports } from "@medusajs/types"
import { WorkflowsModuleService } from "@services"
import redisConnection from "./loaders/redis"
import loadUtils from "./loaders/utils"
const service = WorkflowsModuleService
const loaders = [loadUtils, redisConnection] as any
export const moduleDefinition: ModuleExports = {
service,
loaders,
}