@nestjs-mod/common
Version:
A collection of utilities for unifying NestJS applications and modules
24 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigModel = ConfigModel;
exports.ConfigModelProperty = ConfigModelProperty;
const common_1 = require("@nestjs/common");
const constants_1 = require("./constants");
function ConfigModel(options) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (0, common_1.applyDecorators)((0, common_1.Injectable)(), (target) => {
Reflect.defineMetadata(constants_1.CONFIG_MODEL_METADATA, {
...options,
originalName: target.name,
}, target);
});
}
function ConfigModelProperty(options) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (target, propertyKey) => {
const configModelPropertyMetadata = Reflect.getOwnMetadata(constants_1.CONFIG_MODEL_PROPERTIES_METADATA, target.constructor) || [];
configModelPropertyMetadata.push({ ...options, originalName: propertyKey });
Reflect.defineMetadata(constants_1.CONFIG_MODEL_PROPERTIES_METADATA, configModelPropertyMetadata, target.constructor);
};
}
//# sourceMappingURL=decorators.js.map