UNPKG

@elsikora/nestjs-crud-automator

Version:

A library for automating the creation of CRUD operations in NestJS.

21 lines (18 loc) 961 B
import { AUTHORIZATION_DECISION_METADATA_CONSTANT } from '../../../constant/class/authorization/metadata-decision.constant.js'; /** * Extracts an authorization decision from the authentication request metadata stored on the HTTP request. * @template E - Entity type * @template R - Result payload type * @param {IApiAuthenticationRequest} [authenticationRequest] - Request object bound to the route handler. * @returns {IApiAuthorizationDecision<E, R> | undefined} Authorization decision if present. */ function AuthorizationDecisionResolveFromRequest(authenticationRequest) { if (!authenticationRequest) { return undefined; } const requestRecord = authenticationRequest; const decision = requestRecord[AUTHORIZATION_DECISION_METADATA_CONSTANT.REQUEST_KEY] ?? requestRecord.authorizationDecision; return decision; } export { AuthorizationDecisionResolveFromRequest }; //# sourceMappingURL=resolve-from-request.utility.js.map