import { TaskWorkflowDeclaration, WorkflowDeclaration } from "@hatchet-dev/typescript-sdk"; import { ModuleRef } from "@nestjs/core"; import { InterceptorRegistration } from "../internal/registrations.js"; import { AnyHost } from "../references/shared.js"; export declare class DeclarationBuilderService { private readonly moduleRef; private readonly interceptorRegistration?; private readonly interceptors; constructor(moduleRef: ModuleRef, interceptorRegistration?: InterceptorRegistration | undefined); /** * Creates a WorkflowDeclaration or TaskWorkflowDeclaration from the given host. * * @param host The host to create a declaration for. * @returns A WorkflowDeclaration or TaskWorkflowDeclaration. */ createDeclaration(host: AnyHost): WorkflowDeclaration | TaskWorkflowDeclaration; private createTaskWorkflow; private createWorkflow; /** * Validates the given WorkflowHost with basic sanity checks. * This does not return, rather it throws an error if the host is invalid. * * @param input The host to validate. * @private */ private validateWorkflowHost; /** * Validates the given TaskHost with basic sanity checks. * This does not return, rather it throws an error if the host is invalid. * * @param input The host to validate. * @private */ private validateTaskHost; /** * Builds a directed graph of the workflow host. * The nodes are the methods of the host, and the edges are the dependencies between the methods. * * Note: This validates for cyclic dependencies and throws an * * @param host The host to build the graph for. * @returns The directed graph. * @private */ private buildWorkflowHostGraph; /** * Pre-processes the context by inferring the trigger source and * validating the input (if applicable). * * @returns The pre-processed context properties including hostConfig. */ private preProcessContext; /** * Executes a function, optionally intercepted by the interceptors. * Interceptors are chained in array order (first = outermost). * * @param ctx The context. * @param fn The function to execute. * @returns The result of the function. */ private executeWithInterceptors; /** * Infers the trigger source from the given context. * * @param ctx The context. * @returns The inferred trigger source. * @private */ private inferTriggerSource; }