nestjs-otel
Version:
NestJS OpenTelemetry Library
13 lines (12 loc) • 677 B
JavaScript
;
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
for (const metadataKey of Reflect.getMetadataKeys(originalFunction)) {
Reflect.defineMetadata(metadataKey, Reflect.getMetadata(metadataKey, originalFunction), newFunction);
}
};
exports.copyMetadataFromFunctionToFunction = copyMetadataFromFunctionToFunction;