@mashroom/mashroom
Advanced tools
Comparing version 2.4.5 to 2.5.0
@@ -10,8 +10,5 @@ "use strict"; | ||
var _fs = require("fs"); | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _config_utils = require("@mashroom/mashroom-utils/lib/config_utils"); | ||
var _model_utils = require("@mashroom/mashroom-utils/lib/model_utils"); | ||
var _ts_node_utils = require("@mashroom/mashroom-utils/lib/ts_node_utils"); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _ServerConfigurationError = _interopRequireDefault(require("../errors/ServerConfigurationError")); | ||
var _mashroom_default_config = _interopRequireDefault(require("./mashroom_default_config")); | ||
var _mashroomDefaultConfig = _interopRequireDefault(require("./mashroom-default-config")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,3 +28,3 @@ const ENVIRONMENT = process.env.NODE_ENV || 'development'; | ||
let possibleConfigFiles = CONFIG_FILES; | ||
if (!(0, _ts_node_utils.withinTsNode)()) { | ||
if (!_mashroomUtils.tsNodeUtils.withinTsNode()) { | ||
possibleConfigFiles = possibleConfigFiles.filter(p => !p.endsWith('.ts')); | ||
@@ -38,3 +35,3 @@ } | ||
const existingConfigFiles = configFiles.filter(file => (0, _fs.existsSync)(file)); | ||
let config = _mashroom_default_config.default; | ||
let config = _mashroomDefaultConfig.default; | ||
if (existingConfigFiles.length > 0) { | ||
@@ -47,3 +44,3 @@ for (const configFile of existingConfigFiles) { | ||
const externalConfig = externalConfigModule.default ?? externalConfigModule; | ||
config = (0, _model_utils.deepAssign)({}, config, externalConfig); | ||
config = _mashroomUtils.modelUtils.deepAssign({}, config, externalConfig); | ||
} catch (e) { | ||
@@ -76,5 +73,5 @@ this._logger.error(`Loading config file failed: ${configFile}`, e); | ||
}; | ||
(0, _config_utils.evaluateTemplatesInConfigObject)(config, this._logger); | ||
_mashroomUtils.configUtils.evaluateTemplatesInConfigObject(config, this._logger); | ||
return { | ||
getConfig: () => (0, _readonly_utils.createReadonlyProxy)(config) | ||
getConfig: () => _mashroomUtils.readonlyUtils.createReadonlyProxy(config) | ||
}; | ||
@@ -81,0 +78,0 @@ } |
@@ -9,6 +9,6 @@ "use strict"; | ||
get: function () { | ||
return _mashroom_server_context_factory.default; | ||
return _mashroomServerContextFactory.default; | ||
} | ||
}); | ||
var _mashroom_server_context_factory = _interopRequireDefault(require("./context/mashroom_server_context_factory")); | ||
var _mashroomServerContextFactory = _interopRequireDefault(require("./context/mashroom-server-context-factory")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _default_request_context = _interopRequireDefault(require("./default_request_context")); | ||
var _defaultRequestContext = _interopRequireDefault(require("./default-request-context")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -14,3 +14,3 @@ const MASHROOM_LOGGER_CONTEXT_KEY = 'mashroomLoggerContext'; | ||
this._request = req; | ||
this.add((0, _default_request_context.default)(req)); | ||
this.add((0, _defaultRequestContext.default)(req)); | ||
} | ||
@@ -17,0 +17,0 @@ add(context) { |
@@ -10,4 +10,4 @@ "use strict"; | ||
var _log4js = _interopRequireDefault(require("log4js")); | ||
var _ts_node_utils = require("@mashroom/mashroom-utils/lib/ts_node_utils"); | ||
var _log4js_default_config = _interopRequireDefault(require("./log4js_default_config")); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _log4jsDefaultConfig = _interopRequireDefault(require("./log4js-default-config")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -25,3 +25,3 @@ const ENVIRONMENT = process.env.NODE_ENV || 'development'; | ||
let possibleConfigFiles = CONFIG_FILES; | ||
if (!(0, _ts_node_utils.withinTsNode)()) { | ||
if (!_mashroomUtils.tsNodeUtils.withinTsNode()) { | ||
possibleConfigFiles = possibleConfigFiles.filter(p => !p.endsWith('.ts')); | ||
@@ -39,3 +39,3 @@ } | ||
} else { | ||
_log4js.default.configure(_log4js_default_config.default); | ||
_log4js.default.configure(_log4jsDefaultConfig.default); | ||
_log4js.default.getLogger().info('Considering log config files: ', possibleConfigFiles); | ||
@@ -42,0 +42,0 @@ _log4js.default.getLogger().warn('No log config files found, using default config'); |
@@ -14,3 +14,3 @@ "use strict"; | ||
var _anymatch = _interopRequireDefault(require("anymatch")); | ||
var _log_utils = require("../../utils/log_utils"); | ||
var _logUtils = require("../../utils/log-utils"); | ||
var _MashroomPluginPackageScanner = require("../scanner/MashroomPluginPackageScanner"); | ||
@@ -166,3 +166,3 @@ var _NpmUtils = _interopRequireDefault(require("./NpmUtils")); | ||
this._logger.error(`Error building plugin package: ${queueEntry.pluginPackageName}.`, error); | ||
const errorMessage = (0, _log_utils.stripAnsiColors)(error.toString()); | ||
const errorMessage = (0, _logUtils.stripAnsiColors)(error.toString()); | ||
if (buildInfo) { | ||
@@ -169,0 +169,0 @@ buildInfo.buildStatus = 'error'; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _reload_utils = require("../../utils/reload_utils"); | ||
var _reloadUtils = require("../../utils/reload-utils"); | ||
var _ExpressRequestHandlerWrapper = _interopRequireDefault(require("./ExpressRequestHandlerWrapper")); | ||
@@ -45,3 +45,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
this._logger.info(`Moving ${plugin.type} express plugin ${plugin.name} to new path: ${pluginConfig.path} (from: ${loadedPlugin.path})`); | ||
(0, _reload_utils.removeFromExpressStack)(this._expressApplication, plugin); | ||
(0, _reloadUtils.removeFromExpressStack)(this._expressApplication, plugin); | ||
this.addPluginInstance(this._expressApplication, requestHandlerWrapper.handler(), pluginConfig); | ||
@@ -63,3 +63,3 @@ } | ||
this.beforeUnload(plugin); | ||
(0, _reload_utils.removeFromExpressStack)(this._expressApplication, plugin); | ||
(0, _reloadUtils.removeFromExpressStack)(this._expressApplication, plugin); | ||
this._loadedPlugins.delete(plugin.name); | ||
@@ -66,0 +66,0 @@ } |
@@ -7,4 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _PluginConfigurationError = _interopRequireDefault(require("@mashroom/mashroom-utils/lib/PluginConfigurationError")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
class MashroomAdminUIIntegrationLoader { | ||
@@ -29,9 +28,9 @@ constructor(loggerFactory) { | ||
if (!target) { | ||
throw new _PluginConfigurationError.default(`Cannot register Admin UI integration ${plugin.name} because the 'target' attribute is missing!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Cannot register Admin UI integration ${plugin.name} because the 'target' attribute is missing!`); | ||
} | ||
if (!menuTitle) { | ||
throw new _PluginConfigurationError.default(`Cannot register Admin UI integration ${plugin.name} because the 'menuTitle' config attribute is missing!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Cannot register Admin UI integration ${plugin.name} because the 'menuTitle' config attribute is missing!`); | ||
} | ||
if (!path) { | ||
throw new _PluginConfigurationError.default(`Cannot register Admin UI integration ${plugin.name} because the 'path' config attribute is missing!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Cannot register Admin UI integration ${plugin.name} because the 'path' config attribute is missing!`); | ||
} | ||
@@ -38,0 +37,0 @@ this._logger.info('Registering Admin UI integration:', plugin.name); |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
var _PluginConfigurationError = _interopRequireDefault(require("@mashroom/mashroom-utils/lib/PluginConfigurationError")); | ||
var _built_in_loaders = _interopRequireDefault(require("./built_in_loaders")); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _builtInLoaders = _interopRequireDefault(require("./built-in-loaders")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -60,6 +60,6 @@ class MashroomPluginLoaderLoader { | ||
if (!loads) { | ||
throw new _PluginConfigurationError.default(`Loader plugin ${plugin.name} is missing property 'loads'!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Loader plugin ${plugin.name} is missing property 'loads'!`); | ||
} | ||
if (_built_in_loaders.default.indexOf(loads) !== -1) { | ||
throw new _PluginConfigurationError.default(`Loader plugin ${plugin.name} tries to override a built in loader: ${loads}!`); | ||
if (_builtInLoaders.default.indexOf(loads) !== -1) { | ||
throw new _mashroomUtils.PluginConfigurationError(`Loader plugin ${plugin.name} tries to override a built in loader: ${loads}!`); | ||
} | ||
@@ -66,0 +66,0 @@ } |
@@ -7,4 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _PluginConfigurationError = _interopRequireDefault(require("@mashroom/mashroom-utils/lib/PluginConfigurationError")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
class MashroomServicesLoader { | ||
@@ -21,3 +20,3 @@ constructor(_serviceRegistry, loggerFactory) { | ||
if (!namespace) { | ||
throw new _PluginConfigurationError.default(`Cannot register services in ${plugin.name} because the 'namespace' attribute is missing!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Cannot register services in ${plugin.name} because the 'namespace' attribute is missing!`); | ||
} | ||
@@ -24,0 +23,0 @@ const bootstrap = plugin.requireBootstrap(); |
@@ -9,3 +9,3 @@ "use strict"; | ||
var _express = _interopRequireDefault(require("express")); | ||
var _PluginConfigurationError = _interopRequireDefault(require("@mashroom/mashroom-utils/lib/PluginConfigurationError")); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _ExpressRequestHandlerBasePluginLoader = _interopRequireDefault(require("./ExpressRequestHandlerBasePluginLoader")); | ||
@@ -20,3 +20,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
if (!documentRoot) { | ||
throw new _PluginConfigurationError.default(`Static plugin ${plugin.name} is missing property 'documentRoot'!`); | ||
throw new _mashroomUtils.PluginConfigurationError(`Static plugin ${plugin.name} is missing property 'documentRoot'!`); | ||
} | ||
@@ -23,0 +23,0 @@ const fullDocumentRoot = _path.default.resolve(plugin.pluginPackage.pluginPackagePath, documentRoot); |
@@ -8,5 +8,3 @@ "use strict"; | ||
var _path = require("path"); | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _PluginBootstrapError = _interopRequireDefault(require("@mashroom/mashroom-utils/lib/PluginBootstrapError")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
class MashroomPlugin { | ||
@@ -25,3 +23,3 @@ constructor(_pluginDefinition, _pluginPackage, registryConnector, loggerFactory) { | ||
if (!bootstrapFullPath) { | ||
throw new _PluginBootstrapError.default(`No bootstrap defined for plugin ${this.name}`); | ||
throw new _mashroomUtils.PluginBootstrapError(`No bootstrap defined for plugin ${this.name}`); | ||
} | ||
@@ -34,3 +32,3 @@ this._logger.info(`Loading bootstrap for plugin ${this.name}: ${bootstrapFullPath}`); | ||
this._logger.error(`Loading bootstrap of plugin ${this.name} failed`, e); | ||
throw new _PluginBootstrapError.default(`Loading bootstrap of plugin ${this.name} failed: ${e}`); | ||
throw new _mashroomUtils.PluginBootstrapError(`Loading bootstrap of plugin ${this.name} failed: ${e}`); | ||
} | ||
@@ -43,3 +41,3 @@ if (typeof bootstrap === 'function') { | ||
} | ||
throw new _PluginBootstrapError.default(`Loading bootstrap of plugin ${this.name} failed: Default export is no function!`); | ||
throw new _mashroomUtils.PluginBootstrapError(`Loading bootstrap of plugin ${this.name} failed: Default export is no function!`); | ||
} | ||
@@ -91,3 +89,3 @@ _getBootstrapFullPath() { | ||
get pluginDefinition() { | ||
return (0, _readonly_utils.cloneAndFreezeObject)(this._pluginDefinition); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeObject(this._pluginDefinition); | ||
} | ||
@@ -94,0 +92,0 @@ get config() { |
@@ -10,6 +10,5 @@ "use strict"; | ||
var _events = require("events"); | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _config_utils = require("@mashroom/mashroom-utils/lib/config_utils"); | ||
var _reload_utils = require("../utils/reload_utils"); | ||
var _plugin_utils = require("../utils/plugin_utils"); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _reloadUtils = require("../utils/reload-utils"); | ||
var _pluginUtils = require("../utils/plugin-utils"); | ||
class MashroomPackagePlugin { | ||
@@ -112,3 +111,3 @@ constructor(_pluginPackagePath, _ignorePlugins, _externalPluginConfigFileNames, _registryConnector, _builder, loggerFactory) { | ||
_readExternalPluginConfigFile() { | ||
const externalPluginConfigFile = (0, _plugin_utils.getExternalPluginDefinitionFilePath)(this._pluginPackagePath, this._externalPluginConfigFileNames); | ||
const externalPluginConfigFile = (0, _pluginUtils.getExternalPluginDefinitionFilePath)(this._pluginPackagePath, this._externalPluginConfigFileNames); | ||
if (!externalPluginConfigFile) { | ||
@@ -159,3 +158,3 @@ return; | ||
_removeModulesFromNodeCache() { | ||
(0, _reload_utils.removePackageModulesFromNodeCache)(this._pluginPackagePath); | ||
(0, _reloadUtils.removePackageModulesFromNodeCache)(this._pluginPackagePath); | ||
} | ||
@@ -187,3 +186,3 @@ _emitReady() { | ||
} | ||
if (p.name.match(_config_utils.INVALID_PLUGIN_NAME_CHARACTERS)) { | ||
if (p.name.match(_mashroomUtils.configUtils.INVALID_PLUGIN_NAME_CHARACTERS)) { | ||
this._logger.error(`Ignoring plugin ${p.name} in package ${this._name} because its name has invalid characters (/,?).`); | ||
@@ -210,3 +209,3 @@ return false; | ||
if (p.defaultConfig) { | ||
(0, _config_utils.evaluateTemplatesInConfigObject)(p.defaultConfig, this._logger); | ||
_mashroomUtils.configUtils.evaluateTemplatesInConfigObject(p.defaultConfig, this._logger); | ||
} | ||
@@ -247,3 +246,3 @@ }); | ||
get pluginDefinitions() { | ||
return (0, _readonly_utils.cloneAndFreezeArray)(this._pluginDefinitions); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeArray(this._pluginDefinitions); | ||
} | ||
@@ -250,0 +249,0 @@ get status() { |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
class MashroomServiceRegistry { | ||
@@ -20,5 +20,5 @@ constructor() { | ||
getServiceNamespaces() { | ||
return (0, _readonly_utils.cloneAndFreezeObject)(this._namespaces); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeObject(this._namespaces); | ||
} | ||
} | ||
exports.default = MashroomServiceRegistry; |
@@ -8,4 +8,4 @@ "use strict"; | ||
var _events = require("events"); | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _plugin_utils = require("../../utils/plugin_utils"); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _pluginUtils = require("../../utils/plugin-utils"); | ||
var _MashroomPluginPackageRegistryConnector = _interopRequireDefault(require("./MashroomPluginPackageRegistryConnector")); | ||
@@ -38,4 +38,3 @@ var _MashroomPluginRegistryConnector = _interopRequireDefault(require("./MashroomPluginRegistryConnector")); | ||
unregisterPluginLoader(type, loader) { | ||
var _this$_pluginLoaders$; | ||
if (this._pluginLoaders[type] && ((_this$_pluginLoaders$ = this._pluginLoaders[type]) === null || _this$_pluginLoaders$ === void 0 ? void 0 : _this$_pluginLoaders$.name) === loader.name) { | ||
if (this._pluginLoaders[type] && this._pluginLoaders[type]?.name === loader.name) { | ||
delete this._pluginLoaders[type]; | ||
@@ -189,3 +188,3 @@ } | ||
} | ||
const pluginConfig = (0, _plugin_utils.createPluginConfig)(plugin, loader, this._pluginContextHolder.getPluginContext()); | ||
const pluginConfig = (0, _pluginUtils.createPluginConfig)(plugin, loader, this._pluginContextHolder.getPluginContext()); | ||
try { | ||
@@ -232,3 +231,3 @@ await loader.load(plugin, pluginConfig, this._pluginContextHolder); | ||
const plugin = loadedPlugins[i]; | ||
const pluginConfig = (0, _plugin_utils.createPluginConfig)(plugin, pluginLoader, this._pluginContextHolder.getPluginContext()); | ||
const pluginConfig = (0, _pluginUtils.createPluginConfig)(plugin, pluginLoader, this._pluginContextHolder.getPluginContext()); | ||
try { | ||
@@ -324,11 +323,11 @@ await pluginLoader.load(plugin, pluginConfig, this._pluginContextHolder); | ||
get plugins() { | ||
return (0, _readonly_utils.cloneAndFreezeArray)([...this._plugins.keys()]); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeArray([...this._plugins.keys()]); | ||
} | ||
get pluginLoaders() { | ||
return (0, _readonly_utils.cloneAndFreezeObject)(this._pluginLoaders); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeObject(this._pluginLoaders); | ||
} | ||
get pluginPackages() { | ||
return (0, _readonly_utils.cloneAndFreezeArray)([...this._pluginPackages.keys()]); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeArray([...this._pluginPackages.keys()]); | ||
} | ||
} | ||
exports.default = MashroomPluginRegistry; |
@@ -12,9 +12,8 @@ "use strict"; | ||
var _chokidar = _interopRequireDefault(require("chokidar")); | ||
var _readonly_utils = require("@mashroom/mashroom-utils/lib/readonly_utils"); | ||
var _plugin_utils = require("../../utils/plugin_utils"); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _pluginUtils = require("../../utils/plugin-utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Anymatch patterns | ||
const IGNORE_CHANGES_IN_PATHS = ['**/node_modules/**', '**/dist/**', '**/build/**', '**/public/**']; | ||
exports.IGNORE_CHANGES_IN_PATHS = IGNORE_CHANGES_IN_PATHS; | ||
const DEFAULT_DEFER_UPDATE_MS = 2000; | ||
const IGNORE_CHANGES_IN_PATHS = exports.IGNORE_CHANGES_IN_PATHS = ['**/node_modules/**', '**/dist/**', '**/build/**', '**/public/**']; | ||
const DEFAULT_DEFER_UPDATE_MS = exports.DEFAULT_DEFER_UPDATE_MS = 2000; | ||
@@ -25,3 +24,2 @@ /** | ||
*/ | ||
exports.DEFAULT_DEFER_UPDATE_MS = DEFAULT_DEFER_UPDATE_MS; | ||
class MashroomPluginPackageScanner { | ||
@@ -91,6 +89,6 @@ constructor(config, loggerFactory) { | ||
get pluginPackageFolders() { | ||
return (0, _readonly_utils.cloneAndFreezeArray)(this._pluginPackageFolders.map(f => f.path)); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeArray(this._pluginPackageFolders.map(f => f.path)); | ||
} | ||
get pluginPackagePaths() { | ||
return (0, _readonly_utils.cloneAndFreezeArray)(this._pluginPackagePaths); | ||
return _mashroomUtils.readonlyUtils.cloneAndFreezeArray(this._pluginPackagePaths); | ||
} | ||
@@ -185,3 +183,3 @@ _processChange(pluginPackagePath) { | ||
_isMashroomPluginPackage(pluginPackagePath) { | ||
const externalPluginConfigFile = (0, _plugin_utils.getExternalPluginDefinitionFilePath)(pluginPackagePath, this._externalPluginConfigFileNames); | ||
const externalPluginConfigFile = (0, _pluginUtils.getExternalPluginDefinitionFilePath)(pluginPackagePath, this._externalPluginConfigFileNames); | ||
if (externalPluginConfigFile) { | ||
@@ -188,0 +186,0 @@ return true; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _request_plugin_context = _interopRequireDefault(require("../context/request_plugin_context")); | ||
var _requestPluginContext = _interopRequireDefault(require("../context/request-plugin-context")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -17,3 +17,3 @@ const PLUGIN_CONTEXT_PROPERTY_NAME = 'pluginContext'; | ||
return (req, res, next) => { | ||
req[PLUGIN_CONTEXT_PROPERTY_NAME] = (0, _request_plugin_context.default)(req, this._pluginContextHolder); | ||
req[PLUGIN_CONTEXT_PROPERTY_NAME] = (0, _requestPluginContext.default)(req, this._pluginContextHolder); | ||
next(); | ||
@@ -20,0 +20,0 @@ }; |
@@ -9,4 +9,4 @@ "use strict"; | ||
var _https = _interopRequireDefault(require("https")); | ||
var _tls_utils = require("@mashroom/mashroom-utils/lib/tls_utils"); | ||
var _index_route = _interopRequireDefault(require("./routes/index_route")); | ||
var _mashroomUtils = require("@mashroom/mashroom-utils"); | ||
var _indexRoute = _interopRequireDefault(require("./routes/index-route")); | ||
var _mashroom = _interopRequireDefault(require("./routes/mashroom")); | ||
@@ -46,3 +46,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
_addServerRoutes() { | ||
this._expressApp.get('/', _index_route.default); | ||
this._expressApp.get('/', _indexRoute.default); | ||
this._expressApp.use('/mashroom', _mashroom.default); | ||
@@ -75,3 +75,3 @@ } | ||
} | ||
const fixedTlsOptions = (0, _tls_utils.fixTlsOptions)(this._config.tlsOptions, this._config.serverRootFolder, this._logger); | ||
const fixedTlsOptions = _mashroomUtils.tlsUtils.fixTlsOptions(this._config.tlsOptions, this._config.serverRootFolder, this._logger); | ||
this._logger.debug('Using TLS options: ', fixedTlsOptions); | ||
@@ -78,0 +78,0 @@ return new Promise((resolve, reject) => { |
@@ -8,25 +8,24 @@ "use strict"; | ||
var _express = require("express"); | ||
var _info_overview_route = _interopRequireDefault(require("./info_overview_route")); | ||
var _info_plugins_route = _interopRequireDefault(require("./info_plugins_route")); | ||
var _info_plugin_packages_route = _interopRequireDefault(require("./info_plugin_packages_route")); | ||
var _info_plugin_loaders_route = _interopRequireDefault(require("./info_plugin_loaders_route")); | ||
var _info_webapps_route = _interopRequireDefault(require("./info_webapps_route")); | ||
var _info_apis_route = _interopRequireDefault(require("./info_apis_route")); | ||
var _info_services_route = _interopRequireDefault(require("./info_services_route")); | ||
var _info_middleware_stack = _interopRequireDefault(require("./info_middleware_stack")); | ||
var _info_server_route = _interopRequireDefault(require("./info_server_route")); | ||
var _info_ext_admin_webapp = _interopRequireDefault(require("./info_ext_admin_webapp")); | ||
var _infoOverviewRoute = _interopRequireDefault(require("./info-overview-route")); | ||
var _infoPluginsRoute = _interopRequireDefault(require("./info-plugins-route")); | ||
var _infoPluginPackagesRoute = _interopRequireDefault(require("./info-plugin-packages-route")); | ||
var _infoPluginLoadersRoute = _interopRequireDefault(require("./info-plugin-loaders-route")); | ||
var _infoWebappsRoute = _interopRequireDefault(require("./info-webapps-route")); | ||
var _infoApisRoute = _interopRequireDefault(require("./info-apis-route")); | ||
var _infoServicesRoute = _interopRequireDefault(require("./info-services-route")); | ||
var _infoMiddlewareStack = _interopRequireDefault(require("./info-middleware-stack")); | ||
var _infoServerRoute = _interopRequireDefault(require("./info-server-route")); | ||
var _infoExtAdminWebapp = _interopRequireDefault(require("./info-ext-admin-webapp")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const router = (0, _express.Router)(); | ||
router.get('/', _info_overview_route.default); | ||
router.get('/plugins', _info_plugins_route.default); | ||
router.get('/plugin-packages', _info_plugin_packages_route.default); | ||
router.get('/plugin-loaders', _info_plugin_loaders_route.default); | ||
router.get('/middleware', _info_middleware_stack.default); | ||
router.get('/webapps', _info_webapps_route.default); | ||
router.get('/apis', _info_apis_route.default); | ||
router.get('/services', _info_services_route.default); | ||
router.get('/server-info', _info_server_route.default); | ||
router.get('/ext/*', _info_ext_admin_webapp.default); | ||
var _default = router; | ||
exports.default = _default; | ||
router.get('/', _infoOverviewRoute.default); | ||
router.get('/plugins', _infoPluginsRoute.default); | ||
router.get('/plugin-packages', _infoPluginPackagesRoute.default); | ||
router.get('/plugin-loaders', _infoPluginLoadersRoute.default); | ||
router.get('/middleware', _infoMiddlewareStack.default); | ||
router.get('/webapps', _infoWebappsRoute.default); | ||
router.get('/apis', _infoApisRoute.default); | ||
router.get('/services', _infoServicesRoute.default); | ||
router.get('/server-info', _infoServerRoute.default); | ||
router.get('/ext/*', _infoExtAdminWebapp.default); | ||
var _default = exports.default = router; |
@@ -8,15 +8,9 @@ "use strict"; | ||
var _default = (content, req) => { | ||
const adminIntegrationPlugins = [...req.pluginContext.services.core.pluginService.getPlugins().filter(p => { | ||
var _p$config; | ||
return p.type === 'admin-ui-integration' && !!((_p$config = p.config) !== null && _p$config !== void 0 && _p$config.menuTitle); | ||
})]; | ||
adminIntegrationPlugins.sort((p1, p2) => { | ||
var _p1$config, _p2$config; | ||
return ((_p1$config = p1.config) === null || _p1$config === void 0 ? void 0 : _p1$config.weight) - ((_p2$config = p2.config) === null || _p2$config === void 0 ? void 0 : _p2$config.weight); | ||
}); | ||
const adminIntegrationPlugins = [...req.pluginContext.services.core.pluginService.getPlugins().filter(p => p.type === 'admin-ui-integration' && !!p.config?.menuTitle)]; | ||
adminIntegrationPlugins.sort((p1, p2) => p1.config?.weight - p2.config?.weight); | ||
const extraMenuEntry = adminIntegrationPlugins.map(({ | ||
config | ||
}) => ({ | ||
menuTitle: (config === null || config === void 0 ? void 0 : config.menuTitle) || '???', | ||
path: (config === null || config === void 0 ? void 0 : config.path) || '???' | ||
menuTitle: config?.menuTitle || '???', | ||
path: config?.path || '???' | ||
})); | ||
@@ -238,3 +232,3 @@ return ` | ||
<script type="application/javascript"> | ||
<script type="text/javascript"> | ||
var refreshEnabled = document.cookie.split('; ').find(function(keyValue) { | ||
@@ -241,0 +235,0 @@ return keyValue === 'mashroomAdminUIAutoRefresh=1'; |
@@ -9,4 +9,3 @@ "use strict"; | ||
const up = request => { | ||
var _request$pluginContex, _request$pluginContex2, _request$pluginContex3; | ||
return !!((_request$pluginContex = request.pluginContext) !== null && _request$pluginContex !== void 0 && (_request$pluginContex2 = _request$pluginContex.services) !== null && _request$pluginContex2 !== void 0 && (_request$pluginContex3 = _request$pluginContex2.core) !== null && _request$pluginContex3 !== void 0 && _request$pluginContex3.pluginService); | ||
return !!request.pluginContext?.services?.core?.pluginService; | ||
}; | ||
@@ -13,0 +12,0 @@ exports.up = up; |
@@ -9,5 +9,5 @@ "use strict"; | ||
var _checks = require("./checks"); | ||
var _up_route = _interopRequireDefault(require("./up_route")); | ||
var _ready_route = _interopRequireDefault(require("./ready_route")); | ||
var _healthy_route = _interopRequireDefault(require("./healthy_route")); | ||
var _upRoute = _interopRequireDefault(require("./up-route")); | ||
var _readyRoute = _interopRequireDefault(require("./ready-route")); | ||
var _healthyRoute = _interopRequireDefault(require("./healthy-route")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -85,6 +85,5 @@ const router = (0, _express.Router)(); | ||
}); | ||
router.get('/up', _up_route.default); | ||
router.get('/ready', _ready_route.default); | ||
router.get('/healthy', _healthy_route.default); | ||
var _default = router; | ||
exports.default = _default; | ||
router.get('/up', _upRoute.default); | ||
router.get('/ready', _readyRoute.default); | ||
router.get('/healthy', _healthyRoute.default); | ||
var _default = exports.default = router; |
@@ -18,3 +18,2 @@ "use strict"; | ||
router.use('/health', _health.default); | ||
var _default = router; | ||
exports.default = _default; | ||
var _default = exports.default = router; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _request_plugin_context = _interopRequireDefault(require("../context/request_plugin_context")); | ||
var _requestPluginContext = _interopRequireDefault(require("../context/request-plugin-context")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -37,3 +37,3 @@ class MashroomHttpUpgradeService { | ||
const reqWithContext = req; | ||
reqWithContext.pluginContext = (0, _request_plugin_context.default)(req, this._pluginContextHolder); | ||
reqWithContext.pluginContext = (0, _requestPluginContext.default)(req, this._pluginContextHolder); | ||
entry.handler(reqWithContext, socket, head); | ||
@@ -40,0 +40,0 @@ } else { |
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "2.4.5", | ||
"version": "2.5.0", | ||
"main": "dist", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
}, | ||
@@ -22,8 +22,8 @@ "bin": { | ||
"dependencies": { | ||
"@mashroom/mashroom-utils": "2.4.5", | ||
"@types/express": "^4.17.17", | ||
"@mashroom/mashroom-utils": "2.5.0", | ||
"@types/express": "^4.17.21", | ||
"anymatch": "^3.1.3", | ||
"chokidar": "^3.5.3", | ||
"express": "^4.18.2", | ||
"fs-extra": "^11.1.1", | ||
"fs-extra": "^11.2.0", | ||
"log4js": "^6.9.1", | ||
@@ -64,3 +64,3 @@ "lucy-dirsum": "^0.1.1", | ||
"type-check": "tsc --noEmit", | ||
"test": "jest", | ||
"test": "jest --maxWorkers=1", | ||
"build": "babel src -d dist --extensions \".ts\"", | ||
@@ -67,0 +67,0 @@ "dev": "npm run build && node dist/server.js" |
@@ -7,3 +7,3 @@ | ||
// Extends Express Request | ||
// Extend Express Request | ||
declare global { | ||
@@ -13,5 +13,2 @@ namespace Express { | ||
pluginContext: MashroomPluginContext; | ||
// The only way so far I found to allow to have the session optional | ||
// without colliding with the declarations in express-session | ||
[key: string]: any; | ||
} | ||
@@ -18,0 +15,0 @@ } |
@@ -7,7 +7,5 @@ // @flow | ||
pluginContext: MashroomPluginContext, | ||
session?: any; | ||
}; | ||
export type IncomingMessageWithContext = http$IncomingMessage<> & { | ||
pluginContext: MashroomPluginContext; | ||
session?: any; | ||
} | ||
@@ -14,0 +12,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195857
5166
+ Added@mashroom/mashroom-utils@2.5.0(transitive)
- Removed@mashroom/mashroom-utils@2.4.5(transitive)
Updated@types/express@^4.17.21
Updatedfs-extra@^11.2.0