nats-micro
Version:
NATS micro compatible extra-lightweight microservice library
14 lines • 1.08 kB
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */
import { storage } from './storage.js';
import { kebabCase } from '../utils/index.js';
export function microservice(options) {
return (target,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
context) => {
var _a, _b, _c, _d;
const name = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : kebabCase(target.name.replace(/microservice/i, ''));
const ms = storage.ensureClassAdded(target.prototype);
ms.config = Object.assign(Object.assign(Object.assign({}, ms.config), options), { name, description: (_b = options === null || options === void 0 ? void 0 : options.description) !== null && _b !== void 0 ? _b : '', version: (_c = options === null || options === void 0 ? void 0 : options.version) !== null && _c !== void 0 ? _c : '0.0.0', metadata: (_d = options === null || options === void 0 ? void 0 : options.metadata) !== null && _d !== void 0 ? _d : {} });
};
}
//# sourceMappingURL=microservice.js.map