Setu-TS
    Preparing search index...

    Type Alias PolicyTarget<T>

    PolicyTarget:
        | T
        | ((ctx: IRequestContext) => T | undefined | Promise<T | undefined>)

    The target a route-level policy check evaluates against: a fixed value, or an extractor called per request — reading a route parameter, or loading the record. A FUNCTION is always treated as an extractor; a policy whose target is itself a function wraps it. An extractor may answer undefined — a record that was not found — which the check receives as it receives an omitted target, since every check's target is already T | undefined.

    Shared by AuthPlugin's requirePolicy and DecoratorPlugin's @RequirePolicy, so the two entry points accept the same targets.

    Type Parameters

    • T

      The policy's target type

    0.9.0