contentful-node-apps-toolkit
    Preparing search index...

    Type Alias FunctionEventHandler<K, P>

    FunctionEventHandler: (
        event: FunctionEventHandlers[K]["event"],
        context: FunctionEventContext<P>,
    ) =>
        | Promise<FunctionEventHandlers[K]["response"]>
        | FunctionEventHandlers[K]["response"]

    Event handler type that needs to be exported as handler from your function. e.g. const handler: FunctionEventHandler = (event, context) => { ... }

    This type can also be used to construct helper functions for specific events e.g. const queryHandler: FunctionEventHandler<'graphql.query'> = (event, context) => { ... }

    Type Parameters

    • K extends FunctionEventType = FunctionEventType
    • P extends Record<string, any> = Record<string, any>

    Type Declaration

      • (
            event: FunctionEventHandlers[K]["event"],
            context: FunctionEventContext<P>,
        ):
            | Promise<FunctionEventHandlers[K]["response"]>
            | FunctionEventHandlers[K]["response"]
      • Parameters

        Returns
            | Promise<FunctionEventHandlers[K]["response"]>
            | FunctionEventHandlers[K]["response"]