Repository navigation
index.Function.reportDenials
function reportDenials<TResult>(context, result): TResult;Defined in: packages/graphql-casl/src/denials.ts:180
Merges the denials onDeny: 'filter' recorded for a request into its
execution result — the ones the response could not carry through the denied
field itself (see ApplyPermissionsOptions.onDeny).
TResult extends ExecutionResult<ObjMap<unknown>, ObjMap<unknown>>
unknown
The request's context value: the one the resolvers saw.
TResult
The execution result to report into.
TResult
The result with the denials merged in, or result itself if there were none.
The /envelop entry point calls this for you. Under applyPermissions no
hook sees the finished response, so call it from your server's own — Apollo
Server's willSendResponse, or straight after execute:
const result = reportDenials(contextValue, await execute({ schema, document, contextValue }));Under report: 'errors' the denials are appended to result.errors; under
report: 'extensions' they are formatted into
result.extensions.authorizationErrors. The record is drained, so a context
is reported once, and a context with nothing recorded returns the result
untouched. Nothing is recorded under 'reject' or 'mask'.