FIXES: FRMW-2727
MikroORM (with version 5.9) has [hardcoded the TypeScript module](https://github.com/mikro-orm/mikro-orm/blob/5.x/packages/core/src/utils/ConfigurationLoader.ts#L138-L139) system to `commonjs`, which makes it incompatible with the module system we are using, ie `Node16`.
So, in order to continue using the Mikro ORM CLI within our modules, we will have to monkey-patch the block of code responsible for configuring `ts-node`. However, the monkey-patching must be done before their CLI gets booted.
As a result of this, we have to create a wrapper CLI on top of Mikro ORM CLI that performs the following steps.
- Monkey-patch the relevant code
- Register Mikro ORM CLI as the second step.
Due do this, we will have to use this new wrapper CLI within the modules, which is exposed as `medusa-db`. Maybe, `medusa-db` is not a great name, so please send your suggestions.
* chore: Treat internal event differently, primarely do not display info log for those events
* revert doc
* add few tests
* only set internal option if present
* revert to previous condition
* start including feedback after discussion
* include feedback
* fix modules integration tests
* fix modules integration tests
* fix event bus local
* fix: normalize path before consuming it while loading models
* Make it so that models derived from the service if present
* fix linkable tests that now match what has been passed to the medusa service if there is no custom joiner config
* fix linkable tests that now match what has been passed to the medusa service if there is no custom joiner config
* fix linkable tests that now match what has been passed to the medusa service if there is no custom joiner config
**What**
Apply the `Module` util to each module to handle the export and provide the linkable configuration object.
- Most joiner config that does not have any special config are removed/cleaned up in favor of the autogenerated one or simpler one
- linkable are now available in all modules
- cleaned up the dependencies of the modules
FIXES CORE-2410
**What**
Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate.
This pr also includes various fixes in different modules
Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
* chore: ability to group events on redis event bus
* chore: fix tests
* Update packages/modules/event-bus-redis/src/services/event-bus-redis.ts
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
* chore: change shape of input and body data
* chore: fix builds
* chore: address comments
* chore: fix unit test
---------
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
**What**
Add support for event emitting in the fulfillment module
**NOTE**
It does not include the review of the events for the abstract module factory if the method is not implemented in the module itself and rely on the default implementation
**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