Setu-TS
    Preparing search index...

    Interface SubscriptionResolver<TSource, TContext, TArgs>

    A subscription field's resolver pair.

    subscribe returns the async iterable the field streams from and is attached to the schema field's subscribe slot; the optional resolve maps each emitted payload to the field value, exactly as graphql defines it.

    Without this arm a subscription is unexpressible in the schema-first map: an entry has to be a function, and assigning { subscribe } to a field's resolve leaves subscribe unset, which makes graphql.subscribe() throw "Subscription field must return Async Iterable".

    0.3.0

    interface SubscriptionResolver<
        TSource = unknown,
        TContext = unknown,
        TArgs = Record<string, unknown>,
    > {
        resolve?: FieldResolver<TSource, TContext, TArgs>;
        subscribe: (
            source: TSource,
            args: TArgs,
            context: TContext,
            info: unknown,
        ) =>
            | AsyncIterable<unknown, any, any>
            | Promise<AsyncIterable<unknown, any, any>>;
    }

    Type Parameters

    • TSource = unknown
    • TContext = unknown
    • TArgs = Record<string, unknown>
    Index

    Maps each emitted payload to the field value. Optional.

    subscribe: (
        source: TSource,
        args: TArgs,
        context: TContext,
        info: unknown,
    ) =>
        | AsyncIterable<unknown, any, any>
        | Promise<AsyncIterable<unknown, any, any>>

    Produces the event source for this subscription field.