import type { ExecutionContextFactory, NodeExecutionStatePublisher, NodeId, ParentExecutionRef, RunDataFactory, RunId, RunTestContext, WorkflowId, } from "../types"; import { CredentialResolverFactory } from "./CredentialResolverFactory"; export class WorkflowRunExecutionContextFactory { constructor( private readonly executionContextFactory: ExecutionContextFactory, private readonly credentialResolverFactory: CredentialResolverFactory, ) {} create(args: { runId: RunId; workflowId: WorkflowId; nodeId: NodeId; parent?: ParentExecutionRef; policySnapshot?: import("../types").PersistedRunPolicySnapshot; subworkflowDepth: number; engineMaxNodeActivations: number; engineMaxSubworkflowDepth: number; data: ReturnType; nodeState?: NodeExecutionStatePublisher; testContext?: RunTestContext; }) { return this.executionContextFactory.create({ runId: args.runId, workflowId: args.workflowId, parent: args.parent, policySnapshot: args.policySnapshot, subworkflowDepth: args.subworkflowDepth, engineMaxNodeActivations: args.engineMaxNodeActivations, engineMaxSubworkflowDepth: args.engineMaxSubworkflowDepth, data: args.data, nodeState: args.nodeState, getCredential: this.credentialResolverFactory.create(args.workflowId, args.nodeId), testContext: args.testContext, }); } }