@bluelibs/runner - v5.5.0
    Preparing search index...

    Interface ITaskDefinition<TInput, TOutput, TDependencies, TMeta, TTags, TMiddleware>

    interface ITaskDefinition<
        TInput = undefined,
        TOutput extends Promise<unknown> = Promise<unknown>,
        TDependencies extends DependencyMapType = {},
        TMeta extends ITaskMeta = any,
        TTags extends TagType[] = TagType[],
        TMiddleware extends
            TaskMiddlewareAttachmentType[] = TaskMiddlewareAttachmentType[],
    > {
        dependencies?: TDependencies
        | (() => TDependencies);
        id: string;
        inputSchema?: IValidationSchema<TInput>;
        meta?: TMeta;
        middleware?: TMiddleware;
        resultSchema?: IValidationSchema<TOutput extends Promise<U> ? U : never>;
        run: (
            input: HasInputContracts<[...TTags[], ...TMiddleware[]]> extends true
                ? [TInput] extends [undefined]
                    ? InferInputOrViolationFromContracts<[...TTags[], ...TMiddleware[]]>
                    : EnsureInputSatisfiesContracts<[...TTags[], ...TMiddleware[]], TInput>
                : TInput,
            dependencies: DependencyValuesType<TDependencies>,
            context?: { journal: ExecutionJournal },
        ) => HasOutputContracts<[...TTags[], ...TMiddleware[]]> extends true
            ? EnsureOutputSatisfiesContracts<
                [...TTags[], ...TMiddleware[]],
                TOutput,
            >
            : TOutput;
        tags?: TTags;
        throws?: ThrowsList;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    dependencies?: TDependencies | (() => TDependencies)

    Access other tasks/resources/events. Can be an object or a function when you need late or config‑dependent resolution.

    id: string
    inputSchema?: IValidationSchema<TInput>

    Optional validation schema for runtime input validation. When provided, task input will be validated before execution.

    meta?: TMeta

    Optional metadata used for docs, filtering and tooling.

    middleware?: TMiddleware

    Middleware applied around task execution.

    resultSchema?: IValidationSchema<TOutput extends Promise<U> ? U : never>

    Optional validation schema for the task result. When provided, the result will be validated immediately after the task's run resolves, without considering middleware.

    run: (
        input: HasInputContracts<[...TTags[], ...TMiddleware[]]> extends true
            ? [TInput] extends [undefined]
                ? InferInputOrViolationFromContracts<[...TTags[], ...TMiddleware[]]>
                : EnsureInputSatisfiesContracts<[...TTags[], ...TMiddleware[]], TInput>
            : TInput,
        dependencies: DependencyValuesType<TDependencies>,
        context?: { journal: ExecutionJournal },
    ) => HasOutputContracts<[...TTags[], ...TMiddleware[]]> extends true
        ? EnsureOutputSatisfiesContracts<
            [...TTags[], ...TMiddleware[]],
            TOutput,
        >
        : TOutput
    tags?: TTags

    Tags applied to the task that might define its behvaiour or impact the systems.

    throws?: ThrowsList

    Declares which typed errors are part of this task's contract.

    This is a declarative contract only:

    • It does not imply dependency injection
    • It does not enforce that only these errors can be thrown

    Use string ids or Error helpers.