chore(workflow-engine-*): cleanup and improvements (#13789)
**What** Cleanup recent work on workflows
This commit is contained in:
committed by
GitHub
parent
356dcc94ce
commit
d51ae2768b
@@ -49,7 +49,7 @@
|
||||
"scripts": {
|
||||
"build": "rimraf dist && tsc --build",
|
||||
"watch": "tsc --build --watch",
|
||||
"test": "jest --bail --forceExit",
|
||||
"test": "jest --bail --forceExit -- src/**/__tests__/**/*.spec.ts",
|
||||
"test:run": "node ./dist/utils/_playground.js"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
deepCopy,
|
||||
isObject,
|
||||
OrchestrationUtils,
|
||||
parseStringifyIfNecessary,
|
||||
@@ -10,10 +9,10 @@ import * as util from "node:util"
|
||||
type InputPrimitive = string | Symbol
|
||||
type InputObject = object & { __type?: string | Symbol; output?: any }
|
||||
|
||||
function resolveProperty(property, transactionContext) {
|
||||
function resolveProperty(property: any, transactionContext: any) {
|
||||
const { invoke: invokeRes } = transactionContext
|
||||
|
||||
let res
|
||||
let res: any
|
||||
|
||||
if (property.__type === OrchestrationUtils.SymbolInputReference) {
|
||||
res = transactionContext.payload
|
||||
@@ -132,7 +131,7 @@ function unwrapInput({
|
||||
if (result != null && typeof result === "object") {
|
||||
const unwrapped = unwrapInput({
|
||||
inputTOUnwrap: result,
|
||||
parentRef: parentRef[key] || {},
|
||||
parentRef: {},
|
||||
transactionContext,
|
||||
})
|
||||
if (unwrapped instanceof Promise) {
|
||||
@@ -161,7 +160,7 @@ function unwrapInput({
|
||||
if (resolved != null && typeof resolved === "object") {
|
||||
const unwrapped = unwrapInput({
|
||||
inputTOUnwrap: resolved,
|
||||
parentRef: parentRef[key] || {},
|
||||
parentRef: {},
|
||||
transactionContext,
|
||||
})
|
||||
if (unwrapped instanceof Promise) {
|
||||
@@ -184,18 +183,17 @@ function unwrapInput({
|
||||
|
||||
export function resolveValue(
|
||||
input: InputPrimitive | InputObject | unknown | undefined,
|
||||
transactionContext
|
||||
transactionContext: any
|
||||
): Promise<any> | any {
|
||||
if (input == null || typeof input !== "object") {
|
||||
return input
|
||||
}
|
||||
|
||||
const input_ = deepCopy(
|
||||
const input_ =
|
||||
(input as InputObject)?.__type ===
|
||||
OrchestrationUtils.SymbolWorkflowWorkflowData
|
||||
OrchestrationUtils.SymbolWorkflowWorkflowData
|
||||
? (input as InputObject).output
|
||||
: input
|
||||
)
|
||||
|
||||
let result: any
|
||||
|
||||
|
||||
Reference in New Issue
Block a user