import { resolveItemExprsForExecution } from "../contracts/itemExpr"; import type { Item, NodeExecutionContext, RunnableNodeConfig } from "../types"; export class ItemExprResolver { async resolveConfigForItem>( ctx: NodeExecutionContext, item: Item, itemIndex: number, items: ReadonlyArray, ): Promise> { if (!ctx) { throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required"); } const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items); const merged = resolvedConfig !== undefined && resolvedConfig !== null ? resolvedConfig : ctx.config; if (merged === undefined || merged === null) { return ctx; } return { ...ctx, config: merged as TConfig, }; } }