@loopback/context-explorer
Version:
Visualize context hierarchy, bindings, configurations, and dependencies
34 lines • 1.78 kB
JavaScript
;
// Copyright IBM Corp. and LoopBack contributors 2020. All Rights Reserved.
// Node module: @loopback/context-explorer
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextExplorerComponent = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const rest_1 = require("@loopback/rest");
const path_1 = tslib_1.__importDefault(require("path"));
const context_explorer_controller_1 = require("./context-explorer.controller");
const keys_1 = require("./keys");
/**
* A component providing a self-hosted API Explorer.
*/
let ContextExplorerComponent = class ContextExplorerComponent {
constructor(application, explorerConfig = {}) {
var _a;
const explorerPath = (_a = explorerConfig.path) !== null && _a !== void 0 ? _a : '/context-explorer';
if (explorerConfig.enableD3Animation !== false) {
application.static(explorerPath, path_1.default.join(__dirname, '../public'));
}
application.controller((0, context_explorer_controller_1.contextExplorerControllerFactory)(explorerPath));
}
};
exports.ContextExplorerComponent = ContextExplorerComponent;
exports.ContextExplorerComponent = ContextExplorerComponent = tslib_1.__decorate([
(0, core_1.injectable)({ tags: { [core_1.ContextTags.KEY]: keys_1.ContextExplorerBindings.COMPONENT.key } }),
tslib_1.__param(0, (0, core_1.inject)(core_1.CoreBindings.APPLICATION_INSTANCE)),
tslib_1.__param(1, (0, core_1.config)()),
tslib_1.__metadata("design:paramtypes", [rest_1.RestApplication, Object])
], ContextExplorerComponent);
//# sourceMappingURL=context-explorer.component.js.map