UNPKG

@elsikora/nestjs-crud-automator

Version:

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

23 lines (19 loc) 1.02 kB
'use strict'; var metadataDecision_constant = require('../../../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[metadataDecision_constant.AUTHORIZATION_DECISION_METADATA_CONSTANT.REQUEST_KEY] ?? requestRecord.authorizationDecision; return decision; } exports.AuthorizationDecisionResolveFromRequest = AuthorizationDecisionResolveFromRequest; //# sourceMappingURL=resolve-from-request.utility.js.map