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
2024-02-01 10:37:26 -03:00
committed by GitHub
parent a2bf6756ac
commit 45134e4d11
40 changed files with 576 additions and 170 deletions

View File

@@ -1,15 +1,15 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IProductModuleService, WorkflowTypes } from "@medusajs/types"
import {
createProducts,
CreateProductsActions,
Handlers,
createProducts,
} from "@medusajs/core-flows"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { IProductModuleService, WorkflowTypes } from "@medusajs/types"
import { pipe } from "@medusajs/workflows-sdk"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import { pipe } from "@medusajs/workflows-sdk"
jest.setTimeout(30000)
@@ -25,8 +25,6 @@ describe("CreateProduct workflow", function () {
})
afterAll(async () => {
console.log("GLOABL GC()", typeof global)
const db = useDb()
await db.shutdown()
await shutdownServer()