zerot
    Preparing search index...

    Interface ContractOptions<TInput, TOutput, TContext>

    Options for the @contract decorator.

    interface ContractOptions<TInput = any, TOutput = any, TContext = AuthContext> {
        ensures?: ContractEnsuresCondition<TOutput, TInput, TContext>[];
        invariants?: ContractInvariant<TInput, TOutput>[];
        layer?:
            | "presentation"
            | "action"
            | "business"
            | "data"
            | "unknown"
            | "test";
        requires?: (
            ContractCondition<TInput, TContext>
            | ContractValidator<TInput, any>
        )[];
        retryAttempts?: number;
        retryDelayMs?: number;
        retryOnCategories?: ErrorCategory[];
    }

    Type Parameters

    • TInput = any

      The expected type of the input to the method.

    • TOutput = any

      The expected type of the output of the method.

    • TContext = AuthContext

      The expected type of the authentication context.

    Index

    Properties

    An array of post-conditions that must pass after the method executes successfully.

    An array of invariant conditions that must hold true before and after method execution.

    layer?: "presentation" | "action" | "business" | "data" | "unknown" | "test"

    The layer of the application where the contract is applied (e.g., "presentation", "action", "business", "data", "unknown", "test").

    requires?: (
        ContractCondition<TInput, TContext>
        | ContractValidator<TInput, any>
    )[]

    An array of pre-conditions that must pass before the method executes.

    retryAttempts?: number

    The maximum number of retry attempts for recoverable errors. Defaults to 0 (no retries).

    retryDelayMs?: number

    The delay in milliseconds between retry attempts. Defaults to 100ms.

    retryOnCategories?: ErrorCategory[]

    An array of ErrorCategory values that should trigger a retry. If not provided, it will retry on errors where isRecoverable is true.