import { ExecutorInput } from "../../../types/executor.generated.mjs"; import { Workflow } from "../workflow/workflow.mjs"; import { Operation, WorkflowOperation } from "./operation.mjs"; import { Trigger } from "./trigger/index.mjs"; //#region src/configure/services/executor/executor.d.ts type TriggerArgs> = T extends { __args: infer Args; } ? Args : never; type ExecutorBase> = Omit & { trigger: T; }; /** * Executor type with conditional inference for workflow operations. * When operation.kind is "workflow", infers W from the workflow property * to ensure args type matches the workflow's mainJob input type. */ type Executor, O> = O extends { kind: "workflow"; workflow: infer W extends Workflow; } ? ExecutorBase & { operation: WorkflowOperation, W>; } : ExecutorBase & { operation: O; }; /** * Create an executor configuration for the Tailor SDK. * * Executors are event-driven handlers that respond to record changes, * resolver executions, or other events. * * Operation kinds: "function", "graphql", "webhook", "workflow". * @template T * @template O * @param config - Executor configuration * @returns The same executor configuration * @example * import { createExecutor, recordCreatedTrigger } from "@tailor-platform/sdk"; * import { order } from "../tailordb/order"; * * export default createExecutor({ * name: "order-created", * description: "Handles new order creation", * trigger: recordCreatedTrigger({ type: order }), * operation: { * kind: "function", * body: async ({ newRecord }) => { * console.log("New order:", newRecord.id); * }, * }, * }); */ export declare function createExecutor, O extends Operation> | { kind: "workflow"; workflow: Workflow; }>(config: Executor): Executor; /** * Create an executor configuration for the Tailor SDK. * This overload preserves source compatibility for legacy explicit generic calls, * where the first generic argument represents trigger args. * @template Args * @template O * @param config - Executor configuration * @returns The same executor configuration */ export declare function createExecutor | { kind: "workflow"; workflow: Workflow; }>(config: Executor, O>): Executor, O>; //#endregion