UNPKG

nestjs-otel

Version:
13 lines (12 loc) 675 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.copyMetadataFromFunctionToFunction = void 0; const copyMetadataFromFunctionToFunction = (originalFunction, newFunction) => { // Get the current metadata and set onto the wrapper // to ensure other decorators ( ie: NestJS EventPattern / RolesGuard ) // won't be affected by the use of this instrumentation Reflect.getMetadataKeys(originalFunction).forEach(metadataKey => { Reflect.defineMetadata(metadataKey, Reflect.getMetadata(metadataKey, originalFunction), newFunction); }); }; exports.copyMetadataFromFunctionToFunction = copyMetadataFromFunctionToFunction;