chore: local workflow proxying methods to pass context (#6263)

What:
- When calling a module's method inside a Local Workflow the MedusaContext is passed as the last argument to the method if not provided
- Add `requestId` to req
- A couple of fixes on Remote Joiner and the data fetcher for internal services

Why:
- The context used to initialize the workflow has to be shared with all modules. properties like transactionId will be used to emit events and requestId to trace logs for example.
This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-02-01 13:37:26 +00:00
1 parent a2bf6756ac
commit 45134e4d11
40 files changed
+576 -170

No files matched your search

+6
View File
@@ -22,6 +22,7 @@ export type SharedContext = {
* A context used to share resources, such as transaction manager, between the application and the module.
*/
export type Context<TManager = unknown> = {
__type?: "MedusaContext"
/**
* An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.
*/
@@ -42,4 +43,9 @@ export type Context<TManager = unknown> = {
* A string indicating the ID of the current transaction.
*/
transactionId?: string
/**
* A string indicating the ID of the current request.
*/
requestId?: string
}