fix(core-flows): complete cart improvements (#12646)
* fix(core-flows): use cartId as transactionId and acquire lock to complete cart * fix cart update compensation
This commit is contained in:
@@ -116,7 +116,7 @@ export function createHook<Name extends string, TInvokeInput, TInvokeOutput>(
|
||||
stepName: name,
|
||||
input: hookInput,
|
||||
invokeFn,
|
||||
compensateFn,
|
||||
compensateFn: compensateFn ?? (() => void 0),
|
||||
})
|
||||
|
||||
if (this.hooks_.registered.includes(name)) {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { deepCopy, OrchestrationUtils, promiseAll } from "@medusajs/utils"
|
||||
import {
|
||||
deepCopy,
|
||||
isDefined,
|
||||
OrchestrationUtils,
|
||||
promiseAll,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
async function resolveProperty(property, transactionContext) {
|
||||
const { invoke: invokeRes } = transactionContext
|
||||
@@ -78,5 +83,8 @@ export async function resolveValue(input, transactionContext) {
|
||||
? await resolveProperty(copiedInput, transactionContext)
|
||||
: await unwrapInput(copiedInput, {})
|
||||
|
||||
return result && JSON.parse(JSON.stringify(result))
|
||||
const strResult = JSON.stringify(result) // Symbols return undefined
|
||||
if (isDefined(strResult)) {
|
||||
return JSON.parse(strResult)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user