refactor: CB-2288 manifests

This commit is contained in:
Wroud
2022-07-15 03:21:14 +03:00
parent 722575668f
commit dd18c8e260
36 changed files with 354 additions and 175 deletions
+1
View File
@@ -15,6 +15,7 @@
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
},
"peerDependencies": {
"@cloudbeaver/core-browser": "~0.1.0",
"@cloudbeaver/core-blocks": "~0.1.0",
"@cloudbeaver/core-connections": "~0.1.0",
"@cloudbeaver/core-di": "~0.1.0",
+1
View File
@@ -86,3 +86,4 @@ export * from './TopNavBar/Logo';
// Interfaces
export * from './shared/NodesManager/NodeManagerUtils';
export * from './shared/NodesManager/EntityTypes';
export * from './manifest';
+76
View File
@@ -0,0 +1,76 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';
import { AppLocaleService } from './AppLocaleService';
import { AppScreenService } from './AppScreen/AppScreenService';
import { CoreSettingsService } from './CoreSettingsService';
import { ElementsTreeToolsMenuService } from './NavigationTree/ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService';
import { NavigationTreeBootstrap } from './NavigationTree/NavigationTreeBootstrap';
import { NavigationTreeService } from './NavigationTree/NavigationTreeService';
import { QuotasService } from './QuotasService';
import { NavigationTabsService } from './shared/NavigationTabs/NavigationTabsService';
import { ConnectionDialogsService } from './shared/NodesManager/ConnectionDialogsService';
import { DBObjectResource } from './shared/NodesManager/DBObjectResource';
import { NavNodeContextMenuService } from './shared/NodesManager/NavNodeContextMenuService';
import { NavNodeExtensionsService } from './shared/NodesManager/NavNodeExtensionsService';
import { NavNodeInfoResource } from './shared/NodesManager/NavNodeInfoResource';
import { NavNodeManagerService } from './shared/NodesManager/NavNodeManagerService';
import { NavNodeViewService } from './shared/NodesManager/NavNodeView/NavNodeViewService';
import { NavTreeResource } from './shared/NodesManager/NavTreeResource';
import { SessionExpiredDialogService } from './shared/SessionExpireDialog/SessionExpiredDialogService';
import { SessionExpireWarningDialogService } from './shared/SessionExpireWarningDialog/SessionExpireWarningDialogService';
import { SqlGeneratorsBootstrap } from './shared/SqlGenerators/SqlGeneratorsBootstrap';
import { SqlGeneratorsResource } from './shared/SqlGenerators/SqlGeneratorsResource';
import { LogViewerBootstrap } from './shared/ToolsPanel/LogViewer/LogViewerBootstrap';
import { LogViewerService } from './shared/ToolsPanel/LogViewer/LogViewerService';
import { ToolsPanelService } from './shared/ToolsPanel/ToolsPanelService';
import { AdministrationTopAppBarBootstrapService } from './TopNavBar/AdministrationTopAppBarBootstrapService';
import { ConnectionSchemaManagerBootstrap } from './TopNavBar/ConnectionSchemaManager/ConnectionSchemaManagerBootstrap';
import { ConnectionSchemaManagerService } from './TopNavBar/ConnectionSchemaManager/ConnectionSchemaManagerService';
import { MainMenuService } from './TopNavBar/MainMenu/MainMenuService';
import { TopNavService } from './TopNavBar/TopNavBarService';
export const coreAppManifest: PluginManifest = {
info: {
name: 'Core App',
},
providers: [
ConnectionDialogsService,
MainMenuService,
NavigationTreeService,
NavNodeManagerService,
DBObjectResource,
NavNodeViewService,
NavNodeExtensionsService,
NavNodeInfoResource,
SqlGeneratorsBootstrap,
SqlGeneratorsResource,
NavTreeResource,
ConnectionSchemaManagerService,
NavigationTabsService,
NavNodeContextMenuService,
LogViewerService,
LogViewerBootstrap,
TopNavService,
AppScreenService,
CoreSettingsService,
AdministrationTopAppBarBootstrapService,
AppLocaleService,
SessionExpiredDialogService,
SessionExpireWarningDialogService,
ConnectionSchemaManagerBootstrap,
NavigationTreeBootstrap,
ToolsPanelService,
QuotasService,
ElementsTreeToolsMenuService,
],
};
@@ -7,9 +7,10 @@
*/
import { UserInfoResource } from '@cloudbeaver/core-authentication';
import { CookiesService } from '@cloudbeaver/core-browser';
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs';
import { ServerConfigResource, SessionExpireService, SessionResource, CookiesService } from '@cloudbeaver/core-root';
import { ServerConfigResource, SessionExpireService, SessionResource } from '@cloudbeaver/core-root';
import { getCookies } from '@cloudbeaver/core-utils';
import { SessionExpireWarningDialog } from '../SessionExpireWarningDialog/SessionExpireWarningDialog';
@@ -10,7 +10,6 @@ import { observer } from 'mobx-react-lite';
import styled, { css } from 'reshadow';
import { useTranslate } from '@cloudbeaver/core-localization';
import { useStyles } from '@cloudbeaver/core-theming';
import { Button } from './Button';
import { IconOrImage } from './IconOrImage';
@@ -62,7 +61,7 @@ export const ErrorMessage = observer<Props>(function ErrorMessage({
}) {
const translate = useTranslate();
return styled(useStyles(styles))(
return styled(styles)(
<message className={className}>
<IconOrImage icon="/icons/error_icon_sm.svg" />
<message-body title={text}>
+1
View File
@@ -182,3 +182,4 @@ export * from './Snackbars/Snackbar';
export * from './Snackbars/ActionSnackbar';
export * from './Snackbars/ProcessSnackbar';
export * from './useUserData';
export * from './manifest';
@@ -0,0 +1,21 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';
import { BlocksLocaleService } from './BlocksLocaleService';
export const coreBlocksManifest: PluginManifest = {
info: {
name: 'Core Blocks',
},
providers: [
BlocksLocaleService,
],
};
@@ -19,6 +19,7 @@
"@cloudbeaver/core-app": "~0.1.0",
"@cloudbeaver/core-authentication": "~0.1.0",
"@cloudbeaver/core-blocks": "~0.1.0",
"@cloudbeaver/core-browser": "~0.1.0",
"@cloudbeaver/core-connections": "~0.1.0",
"@cloudbeaver/core-di": "~0.1.0",
"@cloudbeaver/core-dialogs": "~0.1.0",
+17 -74
View File
@@ -7,42 +7,14 @@
*/
import { coreAdministrationManifest } from '@cloudbeaver/core-administration';
import {
ConnectionDialogsService,
MainMenuService,
NavigationTreeService,
NavNodeManagerService,
DBObjectResource,
NavNodeViewService,
NavNodeExtensionsService,
NavNodeInfoResource,
SqlGeneratorsBootstrap,
SqlGeneratorsResource,
NavTreeResource,
ConnectionSchemaManagerService,
NavigationTabsService,
NavNodeContextMenuService,
LogViewerService,
LogViewerBootstrap,
TopNavService,
AppScreenService,
CoreSettingsService,
AdministrationTopAppBarBootstrapService,
AppLocaleService,
SessionExpiredDialogService,
SessionExpireWarningDialogService,
ConnectionSchemaManagerBootstrap,
NavigationTreeBootstrap,
ToolsPanelService,
QuotasService,
ElementsTreeToolsMenuService,
} from '@cloudbeaver/core-app';
import { coreAppManifest } from '@cloudbeaver/core-app';
import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication';
import { BlocksLocaleService } from '@cloudbeaver/core-blocks';
import { coreBlocksManifest } from '@cloudbeaver/core-blocks';
import { coreBrowserManifest } from '@cloudbeaver/core-browser';
import { coreConnectionsManifest } from '@cloudbeaver/core-connections';
import type { PluginManifest } from '@cloudbeaver/core-di';
import { CommonDialogService, ContextMenuService } from '@cloudbeaver/core-dialogs';
import { NotificationService, ExceptionsCatcherService, EventsSettingsService } from '@cloudbeaver/core-events';
import { codeDialogsManifest } from '@cloudbeaver/core-dialogs';
import { coreEventsManifest } from '@cloudbeaver/core-events';
import { coreLocalizationManifest } from '@cloudbeaver/core-localization';
import { corePluginManifest } from '@cloudbeaver/core-plugin';
import { coreProductManifest } from '@cloudbeaver/core-product';
@@ -57,6 +29,7 @@ import { coreVersionManifest } from '@cloudbeaver/core-version';
import { coreVersionUpdateManifest } from '@cloudbeaver/core-version-update';
import { coreViewManifest } from '@cloudbeaver/core-view';
export const coreManifests: PluginManifest[] = [
{
info: {
@@ -64,57 +37,27 @@ export const coreManifests: PluginManifest[] = [
},
depends: [],
providers: [
AdministrationTopAppBarBootstrapService,
CoreSettingsService,
QuotasService,
CommonDialogService,
SessionExpireWarningDialogService,
SessionExpiredDialogService,
ConnectionDialogsService,
ConnectionSchemaManagerBootstrap,
ConnectionSchemaManagerService,
BlocksLocaleService,
AppLocaleService,
AppScreenService,
ContextMenuService,
ExceptionsCatcherService,
EventsSettingsService,
LogViewerBootstrap,
LogViewerService,
MainMenuService,
TopNavService,
NavigationTabsService,
NavNodeContextMenuService,
NavigationTreeService,
NavNodeManagerService,
NavNodeViewService,
NavNodeExtensionsService,
NavNodeInfoResource,
SqlGeneratorsBootstrap,
SqlGeneratorsResource,
ElementsTreeToolsMenuService,
NavigationTreeBootstrap,
NavTreeResource,
DBObjectResource,
NotificationService,
ToolsPanelService,
],
providers: [ ],
},
coreRoutingManifest, // important, should be first because the router starts in load phase first after all plugins register phase
coreThemingManifest,
coreLocalizationManifest,
coreBlocksManifest,
coreSettingsManifest,
coreProjectsManifest,
coreAdministrationManifest,
coreEventsManifest,
coreSDKManifest,
coreRootManifest,
corePluginManifest,
coreBrowserManifest,
coreProductManifest,
coreProjectsManifest,
coreAuthenticationManifest,
coreUIManifest,
coreViewManifest,
coreVersionManifest,
coreVersionUpdateManifest,
coreRootManifest,
coreConnectionsManifest,
corePluginManifest,
coreProductManifest,
coreAdministrationManifest,
codeDialogsManifest,
coreAppManifest,
];
+21
View File
@@ -0,0 +1,21 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/lib
# misc
.DS_Store
.env*
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+27
View File
@@ -0,0 +1,27 @@
{
"name": "@cloudbeaver/core-browser",
"sideEffects": false,
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "lib/index.js",
"types": "src/index.ts",
"scripts": {
"prebuild": "rimraf lib/*",
"build": "webpack --config ../../configs/webpack.plugin.config.js",
"postbuild": "tsc",
"lint": "eslint ./src/ --ext .ts,.tsx",
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
},
"dependencies": {
"@cloudbeaver/core-di": "~0.1.0",
"@cloudbeaver/core-plugin": "~0.1.0",
"react": "~18.x.x",
"react-dom": "~18.x.x",
"reakit": "~1.x.x",
"mobx": "~6.x.x",
"mobx-react-lite": "~3.x.x",
"reshadow": "~0.x.x"
}
}
@@ -0,0 +1,2 @@
export * from './CookiesService';
export * from './manifest';
@@ -0,0 +1,24 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';
import { CookiesService } from './CookiesService';
import { CookiesSettingsService } from './CookiesSettingsService';
export const coreBrowserManifest: PluginManifest = {
info: {
name: 'Core Browser',
},
providers: [
CookiesSettingsService,
CookiesService,
],
};
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"composite": true
},
"include": ["src"],
"exclude": ["**/node_modules", "**/.*/"],
"references": [{ "path": "../*" }]
}
@@ -1,20 +1,20 @@
const { resolve, join } = require('path')
const ModuleDependencyWarning = require('webpack/lib/ModuleDependencyWarning')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const PnpWebpackPlugin = require(`pnp-webpack-plugin`);
const { resolve, join } = require('path');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const ModuleDependencyWarning = require('webpack/lib/ModuleDependencyWarning');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
// const ESLintPlugin = require('eslint-webpack-plugin');
class IgnoreNotFoundExportPlugin {
apply (compiler) {
apply(compiler) {
const messageRegExp = /export '.*'( \(imported as '.*'\))? was not found in/;
function doneHook (stats) {
function doneHook(stats) {
stats.compilation.warnings = stats.compilation.warnings.filter(warn => {
if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) {
return false;
}
return true
return true;
});
}
if (compiler.hooks) {
@@ -32,37 +32,37 @@ const nodeModules = [
];
module.exports = (env, argv) => {
process.env.NODE_ENV = argv.mode
const devTool = 'source-map' in env && 'source-map'
const devMode = argv.mode !== 'production'
function getBaseStyleLoaders () {
const loaders = []
process.env.NODE_ENV = argv.mode;
const devTool = 'source-map' in env && 'source-map';
const devMode = argv.mode !== 'production';
function getBaseStyleLoaders() {
const loaders = [];
// Broke styles order in dev mode
// if (devMode) {
// loaders.push('style-loader');
// } else {
loaders.push(MiniCssExtractPlugin.loader)
loaders.push(MiniCssExtractPlugin.loader);
// }
return loaders
return loaders;
}
function generateStyleLoaders (options = { hasModule: false, disable: false }) {
const moduleScope = options.hasModule ? 'local' : 'global'
function generateStyleLoaders(options = { hasModule: false, disable: false }) {
const moduleScope = options.hasModule ? 'local' : 'global';
let modules = {
mode: moduleScope,
localIdentName: '[local]___[hash:base64:5]',
}
};
if(options.disable) {
if (options.disable) {
modules = false;
}
const postCssPlugins = [
require('postcss-preset-env')({ stage: 0 }),
require('@reshadow/postcss')({ scopeBehaviour: moduleScope }),
]
];
return [
...getBaseStyleLoaders(),
@@ -93,7 +93,7 @@ module.exports = (env, argv) => {
},
},
},
]
];
}
var babelLoader = {
@@ -108,22 +108,22 @@ module.exports = (env, argv) => {
optimization: {
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false
splitChunks: false,
},
output: {
pathinfo: false
pathinfo: false,
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
modules: nodeModules,
// alias: {
// "react/jsx-dev-runtime": "react/jsx-dev-runtime.js", // 17->18
// "react/jsx-runtime": "react/jsx-runtime.js",
// "react/jsx-runtime.js": "react/jsx-runtime", // 18->17
// "react/jsx-dev-runtime.js": "react/jsx-dev-runtime"
// "react/jsx-dev-runtime": "react/jsx-dev-runtime.js", // 17->18
// "react/jsx-runtime": "react/jsx-runtime.js",
// "react/jsx-runtime.js": "react/jsx-runtime", // 18->17
// "react/jsx-dev-runtime.js": "react/jsx-dev-runtime"
// },
fallback: {
path: require.resolve("path-browserify"),
path: require.resolve('path-browserify'),
},
plugins: [
PnpWebpackPlugin,
@@ -203,13 +203,13 @@ module.exports = (env, argv) => {
insert: linkTag => {
let reshadowObj = document.getElementById('__reshadow__');
if(reshadowObj) {
if (reshadowObj) {
document.head.insertBefore(linkTag, reshadowObj);
} else {
document.head.appendChild(linkTag)
} else {
document.head.appendChild(linkTag);
}
}
},
}),
],
}
}
};
};
@@ -1,11 +1,12 @@
const { merge } = require('webpack-merge');
const { resolve } = require('path');
var PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
const { merge } = require('webpack-merge');
const commonConfig = require('./webpack.config.js');
var main = resolve('src/index.ts');
var outputDir = resolve('lib');
var package = require(resolve("package.json"));
var package = require(resolve('package.json'));
module.exports = (env, argv) => merge(commonConfig(env, argv), {
entry: main,
@@ -3,7 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');
const { merge } = require('webpack-merge')
const { merge } = require('webpack-merge');
const commonConfig = require('./webpack.config.js');
const { getAssets, withTimestamp } = require('./webpack.product.utils');
@@ -12,8 +12,8 @@ const HtmlInjectWebpackPlugin = require('./HtmlInjectWebpackPlugin.js');
const main = resolve('src/index.ts');
const sso = require.resolve('@cloudbeaver/plugin-sso/src/index.ts');
const ssoHtmlTemplate = require.resolve('@cloudbeaver/plugin-sso/src/index.html.ejs');
const outputDir = resolve('lib')
const package = require(resolve('package.json'))
const outputDir = resolve('lib');
const package = require(resolve('package.json'));
const excludedFromVendor = [
'react-data-grid',
@@ -36,15 +36,15 @@ const excludedFromVendor = [
'codemirror',
'react-codemirror2',
'd3',
'dagre'
]
'dagre',
];
const timestampVersion = withTimestamp(package.version)
const timestampVersion = withTimestamp(package.version);
module.exports = (env, argv) => merge(commonConfig(env, argv), {
entry: {
main,
sso
sso,
},
output: {
filename: 'index.[contenthash].js',
@@ -82,14 +82,14 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
}),
new webpack.DefinePlugin({
_VERSION_: JSON.stringify(timestampVersion),
_DEV_: false
_DEV_: false,
}),
new HtmlWebpackPlugin({
template: resolve('src/index.html.ejs'),
inject: 'body',
chunks: ['main'],
version: timestampVersion,
title: package.product?.name
title: package.product?.name,
}),
new HtmlWebpackPlugin({
filename: 'sso.html',
@@ -97,10 +97,10 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
inject: 'body',
chunks: ['sso'],
version: timestampVersion,
title: package.product?.name
title: package.product?.name,
}),
new HtmlInjectWebpackPlugin({
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: "{STATIC_CONTENT}", voidTag: false }]
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: '{STATIC_CONTENT}', voidTag: false }],
}),
],
})
});
@@ -1,38 +1,39 @@
const { getAssets } = require('./webpack.product.utils');
const { merge } = require('webpack-merge');
const { resolve } = require('path');
const webpack = require('webpack');
const fs = require('fs');
const commonConfig = require('./webpack.config.js')
const commonConfig = require('./webpack.config.js');
const main = resolve('src/index.ts');
const sso = require.resolve('@cloudbeaver/plugin-sso/src/index.ts');
const ssoHtmlTemplate = require.resolve('@cloudbeaver/plugin-sso/src/index.html.ejs');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlInjectWebpackPlugin = require('./HtmlInjectWebpackPlugin');
const { getAssets } = require('./webpack.product.utils');
const package = require(resolve('package.json'));
const certPath = resolve(__dirname, '../../../../../certs/private.pem')
const keyPath = resolve(__dirname, '../../../../../certs/private.key')
const certPath = resolve(__dirname, '../../../../../certs/private.pem');
const keyPath = resolve(__dirname, '../../../../../certs/private.key');
let server = undefined;
if(fs.existsSync(certPath) && fs.existsSync(keyPath)) {
if (fs.existsSync(certPath) && fs.existsSync(keyPath)) {
server = {
type: 'https',
options: {
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certPath),
}
}
},
};
}
module.exports = (env, argv) => merge(commonConfig(env, argv), {
entry: {
main,
sso
sso,
},
mode: 'development',
devServer: {
@@ -46,11 +47,11 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
'/api': {
target: env.server,
},
}
},
},
devtool: 'eval-source-map',
optimization: {
moduleIds: "named"
moduleIds: 'named',
},
plugins: [
new CopyWebpackPlugin({
@@ -60,12 +61,12 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
_VERSION_: JSON.stringify(package.version),
_DEV_: true,
}),
new HtmlWebpackPlugin({
template: resolve('src/index.html.ejs'),
new HtmlWebpackPlugin({
template: resolve('src/index.html.ejs'),
inject: 'body',
chunks: ['main'],
version: package.version,
title: package.product?.name
title: package.product?.name,
}),
new HtmlWebpackPlugin({
filename: 'sso.html',
@@ -73,10 +74,10 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), {
inject: 'body',
chunks: ['sso'],
version: package.version,
title: package.product?.name
title: package.product?.name,
}),
new HtmlInjectWebpackPlugin({
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: "{STATIC_CONTENT}", voidTag: false }]
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: '{STATIC_CONTENT}', voidTag: false }],
}),
new webpack.HotModuleReplacementPlugin(),
],
@@ -3,7 +3,7 @@ const { resolve } = require('path');
const paths = [resolve('.')];
function withTimestamp(version) {
return `${version}.${new Date().toISOString().substr(0, 19).replace('T', '').split(/[-:]+/).join('').slice(0, -2)}`
return `${version}.${new Date().toISOString().substr(0, 19).replace('T', '').split(/[-:]+/).join('').slice(0, -2)}`;
}
function getCloudbeaverDeps(package) {
@@ -12,7 +12,7 @@ function getCloudbeaverDeps(package) {
}
return Object.keys(package.dependencies)
.filter(dependency => /@cloudbeaver\/(.*?)/.test(dependency))
.filter(dependency => /@cloudbeaver\/(.*?)/.test(dependency));
}
function scanCloudbeaverDeps(package) {
@@ -23,13 +23,13 @@ function scanCloudbeaverDeps(package) {
const dependency = list.shift();
if (!deps.has(dependency)) {
list.push(...getCloudbeaverDeps(require(resolve('../../node_modules', dependency, 'package.json'))))
list.push(...getCloudbeaverDeps(require(resolve('../../node_modules', dependency, 'package.json'))));
}
deps.add(dependency);
}
return Array.from(deps.keys())
return Array.from(deps.keys());
}
function getAssets(package, to) {
@@ -39,10 +39,10 @@ function getAssets(package, to) {
patterns.push({ from: './public', to, force: true });
return patterns.filter(pattern => fs.existsSync(pattern.from))
return patterns.filter(pattern => fs.existsSync(pattern.from));
}
module.exports = {
withTimestamp,
getAssets
}
module.exports = {
withTimestamp,
getAssets,
};
@@ -12,7 +12,6 @@ import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } fr
import { NotificationService } from '@cloudbeaver/core-events';
import { Executor, ExecutorInterrupter, IExecutor } from '@cloudbeaver/core-executor';
import { CachedMapAllKey } from '@cloudbeaver/core-sdk';
import { AuthenticationService } from '@cloudbeaver/plugin-authentication';
import { ConnectionInfoResource, Connection } from './ConnectionInfoResource';
import { ContainerResource, IStructContainers, ObjectContainer } from './ContainerResource';
@@ -36,7 +35,6 @@ export class ConnectionsManagerService {
readonly containerContainers: ContainerResource,
private readonly notificationService: NotificationService,
private readonly commonDialogService: CommonDialogService,
private readonly authenticationService: AuthenticationService,
) {
this.disconnecting = false;
@@ -46,12 +44,6 @@ export class ConnectionsManagerService {
this.connectionExecutor.addHandler(() => connectionInfo.load(CachedMapAllKey));
this.onDelete.before(this.onDisconnect);
this.authenticationService.onLogout.before(this.onDisconnect, state => ({
connections: this.connectionInfo.values
.filter(connection => connection.connected)
.map(connection => connection.id),
state,
}));
}
async requireConnection(connectionId: string | null = null): Promise<Connection | null> {
+1 -1
View File
@@ -14,7 +14,7 @@ export interface IServiceCollection {
addServiceByClass: (ctor: IServiceConstructor<any>, value?: any) => void;
}
export type ExtractInitArgs<T> = T extends IInitializableController<infer TArgs>? TArgs : never;
export type ExtractInitArgs<T> = T extends IInitializableController<infer TArgs> ? TArgs : never;
export interface IDestructibleController {
destruct: () => void;
@@ -17,3 +17,4 @@ export * from './Menu/models/ComputedMenuPanelModel';
export * from './Menu/ContextMenu/ContextMenuService';
export * from './Menu/ContextMenu/IContextMenuItem';
export * from './Menu/ContextMenu/IMenuContext';
export * from './manifest';
@@ -0,0 +1,24 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';
import { CommonDialogService } from './CommonDialog/CommonDialogService';
import { ContextMenuService } from './Menu/ContextMenu/ContextMenuService';
export const codeDialogsManifest: PluginManifest = {
info: {
name: 'Core Dialogs',
},
providers: [
CommonDialogService,
ContextMenuService,
],
};
+1
View File
@@ -5,3 +5,4 @@ export * from './INotification';
export * from './DbeaverError';
export * from './ExceptionsCatcherService';
export * from './EventsSettingsService';
export { manifest as coreEventsManifest } from './manifest';
@@ -0,0 +1,27 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';
import { EventsSettingsService } from './EventsSettingsService';
import { ExceptionsCatcherService } from './ExceptionsCatcherService';
import { NotificationService } from './NotificationService';
export const manifest: PluginManifest = {
info: {
name: 'Core Events',
},
providers: [
NotificationService,
ExceptionsCatcherService,
EventsSettingsService,
],
};
@@ -13,7 +13,7 @@ import { PluginSettings } from './PluginSettings';
@injectable()
export class PluginManagerService {
constructor(private productManagerService: ProductManagerService) { }
constructor(private readonly productManagerService: ProductManagerService) { }
getPluginSettings<T>(scope: string, defaults: T) {
return new PluginSettings(this.productManagerService.settings, scope, defaults);
@@ -10,9 +10,9 @@ import type { ISettingsSource } from '@cloudbeaver/core-settings';
export class PluginSettings<T> implements ISettingsSource {
constructor(
private source: ISettingsSource,
private scope: string,
private defaults: T
private readonly source: ISettingsSource,
private readonly scope: string,
private readonly defaults: T
) {
}
@@ -16,7 +16,7 @@ import { ProductSettingsService } from './ProductSettingsService';
export class ProductManagerService {
readonly settings: ProductSettingsService;
constructor(private readonly serverService: ServerService) {
constructor(private readonly serverService: ServerService) {
this.settings = new ProductSettingsService(this.serverService.settings);
}
-1
View File
@@ -15,5 +15,4 @@ export * from './SessionSettingsService';
export * from './SessionExpireService';
export * from './usePermission';
export * from './WindowEventsService';
export * from './CookiesService';
export { manifest as coreRootManifest } from './manifest';
@@ -8,8 +8,6 @@
import type { PluginManifest } from '@cloudbeaver/core-di';
import { CookiesService } from './CookiesService';
import { CookiesSettingsService } from './CookiesSettingsService';
import { FeaturesResource } from './FeaturesResource';
import { NetworkStateService } from './NetworkStateService';
import { PermissionsService } from './PermissionsService';
@@ -46,7 +44,5 @@ export const manifest: PluginManifest = {
SessionService,
SessionSettingsService,
WindowEventsService,
CookiesSettingsService,
CookiesService,
],
};
@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import { createAction } from '@cloudbeaver/core-view';
import { createAction } from '../createAction';
export const ACTION_EXPORT = createAction(
'export',
@@ -1,6 +1,4 @@
import { manifest } from './manifest';
export default manifest;
export * from './AuthenticationService';
export * from './Dialog/AuthDialogService';
export default manifest;
@@ -15,7 +15,7 @@ import { PluginBootstrap } from './PluginBootstrap';
export const manifest: PluginManifest = {
info: {
name: 'Authentication',
name: 'Plugin Authentication',
},
providers: [
@@ -8,23 +8,33 @@
import { AuthProviderService } from '@cloudbeaver/core-authentication';
import { Connection, ConnectionInfoResource, ConnectionsManagerService } from '@cloudbeaver/core-connections';
import { injectable } from '@cloudbeaver/core-di';
import { Dependency, injectable } from '@cloudbeaver/core-di';
import { CommonDialogService } from '@cloudbeaver/core-dialogs';
import { NotificationService } from '@cloudbeaver/core-events';
import type { IExecutionContextProvider } from '@cloudbeaver/core-executor';
import type { AuthenticationService } from '@cloudbeaver/plugin-authentication';
import { DatabaseAuthDialog } from './DatabaseAuthDialog/DatabaseAuthDialog';
@injectable()
export class ConnectionAuthService {
export class ConnectionAuthService extends Dependency {
constructor(
private readonly connectionInfoResource: ConnectionInfoResource,
private readonly commonDialogService: CommonDialogService,
private readonly authProviderService: AuthProviderService,
private readonly connectionsManagerService: ConnectionsManagerService,
private readonly notificationService: NotificationService,
private readonly authenticationService: AuthenticationService,
) {
super();
connectionsManagerService.connectionExecutor.addHandler(this.connectionDialog.bind(this));
this.authenticationService.onLogout.before(connectionsManagerService.onDisconnect, state => ({
connections: connectionInfoResource.values
.filter(connection => connection.connected)
.map(connection => connection.id),
state,
}));
}
private async connectionDialog(connectionId: string | null, context: IExecutionContextProvider<string | null>) {