@bluelibs/runner - v6.3.1
    Preparing search index...

    Interface IAsyncContext<T>

    Runtime async-context accessor returned by defineAsyncContext(...).

    Async contexts carry per-execution values across async boundaries and can be required by middleware when a task must run inside an active context.

    interface IAsyncContext<T> {
        "[symbolAsyncContext]": true;
        "[symbolFilePath]": string;
        configSchema?: IValidationSchema<T>;
        id: string;
        has(): boolean;
        optional(): IOptionalDependency<IAsyncContext<T>>;
        parse(data: string): T;
        provide<R>(value: T, fn: () => R | Promise<R>): R | Promise<R>;
        require(): ITaskMiddlewareConfigured<{ context: IAsyncContext<T> }>;
        serialize(data: T): string;
        tryUse(): T | undefined;
        use(): T;
    }

    Type Parameters

    • T
    Index

    Properties

    "[symbolAsyncContext]": true

    Brand marker used by Runner for registration and runtime checks.

    "[symbolFilePath]": string

    File path where this async context was defined.

    configSchema?: IValidationSchema<T>

    Optional normalized validation schema associated with the context value.

    id: string

    Stable public context id.

    Methods

    • Runs fn with a value bound to this context for the duration of the async call chain.

      Type Parameters

      • R

      Parameters

      • value: T
      • fn: () => R | Promise<R>

      Returns R | Promise<R>

    • Serializes the current value for transport or persistence scenarios.

      Parameters

      • data: T

      Returns string