Closed sashee closed 1 year ago
Similar problem here, not able to use $extensions.setSubscriptionFilter
in a direct lambda resolver. I can implement the filtering using a VTL mapping-template. But would be nice if we can use the extensions in all resolvers.
this should be fixed. i recommend using util.transform
as well. example in TypeScript:
import { util } from '@aws-appsync/utils'
type Notice = { team: string; severity: number }
export function request() {}
export function response(ctx) {
const filter = util.transform.toSubscriptionFilter<Notice>({
team: { eq: 'mine' },
severity: { gt: 34 },
})
extensions.setSubscriptionFilter(filter)
}
In VTL, there is an extensions.invalidateSubscriptions function for invalidating subscriptions:
But this is not available for JS resolvers:
Without this, we need to use VTL resolvers to close subscriptions.