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

    Interface IResource<TConfig, TValue, TDependencies, TContext, TMeta, TTags, TMiddleware>

    Normalized runtime resource definition.

    interface IResource<
        TConfig = void,
        TValue extends Promise<any> = Promise<any>,
        TDependencies extends DependencyMapType = any,
        TContext = any,
        TMeta extends IResourceMeta = any,
        TTags extends ResourceTagType[] = ResourceTagType[],
        TMiddleware extends
            ResourceMiddlewareAttachmentType[] = ResourceMiddlewareAttachmentType[],
    > {
        "[symbolDefinitionIdentity]"?: object;
        "[symbolFilePath]": string;
        "[symbolForkedFrom]"?: ResourceForkInfo;
        "[symbolResource]": true;
        "[symbolResourceIsolateDeclarations]"?: readonly IsolationPolicyDeclaration<
            TConfig,
        >[];
        "[symbolResourceRegistersChildren]"?: true;
        "[symbolResourceSubtreeDeclarations]"?: readonly ResourceSubtreePolicyDeclaration<
            TConfig,
        >[];
        configSchema?: IValidationSchema<TConfig>;
        context?: () => TContext;
        cooldown?: (
            this: unknown,
            value: TValue extends Promise<U> ? U : TValue,
            config: TConfig,
            dependencies: ResourceDependencyValuesType<TDependencies>,
            context: TContext,
        ) => Promise<void | ResourceCooldownAdmissionTargets>;
        dependencies?:
            | TDependencies
            | ((config: TConfig, mode: RunnerMode) => TDependencies);
        dispose?: (
            this: unknown,
            value: TValue extends Promise<U> ? U : TValue,
            config: TConfig,
            dependencies: ResourceDependencyValuesType<TDependencies>,
            context: TContext,
        ) => Promise<void>;
        health?: (
            this: unknown,
            value: (TValue extends Promise<U> ? U : TValue) | undefined,
            config: TConfig,
            dependencies: ResourceDependencyValuesType<TDependencies>,
            context: TContext,
        ) => Promise<IResourceHealthResult>;
        id: string;
        init?: (
            config: HasInputContracts<[...TTags[], ...TMiddleware[]]> extends true
                ? IsUnspecified<TConfig> extends true
                    ? InferInputOrViolationFromContracts<[...TTags[], ...TMiddleware[]]>
                    : EnsureInputSatisfiesContracts<[...TTags[], ...TMiddleware[]], TConfig>
                : TConfig,
            dependencies: ResourceDependencyValuesType<TDependencies>,
            context: TContext,
        ) => HasOutputContracts<[...TTags[], ...TMiddleware[]]> extends true
            ? EnsureOutputSatisfiesContracts<
                [...TTags[], ...TMiddleware[]],
                TValue,
            >
            : TValue;
        isolate?: IsolationPolicyInput<TConfig>;
        meta?: TMeta;
        middleware: TMiddleware;
        optional: () => IOptionalDependency<
            IResource<
                TConfig,
                TValue,
                TDependencies,
                TContext,
                TMeta,
                TTags,
                TMiddleware,
            >,
        >;
        overrides: | OverridableElements[]
        | ((config: TConfig, mode: RunnerMode) => OverridableElements[]);
        path?: string;
        ready?: (
            this: unknown,
            value: TValue extends Promise<U> ? U : TValue,
            config: TConfig,
            dependencies: ResourceDependencyValuesType<TDependencies>,
            context: TContext,
        ) => Promise<void>;
        register:
            | RegisterableItem[]
            | ((config: TConfig, mode: RunnerMode) => RegisterableItem[]);
        resultSchema?: IValidationSchema<TValue extends Promise<U> ? U : TValue>;
        subtree?:
            | ResourceSubtreePolicyInput<TConfig>
            | DisplayResourceSubtreePolicy<TConfig>;
        tags: TTags;
        throws?: NormalizedThrowsList;
        extract(
            target:
                | IResource<any, any, any, any, any, any, any>
                | IResourceWithConfig<any, any, any, any, any, any, any>,
        ): TConfig | undefined;
        fork(
            newId: string,
        ): IResource<
            TConfig,
            TValue,
            TDependencies,
            TContext,
            TMeta,
            TTags,
            TMiddleware,
        >;
        with(
            config: HasInputContracts<[...TTags[], ...TMiddleware[]]> extends true
                ? IsUnspecified<TConfig> extends true
                    ? InferInputOrViolationFromContracts<[...TTags[], ...TMiddleware[]]>
                    : TConfig
                : TConfig,
        ): IResourceWithConfig<
            TConfig,
            TValue,
            TDependencies,
            TContext,
            TMeta,
            TTags,
            TMiddleware,
        >;
    }

    Type Parameters

    Hierarchy

    Index

    Properties

    "[symbolDefinitionIdentity]"?: object

    Stable lineage identity shared across configured wrappers and projections.

    "[symbolFilePath]": string
    "[symbolForkedFrom]"?: ResourceForkInfo

    Present only on forked resources.

    "[symbolResource]": true
    "[symbolResourceIsolateDeclarations]"?: readonly IsolationPolicyDeclaration<
        TConfig,
    >[]

    Ordered isolate declarations preserved across builder composition.

    "[symbolResourceRegistersChildren]"?: true

    Tracks whether the resource explicitly declared .register(...).

    "[symbolResourceSubtreeDeclarations]"?: readonly ResourceSubtreePolicyDeclaration<
        TConfig,
    >[]

    Ordered subtree declarations preserved across builder composition.

    configSchema?: IValidationSchema<TConfig>

    Normalized validation schema for resource config.

    context?: () => TContext

    Create a private, mutable context shared between init, ready, cooldown, and dispose.

    cooldown?: (
        this: unknown,
        value: TValue extends Promise<U> ? U : TValue,
        config: TConfig,
        dependencies: ResourceDependencyValuesType<TDependencies>,
        context: TContext,
    ) => Promise<void | ResourceCooldownAdmissionTargets>

    Cooldown hook for the resource. This runs during shutdown to stop intake quickly before runtime drains in-flight business work.

    Keep this fast and non-blocking in intent: trigger ingress stop, capture handles/promises in context, and return promptly. The cooling resource is always allowed as a resource-origin source during the later drain window. Returning additional resource definitions extends that shutdown allowlist.

    dependencies?:
        | TDependencies
        | ((config: TConfig, mode: RunnerMode) => TDependencies)

    Static or lazy dependency map. Receives config when provided.

    dispose?: (
        this: unknown,
        value: TValue extends Promise<U> ? U : TValue,
        config: TConfig,
        dependencies: ResourceDependencyValuesType<TDependencies>,
        context: TContext,
    ) => Promise<void>

    Clean-up function for the resource. This is called when the resource is no longer needed.

    Type Declaration

    health?: (
        this: unknown,
        value: (TValue extends Promise<U> ? U : TValue) | undefined,
        config: TConfig,
        dependencies: ResourceDependencyValuesType<TDependencies>,
        context: TContext,
    ) => Promise<IResourceHealthResult>

    Optional async health probe for this resource.

    Resources without health are excluded from runtime health reports.

    id: string

    Stable identifier.

    init?: (
        config: HasInputContracts<[...TTags[], ...TMiddleware[]]> extends true
            ? IsUnspecified<TConfig> extends true
                ? InferInputOrViolationFromContracts<[...TTags[], ...TMiddleware[]]>
                : EnsureInputSatisfiesContracts<[...TTags[], ...TMiddleware[]], TConfig>
            : TConfig,
        dependencies: ResourceDependencyValuesType<TDependencies>,
        context: TContext,
    ) => HasOutputContracts<[...TTags[], ...TMiddleware[]]> extends true
        ? EnsureOutputSatisfiesContracts<[...TTags[], ...TMiddleware[]], TValue>
        : TValue

    Initialize and return the resource value. Called once during boot.

    Wiring isolation policy for this resource and its subtree.

    meta?: TMeta

    Optional metadata used by docs and tooling.

    middleware: TMiddleware

    Normalized middleware attachments applied to the resource lifecycle.

    optional: () => IOptionalDependency<
        IResource<
            TConfig,
            TValue,
            TDependencies,
            TContext,
            TMeta,
            TTags,
            TMiddleware,
        >,
    >

    Return an optional dependency wrapper for this resource.

    overrides:
        | OverridableElements[]
        | ((config: TConfig, mode: RunnerMode) => OverridableElements[])

    Safe override declarations applied to this resource.

    path?: string
    ready?: (
        this: unknown,
        value: TValue extends Promise<U> ? U : TValue,
        config: TConfig,
        dependencies: ResourceDependencyValuesType<TDependencies>,
        context: TContext,
    ) => Promise<void>

    Ready hook for the resource. This runs after initialization completes and right before Runner emits the global system ready event.

    Use this for startup ingress actions that should begin only after runtime internals are locked and all startup-initialized dependencies are ready.

    register:
        | RegisterableItem[]
        | ((config: TConfig, mode: RunnerMode) => RegisterableItem[])

    Register other registerables (resources/tasks/middleware/events). Accepts a static array or a function of config to support dynamic wiring.

    resultSchema?: IValidationSchema<TValue extends Promise<U> ? U : TValue>

    Normalized validation schema for the resolved resource value.

    Normalized subtree policy declarations owned by this resource.

    tags: TTags

    Normalized tags attached to the resource.

    Normalized list of error ids declared via throws.

    Methods