dbeaver/pro#6744 refactor: migration to @wroud/di (#3704)

* dbeaver/pro#6744 refactor: migration to `@wroud/di`

* tests: enable settings tests

* chore: update syntax

* fix: dynamic theme detection

* fix: skip not stable test

* fix: skip whole test

* fix: make theme optional

* fix: page reload

* tests: skip unstable test

* fix: remove optional

* fix: load system theme

* fix: prevent the system theme from always loading despite not being selected

---------

Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
This commit is contained in:
Alexey Potsetsuev
2025-08-29 18:22:11 +08:00
committed by GitHub
co-authored by mr-anton-t
parent ac48e13039
commit 80f258b561
867 changed files with 4572 additions and 2119 deletions
@@ -31,8 +31,10 @@
"@testing-library/jest-dom": "^6",
"@testing-library/react": "^16",
"@types/node": "^22",
"@types/ws": "^8",
"rimraf": "^6",
"typescript": "^5",
"vitest": "^3"
"vitest": "^3",
"ws": "^8"
}
}
@@ -6,7 +6,9 @@
* you may not use this file except in compliance with the License.
*/
import { WebSocket } from 'ws'
import '@testing-library/jest-dom/vitest';
// different machine has its own timezones and some tests can fail because of it
process.env.TZ = 'UTC';
globalThis.WebSocket = WebSocket as any
+42
View File
@@ -400,9 +400,11 @@ __metadata:
"@testing-library/jest-dom": "npm:^6"
"@testing-library/react": "npm:^16"
"@types/node": "npm:^22"
"@types/ws": "npm:^8"
rimraf: "npm:^6"
typescript: "npm:^5"
vitest: "npm:^3"
ws: "npm:^8"
languageName: unknown
linkType: soft
@@ -1922,6 +1924,15 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:*":
version: 24.3.0
resolution: "@types/node@npm:24.3.0"
dependencies:
undici-types: "npm:~7.10.0"
checksum: 10c0/96bdeca01f690338957c2dcc92cb9f76c262c10398f8d91860865464412b0f9d309c24d9b03d0bdd26dd47fa7ee3f8227893d5c89bc2009d919a525a22512030
languageName: node
linkType: hard
"@types/node@npm:^20.0.0":
version: 20.19.9
resolution: "@types/node@npm:20.19.9"
@@ -2018,6 +2029,15 @@ __metadata:
languageName: node
linkType: hard
"@types/ws@npm:^8":
version: 8.18.1
resolution: "@types/ws@npm:8.18.1"
dependencies:
"@types/node": "npm:*"
checksum: 10c0/61aff1129143fcc4312f083bc9e9e168aa3026b7dd6e70796276dcfb2c8211c4292603f9c4864fae702f2ed86e4abd4d38aa421831c2fd7f856c931a481afbab
languageName: node
linkType: hard
"@ungap/structured-clone@npm:^1.0.0":
version: 1.3.0
resolution: "@ungap/structured-clone@npm:1.3.0"
@@ -7227,6 +7247,13 @@ __metadata:
languageName: node
linkType: hard
"undici-types@npm:~7.10.0":
version: 7.10.0
resolution: "undici-types@npm:7.10.0"
checksum: 10c0/8b00ce50e235fe3cc601307f148b5e8fb427092ee3b23e8118ec0a5d7f68eca8cee468c8fc9f15cbb2cf2a3797945ebceb1cbd9732306a1d00e0a9b6afa0f635
languageName: node
linkType: hard
"unicorn-magic@npm:^0.3.0":
version: 0.3.0
resolution: "unicorn-magic@npm:0.3.0"
@@ -7726,6 +7753,21 @@ __metadata:
languageName: node
linkType: hard
"ws@npm:^8":
version: 8.18.3
resolution: "ws@npm:8.18.3"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ">=5.0.2"
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
checksum: 10c0/eac918213de265ef7cb3d4ca348b891a51a520d839aa51cdb8ca93d4fa7ff9f6ccb339ccee89e4075324097f0a55157c89fa3f7147bde9d8d7e90335dc087b53
languageName: node
linkType: hard
"wsl-utils@npm:^0.1.0":
version: 0.1.0
resolution: "wsl-utils@npm:0.1.0"
-1
View File
@@ -49,7 +49,6 @@
"react": "^19",
"react-dom": "^19",
"reakit": "^1",
"reflect-metadata": "^0",
"rimraf": "^6",
"typescript": "^5.8.3",
"typescript-plugin-css-modules": "^5",
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-administration",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -8,7 +8,7 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
@injectable(() => [LocalizationService])
export class AdministrationLocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
@@ -23,7 +23,15 @@ import { ADMINISTRATION_SCREEN_STATE_SCHEMA, type IAdministrationScreenInfo } fr
const ADMINISTRATION_INFO = 'administration_info';
@injectable()
@injectable(() => [
SessionPermissionsResource,
PermissionsService,
ScreenService,
AdministrationItemService,
StorageService,
ServerConfigResource,
NotificationService,
])
export class AdministrationScreenService {
static screenName = 'administration';
static itemRouteName = 'administration.item';
@@ -1,26 +1,25 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 { Dependency, injectable } from '@cloudbeaver/core-di';
import { injectable } from '@cloudbeaver/core-di';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { ScreenService } from '@cloudbeaver/core-routing';
import { AdministrationScreenService } from '../AdministrationScreenService.js';
import { ConfigurationWizardService } from './ConfigurationWizardService.js';
@injectable()
export class ConfigurationWizardScreenService extends Dependency {
@injectable(() => [AdministrationScreenService, ScreenService, ServerConfigResource, ConfigurationWizardService])
export class ConfigurationWizardScreenService {
constructor(
private readonly administrationScreenService: AdministrationScreenService,
private readonly screenService: ScreenService,
private readonly serverConfigResource: ServerConfigResource,
private readonly configurationWizardService: ConfigurationWizardService,
) {
super();
this.screenService.routeChange.addHandler(this.onRouteChange.bind(this));
}
@@ -16,7 +16,7 @@ import type { IAdministrationItem } from '../../AdministrationItem/IAdministrati
import { orderAdministrationItems } from '../../AdministrationItem/orderAdministrationItems.js';
import { AdministrationScreenService } from '../AdministrationScreenService.js';
@injectable()
@injectable(() => [AdministrationItemService, AdministrationScreenService, NotificationService])
export class ConfigurationWizardService {
get steps(): IAdministrationItem[] {
return this.administrationItemService
@@ -13,7 +13,7 @@ import { type AdminObjectGrantInfoFragment, type AdminPermissionInfoFragment, Gr
export type PermissionInfo = AdminPermissionInfoFragment;
export type AdminObjectGrantInfo = AdminObjectGrantInfoFragment;
@injectable()
@injectable(() => [GraphQLService, SessionDataResource])
export class PermissionsResource extends CachedMapResource<string, PermissionInfo> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -5,6 +5,8 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import './module.js';
export * from './manifest.js';
export * from './AdministrationItem/AdministrationItemService.js';
export * from './AdministrationItem/filterConfigurationWizard.js';
@@ -11,13 +11,4 @@ export const coreAdministrationManifest: PluginManifest = {
info: {
name: 'Core Administration',
},
providers: [
() => import('./AdministrationItem/AdministrationItemService.js').then(m => m.AdministrationItemService),
() => import('./PermissionsResource.js').then(m => m.PermissionsResource),
() => import('./AdministrationScreen/AdministrationScreenService.js').then(m => m.AdministrationScreenService),
() => import('./AdministrationScreen/ConfigurationWizard/ConfigurationWizardService.js').then(m => m.ConfigurationWizardService),
() => import('./AdministrationScreen/ConfigurationWizard/ConfigurationWizardScreenService.js').then(m => m.ConfigurationWizardScreenService),
() => import('./AdministrationLocaleService.js').then(m => m.AdministrationLocaleService),
],
};
@@ -0,0 +1,31 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { Bootstrap, Dependency, ModuleRegistry, proxy } from '@cloudbeaver/core-di';
import { PermissionsResource } from './PermissionsResource.js';
import { ConfigurationWizardService } from './AdministrationScreen/ConfigurationWizard/ConfigurationWizardService.js';
import { ConfigurationWizardScreenService } from './AdministrationScreen/ConfigurationWizard/ConfigurationWizardScreenService.js';
import { AdministrationScreenService } from './AdministrationScreen/AdministrationScreenService.js';
import { AdministrationLocaleService } from './AdministrationLocaleService.js';
import { AdministrationItemService } from './AdministrationItem/AdministrationItemService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-administration',
configure: serviceCollection => {
serviceCollection
.addSingleton(Bootstrap, AdministrationLocaleService)
.addSingleton(Dependency, proxy(ConfigurationWizardScreenService))
.addSingleton(Dependency, proxy(PermissionsResource))
.addSingleton(AdministrationItemService)
.addSingleton(PermissionsResource)
.addSingleton(ConfigurationWizardService)
.addSingleton(ConfigurationWizardScreenService)
.addSingleton(AdministrationScreenService);
},
});
+2
View File
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-app",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -8,7 +8,7 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
@injectable(() => [LocalizationService])
export class AppLocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
@@ -14,7 +14,7 @@ import { importLazyComponent } from '@cloudbeaver/core-blocks';
const AppScreen = importLazyComponent(() => import('./AppScreen.js').then(m => m.AppScreen));
@injectable()
@injectable(() => [ScreenService])
export class AppScreenBootstrap extends Bootstrap {
readonly activation: IExecutor;
+1 -1
View File
@@ -56,7 +56,7 @@ export const Body = observer(function Body() {
className={s(
styles,
{ bodyContent: true },
`theme-${themeService.currentTheme.class}`,
`theme-${themeService.currentTheme?.class || ''}`,
'theme-typography--body2',
'theme-background-surface',
'theme-text-on-surface',
+3 -1
View File
@@ -1,10 +1,12 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 './module.js';
// Services
export * from './AppScreen/AppScreenService.js';
export * from './AppScreen/AppScreenBootstrap.js';
+1 -7
View File
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,10 +11,4 @@ export const coreAppManifest: PluginManifest = {
info: {
name: 'Core App',
},
providers: [
() => import('./AppScreen/AppScreenService.js').then(m => m.AppScreenService),
() => import('./AppScreen/AppScreenBootstrap.js').then(m => m.AppScreenBootstrap),
() => import('./AppLocaleService.js').then(m => m.AppLocaleService),
],
};
+20
View File
@@ -0,0 +1,20 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { Bootstrap, ModuleRegistry } from '@cloudbeaver/core-di';
import { AppScreenService } from './AppScreen/AppScreenService.js';
import { AppScreenBootstrap } from './AppScreen/AppScreenBootstrap.js';
import { AppLocaleService } from './AppLocaleService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-app',
configure: serviceCollection => {
serviceCollection.addSingleton(Bootstrap, AppLocaleService).addSingleton(Bootstrap, AppScreenBootstrap).addSingleton(AppScreenService);
},
});
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-authentication",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -39,10 +41,12 @@
"devDependencies": {
"@cloudbeaver/core-cli": "workspace:*",
"@cloudbeaver/core-sdk": "workspace:*",
"@cloudbeaver/tests-runner": "workspace:*",
"@cloudbeaver/tsconfig": "workspace:*",
"@dbeaver/cli": "workspace:*",
"@dbeaver/react-tests": "workspace:^",
"msw": "^2",
"rimraf": "^6",
"typescript": "^5",
"vitest": "^3"
}
@@ -1,11 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { injectable } from '@cloudbeaver/core-di';
import { Executor, ExecutorInterrupter, type IExecutor } from '@cloudbeaver/core-executor';
import { type CachedDataResourceKey, CachedResource, getCachedDataResourceLoaderState } from '@cloudbeaver/core-resource';
import { ServerConfigResource } from '@cloudbeaver/core-root';
@@ -13,8 +13,8 @@ import type { ILoadableState } from '@cloudbeaver/core-utils';
import { UserInfoResource } from './UserInfoResource.js';
@injectable()
export class AppAuthService extends Bootstrap {
@injectable(() => [ServerConfigResource, UserInfoResource])
export class AppAuthService {
get authenticated(): boolean {
return this.serverConfigResource.configurationMode || this.userInfoResource.hasAccess();
}
@@ -32,7 +32,6 @@ export class AppAuthService extends Bootstrap {
private readonly serverConfigResource: ServerConfigResource,
private readonly userInfoResource: UserInfoResource,
) {
super();
this.auth = new Executor();
this.userInfoResource.onDataUpdate.addHandler(this.authUser.bind(this));
}
@@ -14,7 +14,7 @@ import {
GraphQLService,
} from '@cloudbeaver/core-sdk';
@injectable()
@injectable(() => [GraphQLService, SessionDataResource, SessionPermissionsResource])
export class AuthConfigurationParametersResource extends CachedMapResource<
string,
AuthProviderConfigurationParametersFragment[],
@@ -28,7 +28,7 @@ export type AuthConfiguration = AdminAuthProviderConfiguration;
type NewConfiguration = AuthConfiguration & { [NEW_CONFIGURATION_SYMBOL]: boolean; timestamp: number };
@injectable()
@injectable(() => [GraphQLService, SessionPermissionsResource])
export class AuthConfigurationsResource extends CachedMapResource<string, AuthConfiguration, GetAuthProviderConfigurationsQueryVariables> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -20,7 +20,7 @@ export interface IUserAuthConfiguration {
configuration: AuthProviderConfiguration;
}
@injectable()
@injectable(() => [UserInfoResource, WindowsService, AsyncTaskInfoService])
export class AuthInfoService {
get userInfo(): UserInfo | null {
return this.userInfoResource.data;
@@ -32,7 +32,7 @@ export interface RequestedProvider {
configurationId?: string;
}
@injectable()
@injectable(() => [AuthProvidersResource])
export class AuthProviderService {
readonly requestAuthProvider: IExecutor<RequestedProvider>;
@@ -26,7 +26,7 @@ import { AuthConfigurationsResource } from './AuthConfigurationsResource.js';
export type AuthProvider = NonNullable<AuthProviderInfoFragment>;
export type AuthProviderConfiguration = NonNullable<AuthProviderConfigurationInfoFragment>;
@injectable()
@injectable(() => [GraphQLService, ServerConfigResource, AuthConfigurationsResource])
export class AuthProvidersResource extends CachedMapResource<string, AuthProvider> {
get configurable(): AuthProvider[] {
return this.values.filter(provider => provider.configurable);
@@ -10,7 +10,7 @@ import { CachedDataResource } from '@cloudbeaver/core-resource';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { GraphQLService } from '@cloudbeaver/core-sdk';
@injectable()
@injectable(() => [GraphQLService, SessionPermissionsResource])
export class AuthRolesResource extends CachedDataResource<string[]> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -5,52 +5,43 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { describe } from 'vitest';
import { describe, expect, test } from 'vitest';
// import { coreClientActivityManifest } from '@cloudbeaver/core-client-activity';
// import { coreLocalizationManifest } from '@cloudbeaver/core-localization';
// import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root';
// import { createGQLEndpoint } from '@cloudbeaver/core-root/__custom_mocks__/createGQLEndpoint.js';
// import '@cloudbeaver/core-root/__custom_mocks__/expectWebsocketClosedMessage.js';
// import { mockAppInit } from '@cloudbeaver/core-root/__custom_mocks__/mockAppInit.js';
// import { mockGraphQL } from '@cloudbeaver/core-root/__custom_mocks__/mockGraphQL.js';
// import { mockServerConfig } from '@cloudbeaver/core-root/__custom_mocks__/resolvers/mockServerConfig.js';
// import { coreRoutingManifest } from '@cloudbeaver/core-routing';
// import { coreSDKManifest } from '@cloudbeaver/core-sdk';
// import { coreSettingsManifest } from '@cloudbeaver/core-settings';
// import { expectNoDeprecatedSettingMessage } from '@cloudbeaver/core-settings/__custom_mocks__/expectDeprecatedSettingMessage.js';
// import { createApp } from '@cloudbeaver/tests-runner';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { createGQLEndpoint } from '@cloudbeaver/core-root/__custom_mocks__/createGQLEndpoint.js';
import '@cloudbeaver/core-root/__custom_mocks__/expectWebsocketClosedMessage.js';
import { mockAppInit } from '@cloudbeaver/core-root/__custom_mocks__/mockAppInit.js';
import { mockGraphQL } from '@cloudbeaver/core-root/__custom_mocks__/mockGraphQL.js';
import { mockServerConfig } from '@cloudbeaver/core-root/__custom_mocks__/resolvers/mockServerConfig.js';
import { expectNoDeprecatedSettingMessage } from '@cloudbeaver/core-settings/__custom_mocks__/expectDeprecatedSettingMessage.js';
import { resetDeprecatedSettings } from '@cloudbeaver/core-settings/createSettingsAliasResolver.test.js';
import { createApp, initKnownConsoleMessages } from '@cloudbeaver/tests-runner';
// import { mockAuthentication } from './__custom_mocks__/mockAuthentication.js';
// import { AuthSettingsService } from './AuthSettingsService.js';
// import { coreAuthenticationManifest } from './manifest.js';
import { mockAuthentication } from './__custom_mocks__/mockAuthentication.js';
import { AuthSettingsService } from './AuthSettingsService.js';
import './module.js';
// const endpoint = createGQLEndpoint();
// const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint));
// const app = createApp(
// coreAuthenticationManifest,
// coreRootManifest,
// coreSDKManifest,
// coreSettingsManifest,
// coreRoutingManifest,
// coreLocalizationManifest,
// coreClientActivityManifest,
// );
describe.skip(() => {
const endpoint = createGQLEndpoint();
const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint));
const app = createApp();
// const equalConfig = {
// 'core.authentication.disableAnonymousAccess': true,
// };
const equalConfig = {
'core.authentication.disableAnonymousAccess': true,
};
// test('Read settings', async () => {
// const settings = app.serviceProvider.getService(AuthSettingsService);
// const config = app.serviceProvider.getService(ServerConfigResource);
initKnownConsoleMessages();
resetDeprecatedSettings();
// server.use(endpoint.query('serverConfig', mockServerConfig(equalConfig)));
test('Read settings', async () => {
const settings = app.serviceProvider.getService(AuthSettingsService);
const config = app.serviceProvider.getService(ServerConfigResource);
// await config.refresh();
server.use(endpoint.query('serverConfig', mockServerConfig(equalConfig)));
// expect(settings.disableAnonymousAccess).toBe(true);
// expectNoDeprecatedSettingMessage();
// });
await config.refresh();
describe.skip('AuthSettingsService', () => {});
expect(settings.disableAnonymousAccess).toBe(true);
expectNoDeprecatedSettingMessage();
});
});
@@ -15,7 +15,7 @@ const settingsSchema = schema.object({
export type AuthSettings = schema.infer<typeof settingsSchema>;
@injectable()
@injectable(() => [SettingsProviderService, SettingsManagerService])
export class AuthSettingsService {
get disableAnonymousAccess(): boolean {
return this.settings.getValue('core.authentication.disableAnonymousAccess');
@@ -8,7 +8,7 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
@injectable(() => [LocalizationService])
export class LocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
@@ -21,7 +21,7 @@ const DEFAULT_PASSWORD_POLICY: PasswordPolicyConfig = {
type ValidationResult = { isValid: true; errorMessage: null } | { isValid: false; errorMessage: string };
@injectable()
@injectable(() => [PasswordPolicyResource, LocalizationService])
export class PasswordPolicyService {
get config(): PasswordPolicyConfig {
return {
@@ -12,7 +12,7 @@ import { GraphQLService } from '@cloudbeaver/core-sdk';
import type { TeamMetaParameter } from './TeamMetaParametersResource.js';
import { TeamsResource } from './TeamsResource.js';
@injectable()
@injectable(() => [GraphQLService, TeamsResource])
export class TeamInfoMetaParametersResource extends CachedMapResource<string, TeamMetaParameter> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -12,7 +12,7 @@ import { GraphQLService, type ObjectPropertyInfo } from '@cloudbeaver/core-sdk';
export type TeamMetaParameter = ObjectPropertyInfo;
@injectable()
@injectable(() => [GraphQLService, SessionResource])
export class TeamMetaParametersResource extends CachedDataResource<TeamMetaParameter[]> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -12,7 +12,7 @@ import { GraphQLService } from '@cloudbeaver/core-sdk';
export const USER_TEAM_ROLE_SUPERVISOR = 'Supervisor';
@injectable()
@injectable(() => [GraphQLService, SessionPermissionsResource])
export class TeamRolesResource extends CachedDataResource<string[]> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -9,7 +9,7 @@ import { injectable } from '@cloudbeaver/core-di';
import { TeamsResource } from './TeamsResource.js';
@injectable()
@injectable(() => [TeamsResource])
export class TeamsManagerService {
constructor(readonly teams: TeamsResource) {}
}
@@ -32,7 +32,7 @@ export type UserTeamGrantInfo = UndefinedToNull<AdminUserTeamGrantInfo>;
type TeamResourceIncludes = Omit<GetTeamsListQueryVariables, 'teamId'>;
type NewTeam = TeamInfo & { [NEW_TEAM_SYMBOL]: boolean; timestamp: number };
@injectable()
@injectable(() => [GraphQLService])
export class TeamsResource extends CachedMapResource<string, TeamInfo, TeamResourceIncludes> {
constructor(private readonly graphQLService: GraphQLService) {
super();
@@ -9,7 +9,7 @@ import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { UserInfoResource } from './UserInfoResource.js';
@injectable()
@injectable(() => [UserInfoResource])
export class UserConfigurationBootstrap extends Bootstrap {
constructor(private readonly userInfoResource: UserInfoResource) {
super();
@@ -13,7 +13,7 @@ import { TempMap } from '@cloudbeaver/core-utils';
import { UserInfoResource } from './UserInfoResource.js';
@injectable()
@injectable(() => [UserInfoResource, StorageService])
export class UserDataService {
private readonly userData: Map<string, Record<string, any>>;
private readonly tempData: TempMap<string, Record<string, any>>;
@@ -12,7 +12,7 @@ import { GraphQLService } from '@cloudbeaver/core-sdk';
import { UserInfoResource } from './UserInfoResource.js';
import type { UserMetaParameter } from './UserMetaParametersResource.js';
@injectable()
@injectable(() => [GraphQLService, UserInfoResource])
export class UserInfoMetaParametersResource extends CachedDataResource<UserMetaParameter | undefined> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -32,7 +32,7 @@ export type IFederatedLoginOptions = Omit<ILoginOptions, 'credentials'>;
export const ANONYMOUS_USER_ID = 'anonymous';
export const UNAUTHORIZED_ID = 'unauthorized';
@injectable()
@injectable(() => [GraphQLService, AuthProviderService, SessionResource])
export class UserInfoResource extends CachedDataResource<UserInfo | null, void> {
readonly onUserChange: ISyncExecutor<string>;
readonly onException: ISyncExecutor<Error>;
@@ -21,7 +21,7 @@ export interface IUserMetaParameterOptions {
required: boolean;
}
@injectable()
@injectable(() => [GraphQLService, SessionResource, UserInfoResource])
export class UserMetaParametersResource extends CachedDataResource<UserMetaParameter[]> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -12,7 +12,7 @@ import { GraphQLService } from '@cloudbeaver/core-sdk';
import type { UserMetaParameter } from './UserMetaParametersResource.js';
import { UsersResource } from './UsersResource.js';
@injectable()
@injectable(() => [GraphQLService, UsersResource])
export class UsersMetaParametersResource extends CachedMapResource<string, UserMetaParameter> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -11,7 +11,7 @@ import { type AdminOriginDetailsFragment, GraphQLService } from '@cloudbeaver/co
import { UsersResource } from './UsersResource.js';
@injectable()
@injectable(() => [GraphQLService, UsersResource])
export class UsersOriginDetailsResource extends CachedMapResource<string, AdminOriginDetailsFragment> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ interface UserCreateOptions {
enabled?: boolean;
}
@injectable()
@injectable(() => [GraphQLService, ServerConfigResource, AuthProviderService, AuthInfoService, SessionPermissionsResource])
export class UsersResource extends CachedMapResource<string, AdminUser, UserResourceIncludes> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -1,11 +1,13 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 './module.js';
export * from './manifest.js';
export * from './ELMRole.js';
export * from './AppAuthService.js';
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,30 +11,4 @@ export const coreAuthenticationManifest: PluginManifest = {
info: {
name: 'Core Authentication',
},
providers: [
() => import('./AppAuthService.js').then(m => m.AppAuthService),
() => import('./AuthConfigurationParametersResource.js').then(m => m.AuthConfigurationParametersResource),
() => import('./AuthConfigurationsResource.js').then(m => m.AuthConfigurationsResource),
() => import('./AuthInfoService.js').then(m => m.AuthInfoService),
() => import('./AuthProviderService.js').then(m => m.AuthProviderService),
() => import('./AuthProvidersResource.js').then(m => m.AuthProvidersResource),
() => import('./AuthRolesResource.js').then(m => m.AuthRolesResource),
() => import('./AuthSettingsService.js').then(m => m.AuthSettingsService),
() => import('./LocaleService.js').then(m => m.LocaleService),
() => import('./PasswordPolicyService.js').then(m => m.PasswordPolicyService),
() => import('./TeamMetaParametersResource.js').then(m => m.TeamMetaParametersResource),
() => import('./TeamsManagerService.js').then(m => m.TeamsManagerService),
() => import('./TeamsResource.js').then(m => m.TeamsResource),
() => import('./TeamRolesResource.js').then(m => m.TeamRolesResource),
() => import('./UserConfigurationBootstrap.js').then(m => m.UserConfigurationBootstrap),
() => import('./UserInfoMetaParametersResource.js').then(m => m.UserInfoMetaParametersResource),
() => import('./UserDataService.js').then(m => m.UserDataService),
() => import('./UserInfoResource.js').then(m => m.UserInfoResource),
() => import('./UsersOriginDetailsResource.js').then(m => m.UsersOriginDetailsResource),
() => import('./UserMetaParametersResource.js').then(m => m.UserMetaParametersResource),
() => import('./UsersMetaParametersResource.js').then(m => m.UsersMetaParametersResource),
() => import('./TeamInfoMetaParametersResource.js').then(m => m.TeamInfoMetaParametersResource),
() => import('./UsersResource.js').then(m => m.UsersResource),
],
};
@@ -0,0 +1,78 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { Bootstrap, ModuleRegistry, proxy, Dependency } from '@cloudbeaver/core-di';
import { UsersResource } from './UsersResource.js';
import { UsersOriginDetailsResource } from './UsersOriginDetailsResource.js';
import { UsersMetaParametersResource } from './UsersMetaParametersResource.js';
import { UserInfoResource } from './UserInfoResource.js';
import { UserMetaParametersResource } from './UserMetaParametersResource.js';
import { UserInfoMetaParametersResource } from './UserInfoMetaParametersResource.js';
import { UserDataService } from './UserDataService.js';
import { UserConfigurationBootstrap } from './UserConfigurationBootstrap.js';
import { TeamsResource } from './TeamsResource.js';
import { TeamsManagerService } from './TeamsManagerService.js';
import { TeamRolesResource } from './TeamRolesResource.js';
import { TeamInfoMetaParametersResource } from './TeamInfoMetaParametersResource.js';
import { TeamMetaParametersResource } from './TeamMetaParametersResource.js';
import { LocaleService } from './LocaleService.js';
import { PasswordPolicyService } from './PasswordPolicyService.js';
import { AuthRolesResource } from './AuthRolesResource.js';
import { AuthSettingsService } from './AuthSettingsService.js';
import { AuthProvidersResource } from './AuthProvidersResource.js';
import { AuthProviderService } from './AuthProviderService.js';
import { AuthInfoService } from './AuthInfoService.js';
import { AuthConfigurationsResource } from './AuthConfigurationsResource.js';
import { AuthConfigurationParametersResource } from './AuthConfigurationParametersResource.js';
import { AppAuthService } from './AppAuthService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-authentication',
configure: serviceCollection => {
serviceCollection
.addSingleton(Bootstrap, LocaleService)
.addSingleton(Bootstrap, UserConfigurationBootstrap)
.addSingleton(Dependency, proxy(AppAuthService))
.addSingleton(Dependency, proxy(UsersResource))
.addSingleton(Dependency, proxy(UsersOriginDetailsResource))
.addSingleton(Dependency, proxy(UsersMetaParametersResource))
.addSingleton(Dependency, proxy(UserInfoResource))
.addSingleton(Dependency, proxy(UserMetaParametersResource))
.addSingleton(Dependency, proxy(UserInfoMetaParametersResource))
.addSingleton(Dependency, proxy(TeamsResource))
.addSingleton(Dependency, proxy(TeamRolesResource))
.addSingleton(Dependency, proxy(TeamInfoMetaParametersResource))
.addSingleton(Dependency, proxy(TeamMetaParametersResource))
.addSingleton(Dependency, proxy(AuthRolesResource))
.addSingleton(Dependency, proxy(AuthProvidersResource))
.addSingleton(Dependency, proxy(AuthConfigurationsResource))
.addSingleton(Dependency, proxy(AuthConfigurationParametersResource))
.addSingleton(AppAuthService)
.addSingleton(UsersResource)
.addSingleton(UsersOriginDetailsResource)
.addSingleton(UsersMetaParametersResource)
.addSingleton(UserInfoResource)
.addSingleton(UserMetaParametersResource)
.addSingleton(UserInfoMetaParametersResource)
.addSingleton(UserDataService)
.addSingleton(TeamsResource)
.addSingleton(TeamsManagerService)
.addSingleton(TeamRolesResource)
.addSingleton(TeamInfoMetaParametersResource)
.addSingleton(TeamMetaParametersResource)
.addSingleton(PasswordPolicyService)
.addSingleton(AuthRolesResource)
.addSingleton(AuthSettingsService)
.addSingleton(AuthProvidersResource)
.addSingleton(AuthProviderService)
.addSingleton(AuthInfoService)
.addSingleton(AuthConfigurationsResource)
.addSingleton(AuthConfigurationParametersResource);
},
});
@@ -55,6 +55,9 @@
},
{
"path": "../core-utils"
},
{
"path": "../tests-runner"
}
],
"include": [
+2
View File
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-blocks",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -8,7 +8,7 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
@injectable(() => [LocalizationService])
export class BlocksLocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
+2
View File
@@ -6,6 +6,8 @@
* you may not use this file except in compliance with the License.
*/
import './module.js';
export * from './AuthenticationProviderLoader.js';
export * from './useAuthenticationAction.js';
export * from './CommonDialog/CommonDialog/CommonDialogBody.js';
+1 -3
View File
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,6 +11,4 @@ export const coreBlocksManifest: PluginManifest = {
info: {
name: 'Core Blocks',
},
providers: [() => import('./BlocksLocaleService.js').then(m => m.BlocksLocaleService)],
};
+18
View File
@@ -0,0 +1,18 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { Bootstrap, ModuleRegistry } from '@cloudbeaver/core-di';
import { BlocksLocaleService } from './BlocksLocaleService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-blocks',
configure: serviceCollection => {
serviceCollection.addSingleton(Bootstrap, BlocksLocaleService);
},
});
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ export function useS<T extends ComponentStyle[]>(...componentStyles: [...T]): Ex
const stylesRef = useRef<ComponentStyle[]>([]);
const [patch, forceUpdate] = useState(0);
const loadedStyles = useRef<BaseStyles[]>([]);
const themeService = useService(ThemeService, true);
const themeService = useService(ThemeService);
const [currentThemeId, setCurrentThemeId] = useState(() => themeService?.themeId);
const lastThemeRef = useRef<string | undefined>(currentThemeId);
const filteredStyles = themeService
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-bootstrap",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -26,28 +26,28 @@ export async function bootstrap(plugins: PluginManifest[]): Promise<App> {
}
const { renderLayout } = await import('./renderLayout.js');
const render = renderLayout(app.getServiceProvider());
const render = renderLayout();
const unmountExecutor = new SyncExecutor();
unmountExecutor.addHandler(() => render.unmount());
app.onStart.before(unmountExecutor, undefined, data => data.preload);
app.onStart.addHandler(({ preload }) => {
if (!preload) {
render.renderApp();
render.renderApp(app.getServiceProvider());
}
});
app.onStart.addPostHandler((_, context) => {
const exception = context.getContext(executionExceptionContext);
if (exception.exception) {
render.renderError(exception.exception);
render.renderError(app.getServiceProvider(), exception.exception);
}
});
if (exception) {
render.renderError(exception);
render.renderError(app.getServiceProvider(), exception);
} else {
render.renderApp();
render.renderApp(app.getServiceProvider());
}
return app;
+2 -2
View File
@@ -1,11 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
// reexports
import { coreManifests } from './manifest.js';
export * from './bootstrap.js';
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -45,9 +45,6 @@ export const coreManifests: PluginManifest[] = [
info: {
name: 'DBeaver core',
},
depends: [],
providers: [],
},
coreDIManifest,
coreRoutingManifest, // important, should be first because the router starts in load phase first after all plugins register phase
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -10,18 +10,18 @@ import { createRoot, type Root } from 'react-dom/client';
import { BodyLazy } from '@cloudbeaver/core-app';
import { DisplayError, ErrorBoundary, Loader, s } from '@cloudbeaver/core-blocks';
import { HideAppLoadingScreen, IServiceProvider, ServiceProviderContext } from '@cloudbeaver/core-di';
import { HideAppLoadingScreen, IServiceProvider, ServiceProvider } from '@cloudbeaver/core-di';
import styles from './renderLayout.module.css';
interface IRender {
initRoot(): Root;
renderApp(): void;
renderError(exception?: any): void;
renderApp(serviceProvider: IServiceProvider | null): void;
renderError(serviceProvider: IServiceProvider | null, exception?: any): void;
unmount(): void;
}
export function renderLayout(serviceProvider: IServiceProvider): IRender {
export function renderLayout(): IRender {
let root: Root | undefined;
return {
@@ -45,30 +45,30 @@ export function renderLayout(serviceProvider: IServiceProvider): IRender {
root = undefined;
}
},
renderApp() {
renderApp(serviceProvider: IServiceProvider | null) {
this.initRoot().render(
<ErrorBoundary fallback={<HideAppLoadingScreen />} simple>
<ServiceProviderContext serviceProvider={serviceProvider}>
<ServiceProvider provider={serviceProvider!}>
<ErrorBoundary fallback={<HideAppLoadingScreen />} root>
<Suspense fallback={<Loader className={s(styles, { loader: true })} />}>
<BodyLazy />
<HideAppLoadingScreen />
</Suspense>
</ErrorBoundary>
</ServiceProviderContext>
</ServiceProvider>
</ErrorBoundary>,
);
},
renderError(exception?: any) {
renderError(serviceProvider: IServiceProvider | null, exception?: any) {
if (exception) {
console.error(exception);
}
this.initRoot().render(
<ErrorBoundary fallback={<HideAppLoadingScreen />} simple>
<ServiceProviderContext serviceProvider={serviceProvider}>
<ServiceProvider provider={serviceProvider!}>
<DisplayError error={exception} root />
<HideAppLoadingScreen />
</ServiceProviderContext>
</ServiceProvider>
</ErrorBoundary>,
);
},
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-browser-cookies",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -8,9 +8,9 @@
import { BrowserSettingsService } from '@cloudbeaver/core-browser-settings';
import { injectable } from '@cloudbeaver/core-di';
@injectable()
@injectable(() => [BrowserSettingsService])
export class CookiesService {
get cookiesEnabled() {
get cookiesEnabled(): boolean {
return !this.browserSettingsService.disabled;
}
@@ -1,9 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 './module.js';
export * from './CookiesService.js';
export * from './manifest.js';
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,6 +11,4 @@ export const coreBrowserCookiesManifest: PluginManifest = {
info: {
name: 'Core Browser Cookies',
},
providers: [() => import('./CookiesService.js').then(m => m.CookiesService)],
};
@@ -0,0 +1,18 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { ModuleRegistry } from '@cloudbeaver/core-di';
import { CookiesService } from './CookiesService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-browser-cookies',
configure: serviceCollection => {
serviceCollection.addSingleton(CookiesService);
},
});
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-browser-settings",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -5,7 +5,7 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Dependency, injectable } from '@cloudbeaver/core-di';
import { injectable } from '@cloudbeaver/core-di';
import {
createSettingsAliasResolver,
ROOT_SETTINGS_LAYER,
@@ -23,8 +23,8 @@ const settingsSchema = schema.object({
export type BrowserSettingsSchema = typeof settingsSchema;
export type CookiesSettings = schema.infer<BrowserSettingsSchema>;
@injectable()
export class BrowserSettingsService extends Dependency {
@injectable(() => [SettingsProviderService, SettingsManagerService, SettingsResolverService])
export class BrowserSettingsService {
get disabled(): boolean {
return this.settings.getValue('core.browser.cookies.disabled');
}
@@ -35,7 +35,6 @@ export class BrowserSettingsService extends Dependency {
private readonly settingsManagerService: SettingsManagerService,
private readonly settingsResolverService: SettingsResolverService,
) {
super();
this.settings = this.settingsProviderService.createSettings(settingsSchema);
this.settingsResolverService.addResolver(
@@ -8,7 +8,7 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
@injectable(() => [LocalizationService])
export class LocaleService extends Bootstrap {
constructor(private readonly localizationService: LocalizationService) {
super();
@@ -1,9 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 './module.js';
export * from './BrowserSettingsService.js';
export * from './manifest.js';
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,9 +11,4 @@ export const coreBrowserSettingsManifest: PluginManifest = {
info: {
name: 'Core Browser Settings',
},
providers: [
() => import('./BrowserSettingsService.js').then(m => m.BrowserSettingsService),
() => import('./LocaleService.js').then(m => m.LocaleService),
],
};
@@ -0,0 +1,22 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { Bootstrap, Dependency, ModuleRegistry, proxy } from '@cloudbeaver/core-di';
import { LocaleService } from './LocaleService.js';
import { BrowserSettingsService } from './BrowserSettingsService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-browser-settings',
configure: serviceCollection => {
serviceCollection
.addSingleton(Bootstrap, LocaleService)
.addSingleton(Dependency, proxy(BrowserSettingsService))
.addSingleton(BrowserSettingsService);
},
});
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-browser",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"lib/service-worker.js",
"src/**/*.css",
"src/**/*.scss",
@@ -28,7 +28,7 @@ interface IMessage {
type: 'init' | 'respond';
}
@injectable()
@injectable(() => [IndexedDBService])
export class LocalStorageSaveService {
get storage(): LocalStorageType {
return this.storageType;
@@ -1,23 +1,21 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { injectable, IPreloadService } from '@cloudbeaver/core-di';
import { ServiceWorkerService } from './ServiceWorkerService.js';
@injectable()
export class ServiceWorkerBootstrap extends Bootstrap {
constructor(private readonly serviceWorkerService: ServiceWorkerService) {
super();
}
override async register(): Promise<void> {
@injectable(() => [ServiceWorkerService])
export class ServiceWorkerBootstrap implements IPreloadService {
constructor(private readonly serviceWorkerService: ServiceWorkerService) {}
async register(): Promise<void> {
await this.serviceWorkerService.register();
}
override async load(): Promise<void> {
async load(): Promise<void> {
await this.serviceWorkerService.load();
}
}
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -5,6 +5,8 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import './module.js';
export * from './IndexedDB/IndexedDBService.js';
export * from './IndexedDB/IndexedDB.js';
export * from './LocalStorageSaveService.js';
+1 -10
View File
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,13 +11,4 @@ export const coreBrowserManifest: PluginManifest = {
info: {
name: 'Core Browser',
},
preload: [
() => import('./ServiceWorkerBootstrap.js').then(module => module.ServiceWorkerBootstrap),
() => import('./ServiceWorkerService.js').then(module => module.ServiceWorkerService),
],
providers: [
() => import('./IndexedDB/IndexedDBService.js').then(module => module.IndexedDBService),
() => import('./LocalStorageSaveService.js').then(module => module.LocalStorageSaveService),
],
};
@@ -0,0 +1,25 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { IPreloadService, ModuleRegistry } from '@cloudbeaver/core-di';
import { ServiceWorkerService } from './ServiceWorkerService.js';
import { ServiceWorkerBootstrap } from './ServiceWorkerBootstrap.js';
import { LocalStorageSaveService } from './LocalStorageSaveService.js';
import { IndexedDBService } from './IndexedDB/IndexedDBService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-browser',
configure: serviceCollection => {
serviceCollection
.addSingleton(IPreloadService, ServiceWorkerBootstrap)
.addSingleton(IndexedDBService)
.addSingleton(ServiceWorkerService)
.addSingleton(LocalStorageSaveService);
},
});
@@ -1,6 +1,7 @@
---
to: <%= name %>/src/index.ts
---
import './module.js';
import { <%= h.changeCase.camel(name) %>Manifest } from './manifest.js';
export default <%= h.changeCase.camel(name) %>Manifest;
@@ -7,6 +7,4 @@ export const <%= h.changeCase.camel(name) %>Manifest: PluginManifest = {
info: {
name: '<%= h.changeCase.sentence(name) %>',
},
providers: [() => import('./<%= h.changeCase.pascal(name) %>ServiceBootstrap.js').then(m => m.<%= h.changeCase.pascal(name) %>ServiceBootstrap)],
};
@@ -0,0 +1,14 @@
---
to: <%= name %>/src/module.ts
---
import { Bootstrap, ModuleRegistry } from '@cloudbeaver/core-di';
import { <%= h.changeCase.pascal(name) %>Bootstrap } from './<%= h.changeCase.pascal(name) %>Bootstrap.js';
ModuleRegistry.add({
name: '@cloudbeaver/<%= name %>',
configure: serviceCollection => {
serviceCollection
.addSingleton(Bootstrap, <%= h.changeCase.pascal(name) %>Bootstrap);
},
});
@@ -5,6 +5,8 @@ to: <%= name %>/package.json
"name": "@cloudbeaver/<%= name %>",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -1,10 +1,10 @@
---
to: <%= name %>/src/<%= h.changeCase.pascal(name) %>ServiceBootstrap.ts
to: <%= name %>/src/<%= h.changeCase.pascal(name) %>Bootstrap.ts
---
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
@injectable()
export class <%= h.changeCase.pascal(name) %>ServiceBootstrap extends Bootstrap {
export class <%= h.changeCase.pascal(name) %>Bootstrap extends Bootstrap {
constructor() {
super();
}
@@ -1,7 +1,7 @@
---
to: <%= name %>/tsconfig.json
---
<% isEE = cwd.includes('cloudbeaver-ee'); %>
{
"extends": "@cloudbeaver/tsconfig/tsconfig.json",
"compilerOptions": {
+2
View File
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-cli",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -8,7 +8,6 @@
export const KNOWN_PEER_DEPS_MAP: Record<string, string[]> = {
'mobx-react-lite': ['mobx', 'react-dom'],
'@testing-library/react': ['@testing-library/dom', 'react-dom'],
inversify: ['reflect-metadata'],
'@typescript-eslint/eslint-plugin': ['typescript'],
'react-minisearch': ['minisearch'],
};
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-client-activity",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -1,9 +1,11 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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 './module.js';
export * from './ClientActivityService.js';
export * from './manifest.js';
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -11,6 +11,4 @@ export const coreClientActivityManifest: PluginManifest = {
info: {
name: 'Core Client Activity',
},
providers: [() => import('./ClientActivityService.js').then(m => m.ClientActivityService)],
};
@@ -0,0 +1,18 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 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 { ModuleRegistry } from '@cloudbeaver/core-di';
import { ClientActivityService } from './ClientActivityService.js';
ModuleRegistry.add({
name: '@cloudbeaver/core-client-activity',
configure: serviceCollection => {
serviceCollection.addSingleton(ClientActivityService);
},
});
@@ -2,6 +2,8 @@
"name": "@cloudbeaver/core-connections",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
@@ -22,7 +22,7 @@ import {
export type ConnectionDialect = SqlDialectInfo;
@injectable()
@injectable(() => [GraphQLService, ProjectsService, ConnectionInfoResource])
export class ConnectionDialectResource extends CachedMapResource<IConnectionInfoParams, ConnectionDialect> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -33,7 +33,7 @@ export type IConnectionExecutionContextInfo = SqlContextInfo & {
defaultSchema?: string | null;
};
@injectable()
@injectable(() => [GraphQLService, ConnectionInfoResource, UserInfoResource, AppAuthService])
export class ConnectionExecutionContextResource extends CachedMapResource<string, IConnectionExecutionContextInfo> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ import type { IConnectionInfoParams } from '../CONNECTION_INFO_PARAM_SCHEMA.js';
import { ConnectionExecutionContext } from './ConnectionExecutionContext.js';
import { ConnectionExecutionContextResource } from './ConnectionExecutionContextResource.js';
@injectable()
@injectable(() => [ConnectionExecutionContextResource, AsyncTaskInfoService, GraphQLService])
export class ConnectionExecutionContextService {
private readonly contexts: MetadataMap<string, ConnectionExecutionContext>;
protected scheduler: TaskScheduler<string>;
@@ -11,7 +11,7 @@ import type { CbDatasourceFolderEvent as IConnectionFolderEvent } from '@cloudbe
export type { IConnectionFolderEvent };
@injectable()
@injectable(() => [SessionEventSource])
export class ConnectionFolderEventHandler extends TopicEventHandler<IConnectionFolderEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbDatasourceFolder, sessionEventSource);
@@ -35,7 +35,7 @@ export const CONNECTION_FOLDER_NAME_VALIDATION = /^(?!\.)[^\\/:\\"'<>|?*]+$/u;
export const ConnectionFolderProjectKey = resourceKeyAliasFactory('@connection-folder/project', (projectId: string) => ({ projectId }));
@injectable()
@injectable(() => [GraphQLService, SessionDataResource, AppAuthService])
export class ConnectionFolderResource extends CachedMapResource<IConnectionFolderParam, ConnectionFolder> {
constructor(
private readonly graphQLService: GraphQLService,
@@ -25,7 +25,7 @@ import { parseConnectionKey } from './parseConnectionKey.js';
export type ConnectionInfoAuthProperties = DatabaseConnectionAuthPropertiesFragment;
@injectable()
@injectable(() => [ProjectsService, GraphQLService, ConnectionInfoResource])
export class ConnectionInfoAuthPropertiesResource extends CachedMapResource<IConnectionInfoParams, ConnectionInfoAuthProperties> {
constructor(
private readonly projectsService: ProjectsService,
@@ -25,7 +25,7 @@ import { parseConnectionKey } from './parseConnectionKey.js';
export type ConnectionInfoCustomOptions = DatabaseConnectionCustomOptionsFragment;
@injectable()
@injectable(() => [ProjectsService, GraphQLService, ConnectionInfoResource])
export class ConnectionInfoCustomOptionsResource extends CachedMapResource<IConnectionInfoParams, ConnectionInfoCustomOptions> {
constructor(
private readonly projectsService: ProjectsService,
@@ -11,7 +11,7 @@ import type { CbDatasourceEvent as IConnectionInfoEvent } from '@cloudbeaver/cor
export type { IConnectionInfoEvent };
@injectable()
@injectable(() => [SessionEventSource])
export class ConnectionInfoEventHandler extends TopicEventHandler<IConnectionInfoEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbDatasource, sessionEventSource);
@@ -25,7 +25,7 @@ import { parseConnectionKey } from './parseConnectionKey.js';
export type ConnectionInfoNetworkHandlers = DatabaseConnectionNetworkHandlersFragment;
@injectable()
@injectable(() => [ProjectsService, GraphQLService, ConnectionInfoResource])
export class ConnectionInfoNetworkHandlersResource extends CachedMapResource<IConnectionInfoParams, ConnectionInfoNetworkHandlers> {
constructor(
private readonly projectsService: ProjectsService,

Some files were not shown because too many files have changed in this diff Show More