Commit Graph

43 Commits

Author SHA1 Message Date
Adrien de Peretti
1d8939df3a chore(): Allow to register modules through array (#9522) 2024-10-11 15:17:00 +02:00
Adrien de Peretti
34d57870ad chore: workflow internals improvementss (#9455) 2024-10-10 09:11:56 +02:00
Harminder Virk
2d1cf12dac feature: Add MikroORM CLI wrapper to bypass hardcoded module system (#9426)
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.
2024-10-03 04:51:20 +00:00
Harminder Virk
48bea267dc chore: perform dependencies scan and fix all dependencies (#9296) 2024-09-26 14:14:38 +05:30
Adrien de Peretti
e096feb7d5 chore: Update modules deps (#9286) 2024-09-26 11:14:35 +05:30
Adrien de Peretti
6937d74252 chore(): Move dependencies around (#9278)
RESOLVES FRMW-2716 [1]

**What**
First stab at re organising dependencies in the modules and their usage.
2024-09-24 14:58:04 +00:00
Harminder Virk
9e711720dd chore: upgrade moduleResolution to Node16 (#9269) 2024-09-24 17:19:20 +05:30
Harminder Virk
9f72fb5902 Chore: cleanup workflows SDK (#9244)
Fixes: FRMW-2712
2024-09-23 11:04:38 +00:00
Adrien de Peretti
58167b5dfa feat(index): Index module foundation (#9095)
**What**
Index module foundation

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-09-18 19:04:04 +00:00
Carlos R. L. Rodrigues
adbeb9cc1d fix(workflow-engine-*): pass container to flow (#9180) 2024-09-18 08:44:11 -03:00
Carlos R. L. Rodrigues
d6ff526820 fix(link-modules): table name (#9151)
FIXES: FRMW-2706
2024-09-16 19:08:42 +00:00
Carlos R. L. Rodrigues
ef8dc4087e feat: run nested async workflows (#9119) 2024-09-16 13:06:45 +00:00
Carlos R. L. Rodrigues
950cf9af79 chore: remove container registration name (#9137) 2024-09-16 06:22:24 -03:00
Carlos R. L. Rodrigues
fdd0543011 chore: joiner config entity property (#9084) 2024-09-11 06:25:25 -03:00
Oli Juhl
2bacf86d3c chore: Remove prepublishOnly script (#8699)
* wip

* wip

* verbose logging

* remove prepublish scripts

* chore: add back prepublish scripts

* wip

* remove prepublishOnly script

* chore: Clean up rest of build scripts

* add back build script

* feedback

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-08-27 10:31:38 +02:00
Carlos R. L. Rodrigues
3b4eea08ef chore: peer dependency version (#8771)
* fix peer dependency version

* dotenv

* commands

* dotenv cli
2024-08-26 21:55:57 +02:00
Carlos R. L. Rodrigues
058378970a chore: dependecies reorg (#8535) 2024-08-23 07:16:04 -03:00
Stevche Radevski
9ba52021d0 fix: Log on error by default in async workflow executions (#8723) 2024-08-22 13:33:11 +02:00
Carlos R. L. Rodrigues
eb0bfe9f33 feat(workflows-sdk): log on error (#8666) 2024-08-20 06:23:24 -03:00
Stevche Radevski
4155d0354f fix: Use a global reference to distributed transaction and scheduler (#8462)
* fix: Add storage cleanup on scheduled jobs

* fix: Use a global reference to distributed transaction and scheduler classes
2024-08-06 14:14:51 +02:00
Stevche Radevski
c58a35f0c0 feat: Add support for private files to file module (#8169) 2024-07-18 09:46:10 +02:00
Stevche Radevski
26d600b6db feat: Ensure async workflow executions have access to shared container (#8157)
* feat: Ensure async workflow executions have access to shared container

* fix: Register workflow worker on application start
2024-07-17 12:17:48 +02:00
Adrien de Peretti
4af7309170 fix: install modules-sdk for test-utils to work (#8142) 2024-07-16 12:00:24 +02:00
Adrien de Peretti
b368251ca3 chore: Migrate modules to use the Module util (#7964)
**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
2024-07-05 13:00:40 +00:00
Adrien de Peretti
f4dd390ab1 chore: Apply defineMikroOrmCliConfig (#7975)
**What**
Ensure all module rely on the same config for the dev db

FIXES CORE-2493
2024-07-05 11:10:03 +00:00
Carlos R. L. Rodrigues
9badad24aa feat(workflows-sdk): conditional step (#7912)
* chore: move ModuleRegistrationName to utils

* chore(workflows-sdk): conditional step

* type

* when condition
2024-07-05 10:54:18 +02:00
Adrien de Peretti
617a5972bf feat: refactor module joiner config and links generation (#7859)
* feat: refactor module joiner config and links generation

* improve typings

* WIP

* WIP

* WIP

* rename type file

* create link config

* finish typings and add utils

* improve links

* WIP typings

* finalize ExportModule utils

* finalize ExportModule utils

* fix: dml tests

* improve and fixes

* simplify typings with id changes

* add toJSON

* multiple fixes and entity builder fixes

* fix currency searchable

* fix tests

* medusa service refactoring

* cleanup

* cleanup and fixes

* make module name optional

* renaming

---------

Co-authored-by: Harminder Virk <virk.officials@gmail.com>
2024-07-03 13:12:49 +02:00
Carlos R. L. Rodrigues
5600e58b7f chore(orchestration): idempotent (#7771) 2024-06-25 10:34:00 -03:00
Adrien de Peretti
937a632eb6 chore: make module loaders DML aware and auto generate joiner config (#7781)
* chore: make module loaders DML aware and auto generate joiner config

* fixes and cleanup

* improve dml entity check

* add unit tests on load resources

* cleanup deps

* cleanup deps

* cleanup Modules

* finalise

* fix modules-sdk jest

* fix modules-sdk jest

* fix import

* fix import
2024-06-20 18:18:07 +02:00
Riqwan Thamir
03924a4ff6 chore: move to swc/jest (#7739)
* chore: move to swc

* chore: fix tax rate tests

* chore: undo failed test

* chore: fix unit tests script

* chore: use node 20

* Update scripts/run-workspace-unit-tests-in-chunks.sh
2024-06-20 12:59:33 +02:00
Adrien de Peretti
48963f55ef Chore/rm main entity concept (#7709)
**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>
2024-06-19 13:02:16 +00:00
Adrien de Peretti
e0b14519f1 fix: Medusa service base method transaction (#7758)
**What**
Remove transaction decorator from the base medusa service method, the transaction will always be coming from the shared context. It fixes the issue that when you consume a base method directly it will return a proper tuple from the DB instead of the one from the entity map cc @VariableVic 

**NOTE**
This pr also fix some categories issues in the product module which was preventing the tests from working. if @sradevski you could have a look later, in the mean time we can still merge it

FIXES CORE-2342
2024-06-18 10:58:54 +00:00
Riqwan Thamir
3d33f06e77 chore: upgrade jest everywhere (#7703) 2024-06-14 07:35:30 +02:00
Adrien de Peretti
d2a5201eeb chore: Refactor and improve abstract module service factory (#7688)
* chore: Refactor and improve abstract module service factory

* align naming

* clean up some template args and tests

* partially migrate modules

* partially migrate modules

* migrate more modules

* migrate last modules

* fix typings

* rename interface

* rename interface

* fixes

* fixes

* rm local plain tests
2024-06-13 13:12:37 +02:00
Adrien de Peretti
afae395fea chore: ensure the event group id is kept for async workflow (#7668)
* chore: ensure the event group id is kept for async workflow

* revert test

* fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2024-06-11 13:20:17 +02:00
Stevche Radevski
3d72002c28 fix: Remove scheduled workflows if they no longer exist when executed (#7673) 2024-06-11 12:57:25 +02:00
Stevche Radevski
69410162f6 feat: Add support for scheduled workflows (#7651)
We still need to:
But wanted to open the PR for early feedback on the approach
2024-06-10 14:49:52 +00:00
Oli Juhl
3f661c917b feat: Fix subscribers loading + add order <> cart link (#7617) 2024-06-09 12:31:28 +02:00
Harminder Virk
11528526fa feat: loosely typed container 2024-05-31 15:22:03 +05:30
Carlos R. L. Rodrigues
f1ced57d5f chore: payment auto capture + remove enum from utils (#7513)
What:

- handles payments session that are auto captured
- removes all the enums from `@medusajs/types`
- move all `@medusajs/types` to devDependencies
2024-05-29 11:12:59 +00:00
Carlos R. L. Rodrigues
9dae86daa2 chore: es target 2021 (#7325) 2024-05-14 08:07:14 -03:00
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
Adrien de Peretti
4eae25e1ef chore(): Reorganize modules (#7210)
**What**
Move all modules to the modules directory
2024-05-02 15:33:34 +00:00