chore: idempotent cart operations (#13236)

* chore(core-flows): idempotent cart operations

* changeset

* add tests

* revert

* revert route

* promo test

* skip bugs

* fix test

* tests

* avoid workflow name conflict

* prevent nested workflow from being deleted until the top level parent finishes

* remove unused setTimeout

* update changeset

* rm comments

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
Carlos R. L. Rodrigues
2025-08-28 10:04:00 -03:00
committed by GitHub
parent b111d01898
commit 9412669e65
38 changed files with 890 additions and 64 deletions

View File

@@ -1,3 +1,4 @@
import { emitEventStep } from "@medusajs/core-flows"
import { Modules, TransactionState } from "@medusajs/framework/utils"
import {
createStep,
@@ -7,12 +8,11 @@ import {
WorkflowResponse,
} from "@medusajs/framework/workflows-sdk"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { IEventBusModuleService } from "@medusajs/types"
import {
adminHeaders,
createAdminUser,
} from "../../../helpers/create-admin-user"
import { emitEventStep } from "@medusajs/core-flows"
import { IEventBusModuleService } from "@medusajs/types"
jest.setTimeout(300000)
@@ -106,7 +106,7 @@ medusaIntegrationTestRunner({
createWorkflow(
{
name: "my-workflow-name",
name: "my-workflow-name-2",
retentionTime: 50,
},
function (input: WorkflowData<{ initial: string }>) {
@@ -137,7 +137,7 @@ medusaIntegrationTestRunner({
const engine = container.resolve(Modules.WORKFLOW_ENGINE)
const transactionId = "trx-id-failing-event"
const res = await engine.run("my-workflow-name", {
const res = await engine.run("my-workflow-name-2", {
transactionId,
input: {
initial: "abc",