fix(workflows-sdk): Value resolver should resolve non StepResponse (#6726)

This commit is contained in:
Adrien de Peretti
2024-03-18 21:07:04 +01:00
committed by GitHub
parent 0c705d7bd4
commit 4b06c17dc0
5 changed files with 38 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
import { OrchestrationUtils, deepCopy, promiseAll } from "@medusajs/utils"
import { deepCopy, OrchestrationUtils, promiseAll } from "@medusajs/utils"
async function resolveProperty(property, transactionContext) {
const { invoke: invokeRes } = transactionContext
@@ -12,7 +12,8 @@ async function resolveProperty(property, transactionContext) {
} else if (property?.__type === OrchestrationUtils.SymbolWorkflowHook) {
return await property.__value(transactionContext)
} else if (property?.__type === OrchestrationUtils.SymbolWorkflowStep) {
const output = invokeRes[property.__step__]?.output
const output =
invokeRes[property.__step__]?.output ?? invokeRes[property.__step__]
if (output?.__type === OrchestrationUtils.SymbolWorkflowStepResponse) {
return output.output
}