UNPKG

@duongtrungnguyen/nestro

Version:
76 lines 2.94 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; var server_module_exports = {}; __export(server_module_exports, { ServerModule: () => ServerModule }); module.exports = __toCommonJS(server_module_exports); var import_common = require("@nestjs/common"); var import_controllers = require("./controllers"); var import_security = require("../security"); var import_services = require("./services"); var import_storage = require("../storage"); let ServerModule = class { static register(config) { this._config = config ?? {}; const controllers = [import_controllers.RegistryController]; const providers = [import_services.RegistryService]; const imports = [import_storage.StorageModule.register(this._config.storage ?? {})]; if (this._config.enableRegistryDashboard) { controllers.push(import_controllers.DashboardController); } if (this._config.enableSecurity) { imports.push( import_security.SecurityModule.register({ ...this._config.security ?? {}, initKeys: true }) ); } return { module: ServerModule, imports, providers, controllers, exports: [import_services.RegistryService], global: true }; } configure(consumer) { if (ServerModule._config.enableSecurity) { consumer.apply(import_security.SecurityMiddleware).exclude({ path: "/nestro/services", method: import_common.RequestMethod.GET }, { path: "/nestro/dashboard(.*)", method: import_common.RequestMethod.ALL }).forRoutes("/nestro/*"); } } }; ServerModule._config = {}; ServerModule = __decorateClass([ (0, import_common.Module)({}) ], ServerModule); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ServerModule }); //# sourceMappingURL=server.module.js.map