OptionalscopeReference to this instance of the class that is calling the resolve method.
This parameter should be used only when using AppSyncEventsResolver.onPublish(),
AppSyncEventsResolver.onSubscribe(), and AppSyncGraphQLResolver.resolve() 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);
Optional object to pass to the
AppSyncEventsResolver.resolve()orAppSyncGraphQLResolver.resolve()methods.