Setu-TS
    Preparing search index...

    Interface BehaviorLike<TWork, TResult>

    The structural shape both behaviour contracts satisfy, and the element type of composeBehaviorChain's behaviors array.

    IPipelineBehavior and IIngressBehavior both satisfy this structurally — neither needed to change — which is what lets one composer serve both the CQRS pipeline and the four non-HTTP ingress chains.

    0.3.0

    interface BehaviorLike<TWork, TResult> {
        handle(
            work: TWork,
            next: () => Promise<TResult>,
        ): TResult | Promise<TResult>;
    }

    Type Parameters

    • TWork

      The work item the behaviour wraps

    • TResult

      The chain result type

    Index
    • Wraps the rest of the chain.

      Parameters

      • work: TWork

        The work item being handled

      • next: () => Promise<TResult>

        Invokes the next behaviour in declared order, ending at the terminal handler

      Returns TResult | Promise<TResult>

      The chain result. Returning WITHOUT calling next short-circuits the chain: downstream behaviours and the terminal are skipped and this value becomes the result.