API Reference
    Preparing search index...

    Optional object to pass to the AppSyncEventsResolver.resolve() method.

    type ResolveOptions = {
        scope?: unknown;
    }
    Index

    Properties

    Properties

    scope?: unknown

    Reference to this instance of the class that is calling the resolve method.

    This parameter should be used only when using AppSyncEventsResolver.onPublish() and AppSyncEventsResolver.onSubscribe() as class method decorators, and it's used to bind the decorated methods to your class instance.

    import { AppSyncEventsResolver } from '@aws-lambda-powertools/event-handler/appsync-events';

    const app = new AppSyncEventsResolver();

    class Lambda {
    public scope = 'scoped';

    ⁣@app.onPublish('/foo')
    public async handleFoo(payload: string) {
    return `${this.scope} ${payload}`;
    }

    public async handler(event: unknown, context: Context) {
    return app.resolve(event, context, { scope: this });
    }
    }
    const lambda = new Lambda();
    const handler = lambda.handler.bind(lambda);