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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user