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

@@ -11,12 +11,12 @@ import {
import {
InjectManager,
InjectTransactionManager,
isDefined,
mapObjectTo,
MapToConfig,
MedusaContext,
MedusaError,
ModulesSdkUtils,
isDefined,
mapObjectTo,
} from "@medusajs/utils"
import { LinkService } from "@services"
import { shouldForceTransaction } from "../utils"
@@ -229,7 +229,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
async softDelete(
data: any,
{ returnLinkableKeys }: SoftDeleteReturn = {},
sharedContext: Context = {}
@MedusaContext() sharedContext: Context = {}
): Promise<Record<string, unknown[]> | void> {
this.validateFields(data)
@@ -270,7 +270,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
async restore(
data: any,
{ returnLinkableKeys }: RestoreReturn = {},
sharedContext: Context = {}
@MedusaContext() sharedContext: Context = {}
): Promise<Record<string, unknown[]> | void> {
this.validateFields(data)