diff --git a/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF index f762b5a198..efe461a216 100644 --- a/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Release-Date: 20231009 Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . -Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport, +Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport, org.jkiss.dbeaver.model;visibility:=reexport, org.jkiss.dbeaver.model.sm;visibility:=reexport, org.jkiss.dbeaver.model.event;visibility:=reexport, @@ -18,7 +18,7 @@ Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport, org.jkiss.bundle.graphql.java;visibility:=reexport, org.jkiss.bundle.apache.dbcp, com.google.gson;visibility:=reexport, - jakarta.servlet-api;visibility:=reexport + jakarta.servlet-api;bundle-version="[4.0.0,4.0.0]";visibility:=reexport Export-Package: io.cloudbeaver, io.cloudbeaver.auth, io.cloudbeaver.auth.provider, diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java index ace90be81f..c903d3b7e1 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java @@ -47,8 +47,10 @@ import org.jkiss.dbeaver.model.data.json.JSONUtils; import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; -import org.jkiss.dbeaver.model.security.*; -import org.jkiss.dbeaver.model.security.user.SMObjectPermissions; +import org.jkiss.dbeaver.model.security.SMAdminController; +import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration; +import org.jkiss.dbeaver.model.security.SMConstants; +import org.jkiss.dbeaver.model.security.SMObjectType; import org.jkiss.dbeaver.model.websocket.event.WSEventController; import org.jkiss.dbeaver.model.websocket.event.WSServerConfigurationChangedEvent; import org.jkiss.dbeaver.registry.BaseApplicationImpl; @@ -256,7 +258,8 @@ protected void startServer() { if (CommonUtils.isEmpty(localHostAddress)) { localHostAddress = System.getProperty(CBConstants.VAR_CB_LOCAL_HOST_ADDR); } - if (CommonUtils.isEmpty(localHostAddress) || "127.0.0.1".equals(localHostAddress) || "::0".equals(localHostAddress)) { + if (CommonUtils.isEmpty(localHostAddress) || "127.0.0.1".equals(localHostAddress) || "::0".equals( + localHostAddress)) { localHostAddress = "localhost"; } @@ -278,8 +281,10 @@ protected void startServer() { } log.debug(GeneralUtils.getProductName() + " " + GeneralUtils.getProductVersion() + " is starting"); //$NON-NLS-1$ - log.debug("\tOS: " + System.getProperty(StandardConstants.ENV_OS_NAME) + " " + System.getProperty(StandardConstants.ENV_OS_VERSION) + " (" + System.getProperty(StandardConstants.ENV_OS_ARCH) + ")"); - log.debug("\tJava version: " + System.getProperty(StandardConstants.ENV_JAVA_VERSION) + " by " + System.getProperty(StandardConstants.ENV_JAVA_VENDOR) + " (" + System.getProperty(StandardConstants.ENV_JAVA_ARCH) + "bit)"); + log.debug("\tOS: " + System.getProperty(StandardConstants.ENV_OS_NAME) + " " + System.getProperty( + StandardConstants.ENV_OS_VERSION) + " (" + System.getProperty(StandardConstants.ENV_OS_ARCH) + ")"); + log.debug("\tJava version: " + System.getProperty(StandardConstants.ENV_JAVA_VERSION) + " by " + System.getProperty( + StandardConstants.ENV_JAVA_VENDOR) + " (" + System.getProperty(StandardConstants.ENV_JAVA_ARCH) + "bit)"); log.debug("\tInstall path: '" + SystemVariablesResolver.getInstallPath() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ log.debug("\tGlobal workspace: '" + instanceLoc.getURL() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ log.debug("\tMemory available " + (runtime.totalMemory() / (1024 * 1024)) + "Mb/" + (runtime.maxMemory() / (1024 * 1024)) + "Mb"); @@ -309,7 +314,8 @@ protected void startServer() { } { // Perform services initialization - for (DBWServiceInitializer wsi : WebServiceRegistry.getInstance().getWebServices(DBWServiceInitializer.class)) { + for (DBWServiceInitializer wsi : WebServiceRegistry.getInstance() + .getWebServices(DBWServiceInitializer.class)) { try { wsi.initializeService(this); } catch (Exception e) { @@ -379,7 +385,8 @@ protected void performAutoConfiguration(File configPath) { String autoAdminName = System.getenv(CBConstants.VAR_AUTO_CB_ADMIN_NAME); String autoAdminPassword = System.getenv(CBConstants.VAR_AUTO_CB_ADMIN_PASSWORD); - if (CommonUtils.isEmpty(autoServerName) || CommonUtils.isEmpty(autoAdminName) || CommonUtils.isEmpty(autoAdminPassword)) { + if (CommonUtils.isEmpty(autoServerName) || CommonUtils.isEmpty(autoAdminName) || CommonUtils.isEmpty( + autoAdminPassword)) { // Try to load from auto config file if (configPath.exists()) { File autoConfigFile = new File(configPath, CBConstants.AUTO_CONFIG_FILE_NAME); @@ -393,13 +400,15 @@ protected void performAutoConfiguration(File configPath) { autoAdminName = autoProps.getProperty(CBConstants.VAR_AUTO_CB_ADMIN_NAME); autoAdminPassword = autoProps.getProperty(CBConstants.VAR_AUTO_CB_ADMIN_PASSWORD); } catch (IOException e) { - log.error("Error loading auto configuration file '" + autoConfigFile.getAbsolutePath() + "'", e); + log.error("Error loading auto configuration file '" + autoConfigFile.getAbsolutePath() + "'", + e); } } } } - if (CommonUtils.isEmpty(autoServerName) || CommonUtils.isEmpty(autoAdminName) || CommonUtils.isEmpty(autoAdminPassword)) { + if (CommonUtils.isEmpty(autoServerName) || CommonUtils.isEmpty(autoAdminName) || CommonUtils.isEmpty( + autoAdminPassword)) { log.info("No auto configuration was found. Server must be configured manually"); return; } @@ -495,6 +504,7 @@ private void initializeSecurityController() throws DBException { protected Path loadServerConfiguration() throws DBException { Path path = super.loadServerConfiguration(); + File runtimeConfigFile = getRuntimeAppConfigFile(); if (runtimeConfigFile.exists()) { log.debug("Runtime configuration [" + runtimeConfigFile.getAbsolutePath() + "]"); @@ -514,7 +524,9 @@ protected void loadConfiguration(Path configPath) throws DBException { parseConfiguration(configPath.toFile()); } // Set default preferences - PrefUtils.setDefaultPreferenceValue(ModelPreferences.getPreferences(), ModelPreferences.UI_DRIVERS_HOME, getDriversLocation()); + PrefUtils.setDefaultPreferenceValue(ModelPreferences.getPreferences(), + ModelPreferences.UI_DRIVERS_HOME, + getDriversLocation()); } private void parseConfiguration(File configFile) throws DBException { @@ -551,10 +563,14 @@ protected void parseConfiguration(Map configProps) throws DBExce workspaceLocation = WebAppUtils.getRelativePath( JSONUtils.getString(serverConfig, CBConstants.PARAM_WORKSPACE_LOCATION, workspaceLocation), homeFolder); - maxSessionIdleTime = JSONUtils.getLong(serverConfig, CBConstants.PARAM_SESSION_EXPIRE_PERIOD, maxSessionIdleTime); + maxSessionIdleTime = JSONUtils.getLong(serverConfig, + CBConstants.PARAM_SESSION_EXPIRE_PERIOD, + maxSessionIdleTime); develMode = JSONUtils.getBoolean(serverConfig, CBConstants.PARAM_DEVEL_MODE, develMode); - enableSecurityManager = JSONUtils.getBoolean(serverConfig, CBConstants.PARAM_SECURITY_MANAGER, enableSecurityManager); + enableSecurityManager = JSONUtils.getBoolean(serverConfig, + CBConstants.PARAM_SECURITY_MANAGER, + enableSecurityManager); //SM config gson.fromJson( gson.toJsonTree(JSONUtils.getObject(serverConfig, CBConstants.PARAM_SM_CONFIGURATION)), @@ -636,7 +652,8 @@ protected void validateConfiguration(Map appConfig) throws DBExc } - protected void readProductConfiguration(Map serverConfig, Gson gson, String homeFolder) throws DBException { + protected void readProductConfiguration(Map serverConfig, Gson gson, String homeFolder) + throws DBException { String productConfigPath = WebAppUtils.getRelativePath( JSONUtils.getString( serverConfig, @@ -652,7 +669,8 @@ protected void readProductConfiguration(Map serverConfig, Gson g log.error("Product configuration file not found (" + productConfigFile.getAbsolutePath() + "'"); } else { log.debug("Load product configuration from '" + productConfigFile.getAbsolutePath() + "'"); - try (Reader reader = new InputStreamReader(new FileInputStream(productConfigFile), StandardCharsets.UTF_8)) { + try (Reader reader = new InputStreamReader(new FileInputStream(productConfigFile), + StandardCharsets.UTF_8)) { productConfiguration.putAll(JSONUtils.parseMap(gson, reader)); } catch (Exception e) { throw new DBException("Error reading product configuration", e); @@ -673,11 +691,13 @@ protected void readProductConfiguration(Map serverConfig, Gson g } protected Map readConnectionsPermissionsConfiguration(Path parentPath) { - String permissionsConfigPath = WebAppUtils.getRelativePath(CBConstants.DEFAULT_DATASOURCE_PERMISSIONS_CONFIGURATION, parentPath); + String permissionsConfigPath = WebAppUtils.getRelativePath(CBConstants.DEFAULT_DATASOURCE_PERMISSIONS_CONFIGURATION, + parentPath); File permissionsConfigFile = new File(permissionsConfigPath); if (permissionsConfigFile.exists()) { log.debug("Load permissions configuration from '" + permissionsConfigFile.getAbsolutePath() + "'"); - try (Reader reader = new InputStreamReader(new FileInputStream(permissionsConfigFile), StandardCharsets.UTF_8)) { + try (Reader reader = new InputStreamReader(new FileInputStream(permissionsConfigFile), + StandardCharsets.UTF_8)) { return JSONUtils.parseMap(getGson(), reader); } catch (Exception e) { log.error("Error reading permissions configuration", e); @@ -841,7 +861,8 @@ public synchronized void finishConfiguration( configurationMode = CommonUtils.isEmpty(serverName); // Reloading configuration by services - for (DBWServiceServerConfigurator wsc : WebServiceRegistry.getInstance().getWebServices(DBWServiceServerConfigurator.class)) { + for (DBWServiceServerConfigurator wsc : WebServiceRegistry.getInstance() + .getWebServices(DBWServiceServerConfigurator.class)) { try { wsc.reloadConfiguration(appConfig); } catch (Exception e) { @@ -878,7 +899,9 @@ private void grantAnonymousAccessToConnections(CBAppConfig appConfig, String adm String anonymousTeamId = appConfig.getAnonymousUserTeam(); var securityController = getSecurityController(); for (DBPDataSourceContainer ds : WebServiceUtils.getGlobalDataSourceRegistry().getDataSources()) { - var datasourcePermissions = securityController.getObjectPermissions(anonymousTeamId, ds.getId(), SMObjectType.datasource); + var datasourcePermissions = securityController.getObjectPermissions(anonymousTeamId, + ds.getId(), + SMObjectType.datasource); if (ArrayUtils.isEmpty(datasourcePermissions.getPermissions())) { securityController.setObjectPermissions( Set.of(ds.getId()), @@ -897,7 +920,8 @@ private void grantAnonymousAccessToConnections(CBAppConfig appConfig, String adm private void grantPermissionsToConnections() { try { var globalRegistry = WebDataSourceUtils.getGlobalDataSourceRegistry(); - var permissionsConfiguration = readConnectionsPermissionsConfiguration(globalRegistry.getProject().getMetadataFolder(false)); + var permissionsConfiguration = readConnectionsPermissionsConfiguration(globalRegistry.getProject() + .getMetadataFolder(false)); if (permissionsConfiguration == null) { return; } @@ -905,7 +929,8 @@ private void grantPermissionsToConnections() { var dataSourceId = entry.getKey(); var ds = globalRegistry.getDataSource(dataSourceId); if (ds == null) { - log.error("Connection " + dataSourceId + " is not found in project " + globalRegistry.getProject().getName()); + log.error("Connection " + dataSourceId + " is not found in project " + globalRegistry.getProject() + .getName()); } List permissions = JSONUtils.getStringList(permissionsConfiguration, dataSourceId); var securityController = getSecurityController(); @@ -971,7 +996,10 @@ protected Map collectConfigurationProperties( var originServerConfig = getServerConfigProps(this.originalConfigurationProperties); // get server properties from original configuration file rootConfig.put("server", serverConfigProperties); if (!CommonUtils.isEmpty(newServerName)) { - copyConfigValue(originServerConfig, serverConfigProperties, CBConstants.PARAM_SERVER_NAME, newServerName); + copyConfigValue(originServerConfig, + serverConfigProperties, + CBConstants.PARAM_SERVER_NAME, + newServerName); } if (!CommonUtils.isEmpty(newServerURL)) { copyConfigValue( @@ -979,10 +1007,14 @@ protected Map collectConfigurationProperties( } if (sessionExpireTime > 0) { copyConfigValue( - originServerConfig, serverConfigProperties, CBConstants.PARAM_SESSION_EXPIRE_PERIOD, sessionExpireTime); + originServerConfig, + serverConfigProperties, + CBConstants.PARAM_SESSION_EXPIRE_PERIOD, + sessionExpireTime); } var databaseConfigProperties = new LinkedHashMap(); - Map oldRuntimeDBConfig = JSONUtils.getObject(originServerConfig, CBConstants.PARAM_DB_CONFIGURATION); + Map oldRuntimeDBConfig = JSONUtils.getObject(originServerConfig, + CBConstants.PARAM_DB_CONFIGURATION); if (!CommonUtils.isEmpty(databaseConfiguration) && !isDistributed()) { for (Map.Entry mp : databaseConfiguration.entrySet()) { copyConfigValue(oldRuntimeDBConfig, databaseConfigProperties, mp.getKey(), mp.getValue()); @@ -998,23 +1030,41 @@ protected Map collectConfigurationProperties( copyConfigValue( oldAppConfig, appConfigProperties, "anonymousAccessEnabled", appConfig.isAnonymousAccessEnabled()); copyConfigValue( - oldAppConfig, appConfigProperties, "supportsCustomConnections", appConfig.isSupportsCustomConnections()); + oldAppConfig, + appConfigProperties, + "supportsCustomConnections", + appConfig.isSupportsCustomConnections()); copyConfigValue( - oldAppConfig, appConfigProperties, "publicCredentialsSaveEnabled", appConfig.isPublicCredentialsSaveEnabled()); + oldAppConfig, + appConfigProperties, + "publicCredentialsSaveEnabled", + appConfig.isPublicCredentialsSaveEnabled()); copyConfigValue( - oldAppConfig, appConfigProperties, "adminCredentialsSaveEnabled", appConfig.isAdminCredentialsSaveEnabled()); + oldAppConfig, + appConfigProperties, + "adminCredentialsSaveEnabled", + appConfig.isAdminCredentialsSaveEnabled()); copyConfigValue( oldAppConfig, appConfigProperties, "enableReverseProxyAuth", appConfig.isEnabledReverseProxyAuth()); copyConfigValue( oldAppConfig, appConfigProperties, "forwardProxy", appConfig.isEnabledForwardProxy()); copyConfigValue( - oldAppConfig, appConfigProperties, "linkExternalCredentialsWithUser", appConfig.isLinkExternalCredentialsWithUser()); + oldAppConfig, + appConfigProperties, + "linkExternalCredentialsWithUser", + appConfig.isLinkExternalCredentialsWithUser()); copyConfigValue( oldAppConfig, appConfigProperties, "redirectOnFederatedAuth", appConfig.isRedirectOnFederatedAuth()); copyConfigValue( - oldAppConfig, appConfigProperties, CBConstants.PARAM_RESOURCE_MANAGER_ENABLED, appConfig.isResourceManagerEnabled()); + oldAppConfig, + appConfigProperties, + CBConstants.PARAM_RESOURCE_MANAGER_ENABLED, + appConfig.isResourceManagerEnabled()); copyConfigValue( - oldAppConfig, appConfigProperties, CBConstants.PARAM_SHOW_READ_ONLY_CONN_INFO, appConfig.isShowReadOnlyConnectionInfo()); + oldAppConfig, + appConfigProperties, + CBConstants.PARAM_SHOW_READ_ONLY_CONN_INFO, + appConfig.isShowReadOnlyConnectionInfo()); copyConfigValue( oldAppConfig, appConfigProperties, @@ -1022,7 +1072,8 @@ protected Map collectConfigurationProperties( appConfig.isGrantConnectionsAccessToAnonymousTeam()); Map resourceQuotas = new LinkedHashMap<>(); - Map originResourceQuotas = JSONUtils.getObject(oldAppConfig, CBConstants.PARAM_RESOURCE_QUOTAS); + Map originResourceQuotas = JSONUtils.getObject(oldAppConfig, + CBConstants.PARAM_RESOURCE_QUOTAS); for (Map.Entry mp : appConfig.getResourceQuotas().entrySet()) { copyConfigValue(originResourceQuotas, resourceQuotas, mp.getKey(), mp.getValue()); } @@ -1136,7 +1187,12 @@ public List getAvailableAuthRoles() { } // gets info about patterns from original configuration file and saves it to runtime config - private void copyConfigValue(Map oldConfig, Map newConfig, String key, Object defaultValue) { + private void copyConfigValue( + Map oldConfig, + Map newConfig, + String key, + Object defaultValue + ) { Object value = oldConfig.get(key); if (value instanceof Map && defaultValue instanceof Map) { Map subValue = new LinkedHashMap<>(); diff --git a/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..232c7cf960 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Vendor: DBeaver Corp +Bundle-Name: CloudBeaver SLF4j Binding +Bundle-SymbolicName: io.cloudbeaver.slf4j;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Release-Date: 20231009 +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Fragment-Host: slf4j.api +Require-Bundle: ch.qos.logback.core, + ch.qos.logback.classic +Automatic-Module-Name: io.cloudbeaver.slf4j +Provide-Capability: osgi.serviceloader;osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider" diff --git a/server/bundles/io.cloudbeaver.slf4j/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/server/bundles/io.cloudbeaver.slf4j/META-INF/services/org.slf4j.spi.SLF4JServiceProvider new file mode 100644 index 0000000000..24a9f55c83 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/META-INF/services/org.slf4j.spi.SLF4JServiceProvider @@ -0,0 +1 @@ +io.cloudbeaver.slf4j.CloudBeaverLogServiceProvider \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.slf4j/build.properties b/server/bundles/io.cloudbeaver.slf4j/build.properties new file mode 100644 index 0000000000..0511fdeb94 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = target/classes/ +bin.includes = .,\ + META-INF/,\ + plugin.xml diff --git a/server/bundles/io.cloudbeaver.slf4j/plugin.xml b/server/bundles/io.cloudbeaver.slf4j/plugin.xml new file mode 100644 index 0000000000..cb11a658f5 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/server/bundles/io.cloudbeaver.slf4j/pom.xml b/server/bundles/io.cloudbeaver.slf4j/pom.xml new file mode 100644 index 0000000000..eee6e44448 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + io.cloudbeaver + bundles + 1.0.0-SNAPSHOT + ../ + + io.cloudbeaver.slf4j + 1.0.0-SNAPSHOT + eclipse-plugin + + diff --git a/server/bundles/io.cloudbeaver.slf4j/src/io.cloudbeaver.slf4j/CloudBeaverLogServiceProvider.java b/server/bundles/io.cloudbeaver.slf4j/src/io.cloudbeaver.slf4j/CloudBeaverLogServiceProvider.java new file mode 100644 index 0000000000..ce4e8fc150 --- /dev/null +++ b/server/bundles/io.cloudbeaver.slf4j/src/io.cloudbeaver.slf4j/CloudBeaverLogServiceProvider.java @@ -0,0 +1,24 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.cloudbeaver.slf4j; + +import ch.qos.logback.classic.spi.LogbackServiceProvider; + +public class CloudBeaverLogServiceProvider extends LogbackServiceProvider { + public CloudBeaverLogServiceProvider() { + } +} diff --git a/server/bundles/pom.xml b/server/bundles/pom.xml index 453987399b..5ce7dcb36f 100644 --- a/server/bundles/pom.xml +++ b/server/bundles/pom.xml @@ -15,6 +15,7 @@ io.cloudbeaver.model io.cloudbeaver.server + io.cloudbeaver.slf4j io.cloudbeaver.service.admin io.cloudbeaver.service.auth diff --git a/server/features/io.cloudbeaver.ws.feature/feature.xml b/server/features/io.cloudbeaver.ws.feature/feature.xml index 010ede7563..522a6ee168 100644 --- a/server/features/io.cloudbeaver.ws.feature/feature.xml +++ b/server/features/io.cloudbeaver.ws.feature/feature.xml @@ -39,9 +39,9 @@ + - diff --git a/server/test/pom.xml b/server/test/pom.xml index 1e8d711c59..ab27553b55 100644 --- a/server/test/pom.xml +++ b/server/test/pom.xml @@ -28,7 +28,7 @@ eclipse-plugin - ch.qos.logback.slf4j + ch.qos.logback.classic 0.0.0 diff --git a/webapp/packages/browserslist-config/index.js b/webapp/packages/browserslist-config/index.js new file mode 100644 index 0000000000..de089bf028 --- /dev/null +++ b/webapp/packages/browserslist-config/index.js @@ -0,0 +1 @@ +module.exports = ['defaults', 'not IE 11']; diff --git a/webapp/packages/browserslist-config/package.json b/webapp/packages/browserslist-config/package.json new file mode 100644 index 0000000000..63aac8cc0a --- /dev/null +++ b/webapp/packages/browserslist-config/package.json @@ -0,0 +1,7 @@ +{ + "name": "@cloudbeaver/browserslist-config", + "sideEffects": false, + "version": "0.1.0", + "license": "Apache-2.0", + "main": "index.js" +} diff --git a/webapp/packages/core-cli/bin/validate-dependencies.js b/webapp/packages/core-cli/bin/validate-dependencies.js index 7ff47d951e..312ef3e167 100755 --- a/webapp/packages/core-cli/bin/validate-dependencies.js +++ b/webapp/packages/core-cli/bin/validate-dependencies.js @@ -23,6 +23,7 @@ const currentPackage = JSON.parse(fs.readFileSync(currentPackagePath, 'utf8')); // Keep track of the dependencies that were found in the source files const dependencies = new Set(); const devDependencies = new Set(); +let isSuccess = true; const sourceFilesIterator = glob.globIterateSync('**/*.{ts,tsx,scss,css}', { cwd: currentPackageSrcPath }); const importRegex = /(import|export) ((type |)([\w,\s]*?)(\{[\w\s\n,]*?\}|) from |)['"]((@[\w-]*\/[\w-]*)|([^\\.].*?))(\/.*)*['"]/g; @@ -84,6 +85,8 @@ for (const sideEffect of sideEffects) { } } +console.log('Analyzing dependencies...'); + const newDependencies = [...dependencies].sort(sortDependencies); logUnmetAndExtraDependencies('dependencies', newDependencies, currentPackage.dependencies); @@ -108,6 +111,10 @@ currentPackage.devDependencies = [...devDependencies].sort(sortDependencies).red currentPackage.devDependencies, ); +if (isSuccess) { + console.log('All dependencies are valid'); +} + // Write the updated `package.json` fs.writeFileSync(currentPackagePath, JSON.stringify(currentPackage, null, 2) + '\n', 'utf8'); @@ -152,9 +159,11 @@ function logUnmetAndExtraDependencies(key, newDependencies, current) { if (unmetDependencies.length > 0) { console.warn(`Unmet ${key} found:`, unmetDependencies); + isSuccess = false; } if (extraDependencies.length > 0) { console.warn(`Extra ${key} found:`, extraDependencies); + isSuccess = false; } } diff --git a/webapp/packages/core-cli/configs/babel.config.js b/webapp/packages/core-cli/configs/babel.config.js index b1fb5c0648..d3974e9199 100644 --- a/webapp/packages/core-cli/configs/babel.config.js +++ b/webapp/packages/core-cli/configs/babel.config.js @@ -34,24 +34,24 @@ module.exports = api => { setSpreadProperties: true, }, presets: [ - [ - '@babel/preset-env', - { - modules: testMode ? undefined : false, - targets: { - node: 'current', - browsers: [ - 'defaults', - 'not IE 11', - // "last 1 chrome version", - // "last 1 firefox version", - // "last 1 edge version", - // "last 1 safari version" - ], - }, - exclude: ['transform-async-to-generator', 'transform-regenerator'], - }, - ], + // [ + // '@babel/preset-env', + // { + // modules: testMode ? undefined : false, + // targets: { + // node: 'current', + // browsers: [ + // 'defaults', + // 'not IE 11', + // // "last 1 chrome version", + // // "last 1 firefox version", + // // "last 1 edge version", + // // "last 1 safari version" + // ], + // }, + // exclude: ['transform-async-to-generator', 'transform-regenerator'], + // }, + // ], // ['@babel/preset-typescript', { isTSX: true, allExtensions: true, onlyRemoveTypeImports: true }], [ '@babel/preset-react', diff --git a/webapp/packages/core-cli/configs/excludedFromVendor.js b/webapp/packages/core-cli/configs/excludedFromVendor.js index 91866498ce..60973478ce 100644 --- a/webapp/packages/core-cli/configs/excludedFromVendor.js +++ b/webapp/packages/core-cli/configs/excludedFromVendor.js @@ -18,14 +18,6 @@ module.exports = [ 'd3', 'dagre', 'codemirror', - '@codemirror/*', - '@codemirror/commands', - '@codemirror/language', - '@codemirror/search', - '@codemirror/state', - '@codemirror/view', - '@codemirror/autocomplete', - '@codemirror/lang-*', + '@codemirror', '@lezer', - '@lezer/*', -]; \ No newline at end of file +]; diff --git a/webapp/packages/core-cli/configs/webpack.config.js b/webapp/packages/core-cli/configs/webpack.config.js index 3a48031e0a..20e899a14e 100644 --- a/webapp/packages/core-cli/configs/webpack.config.js +++ b/webapp/packages/core-cli/configs/webpack.config.js @@ -85,7 +85,6 @@ module.exports = (env, argv) => { }; return { - // target: !devMode ? "web" : "browserslist", optimization: { runtimeChunk: 'single', moduleIds: 'deterministic', @@ -104,7 +103,7 @@ module.exports = (env, argv) => { enforceSizeThreshold: 50000, cacheGroups: { locale: { - test: /[\\/]locales[\\/].*?\.ts/, + test: /[\\/]locales[\\/].*?\.js/, filename: '[name].[contenthash].js', name(module) { return module.rawRequest.substr(2); diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/useTableColumnDnD.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/useTableColumnDnD.ts index ab24da00f7..8bdc916cfc 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/useTableColumnDnD.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/useTableColumnDnD.ts @@ -60,7 +60,7 @@ export function useTableColumnDnD(model: IDatabaseDataModel, resultIndex: number let side: TableColumnInsertPositionSide = null; if (columnKey && dndBox.state.isOver && dndBox.state.context) { - const dndColumnKey = dndBox.state.context.get(DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY); + const dndColumnKey = dndBox.state.context.tryGet(DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY); if (resultSetViewAction && dndColumnKey && resultSetViewAction.columnIndex(columnKey) > resultSetViewAction.columnIndex(dndColumnKey)) { side = 'right'; diff --git a/webapp/packages/product-default/package.json b/webapp/packages/product-default/package.json index cae9f1f2c3..80854c1325 100644 --- a/webapp/packages/product-default/package.json +++ b/webapp/packages/product-default/package.json @@ -9,11 +9,14 @@ "description": "CloudBeaver Community", "license": "Apache-2.0", "main": "dist/index.js", + "browserslist": [ + "extends @cloudbeaver/browserslist-config" + ], "scripts": { "build": "rimraf --glob lib && lerna run gql:gen --stream --parallel && tsc -b", "bundle": "yarn build && core-cli-build --mode=production --config ../core-cli/configs/webpack.product.config.js", "dev": "yarn build && concurrently -P -k \"yarn tsc -b --watch --preserveWatchOutput\" \"lerna run gql:gen:dev --stream --parallel\" \"core-cli-build serve --mode=development --progress --config=../core-cli/configs/webpack.product.dev.config.js --port=3100 {@}\"", - "analyse": "core-cli-build --mode=production --config ../core-cli/configs/webpack.product.config.js --profile --json > ./lib/stats.json", + "analyse": "yarn build && rimraf --glob lib && mkdir lib && core-cli-build --mode=production --config ../core-cli/configs/webpack.product.config.js --profile --json > ./lib/stats.json", "postanalyse": "core-cli-analyzer ./lib/stats.json", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", diff --git a/webapp/tsconfig.base.json b/webapp/tsconfig.base.json index 7b315a44e2..740e42f53c 100644 --- a/webapp/tsconfig.base.json +++ b/webapp/tsconfig.base.json @@ -41,6 +41,10 @@ "disableReferencedProjectLoad": true, "disableSolutionSearching": true, + // disable support of helpers + "noEmitHelpers": false, + "importHelpers": true, + "types": ["reflect-metadata", "node", "jest", "@cloudbeaver/core-cli/global.d.ts"], "plugins": [ {