diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml new file mode 100644 index 0000000000..9ff8f68dce --- /dev/null +++ b/.github/workflows/frontend.yml @@ -0,0 +1,136 @@ +name: frontend + +on: + # Triggers the workflow on push or pull request events but only for the "devel" branch + pull_request: + branches: ["devel"] + paths: + - "webapp/**" # monitor for the frontend changes + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: macos-latest + defaults: + run: + working-directory: ./webapp + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + + - name: restore yarn cache + uses: actions/cache@v3 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: restore node_modules + uses: actions/cache@v3 + with: + path: "**/node_modules" + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node_modules- + + - name: restore typescript cache + uses: actions/cache@v3 + with: + path: "**/packages/*/dist" + key: ${{ runner.os }}-dist- + restore-keys: | + ${{ runner.os }}-dist- + + - name: yarn install + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: install + + - name: yarn lerna bootstrap + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: lerna bootstrap + + - name: build + uses: borales/actions-yarn@v4 + with: + dir: webapp/packages/product-default + cmd: build + + tests: + # macos slower for tests for some reason + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./webapp + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + + - name: restore yarn cache + uses: actions/cache@v3 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: restore node_modules + uses: actions/cache@v3 + with: + path: "**/node_modules" + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node_modules- + + - name: restore typescript cache + uses: actions/cache@v3 + with: + path: "**/packages/*/dist" + key: ${{ runner.os }}-dist-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-dist- + + - name: yarn install + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: install + + - name: yarn lerna bootstrap + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: lerna bootstrap + + - name: generate sdk + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: pretest + + - name: run test + uses: borales/actions-yarn@v4 + with: + dir: webapp + cmd: lerna run test diff --git a/.github/workflows/jest-tests-runner.yml b/.github/workflows/jest-tests-runner.yml deleted file mode 100644 index 06d1e52517..0000000000 --- a/.github/workflows/jest-tests-runner.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Run Jest Tests - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the "devel" branch - pull_request: - branches: ["devel"] - paths: - - "webapp/**" # monitor for the frontend changes - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - run-jest-tests: - # The type of runner that the job will run on - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./webapp - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: "18" - - - name: Cache node modules - id: cache-npm - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - name: List the state of node modules - continue-on-error: true - run: npm list - - - name: Run install - uses: borales/actions-yarn@v4 - with: - dir: webapp - cmd: install - - - name: Run lerna bootstrap - uses: borales/actions-yarn@v4 - with: - dir: webapp - cmd: lerna bootstrap - - - name: Run pre test - uses: borales/actions-yarn@v4 - with: - dir: webapp - cmd: pretest - - - name: Run test - uses: borales/actions-yarn@v4 - with: - dir: webapp - cmd: lerna run test diff --git a/.github/workflows/commit-msgs-validator.yml b/.github/workflows/validation.yml similarity index 73% rename from .github/workflows/commit-msgs-validator.yml rename to .github/workflows/validation.yml index a7f16300ca..9ccd4113b7 100644 --- a/.github/workflows/commit-msgs-validator.yml +++ b/.github/workflows/validation.yml @@ -1,4 +1,4 @@ -name: "Commit Message Validation" +name: validation on: pull_request: @@ -11,7 +11,7 @@ on: - edited - ready_for_review - labeled - + jobs: - validate-commit-message: - uses: dbeaver/dbeaver/.github/workflows/reused-commit-msgs-validator.yml@devel \ No newline at end of file + commit-message: + uses: dbeaver/dbeaver/.github/workflows/reused-commit-msgs-validator.yml@devel diff --git a/.vscode/settings.json b/.vscode/settings.json index 3a4e57c664..21924f722a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,6 +9,7 @@ "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx16G -Xms100m -Xlog:disable", "java.compile.nullAnalysis.mode": "automatic", + "typescript.preferences.useAliasesForRenames": false, "typescript.preferences.importModuleSpecifier": "relative", "typescript.preferences.includePackageJsonAutoImports": "on", "typescript.preferences.quoteStyle": "single", @@ -21,7 +22,6 @@ "typescript", "typescriptreact" ], - "eslint.packageManager": "yarn", "eslint.workingDirectories": ["webapp"], "editor.defaultFormatter": "esbenp.prettier-vscode", diff --git a/webapp/package.json b/webapp/package.json index 63ad774fe7..62d3eea0c5 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -11,8 +11,8 @@ ] }, "scripts": { - "prebuild": "npm run clean-dist && lerna run gql:gen --stream --parallel", - "pretest": "npm run clean-dist && lerna run gql:gen --stream --parallel", + "prebuild": "lerna run gql:gen --stream --parallel", + "pretest": "lerna run gql:gen --stream --parallel && yarn lerna run test --scope @cloudbeaver/tests-runner", "clean-dist": "rimraf --glob lib/*" }, "devDependencies": { diff --git a/webapp/packages/core-administration/package.json b/webapp/packages/core-administration/package.json index b54668c33a..7ca5df9fb5 100644 --- a/webapp/packages/core-administration/package.json +++ b/webapp/packages/core-administration/package.json @@ -1,42 +1,47 @@ { "name": "@cloudbeaver/core-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", + "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" }, - "devDependencies": { - "@cloudbeaver/core-theming": "~0.1.0" - }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "^6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-administration/src/AdministrationSettingsService.test.ts b/webapp/packages/core-administration/src/AdministrationSettingsService.test.ts index 1aab7c0b30..87115d0dec 100644 --- a/webapp/packages/core-administration/src/AdministrationSettingsService.test.ts +++ b/webapp/packages/core-administration/src/AdministrationSettingsService.test.ts @@ -7,20 +7,39 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { createApp } from '@cloudbeaver/tests-runner'; import { AdministrationSettings, AdministrationSettingsService } from './AdministrationSettingsService'; +import { coreAdministrationManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreAdministrationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + // coreRoutingManifest, + // coreThemingManifest, + coreLocalizationManifest, +); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-administration/src/DataContext/DATA_CONTEXT_ADMINISTRATION_ITEM_ROUTE.ts b/webapp/packages/core-administration/src/DataContext/DATA_CONTEXT_ADMINISTRATION_ITEM_ROUTE.ts index fc62d08814..834863c6fa 100644 --- a/webapp/packages/core-administration/src/DataContext/DATA_CONTEXT_ADMINISTRATION_ITEM_ROUTE.ts +++ b/webapp/packages/core-administration/src/DataContext/DATA_CONTEXT_ADMINISTRATION_ITEM_ROUTE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { IAdministrationItemRoute } from '../AdministrationItem/IAdministrationItemRoute'; diff --git a/webapp/packages/core-administration/src/PermissionsResource.ts b/webapp/packages/core-administration/src/PermissionsResource.ts index bc89f74b47..fb2556afe0 100644 --- a/webapp/packages/core-administration/src/PermissionsResource.ts +++ b/webapp/packages/core-administration/src/PermissionsResource.ts @@ -6,15 +6,9 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapAllKey, CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { SessionDataResource } from '@cloudbeaver/core-root'; -import { - AdminObjectGrantInfoFragment, - AdminPermissionInfoFragment, - CachedMapAllKey, - CachedMapResource, - GraphQLService, - resourceKeyList, -} from '@cloudbeaver/core-sdk'; +import { AdminObjectGrantInfoFragment, AdminPermissionInfoFragment, GraphQLService } from '@cloudbeaver/core-sdk'; export type PermissionInfo = AdminPermissionInfoFragment; export type AdminObjectGrantInfo = AdminObjectGrantInfoFragment; diff --git a/webapp/packages/core-administration/src/index.ts b/webapp/packages/core-administration/src/index.ts index 794014aa75..a3e206db91 100644 --- a/webapp/packages/core-administration/src/index.ts +++ b/webapp/packages/core-administration/src/index.ts @@ -1,4 +1,4 @@ -export { manifest as coreAdministrationManifest } from './manifest'; +export * from './manifest'; export * from './AdministrationItem/AdministrationItemService'; export * from './AdministrationItem/filterConfigurationWizard'; export * from './AdministrationItem/IAdministrationItem'; diff --git a/webapp/packages/core-administration/src/manifest.ts b/webapp/packages/core-administration/src/manifest.ts index 1e1bd39108..2a22f87096 100644 --- a/webapp/packages/core-administration/src/manifest.ts +++ b/webapp/packages/core-administration/src/manifest.ts @@ -14,7 +14,7 @@ import { ConfigurationWizardService } from './AdministrationScreen/Configuration import { AdministrationSettingsService } from './AdministrationSettingsService'; import { PermissionsResource } from './PermissionsResource'; -export const manifest: PluginManifest = { +export const coreAdministrationManifest: PluginManifest = { info: { name: 'Core Administration', }, diff --git a/webapp/packages/core-administration/tsconfig.json b/webapp/packages/core-administration/tsconfig.json index bd4ed8f7d0..1534e7aee2 100644 --- a/webapp/packages/core-administration/tsconfig.json +++ b/webapp/packages/core-administration/tsconfig.json @@ -1,10 +1,67 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-app/package.json b/webapp/packages/core-app/package.json index a4bfeb742e..f75bcbdfe2 100644 --- a/webapp/packages/core-app/package.json +++ b/webapp/packages/core-app/package.json @@ -1,31 +1,31 @@ { "name": "@cloudbeaver/core-app", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-tools-panel": "~0.1.0", "@cloudbeaver/plugin-version": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-notifications": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", @@ -37,5 +37,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-app/src/AppScreen/AppScreenService.ts b/webapp/packages/core-app/src/AppScreen/AppScreenService.ts index 37991bc238..fb1c7a4cc5 100644 --- a/webapp/packages/core-app/src/AppScreen/AppScreenService.ts +++ b/webapp/packages/core-app/src/AppScreen/AppScreenService.ts @@ -12,8 +12,12 @@ import { injectable } from '@cloudbeaver/core-di'; export class AppScreenService { static screenName = 'app'; readonly placeholder: PlaceholderContainer; + readonly rightAreaTop: PlaceholderContainer; + readonly rightAreaBottom: PlaceholderContainer; constructor() { this.placeholder = new PlaceholderContainer(); + this.rightAreaTop = new PlaceholderContainer(); + this.rightAreaBottom = new PlaceholderContainer(); } } diff --git a/webapp/packages/core-app/src/AppScreen/RightArea.tsx b/webapp/packages/core-app/src/AppScreen/RightArea.tsx index 105104905b..e54ca208d3 100644 --- a/webapp/packages/core-app/src/AppScreen/RightArea.tsx +++ b/webapp/packages/core-app/src/AppScreen/RightArea.tsx @@ -7,12 +7,23 @@ */ import { observer } from 'mobx-react-lite'; -import { Loader, Pane, ResizerControls, s, SlideBox, SlideElement, SlideOverlay, Split, useS, useSplitUserState } from '@cloudbeaver/core-blocks'; +import { + Loader, + Pane, + Placeholder, + ResizerControls, + s, + SlideBox, + SlideElement, + SlideOverlay, + Split, + useS, + useSplitUserState, +} from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { OptionsPanelService } from '@cloudbeaver/core-ui'; -import { NavigationTabsBar } from '@cloudbeaver/plugin-navigation-tabs'; -import { ToolsPanel, ToolsPanelService } from '@cloudbeaver/plugin-tools-panel'; +import { AppScreenService } from './AppScreenService'; import style from './RightArea.m.css'; interface Props { @@ -21,14 +32,13 @@ interface Props { export const RightArea = observer(function RightArea({ className }) { const styles = useS(style); - const toolsPanelService = useService(ToolsPanelService); + const appScreenService = useService(AppScreenService); const optionsPanelService = useService(OptionsPanelService); const splitState = useSplitUserState('right-area'); const OptionsPanel = optionsPanelService.getPanelComponent(); - const activeTools = toolsPanelService.tabsContainer.getDisplayed(); - const toolsDisabled = activeTools.length === 0 || toolsPanelService.disabled; + const toolsDisabled = appScreenService.rightAreaBottom.getDisplayed({}).length === 0; return ( @@ -41,13 +51,13 @@ export const RightArea = observer(function RightArea({ className }) { - + - + diff --git a/webapp/packages/core-app/src/Body.tsx b/webapp/packages/core-app/src/Body.tsx index 6b8edd8dba..3e611d406c 100644 --- a/webapp/packages/core-app/src/Body.tsx +++ b/webapp/packages/core-app/src/Body.tsx @@ -8,14 +8,13 @@ import { observer } from 'mobx-react-lite'; import { useLayoutEffect, useRef } from 'react'; -import { Loader, s, useResource, useS, useStyles } from '@cloudbeaver/core-blocks'; +import { DialogsPortal, Loader, s, useResource, useS, useStyles } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { DialogsPortal } from '@cloudbeaver/core-dialogs'; import { Notifications } from '@cloudbeaver/core-notifications'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { SessionPermissionsResource } from '@cloudbeaver/core-root'; import { ScreenService } from '@cloudbeaver/core-routing'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { ThemeService } from '@cloudbeaver/core-theming'; import { DNDProvider } from '@cloudbeaver/core-ui'; import { useAppVersion } from '@cloudbeaver/plugin-version'; diff --git a/webapp/packages/core-app/tsconfig.json b/webapp/packages/core-app/tsconfig.json index bd4ed8f7d0..ce2e14d9b8 100644 --- a/webapp/packages/core-app/tsconfig.json +++ b/webapp/packages/core-app/tsconfig.json @@ -1,10 +1,61 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-version" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-notifications" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-authentication/package.json b/webapp/packages/core-authentication/package.json index 9481cdbb57..3075b47896 100644 --- a/webapp/packages/core-authentication/package.json +++ b/webapp/packages/core-authentication/package.json @@ -1,37 +1,43 @@ { "name": "@cloudbeaver/core-authentication", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-routing": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-routing": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", - "@cloudbeaver/core-settings": "~0.1.0" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "msw": "~1.x.x", "@testing-library/jest-dom": "^6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-authentication/src/AppAuthService.ts b/webapp/packages/core-authentication/src/AppAuthService.ts index 80076210c5..06a1b9dabd 100644 --- a/webapp/packages/core-authentication/src/AppAuthService.ts +++ b/webapp/packages/core-authentication/src/AppAuthService.ts @@ -7,8 +7,8 @@ */ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { Executor, ExecutorInterrupter, IExecutor } from '@cloudbeaver/core-executor'; +import { CachedDataResourceKey, CachedResource, getCachedDataResourceLoaderState } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedDataResourceKey, CachedResource, getCachedDataResourceLoaderState } from '@cloudbeaver/core-sdk'; import type { ILoadableState } from '@cloudbeaver/core-utils'; import { UserInfoResource } from './UserInfoResource'; diff --git a/webapp/packages/core-authentication/src/AuthConfigurationParametersResource.ts b/webapp/packages/core-authentication/src/AuthConfigurationParametersResource.ts index c495cd2688..60d8274903 100644 --- a/webapp/packages/core-authentication/src/AuthConfigurationParametersResource.ts +++ b/webapp/packages/core-authentication/src/AuthConfigurationParametersResource.ts @@ -6,15 +6,12 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapResource, isResourceAlias, type ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { SessionDataResource, SessionPermissionsResource } from '@cloudbeaver/core-root'; import { AuthProviderConfigurationParametersFragment, - CachedMapResource, GetAuthProviderConfigurationParametersQueryVariables, GraphQLService, - isResourceAlias, - ResourceKey, - ResourceKeyUtils, } from '@cloudbeaver/core-sdk'; import { EAdminPermission } from './EAdminPermission'; diff --git a/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts b/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts index 92bc6f7538..552e41df96 100644 --- a/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts +++ b/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts @@ -8,20 +8,17 @@ import { runInAction } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; -import { SessionPermissionsResource } from '@cloudbeaver/core-root'; import { - AdminAuthProviderConfiguration, CachedMapAllKey, CachedMapResource, - GetAuthProviderConfigurationsQueryVariables, - GraphQLService, isResourceAlias, - ResourceKey, - ResourceKeyList, + type ResourceKey, resourceKeyList, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { SessionPermissionsResource } from '@cloudbeaver/core-root'; +import { AdminAuthProviderConfiguration, GetAuthProviderConfigurationsQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk'; import type { AuthProviderConfiguration } from './AuthProvidersResource'; import { EAdminPermission } from './EAdminPermission'; @@ -76,7 +73,7 @@ export class AuthConfigurationsResource extends CachedMapResource): Promise> { - const all = this.isAlias(originalKey, CachedMapAllKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); const configurationsList: AuthConfiguration[] = []; await ResourceKeyUtils.forEachAsync(originalKey, async key => { diff --git a/webapp/packages/core-authentication/src/AuthProvidersResource.ts b/webapp/packages/core-authentication/src/AuthProvidersResource.ts index 7213aaada3..62a6522df2 100644 --- a/webapp/packages/core-authentication/src/AuthProvidersResource.ts +++ b/webapp/packages/core-authentication/src/AuthProvidersResource.ts @@ -8,18 +8,16 @@ import { computed, makeObservable, runInAction } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; import { - AuthProviderConfigurationInfoFragment, - AuthProviderInfoFragment, CachedMapAllKey, CachedMapResource, - GraphQLService, - ResourceKey, + type ResourceKey, resourceKeyList, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { ServerConfigResource } from '@cloudbeaver/core-root'; +import { AuthProviderConfigurationInfoFragment, AuthProviderInfoFragment, GraphQLService } from '@cloudbeaver/core-sdk'; import { AuthConfigurationsResource } from './AuthConfigurationsResource'; import { AuthSettingsService } from './AuthSettingsService'; @@ -105,7 +103,7 @@ export class AuthProvidersResource extends CachedMapResource): Promise> { - const all = this.isAlias(originalKey, CachedMapAllKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); const { providers } = await this.graphQLService.sdk.getAuthProviders(); diff --git a/webapp/packages/core-authentication/src/AuthRolesResource.ts b/webapp/packages/core-authentication/src/AuthRolesResource.ts index d48feab975..564cfeafea 100644 --- a/webapp/packages/core-authentication/src/AuthRolesResource.ts +++ b/webapp/packages/core-authentication/src/AuthRolesResource.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { SessionPermissionsResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService } from '@cloudbeaver/core-sdk'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; import { EAdminPermission } from './EAdminPermission'; diff --git a/webapp/packages/core-authentication/src/AuthSettingsService.test.ts b/webapp/packages/core-authentication/src/AuthSettingsService.test.ts index 42186566ce..4553fddc7b 100644 --- a/webapp/packages/core-authentication/src/AuthSettingsService.test.ts +++ b/webapp/packages/core-authentication/src/AuthSettingsService.test.ts @@ -7,18 +7,40 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { createApp } from '@cloudbeaver/tests-runner'; +import { mockAuthentication } from './__custom_mocks__/mockAuthentication'; import { AuthSettings, AuthSettingsService } from './AuthSettingsService'; +import { coreAuthenticationManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreAuthenticationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + coreRoutingManifest, + coreThemingManifest, + coreLocalizationManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/core-authentication/src/DATA_CONTEXT_USER.ts b/webapp/packages/core-authentication/src/DATA_CONTEXT_USER.ts index c37f85296d..8704ffdb51 100644 --- a/webapp/packages/core-authentication/src/DATA_CONTEXT_USER.ts +++ b/webapp/packages/core-authentication/src/DATA_CONTEXT_USER.ts @@ -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 { createDataContext } from '@cloudbeaver/core-data-context'; import type { UserInfo } from '@cloudbeaver/core-sdk'; -import { createDataContext } from '@cloudbeaver/core-view'; export const DATA_CONTEXT_USER = createDataContext('user-info', () => null); diff --git a/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts b/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts index 3079c0b470..2b395eeae4 100644 --- a/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { SessionResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService, ObjectPropertyInfo } from '@cloudbeaver/core-sdk'; +import { GraphQLService, ObjectPropertyInfo } from '@cloudbeaver/core-sdk'; export type TeamMetaParameter = ObjectPropertyInfo; diff --git a/webapp/packages/core-authentication/src/TeamsResource.ts b/webapp/packages/core-authentication/src/TeamsResource.ts index a781f04ab2..4e31a61bec 100644 --- a/webapp/packages/core-authentication/src/TeamsResource.ts +++ b/webapp/packages/core-authentication/src/TeamsResource.ts @@ -7,18 +7,15 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { - AdminConnectionGrantInfo, - AdminTeamInfoFragment, CachedMapAllKey, CachedMapResource, - GetTeamsListQueryVariables, - GraphQLService, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyList, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { AdminConnectionGrantInfo, AdminTeamInfoFragment, GetTeamsListQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; const NEW_TEAM_SYMBOL = Symbol('new-team'); @@ -120,7 +117,7 @@ export class TeamsResource extends CachedMapResource, includes?: string[]): Promise> { - const all = this.isAlias(originalKey, CachedMapAllKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); const teamsList: TeamInfo[] = []; await ResourceKeyUtils.forEachAsync(originalKey, async key => { diff --git a/webapp/packages/core-authentication/src/UserInfoResource.ts b/webapp/packages/core-authentication/src/UserInfoResource.ts index 4f39ea584b..682a2a9d0d 100644 --- a/webapp/packages/core-authentication/src/UserInfoResource.ts +++ b/webapp/packages/core-authentication/src/UserInfoResource.ts @@ -9,17 +9,9 @@ import { computed, makeObservable, runInAction } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; import { AutoRunningTask, ISyncExecutor, ITask, SyncExecutor, whileTask } from '@cloudbeaver/core-executor'; +import { CachedDataResource, type ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { SessionDataResource, SessionResource } from '@cloudbeaver/core-root'; -import { - AuthInfo, - AuthStatus, - CachedDataResource, - GetActiveUserQueryVariables, - GraphQLService, - ResourceKeySimple, - ResourceKeyUtils, - UserInfo, -} from '@cloudbeaver/core-sdk'; +import { AuthInfo, AuthStatus, GetActiveUserQueryVariables, GraphQLService, UserInfo } from '@cloudbeaver/core-sdk'; import { AUTH_PROVIDER_LOCAL_ID } from './AUTH_PROVIDER_LOCAL_ID'; import { AuthProviderService } from './AuthProviderService'; diff --git a/webapp/packages/core-authentication/src/UserMetaParametersResource.ts b/webapp/packages/core-authentication/src/UserMetaParametersResource.ts index 2ea613f163..de7cb60021 100644 --- a/webapp/packages/core-authentication/src/UserMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/UserMetaParametersResource.ts @@ -7,8 +7,9 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { SessionResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService, UserConnectionAuthPropertiesFragment } from '@cloudbeaver/core-sdk'; +import { GraphQLService, UserConnectionAuthPropertiesFragment } from '@cloudbeaver/core-sdk'; import { UserInfoResource } from './UserInfoResource'; diff --git a/webapp/packages/core-authentication/src/UsersResource.ts b/webapp/packages/core-authentication/src/UsersResource.ts index b1c7900403..fc53b3067b 100644 --- a/webapp/packages/core-authentication/src/UsersResource.ts +++ b/webapp/packages/core-authentication/src/UsersResource.ts @@ -6,27 +6,23 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; -import { ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root'; import { - AdminConnectionGrantInfo, - AdminUserInfo, - AdminUserInfoFragment, CACHED_RESOURCE_DEFAULT_PAGE_LIMIT, CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedMapAllKey, CachedMapResource, - CachedResourcePageKey, - CachedResourcePageListKey, - GetUsersListQueryVariables, - GraphQLService, + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyList, resourceKeyListAlias, resourceKeyListAliasFactory, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root'; +import { AdminConnectionGrantInfo, AdminUserInfo, AdminUserInfoFragment, GetUsersListQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk'; import { AUTH_PROVIDER_LOCAL_ID } from './AUTH_PROVIDER_LOCAL_ID'; import { AuthInfoService } from './AuthInfoService'; @@ -70,7 +66,7 @@ export class UsersResource extends CachedMapResource + this.aliases.add(UsersResourceFilterKey, key => resourceKeyList( this.entries .filter( @@ -81,7 +77,7 @@ export class UsersResource extends CachedMapResource { + this.aliases.add(UsersResourceNewUsers, () => { const orderedKeys = this.entries .filter(k => isNewUser(k[1])) .sort((a, b) => compareUsers(a[1], b[1])) @@ -218,7 +214,7 @@ export class UsersResource extends CachedMapResource, includes?: string[]): Promise> { - const all = this.isAlias(originalKey, CachedMapAllKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); if (all) { throw new Error('Loading all users is prohibited'); @@ -242,8 +238,9 @@ export class UsersResource extends CachedMapResource = function ConfirmationDialogDelete({ payload, diff --git a/webapp/packages/core-dialogs/src/CommonDialog/DialogContext.ts b/webapp/packages/core-blocks/src/CommonDialog/DialogContext.ts similarity index 87% rename from webapp/packages/core-dialogs/src/CommonDialog/DialogContext.ts rename to webapp/packages/core-blocks/src/CommonDialog/DialogContext.ts index 15c197859e..19f9317cae 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/DialogContext.ts +++ b/webapp/packages/core-blocks/src/CommonDialog/DialogContext.ts @@ -7,7 +7,7 @@ */ import { createContext } from 'react'; -import type { DialogInternal } from './CommonDialogService'; +import type { DialogInternal } from '@cloudbeaver/core-dialogs'; export interface IDialogContext { visible: boolean; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.m.css b/webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.m.css similarity index 100% rename from webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.m.css rename to webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.m.css diff --git a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx b/webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.tsx similarity index 93% rename from webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx rename to webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.tsx index f7b8d7c96b..226792bb5e 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx +++ b/webapp/packages/core-blocks/src/CommonDialog/DialogsPortal.tsx @@ -9,10 +9,14 @@ import { observer } from 'mobx-react-lite'; import { useLayoutEffect, useMemo, useRef } from 'react'; import { DialogBackdrop } from 'reakit/Dialog'; -import { ErrorBoundary, Loader, s, useObjectRef, useS } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; +import { CommonDialogService, DialogInternal } from '@cloudbeaver/core-dialogs'; -import { CommonDialogService, DialogInternal } from './CommonDialogService'; +import { ErrorBoundary } from '../ErrorBoundary'; +import { Loader } from '../Loader/Loader'; +import { s } from '../s'; +import { useObjectRef } from '../useObjectRef'; +import { useS } from '../useS'; import { DialogContext, IDialogContext } from './DialogContext'; import style from './DialogsPortal.m.css'; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.m.css b/webapp/packages/core-blocks/src/CommonDialog/RenameDialog.m.css similarity index 100% rename from webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.m.css rename to webapp/packages/core-blocks/src/CommonDialog/RenameDialog.m.css diff --git a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx b/webapp/packages/core-blocks/src/CommonDialog/RenameDialog.tsx similarity index 87% rename from webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx rename to webapp/packages/core-blocks/src/CommonDialog/RenameDialog.tsx index 0a9bafeb86..9c013dcaf1 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx +++ b/webapp/packages/core-blocks/src/CommonDialog/RenameDialog.tsx @@ -9,14 +9,23 @@ import { observable } from 'mobx'; import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; -import { Button, Container, Fill, Form, InputField, s, useFocus, useObservableRef, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { throttleAsync } from '@cloudbeaver/core-utils'; +import { Button } from '../Button'; +import { Container } from '../Containers/Container'; +import { Fill } from '../Fill'; +import { Form } from '../FormControls/Form'; +import { InputField } from '../FormControls/InputField'; +import { useTranslate } from '../localization/useTranslate'; +import { s } from '../s'; +import { useFocus } from '../useFocus'; +import { useObservableRef } from '../useObservableRef'; +import { useS } from '../useS'; import { CommonDialogBody } from './CommonDialog/CommonDialogBody'; import { CommonDialogFooter } from './CommonDialog/CommonDialogFooter'; import { CommonDialogHeader } from './CommonDialog/CommonDialogHeader'; import { CommonDialogWrapper } from './CommonDialog/CommonDialogWrapper'; -import type { DialogComponent } from './CommonDialogService'; import style from './RenameDialog.m.css'; interface IRenameDialogState { diff --git a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.m.css b/webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorDetailsDialog.m.css similarity index 100% rename from webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.m.css rename to webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorDetailsDialog.m.css diff --git a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx b/webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorDetailsDialog.tsx similarity index 76% rename from webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx rename to webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorDetailsDialog.tsx index 35bd0e3044..5159a35e4c 100644 --- a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx +++ b/webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorDetailsDialog.tsx @@ -8,9 +8,19 @@ import { observer } from 'mobx-react-lite'; import { useCallback, useMemo } from 'react'; -import { Button, Iframe, s, Textarea, useClipboard, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; +import { Button } from '../Button'; +import { CommonDialogBody } from '../CommonDialog/CommonDialog/CommonDialogBody'; +import { CommonDialogFooter } from '../CommonDialog/CommonDialog/CommonDialogFooter'; +import { CommonDialogHeader } from '../CommonDialog/CommonDialog/CommonDialogHeader'; +import { CommonDialogWrapper } from '../CommonDialog/CommonDialog/CommonDialogWrapper'; +import { Textarea } from '../FormControls/Textarea'; +import { Iframe } from '../Iframe'; +import { useTranslate } from '../localization/useTranslate'; +import { s } from '../s'; +import { useClipboard } from '../useClipboard'; +import { useS } from '../useS'; import style from './ErrorDetailsDialog.m.css'; import { ErrorModel, IErrorInfo } from './ErrorModel'; diff --git a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorModel.ts b/webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorModel.ts similarity index 100% rename from webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorModel.ts rename to webapp/packages/core-blocks/src/ErrorDetailsDialog/ErrorModel.ts diff --git a/webapp/packages/core-blocks/src/ErrorMessage.test.tsx b/webapp/packages/core-blocks/src/ErrorMessage.test.tsx index d665b95b63..4771230e67 100644 --- a/webapp/packages/core-blocks/src/ErrorMessage.test.tsx +++ b/webapp/packages/core-blocks/src/ErrorMessage.test.tsx @@ -8,19 +8,36 @@ import '@testing-library/jest-dom'; import { screen } from '@testing-library/react'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { renderInApp } from '@cloudbeaver/core-cli/tests/utils/renderInApp'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { createApp, renderInApp } from '@cloudbeaver/tests-runner'; import { ErrorMessage } from './ErrorMessage'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + coreThemingManifest, + coreLocalizationManifest, +); -mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-blocks/src/LoadingScreen/LoadingScreen.tsx b/webapp/packages/core-blocks/src/LoadingScreen/LoadingScreen.tsx index 1815311c77..5b93f9eaef 100644 --- a/webapp/packages/core-blocks/src/LoadingScreen/LoadingScreen.tsx +++ b/webapp/packages/core-blocks/src/LoadingScreen/LoadingScreen.tsx @@ -8,7 +8,7 @@ import { useEffect, useRef } from 'react'; import styled from 'reshadow'; -import { Icon } from '../Icons'; +import { Icon } from '../Icon'; import styles from './loading-screen.css'; const FADE_IN_DELAY = 300; diff --git a/webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuPanelItem.tsx b/webapp/packages/core-blocks/src/MenuPanel/MenuPanelItem.tsx similarity index 79% rename from webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuPanelItem.tsx rename to webapp/packages/core-blocks/src/MenuPanel/MenuPanelItem.tsx index 5ce04d7bc5..9368853e9b 100644 --- a/webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuPanelItem.tsx +++ b/webapp/packages/core-blocks/src/MenuPanel/MenuPanelItem.tsx @@ -8,10 +8,16 @@ import { observer } from 'mobx-react-lite'; import styled, { use } from 'reshadow'; -import { Checkbox, Icon, IconOrImage, Loader, Radio, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; +import type { IMenuItem } from '@cloudbeaver/core-dialogs'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import type { IMenuItem } from '../IMenuPanel'; +import { Checkbox } from '../FormControls/Checkboxes/Checkbox'; +import { Radio } from '../FormControls/Radio'; +import { Icon } from '../Icon'; +import { IconOrImage } from '../IconOrImage'; +import { Loader } from '../Loader/Loader'; +import { useTranslate } from '../localization/useTranslate'; +import { useStyles } from '../useStyles'; import { menuPanelStyles } from './menuPanelStyles'; interface MenuPanelItemProps { diff --git a/webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuTrigger.tsx b/webapp/packages/core-blocks/src/MenuPanel/MenuTrigger.tsx similarity index 97% rename from webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuTrigger.tsx rename to webapp/packages/core-blocks/src/MenuPanel/MenuTrigger.tsx index bb5ec9a03e..1489e52853 100644 --- a/webapp/packages/core-dialogs/src/Menu/MenuPanel/MenuTrigger.tsx +++ b/webapp/packages/core-blocks/src/MenuPanel/MenuTrigger.tsx @@ -11,10 +11,11 @@ import React, { ButtonHTMLAttributes, forwardRef, useCallback, useEffect, useMem import { Menu, MenuButton, MenuInitialState, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuStateReturn, useMenuState } from 'reakit/Menu'; import styled, { use } from 'reshadow'; -import { useObjectRef, useStyles } from '@cloudbeaver/core-blocks'; +import type { IMenuItem, IMenuPanel } from '@cloudbeaver/core-dialogs'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import type { IMenuItem, IMenuPanel } from '../IMenuPanel'; +import { useObjectRef } from '../useObjectRef'; +import { useStyles } from '../useStyles'; import { MenuPanelItem } from './MenuPanelItem'; import { menuPanelStyles } from './menuPanelStyles'; diff --git a/webapp/packages/core-dialogs/src/Menu/MenuPanel/menuPanelStyles.ts b/webapp/packages/core-blocks/src/MenuPanel/menuPanelStyles.ts similarity index 100% rename from webapp/packages/core-dialogs/src/Menu/MenuPanel/menuPanelStyles.ts rename to webapp/packages/core-blocks/src/MenuPanel/menuPanelStyles.ts diff --git a/webapp/packages/core-blocks/src/Placeholder/Placeholder.tsx b/webapp/packages/core-blocks/src/Placeholder/Placeholder.tsx index c61d5a94cb..c9fe9f93aa 100644 --- a/webapp/packages/core-blocks/src/Placeholder/Placeholder.tsx +++ b/webapp/packages/core-blocks/src/Placeholder/Placeholder.tsx @@ -27,6 +27,8 @@ export const Placeholder = observer(function Placeholder !placeholder.isHidden?.(rest as unknown as T)); + return ( <> {elements.map(({ id, component: Component }) => ( diff --git a/webapp/packages/core-blocks/src/Placeholder/PlaceholderContainer.ts b/webapp/packages/core-blocks/src/Placeholder/PlaceholderContainer.ts index 6637c1b924..8c3a93ab24 100644 --- a/webapp/packages/core-blocks/src/Placeholder/PlaceholderContainer.ts +++ b/webapp/packages/core-blocks/src/Placeholder/PlaceholderContainer.ts @@ -14,6 +14,7 @@ export type PlaceholderComponent = Record = Record> { id: string; component: PlaceholderComponent; + isHidden?: (props: T) => boolean; order?: number; } @@ -24,11 +25,16 @@ export class PlaceholderContainer = Record, order?: number): void { + getDisplayed(props: T): Array> { + return this.placeholders.filter(placeholder => !placeholder.isHidden?.(props)); + } + + add(component: PlaceholderComponent, order?: number, isHidden?: (props: T) => boolean): void { const placeholder: PlaceholderElement = { id: uuid(), component, order, + isHidden, }; if (order === undefined) { diff --git a/webapp/packages/core-blocks/src/ResourcesHooks/usePagination.ts b/webapp/packages/core-blocks/src/ResourcesHooks/useOffsetPagination.ts similarity index 65% rename from webapp/packages/core-blocks/src/ResourcesHooks/usePagination.ts rename to webapp/packages/core-blocks/src/ResourcesHooks/useOffsetPagination.ts index 5a46d1a966..5bdd99e474 100644 --- a/webapp/packages/core-blocks/src/ResourcesHooks/usePagination.ts +++ b/webapp/packages/core-blocks/src/ResourcesHooks/useOffsetPagination.ts @@ -12,15 +12,15 @@ import { CACHED_RESOURCE_DEFAULT_PAGE_LIMIT, CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedMapResource, - CachedResourcePageKey, - CachedResourcePageListKey, + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, getNextPageOffset, - ICachedResourcePageOptions, + ICachedResourceOffsetPageOptions, ResourceKey, ResourceKeyAlias, ResourceKeyList, ResourceKeyListAlias, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; import { useObservableRef } from '../useObservableRef'; @@ -29,40 +29,40 @@ interface IOptions> { pageSize?: number; } -interface IPagination { +interface IOffsetPagination { key: TKey extends ResourceKeyListAlias | ResourceKeyList - ? ResourceKeyListAlias> - : ResourceKeyAlias>; + ? ResourceKeyListAlias> + : ResourceKeyAlias>; hasNextPage: boolean; refresh: () => void; loadMore: () => void; } -interface IPaginationPrivate> extends IPagination { +interface IOffsetPaginationPrivate> extends IOffsetPagination { offset: number; resource: CachedMapResource; - _key: ResourceKeyAlias> | ResourceKeyListAlias>; + _key: ResourceKeyAlias> | ResourceKeyListAlias>; } -export function usePagination, TKey extends ResourceKey>( +export function useOffsetPagination, TKey extends ResourceKey>( ctor: IServiceConstructor, options?: IOptions, -): IPagination { +): IOffsetPagination { const targetKey = options?.key; const pageSize = options?.pageSize || CACHED_RESOURCE_DEFAULT_PAGE_LIMIT; const resource = useService(ctor); - const pageInfo = resource.getPageInfo(createPageKey(0, 0, targetKey)); + const pageInfo = resource.offsetPagination.getPageInfo(createPageKey(0, 0, targetKey)); const offset = Math.max( (pageInfo ? getNextPageOffset(pageInfo) : CACHED_RESOURCE_DEFAULT_PAGE_OFFSET) - pageSize, CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, ); - const pagination = useObservableRef>( + const pagination = useObservableRef>( () => ({ offset, _key: createPageKey(offset, pageSize, targetKey), get key() { - const pageInfo = resource.getPageInfo(createPageKey(0, 0, this._key.target)); + const pageInfo = resource.offsetPagination.getPageInfo(createPageKey(0, 0, this._key.target)); for (const page of pageInfo?.pages || []) { if (page.outdated && page.from < this._key.options.offset) { @@ -72,7 +72,7 @@ export function usePagination, -): ResourceKeyAlias> | ResourceKeyListAlias> { +): ResourceKeyAlias> | ResourceKeyListAlias> { if (target instanceof ResourceKeyList || target instanceof ResourceKeyListAlias) { - return CachedResourcePageListKey(offset, limit).setTarget(target); + return CachedResourceOffsetPageListKey(offset, limit).setTarget(target); } - return CachedResourcePageKey(offset, limit).setTarget(target); + return CachedResourceOffsetPageKey(offset, limit).setTarget(target); } diff --git a/webapp/packages/core-blocks/src/ResourcesHooks/useResource.ts b/webapp/packages/core-blocks/src/ResourcesHooks/useResource.ts index 6f4defee11..e98f215baa 100644 --- a/webapp/packages/core-blocks/src/ResourcesHooks/useResource.ts +++ b/webapp/packages/core-blocks/src/ResourcesHooks/useResource.ts @@ -26,7 +26,7 @@ import { ResourceKey, ResourceKeyList, ResourceKeyListAlias, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; import { ILoadableState, isArraysEqual, isContainsException, LoadingError } from '@cloudbeaver/core-utils'; import { ErrorContext } from '../ErrorContext'; @@ -220,14 +220,14 @@ export function useResource< use(key: ResourceKey | null): void { key = toJS(key); - if (this.useRef[0] !== null && propertiesRef.resource.hasUseId(this.useRef[1])) { + if (this.useRef[0] !== null && propertiesRef.resource.useTracker.hasUseId(this.useRef[1])) { if (key !== null && propertiesRef.resource.isIntersect(key, this.useRef[0])) { return; } - propertiesRef.resource.free(this.useRef[0], this.useRef[1]); + propertiesRef.resource.useTracker.free(this.useRef[0], this.useRef[1]); } - this.useRef = [key, key === null ? '' : propertiesRef.resource.use(key)]; + this.useRef = [key, key === null ? '' : propertiesRef.resource.useTracker.use(key)]; }, async [loadFunctionName](refresh?: boolean): Promise { const { key, includes, resource } = propertiesRef; diff --git a/webapp/packages/core-blocks/src/index.ts b/webapp/packages/core-blocks/src/index.ts index 837dab904c..280a8df4b2 100644 --- a/webapp/packages/core-blocks/src/index.ts +++ b/webapp/packages/core-blocks/src/index.ts @@ -1,3 +1,14 @@ +export * from './CommonDialog/CommonDialog/CommonDialogBody'; +export * from './CommonDialog/CommonDialog/CommonDialogFooter'; +export * from './CommonDialog/CommonDialog/CommonDialogHeader'; +export * from './CommonDialog/CommonDialog/CommonDialogWrapper'; +export * from './CommonDialog/ConfirmationDialog'; +export * from './CommonDialog/ConfirmationDialogDelete'; +export * from './CommonDialog/RenameDialog'; +export * from './CommonDialog/DialogsPortal'; + +export * from './ErrorDetailsDialog/ErrorDetailsDialog'; + export * from './AppRefreshButton'; export * from './ComplexLoader'; export * from './DisplayError'; @@ -42,6 +53,7 @@ export * from './Menu/MenuSeparator'; export { default as MenuSeparatorStyles } from './Menu/MenuSeparator.m.css'; export * from './Menu/MenuStateContext'; export * from './Menu/useMouseContextMenu'; +export { MenuTrigger, type MenuState } from './MenuPanel/MenuTrigger'; export * from './ObjectPropertyInfo/ObjectPropertyInfoForm/ObjectPropertyInfoForm'; export * from './ObjectPropertyInfo/useObjectPropertyCategories'; @@ -190,7 +202,7 @@ export * from './useExecutor'; export * from './useFn'; export * from './useFocus'; export * from './useFormValidator'; -export * from './ResourcesHooks/usePagination'; +export * from './ResourcesHooks/useOffsetPagination'; export * from './ResourcesHooks/useResource'; export * from './useMouse'; export * from './useObjectRef'; diff --git a/webapp/packages/core-blocks/src/useActivationDelay.tsx b/webapp/packages/core-blocks/src/useActivationDelay.ts similarity index 100% rename from webapp/packages/core-blocks/src/useActivationDelay.tsx rename to webapp/packages/core-blocks/src/useActivationDelay.ts diff --git a/webapp/packages/core-blocks/src/useErrorDetails.tsx b/webapp/packages/core-blocks/src/useErrorDetails.ts similarity index 95% rename from webapp/packages/core-blocks/src/useErrorDetails.tsx rename to webapp/packages/core-blocks/src/useErrorDetails.ts index 5a4a053cc2..66f4cf4196 100644 --- a/webapp/packages/core-blocks/src/useErrorDetails.tsx +++ b/webapp/packages/core-blocks/src/useErrorDetails.ts @@ -9,10 +9,11 @@ import { useState } from 'react'; import { useService } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; -import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications'; import { DetailsError } from '@cloudbeaver/core-sdk'; import { errorOf, LoadingError } from '@cloudbeaver/core-utils'; +import { ErrorDetailsDialog } from './ErrorDetailsDialog/ErrorDetailsDialog'; + interface IErrorDetailsHook { name?: string; message?: string; diff --git a/webapp/packages/core-blocks/src/useMergeRefs.tsx b/webapp/packages/core-blocks/src/useMergeRefs.ts similarity index 100% rename from webapp/packages/core-blocks/src/useMergeRefs.tsx rename to webapp/packages/core-blocks/src/useMergeRefs.ts diff --git a/webapp/packages/core-blocks/src/useStateDelay.tsx b/webapp/packages/core-blocks/src/useStateDelay.ts similarity index 100% rename from webapp/packages/core-blocks/src/useStateDelay.tsx rename to webapp/packages/core-blocks/src/useStateDelay.ts diff --git a/webapp/packages/core-blocks/tsconfig.json b/webapp/packages/core-blocks/tsconfig.json index ae46b96cc6..37162a9a09 100644 --- a/webapp/packages/core-blocks/tsconfig.json +++ b/webapp/packages/core-blocks/tsconfig.json @@ -1,10 +1,58 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - // "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-bootstrap/package.json b/webapp/packages/core-bootstrap/package.json index b88daef7b1..2e2a80cdf8 100644 --- a/webapp/packages/core-bootstrap/package.json +++ b/webapp/packages/core-bootstrap/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/core-bootstrap", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-administration": "~0.1.0", @@ -21,14 +22,19 @@ "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-browser": "~0.1.0", + "@cloudbeaver/core-browser-cookies": "~0.1.0", + "@cloudbeaver/core-browser-settings": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-product": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-resource-manager": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", @@ -38,8 +44,7 @@ "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-version": "~0.1.0", "@cloudbeaver/core-version-update": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/core-navigation-tree": "~0.1.0" + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", @@ -47,5 +52,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-bootstrap/src/manifest.ts b/webapp/packages/core-bootstrap/src/manifest.ts index 3e0db115cd..f12cf03da2 100644 --- a/webapp/packages/core-bootstrap/src/manifest.ts +++ b/webapp/packages/core-bootstrap/src/manifest.ts @@ -10,15 +10,18 @@ import { coreAppManifest } from '@cloudbeaver/core-app'; import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; import { coreBlocksManifest } from '@cloudbeaver/core-blocks'; import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreBrowserCookiesManifest } from '@cloudbeaver/core-browser-cookies'; +import { coreBrowserSettingsManifest } from '@cloudbeaver/core-browser-settings'; import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; import { coreDIManifest, PluginManifest } from '@cloudbeaver/core-di'; -import { codeDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; import { coreEventsManifest } from '@cloudbeaver/core-events'; import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; import { corePluginManifest } from '@cloudbeaver/core-plugin'; import { coreProductManifest } from '@cloudbeaver/core-product'; import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreResourceManifest } from '@cloudbeaver/core-resource'; import { resourceManagerManifest } from '@cloudbeaver/core-resource-manager'; import { coreRootManifest } from '@cloudbeaver/core-root'; import { coreRoutingManifest } from '@cloudbeaver/core-routing'; @@ -46,10 +49,13 @@ export const coreManifests: PluginManifest[] = [ coreBlocksManifest, coreSettingsManifest, coreEventsManifest, + coreResourceManifest, coreSDKManifest, coreRootManifest, corePluginManifest, coreBrowserManifest, + coreBrowserSettingsManifest, + coreBrowserCookiesManifest, coreProductManifest, coreProjectsManifest, coreAuthenticationManifest, @@ -59,7 +65,7 @@ export const coreManifests: PluginManifest[] = [ coreVersionUpdateManifest, coreConnectionsManifest, coreAdministrationManifest, - codeDialogsManifest, + coreDialogsManifest, resourceManagerManifest, coreAppManifest, coreNavigationTree, diff --git a/webapp/packages/core-bootstrap/tsconfig.json b/webapp/packages/core-bootstrap/tsconfig.json index bd4ed8f7d0..d82e0f3fc6 100644 --- a/webapp/packages/core-bootstrap/tsconfig.json +++ b/webapp/packages/core-bootstrap/tsconfig.json @@ -1,10 +1,106 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-browser" + }, + { + "path": "..\\core-browser-cookies" + }, + { + "path": "..\\core-browser-settings" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-product" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-resource-manager" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-version" + }, + { + "path": "..\\core-version-update" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-browser-cookies/.gitignore b/webapp/packages/core-browser-cookies/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-browser-cookies/.gitignore @@ -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* diff --git a/webapp/packages/core-browser-cookies/package.json b/webapp/packages/core-browser-cookies/package.json new file mode 100644 index 0000000000..34b4b288b0 --- /dev/null +++ b/webapp/packages/core-browser-cookies/package.json @@ -0,0 +1,33 @@ +{ + "name": "@cloudbeaver/core-browser-cookies", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", + "test": "core-cli-test", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/core-browser-settings": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0" + }, + "peerDependencies": { + "@testing-library/jest-dom": "~6.x.x", + "mobx": "~6.x.x", + "mobx-react-lite": "~3.x.x", + "react": "~18.x.x", + "react-dom": "~18.x.x" + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-browser/src/CookiesService.ts b/webapp/packages/core-browser-cookies/src/CookiesService.ts similarity index 89% rename from webapp/packages/core-browser/src/CookiesService.ts rename to webapp/packages/core-browser-cookies/src/CookiesService.ts index 1eaf8b409d..567d5d042b 100644 --- a/webapp/packages/core-browser/src/CookiesService.ts +++ b/webapp/packages/core-browser-cookies/src/CookiesService.ts @@ -5,10 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { BrowserSettingsService } from '@cloudbeaver/core-browser-settings'; import { injectable } from '@cloudbeaver/core-di'; -import { BrowserSettingsService } from './BrowserSettingsService'; - @injectable() export class CookiesService { get cookiesEnabled() { diff --git a/webapp/packages/core-browser-cookies/src/index.ts b/webapp/packages/core-browser-cookies/src/index.ts new file mode 100644 index 0000000000..d662748372 --- /dev/null +++ b/webapp/packages/core-browser-cookies/src/index.ts @@ -0,0 +1,2 @@ +export * from './CookiesService'; +export * from './manifest'; diff --git a/webapp/packages/core-browser-cookies/src/manifest.ts b/webapp/packages/core-browser-cookies/src/manifest.ts new file mode 100644 index 0000000000..05e8b524df --- /dev/null +++ b/webapp/packages/core-browser-cookies/src/manifest.ts @@ -0,0 +1,18 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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'; + +export const coreBrowserCookiesManifest: PluginManifest = { + info: { + name: 'Core Browser Cookies', + }, + + providers: [CookiesService], +}; diff --git a/webapp/packages/core-browser-cookies/tsconfig.json b/webapp/packages/core-browser-cookies/tsconfig.json new file mode 100644 index 0000000000..ac0d6f2231 --- /dev/null +++ b/webapp/packages/core-browser-cookies/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\core-browser-settings" + }, + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/core-browser-settings/.gitignore b/webapp/packages/core-browser-settings/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-browser-settings/.gitignore @@ -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* diff --git a/webapp/packages/core-browser-settings/package.json b/webapp/packages/core-browser-settings/package.json new file mode 100644 index 0000000000..57f0d2d1fa --- /dev/null +++ b/webapp/packages/core-browser-settings/package.json @@ -0,0 +1,35 @@ +{ + "name": "@cloudbeaver/core-browser-settings", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", + "test": "core-cli-test", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0" + }, + "peerDependencies": { + "@testing-library/jest-dom": "~6.x.x", + "mobx": "~6.x.x", + "mobx-react-lite": "~3.x.x", + "react": "~18.x.x", + "react-dom": "~18.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" + } +} diff --git a/webapp/packages/core-browser/src/BrowserSettingsService.test.ts b/webapp/packages/core-browser-settings/src/BrowserSettingsService.test.ts similarity index 78% rename from webapp/packages/core-browser/src/BrowserSettingsService.test.ts rename to webapp/packages/core-browser-settings/src/BrowserSettingsService.test.ts index 8fb921c957..8f8b2d0a6a 100644 --- a/webapp/packages/core-browser/src/BrowserSettingsService.test.ts +++ b/webapp/packages/core-browser-settings/src/BrowserSettingsService.test.ts @@ -7,20 +7,19 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { createApp } from '@cloudbeaver/tests-runner'; import { BrowserSettingsService, CookiesSettings, DeprecatedCookiesSettings } from './BrowserSettingsService'; const endpoint = createGQLEndpoint(); const app = createApp(); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-browser/src/BrowserSettingsService.ts b/webapp/packages/core-browser-settings/src/BrowserSettingsService.ts similarity index 100% rename from webapp/packages/core-browser/src/BrowserSettingsService.ts rename to webapp/packages/core-browser-settings/src/BrowserSettingsService.ts diff --git a/webapp/packages/core-browser-settings/src/index.ts b/webapp/packages/core-browser-settings/src/index.ts new file mode 100644 index 0000000000..295a5758ab --- /dev/null +++ b/webapp/packages/core-browser-settings/src/index.ts @@ -0,0 +1,2 @@ +export * from './BrowserSettingsService'; +export * from './manifest'; diff --git a/webapp/packages/core-browser-settings/src/manifest.ts b/webapp/packages/core-browser-settings/src/manifest.ts new file mode 100644 index 0000000000..739d5633a0 --- /dev/null +++ b/webapp/packages/core-browser-settings/src/manifest.ts @@ -0,0 +1,18 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { BrowserSettingsService } from './BrowserSettingsService'; + +export const coreBrowserSettingsManifest: PluginManifest = { + info: { + name: 'Core Browser Settings', + }, + + providers: [BrowserSettingsService], +}; diff --git a/webapp/packages/core-browser-settings/tsconfig.json b/webapp/packages/core-browser-settings/tsconfig.json new file mode 100644 index 0000000000..8fa08421b4 --- /dev/null +++ b/webapp/packages/core-browser-settings/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../tsconfig.base.json", + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ], + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ] +} diff --git a/webapp/packages/core-browser/package.json b/webapp/packages/core-browser/package.json index 731e95b5e2..0de2aa4c56 100644 --- a/webapp/packages/core-browser/package.json +++ b/webapp/packages/core-browser/package.json @@ -1,31 +1,32 @@ { "name": "@cloudbeaver/core-browser", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "dexie": "^3.2.4", "workbox-core": "~7.x.x", "workbox-precaching": "~7.x.x", "workbox-routing": "~7.x.x", - "workbox-window": "~7.x.x" + "workbox-window": "~7.x.x", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "@testing-library/jest-dom": "~6.x.x", @@ -33,5 +34,6 @@ "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "react-dom": "~18.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/core-browser/src/ServiceWorkerService.ts b/webapp/packages/core-browser/src/ServiceWorkerService.ts index 38da68d041..a9af829efb 100644 --- a/webapp/packages/core-browser/src/ServiceWorkerService.ts +++ b/webapp/packages/core-browser/src/ServiceWorkerService.ts @@ -5,6 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +/// import { Workbox } from 'workbox-window'; import { injectable } from '@cloudbeaver/core-di'; diff --git a/webapp/packages/core-browser/src/index.ts b/webapp/packages/core-browser/src/index.ts index 635950874c..231b868af1 100644 --- a/webapp/packages/core-browser/src/index.ts +++ b/webapp/packages/core-browser/src/index.ts @@ -1,5 +1,4 @@ export * from './IndexedDB/IndexedDBService'; export * from './IndexedDB/IndexedDB'; -export * from './CookiesService'; export * from './manifest'; export * from './ServiceWorkerService'; diff --git a/webapp/packages/core-browser/src/manifest.ts b/webapp/packages/core-browser/src/manifest.ts index 360cdb992d..ac5556fb70 100644 --- a/webapp/packages/core-browser/src/manifest.ts +++ b/webapp/packages/core-browser/src/manifest.ts @@ -7,8 +7,6 @@ */ import type { PluginManifest } from '@cloudbeaver/core-di'; -import { BrowserSettingsService } from './BrowserSettingsService'; -import { CookiesService } from './CookiesService'; import { IndexedDBService } from './IndexedDB/IndexedDBService'; import { ServiceWorkerBootstrap } from './ServiceWorkerBootstrap'; import { ServiceWorkerService } from './ServiceWorkerService'; @@ -18,5 +16,5 @@ export const coreBrowserManifest: PluginManifest = { name: 'Core Browser', }, - providers: [BrowserSettingsService, CookiesService, ServiceWorkerBootstrap, ServiceWorkerService, IndexedDBService], + providers: [ServiceWorkerBootstrap, ServiceWorkerService, IndexedDBService], }; diff --git a/webapp/packages/core-browser/src/service-worker.ts b/webapp/packages/core-browser/src/service-worker.ts index 11089e7058..c754710c94 100644 --- a/webapp/packages/core-browser/src/service-worker.ts +++ b/webapp/packages/core-browser/src/service-worker.ts @@ -13,6 +13,10 @@ addEventListener('message', event => { }); addEventListener('fetch', async event => { + if (!(event instanceof FetchEvent)) { + return; + } + const { request } = event; const url = new URL(request.url); diff --git a/webapp/packages/core-browser/tsconfig.json b/webapp/packages/core-browser/tsconfig.json index bd4ed8f7d0..a74f24e351 100644 --- a/webapp/packages/core-browser/tsconfig.json +++ b/webapp/packages/core-browser/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-cli/bin/test.js b/webapp/packages/core-cli/bin/test.js index 9ecd0db610..e81e5e9e10 100755 --- a/webapp/packages/core-cli/bin/test.js +++ b/webapp/packages/core-cli/bin/test.js @@ -5,18 +5,11 @@ process.title = 'core-test'; const jest = require('jest'); -const { resolve } = require('path'); if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'test'; } -const argv = [ - ...process.argv.slice(2, process.argv.length), - '--roots', - resolve('.'), - '--config', - require.resolve('../configs/jest.config.js'), -]; +const argv = [...process.argv.slice(2, process.argv.length), '--config', require.resolve('../configs/jest.config.js')]; jest.run(argv); diff --git a/webapp/packages/core-cli/bin/typescript-resolve-references.js b/webapp/packages/core-cli/bin/typescript-resolve-references.js new file mode 100644 index 0000000000..279205f8c9 --- /dev/null +++ b/webapp/packages/core-cli/bin/typescript-resolve-references.js @@ -0,0 +1,61 @@ +#!/usr/bin/env node + +'use strict'; +require('./validate-dependencies'); +process.title = 'typescript-resolve-references'; + +const fs = require('fs'); +const { resolve, relative, join } = require('path'); +const { getCloudBeaverDeps } = require('../utils/getCloudBeaverDeps'); + +const tsConfigPath = resolve('tsconfig.json'); +// const tsRootPath = resolve('../../'); +// const tsRootConfigPath = resolve(join(tsRootPath, 'tsconfig.json')); +const pkg = require(resolve('package.json')); +const typescriptConfig = require(tsConfigPath); +// const typescriptRootConfig = require(tsRootConfigPath); + +const allDependencies = getCloudBeaverDeps(pkg); +const dependencies = [...allDependencies.dependencies, ...allDependencies.devDependencies, ...allDependencies.peerDependencies]; +const currentDir = resolve(); + +const nodeModules = [resolve('node_modules')]; + +typescriptConfig.references = []; +// typescriptRootConfig.references = typescriptRootConfig.references || []; + +for (const dependency of dependencies) { + const dependencyPath = resolve(require.resolve(join(dependency, 'src', 'index.ts'), { paths: nodeModules }), '../..'); + typescriptConfig.references.push({ + path: relative(currentDir, dependencyPath), + }); + + // const relativePath = relative(tsRootPath, dependencyPath); + + // if (!typescriptRootConfig.references.find(ref => ref.path === relativePath)) { + // typescriptRootConfig.references.push({ + // path: relativePath, + // }); + // } +} + +typescriptConfig.compilerOptions = { + rootDir: 'src', + outDir: 'dist', + tsBuildInfoFile: 'dist/tsconfig.tsbuildinfo', +}; + +typescriptConfig.include = ['__custom_mocks__/**/*', 'src/**/*', 'src/**/*.json', 'src/**/*.css', 'src/**/*.scss']; + +typescriptConfig.exclude = typescriptConfig.exclude || []; + +const defaultExclude = ['lib/**/*', 'dist/**/*', '**/node_modules']; + +for (const exclude of defaultExclude) { + if (!typescriptConfig.exclude.includes(exclude)) { + typescriptConfig.exclude.push(exclude); + } +} + +fs.writeFileSync(tsConfigPath, JSON.stringify(typescriptConfig, undefined, 2) + '\n', 'utf8'); +// fs.writeFileSync(tsRootConfigPath, JSON.stringify(typescriptRootConfig, undefined, 2), 'utf8'); diff --git a/webapp/packages/core-cli/bin/validate-dependencies.js b/webapp/packages/core-cli/bin/validate-dependencies.js index e313eef3b5..13c17bad23 100755 --- a/webapp/packages/core-cli/bin/validate-dependencies.js +++ b/webapp/packages/core-cli/bin/validate-dependencies.js @@ -20,60 +20,91 @@ const srcDir = path.join(root, 'src'); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); // Keep track of the dependencies that were found in the .ts files -const foundDependencies = new Set(); +const cloudbeaverDependencies = new Set(); +const cloudbeaverDevDependencies = new Set(); // A helper function that recursively processes a directory and its subdirectories function processDirectory(directory) { // Iterate over all files in the directory - fs.readdirSync(directory) - .forEach(file => { - // Check if the file is a directory - const filePath = path.join(directory, file); - const fileStat = fs.statSync(filePath); + fs.readdirSync(directory).forEach(file => { + // Check if the file is a directory + const filePath = path.join(directory, file); + const fileStat = fs.statSync(filePath); - if (fileStat.isDirectory()) { - // If it is, recursively process the subdirectory - processDirectory(filePath); - } else { - // Otherwise, check if the file is a .ts/.tsx file - const extensions = /(? { - const dep = match.split('/')[1].replace(/['"]/g, ''); - const fullDep = `@cloudbeaver/${dep}`; + // Add the found dependencies to the set + if (matches) { + matches.forEach(match => { + const dep = match.split('/')[1].replace(/['"]/g, ''); + const fullDep = `@cloudbeaver/${dep}`; - foundDependencies.add(fullDep); - }); - } + cloudbeaverDependencies.add(fullDep); + }); + } + } else if (/\.test.tsx?$/i.test(file)) { + //@cloudbeaver/tests-runner + // Read the contents of the file + const fileContent = fs.readFileSync(filePath, 'utf8'); + const regex = /import\s+(type\s+|)(\{[^}]*\}|\w+)\s+from\s+['"]@cloudbeaver\/tests-runner(\/[^'"]*)?['"]/g; + const matches = fileContent.match(regex); + if (matches?.length) { + cloudbeaverDevDependencies.add('@cloudbeaver/tests-runner'); } } - }); + } + }); } // Start processing the `src` directory processDirectory(srcDir); -// Iterate over the dependencies in the `package.json` file -for (const dep in packageJson.dependencies) { +packageJson.sideEffects = packageJson.sideEffects || []; +const sideEffects = ['src/**/*.css', 'src/**/*.scss', 'public/**/*']; + +for (const sideEffect of sideEffects) { + if (!packageJson.sideEffects.includes(sideEffect)) { + packageJson.sideEffects.push(sideEffect); + } +} + +packageJson.peerDependencies = packageJson.peerDependencies || {}; + +const isProduct = /^@cloudbeaver\/product-.+$/.test(packageJson.name) || true; + +const dependenciesToRemove = isProduct ? packageJson.peerDependencies : packageJson.dependencies; +const dependenciesToAdd = isProduct ? packageJson.dependencies : packageJson.peerDependencies; + +for (const dep in dependenciesToRemove) { + if (dep.includes('@cloudbeaver')) { + delete dependenciesToRemove[dep]; + } +} + +// Iterate over the dependencies in the `package.json` file +for (const dep in dependenciesToAdd) { // If a dependency was not found in any of the .ts/.tsx files, delete it from the `package.json` file // Make sure we are deleting only internal dependencies - if (dep.includes('@cloudbeaver') && !foundDependencies.has(dep)) { - delete packageJson.dependencies[dep]; + if (dep.includes('@cloudbeaver') && !cloudbeaverDependencies.has(dep)) { + delete dependenciesToAdd[dep]; } } // Plugins first, core packages after -const sortedDependencies = [...foundDependencies.values()].sort((a, b) => { +const sortedDependencies = [...cloudbeaverDependencies.values()].sort((a, b) => { const aPlugin = a.includes('plugin-'); const bPlugin = b.includes('plugin-'); @@ -94,10 +125,21 @@ const sortedDependencies = [...foundDependencies.values()].sort((a, b) => { // Add the dependencies that were found in the .ts/.tsx files to the `package.json` file sortedDependencies.forEach(dep => { - if (!packageJson.dependencies[dep]) { - packageJson.dependencies[dep] = '~0.1.0'; + if (!dependenciesToAdd[dep]) { + dependenciesToAdd[dep] = '~0.1.0'; } }); +packageJson.devDependencies = packageJson.devDependencies || {}; +const devDependencies = packageJson.devDependencies; + +const sortedDevDependencies = [...cloudbeaverDevDependencies.values()].sort((a, b) => a.localeCompare(b)); + +for (const dep of sortedDevDependencies) { + if (!devDependencies[dep]) { + devDependencies[dep] = '~0.1.0'; + } +} + // Write the updated `package.json` -fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); \ No newline at end of file +fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8'); diff --git a/webapp/packages/core-cli/configs/__mocks__/fileMock.ts b/webapp/packages/core-cli/configs/__mocks__/fileMock.js similarity index 100% rename from webapp/packages/core-cli/configs/__mocks__/fileMock.ts rename to webapp/packages/core-cli/configs/__mocks__/fileMock.js diff --git a/webapp/packages/core-cli/configs/__mocks__/styleMock.ts b/webapp/packages/core-cli/configs/__mocks__/styleMock.js similarity index 100% rename from webapp/packages/core-cli/configs/__mocks__/styleMock.ts rename to webapp/packages/core-cli/configs/__mocks__/styleMock.js diff --git a/webapp/packages/core-cli/configs/babel.config.js b/webapp/packages/core-cli/configs/babel.config.js index ed8f1acecb..b1fb5c0648 100644 --- a/webapp/packages/core-cli/configs/babel.config.js +++ b/webapp/packages/core-cli/configs/babel.config.js @@ -6,8 +6,7 @@ * you may not use this file except in compliance with the License. */ /* eslint-disable @typescript-eslint/no-var-requires */ - -const testingAttributes = require('../lib/babel-plugins/TestingAttributes.js'); +const testingAttributes = require('../dist/babel-plugins/TestingAttributes.js'); const { warn } = console; // Prevents resolution warnings from babel-plugin-module-resolver @@ -25,6 +24,7 @@ console.warn = (...args) => { module.exports = api => { const devMode = !api.env('production'); const testMode = api.env('test'); + api.cache.never(); return { compact: !devMode, @@ -33,11 +33,6 @@ module.exports = api => { setPublicClassFields: true, // defines properties in extending classes via Object.defineProperty setSpreadProperties: true, }, - // env: { - // test: { - // plugins: ["@babel/plugin-transform-modules-commonjs"] - // } - // }, presets: [ [ '@babel/preset-env', @@ -57,7 +52,7 @@ module.exports = api => { exclude: ['transform-async-to-generator', 'transform-regenerator'], }, ], - ['@babel/preset-typescript', { isTSX: true, allExtensions: true, onlyRemoveTypeImports: true }], + // ['@babel/preset-typescript', { isTSX: true, allExtensions: true, onlyRemoveTypeImports: true }], [ '@babel/preset-react', { @@ -67,24 +62,24 @@ module.exports = api => { ], ], plugins: [ - 'babel-plugin-transform-typescript-metadata', - '@babel/plugin-syntax-dynamic-import', - '@babel/plugin-proposal-nullish-coalescing-operator', - '@babel/plugin-proposal-optional-chaining', - ['@babel/plugin-proposal-decorators', { legacy: true }], - ['@babel/plugin-proposal-class-properties'], - ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }], + // 'babel-plugin-transform-typescript-metadata', + // '@babel/plugin-syntax-dynamic-import', + // '@babel/plugin-proposal-nullish-coalescing-operator', + // '@babel/plugin-proposal-optional-chaining', + // ['@babel/plugin-proposal-decorators', { legacy: true }], + // ['@babel/plugin-proposal-class-properties'], + // ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }], [testingAttributes, {}], [require('@reshadow/babel'), {}], - /*devMode &&*/ [ - 'babel-plugin-module-resolver', - { - alias: { - '^@cloudbeaver/([^/]*)$': '@cloudbeaver/\\1/src', - '^@cloudbeaver/([^/]*)/(.*)$': '@cloudbeaver/\\1/\\2', - }, - }, - ], + // /*devMode &&*/ [ + // 'babel-plugin-module-resolver', + // { + // alias: { + // '^@cloudbeaver/([^/]*)$': '@cloudbeaver/\\1/lib', + // '^@cloudbeaver/([^/]*)/(.*)$': '@cloudbeaver/\\1/\\2', + // }, + // }, + // ], devMode && !testMode && require.resolve('react-refresh/babel'), ].filter(Boolean), }; diff --git a/webapp/packages/core-cli/configs/jest.config.js b/webapp/packages/core-cli/configs/jest.config.js index ccd3ae54c3..bb5d6b1f4a 100644 --- a/webapp/packages/core-cli/configs/jest.config.js +++ b/webapp/packages/core-cli/configs/jest.config.js @@ -1,23 +1,37 @@ // https://jestjs.io/docs/configuration +const path = require('path'); +/** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { + testEnvironment: 'jsdom', + rootDir: path.resolve('./dist'), transformIgnorePatterns: [ + '\\.pnp\\.[^\\/]+$', 'node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)', '/node_modules/(?!(uuid|go-split|@react-dnd|react-dnd-html5-backend|react-dnd|dnd-core|@cloudbeaver))(.*)', ], + // transformIgnorePatterns: ['/node_modules/', '\\.pnp\\.[^\\/]+$', 'reshadow'], testPathIgnorePatterns: ['/node_modules/'], moduleNameMapper: { - '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/__mocks__/fileMock.ts', - '\\.(css|scss|less)$': '/__mocks__/styleMock.ts', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': require.resolve('./__mocks__/fileMock.js'), + '\\.(css|scss|less)$': require.resolve('./__mocks__/styleMock.js'), '^dexie$': require.resolve('dexie'), + + // '^@cloudbeaver/([^/]*)$': '@cloudbeaver/$1/src', + // '^@cloudbeaver/([^/]*)/(.*)$': '@cloudbeaver/$1/$2', + + '^reshadow$': 'reshadow/lib', + '^@reshadow/react$': '@reshadow/react/lib', + '^@reshadow/runtime$': '@reshadow/runtime/lib', }, // collectCoverage: true, // collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/types.ts'], // coverageReporters: ['json'], // restoreMocks: true, passWithNoTests: true, - testEnvironment: 'jsdom', - setupFiles: ['fake-indexeddb/auto', '../tests/setup.ts'], + setupFiles: [require.resolve('fake-indexeddb/auto'), require.resolve('../tests/setup.js')], setupFilesAfterEnv: ['@testing-library/jest-dom'], - transform: { '\\.[jt]sx?$': ['babel-jest', { configFile: require.resolve('./babel.config.js') }] }, + transform: { + '\\.jsx?$': ['babel-jest', { configFile: require.resolve('./babel.config.js') }], + }, }; diff --git a/webapp/packages/core-cli/configs/webpack.config.js b/webapp/packages/core-cli/configs/webpack.config.js index 8976486b15..3f6650ac86 100644 --- a/webapp/packages/core-cli/configs/webpack.config.js +++ b/webapp/packages/core-cli/configs/webpack.config.js @@ -1,31 +1,11 @@ const { resolve } = 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 threadLoader = require('thread-loader'); - +const { CSSSourceResolver } = require('../utils/CSSSourceResolver.js'); +const { IgnoreNotFoundExportPlugin } = require('../utils/IgnoreNotFoundExportPlugin.js'); const excludedFromVendor = require('./excludedFromVendor.js'); -// const ESLintPlugin = require('eslint-webpack-plugin'); -class IgnoreNotFoundExportPlugin { - apply(compiler) { - const messageRegExp = /export '.*'( \(imported as '.*'\))? was not found in/; - function doneHook(stats) { - stats.compilation.warnings = stats.compilation.warnings.filter(warn => { - if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) { - return false; - } - return true; - }); - } - if (compiler.hooks) { - compiler.hooks.done.tap('IgnoreNotFoundExportPlugin', doneHook); - } else { - compiler.plugin('done', doneHook); - } - } -} +const supportedStyles = /\.(css|s[ac]ss)$/; const nodeModules = [ resolve('node_modules'), // product @@ -33,18 +13,15 @@ const nodeModules = [ resolve('../../node_modules/@cloudbeaver/core-cli/node_modules'), // core-cli ]; -threadLoader.warmup({}, ['babel-loader', 'css-loader', 'sass-loader', 'postcss-loader', 'style-loader', 'json5-loader', MiniCssExtractPlugin.loader]); - 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 = []; // Broke styles order in dev mode // if (devMode) { - // loaders.push('style-loader'); + // loaders.push('style-loader'); // } else { loaders.push(MiniCssExtractPlugin.loader); // } @@ -74,24 +51,21 @@ module.exports = (env, argv) => { { loader: 'css-loader', options: { + esModule: true, modules: modules, - sourceMap: devMode, }, }, { loader: 'postcss-loader', options: { - sourceMap: devMode, postcssOptions: { plugins: postCssPlugins, - sourceMap: devMode, }, }, }, { loader: 'sass-loader', options: { - sourceMap: devMode, sassOptions: { implementation: require('sass'), includePaths: nodeModules, @@ -106,7 +80,7 @@ module.exports = (env, argv) => { loader: require.resolve('babel-loader'), options: { root: __dirname, - cacheDirectory: true, + // cacheDirectory: true, envName: argv.mode, }, }; @@ -140,7 +114,7 @@ module.exports = (env, argv) => { reuseExistingChunk: true, }, packages: { - test: /[\\/]packages[\\/]((plugin|core)-.*?)[\\/]src[\\/]/, + test: /[\\/]packages[\\/]((plugin|core)-.*?)[\\/](src|dist)[\\/]/, filename: '[name].[contenthash].js', name(module) { const path = module.context ?? module.resource; @@ -178,18 +152,9 @@ module.exports = (env, argv) => { pathinfo: false, }, resolve: { - extensions: ['.ts', '.tsx', '.js'], + extensions: ['.ts', '.tsx', '.wasm', '.mjs', '.js', '.jsx', '.json'], 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" - // }, - fallback: { - // path: require.resolve('path-browserify'), - }, - plugins: [PnpWebpackPlugin], + plugins: [PnpWebpackPlugin, new CSSSourceResolver(supportedStyles)], }, resolveLoader: { modules: nodeModules, @@ -197,18 +162,41 @@ module.exports = (env, argv) => { }, module: { rules: [ + devMode && { + test: /\.jsx?$/, + enforce: 'pre', + exclude: /node_modules/, + use: ['source-map-loader'], + }, { test: /\.json5$/i, loader: 'json5-loader', type: 'javascript/auto', }, { - test: /\.(ts|js)x?$/, + test: /\.jsx?$/, exclude: /node_modules/, use: ['thread-loader', babelLoader], }, { - test: /\.(css|s[ac]ss)$/, + test: /\.tsx?$/, + exclude: /node_modules/, + use: [ + // 'thread-loader', + babelLoader, + { + loader: 'ts-loader', + options: { + // happyPackMode: true, + // transpileOnly: true, + projectReferences: true, + ignoreDiagnostics: [6059, 2307], + }, + }, + ], + }, + { + test: supportedStyles, exclude: /node_modules/, oneOf: [ { @@ -238,28 +226,45 @@ module.exports = (env, argv) => { }, ], }, - devtool: devTool, + ignoreWarnings: [/Failed to parse source map/], + devtool: devMode ? 'source-map' : false, plugins: [ - new ForkTsCheckerWebpackPlugin({ - typescript: { - typescriptPath: require.resolve('typescript'), - configFile: resolve('tsconfig.json'), - configOverwrite: { - include: ['**/src/**/*.ts', '**/src/**/*.tsx'], - }, - diagnosticOptions: { - semantic: true, - syntactic: true, - }, - }, - }), + // new ForkTsCheckerWebpackPlugin({ + // typescript: { + // // async: true, + // typescriptPath: require.resolve('typescript'), + // configFile: resolve('tsconfig.json'), + // mode: 'readonly', + // // build: true, + // // configOverwrite: { + // // include: ['**/src/**/*.ts', '**/src/**/*.tsx', '**/src/**/*.css'], + // // }, + // profile: true, + // diagnosticOptions: { + // semantic: true, + // syntactic: true, + // }, + // }, + // }), + // new ForkTsCheckerWebpackPlugin({ + // typescript: { + // typescriptPath: require.resolve('typescript'), + // configFile: resolve('tsconfig.json'), + // // build: true, + // configOverwrite: { + // include: ['**/src/**/*.ts', '**/src/**/*.tsx'], + // }, + // diagnosticOptions: { + // semantic: true, + // syntactic: true, + // }, + // }, + // }), new IgnoreNotFoundExportPlugin(), new MiniCssExtractPlugin({ - // Options similar to the same options in webpackOptions.output - // all options are optional filename: devMode ? 'styles/[name].css' : 'styles/[name].[contenthash].css', chunkFilename: devMode ? 'styles/[name].bundle.css' : 'styles/[name].[contenthash].css', - ignoreOrder: false, // Enable to remove warnings about conflicting order + ignoreOrder: true, // Enable to remove warnings about conflicting order insert: linkTag => { let reshadowObj = document.getElementById('__reshadow__'); diff --git a/webapp/packages/core-cli/configs/webpack.plugin.config.js b/webapp/packages/core-cli/configs/webpack.plugin.config.js index 7752e11b60..64e89dc5df 100644 --- a/webapp/packages/core-cli/configs/webpack.plugin.config.js +++ b/webapp/packages/core-cli/configs/webpack.plugin.config.js @@ -1,16 +1,19 @@ const { resolve } = require('path'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin'); const { merge } = require('webpack-merge'); const commonConfig = require('./webpack.config.js'); -const main = resolve('src/index.ts'); +const index = resolve('src/index.ts'); const outputDir = resolve('lib'); const package = require(resolve('package.json')); module.exports = (env, argv) => merge(commonConfig(env, argv), { entry: { - [package.name.replace('@cloudbeaver/', '')]: main, + // [package.name.replace('@cloudbeaver/', '')]: index, + + index, }, output: { filename: '[name].js', @@ -19,13 +22,7 @@ module.exports = (env, argv) => merge(commonConfig(env, argv), { libraryTarget: 'commonjs', path: outputDir, }, - optimization: { - // splitChunks: { - // chunks: 'all', - // }, - // minimize: false, - // concatenateModules: false, - }, + externals: /^@cloudbeaver\/.+$/i, plugins: [ new PeerDepsExternalsPlugin(), ], diff --git a/webapp/packages/core-cli/configs/webpack.product.config.js b/webapp/packages/core-cli/configs/webpack.product.config.js index 613747bf17..b2dcb5fa61 100644 --- a/webapp/packages/core-cli/configs/webpack.product.config.js +++ b/webapp/packages/core-cli/configs/webpack.product.config.js @@ -8,7 +8,7 @@ const { merge } = require('webpack-merge'); const commonConfig = require('./webpack.config.js'); const { getAssets, withTimestamp } = require('./webpack.product.utils'); -const HtmlInjectWebpackPlugin = require('./HtmlInjectWebpackPlugin.js'); +const HtmlInjectWebpackPlugin = require('../utils/HtmlInjectWebpackPlugin.js'); const main = resolve('src/index.ts'); const sso = require.resolve('@cloudbeaver/plugin-sso/src/index.ts'); @@ -41,6 +41,12 @@ module.exports = (env, argv) => { swSrc: getServiceWorkerSource(), swDest: 'service-worker.js', maximumFileSizeToCacheInBytes: 20 * 1024 * 1024, + exclude: [ + /\.map$/, + /manifest.*\.js$/, + /\.tsx?$/, + /\.tsbuildinfo$/, + ], })]; } @@ -49,6 +55,7 @@ module.exports = (env, argv) => { main, sso, }, + devtool: false, output: { filename: 'index.[contenthash].js', chunkFilename: '[name].[contenthash].bundle.js', diff --git a/webapp/packages/core-cli/configs/webpack.product.dev.config.js b/webapp/packages/core-cli/configs/webpack.product.dev.config.js index 44be0161a2..e6d89a05a8 100644 --- a/webapp/packages/core-cli/configs/webpack.product.dev.config.js +++ b/webapp/packages/core-cli/configs/webpack.product.dev.config.js @@ -6,7 +6,7 @@ const fs = require('fs'); const { URL } = require('url'); const commonConfig = require('./webpack.config.js'); -const main = resolve('src/index.ts'); +const index = 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 { getAssets } = require('./webpack.product.utils'); @@ -15,7 +15,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); -const HtmlInjectWebpackPlugin = require('./HtmlInjectWebpackPlugin'); +const HtmlInjectWebpackPlugin = require('../utils/HtmlInjectWebpackPlugin'); const package = require(resolve('package.json')); @@ -42,7 +42,7 @@ module.exports = (env, argv) => { mode: 'development', context: resolve(__dirname, '../../../../../'), entry: { - main, + index, sso, }, optimization: { @@ -78,8 +78,7 @@ module.exports = (env, argv) => { logger.info(`Proxy from http://localhost:8080 to http://127.0.0.1:${port}`); httpProxy.createProxyServer({ target:`http://127.0.0.1:${port}` }).listen(8080); }, - }, - devtool: 'source-map', + }, plugins: [ new CopyWebpackPlugin({ patterns: getAssets(package, ''), @@ -91,7 +90,7 @@ module.exports = (env, argv) => { new HtmlWebpackPlugin({ template: resolve('src/index.html.ejs'), inject: 'body', - chunks: ['main'], + chunks: ['index'], version: package.version, title: package.product?.name, }), diff --git a/webapp/packages/core-cli/configs/webpack.product.utils.js b/webapp/packages/core-cli/configs/webpack.product.utils.js index dd60a0d524..1cb255e675 100644 --- a/webapp/packages/core-cli/configs/webpack.product.utils.js +++ b/webapp/packages/core-cli/configs/webpack.product.utils.js @@ -1,5 +1,6 @@ const fs = require('fs'); const { resolve } = require('path'); +const { getCloudBeaverDeps } = require('../utils/getCloudBeaverDeps'); function getServiceWorkerSource() { return require.resolve('@cloudbeaver/core-browser/src/service-worker.ts'); @@ -9,15 +10,6 @@ function withTimestamp(version) { return `${version}.${new Date().toISOString().substr(0, 19).replace('T', '').split(/[-:]+/).join('').slice(0, -2)}`; } -function getCloudbeaverDeps(package) { - if (!package.dependencies) { - return []; - } - - return Object.keys(package.dependencies) - .filter(dependency => /@cloudbeaver\/(.*?)/.test(dependency)); -} - function scanCloudbeaverDeps(package) { const deps = new Set(); const list = [package.name]; @@ -26,7 +18,8 @@ function scanCloudbeaverDeps(package) { const dependency = list.shift(); if (!deps.has(dependency)) { - list.push(...getCloudbeaverDeps(require(resolve('../../node_modules', dependency, 'package.json')))); + const allDependencies = getCloudBeaverDeps(require(resolve('../../node_modules', dependency, 'package.json'))); + list.push(...allDependencies.dependencies, ...allDependencies.peerDependencies); } deps.add(dependency); diff --git a/webapp/packages/core-cli/package.json b/webapp/packages/core-cli/package.json index fa1f47a410..19f640364b 100644 --- a/webapp/packages/core-cli/package.json +++ b/webapp/packages/core-cli/package.json @@ -1,6 +1,6 @@ { "name": "@cloudbeaver/core-cli", - "sideEffects": false, + "sideEffects": [], "version": "0.1.0", "description": "CLI for CloudBeaver build system", "license": "Apache-2.0", @@ -18,10 +18,10 @@ "core-cli-build": "./bin/build.js", "core-cli-test": "./bin/test.js", "core-cli-analyzer": "./bin/analyzer.js", - "core-cli-validate-dependencies": "./bin/validate-dependencies.js" + "core-cli-validate-dependencies": "./bin/validate-dependencies.js", + "typescript-resolve-references": "./bin/typescript-resolve-references.js" }, "scripts": { - "preinstall": "rimraf --glob lib/* && rimraf tsconfig.tsbuildinfo", "install": "tsc" }, "engines": { @@ -71,10 +71,11 @@ "webpack-merge": "~5.9.0" }, "devDependencies": { - "@types/jest": "~29.5.4", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", + "@types/jest": "~29.5.4", "@types/madge": "^5.0.0", "allure-commandline": "^2.22.1", + "babel-jest": "~29.6.4", "crypto": "^1.0.1", "fake-indexeddb": "^4.0.2", "http-proxy": "^1.18.1", @@ -82,9 +83,9 @@ "jest-allure": "^0.1.3", "jest-environment-jsdom": "~29.6.4", "jest-jasmine2": "^29.6.4", - "babel-jest": "~29.6.4", "madge": "^6.1.0", "react-refresh": "^0.14.0", + "tsconfig-paths-webpack-plugin": "^4.1.0", "workbox-webpack-plugin": "^7.0.0" } } diff --git a/webapp/packages/core-cli/tests/setup.ts b/webapp/packages/core-cli/tests/setup.js similarity index 100% rename from webapp/packages/core-cli/tests/setup.ts rename to webapp/packages/core-cli/tests/setup.js diff --git a/webapp/packages/core-cli/tsconfig.json b/webapp/packages/core-cli/tsconfig.json index ce9c9e7400..008f4e3574 100644 --- a/webapp/packages/core-cli/tsconfig.json +++ b/webapp/packages/core-cli/tsconfig.json @@ -2,12 +2,12 @@ "compilerOptions": { "rootDir": "src", "module": "CommonJS", - "outDir": "lib", + "outDir": "dist", "moduleResolution": "node", "esModuleInterop": true, "emitDeclarationOnly": false, "skipLibCheck": true }, - "include": ["src"], - "exclude": ["**/node_modules", "**/lib"] + "include": ["src/**/*"], + "exclude": ["node_modules/**/*", "dist/**/*", "tests/**/*"] } diff --git a/webapp/packages/core-cli/utils/CSSSourceResolver.js b/webapp/packages/core-cli/utils/CSSSourceResolver.js new file mode 100644 index 0000000000..9a8fdd1086 --- /dev/null +++ b/webapp/packages/core-cli/utils/CSSSourceResolver.js @@ -0,0 +1,73 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +class CSSSourceResolver { + // https://github.com/webpack/enhanced-resolve/ + constructor(supportedStyles) { + this.source = 'after-normal-resolve'; + this.target = 'relative'; + this.supportedStyles = supportedStyles; + } + + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver.getHook(this.source).tapAsync('CSSSourceResolver', (request, resolveContext, callback) => { + const descriptionFileRoot = /** @type {string} */ (request.descriptionFileRoot); + let relativePath = /** @type {string} */ (request.relativePath); + const requestRequest = /** @type {string | undefined} */ (request.request); + + if (this.supportedStyles.test(requestRequest) && relativePath.startsWith('./dist')) { + relativePath = './' + resolver.join(relativePath.replace('./dist', './src'), requestRequest); + const path = resolver.join(descriptionFileRoot, relativePath); + const obj = { + ...request, + path, + relativePath, + fullySpecified: false, + request: undefined, + }; + resolver.doResolve(target, obj, null, resolveContext, callback); + } else { + callback(); + } + }); + } +} + +module.exports = { + CSSSourceResolver, +}; + +// class CSSSourceResolver { +// // https://github.com/webpack/enhanced-resolve/ +// constructor(supportedStyles) { +// this.source = 'describedRelative'; +// this.target = 'file'; +// this.supportedStyles = supportedStyles; +// } + +// apply(resolver) { +// const target = resolver.ensureHook(this.target); +// resolver.getHook(this.source).tapAsync('CSSSourceResolver', (request, resolveContext, callback) => { +// const requestRelativePath = request.request ?? request.relativePath; +// if (requestRelativePath.startsWith('./') && this.supportedStyles.test(requestRelativePath)) { +// const srcRelativePath = join(request.descriptionFileRoot, 'src', relative('./dist', requestRelativePath)); +// var obj = { +// path: srcRelativePath, +// request: request.request, +// query: request.query, +// directory: request.directory, +// context: request.context, +// }; +// resolver.doResolve(target, obj, 'resolve css source: ' + srcRelativePath, resolveContext, callback); +// } else { +// callback(); +// } +// }); +// } +// } diff --git a/webapp/packages/core-cli/configs/HtmlInjectWebpackPlugin.js b/webapp/packages/core-cli/utils/HtmlInjectWebpackPlugin.js similarity index 100% rename from webapp/packages/core-cli/configs/HtmlInjectWebpackPlugin.js rename to webapp/packages/core-cli/utils/HtmlInjectWebpackPlugin.js diff --git a/webapp/packages/core-cli/utils/IgnoreNotFoundExportPlugin.js b/webapp/packages/core-cli/utils/IgnoreNotFoundExportPlugin.js new file mode 100644 index 0000000000..0312a9ba7c --- /dev/null +++ b/webapp/packages/core-cli/utils/IgnoreNotFoundExportPlugin.js @@ -0,0 +1,31 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +const ModuleDependencyWarning = require('webpack/lib/ModuleDependencyWarning'); + +class IgnoreNotFoundExportPlugin { + apply(compiler) { + const messageRegExp = /export '.*'( \(imported as '.*'\))? was not found in/; + function doneHook(stats) { + stats.compilation.warnings = stats.compilation.warnings.filter(warn => { + if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) { + return false; + } + return true; + }); + } + if (compiler.hooks) { + compiler.hooks.done.tap('IgnoreNotFoundExportPlugin', doneHook); + } else { + compiler.plugin('done', doneHook); + } + } +} + +module.exports = { + IgnoreNotFoundExportPlugin, +}; diff --git a/webapp/packages/core-cli/utils/getCloudBeaverDeps.js b/webapp/packages/core-cli/utils/getCloudBeaverDeps.js new file mode 100644 index 0000000000..63602f37da --- /dev/null +++ b/webapp/packages/core-cli/utils/getCloudBeaverDeps.js @@ -0,0 +1,31 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +function getCloudBeaverDeps(package) { + const resultMap = { + 'dependencies': [], + 'peerDependencies': [], + 'devDependencies': [], + }; + + for (const dep of Object.keys(resultMap)) { + const deps = Object.keys(package[dep] || {}); + + for (const dependency of deps) { + if (!resultMap[dep].includes(dependency) && /@cloudbeaver\/(.*?)/.test(dependency)) { + resultMap[dep].push(dependency); + } + } + } + + return resultMap; +} + +module.exports = { + getCloudBeaverDeps, +}; \ No newline at end of file diff --git a/webapp/packages/core-connections/package.json b/webapp/packages/core-connections/package.json index b548d349d1..c941a28b79 100644 --- a/webapp/packages/core-connections/package.json +++ b/webapp/packages/core-connections/package.json @@ -1,23 +1,25 @@ { "name": "@cloudbeaver/core-connections", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", @@ -25,7 +27,9 @@ "@cloudbeaver/core-extensions": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" @@ -35,5 +39,6 @@ "react-dom": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-connections/src/ConnectionDialectResource.ts b/webapp/packages/core-connections/src/ConnectionDialectResource.ts index 5b3a0bef3f..141aa3d350 100644 --- a/webapp/packages/core-connections/src/ConnectionDialectResource.ts +++ b/webapp/packages/core-connections/src/ConnectionDialectResource.ts @@ -8,15 +8,8 @@ import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; import { ProjectsService } from '@cloudbeaver/core-projects'; -import { - CachedMapAllKey, - CachedMapResource, - GraphQLService, - ResourceKey, - resourceKeyList, - ResourceKeyUtils, - SqlDialectInfo, -} from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, CachedMapResource, type ResourceKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import { GraphQLService, SqlDialectInfo } from '@cloudbeaver/core-sdk'; import type { IConnectionExecutionContextInfo } from './ConnectionExecutionContext/ConnectionExecutionContextResource'; import { @@ -38,14 +31,14 @@ export class ConnectionDialectResource extends CachedMapResource + this.aliases.add(ConnectionInfoProjectKey, param => resourceKeyList(connectionInfoResource.keys.filter(key => param.options.projectIds.includes(key.projectId))), ); - this.addAlias(ConnectionInfoActiveProjectKey, () => + this.aliases.add(ConnectionInfoActiveProjectKey, () => resourceKeyList(connectionInfoResource.keys.filter(key => projectsService.activeProjects.some(({ id }) => id === key.projectId))), ); - this.replaceAlias(CachedMapAllKey, () => resourceKeyList(connectionInfoResource.keys)); + this.aliases.replace(CachedMapAllKey, () => resourceKeyList(connectionInfoResource.keys)); this.before(ExecutorInterrupter.interrupter(key => !connectionInfoResource.isConnected(key))); } @@ -64,7 +57,7 @@ export class ConnectionDialectResource extends CachedMapResource> { const dialects: ConnectionDialect[] = []; - const keys = ResourceKeyUtils.toList(this.transformToKey(originalKey)); + const keys = ResourceKeyUtils.toList(this.aliases.transformToKey(originalKey)); for (const key of keys) { const { dialect } = await this.graphQLService.sdk.querySqlDialectInfo({ diff --git a/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextResource.ts b/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextResource.ts index c63d94f531..a443840f1f 100644 --- a/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextResource.ts +++ b/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextResource.ts @@ -12,15 +12,14 @@ import { injectable } from '@cloudbeaver/core-di'; import { CachedMapAllKey, CachedMapResource, - GraphQLService, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyAliasFactory, resourceKeyList, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, - SqlContextInfo, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { GraphQLService, SqlContextInfo } from '@cloudbeaver/core-sdk'; import { flat } from '@cloudbeaver/core-utils'; import { ConnectionInfoActiveProjectKey, ConnectionInfoResource } from '../ConnectionInfoResource'; @@ -49,7 +48,7 @@ export class ConnectionExecutionContextResource extends CachedMapResource CachedMapAllKey, ); - this.addAlias(ConnectionExecutionContextProjectKey, param => + this.aliases.add(ConnectionExecutionContextProjectKey, param => resourceKeyList( Array.from(this.data.entries()) .filter(([key, context]) => context.projectId === param.options.projectId) @@ -138,8 +137,8 @@ export class ConnectionExecutionContextResource extends CachedMapResource): Promise> { const contextsList: IConnectionExecutionContextInfo[] = []; let projectId: string | undefined; - const all = this.isAlias(originalKey, CachedMapAllKey); - const projectKey = this.isAlias(originalKey, ConnectionExecutionContextProjectKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); + const projectKey = this.aliases.isAlias(originalKey, ConnectionExecutionContextProjectKey); if (projectKey) { projectId = projectKey.options.projectId; diff --git a/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextService.ts b/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextService.ts index f9c853e257..b15d92ec06 100644 --- a/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextService.ts +++ b/webapp/packages/core-connections/src/ConnectionExecutionContext/ConnectionExecutionContextService.ts @@ -7,7 +7,7 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { TaskScheduler } from '@cloudbeaver/core-executor'; -import { CachedMapAllKey, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { MetadataMap } from '@cloudbeaver/core-utils'; import type { IConnectionInfoParams } from '../IConnectionsResource'; diff --git a/webapp/packages/core-connections/src/ConnectionFolderEventHandler.ts b/webapp/packages/core-connections/src/ConnectionFolderEventHandler.ts index 3ed6c8056d..b073c8688b 100644 --- a/webapp/packages/core-connections/src/ConnectionFolderEventHandler.ts +++ b/webapp/packages/core-connections/src/ConnectionFolderEventHandler.ts @@ -9,7 +9,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { ISessionEvent, SessionEventId, SessionEventSource, SessionEventTopic, TopicEventHandler } from '@cloudbeaver/core-root'; import type { CbDatasourceFolderEvent as IConnectionFolderEvent } from '@cloudbeaver/core-sdk'; -export { IConnectionFolderEvent }; +export type { IConnectionFolderEvent }; @injectable() export class ConnectionFolderEventHandler extends TopicEventHandler { diff --git a/webapp/packages/core-connections/src/ConnectionFolderResource.ts b/webapp/packages/core-connections/src/ConnectionFolderResource.ts index 6cb1e05bf5..7b1b17c5c0 100644 --- a/webapp/packages/core-connections/src/ConnectionFolderResource.ts +++ b/webapp/packages/core-connections/src/ConnectionFolderResource.ts @@ -9,18 +9,17 @@ import { action, makeObservable, runInAction } from 'mobx'; import { AppAuthService } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; -import { SessionDataResource } from '@cloudbeaver/core-root'; import { CachedMapAllKey, CachedMapResource, - ConnectionFolderInfoFragment, - GraphQLService, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyAliasFactory, resourceKeyList, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { SessionDataResource } from '@cloudbeaver/core-root'; +import { ConnectionFolderInfoFragment, GraphQLService } from '@cloudbeaver/core-sdk'; import { createConnectionFolderParam } from './createConnectionFolderParam'; import { getConnectionFolderIdFromNodeId } from './NavTree/getConnectionFolderIdFromNodeId'; @@ -44,7 +43,7 @@ export class ConnectionFolderResource extends CachedMapResource resourceKeyList(this.keys.filter(key => key.projectId === param.options.projectId))); + this.aliases.add(ConnectionFolderProjectKey, param => resourceKeyList(this.keys.filter(key => key.projectId === param.options.projectId))); makeObservable(this, { create: action, @@ -85,8 +84,8 @@ export class ConnectionFolderResource extends CachedMapResource): Promise> { - const all = this.isAlias(originalKey, CachedMapAllKey); - const projectFoldersKey = this.isAlias(originalKey, ConnectionFolderProjectKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); + const projectFoldersKey = this.aliases.isAlias(originalKey, ConnectionFolderProjectKey); const folderList: ConnectionFolder[] = []; let projectId: string | undefined; let folderId: string | undefined; diff --git a/webapp/packages/core-connections/src/ConnectionInfoEventHandler.ts b/webapp/packages/core-connections/src/ConnectionInfoEventHandler.ts index 628fae3de2..bf91bc2c5e 100644 --- a/webapp/packages/core-connections/src/ConnectionInfoEventHandler.ts +++ b/webapp/packages/core-connections/src/ConnectionInfoEventHandler.ts @@ -9,7 +9,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { ISessionEvent, SessionEventId, SessionEventSource, SessionEventTopic, TopicEventHandler } from '@cloudbeaver/core-root'; import type { CbDatasourceEvent as IConnectionInfoEvent } from '@cloudbeaver/core-sdk'; -export { IConnectionInfoEvent }; +export type { IConnectionInfoEvent }; @injectable() export class ConnectionInfoEventHandler extends TopicEventHandler { diff --git a/webapp/packages/core-connections/src/ConnectionInfoResource.ts b/webapp/packages/core-connections/src/ConnectionInfoResource.ts index 945d5bd3f1..22449f57e1 100644 --- a/webapp/packages/core-connections/src/ConnectionInfoResource.ts +++ b/webapp/packages/core-connections/src/ConnectionInfoResource.ts @@ -11,25 +11,27 @@ import { AppAuthService, UserInfoResource } from '@cloudbeaver/core-authenticati import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter, ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; +import { + CachedMapAllKey, + CachedMapResource, + type CachedResourceIncludeArgs, + isResourceAlias, + type ResourceKey, + resourceKeyList, + type ResourceKeyList, + resourceKeyListAlias, + resourceKeyListAliasFactory, + ResourceKeyUtils, +} from '@cloudbeaver/core-resource'; import { DataSynchronizationService, NavigatorViewSettings, ServerEventId, SessionDataResource } from '@cloudbeaver/core-root'; import { AdminConnectionGrantInfo, AdminConnectionSearchInfo, - CachedMapAllKey, - CachedMapResource, - CachedResourceIncludeArgs, ConnectionConfig, GetUserConnectionsQueryVariables, GraphQLService, InitConnectionMutationVariables, - isResourceAlias, NavigatorSettingsInput, - ResourceKey, - resourceKeyList, - ResourceKeyList, - resourceKeyListAlias, - resourceKeyListAliasFactory, - ResourceKeyUtils, TestConnectionMutation, UserConnectionAuthPropertiesFragment, } from '@cloudbeaver/core-sdk'; @@ -97,9 +99,9 @@ export class ConnectionInfoResource extends CachedMapResource resourceKeyList(this.keys.filter(key => param.options.projectIds.includes(key.projectId)))); + this.aliases.add(ConnectionInfoProjectKey, param => resourceKeyList(this.keys.filter(key => param.options.projectIds.includes(key.projectId)))); - this.addAlias(ConnectionInfoActiveProjectKey, () => + this.aliases.add(ConnectionInfoActiveProjectKey, () => resourceKeyList(this.keys.filter(key => projectsService.activeProjects.some(({ id }) => id === key.projectId))), ); @@ -232,7 +234,7 @@ export class ConnectionInfoResource extends CachedMapResource): boolean; isConnected(key: ResourceKey): boolean; isConnected(key: ResourceKey): boolean { - key = ResourceKeyUtils.toList(this.transformToKey(key)); + key = ResourceKeyUtils.toList(this.aliases.transformToKey(key)); return this.get(key).every(connection => connection?.connected ?? false); } @@ -434,7 +436,7 @@ export class ConnectionInfoResource extends CachedMapResource): Promise; deleteConnection(key: ResourceKey): Promise; async deleteConnection(key: ResourceKey): Promise { - key = this.transformToKey(key); + key = this.aliases.transformToKey(key); await ResourceKeyUtils.forEachAsync(key, async key => { await this.performUpdate(key, [], async () => { await this.graphQLService.sdk.deleteConnection({ projectId: key.projectId, connectionId: key.connectionId }); @@ -469,7 +471,7 @@ export class ConnectionInfoResource extends CachedMapResource> { const connectionsList: Connection[] = []; - const projectKey = this.isAlias(originalKey, ConnectionInfoProjectKey); + const projectKey = this.aliases.isAlias(originalKey, ConnectionInfoProjectKey); let removedConnections: IConnectionInfoParams[] = []; let projectId: string | undefined; let projectIds: string[] | undefined; @@ -478,12 +480,12 @@ export class ConnectionInfoResource extends CachedMapResource project.id); } if (isResourceAlias(originalKey)) { - const key = this.transformToKey(originalKey); + const key = this.aliases.transformToKey(originalKey); const outdated = ResourceKeyUtils.filter(key, key => this.isOutdated(key)); if (!refresh && outdated.length === 1) { @@ -515,7 +517,7 @@ export class ConnectionInfoResource extends CachedMapResource { if (isResourceAlias(originalKey)) { - removedConnections = ResourceKeyUtils.toList(this.transformToKey(originalKey)).filter( + removedConnections = ResourceKeyUtils.toList(this.aliases.transformToKey(originalKey)).filter( key => !connectionsList.some(connection => isConnectionInfoParamEqual(key, createConnectionParam(connection))), ); } diff --git a/webapp/packages/core-connections/src/ConnectionsManagerService.ts b/webapp/packages/core-connections/src/ConnectionsManagerService.ts index 9834edfa5e..0f55876bf2 100644 --- a/webapp/packages/core-connections/src/ConnectionsManagerService.ts +++ b/webapp/packages/core-connections/src/ConnectionsManagerService.ts @@ -7,9 +7,9 @@ */ import { computed, makeObservable } from 'mobx'; -import { ProcessSnackbar } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialogDelete, ProcessSnackbar } from '@cloudbeaver/core-blocks'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { Executor, ExecutorInterrupter, IExecutor } from '@cloudbeaver/core-executor'; import { ProjectInfo, projectInfoSortByName, ProjectsService } from '@cloudbeaver/core-projects'; diff --git a/webapp/packages/core-connections/src/ContainerResource.ts b/webapp/packages/core-connections/src/ContainerResource.ts index 89598cb36e..259db3a248 100644 --- a/webapp/packages/core-connections/src/ContainerResource.ts +++ b/webapp/packages/core-connections/src/ContainerResource.ts @@ -8,15 +8,8 @@ import { AppAuthService } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; -import { - CachedMapResource, - GraphQLService, - isResourceAlias, - NavNodeInfoFragment, - ResourceKey, - resourceKeyList, - ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +import { CachedMapResource, isResourceAlias, type ResourceKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import { GraphQLService, NavNodeInfoFragment } from '@cloudbeaver/core-sdk'; import { isNull } from '@cloudbeaver/core-utils'; import { ConnectionInfoActiveProjectKey, ConnectionInfoResource } from './ConnectionInfoResource'; diff --git a/webapp/packages/core-connections/src/DBDriverResource.ts b/webapp/packages/core-connections/src/DBDriverResource.ts index b63bd77978..16019588fd 100644 --- a/webapp/packages/core-connections/src/DBDriverResource.ts +++ b/webapp/packages/core-connections/src/DBDriverResource.ts @@ -9,18 +9,9 @@ import { computed, makeObservable } from 'mobx'; import { AppAuthService } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapAllKey, CachedMapResource, isResourceAlias, type ResourceKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { - CachedMapAllKey, - CachedMapResource, - DatabaseDriverFragment, - DriverListQueryVariables, - GraphQLService, - isResourceAlias, - ResourceKey, - resourceKeyList, - ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +import { DatabaseDriverFragment, DriverListQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; export type DBDriver = DatabaseDriverFragment; @@ -66,7 +57,7 @@ export class DBDriverResource extends CachedMapResource, includes?: ReadonlyArray): Promise> { const driversList: DBDriver[] = []; - const all = this.isAlias(originalKey, CachedMapAllKey); + const all = this.aliases.isAlias(originalKey, CachedMapAllKey); await ResourceKeyUtils.forEachAsync(originalKey, async key => { const driverId = isResourceAlias(key) ? undefined : key; diff --git a/webapp/packages/plugin-connections/src/ContextMenu/DATA_CONTEXT_CONNECTION.ts b/webapp/packages/core-connections/src/DataContexts/DATA_CONTEXT_CONNECTION.ts similarity index 70% rename from webapp/packages/plugin-connections/src/ContextMenu/DATA_CONTEXT_CONNECTION.ts rename to webapp/packages/core-connections/src/DataContexts/DATA_CONTEXT_CONNECTION.ts index b81ecc19bf..fdace4f2b7 100644 --- a/webapp/packages/plugin-connections/src/ContextMenu/DATA_CONTEXT_CONNECTION.ts +++ b/webapp/packages/core-connections/src/DataContexts/DATA_CONTEXT_CONNECTION.ts @@ -5,7 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import type { Connection } from '@cloudbeaver/core-connections'; -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; + +import type { Connection } from '../ConnectionInfoResource'; export const DATA_CONTEXT_CONNECTION = createDataContext('connection'); diff --git a/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts b/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts index 2a44c2786f..d3e09177ee 100644 --- a/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts +++ b/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapAllKey, CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, CachedMapResource, DatabaseAuthModel, GraphQLService, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { type DatabaseAuthModel, GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class DatabaseAuthModelsResource extends CachedMapResource { diff --git a/webapp/packages/core-connections/src/NavTree/ConnectionNavNodeService.ts b/webapp/packages/core-connections/src/NavTree/ConnectionNavNodeService.ts index c51e55e593..d1d706427b 100644 --- a/webapp/packages/core-connections/src/NavTree/ConnectionNavNodeService.ts +++ b/webapp/packages/core-connections/src/NavTree/ConnectionNavNodeService.ts @@ -17,8 +17,8 @@ import { NodeManagerUtils, } from '@cloudbeaver/core-navigation-tree'; import { getProjectNodeId } from '@cloudbeaver/core-projects'; +import { isResourceAlias, type ResourceKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { ServerEventId } from '@cloudbeaver/core-root'; -import { isResourceAlias, type ResourceKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; import { ConnectionFolderEventHandler, IConnectionFolderEvent } from '../ConnectionFolderEventHandler'; import { Connection, ConnectionInfoActiveProjectKey, ConnectionInfoResource, createConnectionParam } from '../ConnectionInfoResource'; diff --git a/webapp/packages/core-connections/src/NetworkHandlerResource.ts b/webapp/packages/core-connections/src/NetworkHandlerResource.ts index 9e3f2cb241..d7fb97dec7 100644 --- a/webapp/packages/core-connections/src/NetworkHandlerResource.ts +++ b/webapp/packages/core-connections/src/NetworkHandlerResource.ts @@ -7,15 +7,9 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; +import { CachedMapAllKey, CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { - CachedMapAllKey, - CachedMapResource, - GraphQLService, - NetworkHandlerConfigInput, - NetworkHandlerDescriptor, - resourceKeyList, -} from '@cloudbeaver/core-sdk'; +import { GraphQLService, NetworkHandlerConfigInput, NetworkHandlerDescriptor } from '@cloudbeaver/core-sdk'; export const SSH_TUNNEL_ID = 'ssh_tunnel'; diff --git a/webapp/packages/core-connections/src/index.ts b/webapp/packages/core-connections/src/index.ts index 3f7752f722..04475a9ff9 100644 --- a/webapp/packages/core-connections/src/index.ts +++ b/webapp/packages/core-connections/src/index.ts @@ -3,6 +3,8 @@ export * from './ConnectionExecutionContext/ConnectionExecutionContextResource'; export * from './ConnectionExecutionContext/ConnectionExecutionContextService'; export * from './ConnectionExecutionContext/IConnectionExecutionContext'; +export * from './DataContexts/DATA_CONTEXT_CONNECTION'; + export * from './extensions/IObjectCatalogProvider'; export * from './extensions/IObjectCatalogSetter'; export * from './extensions/IObjectSchemaProvider'; diff --git a/webapp/packages/core-connections/tsconfig.json b/webapp/packages/core-connections/tsconfig.json index bd4ed8f7d0..f193a43c8f 100644 --- a/webapp/packages/core-connections/tsconfig.json +++ b/webapp/packages/core-connections/tsconfig.json @@ -1,10 +1,70 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-data-context/.gitignore b/webapp/packages/core-data-context/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-data-context/.gitignore @@ -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* diff --git a/webapp/packages/core-data-context/package.json b/webapp/packages/core-data-context/package.json new file mode 100644 index 0000000000..8afe9b2835 --- /dev/null +++ b/webapp/packages/core-data-context/package.json @@ -0,0 +1,30 @@ +{ + "name": "@cloudbeaver/core-data-context", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" + }, + "peerDependencies": { + "mobx": "~6.x.x", + "mobx-react-lite": "~3.x.x", + "react": "~18.x.x", + "reshadow": "~0.x.x" + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-view/src/DataContext/DATA_CONTEXT_DI_PROVIDER.ts b/webapp/packages/core-data-context/src/DataContext/DATA_CONTEXT_DI_PROVIDER.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/DATA_CONTEXT_DI_PROVIDER.ts rename to webapp/packages/core-data-context/src/DataContext/DATA_CONTEXT_DI_PROVIDER.ts diff --git a/webapp/packages/core-view/src/DataContext/DataContext.ts b/webapp/packages/core-data-context/src/DataContext/DataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/DataContext.ts rename to webapp/packages/core-data-context/src/DataContext/DataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/DataContextGetter.ts b/webapp/packages/core-data-context/src/DataContext/DataContextGetter.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/DataContextGetter.ts rename to webapp/packages/core-data-context/src/DataContext/DataContextGetter.ts diff --git a/webapp/packages/core-view/src/DataContext/DynamicDataContext.ts b/webapp/packages/core-data-context/src/DataContext/DynamicDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/DynamicDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/DynamicDataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/IDataContext.ts b/webapp/packages/core-data-context/src/DataContext/IDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/IDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/IDataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/IDataContextProvider.ts b/webapp/packages/core-data-context/src/DataContext/IDataContextProvider.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/IDataContextProvider.ts rename to webapp/packages/core-data-context/src/DataContext/IDataContextProvider.ts diff --git a/webapp/packages/core-view/src/DataContext/TempDataContext.ts b/webapp/packages/core-data-context/src/DataContext/TempDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/TempDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/TempDataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/createDataContext.ts b/webapp/packages/core-data-context/src/DataContext/createDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/createDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/createDataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/dataContextAddDIProvider.ts b/webapp/packages/core-data-context/src/DataContext/dataContextAddDIProvider.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/dataContextAddDIProvider.ts rename to webapp/packages/core-data-context/src/DataContext/dataContextAddDIProvider.ts diff --git a/webapp/packages/core-view/src/DataContext/useDataContext.ts b/webapp/packages/core-data-context/src/DataContext/useDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/useDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/useDataContext.ts diff --git a/webapp/packages/core-view/src/DataContext/useDynamicDataContext.ts b/webapp/packages/core-data-context/src/DataContext/useDynamicDataContext.ts similarity index 100% rename from webapp/packages/core-view/src/DataContext/useDynamicDataContext.ts rename to webapp/packages/core-data-context/src/DataContext/useDynamicDataContext.ts diff --git a/webapp/packages/core-data-context/src/index.ts b/webapp/packages/core-data-context/src/index.ts new file mode 100644 index 0000000000..dfe60d3993 --- /dev/null +++ b/webapp/packages/core-data-context/src/index.ts @@ -0,0 +1,22 @@ +export * from './DataContext/createDataContext'; +export * from './DataContext/DATA_CONTEXT_DI_PROVIDER'; +export * from './DataContext/DataContext'; +export * from './DataContext/dataContextAddDIProvider'; +export * from './DataContext/DynamicDataContext'; +export * from './DataContext/IDataContext'; +export * from './DataContext/IDataContextProvider'; +export * from './DataContext/TempDataContext'; +export * from './DataContext/useDataContext'; +export * from './DataContext/useDynamicDataContext'; +export * from './DataContext/createDataContext'; +export * from './DataContext/DATA_CONTEXT_DI_PROVIDER'; +export * from './DataContext/DataContext'; +export * from './DataContext/dataContextAddDIProvider'; +export * from './DataContext/DataContextGetter'; +export * from './DataContext/DynamicDataContext'; +export * from './DataContext/IDataContext'; +export * from './DataContext/IDataContextProvider'; +export * from './DataContext/TempDataContext'; +export * from './DataContext/useDataContext'; +export * from './DataContext/useDynamicDataContext'; +export { coreDataContextManifest } from './manifest'; diff --git a/webapp/packages/core-data-context/src/manifest.ts b/webapp/packages/core-data-context/src/manifest.ts new file mode 100644 index 0000000000..63a8d4ae53 --- /dev/null +++ b/webapp/packages/core-data-context/src/manifest.ts @@ -0,0 +1,16 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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'; + +export const coreDataContextManifest: PluginManifest = { + info: { + name: 'Core Data Context', + }, + + providers: [], +}; diff --git a/webapp/packages/core-data-context/tsconfig.json b/webapp/packages/core-data-context/tsconfig.json new file mode 100644 index 0000000000..f6ff12fc3c --- /dev/null +++ b/webapp/packages/core-data-context/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/core-di/package.json b/webapp/packages/core-di/package.json index 81a934036f..cd098cf320 100644 --- a/webapp/packages/core-di/package.json +++ b/webapp/packages/core-di/package.json @@ -1,27 +1,31 @@ { "name": "@cloudbeaver/core-di", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/core-di.js", - "module": "lib/core-di.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", - "postbuild": "tsc", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "inversify": "~6.0.1" + "inversify": "~6.0.1", + "@cloudbeaver/core-executor": "~0.1.0" }, "peerDependencies": { - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "react": "~18.x.x" - } -} \ No newline at end of file + "react": "~18.x.x", + "@testing-library/jest-dom": "~6.x.x", + "@testing-library/react": "~13.x.x" + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-di/src/App.ts b/webapp/packages/core-di/src/App.ts index a924a100c9..023b62e90f 100644 --- a/webapp/packages/core-di/src/App.ts +++ b/webapp/packages/core-di/src/App.ts @@ -6,7 +6,6 @@ * you may not use this file except in compliance with the License. */ import { Executor, IExecutor } from '@cloudbeaver/core-executor'; -import { flat } from '@cloudbeaver/core-utils'; import { Bootstrap } from './Bootstrap'; import { Dependency } from './Dependency'; @@ -40,7 +39,7 @@ export class App { } getServices(): IServiceConstructor[] { - return flat(this.plugins.map(plugin => plugin.providers)); + return this.plugins.map(plugin => plugin.providers).flat(); } registerChildContainer(container: DIContainer): void { diff --git a/webapp/packages/core-di/src/AppContext.tsx b/webapp/packages/core-di/src/AppContext.tsx index 610056a148..83cc46d0b0 100644 --- a/webapp/packages/core-di/src/AppContext.tsx +++ b/webapp/packages/core-di/src/AppContext.tsx @@ -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 { createContext, StrictMode } from 'react'; +import { createContext } from 'react'; import type { IServiceInjector } from './IApp'; import { useAppLoadingScreen } from './useAppLoadingScreen'; diff --git a/webapp/packages/core-di/tsconfig.json b/webapp/packages/core-di/tsconfig.json index b2a1cc12f9..daa99a63fb 100644 --- a/webapp/packages/core-di/tsconfig.json +++ b/webapp/packages/core-di/tsconfig.json @@ -1,12 +1,25 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib", - "declarationMap": true, - "declaration": true + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../core-executor" }, { "path": "../core-utils" }] + "references": [ + { + "path": "..\\core-executor" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-dialogs/package.json b/webapp/packages/core-dialogs/package.json index 4ca89d94b7..d9dad3e26a 100644 --- a/webapp/packages/core-dialogs/package.json +++ b/webapp/packages/core-dialogs/package.json @@ -1,25 +1,24 @@ { "name": "@cloudbeaver/core-dialogs", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { @@ -28,5 +27,6 @@ "mobx": "~6.x.x", "reshadow": "~0.x.x", "mobx-react-lite": "~3.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-dialogs/src/index.ts b/webapp/packages/core-dialogs/src/index.ts index a812a6f3b2..898d32f224 100644 --- a/webapp/packages/core-dialogs/src/index.ts +++ b/webapp/packages/core-dialogs/src/index.ts @@ -1,15 +1,6 @@ -export * from './CommonDialog/CommonDialog/CommonDialogBody'; -export * from './CommonDialog/CommonDialog/CommonDialogFooter'; -export * from './CommonDialog/CommonDialog/CommonDialogHeader'; -export * from './CommonDialog/CommonDialog/CommonDialogWrapper'; export * from './CommonDialog/CommonDialogService'; -export * from './CommonDialog/ConfirmationDialog'; -export * from './CommonDialog/ConfirmationDialogDelete'; -export * from './CommonDialog/RenameDialog'; -export * from './CommonDialog/DialogsPortal'; export * from './Menu/IMenuPanel'; -export { MenuTrigger, type MenuState } from './Menu/MenuPanel/MenuTrigger'; export * from './Menu/StaticMenu/StaticMenu'; export * from './Menu/models/ComputedContextMenuModel'; diff --git a/webapp/packages/core-dialogs/src/manifest.ts b/webapp/packages/core-dialogs/src/manifest.ts index fbdc320d20..0accbda42e 100644 --- a/webapp/packages/core-dialogs/src/manifest.ts +++ b/webapp/packages/core-dialogs/src/manifest.ts @@ -10,7 +10,7 @@ import type { PluginManifest } from '@cloudbeaver/core-di'; import { CommonDialogService } from './CommonDialog/CommonDialogService'; import { ContextMenuService } from './Menu/ContextMenu/ContextMenuService'; -export const codeDialogsManifest: PluginManifest = { +export const coreDialogsManifest: PluginManifest = { info: { name: 'Core Dialogs', }, diff --git a/webapp/packages/core-dialogs/tsconfig.json b/webapp/packages/core-dialogs/tsconfig.json index bd4ed8f7d0..ac96923b75 100644 --- a/webapp/packages/core-dialogs/tsconfig.json +++ b/webapp/packages/core-dialogs/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-events/package.json b/webapp/packages/core-events/package.json index 816d15d26f..3cac14bfec 100644 --- a/webapp/packages/core-events/package.json +++ b/webapp/packages/core-events/package.json @@ -1,31 +1,35 @@ { "name": "@cloudbeaver/core-events", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0" + "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "@testing-library/jest-dom": "~6.x.x", "mobx": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-events/src/EventsSettingsService.test.ts b/webapp/packages/core-events/src/EventsSettingsService.test.ts index 77d6095c5a..c2cef344e9 100644 --- a/webapp/packages/core-events/src/EventsSettingsService.test.ts +++ b/webapp/packages/core-events/src/EventsSettingsService.test.ts @@ -7,20 +7,23 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { createApp } from '@cloudbeaver/tests-runner'; import { EventsSettings, EventsSettingsService } from './EventsSettingsService'; +import { coreEventsManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp(coreEventsManifest, corePluginManifest, coreProductManifest, coreRootManifest, coreSDKManifest); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-events/src/index.ts b/webapp/packages/core-events/src/index.ts index e1692daed5..88e1caaa37 100644 --- a/webapp/packages/core-events/src/index.ts +++ b/webapp/packages/core-events/src/index.ts @@ -5,4 +5,4 @@ export * from './INotification'; export * from './UIError'; export * from './ExceptionsCatcherService'; export * from './EventsSettingsService'; -export { manifest as coreEventsManifest } from './manifest'; +export * from './manifest'; diff --git a/webapp/packages/core-events/src/manifest.ts b/webapp/packages/core-events/src/manifest.ts index 80fb0581e0..a1ee95092b 100644 --- a/webapp/packages/core-events/src/manifest.ts +++ b/webapp/packages/core-events/src/manifest.ts @@ -11,7 +11,7 @@ import { EventsSettingsService } from './EventsSettingsService'; import { ExceptionsCatcherService } from './ExceptionsCatcherService'; import { NotificationService } from './NotificationService'; -export const manifest: PluginManifest = { +export const coreEventsManifest: PluginManifest = { info: { name: 'Core Events', }, diff --git a/webapp/packages/core-events/tsconfig.json b/webapp/packages/core-events/tsconfig.json index bd4ed8f7d0..74fd621ae3 100644 --- a/webapp/packages/core-events/tsconfig.json +++ b/webapp/packages/core-events/tsconfig.json @@ -1,10 +1,40 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-executor/package.json b/webapp/packages/core-executor/package.json index 991d414f85..0b61916c91 100644 --- a/webapp/packages/core-executor/package.json +++ b/webapp/packages/core-executor/package.json @@ -1,23 +1,33 @@ { "name": "@cloudbeaver/core-executor", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/core-executor.js", - "module": "lib/core-executor.js", - "types": "src/index.ts", + "main": "dist/index.js", + "files": [ + "lib", + "src", + "public", + ".gitignore", + "package.json" + ], "scripts": { - "prebuild": "rimraf --glob lib/*", "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", - "postbuild": "tsc", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "pretest": "tsc -b", + "test": "core-cli-test", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, - "dependencies": { }, + "dependencies": {}, "peerDependencies": { - "@cloudbeaver/core-utils": "~0.1.0", "mobx": "~6.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-executor/src/Executor.ts b/webapp/packages/core-executor/src/Executor.ts index 41b50f7463..d99a69c976 100644 --- a/webapp/packages/core-executor/src/Executor.ts +++ b/webapp/packages/core-executor/src/Executor.ts @@ -5,8 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { flat } from '@cloudbeaver/core-utils'; - import { ExecutionContext } from './ExecutionContext'; import { executionExceptionContext } from './executionExceptionContext'; import { ExecutorHandlersCollection } from './ExecutorHandlersCollection'; @@ -44,7 +42,7 @@ export class Executor extends ExecutorHandlersCollection implements if (!context) { context = new ExecutionContext(data); } - return this.executeHandlersCollection(this, data, context, flat([scope || []])); + return this.executeHandlersCollection(this, data, context, [scope || []].flat()); }); } @@ -63,7 +61,7 @@ export class Executor extends ExecutorHandlersCollection implements if (!context) { context = new ExecutionContext(data); } - return this.executeHandlersCollection(this, data, context, flat([scope || []])); + return this.executeHandlersCollection(this, data, context, [scope || []].flat()); }); } @@ -135,7 +133,7 @@ export class Executor extends ExecutorHandlersCollection implements const mappedData = link.map ? link.map(data, context) : data; const chainedContext = new ExecutionContext(mappedData, context); - await this.executeHandlersCollection(link.executor, mappedData, chainedContext, flat([collection.getLinkHandlers(link.executor) || []])); + await this.executeHandlersCollection(link.executor, mappedData, chainedContext, [collection.getLinkHandlers(link.executor) || []].flat()); } } diff --git a/webapp/packages/core-executor/src/SyncExecutor.ts b/webapp/packages/core-executor/src/SyncExecutor.ts index f355c6c0c3..3b9330af56 100644 --- a/webapp/packages/core-executor/src/SyncExecutor.ts +++ b/webapp/packages/core-executor/src/SyncExecutor.ts @@ -5,8 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { flat } from '@cloudbeaver/core-utils'; - import { ExecutionContext } from './ExecutionContext'; import { executionExceptionContext } from './executionExceptionContext'; import { ExecutorHandlersCollection } from './ExecutorHandlersCollection'; @@ -35,7 +33,7 @@ export class SyncExecutor extends ExecutorHandlersCollection implem if (!context) { context = new ExecutionContext(data); } - return this.executeHandlersCollection(this, data, context, flat([scope || []])); + return this.executeHandlersCollection(this, data, context, [scope || []].flat()); } executeScope( @@ -52,7 +50,7 @@ export class SyncExecutor extends ExecutorHandlersCollection implem if (!context) { context = new ExecutionContext(data); } - return this.executeHandlersCollection(this, data, context, flat([scope || []])); + return this.executeHandlersCollection(this, data, context, [scope || []].flat()); } private executeHandlersCollection( @@ -118,7 +116,7 @@ export class SyncExecutor extends ExecutorHandlersCollection implem const mappedData = link.map ? link.map(data, context) : data; const chainedContext = new ExecutionContext(mappedData, context); - this.executeHandlersCollection(link.executor, mappedData, chainedContext, flat([collection.getLinkHandlers(link.executor) || []])); + this.executeHandlersCollection(link.executor, mappedData, chainedContext, [collection.getLinkHandlers(link.executor) || []].flat()); } } diff --git a/webapp/packages/core-executor/tsconfig.json b/webapp/packages/core-executor/tsconfig.json index 48f43bf851..870c9252f8 100644 --- a/webapp/packages/core-executor/tsconfig.json +++ b/webapp/packages/core-executor/tsconfig.json @@ -1,12 +1,21 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib", - "declarationMap": true, - "declaration": true + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/", "src/**/*.test.ts", "src/**/*.test.tsx"], - "references": [{ "path": "../core-utils" }] + "references": [], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-extensions/package.json b/webapp/packages/core-extensions/package.json index 6b2342b509..cbec51365b 100644 --- a/webapp/packages/core-extensions/package.json +++ b/webapp/packages/core-extensions/package.json @@ -1,19 +1,22 @@ { "name": "@cloudbeaver/core-extensions", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, - "dependencies": {} -} \ No newline at end of file + "dependencies": {}, + "peerDependencies": {}, + "devDependencies": {} +} diff --git a/webapp/packages/core-extensions/tsconfig.json b/webapp/packages/core-extensions/tsconfig.json index bd4ed8f7d0..870c9252f8 100644 --- a/webapp/packages/core-extensions/tsconfig.json +++ b/webapp/packages/core-extensions/tsconfig.json @@ -1,10 +1,21 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-localization/package.json b/webapp/packages/core-localization/package.json index 1e9dca5a1e..31c86da0c4 100644 --- a/webapp/packages/core-localization/package.json +++ b/webapp/packages/core-localization/package.json @@ -1,20 +1,22 @@ { "name": "@cloudbeaver/core-localization", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", @@ -28,5 +30,8 @@ "peerDependencies": { "mobx": "~6.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-localization/src/LocalizationService.test.ts b/webapp/packages/core-localization/src/LocalizationService.test.ts index e487d40922..52de0c8461 100644 --- a/webapp/packages/core-localization/src/LocalizationService.test.ts +++ b/webapp/packages/core-localization/src/LocalizationService.test.ts @@ -7,20 +7,35 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { createApp } from '@cloudbeaver/tests-runner'; import { ILocalizationSettings, LocalizationService } from './LocalizationService'; +import { coreLocalizationManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, +); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-localization/src/index.ts b/webapp/packages/core-localization/src/index.ts index 5b95adb8c9..b798efcd1f 100644 --- a/webapp/packages/core-localization/src/index.ts +++ b/webapp/packages/core-localization/src/index.ts @@ -1,4 +1,4 @@ -export { manifest as coreLocalizationManifest } from './manifest'; +export * from './manifest'; export * from './LocalizationService'; export * from './Locale'; export * from './TLocalizationToken'; diff --git a/webapp/packages/core-localization/src/manifest.ts b/webapp/packages/core-localization/src/manifest.ts index 2282af3f2c..acbf1094da 100644 --- a/webapp/packages/core-localization/src/manifest.ts +++ b/webapp/packages/core-localization/src/manifest.ts @@ -9,7 +9,7 @@ import type { PluginManifest } from '@cloudbeaver/core-di'; import { LocalizationService } from './LocalizationService'; -export const manifest: PluginManifest = { +export const coreLocalizationManifest: PluginManifest = { info: { name: 'Core Localization', }, diff --git a/webapp/packages/core-localization/tsconfig.json b/webapp/packages/core-localization/tsconfig.json index bd4ed8f7d0..aedfdee74a 100644 --- a/webapp/packages/core-localization/tsconfig.json +++ b/webapp/packages/core-localization/tsconfig.json @@ -1,10 +1,46 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-navigation-tree/package.json b/webapp/packages/core-navigation-tree/package.json index 874e2beec7..5deee1bc88 100644 --- a/webapp/packages/core-navigation-tree/package.json +++ b/webapp/packages/core-navigation-tree/package.json @@ -1,39 +1,45 @@ { "name": "@cloudbeaver/core-navigation-tree", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-extensions": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-extensions": "~0.1.0" + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.test.ts b/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.test.ts index a481cfdf9b..8f4f3609eb 100644 --- a/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.test.ts +++ b/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.test.ts @@ -7,19 +7,50 @@ */ import '@testing-library/jest-dom'; -import { CoreSettingsService } from '@cloudbeaver/core-app'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreAppManifest, CoreSettingsService } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { createApp } from '@cloudbeaver/tests-runner'; +import { coreNavigationTree } from './manifest'; import { NavTreeSettings, NavTreeSettingsService } from './NavTreeSettingsService'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreNavigationTree, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + coreRoutingManifest, + coreThemingManifest, + coreLocalizationManifest, + coreAuthenticationManifest, + coreAppManifest, + coreProjectsManifest, + coreUIManifest, + coreViewManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_ACTIVE_NODE.ts b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_ACTIVE_NODE.ts index ad5ff55ae1..9e996d91b2 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_ACTIVE_NODE.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_ACTIVE_NODE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export interface IDataContextActiveNode { nodeId: string; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODE.ts b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODE.ts index 4f4ee682b6..5ce9ae814b 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODE.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { NavNode } from './EntityTypes'; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODES.ts b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODES.ts index d81609c253..672ef8521a 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODES.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/DATA_CONTEXT_NAV_NODES.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { NavNode } from './EntityTypes'; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/DBObjectResource.ts b/webapp/packages/core-navigation-tree/src/NodesManager/DBObjectResource.ts index 325b0d039a..58cf150c4e 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/DBObjectResource.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/DBObjectResource.ts @@ -12,16 +12,15 @@ import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; import { CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedMapResource, - CachedResourcePageKey, - CachedResourcePageListKey, - DetailsError, - GraphQLService, + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyList, resourceKeyListAliasFactory, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { DetailsError, GraphQLService } from '@cloudbeaver/core-sdk'; import type { DBObject } from './EntityTypes'; import { NavNodeInfoResource } from './NavNodeInfoResource'; @@ -38,14 +37,14 @@ export class DBObjectResource extends CachedMapResource { ) { super(); - this.addAlias(DBObjectParentKey, param => resourceKeyList(navTreeResource.get(param.options.parentId) || [])); + this.aliases.add(DBObjectParentKey, param => resourceKeyList(navTreeResource.get(param.options.parentId) || [])); // this.preloadResource(this.navNodeInfoResource); this.navNodeInfoResource.outdateResource(this); this.navNodeInfoResource.deleteInResource(this); this.navTreeResource.onDataOutdated.addHandler(key => { ResourceKeyUtils.forEach(key, nodeId => { - const pageAlias = this.isAlias(nodeId, CachedResourcePageKey) || this.isAlias(nodeId, CachedResourcePageListKey); + const pageAlias = this.aliases.isAlias(nodeId, CachedResourceOffsetPageKey) || this.aliases.isAlias(nodeId, CachedResourceOffsetPageListKey); if (pageAlias) { this.markOutdated(DBObjectParentKey(pageAlias.target)); @@ -59,8 +58,9 @@ export class DBObjectResource extends CachedMapResource { this.beforeLoad.addHandler(async (originalKey, context) => { await this.navTreeResource.waitLoad(); - const parentKey = this.isAlias(originalKey, DBObjectParentKey); - const pageKey = this.isAlias(originalKey, CachedResourcePageKey) || this.isAlias(originalKey, CachedResourcePageListKey); + const parentKey = this.aliases.isAlias(originalKey, DBObjectParentKey); + const pageKey = + this.aliases.isAlias(originalKey, CachedResourceOffsetPageKey) || this.aliases.isAlias(originalKey, CachedResourceOffsetPageListKey); let limit = this.navTreeResource.childrenLimit; let offset = CACHED_RESOURCE_DEFAULT_PAGE_OFFSET; @@ -70,11 +70,11 @@ export class DBObjectResource extends CachedMapResource { } if (parentKey) { - await this.navTreeResource.load(CachedResourcePageKey(offset, limit).setTarget(parentKey.options.parentId)); + await this.navTreeResource.load(CachedResourceOffsetPageKey(offset, limit).setTarget(parentKey.options.parentId)); return; } - const key = ResourceKeyUtils.toList(this.transformToKey(originalKey)); + const key = ResourceKeyUtils.toList(this.aliases.transformToKey(originalKey)); const parents = [ ...new Set( key.map(nodeId => this.navNodeInfoResource.get(nodeId)?.parentId).filter((nodeId): nodeId is string => nodeId !== undefined), @@ -94,8 +94,9 @@ export class DBObjectResource extends CachedMapResource { protected async loader(originalKey: ResourceKey): Promise> { let limit = this.navTreeResource.childrenLimit; let offset = CACHED_RESOURCE_DEFAULT_PAGE_OFFSET; - const parentKey = this.isAlias(originalKey, DBObjectParentKey); - const pageKey = this.isAlias(originalKey, CachedResourcePageKey) || this.isAlias(originalKey, CachedResourcePageListKey); + const parentKey = this.aliases.isAlias(originalKey, DBObjectParentKey); + const pageKey = + this.aliases.isAlias(originalKey, CachedResourceOffsetPageKey) || this.aliases.isAlias(originalKey, CachedResourceOffsetPageListKey); if (pageKey) { limit = pageKey.options.limit; @@ -107,9 +108,9 @@ export class DBObjectResource extends CachedMapResource { await this.loadFromChildren(nodeId, offset, limit); runInAction(() => { - this.setPageEnd( - CachedResourcePageKey(offset, limit).setTarget(originalKey), - this.navTreeResource.hasNextPage(CachedResourcePageKey(offset, limit).setTarget(nodeId)), + this.offsetPagination.setPageEnd( + CachedResourceOffsetPageKey(offset, limit).setTarget(originalKey), + this.navTreeResource.offsetPagination.hasNextPage(CachedResourceOffsetPageKey(offset, limit).setTarget(nodeId)), ); }); return this.data; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeInfoResource.ts b/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeInfoResource.ts index 53fe629f43..2b78edb958 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeInfoResource.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeInfoResource.ts @@ -11,16 +11,15 @@ import { AppAuthService } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; import { CachedMapResource, - GraphQLService, - ICachedResourceMetadata, + type ICachedResourceMetadata, isResourceAlias, - NavNodeInfoFragment, - ResourceKey, - ResourceKeyList, + type ResourceKey, + type ResourceKeyList, resourceKeyList, - ResourceKeySimple, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { GraphQLService, NavNodeInfoFragment } from '@cloudbeaver/core-sdk'; import { getPathParents, MetadataMap } from '@cloudbeaver/core-utils'; import type { NavNode } from './EntityTypes'; @@ -47,7 +46,7 @@ export class NavNodeInfoResource extends CachedMapResource, state: boolean): void { - this.updateMetadata(keyObject, metadata => { + this.metadata.update(keyObject, metadata => { if (!metadata.withDetails && state) { metadata.outdated = true; } diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeManagerService.ts b/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeManagerService.ts index 9ba5aa1883..daf26f1667 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeManagerService.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/NavNodeManagerService.ts @@ -7,12 +7,12 @@ */ import { action } from 'mobx'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { Executor, IExecutionContextProvider, IExecutor, ISyncContextLoader, ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; -import { resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { NavigationService } from '@cloudbeaver/core-ui'; import { MetadataMap } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '@cloudbeaver/core-view'; import { ENodeFeature } from './ENodeFeature'; import type { NavNode, NavNodeInfo } from './EntityTypes'; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts b/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts index 626ca1650d..59cf126d0a 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts @@ -12,26 +12,24 @@ import { AppAuthService, UserInfoResource } from '@cloudbeaver/core-authenticati import { injectable } from '@cloudbeaver/core-di'; import { Executor, ExecutorInterrupter, IExecutionContext, IExecutor } from '@cloudbeaver/core-executor'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { SessionDataResource } from '@cloudbeaver/core-root'; import { CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedMapAllKey, CachedMapResource, - CachedResourcePageKey, - CachedResourcePageListKey, - DetailsError, - NavNodeChildrenQuery as fake, - GraphQLService, - ICachedResourceMetadata, + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, + type ICachedResourceMetadata, isResourceAlias, isResourceKeyList, ResourceError, - ResourceKey, - ResourceKeyList, + type ResourceKey, resourceKeyList, - ResourceKeySimple, + type ResourceKeyList, + type ResourceKeySimple, ResourceKeyUtils, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { SessionDataResource } from '@cloudbeaver/core-root'; +import { DetailsError, NavNodeChildrenQuery as fake, GraphQLService } from '@cloudbeaver/core-sdk'; import { flat, isDefined, isUndefined, MetadataMap } from '@cloudbeaver/core-utils'; import { NavTreeSettingsService } from '../NavTreeSettingsService'; @@ -173,7 +171,7 @@ export class NavTreeResource extends CachedMapResource this.getNestedChildren(key)).flat()); this.navNodeInfoResource.setDetails(list, state); - this.updateMetadata(list, metadata => { + this.metadata.update(list, metadata => { if (!metadata.withDetails && state) { metadata.outdated = true; } @@ -441,8 +439,9 @@ export class NavTreeResource extends CachedMapResource): Promise> { - const pageKey = this.isAlias(originalKey, CachedResourcePageKey) || this.isAlias(originalKey, CachedResourcePageListKey); - const allKey = this.isAlias(originalKey, CachedMapAllKey); + const pageKey = + this.aliases.isAlias(originalKey, CachedResourceOffsetPageKey) || this.aliases.isAlias(originalKey, CachedResourceOffsetPageListKey); + const allKey = this.aliases.isAlias(originalKey, CachedMapAllKey); if (allKey) { throw new Error('Loading all nodes is prohibited'); @@ -457,8 +456,8 @@ export class NavTreeResource extends CachedMapResource node.id)]), metadata.withDetails); } @@ -515,7 +514,7 @@ export class NavTreeResource extends CachedMapResource this.insertSlice(data, offset, limit)), ); } else { - const metadata = this.getMetadata(data.parentPath); + const metadata = this.metadata.get(data.parentPath); this.setDetails(resourceKeyList([data.navNodeInfo.id, ...data.navNodeChildren.map(node => node.id)]), metadata.withDetails); @@ -543,7 +542,7 @@ export class NavTreeResource extends CachedMapResource { - const metadata = this.getMetadata(parentPath); + const metadata = this.metadata.get(parentPath); const { navNodeChildren, navNodeInfo } = await this.graphQLService.sdk.navNodeChildren({ parentPath, offset, diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/ProjectsNavNodeService.ts b/webapp/packages/core-navigation-tree/src/NodesManager/ProjectsNavNodeService.ts index bbf7a4e0e1..05fcd4da8a 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/ProjectsNavNodeService.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/ProjectsNavNodeService.ts @@ -7,7 +7,7 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { NAV_NODE_TYPE_PROJECT, ProjectInfo, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { NavNodeInfoResource } from './NavNodeInfoResource'; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/getNodesFromContext.ts b/webapp/packages/core-navigation-tree/src/NodesManager/getNodesFromContext.ts index 1606b8b8cf..4e65aa15ed 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/getNodesFromContext.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/getNodesFromContext.ts @@ -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 type { IDataContextProvider } from '@cloudbeaver/core-view'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { DATA_CONTEXT_NAV_NODE } from './DATA_CONTEXT_NAV_NODE'; import { DATA_CONTEXT_NAV_NODES } from './DATA_CONTEXT_NAV_NODES'; diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/nodeDeleteContext.ts b/webapp/packages/core-navigation-tree/src/NodesManager/nodeDeleteContext.ts index 366b402c14..65789c5502 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/nodeDeleteContext.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/nodeDeleteContext.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; -import type { ResourceKey } from '@cloudbeaver/core-sdk'; +import type { ResourceKey } from '@cloudbeaver/core-resource'; export interface INodeDeleteContext { confirmed: boolean; diff --git a/webapp/packages/core-navigation-tree/tsconfig.json b/webapp/packages/core-navigation-tree/tsconfig.json index bd4ed8f7d0..509304a766 100644 --- a/webapp/packages/core-navigation-tree/tsconfig.json +++ b/webapp/packages/core-navigation-tree/tsconfig.json @@ -1,10 +1,64 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-notifications/package.json b/webapp/packages/core-notifications/package.json index 1d3179d057..9d538eb197 100644 --- a/webapp/packages/core-notifications/package.json +++ b/webapp/packages/core-notifications/package.json @@ -1,26 +1,26 @@ { "name": "@cloudbeaver/core-notifications", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0" + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-dialogs": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0" }, "peerDependencies": { "reshadow": "~0.x.x", @@ -29,5 +29,6 @@ "reakit": "~1.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-notifications/src/NotificationsItem/NotificationItemController.ts b/webapp/packages/core-notifications/src/NotificationsItem/NotificationItemController.ts index 244e685e68..a80092b0d9 100644 --- a/webapp/packages/core-notifications/src/NotificationsItem/NotificationItemController.ts +++ b/webapp/packages/core-notifications/src/NotificationsItem/NotificationItemController.ts @@ -7,12 +7,11 @@ */ import { makeObservable, observable } from 'mobx'; +import { ErrorDetailsDialog } from '@cloudbeaver/core-blocks'; import { IInitializableController, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { ENotificationType, INotification } from '@cloudbeaver/core-events'; -import { ErrorDetailsDialog } from './ErrorDetailsDialog/ErrorDetailsDialog'; - const FadeTimeout = 5000; @injectable() diff --git a/webapp/packages/core-notifications/src/index.ts b/webapp/packages/core-notifications/src/index.ts index d9f5b58a1f..e7825351af 100644 --- a/webapp/packages/core-notifications/src/index.ts +++ b/webapp/packages/core-notifications/src/index.ts @@ -1,2 +1 @@ -export * from './NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog'; export * from './Notifications'; diff --git a/webapp/packages/core-notifications/tsconfig.json b/webapp/packages/core-notifications/tsconfig.json index bd4ed8f7d0..f20b321e05 100644 --- a/webapp/packages/core-notifications/tsconfig.json +++ b/webapp/packages/core-notifications/tsconfig.json @@ -1,10 +1,34 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-plugin/package.json b/webapp/packages/core-plugin/package.json index ebcfd2c623..70a60b7a7c 100644 --- a/webapp/packages/core-plugin/package.json +++ b/webapp/packages/core-plugin/package.json @@ -1,23 +1,26 @@ { "name": "@cloudbeaver/core-plugin", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-product": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0" - } -} \ No newline at end of file + }, + "peerDependencies": {}, + "devDependencies": {} +} diff --git a/webapp/packages/core-plugin/src/index.ts b/webapp/packages/core-plugin/src/index.ts index 298403476c..1510f51a91 100644 --- a/webapp/packages/core-plugin/src/index.ts +++ b/webapp/packages/core-plugin/src/index.ts @@ -1,3 +1,3 @@ export * from './PluginSettings'; export * from './PluginManagerService'; -export { manifest as corePluginManifest } from './manifest'; +export * from './manifest'; diff --git a/webapp/packages/core-plugin/src/manifest.ts b/webapp/packages/core-plugin/src/manifest.ts index a0b6935874..9ca718e3a1 100644 --- a/webapp/packages/core-plugin/src/manifest.ts +++ b/webapp/packages/core-plugin/src/manifest.ts @@ -9,7 +9,7 @@ import type { PluginManifest } from '@cloudbeaver/core-di'; import { PluginManagerService } from './PluginManagerService'; -export const manifest: PluginManifest = { +export const corePluginManifest: PluginManifest = { info: { name: 'Core Plugin', }, diff --git a/webapp/packages/core-plugin/tsconfig.json b/webapp/packages/core-plugin/tsconfig.json index bd4ed8f7d0..2e826a6d6a 100644 --- a/webapp/packages/core-plugin/tsconfig.json +++ b/webapp/packages/core-plugin/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-product" + }, + { + "path": "..\\core-settings" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-product/package.json b/webapp/packages/core-product/package.json index e2b2bbdb44..26111e413e 100644 --- a/webapp/packages/core-product/package.json +++ b/webapp/packages/core-product/package.json @@ -1,24 +1,27 @@ { "name": "@cloudbeaver/core-product", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" - } -} \ No newline at end of file + }, + "peerDependencies": {}, + "devDependencies": {} +} diff --git a/webapp/packages/core-product/src/index.ts b/webapp/packages/core-product/src/index.ts index 80f6e8b458..610bfa0dca 100644 --- a/webapp/packages/core-product/src/index.ts +++ b/webapp/packages/core-product/src/index.ts @@ -1,3 +1,3 @@ export * from './ProductManagerService'; export * from './ProductSettingsService'; -export { manifest as coreProductManifest } from './manifest'; +export * from './manifest'; diff --git a/webapp/packages/core-product/src/manifest.ts b/webapp/packages/core-product/src/manifest.ts index 9aa0158c52..df91179c3f 100644 --- a/webapp/packages/core-product/src/manifest.ts +++ b/webapp/packages/core-product/src/manifest.ts @@ -10,7 +10,7 @@ import type { PluginManifest } from '@cloudbeaver/core-di'; import { ProductManagerService } from './ProductManagerService'; import { ProductSettingsService } from './ProductSettingsService'; -export const manifest: PluginManifest = { +export const coreProductManifest: PluginManifest = { info: { name: 'Core Product', }, diff --git a/webapp/packages/core-product/tsconfig.json b/webapp/packages/core-product/tsconfig.json index bd4ed8f7d0..6c79398b52 100644 --- a/webapp/packages/core-product/tsconfig.json +++ b/webapp/packages/core-product/tsconfig.json @@ -1,10 +1,34 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-projects/package.json b/webapp/packages/core-projects/package.json index 05b7f468f0..66ee9d2d96 100644 --- a/webapp/packages/core-projects/package.json +++ b/webapp/packages/core-projects/package.json @@ -1,32 +1,35 @@ { "name": "@cloudbeaver/core-projects", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", - "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-extensions": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-extensions": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-projects/src/ProjectInfoEventHandler.ts b/webapp/packages/core-projects/src/ProjectInfoEventHandler.ts index e82e142d59..2384c2d564 100644 --- a/webapp/packages/core-projects/src/ProjectInfoEventHandler.ts +++ b/webapp/packages/core-projects/src/ProjectInfoEventHandler.ts @@ -10,7 +10,7 @@ import { ClientEventId, ISessionEvent, SessionEventId, SessionEventSource, Sessi import type { CbProjectsActiveEvent, CbProjectUpdateEvent as IProjectInfoEvent } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; -export { IProjectInfoEvent }; +export type { IProjectInfoEvent }; @injectable() export class ProjectInfoEventHandler extends TopicEventHandler { diff --git a/webapp/packages/core-projects/src/ProjectInfoResource.ts b/webapp/packages/core-projects/src/ProjectInfoResource.ts index b43bcf72c5..19bdace1b7 100644 --- a/webapp/packages/core-projects/src/ProjectInfoResource.ts +++ b/webapp/packages/core-projects/src/ProjectInfoResource.ts @@ -7,15 +7,9 @@ */ import { AppAuthService, UserInfoResource } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapAllKey, CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { - CachedMapAllKey, - CachedMapResource, - GraphQLService, - resourceKeyList, - RmResourceType, - ProjectInfo as SchemaProjectInfo, -} from '@cloudbeaver/core-sdk'; +import { GraphQLService, RmResourceType, ProjectInfo as SchemaProjectInfo } from '@cloudbeaver/core-sdk'; import { createResourceOfType } from './createResourceOfType'; diff --git a/webapp/packages/core-projects/src/ProjectsService.ts b/webapp/packages/core-projects/src/ProjectsService.ts index 8b30461c74..be78b1d34b 100644 --- a/webapp/packages/core-projects/src/ProjectsService.ts +++ b/webapp/packages/core-projects/src/ProjectsService.ts @@ -10,8 +10,8 @@ import { computed, makeObservable } from 'mobx'; import { UserDataService, UserInfoResource } from '@cloudbeaver/core-authentication'; import { Dependency, injectable } from '@cloudbeaver/core-di'; import { Executor, ExecutorInterrupter, IExecutor, ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; +import { CachedMapAllKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { DataSynchronizationService, ServerConfigResource, ServerEventId } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; import { NavigationService } from '@cloudbeaver/core-ui'; import { isArraysEqual } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/core-projects/tsconfig.json b/webapp/packages/core-projects/tsconfig.json index bd4ed8f7d0..79bb673aa2 100644 --- a/webapp/packages/core-projects/tsconfig.json +++ b/webapp/packages/core-projects/tsconfig.json @@ -1,10 +1,52 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-resource-manager/package.json b/webapp/packages/core-resource-manager/package.json index 813361176b..d0ccf7b69f 100644 --- a/webapp/packages/core-resource-manager/package.json +++ b/webapp/packages/core-resource-manager/package.json @@ -1,32 +1,35 @@ { "name": "@cloudbeaver/core-resource-manager", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-administration": "~0.1.0", - "@cloudbeaver/core-navigation-tree": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-projects": "~0.1.0" + "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts b/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts index 16b0e60f6a..ff7086af13 100644 --- a/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts +++ b/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts @@ -7,8 +7,9 @@ */ import type { PermissionInfo } from '@cloudbeaver/core-administration'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService } from '@cloudbeaver/core-sdk'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class ProjectPermissionsResource extends CachedDataResource { diff --git a/webapp/packages/core-resource-manager/src/ResourceManagerResource.ts b/webapp/packages/core-resource-manager/src/ResourceManagerResource.ts index 1d879fb94e..0550718fef 100644 --- a/webapp/packages/core-resource-manager/src/ResourceManagerResource.ts +++ b/webapp/packages/core-resource-manager/src/ResourceManagerResource.ts @@ -8,20 +8,17 @@ import { injectable } from '@cloudbeaver/core-di'; import { Executor, IExecutor } from '@cloudbeaver/core-executor'; import { ProjectsService } from '@cloudbeaver/core-projects'; -import { DataSynchronizationService, ServerEventId } from '@cloudbeaver/core-root'; import { - CachedResourceIncludeArgs, + type CachedResourceIncludeArgs, CachedTreeChildrenKey, CachedTreeResource, - DetailsError, - GetResourceListQueryVariables, - GraphQLService, isResourceAlias, - ResourceKey, + type ResourceKey, resourceKeyList, ResourceKeyUtils, - RmResource, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { DataSynchronizationService, ServerEventId } from '@cloudbeaver/core-root'; +import { DetailsError, GetResourceListQueryVariables, GraphQLService, RmResource } from '@cloudbeaver/core-sdk'; import { createPath, getPathParent, getPathParts } from '@cloudbeaver/core-utils'; import { ResourceManagerEventHandler } from './ResourceManagerEventHandler'; @@ -58,7 +55,7 @@ export class ResourceManagerResource extends CachedTreeResource { const parent = getPathParent(key); - if (this.isInUse(key)) { + if (this.useTracker.isInUse(key)) { dataSynchronizationService.requestSynchronization('resource', key).then(async state => { if (state) { if (!this.isOutdated(parent)) { @@ -79,7 +76,7 @@ export class ResourceManagerResource extends CachedTreeResource( ServerEventId.CbRmResourceUpdated, key => { - if (this.isInUse(key)) { + if (this.useTracker.isInUse(key)) { dataSynchronizationService.requestSynchronization('resource', key).then(state => { if (state) { this.onDataUpdate.execute(key); @@ -98,7 +95,7 @@ export class ResourceManagerResource extends CachedTreeResource( ServerEventId.CbRmResourceDeleted, key => { - if (this.isInUse(key)) { + if (this.useTracker.isInUse(key)) { dataSynchronizationService.requestSynchronization('resource', key).then(state => { if (state) { this.delete(key); @@ -214,7 +211,7 @@ export class ResourceManagerResource extends CachedTreeResource(); await ResourceKeyUtils.forEachAsync(key, async key => { - const childrenKey = this.isAlias(key, CachedTreeChildrenKey); + const childrenKey = this.aliases.isAlias(key, CachedTreeChildrenKey); if (childrenKey) { const resourceKey = getRmResourceKey(childrenKey.options.path); diff --git a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts index 02231e9cf2..893632b519 100644 --- a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts +++ b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts @@ -11,20 +11,16 @@ import type { AdminObjectGrantInfo } from '@cloudbeaver/core-administration'; import { EAdminPermission } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { SessionPermissionsResource } from '@cloudbeaver/core-root'; import { CachedMapAllKey, CachedMapResource, - GraphQLService, - isResourceKeyAlias, - ResourceKey, + type ResourceKey, + type ResourceKeyList, resourceKeyList, - ResourceKeyList, ResourceKeyUtils, - RmProject, - RmProjectPermissions, - RmSubjectProjectPermissions, -} from '@cloudbeaver/core-sdk'; +} from '@cloudbeaver/core-resource'; +import { SessionPermissionsResource } from '@cloudbeaver/core-root'; +import { GraphQLService, RmProject, RmProjectPermissions, RmSubjectProjectPermissions } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; const newSymbol = Symbol('new-project'); @@ -122,7 +118,7 @@ export class SharedProjectsResource extends CachedMapResource { - await ResourceKeyUtils.forEachAsync(this.transformToKey(key), async projectId => { + await ResourceKeyUtils.forEachAsync(this.aliases.transformToKey(key), async projectId => { await this.graphQLService.sdk.deleteProject({ projectId, }); @@ -138,7 +134,7 @@ export class SharedProjectsResource extends CachedMapResource): Promise> { - const all = this.isAlias(key, CachedMapAllKey); + const all = this.aliases.isAlias(key, CachedMapAllKey); if (all) { const { projects } = await this.graphQLService.sdk.getSharedProjects(); @@ -149,7 +145,7 @@ export class SharedProjectsResource extends CachedMapResource project.id)), projects as SharedProject[]); }); } else { - await ResourceKeyUtils.forEachAsync(this.transformToKey(key), async projectId => { + await ResourceKeyUtils.forEachAsync(this.aliases.transformToKey(key), async projectId => { const { project } = await this.graphQLService.sdk.getProject({ projectId, }); diff --git a/webapp/packages/core-resource-manager/tsconfig.json b/webapp/packages/core-resource-manager/tsconfig.json index bd4ed8f7d0..36da44c9c0 100644 --- a/webapp/packages/core-resource-manager/tsconfig.json +++ b/webapp/packages/core-resource-manager/tsconfig.json @@ -1,10 +1,52 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-resource/.gitignore b/webapp/packages/core-resource/.gitignore new file mode 100644 index 0000000000..c277b14f71 --- /dev/null +++ b/webapp/packages/core-resource/.gitignore @@ -0,0 +1,24 @@ +# 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* + +# generated +sdk.ts + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/core-resource/package.json b/webapp/packages/core-resource/package.json new file mode 100644 index 0000000000..952d98bbf3 --- /dev/null +++ b/webapp/packages/core-resource/package.json @@ -0,0 +1,30 @@ +{ + "name": "@cloudbeaver/core-resource", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", + "test": "core-cli-test", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" + }, + "devDependencies": {}, + "peerDependencies": { + "mobx": "~6.x.x" + } +} diff --git a/webapp/packages/core-sdk/src/Resource/CachedDataResource.test.ts b/webapp/packages/core-resource/src/Resource/CachedDataResource.test.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/CachedDataResource.test.ts rename to webapp/packages/core-resource/src/Resource/CachedDataResource.test.ts diff --git a/webapp/packages/core-sdk/src/Resource/CachedDataResource.ts b/webapp/packages/core-resource/src/Resource/CachedDataResource.ts similarity index 95% rename from webapp/packages/core-sdk/src/Resource/CachedDataResource.ts rename to webapp/packages/core-resource/src/Resource/CachedDataResource.ts index 1fa138a271..73e46a4f1c 100644 --- a/webapp/packages/core-sdk/src/Resource/CachedDataResource.ts +++ b/webapp/packages/core-resource/src/Resource/CachedDataResource.ts @@ -7,8 +7,9 @@ */ import { ILoadableState, isContainsException } from '@cloudbeaver/core-utils'; -import { CachedResource, CachedResourceParamKey, ICachedResourceMetadata } from './CachedResource'; +import { CachedResource, CachedResourceParamKey } from './CachedResource'; import type { CachedResourceIncludeArgs, CachedResourceValueIncludes } from './CachedResourceIncludes'; +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; export type CachedDataResourceData = TResource extends CachedDataResource ? T : never; export type CachedDataResourceKey = TResource extends CachedDataResource ? T : never; diff --git a/webapp/packages/core-sdk/src/Resource/CachedMapResource.test.ts b/webapp/packages/core-resource/src/Resource/CachedMapResource.test.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/CachedMapResource.test.ts rename to webapp/packages/core-resource/src/Resource/CachedMapResource.test.ts diff --git a/webapp/packages/core-sdk/src/Resource/CachedMapResource.ts b/webapp/packages/core-resource/src/Resource/CachedMapResource.ts similarity index 93% rename from webapp/packages/core-sdk/src/Resource/CachedMapResource.ts rename to webapp/packages/core-resource/src/Resource/CachedMapResource.ts index 3c299ee812..72f4d31048 100644 --- a/webapp/packages/core-sdk/src/Resource/CachedMapResource.ts +++ b/webapp/packages/core-resource/src/Resource/CachedMapResource.ts @@ -10,8 +10,9 @@ import { action, computed, makeObservable } from 'mobx'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; import { ILoadableState, isArraysEqual, isContainsException } from '@cloudbeaver/core-utils'; -import { CachedResource, CachedResourceKey, ICachedResourceMetadata } from './CachedResource'; +import { CachedResource, CachedResourceKey } from './CachedResource'; import type { CachedResourceIncludeArgs, CachedResourceValueIncludes } from './CachedResourceIncludes'; +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; import type { ResourceKey, ResourceKeySimple } from './ResourceKey'; import type { ResourceKeyAlias } from './ResourceKeyAlias'; import { isResourceKeyList, resourceKeyList, ResourceKeyList } from './ResourceKeyList'; @@ -61,7 +62,7 @@ export abstract class CachedMapResource< this.onItemUpdate = new SyncExecutor>(null); this.onItemDelete = new SyncExecutor>(null); - this.addAlias(CachedMapAllKey, () => resourceKeyList(this.keys)); + this.aliases.add(CachedMapAllKey, () => resourceKeyList(this.keys)); makeObservable(this, { set: action, @@ -84,9 +85,7 @@ export abstract class CachedMapResource< deleteInResource(resource: CachedMapResource, map?: (key: ResourceKey) => ResourceKey): this { this.onItemDelete.addHandler(param => { try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' outdate - ' + resource.getName())); - } + this.logger.group('outdate - ' + resource.logger.getName()); if (map) { param = map(param) as any as TKey; @@ -94,9 +93,7 @@ export abstract class CachedMapResource< resource.delete(param as any as T); } finally { - if (this.logActivity) { - console.groupEnd(); - } + this.logger.groupEnd(); } }); @@ -104,11 +101,11 @@ export abstract class CachedMapResource< } has(key: ResourceKey): boolean { - if (this.isAlias(key) && (!this.hasMetadata(key) || this.isLoaded(key))) { + if (this.aliases.isAlias(key) && (!this.metadata.has(key) || this.isLoaded(key))) { return false; } - key = this.transformToKey(key); + key = this.aliases.transformToKey(key); return ResourceKeyUtils.every(key, key => this.dataHas(this.getKeyRef(key))); } @@ -116,7 +113,7 @@ export abstract class CachedMapResource< get(key: ResourceKeyList | ResourceKeyListAlias): Array; get(key: ResourceKey): Array | TValue | undefined; get(key: ResourceKey): Array | TValue | undefined { - key = this.transformToKey(key); + key = this.aliases.transformToKey(key); return ResourceKeyUtils.map(key, key => this.dataGet(this.getKeyRef(key))); } @@ -124,7 +121,7 @@ export abstract class CachedMapResource< set(key: ResourceKeyList | ResourceKeyListAlias, value: TValue[]): void; set(key: ResourceKey, value: TValue | TValue[]): void; set(originalKey: ResourceKey, value: TValue | TValue[]): void { - const key = this.transformToKey(originalKey); + const key = this.aliases.transformToKey(originalKey); if (isResourceKeyList(key)) { if (key.length === 0) { @@ -149,7 +146,7 @@ export abstract class CachedMapResource< } delete(originalKey: ResourceKey): void { - const key = this.transformToKey(originalKey); + const key = this.aliases.transformToKey(originalKey); if (isResourceKeyList(key) && key.length === 0) { return; @@ -159,7 +156,7 @@ export abstract class CachedMapResource< ResourceKeyUtils.forEach(key, key => { this.dataDelete(this.getKeyRef(key)); }); - this.deleteMetadata(originalKey); + this.metadata.delete(originalKey); // rewrites pending outdate // this.markUpdated(key); } diff --git a/webapp/packages/core-resource/src/Resource/CachedResource.ts b/webapp/packages/core-resource/src/Resource/CachedResource.ts new file mode 100644 index 0000000000..978b9765e7 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedResource.ts @@ -0,0 +1,882 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { action, makeObservable, observable, toJS } from 'mobx'; + +import { Dependency } from '@cloudbeaver/core-di'; +import { + ExecutionContext, + Executor, + ExecutorInterrupter, + IExecutionContextProvider, + IExecutor, + IExecutorHandler, + ISyncExecutor, + SyncExecutor, + TaskScheduler, +} from '@cloudbeaver/core-executor'; +import { isPrimitive, MetadataMap } from '@cloudbeaver/core-utils'; + +import { + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, + expandOffsetPageRange, + isOffsetPageInRange, + isOffsetPageOutdated, +} from './CachedResourceOffsetPageKeys'; +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; +import { isResourceAlias } from './ResourceAlias'; +import { ResourceAliases } from './ResourceAliases'; +import { ResourceError } from './ResourceError'; +import type { ResourceKey, ResourceKeyFlat } from './ResourceKey'; +import { resourceKeyAlias } from './ResourceKeyAlias'; +import { isResourceKeyList, resourceKeyList, ResourceKeyList } from './ResourceKeyList'; +import { resourceKeyListAlias } from './ResourceKeyListAlias'; +import { ResourceKeyUtils } from './ResourceKeyUtils'; +import { ResourceLogger } from './ResourceLogger'; +import { ResourceMetadata } from './ResourceMetadata'; +import { ResourceOffsetPagination } from './ResourceOffsetPagination'; +import { ResourceUseTracker } from './ResourceUseTracker'; + +export interface IDataError { + param: ResourceKey; + exception: Error; +} + +export type CachedResourceData = TResource extends CachedResource ? T : never; +export type CachedResourceValue = TResource extends CachedResource ? T : never; +export type CachedResourceKey = TResource extends CachedResource ? T : never; +export type CachedResourceContext = TResource extends CachedResource ? T : void; +export type CachedResourceMetadata = TResource extends CachedResource ? T : void; + +export const CachedResourceParamKey = resourceKeyAlias('@cached-resource/param-default'); +export const CachedResourceListEmptyKey = resourceKeyListAlias('@cached-resource/empty'); + +/** + * CachedResource is a base class for all resources. It is used to load, cache and manage data from external sources. + */ +export abstract class CachedResource< + TData, + TValue, + TKey, + TInclude extends ReadonlyArray, + TMetadata extends ICachedResourceMetadata = ICachedResourceMetadata, +> extends Dependency { + data: TData; + + readonly onClear: ISyncExecutor; + readonly onDataOutdated: ISyncExecutor>; + readonly onDataUpdate: ISyncExecutor>; + readonly onDataError: ISyncExecutor>>; + readonly beforeLoad: IExecutor>; + readonly useTracker: ResourceUseTracker; + readonly offsetPagination: ResourceOffsetPagination; + readonly aliases: ResourceAliases; + protected defaultIncludes: TInclude; + protected get loading(): boolean { + return this.scheduler.executing; + } + + protected outdateWaitList: ResourceKey[]; + protected readonly scheduler: TaskScheduler>; + protected readonly logger: ResourceLogger; + protected readonly metadata: ResourceMetadata; + + /** Need to infer value type */ + private readonly typescriptHack: TValue; + + constructor(defaultKey: ResourceKey, private readonly defaultValue: () => TData, defaultIncludes: TInclude = [] as any) { + super(); + + this.logger = new ResourceLogger(this.getName()); + this.aliases = new ResourceAliases(this.logger, this.validateKey.bind(this)); + this.metadata = new ResourceMetadata(this.aliases, this.getDefaultMetadata.bind(this), this.isKeyEqual.bind(this), this.getKeyRef.bind(this)); + this.offsetPagination = new ResourceOffsetPagination(this.metadata); + this.useTracker = new ResourceUseTracker(this.logger, this.aliases, this.metadata); + + this.isKeyEqual = this.isKeyEqual.bind(this); + this.isIntersect = this.isIntersect.bind(this); + this.loadingTask = this.loadingTask.bind(this); + + this.typescriptHack = null as any; + this.defaultIncludes = defaultIncludes; + this.outdateWaitList = []; + this.scheduler = new TaskScheduler(this.isIntersect); + this.data = defaultValue(); + this.beforeLoad = new Executor(null, this.isIntersect); + this.onClear = new SyncExecutor(); + this.onDataOutdated = new SyncExecutor>(null); + this.onDataUpdate = new SyncExecutor>(null); + this.onDataError = new SyncExecutor>>(null); + + this.aliases.add(CachedResourceParamKey, () => defaultKey); + this.aliases.add(CachedResourceListEmptyKey, () => resourceKeyList([])); + this.aliases.add(CachedResourceOffsetPageKey, key => key.target); + this.aliases.add(CachedResourceOffsetPageListKey, key => key.target ?? CachedResourceListEmptyKey); + + // this.logger.spy(this.beforeLoad, 'beforeLoad'); + // this.logger.spy(this.onDataOutdated, 'onDataOutdated'); + this.logger.spy(this.onDataUpdate, 'onDataUpdate'); + this.logger.spy(this.onDataError, 'onDataError'); + + makeObservable(this, { + data: observable, + loader: action, + markLoading: action, + markLoaded: action, + markError: action, + markOutdated: action, + markUpdated: action, + commitIncludes: action, + markOutdatedSync: action, + resetIncludes: action, + clear: action, + }); + + setInterval(() => { + // mark resource outdate when it's not used + if (!this.useTracker.isResourceInUse && !this.isOutdated()) { + this.logger.log('not in use'); + this.markOutdated(); + } + }, 5 * 60 * 1000); + } + + getName(): string { + return this.constructor.name; + } + + /** + * Mark resource as in use when {@link resource} is in use + * @param resource resource to depend on + */ + connect(resource: CachedResource): void { + let subscription: string | null = null; + + const subscriptionHandler = () => { + if (resource.useTracker.isResourceInUse) { + if (!subscription || !this.useTracker.hasUseId(subscription)) { + subscription = this.useTracker.use(CachedResourceParamKey); + } + } else { + if (subscription) { + this.useTracker.free(CachedResourceParamKey, subscription); + subscription = null; + } + } + }; + + resource.useTracker.onUse.addHandler(subscriptionHandler); + this.onClear.addHandler(subscriptionHandler); + } + + /** + * Outdate resource when {@link resource} is outdated. + * Preload {@link resource} before current resource is loaded and connect {@link resource} to current resource. + * @param resource - Resource to sync with + * @param mapTo - Map current resource key to {@link resource} key + * @param mapOut - Map {@link resource} key to current resource key + */ + sync( + resource: CachedResource, + mapTo?: (param: ResourceKey) => ResourceKey, + mapOut?: (param: ResourceKey) => ResourceKey, + ): void { + // TODO: do we want to sync "Clean" action? + resource.outdateResource(this, mapOut); + + resource.onDataUpdate.addHandler(resource.logger.logExecutor('onDataUpdate > ' + this.logger.getName())); + resource.onDataUpdate.addHandler(resource.logger.logExecutor('onDataUpdate < ' + this.logger.getName())); + + this.preloadResource(resource, mapTo); + } + + /** + * Mark {@link resource} as updated when current resource is updated. + * @param resource - Resource to mark as updated + * @param mapTo - Map current resource key to {@link resource} key + * @param mapOut - Map {@link resource} key to current resource key + */ + updateResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { + this.onDataUpdate.addHandler(param => { + try { + this.logger.group(' update - ' + resource.logger.getName()); + + if (map) { + param = map(param) as ResourceKey; + } + + resource.markUpdated(param as ResourceKey); + } finally { + this.logger.groupEnd(); + } + }); + + return this; + } + + /** + * Mark {@link resource} as outdated when current resource is outdated. + * @param resource - Resource to mark as outdated + * @param mapTo - Map current resource key to {@link resource} key + * @param mapOut - Map {@link resource} key to current resource key + */ + outdateResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { + this.onDataOutdated.addHandler(param => { + try { + this.logger.group(' outdate - ' + resource.logger.getName()); + + if (map) { + param = map(param) as ResourceKey; + } + + resource.markOutdated(param as ResourceKey); + } finally { + this.logger.groupEnd(); + } + }); + + return this; + } + + /** + * Preload {@link resource} before current resource is loaded and connect {@link resource} to current resource. + * @param resource - Resource to preload + * @param mapTo - Map current resource key to {@link resource} key + * @param mapOut - Map {@link resource} key to current resource key + */ + preloadResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { + resource.connect(this); + + this.beforeLoad.addHandler(async param => { + try { + this.logger.group(' preload - ' + resource.logger.getName()); + + if (map) { + param = map(param) as ResourceKey; + } + + await resource.load(param as ResourceKey); + } finally { + this.logger.groupEnd(); + } + }); + + return this; + } + + /** + * Execute handler before resource is loaded + * @param handler - Handler to execute + */ + before(handler: IExecutorHandler>): this { + this.beforeLoad.addHandler(async (param, contexts) => { + try { + this.logger.group(' before - ' + handler.name); + + await handler(param, contexts); + } finally { + this.logger.groupEnd(); + } + }); + + return this; + } + + isLoaded(param?: ResourceKey, includes?: TInclude): boolean { + if (param === undefined) { + param = CachedResourceParamKey; + } + + if (!this.metadata.has(param)) { + return false; + } + + const pageKey = this.aliases.isAlias(param, CachedResourceOffsetPageKey) || this.aliases.isAlias(param, CachedResourceOffsetPageListKey); + if (pageKey) { + const pageInfo = this.offsetPagination.getPageInfo(pageKey); + + if (!pageInfo || !isOffsetPageInRange(pageInfo, pageKey.options)) { + return false; + } + } + + return this.metadata.every(param, metadata => metadata.loaded) && (!includes || this.isIncludes(param, includes)); + } + + /** + * Return true if resource is outdated or not loaded + * @param param - Resource key + */ + isLoadable(param?: ResourceKey, context?: TInclude): boolean { + if (param === undefined) { + param = CachedResourceParamKey; + } + return !this.isLoaded(param, context) || this.isOutdated(param); + } + + /** + * Return promise that will be resolved when resource will finish loading pending requests. + * Will be resolved immediately if resource is not loading. + */ + waitLoad(): Promise { + return this.scheduler.wait(); + } + + isLoading(key?: ResourceKey): boolean { + if (key === undefined) { + key = CachedResourceParamKey; + } + + return this.metadata.some(key, metadata => metadata.loading); + } + + /** + * Return true if specified {@link includes} is loaded for specified {@link key} + * @param key - Resource key + * @param includes - Includes + */ + isIncludes(key: ResourceKey, includes: TInclude): boolean { + return this.metadata.every(key, metadata => includes.every(include => metadata.includes.includes(include))); + } + + getException(param: ResourceKeyFlat): Error | null; + getException(param: ResourceKeyList): Error[] | null; + getException(param: ResourceKey): Error[] | Error | null; + getException(param: ResourceKey): Error[] | Error | null { + if (isResourceKeyList(param)) { + return this.metadata.map(param, metadata => metadata?.exception || null).filter((exception): exception is Error => exception !== null); + } + + return this.metadata.map(param, metadata => metadata?.exception || null); + } + + isOutdated(param?: ResourceKey): boolean { + if (param === undefined) { + param = CachedResourceParamKey; + } + + const pageKey = this.aliases.isAlias(param, CachedResourceOffsetPageKey) || this.aliases.isAlias(param, CachedResourceOffsetPageListKey); + if (pageKey) { + const pageInfo = this.offsetPagination.getPageInfo(pageKey); + + if (isOffsetPageOutdated(pageInfo?.pages || [], pageKey.options)) { + return true; + } + } + + return this.metadata.some(param, metadata => !metadata.loaded || metadata.outdated); + } + + markLoading(param: ResourceKey, state: boolean, context?: TInclude): void { + this.metadata.update(param, metadata => { + metadata.loading = state; + }); + } + + markLoaded(param: ResourceKey, includes?: TInclude): void { + const pageKey = this.aliases.isAlias(param, CachedResourceOffsetPageKey) || this.aliases.isAlias(param, CachedResourceOffsetPageListKey); + + this.metadata.update(param, metadata => { + metadata.loaded = true; + + if (pageKey) { + metadata.offsetPage = observable({ + ...metadata.offsetPage, + pages: expandOffsetPageRange(metadata.offsetPage?.pages || [], pageKey.options, false), + }); + } + + if (includes) { + this.commitIncludes(metadata, includes); + } + }); + + if (isResourceAlias(param)) { + param = this.aliases.transformToKey(param); + + this.metadata.update(param, metadata => { + metadata.loaded = true; + if (includes) { + this.commitIncludes(metadata, includes); + } + }); + } + } + + markError(exception: Error, key: ResourceKey, include?: TInclude): ResourceError { + exception = new ResourceError(this, key, include, exception.message, { cause: exception }); + const pageKey = this.aliases.isAlias(key, CachedResourceOffsetPageKey) || this.aliases.isAlias(key, CachedResourceOffsetPageListKey); + this.metadata.update(key, metadata => { + metadata.exception = exception; + metadata.outdated = false; + + if (pageKey) { + metadata.offsetPage = observable({ + ...metadata.offsetPage, + pages: expandOffsetPageRange(metadata.offsetPage?.pages || [], pageKey.options, false), + }); + } else { + metadata.offsetPage?.pages.forEach(page => { + page.outdated = false; + }); + } + }); + if (isResourceAlias(key)) { + key = this.aliases.transformToAlias(key); + } + this.onDataError.execute({ param: key, exception }); + return exception as ResourceError; + } + + cleanError(param?: ResourceKey): void { + if (param === undefined) { + param = CachedResourceParamKey; + } + + this.metadata.update(param, metadata => { + metadata.exception = null; + }); + } + + markOutdated(param?: ResourceKey): void { + if (param === undefined) { + param = CachedResourceParamKey; + } + + const isKeyExecuting = param === CachedResourceParamKey ? this.scheduler.executing : this.scheduler.isExecuting(param); + + if (isKeyExecuting && !this.outdateWaitList.some(key => this.isIntersect(param!, key))) { + this.outdateWaitList.push(param); + return; + } + + this.markOutdatedSync(param); + } + + markUpdated(param?: ResourceKey): void { + if (param === undefined) { + param = CachedResourceParamKey; + } + const pageKey = this.aliases.isAlias(param, CachedResourceOffsetPageKey) || this.aliases.isAlias(param, CachedResourceOffsetPageListKey); + + this.metadata.update(param, metadata => { + metadata.outdated = false; + + if (pageKey) { + metadata.offsetPage = observable({ + ...metadata.offsetPage, + pages: expandOffsetPageRange(metadata.offsetPage?.pages || [], pageKey.options, false), + }); + } + }); + + if (isResourceAlias(param)) { + param = this.aliases.transformToKey(param); + + this.metadata.update(param, metadata => { + metadata.outdated = false; + }); + } + } + + /** + * Method cleans error for {@link key} when specified or for resource itself. + * Method will execute {@link onDataUpdate}. + */ + dataUpdate(key?: ResourceKey): void { + if (key === undefined) { + key = CachedResourceParamKey; + } + + this.cleanError(key); + if (isResourceAlias(key)) { + key = this.aliases.transformToAlias(key); + } + this.onDataUpdate.execute(key); + } + + async refresh(key?: ResourceKey, context?: TInclude): Promise { + if (key === undefined) { + key = CachedResourceParamKey; + } + await this.loadData(key, true, context); + return this.data; + } + + /** + * Load data for {@link key} when specified or for resource itself. + * Data loading will be skipped if data already loaded and updated. + * @param key - Resource key + * @param context - Includes + * @returns Resource data + */ + async load(key?: ResourceKey, context?: TInclude): Promise { + if (key === undefined) { + key = CachedResourceParamKey; + } + await this.loadData(key, false, context); + return this.data; + } + + getIncludes(key?: ResourceKeyFlat): ReadonlyArray { + if (key === undefined) { + key = CachedResourceParamKey; + } + + if (!this.metadata.has(key)) { + return this.defaultIncludes; + } + + const metadata = this.metadata.get(key); + return metadata.includes; + } + + clear(): void { + this.resetDataToDefault(); + this.metadata.clear(); + this.useTracker.clear(); + this.onDataUpdate.execute(this.aliases.transformToAlias(CachedResourceParamKey)); + } + + /** + * Converts array of includes to map + * ``` + * { + * customIncludeBase: true, + * [key]: true + * } + * ``` + * @param key - Resource to extract includes from metadata + * @param includes - Base includes + * @returns {Object} Object where key is include name and value is true + */ + getIncludesMap(key?: ResourceKeyFlat, includes: ReadonlyArray = this.defaultIncludes): Record { + const keyIncludes = this.getIncludes(key); + return ['customIncludeBase', ...includes, ...keyIncludes].reduce((map, key) => { + map[key] = true; + + return map; + }, {}); + } + + /** + * Can be overridden to provide equality check for complicated keys + */ + isKeyEqual(param: TKey, second: TKey): boolean { + return param === second; + } + + /** + * Check if key is a part of nextKey + * @param nextKey - Resource key + * @param key - Resource key + * @returns {boolean} Returns true if key can be represented by nextKey + */ + isIntersect(key: ResourceKey, nextKey: ResourceKey): boolean { + if (key === nextKey) { + return true; + } + + if (isResourceAlias(key) && isResourceAlias(nextKey)) { + key = this.aliases.transformToAlias(key); + nextKey = this.aliases.transformToAlias(nextKey); + + return key.isEqual(nextKey) && this.isIntersect(key.target, nextKey.target); + } else if (isResourceAlias(key) || isResourceAlias(nextKey)) { + return true; + } + + if (isResourceKeyList(key) || isResourceKeyList(nextKey)) { + return ResourceKeyUtils.isIntersect(key, nextKey, this.isKeyEqual); + } + + return ResourceKeyUtils.isIntersect(key, nextKey, this.isKeyEqual); + } + + /** + * Can be overridden to provide static link to complicated keys + */ + protected getKeyRef(key: TKey): TKey { + if (isPrimitive(key)) { + return key; + } + return Object.freeze(toJS(key)); + } + + /** + * Check if key is valid. Can be overridden to provide custom validation. + */ + protected abstract validateKey(key: TKey): boolean; + + protected resetIncludes(): void { + this.metadata.update(metadata => { + metadata.includes = observable([...this.defaultIncludes]); + }); + } + + protected commitIncludes(metadata: TMetadata, includes: ReadonlyArray): void { + for (const include of includes) { + if (!metadata.includes.includes(include)) { + metadata.includes.push(include); + } + } + } + + protected resetDataToDefault(): void { + this.setData(this.defaultValue()); + } + + protected setData(data: TData): void { + this.data = data; + } + + protected markOutdatedSync(key: ResourceKey): void { + // Commented because it can lead to skipping existing keys outdate if some of them doesn't exists + // if (!this.metadata.has(key)) { + // return; + // } + const pageKey = this.aliases.isAlias(key, CachedResourceOffsetPageKey) || this.aliases.isAlias(key, CachedResourceOffsetPageListKey); + this.metadata.update(key, metadata => { + metadata.outdated = true; + + if (pageKey) { + metadata.offsetPage = observable({ + ...metadata.offsetPage, + pages: expandOffsetPageRange(metadata.offsetPage?.pages || [], pageKey.options, true), + }); + } else { + metadata.offsetPage?.pages.forEach(page => { + page.outdated = true; + }); + } + }); + + if (isResourceAlias(key)) { + key = this.aliases.transformToKey(key); + + this.metadata.update(key, metadata => { + metadata.outdated = true; + metadata.offsetPage?.pages.forEach(page => { + page.outdated = true; + }); + }); + } + + this.onDataOutdated.execute(key); + } + + /** + * Use to extend metadata + * @returns {Record} Object Map + */ + protected getDefaultMetadata(key: TKey, metadata: MetadataMap): TMetadata { + return { + loaded: false, + outdated: true, + loading: false, + exception: null, + includes: observable([...this.defaultIncludes]), + dependencies: observable([]), + } as ICachedResourceMetadata as TMetadata; + } + + protected async preLoadData( + param: ResourceKey, + contexts: IExecutionContextProvider>, + refresh: boolean, + context?: TInclude, + ): Promise {} + + protected abstract loader(param: ResourceKey, include: ReadonlyArray | undefined, refresh: boolean): Promise; + + /** + * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. + * Resource will be marked as loading and will be marked as loaded after loader is finished. + * Exceptions will be handled and stored in metadata. + * @param key - Resource key + * @param include - Includes + * @param update - Update function + */ + async performUpdate( + key: ResourceKey, + include: TInclude | undefined, + update: (key: ResourceKey, context?: ReadonlyArray) => Promise, + ): Promise; + + /** + * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. + * Resource will be marked as loading and will be marked as loaded after loader is finished. + * Exceptions will be handled and stored in metadata. + * @param key - Resource key + * @param include - Includes + * @param update - Update function + * @param exitCheck - Function will be called before calling {@link update} function. If it returns true then update will be skipped. + */ + async performUpdate( + key: ResourceKey, + include: TInclude | undefined, + update: (key: ResourceKey, context?: ReadonlyArray) => Promise, + exitCheck: (key: ResourceKey, context?: ReadonlyArray) => boolean, + ): Promise; + + /** + * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. + * Resource will be marked as loading and will be marked as loaded after loader is finished. + * Exceptions will be handled and stored in metadata. + * @param key - Resource key + * @param include - Includes + * @param update - Update function + * @param exitCheck - Function will be called before calling {@link update} function. If it returns true then update will be skipped. + */ + async performUpdate( + key: ResourceKey, + include: TInclude | undefined, + update: (key: ResourceKey, context?: ReadonlyArray) => Promise, + exitCheck?: (key: ResourceKey, context?: ReadonlyArray) => boolean, + ): Promise { + if (isResourceAlias(key)) { + key = this.aliases.transformToAlias(key); + } + + const context = new ExecutionContext(key); + await this.preLoadData(key, context, true, include); + await this.beforeLoad.execute(key, context); + + if (ExecutorInterrupter.isInterrupted(context)) { + return; + } + + await this.scheduler.waitRelease(key); + + if (exitCheck?.(key, include)) { + return; + } + + let loaded = false; + return this.scheduler.schedule( + key, + async () => { + // repeated because previous task maybe has been load requested data + if (exitCheck?.(key, include)) { + return; + } + + this.markLoading(key, true, include); + try { + const result = await this.taskWrapper(key, include, true, update); + loaded = true; + return result; + } finally { + this.markLoading(key, false, include); + } + }, + { + success: () => { + if (loaded) { + this.onDataOutdated.execute(key); // TODO: probably need to remove, we need to notify any related resources that subscribed to .onOutdate, to recursively outdate them + this.dataUpdate(key); + } + }, + error: exception => { + this.markOutdatedSync(key); + this.markError(exception, key, include); + }, + after: () => { + this.flushOutdatedWaitList(); + }, + }, + ); + } + + protected async loadData(key: ResourceKey, refresh: boolean, include?: TInclude): Promise { + if (isResourceAlias(key)) { + key = this.aliases.transformToAlias(key); + } + const contexts = new ExecutionContext(key); + if (!refresh) { + if (!this.isLoadable(key, include)) { + return; + } + + await this.scheduler.waitRelease(key); + + if (!this.isLoadable(key, include)) { + return; + } + } + + await this.preLoadData(key, contexts, refresh, include); + await this.beforeLoad.execute(key, contexts); + + if (ExecutorInterrupter.isInterrupted(contexts)) { + return; + } + + let loaded = false; + await this.scheduler.schedule( + key, + async () => { + // repeated because previous task maybe has been load requested data + if (!refresh && !this.isLoadable(key, include)) { + return; + } + + this.markLoading(key, true, include); + try { + const result = await this.taskWrapper(key, include, refresh, this.loadingTask); + loaded = true; + this.markLoaded(key, include); + return result; + } finally { + this.markLoading(key, false, include); + } + }, + { + before: () => { + if (refresh) { + this.markOutdatedSync(key); + } + }, + success: async () => { + if (loaded) { + this.dataUpdate(key); + } + }, + error: exception => this.markError(exception, key, include), + after: () => { + this.flushOutdatedWaitList(); + }, + }, + ); + } + + private async loadingTask(param: ResourceKey, context: ReadonlyArray | undefined, refresh: boolean) { + this.setData(await this.loader(param, context, refresh)); + } + + private async taskWrapper( + param: ResourceKey, + context: ReadonlyArray | undefined, + refresh: boolean, + promise: (param: ResourceKey, context: ReadonlyArray | undefined, refresh: boolean) => Promise, + ) { + this.logger.log('loading'); + + const value = await promise(param, context, refresh); + this.markUpdated(param); + return value; + } + + private flushOutdatedWaitList(): void { + for (let i = 0; i < this.outdateWaitList.length; i++) { + const key = this.outdateWaitList[i]; + this.markOutdatedSync(key); + } + this.outdateWaitList = []; + } +} diff --git a/webapp/packages/core-sdk/src/Resource/CachedResourceIncludes.ts b/webapp/packages/core-resource/src/Resource/CachedResourceIncludes.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/CachedResourceIncludes.ts rename to webapp/packages/core-resource/src/Resource/CachedResourceIncludes.ts diff --git a/webapp/packages/core-resource/src/Resource/CachedResourceOffsetPageKeys.ts b/webapp/packages/core-resource/src/Resource/CachedResourceOffsetPageKeys.ts new file mode 100644 index 0000000000..0c341a3bac --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedResourceOffsetPageKeys.ts @@ -0,0 +1,152 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { resourceKeyAliasFactory } from './ResourceKeyAlias'; +import { resourceKeyListAliasFactory } from './ResourceKeyListAlias'; + +interface IOffsetPageInfo { + offset: number; + limit: number; +} + +interface IResourceOffsetPage { + from: number; + to: number; + outdated: boolean; +} + +export interface ICachedResourceOffsetPage { + totalCount?: number; + end?: number; + pages: IResourceOffsetPage[]; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ICachedResourceOffsetPageOptions extends IOffsetPageInfo {} + +export const CACHED_RESOURCE_DEFAULT_PAGE_OFFSET = 0; +export const CACHED_RESOURCE_DEFAULT_PAGE_LIMIT = 100; + +export const CachedResourceOffsetPageListKey = resourceKeyListAliasFactory< + any, + [offset: number, limit: number], + Readonly +>('@cached-resource/offset-page-list', (offset: number, limit: number) => ({ + offset, + limit, +})); + +export const CachedResourceOffsetPageKey = resourceKeyAliasFactory>( + '@cached-resource/offset-page', + (offset: number, limit: number) => ({ + offset, + limit, + }), +); + +export function getNextPageOffset(info: ICachedResourceOffsetPage): number { + let lastPage: IResourceOffsetPage | undefined = undefined; + + for (const page of info.pages) { + if (!lastPage) { + lastPage = page; + continue; + } + if (page.from !== lastPage.to) { + break; + } + lastPage = page; + } + + return lastPage?.to ?? CACHED_RESOURCE_DEFAULT_PAGE_OFFSET; +} + +export function isOffsetPageOutdated(pages: IResourceOffsetPage[], info: IOffsetPageInfo): boolean { + for (const { from, to, outdated } of pages) { + if (outdated && info.offset >= from && info.offset + info.limit <= to) { + return true; + } + } + return false; +} + +export function isOffsetPageInRange({ pages, end }: ICachedResourceOffsetPage, info: IOffsetPageInfo): boolean { + const infoTo = info.offset + info.limit; + let meetFrom = false; + let meetTo = false; + let lastIndex = -1; + + for (const { from, to } of pages) { + if (lastIndex === -1) { + lastIndex = from; + } + if (from !== lastIndex) { + return false; + } + lastIndex = to; + if (info.offset >= from) { + meetFrom = true; + } + if (infoTo <= to || (end !== undefined && end <= infoTo)) { + meetTo = true; + } + if (meetFrom && meetTo) { + return true; + } + } + return false; +} + +export function limitOffsetPages(pages: IResourceOffsetPage[], limit: number): IResourceOffsetPage[] { + const result: IResourceOffsetPage[] = []; + + for (const page of pages) { + if (page.from >= limit) { + break; + } + result.push({ ...page, to: Math.min(limit, page.to) }); + } + + return result; +} + +export function expandOffsetPageRange(pages: IResourceOffsetPage[], info: IOffsetPageInfo, outdated: boolean): IResourceOffsetPage[] { + pages = [...pages, { from: info.offset, to: info.offset + info.limit, outdated, end: false }].sort((a, b) => a.from - b.from); + const result: IResourceOffsetPage[] = []; + let previous: IResourceOffsetPage | undefined; + + for (const { from, to, outdated } of pages) { + if (!previous) { + previous = { from, to, outdated }; + continue; + } + + if (from <= previous.from + previous.to) { + if (previous.outdated === outdated) { + previous.to = Math.max(previous.to, to); + } else { + if (previous.from < from) { + result.push({ ...previous, to: from }); + } + if (previous.to > to) { + result.push({ from, to, outdated }); + previous = { ...previous, from: to }; + } else { + previous = { from, to, outdated }; + } + } + } else { + result.push(previous); + previous = { from, to, outdated }; + } + } + + if (previous) { + result.push(previous); + } + return result; +} diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeMetadata.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeMetadata.ts new file mode 100644 index 0000000000..5051c5e984 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeMetadata.ts @@ -0,0 +1,106 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { combineITerableIterators, type DefaultValueGetter } from '@cloudbeaver/core-utils'; + +import type { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import { isResourceAlias } from '../ResourceAlias'; +import type { ResourceAliases } from '../ResourceAliases'; +import type { ResourceKey, ResourceKeyFlat } from '../ResourceKey'; +import { isResourceKeyList, ResourceKeyList } from '../ResourceKeyList'; +import { ResourceKeyUtils } from '../ResourceKeyUtils'; +import { ResourceMetadata } from '../ResourceMetadata'; +import { createTreeNode } from './createTreeNode'; +import { getTreeValue } from './getTreeValue'; +import type { ICachedTreeElement } from './ICachedTreeElement'; + +export class CachedTreeMetadata extends ResourceMetadata { + protected getTree: () => ICachedTreeElement; + constructor( + aliases: ResourceAliases, + private getDefaultMetadata: DefaultValueGetter, + isKeyEqual: (param: string, second: string) => boolean, + getKeyRef: (key: string) => string, + getTree: () => ICachedTreeElement, + ) { + super(aliases, getDefaultMetadata, isKeyEqual, getKeyRef); + this.getTree = getTree; + } + + values(): IterableIterator { + return combineITerableIterators(this.metadata.values(), getAllMetadata(this.getTree())); + } + + has(key: ResourceKey): boolean { + if (isResourceAlias(key)) { + return super.has(key); + } + + if (isResourceKeyList(key)) { + return key.every(key => this.dataHasMetadata(key)); + } + return this.dataHasMetadata(key); + } + + /** + * Use it instead of this.metadata.get + * This method can be override + */ + get(key: ResourceKeyFlat): TMetadata; + get(key: ResourceKeyList): TMetadata[]; + get(key: ResourceKey): TMetadata | TMetadata[]; + get(key: ResourceKey): TMetadata | TMetadata[] { + if (isResourceAlias(key)) { + return super.get(key); + } + if (isResourceKeyList(key)) { + return key.map(key => this.dataGetMetadata(key)); + } + + return this.dataGetMetadata(key); + } + + /** + * Use it instead of this.metadata.delete + * This method can be override + */ + delete(key: ResourceKey): void { + if (isResourceAlias(key)) { + return super.delete(key); + } + ResourceKeyUtils.forEach(key, path => { + const data = getTreeValue(this.getTree(), path); + if (data) { + data.metadata = this.getDefaultMetadata(path, this.metadata) as TMetadata; + } + }); + } + + createNode(path: string): ICachedTreeElement { + return createTreeNode(path, this.getDefaultMetadata(path, this.metadata)); + } + + protected dataGetMetadata(key: string): TMetadata { + return getTreeValue(this.getTree(), key, this.createNode.bind(this)).metadata; + } + + protected dataHasMetadata(key: string): boolean { + return getTreeValue(this.getTree(), key) !== undefined; + } +} + +function* getAllMetadata( + data: ICachedTreeElement, +): IterableIterator { + const elementsToScan = [data]; + + while (elementsToScan.length) { + const current = elementsToScan.shift()!; + yield current.metadata; + elementsToScan.push(...(Object.values(current.children).filter(Boolean) as any)); + } +} diff --git a/webapp/packages/core-sdk/src/Resource/CachedTreeResource.test.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.test.ts similarity index 92% rename from webapp/packages/core-sdk/src/Resource/CachedTreeResource.test.ts rename to webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.test.ts index fa54970887..502fe12a84 100644 --- a/webapp/packages/core-sdk/src/Resource/CachedTreeResource.test.ts +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.test.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { ResourceKey } from '../ResourceKey'; +import { resourceKeyList } from '../ResourceKeyList'; import { CachedTreeChildrenKey, CachedTreeResource, CachedTreeRootChildrenKey } from './CachedTreeResource'; -import type { ResourceKey } from './ResourceKey'; -import { resourceKeyList } from './ResourceKeyList'; interface IMockDataEntity { name: string; @@ -60,13 +60,13 @@ describe('CachedMapResource', () => { expect(treeResource.isOutdated('root/level2')).toBe(false); }); - test('the nodes metadata should be outdated after markOutdated is called on it', () => { + test('children outdated if parent outdated', () => { treeResource.set('root', { name: 'root' }); treeResource.set('root/level2', { name: 'level2' }); treeResource.markOutdated('root'); - expect(treeResource.getMetadata('root').outdated).toBe(true); - expect(treeResource.getMetadata('root/level2').outdated).toBe(false); + expect(treeResource.isOutdated('root')).toBe(true); + expect(treeResource.isOutdated('root/level2')).toBe(false); }); test('should run onDataOutdated handlers on data outdate', () => { diff --git a/webapp/packages/core-sdk/src/Resource/CachedTreeResource.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.ts similarity index 54% rename from webapp/packages/core-sdk/src/Resource/CachedTreeResource.ts rename to webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.ts index c57eb4a6fa..292b0df9d6 100644 --- a/webapp/packages/core-sdk/src/Resource/CachedTreeResource.ts +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeResource.ts @@ -8,26 +8,22 @@ import { action, makeObservable } from 'mobx'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; -import { flat, getPathParents, getPathParts, ILoadableState, isContainsException, uuid } from '@cloudbeaver/core-utils'; +import { ILoadableState, isContainsException } from '@cloudbeaver/core-utils'; -import { CachedResource, ICachedResourceMetadata } from './CachedResource'; -import type { CachedResourceIncludeArgs, CachedResourceValueIncludes } from './CachedResourceIncludes'; -import { isResourceAlias } from './ResourceAlias'; -import type { ResourceKey, ResourceKeyFlat, ResourceKeySimple } from './ResourceKey'; -import { resourceKeyAlias, ResourceKeyAlias } from './ResourceKeyAlias'; -import { isResourceKeyList, resourceKeyList, ResourceKeyList } from './ResourceKeyList'; -import { ResourceKeyListAlias, resourceKeyListAlias, resourceKeyListAliasFactory } from './ResourceKeyListAlias'; -import { ResourceKeyUtils } from './ResourceKeyUtils'; - -export interface ICachedTreeElement { - value?: TValue; - key?: string; - metadata: TMetadata; - parent?: ICachedTreeElement; - children: Record | undefined>; -} - -export type ICachedTreeData = ICachedTreeElement; +import { CachedResource } from '../CachedResource'; +import type { CachedResourceIncludeArgs, CachedResourceValueIncludes } from '../CachedResourceIncludes'; +import type { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ResourceKey, ResourceKeySimple } from '../ResourceKey'; +import { resourceKeyAlias, ResourceKeyAlias } from '../ResourceKeyAlias'; +import { isResourceKeyList, resourceKeyList, ResourceKeyList } from '../ResourceKeyList'; +import { ResourceKeyListAlias, resourceKeyListAlias, resourceKeyListAliasFactory } from '../ResourceKeyListAlias'; +import { ResourceKeyUtils } from '../ResourceKeyUtils'; +import { CachedTreeMetadata } from './CachedTreeMetadata'; +import { CachedTreeUseTracker } from './CachedTreeUseTracker'; +import { deleteTreeValue } from './deleteTreeValue'; +import { getTreeValue } from './getTreeValue'; +import type { ICachedTreeData } from './ICachedTreeData'; +import type { ICachedTreeElement } from './ICachedTreeElement'; export const CachedTreeRootValueKey = resourceKeyAlias('@cached-tree-resource/root-value'); export const CachedTreeRootChildrenKey = resourceKeyListAlias('@cached-tree-resource/root-children'); @@ -43,6 +39,8 @@ export abstract class CachedTreeResource< > extends CachedResource, TValue, string, CachedResourceIncludeArgs, TMetadata> { readonly onItemUpdate: ISyncExecutor>; readonly onItemDelete: ISyncExecutor>; + readonly useTracker: CachedTreeUseTracker; + protected metadata: CachedTreeMetadata; constructor(defaultValue?: () => ICachedTreeData, defaultIncludes?: CachedResourceIncludeArgs) { super( @@ -62,12 +60,22 @@ export abstract class CachedTreeResource< } as any as ICachedTreeData)), defaultIncludes, ); + + this.metadata = new CachedTreeMetadata( + this.aliases, + this.getDefaultMetadata.bind(this), + this.isKeyEqual.bind(this), + this.getKeyRef.bind(this), + () => this.data, + ); + this.useTracker = new CachedTreeUseTracker(this.logger, this.aliases, this.metadata); + this.onItemUpdate = new SyncExecutor>(null); this.onItemDelete = new SyncExecutor>(null); - this.addAlias(CachedTreeRootValueKey, () => ''); - this.addAlias(CachedTreeRootChildrenKey, () => resourceKeyList(this.dataGetKeyChildren(''))); - this.addAlias(CachedTreeChildrenKey, key => resourceKeyList(this.dataGetKeyChildren(key.options.path))); + this.aliases.add(CachedTreeRootValueKey, () => ''); + this.aliases.add(CachedTreeRootChildrenKey, () => resourceKeyList(this.dataGetKeyChildren(''))); + this.aliases.add(CachedTreeChildrenKey, key => resourceKeyList(this.dataGetKeyChildren(key.options.path))); makeObservable(this, { set: action, @@ -80,9 +88,7 @@ export abstract class CachedTreeResource< deleteInResource(resource: CachedTreeResource, map?: (key: ResourceKey) => ResourceKey): this { this.onItemDelete.addHandler(param => { try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' outdate - ' + resource.getName())); - } + this.logger.group(`outdate - ${resource.logger.getName()}`); if (map) { param = map(param) as any as string; @@ -90,41 +96,19 @@ export abstract class CachedTreeResource< resource.delete(param as any as string); } finally { - if (this.logActivity) { - console.groupEnd(); - } + this.logger.groupEnd(); } }); return this; } - use(param: ResourceKey, id = uuid()): string { - const transformedList = resourceKeyList(flat(ResourceKeyUtils.toList(this.transformToKey(param)).map(getPathParents))); - - this.updateMetadata(transformedList, metadata => { - metadata.dependencies.push(id); - }); - - return super.use(param, id); - } - - free(param: ResourceKey, id: string): void { - const transformedList = resourceKeyList(flat(ResourceKeyUtils.toList(this.transformToKey(param)).map(getPathParents))); - this.updateMetadata(transformedList, metadata => { - if (metadata.dependencies.length > 0) { - metadata.dependencies = metadata.dependencies.filter(v => v !== id); - } - }); - super.free(param, id); - } - has(key: ResourceKey): boolean { - if (this.isAlias(key) && (!this.hasMetadata(key) || this.isLoaded(key))) { + if (this.aliases.isAlias(key) && (!this.metadata.has(key) || this.isLoaded(key))) { return false; } - key = this.transformToKey(key); + key = this.aliases.transformToKey(key); return ResourceKeyUtils.every(key, key => this.dataHas(this.getKeyRef(key))); } @@ -132,7 +116,7 @@ export abstract class CachedTreeResource< get(key: ResourceKeyList | ResourceKeyListAlias): Array; get(key: ResourceKey): Array | TValue | undefined; get(key: ResourceKey): Array | TValue | undefined { - key = this.transformToKey(key); + key = this.aliases.transformToKey(key); return ResourceKeyUtils.map(key, key => this.dataGetValue(this.getKeyRef(key))); } @@ -140,10 +124,10 @@ export abstract class CachedTreeResource< set(key: ResourceKeyList | ResourceKeyListAlias, value: TValue[]): void; set(key: ResourceKey, value: TValue | TValue[]): void; set(originalKey: ResourceKey, value: TValue | TValue[]): void { - if (this.isAlias(originalKey, CachedTreeChildrenKey) || this.isAlias(originalKey, CachedTreeRootChildrenKey)) { + if (this.aliases.isAlias(originalKey, CachedTreeChildrenKey) || this.aliases.isAlias(originalKey, CachedTreeRootChildrenKey)) { throw new Error("Children can't be set with alias"); } - const key = this.transformToKey(originalKey); + const key = this.aliases.transformToKey(originalKey); if (isResourceKeyList(key)) { if (key.length === 0) { @@ -163,7 +147,7 @@ export abstract class CachedTreeResource< } delete(originalKey: ResourceKey): void { - const key = this.transformToKey(originalKey); + const key = this.aliases.transformToKey(originalKey); if (isResourceKeyList(key) && key.length === 0) { return; @@ -173,65 +157,11 @@ export abstract class CachedTreeResource< ResourceKeyUtils.forEach(key, key => { this.dataDelete(this.getKeyRef(key)); }); - this.deleteMetadata(originalKey); + this.metadata.delete(originalKey); // rewrites pending outdate // this.markUpdated(key); } - hasMetadata(key: ResourceKey): boolean { - if (isResourceAlias(key)) { - return super.hasMetadata(key); - } - - if (isResourceKeyList(key)) { - return key.every(key => this.dataHasMetadata(key)); - } - return this.dataHasMetadata(key); - } - - /** - * Use it instead of this.metadata.values - * This method can be override - */ - - getAllMetadata(): TMetadata[] { - return [...this.metadata.values(), ...getAllValues(this.data).map(value => value.metadata)]; - } - - /** - * Use it instead of this.metadata.get - * This method can be override - */ - getMetadata(key: ResourceKeyFlat): TMetadata; - getMetadata(key: ResourceKeyList): TMetadata[]; - getMetadata(key: ResourceKey): TMetadata | TMetadata[]; - getMetadata(key: ResourceKey): TMetadata | TMetadata[] { - if (isResourceAlias(key)) { - return super.getMetadata(key); - } - if (isResourceKeyList(key)) { - return key.map(key => this.dataGetMetadata(key)); - } - - return this.dataGetMetadata(key); - } - - /** - * Use it instead of this.metadata.delete - * This method can be override - */ - deleteMetadata(key: ResourceKey): void { - if (isResourceAlias(key)) { - return super.deleteMetadata(key); - } - ResourceKeyUtils.forEach(key, path => { - const data = this.dataGet(path); - if (data) { - data.metadata = this.getDefaultMetadata(path, this.metadata) as TMetadata; - } - }); - } - async refresh = []>( key: string | ResourceKeyAlias, includes?: T, @@ -283,7 +213,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataHas(key: string): boolean { - return getValue(this.data, key)?.value !== undefined; + return getTreeValue(this.data, key)?.value !== undefined; } /** @@ -291,7 +221,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataGet(key: string): ICachedTreeElement | undefined { - return getValue(this.data, key); + return getTreeValue(this.data, key); } /** @@ -299,7 +229,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataGetValueChildren(key: string): TValue[] { - return Object.values(getValue(this.data, key)?.children || {}) + return Object.values(getTreeValue(this.data, key)?.children || {}) .map(info => info?.value) .filter((value): value is TValue => value !== undefined); } @@ -309,7 +239,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataGetKeyChildren(key: string): string[] { - return Object.values(getValue(this.data, key)?.children || {}) + return Object.values(getTreeValue(this.data, key)?.children || {}) .map(info => info?.key) .filter((key): key is string => key !== undefined); } @@ -319,23 +249,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataGetValue(key: string): TValue | undefined { - return getValue(this.data, key)?.value; - } - - /** - * Use it instead of this.data.get - * This method can be override - */ - protected dataGetMetadata(key: string): TMetadata { - return getValue(this.data, key, this.getDefaultNode.bind(this)).metadata; - } - - /** - * Use it instead of this.data.has - * This method can be override - */ - protected dataHasMetadata(key: string): boolean { - return getValue(this.data, key) !== undefined; + return getTreeValue(this.data, key)?.value; } /** @@ -343,7 +257,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataSet(key: string, value: TValue): void { - const data = getValue(this.data, key, this.getDefaultNode.bind(this)); + const data = getTreeValue(this.data, key, path => this.metadata.createNode(path)); data.key = key; data.value = value; } @@ -353,7 +267,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected dataDelete(key: string): void { - deleteValue(this.data, key); + deleteTreeValue(this.data, key); } /** @@ -361,15 +275,7 @@ export abstract class CachedTreeResource< * This method can be override */ protected override resetDataToDefault(): void { - this.data = this.getDefaultNode(''); - } - - protected getDefaultNode(path: string): ICachedTreeElement { - return { - key: path, - children: {}, - metadata: this.getDefaultMetadata(path, this.metadata) as TMetadata, - }; + this.data = this.metadata.createNode(''); } protected validateKey(key: string): boolean { @@ -377,82 +283,6 @@ export abstract class CachedTreeResource< } } -function getAllValues( - data: ICachedTreeElement, -): ICachedTreeElement[] { - const elementsToScan = [data]; - const values: ICachedTreeElement[] = []; - - while (elementsToScan.length) { - const current = elementsToScan.shift()!; - values.push(current); - elementsToScan.push(...(Object.values(current.children).filter(Boolean) as any)); - } - - return values; -} - -function getValue( - data: ICachedTreeElement, - path: string, - getDefault: (path: string) => ICachedTreeElement, -): ICachedTreeElement; -function getValue( - data: ICachedTreeElement, - path: string, -): ICachedTreeElement | undefined; -function getValue( - data: ICachedTreeElement, - path: string, - getDefault?: (path: string) => ICachedTreeElement, -): ICachedTreeElement | undefined { - if (!path) { - return data; - } - const paths = getPathParts(path); - let current = data; - - for (let i = 0; i < paths.length; ++i) { - const path = paths[i]; - let next = current.children[path]; - if (next === undefined) { - if (getDefault) { - next = getDefault(path); - next.parent = current; - current.children[path] = next; - next = current.children[path]!; - } else { - return undefined; - } - } - current = next; - } - return current; -} - -function deleteValue( - data: ICachedTreeElement, - path: string, -): void { - if (!path) { - data.children = {}; - return; - } - - const paths = getPathParts(path); - let current = data; - - for (let i = 0; i < paths.length - 1; ++i) { - const path = paths[i]; - const next = current.children[path]; - if (next === undefined) { - return undefined; - } - current = next; - } - delete current.children[paths[paths.length - 1]]; -} - export function getCachedTreeResourceLoaderState = Record>( resource: CachedTreeResource, key: ResourceKey, diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeUseTracker.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeUseTracker.ts new file mode 100644 index 0000000000..50965f4bc7 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/CachedTreeUseTracker.ts @@ -0,0 +1,42 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { flat, getPathParents, uuid } from '@cloudbeaver/core-utils'; + +import type { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ResourceAliases } from '../ResourceAliases'; +import type { ResourceKey } from '../ResourceKey'; +import { resourceKeyList } from '../ResourceKeyList'; +import { ResourceKeyUtils } from '../ResourceKeyUtils'; +import type { ResourceLogger } from '../ResourceLogger'; +import { ResourceUseTracker } from '../ResourceUseTracker'; +import type { CachedTreeMetadata } from './CachedTreeMetadata'; + +export class CachedTreeUseTracker extends ResourceUseTracker { + constructor(logger: ResourceLogger, aliases: ResourceAliases, protected metadata: CachedTreeMetadata) { + super(logger, aliases, metadata); + } + use(param: ResourceKey, id = uuid()): string { + const transformedList = resourceKeyList(flat(ResourceKeyUtils.toList(this.aliases.transformToKey(param)).map(getPathParents))); + + this.metadata.update(transformedList, metadata => { + metadata.dependencies.push(id); + }); + + return super.use(param, id); + } + + free(param: ResourceKey, id: string): void { + const transformedList = resourceKeyList(flat(ResourceKeyUtils.toList(this.aliases.transformToKey(param)).map(getPathParents))); + this.metadata.update(transformedList, metadata => { + if (metadata.dependencies.length > 0) { + metadata.dependencies = metadata.dependencies.filter(v => v !== id); + } + }); + super.free(param, id); + } +} diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeData.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeData.ts new file mode 100644 index 0000000000..c6a3da3451 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeData.ts @@ -0,0 +1,11 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ICachedTreeElement } from './ICachedTreeElement'; + +export type ICachedTreeData = ICachedTreeElement; diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeElement.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeElement.ts new file mode 100644 index 0000000000..a00504ac41 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/ICachedTreeElement.ts @@ -0,0 +1,16 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { ICachedResourceMetadata } from '../ICachedResourceMetadata'; + +export interface ICachedTreeElement { + value?: TValue; + key?: string; + metadata: TMetadata; + parent?: ICachedTreeElement; + children: Record | undefined>; +} diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/createTreeNode.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/createTreeNode.ts new file mode 100644 index 0000000000..9539f32d56 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/createTreeNode.ts @@ -0,0 +1,20 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ICachedTreeElement } from './ICachedTreeElement'; + +export function createTreeNode( + path: string, + metadata: TMetadata, +): ICachedTreeElement { + return { + key: path, + children: {}, + metadata, + }; +} diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/deleteTreeValue.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/deleteTreeValue.ts new file mode 100644 index 0000000000..a11b848148 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/deleteTreeValue.ts @@ -0,0 +1,34 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { getPathParts } from '@cloudbeaver/core-utils'; +import type { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ICachedTreeElement } from './ICachedTreeElement'; + +export function deleteTreeValue( + data: ICachedTreeElement, + path: string, +): void { + if (!path) { + data.children = {}; + return; + } + + const paths = getPathParts(path); + let current = data; + + for (let i = 0; i < paths.length - 1; ++i) { + const path = paths[i]; + const next = current.children[path]; + if (next === undefined) { + return undefined; + } + current = next; + } + delete current.children[paths[paths.length - 1]]; +} \ No newline at end of file diff --git a/webapp/packages/core-resource/src/Resource/CachedTreeResource/getTreeValue.ts b/webapp/packages/core-resource/src/Resource/CachedTreeResource/getTreeValue.ts new file mode 100644 index 0000000000..1b0f9d2b3d --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/CachedTreeResource/getTreeValue.ts @@ -0,0 +1,49 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { getPathParts } from '@cloudbeaver/core-utils'; + +import type { ICachedResourceMetadata } from '../ICachedResourceMetadata'; +import type { ICachedTreeElement } from './ICachedTreeElement'; + +export function getTreeValue( + data: ICachedTreeElement, + path: string, + getDefault: (path: string) => ICachedTreeElement, +): ICachedTreeElement; +export function getTreeValue( + data: ICachedTreeElement, + path: string, +): ICachedTreeElement | undefined; +export function getTreeValue( + data: ICachedTreeElement, + path: string, + getDefault?: (path: string) => ICachedTreeElement, +): ICachedTreeElement | undefined { + if (!path) { + return data; + } + const paths = getPathParts(path); + let current = data; + + for (let i = 0; i < paths.length; ++i) { + const path = paths[i]; + let next = current.children[path]; + if (next === undefined) { + if (getDefault) { + next = getDefault(path); + next.parent = current; + current.children[path] = next; + next = current.children[path]!; + } else { + return undefined; + } + } + current = next; + } + return current; +} diff --git a/webapp/packages/core-resource/src/Resource/ICachedResourceMetadata.ts b/webapp/packages/core-resource/src/Resource/ICachedResourceMetadata.ts new file mode 100644 index 0000000000..d6f28bf1fd --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ICachedResourceMetadata.ts @@ -0,0 +1,19 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { ICachedResourceOffsetPage } from './CachedResourceOffsetPageKeys'; + +export interface ICachedResourceMetadata { + loaded: boolean; + outdated: boolean; + loading: boolean; + includes: string[]; + exception: Error | null; + /** List of generated id's added each time resource is used and removed on release */ + dependencies: string[]; + offsetPage?: ICachedResourceOffsetPage; +} diff --git a/webapp/packages/core-sdk/src/Resource/LocalResource.ts b/webapp/packages/core-resource/src/Resource/LocalResource.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/LocalResource.ts rename to webapp/packages/core-resource/src/Resource/LocalResource.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceAlias.ts b/webapp/packages/core-resource/src/Resource/ResourceAlias.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceAlias.ts rename to webapp/packages/core-resource/src/Resource/ResourceAlias.ts diff --git a/webapp/packages/core-resource/src/Resource/ResourceAliases.ts b/webapp/packages/core-resource/src/Resource/ResourceAliases.ts new file mode 100644 index 0000000000..1377899554 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ResourceAliases.ts @@ -0,0 +1,173 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { toJS } from 'mobx'; + +import { isResourceAlias, type ResourceAlias, ResourceAliasFactory, type ResourceAliasOptions } from './ResourceAlias'; +import type { ResourceKey } from './ResourceKey'; +import type { ResourceKeyAlias } from './ResourceKeyAlias'; +import { isResourceKeyList, ResourceKeyList } from './ResourceKeyList'; +import type { ResourceKeyListAlias } from './ResourceKeyListAlias'; +import type { ResourceLogger } from './ResourceLogger'; + +export type IParamAlias = { + id: string; + getAlias: (param: ResourceAlias) => ResourceKey; +}; + +export class ResourceAliases { + protected paramAliases: Array>; + private captureAliasGetterExecution: boolean; + + constructor(private readonly logger: ResourceLogger, private readonly validateKey: (key: TKey) => boolean) { + this.paramAliases = []; + + this.captureAliasGetterExecution = false; + } + + has(key: ResourceAlias): boolean { + return this.paramAliases.some(alias => alias.id === key.id); + } + + isAlias( + key: ResourceKey, + aliasToCompare?: ResourceAlias | ResourceAliasFactory, + ): ResourceAlias | undefined { + if (isResourceAlias(key)) { + key = this.transformToAlias(key); + if (this.has(key)) { + if (aliasToCompare === undefined) { + return key as ResourceAlias; + } + return key.find(aliasToCompare); + } + throw new Error(`Alias ${key.toString()} is not registered in ${this.logger.getName()}`); + } + return undefined; + } + + add( + param: ResourceAlias | ResourceAliasFactory, + getAlias: (param: ResourceAlias) => ResourceKey, + ): void { + this.paramAliases.push({ id: param.id, getAlias }); + } + + replace( + param: ResourceAlias | ResourceAliasFactory, + getAlias: (param: ResourceAlias) => ResourceKey, + ): void { + const indexOf = this.paramAliases.findIndex(aliasInfo => aliasInfo.id === param.id); + + if (indexOf === -1) { + this.add(param, getAlias); + } else { + this.paramAliases.splice(indexOf, 1, { id: param.id, getAlias }); + } + } + + transformToAlias( + key: ResourceKeyAlias | ResourceKeyListAlias, + ): ResourceKeyAlias | ResourceKeyListAlias { + if (this.captureAliasGetterExecution) { + return key; + } + + let deep = 0; + // eslint-disable-next-line no-labels + transform: if (deep < 10) { + if (!this.validateResourceKey(key)) { + let paramString = JSON.stringify(toJS(key)); + + if (isResourceKeyList(key) || isResourceAlias(key)) { + paramString = key.toString(); + } + this.logger.warn(`Invalid resource key ${paramString}`); + } + + for (const alias of this.paramAliases) { + if (alias.id === key.id) { + const data = this.captureGetAlias(alias, key); + + if (isResourceAlias(data)) { + key = data.setParent(key); + } else { + return key; + } + deep++; + // eslint-disable-next-line no-labels + break transform; + } + } + } else { + this.logger.error('Alias transform deep limit reached'); + } + return key; + } + transformToKey(param: ResourceKey): TKey | ResourceKeyList { + let deep = 0; + + while (deep < 10) { + if (!this.validateResourceKey(param)) { + let paramString = JSON.stringify(toJS(param)); + + if (isResourceKeyList(param)) { + paramString = param.toString(); + } + this.logger.warn(`Invalid resource key ${paramString}`); + } + + if (isResourceAlias(param)) { + for (const alias of this.paramAliases) { + if (alias.id === param.id) { + param = this.captureGetAlias(alias, param); + deep++; + break; + } + } + } else { + break; + } + } + + if (deep === 10) { + this.logger.error('Alias transform deep limit reached'); + } + + if (isResourceAlias(param)) { + throw new Error(`Alias ${param.toString()} is not registered in ${this.logger.getName()}`); + } + return param; + } + + protected captureGetAlias(alias: IParamAlias, param: ResourceAlias): ResourceKey { + try { + this.captureAliasGetterExecution = true; + return alias.getAlias(param); + } finally { + this.captureAliasGetterExecution = false; + } + } + + /** + * Check if key is valid. Can be overridden to provide custom validation. + * When key is alias checks that alias is registered. + * When key is list checks that all keys are valid. + * When key is primitive checks that this type of primitive is valid for current resource. + * @param param - Resource key + */ + protected validateResourceKey(param: ResourceKey): boolean { + if (isResourceAlias(param)) { + return this.has(param); + } + + if (isResourceKeyList(param)) { + return param.length === 0 || param.every(this.validateKey.bind(this)); + } + return this.validateKey(param); + } +} diff --git a/webapp/packages/core-sdk/src/Resource/ResourceError.ts b/webapp/packages/core-resource/src/Resource/ResourceError.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceError.ts rename to webapp/packages/core-resource/src/Resource/ResourceError.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceKey.ts b/webapp/packages/core-resource/src/Resource/ResourceKey.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceKey.ts rename to webapp/packages/core-resource/src/Resource/ResourceKey.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceKeyAlias.ts b/webapp/packages/core-resource/src/Resource/ResourceKeyAlias.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceKeyAlias.ts rename to webapp/packages/core-resource/src/Resource/ResourceKeyAlias.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceKeyList.ts b/webapp/packages/core-resource/src/Resource/ResourceKeyList.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceKeyList.ts rename to webapp/packages/core-resource/src/Resource/ResourceKeyList.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceKeyListAlias.ts b/webapp/packages/core-resource/src/Resource/ResourceKeyListAlias.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceKeyListAlias.ts rename to webapp/packages/core-resource/src/Resource/ResourceKeyListAlias.ts diff --git a/webapp/packages/core-sdk/src/Resource/ResourceKeyUtils.ts b/webapp/packages/core-resource/src/Resource/ResourceKeyUtils.ts similarity index 100% rename from webapp/packages/core-sdk/src/Resource/ResourceKeyUtils.ts rename to webapp/packages/core-resource/src/Resource/ResourceKeyUtils.ts diff --git a/webapp/packages/core-resource/src/Resource/ResourceLogger.ts b/webapp/packages/core-resource/src/Resource/ResourceLogger.ts new file mode 100644 index 0000000000..a669ec3673 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ResourceLogger.ts @@ -0,0 +1,82 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { ExecutorInterrupter, type IExecutorHandler, ISyncExecutor } from '@cloudbeaver/core-executor'; + +export enum ResourceLoggerLevel { + None, + Error, + Warn, + Log, +} + +export class ResourceLogger { + protected level: ResourceLoggerLevel; + constructor(private name: string) { + this.level = ResourceLoggerLevel.Warn; + } + + setEnabled(level: ResourceLoggerLevel) { + this.level = level; + } + + getName(): string { + return this.name; + } + + group(action: string) { + if (this.level >= ResourceLoggerLevel.Log) { + console.group(this.getActionPrefixedName(action)); + } + } + + groupEnd() { + if (this.level >= ResourceLoggerLevel.Log) { + console.groupEnd(); + } + } + + log(action: string, ...params: any[]) { + if (this.level >= ResourceLoggerLevel.Log) { + console.log(this.getActionPrefixedName(action), ...params); + } + } + + warn(action: string) { + if (this.level >= ResourceLoggerLevel.Warn) { + console.warn(this.getActionPrefixedName(action)); + } + } + + error(action: string) { + if (this.level >= ResourceLoggerLevel.Error) { + console.error(this.getActionPrefixedName(action)); + } + } + + spy(executor: ISyncExecutor, action: string): void { + executor.addHandler(this.logExecutor(action)).addPostHandler(this.logInterrupted(action)); + } + + logExecutor = + (action: string): IExecutorHandler => + () => { + this.log(action); + }; + + private readonly logInterrupted = + (action: string): IExecutorHandler => + (data, contexts) => { + if (ExecutorInterrupter.isInterrupted(contexts)) { + this.log(action + 'interrupted'); + } + }; + + protected getActionPrefixedName(action: string): string { + return this.getName() + ': ' + action; + } +} diff --git a/webapp/packages/core-resource/src/Resource/ResourceMetadata.ts b/webapp/packages/core-resource/src/Resource/ResourceMetadata.ts new file mode 100644 index 0000000000..cb3bc2225f --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ResourceMetadata.ts @@ -0,0 +1,200 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { observable } from 'mobx'; + +import { DefaultValueGetter, isNotNullDefined, isPrimitive, MetadataMap } from '@cloudbeaver/core-utils'; + +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; +import { isResourceAlias } from './ResourceAlias'; +import type { ResourceAliases } from './ResourceAliases'; +import type { ResourceKey, ResourceKeyFlat } from './ResourceKey'; +import { isResourceKeyList, ResourceKeyList } from './ResourceKeyList'; +import { ResourceKeyUtils } from './ResourceKeyUtils'; + +type MetadataCallback = (metadata: TMetadata) => TValue; + +export class ResourceMetadata { + protected metadata: MetadataMap; + private readonly isKeyEqual: (param: TKey, second: TKey) => boolean; + private readonly getKeyRef: (key: TKey) => TKey; + + constructor( + private readonly aliases: ResourceAliases, + getDefaultMetadata: DefaultValueGetter, + isKeyEqual: (param: TKey, second: TKey) => boolean, + getKeyRef: (key: TKey) => TKey, + ) { + this.metadata = new MetadataMap((key, metadata) => observable(getDefaultMetadata(key, metadata), undefined, { deep: false })); + this.isKeyEqual = isKeyEqual; + this.getKeyRef = getKeyRef; + } + + values(): IterableIterator { + return this.metadata.values(); + } + + keys(): IterableIterator { + return this.metadata.keys(); + } + + has(key: ResourceKey): boolean { + if (isResourceKeyList(key)) { + return key.every(key => this.metadata.has(this.getKeyRef(key))); + } + + return this.metadata.has(this.getMetadataKeyRef(key)); + } + + every(param: ResourceKey, predicate: (metadata: TMetadata) => boolean): boolean { + if (!this.has(param)) { + return false; + } + + return !this.some(param, key => !predicate(key)); + } + some(predicate: MetadataCallback): boolean; + some(param: ResourceKey, predicate: MetadataCallback): boolean; + + some(param: ResourceKey | MetadataCallback, predicate?: MetadataCallback): boolean { + if (!predicate) { + predicate = param as (metadata: TMetadata) => boolean; + for (const metadata of this.values()) { + if (predicate(metadata)) { + return true; + } + } + return false; + } + + param = param as ResourceKey; + predicate = predicate as MetadataCallback; + + if (!this.has(param)) { + return false; + } + + if (isResourceKeyList(param)) { + return param.some(key => predicate!(this.get(key))); + } + + let result = false; + + if (predicate(this.get(param))) { + result = true; + } + + if (isResourceAlias(param)) { + param = this.aliases.transformToKey(param); + + if (isResourceKeyList(param)) { + if (this.some(param, predicate)) { + result = true; + } + } + } + + return result; + } + + map(param: ResourceKeyFlat, map: MetadataCallback): TValue; + map(param: ResourceKeyList, map: MetadataCallback): TValue[]; + map(param: ResourceKey, map: MetadataCallback): TValue | TValue[]; + map(param: ResourceKey, map: MetadataCallback): TValue | TValue[] { + const callback = (key: ResourceKeyFlat) => { + if (!this.has(key)) { + return map(undefined); + } + return map(this.get(key)); + }; + + if (isResourceKeyList(param)) { + return param.map(callback); + } + + return callback(param); + } + + /** + * Use it instead of this.metadata.get + * This method can be overridden + */ + get(key: ResourceKeyFlat): TMetadata; + get(key: ResourceKeyList): TMetadata[]; + get(key: ResourceKey): TMetadata | TMetadata[]; + get(key: ResourceKey): TMetadata | TMetadata[] { + if (isResourceKeyList(key)) { + return key.map(key => this.get(key)); + } + + return this.metadata.get(this.getMetadataKeyRef(key)); + } + + /** + * Use to update metadata + * This method can be overridden + */ + update(callback: MetadataCallback): void; + update(key: ResourceKey, callback: MetadataCallback): void; + update(key: ResourceKey | MetadataCallback, callback?: MetadataCallback): void { + if (!callback) { + callback = key as MetadataCallback; + for (const metadata of this.values()) { + callback(metadata); + } + return; + } + + key = key as ResourceKey; + + ResourceKeyUtils.forEach(key, key => { + callback = callback as MetadataCallback; + callback(this.get(key)); + }); + } + + /** + * Use it instead of this.metadata.delete + * This method can be overridden + */ + delete(param: ResourceKey): void { + ResourceKeyUtils.forEach(param, key => { + this.metadata.delete(this.getMetadataKeyRef(key)); + }); + } + + clear() { + this.metadata.clear(); + } + + /** + * Can be overridden to provide static link to complicated keys + */ + protected getMetadataKeyRef(key: ResourceKeyFlat): TKey { + if (isResourceAlias(key)) { + key = this.aliases.transformToAlias(key); + + if (isNotNullDefined(key.target)) { + return this.getMetadataKeyRef(key.target); + } + + return key.toString() as TKey; + } + + if (isPrimitive(key)) { + return key; + } + + const ref = Array.from(this.keys()).find(k => this.isKeyEqual(k, key as TKey)); + + if (ref) { + return ref; + } + + return this.getKeyRef(key); + } +} diff --git a/webapp/packages/core-resource/src/Resource/ResourceOffsetPagination.ts b/webapp/packages/core-resource/src/Resource/ResourceOffsetPagination.ts new file mode 100644 index 0000000000..ec72a2347c --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ResourceOffsetPagination.ts @@ -0,0 +1,75 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { observable } from 'mobx'; + +import { + ICachedResourceOffsetPage, + type ICachedResourceOffsetPageOptions, + isOffsetPageInRange, + limitOffsetPages, +} from './CachedResourceOffsetPageKeys'; +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; +import type { ResourceAlias } from './ResourceAlias'; +import type { ResourceMetadata } from './ResourceMetadata'; + +export class ResourceOffsetPagination { + constructor(protected metadata: ResourceMetadata) { + this.metadata = metadata; + } + + getPageInfo(key: ResourceAlias>): ICachedResourceOffsetPage | undefined { + if (!this.metadata.has(key as TKey)) { + return undefined; + } + + const page = this.metadata.get(key as TKey).offsetPage; + + if (!page || !isOffsetPageInRange(page, key.options)) { + return undefined; + } + + return page; + } + + hasNextPage(key: ResourceAlias>): boolean { + const pageInfo = this.getPageInfo(key); + const to = key.options.offset + key.options.limit; + + if (!pageInfo) { + return false; + } + + return pageInfo.end === undefined || to < pageInfo.end; + } + + setPageEnd(key: ResourceAlias>, hasNextPage: boolean): void { + const count = key.options.offset + key.options.limit; + + this.metadata.update(key as TKey, metadata => { + let end = metadata.offsetPage?.end; + + if (hasNextPage) { + if (end !== undefined && end <= count) { + end = undefined; + } + } else { + end = count; + } + + metadata.offsetPage = observable({ + pages: [], + ...metadata.offsetPage, + end, + }); + + if (!hasNextPage) { + metadata.offsetPage.pages = limitOffsetPages(metadata.offsetPage?.pages || [], count); + } + }); + } +} diff --git a/webapp/packages/core-resource/src/Resource/ResourceUseTracker.ts b/webapp/packages/core-resource/src/Resource/ResourceUseTracker.ts new file mode 100644 index 0000000000..b597396a74 --- /dev/null +++ b/webapp/packages/core-resource/src/Resource/ResourceUseTracker.ts @@ -0,0 +1,116 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { action, computed, makeObservable } from 'mobx'; + +import { type ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; +import { uuid } from '@cloudbeaver/core-utils'; + +import { CachedResourceParamKey } from './CachedResource'; +import type { ICachedResourceMetadata } from './ICachedResourceMetadata'; +import { isResourceAlias } from './ResourceAlias'; +import type { ResourceAliases } from './ResourceAliases'; +import type { ResourceKey } from './ResourceKey'; +import type { ResourceLogger } from './ResourceLogger'; +import type { ResourceMetadata } from './ResourceMetadata'; + +export interface IUseData { + id: string | undefined; + param: ResourceKey; + isInUse: boolean; +} + +export class ResourceUseTracker { + get isResourceInUse(): boolean { + return this.metadata.some(metadata => metadata.dependencies.length > 0); + } + readonly onUse: ISyncExecutor>; + constructor(protected logger: ResourceLogger, protected aliases: ResourceAliases, protected metadata: ResourceMetadata) { + this.onUse = new SyncExecutor(); + this.onUse.setInitialDataGetter(this.getInitialOnUseData.bind(this)); + + makeObservable(this, { + isResourceInUse: computed, + use: action, + free: action, + }); + } + + /** + * Return true if resource is in use + * @param param - Resource key + */ + isInUse(param: ResourceKey): boolean { + return this.metadata.some(param, metadata => metadata.dependencies.length > 0); + } + + /** + * Return true if resource is in use by {@link id} + * @param id - Dependency id + */ + hasUseId(id: string): boolean { + return this.metadata.some(metadata => metadata.dependencies.includes(id)); + } + + /** + * Use resource by {@link param}. Optionally provide {@link id} to track dependency. + * @param param - Resource key + * @param id - Dependency id (uuid by default) + * @returns Dependency id + */ + use(param: ResourceKey, id = uuid()): string { + this.metadata.update(param, metadata => { + metadata.dependencies.push(id); + }); + + if (isResourceAlias(param)) { + param = this.aliases.transformToAlias(param); + + this.metadata.update(param, metadata => { + metadata.dependencies.push(id); + }); + } + + this.onUse.execute({ id, param, isInUse: true }); + + this.logger.log('Use resource: ', this.logger.getName(), param); + return id; + } + + /** + * Release resource by {@link param} and {@link id} + * @param param - Resource key + * @param id - Dependency id + */ + free(param: ResourceKey, id: string): void { + this.metadata.update(metadata => { + if (metadata.dependencies.length > 0) { + metadata.dependencies = metadata.dependencies.filter(v => v !== id); + } + }); + + if (isResourceAlias(param)) { + param = this.aliases.transformToAlias(param); + } + + this.onUse.execute({ id, param, isInUse: false }); + + this.logger.log('Free resource: ', this.logger.getName(), param); + } + + clear(): void { + this.onUse.execute(this.getInitialOnUseData()); + } + + protected getInitialOnUseData(): IUseData { + return { + id: undefined, + param: CachedResourceParamKey, + isInUse: false, + }; + } +} diff --git a/webapp/packages/core-resource/src/index.ts b/webapp/packages/core-resource/src/index.ts new file mode 100644 index 0000000000..cff8c3ac8e --- /dev/null +++ b/webapp/packages/core-resource/src/index.ts @@ -0,0 +1,22 @@ +export * from './Resource/CachedDataResource'; +export * from './Resource/CachedMapResource'; +export * from './Resource/CachedResource'; +export * from './Resource/CachedResourceIncludes'; +export { + CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, + CACHED_RESOURCE_DEFAULT_PAGE_LIMIT, + CachedResourceOffsetPageKey, + CachedResourceOffsetPageListKey, + getNextPageOffset, + type ICachedResourceOffsetPageOptions, +} from './Resource/CachedResourceOffsetPageKeys'; +export * from './Resource/CachedTreeResource/CachedTreeResource'; +export * from './Resource/ICachedResourceMetadata'; +export * from './Resource/ResourceAlias'; +export * from './Resource/ResourceError'; +export * from './Resource/ResourceKey'; +export * from './Resource/ResourceKeyAlias'; +export * from './Resource/ResourceKeyList'; +export * from './Resource/ResourceKeyListAlias'; +export * from './Resource/ResourceKeyUtils'; +export { coreResourceManifest } from './manifest'; diff --git a/webapp/packages/core-resource/src/manifest.ts b/webapp/packages/core-resource/src/manifest.ts new file mode 100644 index 0000000000..61cb380475 --- /dev/null +++ b/webapp/packages/core-resource/src/manifest.ts @@ -0,0 +1,16 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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'; + +export const coreResourceManifest: PluginManifest = { + info: { + name: 'Core Resource', + }, + + providers: [], +}; diff --git a/webapp/packages/core-resource/tsconfig.json b/webapp/packages/core-resource/tsconfig.json new file mode 100644 index 0000000000..a74f24e351 --- /dev/null +++ b/webapp/packages/core-resource/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/core-root/package.json b/webapp/packages/core-root/package.json index 6a99bb653c..726b55b8dd 100644 --- a/webapp/packages/core-root/package.json +++ b/webapp/packages/core-root/package.json @@ -1,30 +1,33 @@ { "name": "@cloudbeaver/core-root", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "rxjs": "7.8.1", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "rxjs": "7.8.1" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "msw": "~1.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/core-root/src/FeaturesResource.ts b/webapp/packages/core-root/src/FeaturesResource.ts index 1122738ee2..945e0d0374 100644 --- a/webapp/packages/core-root/src/FeaturesResource.ts +++ b/webapp/packages/core-root/src/FeaturesResource.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; -import { CachedDataResource, GraphQLService, WebFeatureSet } from '@cloudbeaver/core-sdk'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; +import { GraphQLService, WebFeatureSet } from '@cloudbeaver/core-sdk'; import { ServerConfigResource } from './ServerConfigResource'; diff --git a/webapp/packages/core-root/src/ServerConfigResource.ts b/webapp/packages/core-root/src/ServerConfigResource.ts index c3493efeff..9e94b09c5f 100644 --- a/webapp/packages/core-root/src/ServerConfigResource.ts +++ b/webapp/packages/core-root/src/ServerConfigResource.ts @@ -9,14 +9,8 @@ import { action, makeObservable, observable } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; -import { - CachedDataResource, - CachedResource, - GraphQLService, - NavigatorSettingsInput, - ServerConfig as SDKServerConfig, - ServerConfigInput, -} from '@cloudbeaver/core-sdk'; +import { CachedDataResource, type CachedResource } from '@cloudbeaver/core-resource'; +import { GraphQLService, NavigatorSettingsInput, ServerConfig as SDKServerConfig, ServerConfigInput } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; import { isNavigatorViewSettingsEqual } from './ConnectionNavigatorViewSettings'; diff --git a/webapp/packages/core-root/src/ServerEventEmitter/TopicEventHandler.ts b/webapp/packages/core-root/src/ServerEventEmitter/TopicEventHandler.ts index 3cc85d282c..e5d72aca6e 100644 --- a/webapp/packages/core-root/src/ServerEventEmitter/TopicEventHandler.ts +++ b/webapp/packages/core-root/src/ServerEventEmitter/TopicEventHandler.ts @@ -8,7 +8,7 @@ import { Connectable, connectable, filter, map, merge, Observable, Subject } from 'rxjs'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; -import type { CachedResource } from '@cloudbeaver/core-sdk'; +import type { CachedResource } from '@cloudbeaver/core-resource'; import { compose } from '@cloudbeaver/core-utils'; import type { IBaseServerEvent, IServerEventCallback, IServerEventEmitter, Subscription } from './IServerEventEmitter'; @@ -108,11 +108,11 @@ export abstract class TopicEventHandler< const index = this.activeResources.indexOf(resource); if (index !== -1) { - if (!resource.isResourceInUse) { + if (!resource.useTracker.isResourceInUse) { this.removeActiveResource(resource); } } else { - if (resource.isResourceInUse) { + if (resource.useTracker.isResourceInUse) { this.activeResources.push(resource); if (!this.subscription) { @@ -143,7 +143,7 @@ export abstract class TopicEventHandler< subscription: this.resourceUseHandler.bind(this, resource), }; this.subscribedResources.set(resource, info); - resource.onUse.addHandler(info.subscription); + resource.useTracker.onUse.addHandler(info.subscription); // console.log('Register: ', resource.getName()); } @@ -158,7 +158,7 @@ export abstract class TopicEventHandler< if (info.listeners === 0) { this.removeActiveResource(resource); - resource.onUse.removeHandler(info.subscription); + resource.useTracker.onUse.removeHandler(info.subscription); this.subscribedResources.delete(resource); // console.log('Unregister: ', resource.getName()); } diff --git a/webapp/packages/core-root/src/SessionDataResource.ts b/webapp/packages/core-root/src/SessionDataResource.ts index 0c246753c8..5b77e62351 100644 --- a/webapp/packages/core-root/src/SessionDataResource.ts +++ b/webapp/packages/core-root/src/SessionDataResource.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; -import { CachedDataResource } from '@cloudbeaver/core-sdk'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { SessionResource } from './SessionResource'; diff --git a/webapp/packages/core-root/src/SessionPermissionEventHandler.ts b/webapp/packages/core-root/src/SessionPermissionEventHandler.ts index 524a296ef2..ca3deaf64f 100644 --- a/webapp/packages/core-root/src/SessionPermissionEventHandler.ts +++ b/webapp/packages/core-root/src/SessionPermissionEventHandler.ts @@ -11,7 +11,7 @@ import type { CbSubjectPermissionUpdateEvent as ISessionPermissionEvent } from ' import { TopicEventHandler } from './ServerEventEmitter/TopicEventHandler'; import { ISessionEvent, SessionEventId, SessionEventSource, SessionEventTopic } from './SessionEventSource'; -export { ISessionPermissionEvent }; +export type { ISessionPermissionEvent }; @injectable() export class SessionPermissionEventHandler extends TopicEventHandler { diff --git a/webapp/packages/core-root/src/SessionPermissionsResource.ts b/webapp/packages/core-root/src/SessionPermissionsResource.ts index 9c593ba8e3..97df7b14e3 100644 --- a/webapp/packages/core-root/src/SessionPermissionsResource.ts +++ b/webapp/packages/core-root/src/SessionPermissionsResource.ts @@ -7,7 +7,8 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; -import { CachedDataResource, CachedResource, GraphQLService } from '@cloudbeaver/core-sdk'; +import { CachedDataResource, CachedResource } from '@cloudbeaver/core-resource'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; import { DataSynchronizationService } from './DataSynchronization/DataSynchronizationService'; import { SessionDataResource } from './SessionDataResource'; diff --git a/webapp/packages/core-root/src/SessionResource.ts b/webapp/packages/core-root/src/SessionResource.ts index 4ccef39a06..fc85bbe17b 100644 --- a/webapp/packages/core-root/src/SessionResource.ts +++ b/webapp/packages/core-root/src/SessionResource.ts @@ -7,7 +7,8 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; -import { CachedDataResource, GraphQLService, SessionStateFragment } from '@cloudbeaver/core-sdk'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; +import { GraphQLService, SessionStateFragment } from '@cloudbeaver/core-sdk'; import { ServerConfigResource } from './ServerConfigResource'; import { ServerEventId } from './SessionEventSource'; diff --git a/webapp/packages/core-root/mocks/createGQLEndpoint.ts b/webapp/packages/core-root/src/__custom_mocks__/createGQLEndpoint.ts similarity index 100% rename from webapp/packages/core-root/mocks/createGQLEndpoint.ts rename to webapp/packages/core-root/src/__custom_mocks__/createGQLEndpoint.ts diff --git a/webapp/packages/core-root/mocks/createWebsocketEndpoint.ts b/webapp/packages/core-root/src/__custom_mocks__/createWebsocketEndpoint.ts similarity index 100% rename from webapp/packages/core-root/mocks/createWebsocketEndpoint.ts rename to webapp/packages/core-root/src/__custom_mocks__/createWebsocketEndpoint.ts diff --git a/webapp/packages/core-root/mocks/data/defaultProductConfiguration.ts b/webapp/packages/core-root/src/__custom_mocks__/data/defaultProductConfiguration.ts similarity index 100% rename from webapp/packages/core-root/mocks/data/defaultProductConfiguration.ts rename to webapp/packages/core-root/src/__custom_mocks__/data/defaultProductConfiguration.ts diff --git a/webapp/packages/core-root/mocks/data/defaultServerConfig.ts b/webapp/packages/core-root/src/__custom_mocks__/data/defaultServerConfig.ts similarity index 97% rename from webapp/packages/core-root/mocks/data/defaultServerConfig.ts rename to webapp/packages/core-root/src/__custom_mocks__/data/defaultServerConfig.ts index 1a2128065b..e1aaf6e197 100644 --- a/webapp/packages/core-root/mocks/data/defaultServerConfig.ts +++ b/webapp/packages/core-root/src/__custom_mocks__/data/defaultServerConfig.ts @@ -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 { ServerConfigQuery } from '@cloudbeaver/core-sdk'; +import type { ServerConfigQuery } from '@cloudbeaver/core-sdk'; import { defaultProductConfiguration } from './defaultProductConfiguration'; @@ -30,6 +30,7 @@ export const defaultServerConfig: (productConfiguration?: Record) = resourceManagerEnabled: true, licenseRequired: false, licenseValid: false, + distributed: false, configurationMode: false, developmentMode: false, redirectOnFederatedAuth: false, diff --git a/webapp/packages/core-root/mocks/mockAppInit.ts b/webapp/packages/core-root/src/__custom_mocks__/mockAppInit.ts similarity index 100% rename from webapp/packages/core-root/mocks/mockAppInit.ts rename to webapp/packages/core-root/src/__custom_mocks__/mockAppInit.ts diff --git a/webapp/packages/core-root/mocks/mockGraphQL.ts b/webapp/packages/core-root/src/__custom_mocks__/mockGraphQL.ts similarity index 100% rename from webapp/packages/core-root/mocks/mockGraphQL.ts rename to webapp/packages/core-root/src/__custom_mocks__/mockGraphQL.ts diff --git a/webapp/packages/core-root/mocks/resolvers/mockOpenSession.ts b/webapp/packages/core-root/src/__custom_mocks__/resolvers/mockOpenSession.ts similarity index 94% rename from webapp/packages/core-root/mocks/resolvers/mockOpenSession.ts rename to webapp/packages/core-root/src/__custom_mocks__/resolvers/mockOpenSession.ts index fb20965486..73bd980cb0 100644 --- a/webapp/packages/core-root/mocks/resolvers/mockOpenSession.ts +++ b/webapp/packages/core-root/src/__custom_mocks__/resolvers/mockOpenSession.ts @@ -18,6 +18,8 @@ export function mockOpenSession( return res( ctx.data({ session: { + valid: true, + remainingTime: 0, createTime: date, lastAccessTime: date, cacheExpired: false, diff --git a/webapp/packages/core-root/mocks/resolvers/mockServerConfig.ts b/webapp/packages/core-root/src/__custom_mocks__/resolvers/mockServerConfig.ts similarity index 100% rename from webapp/packages/core-root/mocks/resolvers/mockServerConfig.ts rename to webapp/packages/core-root/src/__custom_mocks__/resolvers/mockServerConfig.ts diff --git a/webapp/packages/core-root/src/index.ts b/webapp/packages/core-root/src/index.ts index a9a0270d79..dd83fdde62 100644 --- a/webapp/packages/core-root/src/index.ts +++ b/webapp/packages/core-root/src/index.ts @@ -24,4 +24,4 @@ export * from './SessionExpireService'; export * from './SessionExpireEventService'; export * from './ServerNodeService'; export * from './WindowEventsService'; -export { manifest as coreRootManifest } from './manifest'; +export * from './manifest'; diff --git a/webapp/packages/core-root/src/manifest.ts b/webapp/packages/core-root/src/manifest.ts index bc444e8614..5a6c16f874 100644 --- a/webapp/packages/core-root/src/manifest.ts +++ b/webapp/packages/core-root/src/manifest.ts @@ -30,7 +30,7 @@ import { SessionService } from './SessionService'; import { SessionSettingsService } from './SessionSettingsService'; import { WindowEventsService } from './WindowEventsService'; -export const manifest: PluginManifest = { +export const coreRootManifest: PluginManifest = { info: { name: 'Core Root', }, diff --git a/webapp/packages/core-root/tsconfig.json b/webapp/packages/core-root/tsconfig.json index 27a71e6649..693e4de77b 100644 --- a/webapp/packages/core-root/tsconfig.json +++ b/webapp/packages/core-root/tsconfig.json @@ -1,10 +1,40 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ], "compilerOptions": { - "rootDir": ".", - "outDir": "lib" + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ] } diff --git a/webapp/packages/core-routing/package.json b/webapp/packages/core-routing/package.json index 1c3d1c6765..59f07ba7f2 100644 --- a/webapp/packages/core-routing/package.json +++ b/webapp/packages/core-routing/package.json @@ -1,29 +1,31 @@ { "name": "@cloudbeaver/core-routing", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "router5": "~8.0.1", + "router5-plugin-browser": "~8.0.1", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "router5": "~8.0.1", - "router5-plugin-browser": "~8.0.1" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-routing/src/index.ts b/webapp/packages/core-routing/src/index.ts index ba9f195ab8..007082b3f1 100644 --- a/webapp/packages/core-routing/src/index.ts +++ b/webapp/packages/core-routing/src/index.ts @@ -1,4 +1,4 @@ -export { manifest as coreRoutingManifest } from './manifest'; +export * from './manifest'; export * from './Screen/IScreen'; export * from './Screen/ScreenService'; export * from './RouterService'; diff --git a/webapp/packages/core-routing/src/manifest.ts b/webapp/packages/core-routing/src/manifest.ts index 36e9e2fcb9..4b4ca438c8 100644 --- a/webapp/packages/core-routing/src/manifest.ts +++ b/webapp/packages/core-routing/src/manifest.ts @@ -11,7 +11,7 @@ import { RouterService } from './RouterService'; import { ScreenService } from './Screen/ScreenService'; import { WindowsService } from './WindowsService'; -export const manifest: PluginManifest = { +export const coreRoutingManifest: PluginManifest = { info: { name: 'Core Routing', }, diff --git a/webapp/packages/core-routing/tsconfig.json b/webapp/packages/core-routing/tsconfig.json index bd4ed8f7d0..a74f24e351 100644 --- a/webapp/packages/core-routing/tsconfig.json +++ b/webapp/packages/core-routing/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-sdk/codegen.ts b/webapp/packages/core-sdk/codegen.ts index 0533a03aef..53e2eab2da 100644 --- a/webapp/packages/core-sdk/codegen.ts +++ b/webapp/packages/core-sdk/codegen.ts @@ -31,9 +31,6 @@ const config: CodegenConfig = { DateTime: 'any', }, }, - hooks: { - afterAllFileWrite: ['prettier --write'], - }, }; export default config; diff --git a/webapp/packages/core-sdk/package.json b/webapp/packages/core-sdk/package.json index 657f5471e2..a8f8b319ee 100644 --- a/webapp/packages/core-sdk/package.json +++ b/webapp/packages/core-sdk/package.json @@ -1,32 +1,34 @@ { "name": "@cloudbeaver/core-sdk", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/* & rimraf node_modules", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "prebuild": "rimraf node_modules", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "pregql:gen": "rimraf node_modules", "gql:gen": "graphql-codegen", "pregql:gen:dev": "rimraf node_modules", "gql:gen:dev": "graphql-codegen --watch", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "axios": "~1.5.0", "graphql": "~16.x.x", - "graphql-request": "~6.1.0" + "graphql-request": "~6.1.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "devDependencies": { "@graphql-codegen/add": "~5.0.0", diff --git a/webapp/packages/core-sdk/src/GQLError.ts b/webapp/packages/core-sdk/src/GQLError.ts index d6e4db7b0a..bbeeea42bf 100644 --- a/webapp/packages/core-sdk/src/GQLError.ts +++ b/webapp/packages/core-sdk/src/GQLError.ts @@ -7,7 +7,7 @@ */ // eslint-disable-next-line @typescript-eslint/triple-slash-reference /// -import type { ClientError, GraphQLRequestContext, GraphQLResponse } from 'graphql-request/src/types'; +import type { ClientError, GraphQLRequestContext, GraphQLResponse } from 'graphql-request/build/cjs/types'; import { DetailsError } from './DetailsError'; diff --git a/webapp/packages/core-sdk/src/PlainGQLError.ts b/webapp/packages/core-sdk/src/PlainGQLError.ts index 4286c75ca3..5588043b3f 100644 --- a/webapp/packages/core-sdk/src/PlainGQLError.ts +++ b/webapp/packages/core-sdk/src/PlainGQLError.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import type { ClientError } from 'graphql-request'; -import type { GraphQLRequestContext, GraphQLResponse } from 'graphql-request/src/types'; +import type { GraphQLRequestContext, GraphQLResponse } from 'graphql-request/build/cjs/types'; import { getTextBetween } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/core-sdk/src/Resource/CachedResource.ts b/webapp/packages/core-sdk/src/Resource/CachedResource.ts deleted file mode 100644 index 9298e3e9ef..0000000000 --- a/webapp/packages/core-sdk/src/Resource/CachedResource.ts +++ /dev/null @@ -1,1490 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 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 { action, computed, makeObservable, observable, toJS } from 'mobx'; - -import { Dependency } from '@cloudbeaver/core-di'; -import { - ExecutionContext, - Executor, - ExecutorInterrupter, - IExecutionContextProvider, - IExecutor, - IExecutorHandler, - ISyncExecutor, - SyncExecutor, - TaskScheduler, -} from '@cloudbeaver/core-executor'; -import { isNotNullDefined, isPrimitive, MetadataMap, uuid } from '@cloudbeaver/core-utils'; - -import { isResourceAlias, ResourceAlias, ResourceAliasFactory, ResourceAliasOptions } from './ResourceAlias'; -import { ResourceError } from './ResourceError'; -import type { ResourceKey, ResourceKeyFlat } from './ResourceKey'; -import { resourceKeyAlias, ResourceKeyAlias, resourceKeyAliasFactory } from './ResourceKeyAlias'; -import { isResourceKeyList, resourceKeyList, ResourceKeyList } from './ResourceKeyList'; -import { type ResourceKeyListAlias, resourceKeyListAlias, resourceKeyListAliasFactory } from './ResourceKeyListAlias'; -import { ResourceKeyUtils } from './ResourceKeyUtils'; - -interface IPageInfo { - offset: number; - limit: number; -} - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ICachedResourcePageOptions extends IPageInfo {} - -interface IResourcePage { - from: number; - to: number; - outdated: boolean; -} - -export interface ICachedResourcePage { - totalCount?: number; - end?: number; - pages: IResourcePage[]; -} - -export interface ICachedResourceMetadata { - loaded: boolean; - outdated: boolean; - loading: boolean; - includes: string[]; - exception: Error | null; - /** List of generated id's added each time resource is used and removed on release */ - dependencies: string[]; - page?: ICachedResourcePage; -} - -export interface IUseData { - id: string | undefined; - param: ResourceKey; - isInUse: boolean; -} - -export interface IDataError { - param: ResourceKey; - exception: Error; -} - -export type IParamAlias = { - id: string; - getAlias: (param: ResourceAlias) => ResourceKey; -}; - -export type CachedResourceData = TResource extends CachedResource ? T : never; -export type CachedResourceValue = TResource extends CachedResource ? T : never; -export type CachedResourceKey = TResource extends CachedResource ? T : never; -export type CachedResourceContext = TResource extends CachedResource ? T : void; -export type CachedResourceMetadata = TResource extends CachedResource ? T : void; - -export const CACHED_RESOURCE_DEFAULT_PAGE_OFFSET = 0; -export const CACHED_RESOURCE_DEFAULT_PAGE_LIMIT = 100; -export const CachedResourceParamKey = resourceKeyAlias('@cached-resource/param-default'); -export const CachedResourceListEmptyKey = resourceKeyListAlias('@cached-resource/empty'); -export const CachedResourcePageListKey = resourceKeyListAliasFactory>( - '@cached-resource/page-list', - (offset: number, limit: number) => ({ - offset, - limit, - }), -); -export const CachedResourcePageKey = resourceKeyAliasFactory>( - '@cached-resource/page', - (offset: number, limit: number) => ({ - offset, - limit, - }), -); - -/** - * CachedResource is a base class for all resources. It is used to load, cache and manage data from external sources. - */ -export abstract class CachedResource< - TData, - TValue, - TKey, - TInclude extends ReadonlyArray, - TMetadata extends ICachedResourceMetadata = ICachedResourceMetadata, -> extends Dependency { - data: TData; - - get isResourceInUse(): boolean { - return this.getAllMetadata().some(metadata => metadata.dependencies.length > 0); - } - - readonly onClear: ISyncExecutor; - readonly onUse: ISyncExecutor>; - readonly onDataOutdated: ISyncExecutor>; - readonly onDataUpdate: ISyncExecutor>; - readonly onDataError: ISyncExecutor>>; - readonly beforeLoad: IExecutor>; - - protected metadata: MetadataMap; - protected defaultIncludes: TInclude; - - protected get loading(): boolean { - return this.scheduler.executing; - } - - protected scheduler: TaskScheduler>; - protected paramAliases: Array>; - protected logActivity: boolean; - protected outdateWaitList: ResourceKey[]; - - /** Need to infer value type */ - private readonly typescriptHack: TValue; - private captureAliasGetterExecution: boolean; - - constructor(defaultKey: ResourceKey, private readonly defaultValue: () => TData, defaultIncludes: TInclude = [] as any) { - super(); - - this.isKeyEqual = this.isKeyEqual.bind(this); - this.isIntersect = this.isIntersect.bind(this); - this.loadingTask = this.loadingTask.bind(this); - - this.logActivity = false; - - this.typescriptHack = null as any; - this.defaultIncludes = defaultIncludes; - this.paramAliases = []; - this.outdateWaitList = []; - this.captureAliasGetterExecution = false; - this.metadata = new MetadataMap((key, metadata) => observable(this.getDefaultMetadata(key, metadata) as TMetadata, undefined, { deep: false })); - this.scheduler = new TaskScheduler(this.isIntersect); - this.data = defaultValue(); - this.beforeLoad = new Executor(null, this.isIntersect); - this.onClear = new SyncExecutor(); - this.onUse = new SyncExecutor(); - this.onDataOutdated = new SyncExecutor>(null); - this.onDataUpdate = new SyncExecutor>(null); - this.onDataError = new SyncExecutor>>(null); - - this.onUse.setInitialDataGetter(this.getInitialOnUseData.bind(this)); - this.addAlias(CachedResourceParamKey, () => defaultKey); - this.addAlias(CachedResourceListEmptyKey, () => resourceKeyList([])); - this.addAlias(CachedResourcePageKey, key => key.target); - this.addAlias(CachedResourcePageListKey, key => key.target ?? CachedResourceListEmptyKey); - - if (this.logActivity) { - // this.spy(this.beforeLoad, 'beforeLoad'); - // this.spy(this.onDataOutdated, 'onDataOutdated'); - this.spy(this.onDataUpdate, 'onDataUpdate'); - this.spy(this.onDataError, 'onDataError'); - } - - makeObservable(this, { - data: observable, - isResourceInUse: computed, - loader: action, - markLoading: action, - markLoaded: action, - markError: action, - markOutdated: action, - markUpdated: action, - commitIncludes: action, - markOutdatedSync: action, - resetIncludes: action, - use: action, - free: action, - clear: action, - }); - - setInterval(() => { - // mark resource outdate when it's not used - if (!this.isResourceInUse && !this.isOutdated()) { - this.markOutdated(); - - if (this.logActivity) { - console.log('Resource outdated lazy: ', this.getName()); - } - } - }, 5 * 60 * 1000); - } - - /** - * Mark resource as in use when {@link resource} is in use - * @param resource resource to depend on - */ - connect(resource: CachedResource): void { - let subscription: string | null = null; - - const subscriptionHandler = () => { - if (resource.isResourceInUse) { - if (!subscription || !this.hasUseId(subscription)) { - subscription = this.use(CachedResourceParamKey); - } - } else { - if (subscription) { - this.free(CachedResourceParamKey, subscription); - subscription = null; - } - } - }; - - resource.onUse.addHandler(subscriptionHandler); - this.onClear.addHandler(subscriptionHandler); - } - - /** - * Outdate resource when {@link resource} is outdated. - * Preload {@link resource} before current resource is loaded and connect {@link resource} to current resource. - * @param resource - Resource to sync with - * @param mapTo - Map current resource key to {@link resource} key - * @param mapOut - Map {@link resource} key to current resource key - */ - sync( - resource: CachedResource, - mapTo?: (param: ResourceKey) => ResourceKey, - mapOut?: (param: ResourceKey) => ResourceKey, - ): void { - // TODO: do we want to sync "Clean" action? - resource.outdateResource(this, mapOut); - - if (this.logActivity) { - // resource.onDataUpdate.addHandler(resource.logLock('onDataUpdate > ' + this.getName())); - } - - // resource.onDataUpdate.addHandler(param => { this.load(param, context); }); - - if (this.logActivity) { - // resource.onDataUpdate.addHandler(resource.logLock('onDataUpdate < ' + this.getName())); - } - - this.preloadResource(resource, mapTo); - } - - /** - * Mark {@link resource} as updated when current resource is updated. - * @param resource - Resource to mark as updated - * @param mapTo - Map current resource key to {@link resource} key - * @param mapOut - Map {@link resource} key to current resource key - */ - updateResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { - this.onDataUpdate.addHandler(param => { - try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' update - ' + resource.getName())); - } - - if (map) { - param = map(param) as ResourceKey; - } - - resource.markUpdated(param as ResourceKey); - } finally { - if (this.logActivity) { - console.groupEnd(); - } - } - }); - - return this; - } - - /** - * Mark {@link resource} as outdated when current resource is outdated. - * @param resource - Resource to mark as outdated - * @param mapTo - Map current resource key to {@link resource} key - * @param mapOut - Map {@link resource} key to current resource key - */ - outdateResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { - this.onDataOutdated.addHandler(param => { - try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' outdate - ' + resource.getName())); - } - - if (map) { - param = map(param) as ResourceKey; - } - - resource.markOutdated(param as ResourceKey); - } finally { - if (this.logActivity) { - console.groupEnd(); - } - } - }); - - return this; - } - - /** - * Preload {@link resource} before current resource is loaded and connect {@link resource} to current resource. - * @param resource - Resource to preload - * @param mapTo - Map current resource key to {@link resource} key - * @param mapOut - Map {@link resource} key to current resource key - */ - preloadResource(resource: CachedResource, map?: (param: ResourceKey) => ResourceKey): this { - resource.connect(this); - - this.beforeLoad.addHandler(async param => { - try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' preload - ' + resource.getName())); - } - - if (map) { - param = map(param) as ResourceKey; - } - - await resource.load(param as ResourceKey); - } finally { - if (this.logActivity) { - console.groupEnd(); - } - } - }); - - return this; - } - - /** - * Execute handler before resource is loaded - * @param handler - Handler to execute - */ - before(handler: IExecutorHandler>): this { - this.beforeLoad.addHandler(async (param, contexts) => { - try { - if (this.logActivity) { - console.group(this.getActionPrefixedName(' preload - ' + handler.name)); - } - - await handler(param, contexts); - } finally { - if (this.logActivity) { - console.groupEnd(); - } - } - }); - - return this; - } - - /** - * Return true if resource is in use - * @param param - Resource key - */ - isInUse(param: ResourceKey): boolean { - return this.someMetadata(param, metadata => metadata.dependencies.length > 0); - } - - /** - * Return true if resource is in use by {@link id} - * @param id - Dependency id - */ - hasUseId(id: string): boolean { - return this.getAllMetadata().some(metadata => metadata.dependencies.includes(id)); - } - - /** - * Use resource by {@link param}. Optionally provide {@link id} to track dependency. - * @param param - Resource key - * @param id - Dependency id (uuid by default) - * @returns Dependency id - */ - use(param: ResourceKey, id = uuid()): string { - this.updateMetadata(param, metadata => { - metadata.dependencies.push(id); - }); - if (isResourceAlias(param)) { - param = this.transformToAlias(param); - } - this.onUse.execute({ id, param, isInUse: true }); - if (this.logActivity) { - console.log('Use resource: ', this.getName(), param); - } - return id; - } - - /** - * Release resource by {@link param} and {@link id} - * @param param - Resource key - * @param id - Dependency id - */ - free(param: ResourceKey, id: string): void { - this.updateMetadata(param, metadata => { - if (metadata.dependencies.length > 0) { - metadata.dependencies = metadata.dependencies.filter(v => v !== id); - } - }); - if (isResourceAlias(param)) { - param = this.transformToAlias(param); - } - this.onUse.execute({ id, param, isInUse: false }); - - if (this.logActivity) { - console.log('Free resource: ', this.getName(), param); - } - } - - isLoaded(param?: ResourceKey, includes?: TInclude): boolean { - if (param === undefined) { - param = CachedResourceParamKey; - } - - if (!this.hasMetadata(param)) { - return false; - } - - const pageKey = this.isAlias(param, CachedResourcePageKey) || this.isAlias(param, CachedResourcePageListKey); - if (pageKey) { - const pageInfo = this.getPageInfo(pageKey); - - if (!pageInfo || !isPageInRange(pageInfo, pageKey.options)) { - return false; - } - } - - return this.everyMetadata(param, metadata => metadata.loaded) && (!includes || this.isIncludes(param, includes)); - } - - /** - * Return true if resource is outdated or not loaded - * @param param - Resource key - */ - isLoadable(param?: ResourceKey, context?: TInclude): boolean { - if (param === undefined) { - param = CachedResourceParamKey; - } - return !this.isLoaded(param, context) || this.isOutdated(param); - } - - hasAlias(key: ResourceAlias): boolean { - return this.paramAliases.some(alias => alias.id === key.id); - } - - isAlias( - key: ResourceKey, - aliasToCompare?: ResourceAlias | ResourceAliasFactory, - ): ResourceAlias | undefined { - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - if (this.hasAlias(key)) { - if (aliasToCompare === undefined) { - return key as ResourceAlias; - } - return key.find(aliasToCompare); - } - throw new Error(`Alias ${key.toString()} is not registered in ${this.getName()}`); - } - return undefined; - } - - /** - * Return promise that will be resolved when resource will finish loading pending requests. - * Will be resolved immediately if resource is not loading. - */ - waitLoad(): Promise { - return this.scheduler.wait(); - } - - isLoading(key?: ResourceKey): boolean { - if (key === undefined) { - key = CachedResourceParamKey; - } - - return this.someMetadata(key, metadata => metadata.loading); - } - - /** - * Return true if specified {@link includes} is loaded for specified {@link key} - * @param key - Resource key - * @param includes - Includes - */ - isIncludes(key: ResourceKey, includes: TInclude): boolean { - return this.everyMetadata(key, metadata => includes.every(include => metadata.includes.includes(include))); - } - - getPageInfo(key: ResourceAlias>): ICachedResourcePage | undefined { - if (!this.hasMetadata(key as TKey)) { - return undefined; - } - - const page = this.getMetadata(key as TKey).page; - - if (!page || !isPageInRange(page, key.options)) { - return undefined; - } - - return page; - } - - hasNextPage(key: ResourceAlias>): boolean { - const pageInfo = this.getPageInfo(key); - const to = key.options.offset + key.options.limit; - - if (!pageInfo) { - return false; - } - - return pageInfo.end === undefined || to < pageInfo.end; - } - - hasMetadata(key: ResourceKey): boolean { - if (isResourceKeyList(key)) { - return key.every(key => this.metadata.has(this.getMetadataKeyRef(key))); - } - - return this.metadata.has(this.getMetadataKeyRef(key)); - } - - everyMetadata(param: ResourceKey, predicate: (metadata: TMetadata) => boolean): boolean { - if (!this.hasMetadata(param)) { - return false; - } - - return !this.someMetadata(param, key => !predicate(key)); - } - - someMetadata(param: ResourceKey, predicate: (metadata: TMetadata) => boolean): boolean { - if (!this.hasMetadata(param)) { - return false; - } - - if (isResourceKeyList(param)) { - return param.some(key => predicate(this.getMetadata(key))); - } - - let result = false; - - if (predicate(this.getMetadata(param))) { - result = true; - } - - if (isResourceAlias(param)) { - param = this.transformToKey(param); - - if (isResourceKeyList(param)) { - if (this.someMetadata(param, predicate)) { - result = true; - } - } - } - - return result; - } - - mapMetadata(param: ResourceKeyFlat, map: (metadata: TMetadata | undefined) => TValue): TValue; - mapMetadata(param: ResourceKeyList, map: (metadata: TMetadata | undefined) => TValue): TValue[]; - mapMetadata(param: ResourceKey, map: (metadata: TMetadata | undefined) => TValue): TValue | TValue[]; - mapMetadata(param: ResourceKey, map: (metadata: TMetadata | undefined) => TValue): TValue | TValue[] { - const callback = (key: ResourceKeyFlat) => { - if (!this.hasMetadata(key)) { - return map(undefined); - } - return map(this.getMetadata(key)); - }; - - if (isResourceKeyList(param)) { - return param.map(callback); - } - - return callback(param); - } - - /** - * Use it instead of this.metadata.values - * This method can be overridden - */ - getAllMetadata(): TMetadata[] { - return [...this.metadata.values()]; - } - - /** - * Use it instead of this.metadata.get - * This method can be overridden - */ - getMetadata(key: ResourceKeyFlat): TMetadata; - getMetadata(key: ResourceKeyList): TMetadata[]; - getMetadata(key: ResourceKey): TMetadata | TMetadata[]; - getMetadata(key: ResourceKey): TMetadata | TMetadata[] { - if (isResourceKeyList(key)) { - return key.map(key => this.getMetadata(key)); - } - - return this.metadata.get(this.getMetadataKeyRef(key)); - } - - /** - * Use to update metadata - * This method can be overridden - */ - updateMetadata(key: ResourceKey, callback: (data: TMetadata) => void): void { - ResourceKeyUtils.forEach(key, key => { - callback(this.getMetadata(key)); - }); - } - - /** - * Use it instead of this.metadata.delete - * This method can be overridden - */ - deleteMetadata(param: ResourceKey): void { - ResourceKeyUtils.forEach(param, key => { - this.metadata.delete(this.getMetadataKeyRef(key)); - }); - } - - getException(param: ResourceKeyFlat): Error | null; - getException(param: ResourceKeyList): Error[] | null; - getException(param: ResourceKey): Error[] | Error | null; - getException(param: ResourceKey): Error[] | Error | null { - if (isResourceKeyList(param)) { - return this.mapMetadata(param, metadata => metadata?.exception || null).filter((exception): exception is Error => exception !== null); - } - - return this.mapMetadata(param, metadata => metadata?.exception || null); - } - - isOutdated(param?: ResourceKey): boolean { - if (param === undefined) { - param = CachedResourceParamKey; - } - - const pageKey = this.isAlias(param, CachedResourcePageKey) || this.isAlias(param, CachedResourcePageListKey); - if (pageKey) { - const pageInfo = this.getPageInfo(pageKey); - - if (isPageOutdated(pageInfo?.pages || [], pageKey.options)) { - return true; - } - } - - return this.someMetadata(param, metadata => !metadata.loaded || metadata.outdated); - } - - protected setPageEnd(key: ResourceAlias>, hasNextPage: boolean): void { - const count = key.options.offset + key.options.limit; - - this.updateMetadata(key as TKey, metadata => { - let end = metadata.page?.end; - - if (hasNextPage) { - if (end !== undefined && end <= count) { - end = undefined; - } - } else { - end = count; - } - - metadata.page = observable({ - pages: [], - ...metadata.page, - end, - }); - - if (!hasNextPage) { - metadata.page.pages = limitPages(metadata.page?.pages || [], count); - } - }); - } - - markLoading(param: ResourceKey, state: boolean, context?: TInclude): void { - this.updateMetadata(param, metadata => { - metadata.loading = state; - }); - } - - markLoaded(param: ResourceKey, includes?: TInclude): void { - const pageKey = this.isAlias(param, CachedResourcePageKey) || this.isAlias(param, CachedResourcePageListKey); - - this.updateMetadata(param, metadata => { - metadata.loaded = true; - - if (pageKey) { - metadata.page = observable({ - ...metadata.page, - pages: expandRange(metadata.page?.pages || [], pageKey.options, false), - }); - } - - if (includes) { - this.commitIncludes(metadata, includes); - } - }); - - if (isResourceAlias(param)) { - param = this.transformToKey(param); - - this.updateMetadata(param, metadata => { - metadata.loaded = true; - if (includes) { - this.commitIncludes(metadata, includes); - } - }); - } - } - - markError(exception: Error, key: ResourceKey, include?: TInclude): ResourceError { - exception = new ResourceError(this, key, include, exception.message, { cause: exception }); - const pageKey = this.isAlias(key, CachedResourcePageKey) || this.isAlias(key, CachedResourcePageListKey); - this.updateMetadata(key, metadata => { - metadata.exception = exception; - metadata.outdated = false; - - if (pageKey) { - metadata.page = observable({ - ...metadata.page, - pages: expandRange(metadata.page?.pages || [], pageKey.options, false), - }); - } else { - metadata.page?.pages.forEach(page => { - page.outdated = false; - }); - } - }); - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - } - this.onDataError.execute({ param: key, exception }); - return exception as ResourceError; - } - - cleanError(param?: ResourceKey): void { - if (param === undefined) { - param = CachedResourceParamKey; - } - - this.updateMetadata(param, metadata => { - metadata.exception = null; - }); - } - - markOutdated(param?: ResourceKey): void { - if (param === undefined) { - param = CachedResourceParamKey; - } - - const isKeyExecuting = param === CachedResourceParamKey ? this.scheduler.executing : this.scheduler.isExecuting(param); - - if (isKeyExecuting && !this.outdateWaitList.some(key => this.isIntersect(param!, key))) { - this.outdateWaitList.push(param); - return; - } - - this.markOutdatedSync(param); - } - - markUpdated(param?: ResourceKey): void { - if (param === undefined) { - param = CachedResourceParamKey; - } - const pageKey = this.isAlias(param, CachedResourcePageKey) || this.isAlias(param, CachedResourcePageListKey); - - this.updateMetadata(param, metadata => { - metadata.outdated = false; - - if (pageKey) { - metadata.page = observable({ - ...metadata.page, - pages: expandRange(metadata.page?.pages || [], pageKey.options, false), - }); - } - }); - - if (isResourceAlias(param)) { - param = this.transformToKey(param); - - this.updateMetadata(param, metadata => { - metadata.outdated = false; - }); - } - } - - /** - * Method cleans error for {@link key} when specified or for resource itself. - * Method will execute {@link onDataUpdate}. - */ - dataUpdate(key?: ResourceKey): void { - if (key === undefined) { - key = CachedResourceParamKey; - } - - this.cleanError(key); - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - } - this.onDataUpdate.execute(key); - } - - addAlias( - param: ResourceAlias | ResourceAliasFactory, - getAlias: (param: ResourceAlias) => ResourceKey, - ): void { - this.paramAliases.push({ id: param.id, getAlias }); - } - - replaceAlias( - param: ResourceAlias | ResourceAliasFactory, - getAlias: (param: ResourceAlias) => ResourceKey, - ): void { - const indexOf = this.paramAliases.findIndex(aliasInfo => aliasInfo.id === param.id); - - if (indexOf === -1) { - this.addAlias(param, getAlias); - } else { - this.paramAliases.splice(indexOf, 1, { id: param.id, getAlias }); - } - } - - async refresh(key?: ResourceKey, context?: TInclude): Promise { - if (key === undefined) { - key = CachedResourceParamKey; - } - await this.loadData(key, true, context); - return this.data; - } - - /** - * Load data for {@link key} when specified or for resource itself. - * Data loading will be skipped if data already loaded and updated. - * @param key - Resource key - * @param context - Includes - * @returns Resource data - */ - async load(key?: ResourceKey, context?: TInclude): Promise { - if (key === undefined) { - key = CachedResourceParamKey; - } - await this.loadData(key, false, context); - return this.data; - } - - getIncludes(key?: ResourceKeyFlat): ReadonlyArray { - if (key === undefined) { - key = CachedResourceParamKey; - } - - if (!this.hasMetadata(key)) { - return this.defaultIncludes; - } - - const metadata = this.getMetadata(key); - return metadata.includes; - } - - clear(): void { - this.resetDataToDefault(); - this.metadata.clear(); - this.onUse.execute(this.getInitialOnUseData()); - this.onDataUpdate.execute(this.transformToAlias(CachedResourceParamKey)); - } - - /** - * Converts array of includes to map - * ``` - * { - * customIncludeBase: true, - * [key]: true - * } - * ``` - * @param key - Resource to extract includes from metadata - * @param includes - Base includes - * @returns {Object} Object where key is include name and value is true - */ - getIncludesMap(key?: ResourceKeyFlat, includes: ReadonlyArray = this.defaultIncludes): Record { - const keyIncludes = this.getIncludes(key); - return ['customIncludeBase', ...includes, ...keyIncludes].reduce((map, key) => { - map[key] = true; - - return map; - }, {}); - } - - /** - * Can be overridden to provide equality check for complicated keys - */ - isKeyEqual(param: TKey, second: TKey): boolean { - return param === second; - } - - /** - * Check if key is a part of nextKey - * @param nextKey - Resource key - * @param key - Resource key - * @returns {boolean} Returns true if key can be represented by nextKey - */ - isIntersect(key: ResourceKey, nextKey: ResourceKey): boolean { - if (key === nextKey) { - return true; - } - - if (isResourceAlias(key) && isResourceAlias(nextKey)) { - key = this.transformToAlias(key); - nextKey = this.transformToAlias(nextKey); - - return key.isEqual(nextKey) && this.isIntersect(key.target, nextKey.target); - } else if (isResourceAlias(key) || isResourceAlias(nextKey)) { - return true; - } - - if (isResourceKeyList(key) || isResourceKeyList(nextKey)) { - return ResourceKeyUtils.isIntersect(key, nextKey, this.isKeyEqual); - } - - return ResourceKeyUtils.isIntersect(key, nextKey, this.isKeyEqual); - } - - /** - * Can be overridden to provide static link to complicated keys - */ - protected getKeyRef(key: TKey): TKey { - if (isPrimitive(key)) { - return key; - } - return Object.freeze(toJS(key)); - } - - /** - * Can be overridden to provide static link to complicated keys - */ - protected getMetadataKeyRef(key: ResourceKeyFlat): TKey { - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - - if (isNotNullDefined(key.target)) { - return this.getMetadataKeyRef(key.target); - } - - return key.toString() as TKey; - } - - if (isPrimitive(key)) { - return key; - } - - const ref = Array.from(this.metadata.keys()).find(k => this.isKeyEqual(k, key as TKey)); - - if (ref) { - return ref; - } - - return this.getKeyRef(key); - } - - //TODO must be protected - transformToKey(param: ResourceKey): TKey | ResourceKeyList { - let deep = 0; - - while (deep < 10) { - if (!this.validateResourceKey(param)) { - let paramString = JSON.stringify(toJS(param)); - - if (isResourceKeyList(param)) { - paramString = param.toString(); - } - console.warn(this.getActionPrefixedName(`wrong param "${paramString}"`)); - } - - if (isResourceAlias(param)) { - for (const alias of this.paramAliases) { - if (alias.id === param.id) { - param = this.captureGetAlias(alias, param); - deep++; - break; - } - } - } else { - break; - } - } - - if (deep === 10) { - console.warn(this.getActionPrefixedName('parameter transform was stopped')); - } - - if (isResourceAlias(param)) { - throw new Error(this.getActionPrefixedName(`Can't resolve alias ${param.toString()}`)); - } - return param; - } - - // TODO: add information about original alias for debugging - protected transformToAlias( - key: ResourceKeyAlias | ResourceKeyListAlias, - ): ResourceKeyAlias | ResourceKeyListAlias { - if (this.captureAliasGetterExecution) { - return key; - } - - let deep = 0; - // eslint-disable-next-line no-labels - transform: if (deep < 10) { - if (!this.validateResourceKey(key)) { - let paramString = JSON.stringify(toJS(key)); - - if (isResourceKeyList(key) || isResourceAlias(key)) { - paramString = key.toString(); - } - console.warn(this.getActionPrefixedName(`wrong param "${paramString}"`)); - } - - for (const alias of this.paramAliases) { - if (alias.id === key.id) { - const data = this.captureGetAlias(alias, key); - - if (isResourceAlias(data)) { - key = data.setParent(key); - } else { - return key; - } - deep++; - // eslint-disable-next-line no-labels - break transform; - } - } - } else { - console.warn('CachedResource: parameter transform was stopped'); - } - return key; - } - - protected captureGetAlias(alias: IParamAlias, param: ResourceAlias): ResourceKey { - try { - this.captureAliasGetterExecution = true; - return alias.getAlias(param); - } finally { - this.captureAliasGetterExecution = false; - } - } - - /** - * Check if key is valid. Can be overridden to provide custom validation. - * When key is alias checks that alias is registered. - * When key is list checks that all keys are valid. - * When key is primitive checks that this type of primitive is valid for current resource. - * @param param - Resource key - */ - protected validateResourceKey(param: ResourceKey): boolean { - if (isResourceAlias(param)) { - return this.hasAlias(param); - } - - if (isResourceKeyList(param)) { - return param.length === 0 || param.every(this.validateKey.bind(this)); - } - return this.validateKey(param); - } - - /** - * Check if key is valid. Can be overridden to provide custom validation. - */ - protected abstract validateKey(key: TKey): boolean; - - protected resetIncludes(): void { - for (const metadata of this.getAllMetadata()) { - metadata.includes = observable([...this.defaultIncludes]); - } - } - - protected commitIncludes(metadata: TMetadata, includes: ReadonlyArray): void { - for (const include of includes) { - if (!metadata.includes.includes(include)) { - metadata.includes.push(include); - } - } - } - - protected resetDataToDefault(): void { - this.setData(this.defaultValue()); - } - - protected setData(data: TData): void { - this.data = data; - } - - protected markOutdatedSync(key: ResourceKey): void { - // Commented because it can lead to skipping existing keys outdate if some of them doesn't exists - // if (!this.hasMetadata(key)) { - // return; - // } - const pageKey = this.isAlias(key, CachedResourcePageKey) || this.isAlias(key, CachedResourcePageListKey); - this.updateMetadata(key, metadata => { - metadata.outdated = true; - - if (pageKey) { - metadata.page = observable({ - ...metadata.page, - pages: expandRange(metadata.page?.pages || [], pageKey.options, true), - }); - } else { - metadata.page?.pages.forEach(page => { - page.outdated = true; - }); - } - }); - - if (isResourceAlias(key)) { - key = this.transformToKey(key); - - this.updateMetadata(key, metadata => { - metadata.outdated = true; - metadata.page?.pages.forEach(page => { - page.outdated = true; - }); - }); - } - - this.onDataOutdated.execute(key); - } - - protected getInitialOnUseData(): IUseData { - return { - id: undefined, - param: CachedResourceParamKey, - isInUse: false, - }; - } - /** - * Use to extend metadata - * @returns {Record} Object Map - */ - protected getDefaultMetadata(key: TKey, metadata: MetadataMap): ICachedResourceMetadata { - return { - loaded: false, - outdated: true, - loading: false, - exception: null, - includes: observable([...this.defaultIncludes]), - dependencies: observable([]), - }; - } - - protected async preLoadData( - param: ResourceKey, - contexts: IExecutionContextProvider>, - refresh: boolean, - context?: TInclude, - ): Promise {} - - protected abstract loader(param: ResourceKey, include: ReadonlyArray | undefined, refresh: boolean): Promise; - - /** - * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. - * Resource will be marked as loading and will be marked as loaded after loader is finished. - * Exceptions will be handled and stored in metadata. - * @param key - Resource key - * @param include - Includes - * @param update - Update function - */ - async performUpdate( - key: ResourceKey, - include: TInclude | undefined, - update: (key: ResourceKey, context?: ReadonlyArray) => Promise, - ): Promise; - - /** - * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. - * Resource will be marked as loading and will be marked as loaded after loader is finished. - * Exceptions will be handled and stored in metadata. - * @param key - Resource key - * @param include - Includes - * @param update - Update function - * @param exitCheck - Function will be called before calling {@link update} function. If it returns true then update will be skipped. - */ - async performUpdate( - key: ResourceKey, - include: TInclude | undefined, - update: (key: ResourceKey, context?: ReadonlyArray) => Promise, - exitCheck: (key: ResourceKey, context?: ReadonlyArray) => boolean, - ): Promise; - - /** - * Implements same behavior as {@link CachedResource.load} and {@link CachedResource.refresh} for custom loaders. - * Resource will be marked as loading and will be marked as loaded after loader is finished. - * Exceptions will be handled and stored in metadata. - * @param key - Resource key - * @param include - Includes - * @param update - Update function - * @param exitCheck - Function will be called before calling {@link update} function. If it returns true then update will be skipped. - */ - async performUpdate( - key: ResourceKey, - include: TInclude | undefined, - update: (key: ResourceKey, context?: ReadonlyArray) => Promise, - exitCheck?: (key: ResourceKey, context?: ReadonlyArray) => boolean, - ): Promise { - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - } - - const context = new ExecutionContext(key); - await this.preLoadData(key, context, true, include); - await this.beforeLoad.execute(key, context); - - if (ExecutorInterrupter.isInterrupted(context)) { - return; - } - - await this.scheduler.waitRelease(key); - - if (exitCheck?.(key, include)) { - return; - } - - let loaded = false; - return this.scheduler.schedule( - key, - async () => { - // repeated because previous task maybe has been load requested data - if (exitCheck?.(key, include)) { - return; - } - - this.markLoading(key, true, include); - try { - const result = await this.taskWrapper(key, include, true, update); - loaded = true; - return result; - } finally { - this.markLoading(key, false, include); - } - }, - { - success: () => { - if (loaded) { - this.onDataOutdated.execute(key); // TODO: probably need to remove, we need to notify any related resources that subscribed to .onOutdate, to recursively outdate them - this.dataUpdate(key); - } - }, - error: exception => { - this.markOutdatedSync(key); - this.markError(exception, key, include); - }, - after: () => { - this.flushOutdatedWaitList(); - }, - }, - ); - } - - protected async loadData(key: ResourceKey, refresh: boolean, include?: TInclude): Promise { - if (isResourceAlias(key)) { - key = this.transformToAlias(key); - } - const contexts = new ExecutionContext(key); - if (!refresh) { - if (!this.isLoadable(key, include)) { - return; - } - - await this.scheduler.waitRelease(key); - - if (!this.isLoadable(key, include)) { - return; - } - } - - await this.preLoadData(key, contexts, refresh, include); - await this.beforeLoad.execute(key, contexts); - - if (ExecutorInterrupter.isInterrupted(contexts)) { - return; - } - - let loaded = false; - await this.scheduler.schedule( - key, - async () => { - // repeated because previous task maybe has been load requested data - if (!refresh && !this.isLoadable(key, include)) { - return; - } - - this.markLoading(key, true, include); - try { - const result = await this.taskWrapper(key, include, refresh, this.loadingTask); - loaded = true; - this.markLoaded(key, include); - return result; - } finally { - this.markLoading(key, false, include); - } - }, - { - before: () => { - if (refresh) { - this.markOutdatedSync(key); - } - }, - success: async () => { - if (loaded) { - this.dataUpdate(key); - } - }, - error: exception => this.markError(exception, key, include), - after: () => { - this.flushOutdatedWaitList(); - }, - }, - ); - } - - private async loadingTask(param: ResourceKey, context: ReadonlyArray | undefined, refresh: boolean) { - this.setData(await this.loader(param, context, refresh)); - } - - private async taskWrapper( - param: ResourceKey, - context: ReadonlyArray | undefined, - refresh: boolean, - promise: (param: ResourceKey, context: ReadonlyArray | undefined, refresh: boolean) => Promise, - ) { - if (this.logActivity) { - console.log(this.getActionPrefixedName('loading')); - } - - const value = await promise(param, context, refresh); - this.markUpdated(param); - return value; - } - - private flushOutdatedWaitList(): void { - for (let i = 0; i < this.outdateWaitList.length; i++) { - const key = this.outdateWaitList[i]; - this.markOutdatedSync(key); - } - this.outdateWaitList = []; - } - - public getName(): string { - return this.constructor.name; - } - - protected logLock = - (action: string): IExecutorHandler => - () => { - console.log(this.getActionPrefixedName(action)); - }; - - private readonly logName = - (action: string): IExecutorHandler => - () => { - console.log(this.getActionPrefixedName(action)); - }; - - protected getActionPrefixedName(action: string): string { - return this.getName() + ': ' + action; - } - - private readonly logInterrupted = - (action: string): IExecutorHandler => - (data, contexts) => { - if (ExecutorInterrupter.isInterrupted(contexts)) { - console.log(this.getActionPrefixedName(action) + 'interrupted'); - } - }; - - private spy(executor: ISyncExecutor, action: string): void { - executor.addHandler(this.logName(action)).addPostHandler(this.logInterrupted(action)); - } -} - -export function getNextPageOffset(info: ICachedResourcePage): number { - let lastPage: IResourcePage | undefined = undefined; - - for (const page of info.pages) { - if (!lastPage) { - lastPage = page; - continue; - } - if (page.from !== lastPage.to) { - break; - } - lastPage = page; - } - - return lastPage?.to ?? CACHED_RESOURCE_DEFAULT_PAGE_OFFSET; -} - -function isPageOutdated(pages: IResourcePage[], info: IPageInfo): boolean { - for (const { from, to, outdated } of pages) { - if (outdated && info.offset >= from && info.offset + info.limit <= to) { - return true; - } - } - return false; -} - -function isPageInRange({ pages, end }: ICachedResourcePage, info: IPageInfo): boolean { - const infoTo = info.offset + info.limit; - let meetFrom = false; - let meetTo = false; - let lastIndex = -1; - - for (const { from, to } of pages) { - if (lastIndex === -1) { - lastIndex = from; - } - if (from !== lastIndex) { - return false; - } - lastIndex = to; - if (info.offset >= from) { - meetFrom = true; - } - if (infoTo <= to || (end !== undefined && end <= infoTo)) { - meetTo = true; - } - if (meetFrom && meetTo) { - return true; - } - } - return false; -} - -function limitPages(pages: IResourcePage[], limit: number): IResourcePage[] { - const result: IResourcePage[] = []; - - for (const page of pages) { - if (page.from >= limit) { - break; - } - result.push({ ...page, to: Math.min(limit, page.to) }); - } - - return result; -} - -function expandRange(pages: IResourcePage[], info: IPageInfo, outdated: boolean): IResourcePage[] { - pages = [...pages, { from: info.offset, to: info.offset + info.limit, outdated, end: false }].sort((a, b) => a.from - b.from); - const result: IResourcePage[] = []; - let previous: IResourcePage | undefined; - - for (const { from, to, outdated } of pages) { - if (!previous) { - previous = { from, to, outdated }; - continue; - } - - if (from <= previous.from + previous.to) { - if (previous.outdated === outdated) { - previous.to = Math.max(previous.to, to); - } else { - if (previous.from < from) { - result.push({ ...previous, to: from }); - } - if (previous.to > to) { - result.push({ from, to, outdated }); - previous = { ...previous, from: to }; - } else { - previous = { from, to, outdated }; - } - } - } else { - result.push(previous); - previous = { from, to, outdated }; - } - } - - if (previous) { - result.push(previous); - } - return result; -} diff --git a/webapp/packages/core-sdk/src/index.ts b/webapp/packages/core-sdk/src/index.ts index bbe21adc38..399400d300 100644 --- a/webapp/packages/core-sdk/src/index.ts +++ b/webapp/packages/core-sdk/src/index.ts @@ -1,17 +1,5 @@ export * from './AsyncTask/AsyncTask'; export * from './AsyncTask/AsyncTaskInfoService'; -export * from './Resource/CachedDataResource'; -export * from './Resource/CachedMapResource'; -export * from './Resource/CachedResource'; -export * from './Resource/CachedResourceIncludes'; -export * from './Resource/CachedTreeResource'; -export * from './Resource/ResourceAlias'; -export * from './Resource/ResourceError'; -export * from './Resource/ResourceKey'; -export * from './Resource/ResourceKeyAlias'; -export * from './Resource/ResourceKeyList'; -export * from './Resource/ResourceKeyListAlias'; -export * from './Resource/ResourceKeyUtils'; export * from './CustomGraphQLClient'; export * from './DetailsError'; export * from './EnvironmentService'; @@ -24,4 +12,4 @@ export * from './isObjectPropertyInfoStateEqual'; export * from './sdk'; export * from './ServerInternalError'; export * from './ServiceError'; -export { manifest as coreSDKManifest } from './manifest'; +export * from './manifest'; diff --git a/webapp/packages/core-sdk/src/manifest.ts b/webapp/packages/core-sdk/src/manifest.ts index a42b9b913b..88038dd2e9 100644 --- a/webapp/packages/core-sdk/src/manifest.ts +++ b/webapp/packages/core-sdk/src/manifest.ts @@ -11,7 +11,7 @@ import { AsyncTaskInfoService } from './AsyncTask/AsyncTaskInfoService'; import { EnvironmentService } from './EnvironmentService'; import { GraphQLService } from './GraphQLService'; -export const manifest: PluginManifest = { +export const coreSDKManifest: PluginManifest = { info: { name: 'Core SDK', }, diff --git a/webapp/packages/core-sdk/tsconfig.json b/webapp/packages/core-sdk/tsconfig.json index bd4ed8f7d0..efff7e2d3e 100644 --- a/webapp/packages/core-sdk/tsconfig.json +++ b/webapp/packages/core-sdk/tsconfig.json @@ -1,10 +1,28 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ], "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ] } diff --git a/webapp/packages/core-settings/package.json b/webapp/packages/core-settings/package.json index edda1cd11f..c94f6e29ce 100644 --- a/webapp/packages/core-settings/package.json +++ b/webapp/packages/core-settings/package.json @@ -1,25 +1,29 @@ { "name": "@cloudbeaver/core-settings", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/core-browser": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-browser": "~0.1.0" + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/core-settings/src/index.ts b/webapp/packages/core-settings/src/index.ts index 64adec9ced..378254ef49 100644 --- a/webapp/packages/core-settings/src/index.ts +++ b/webapp/packages/core-settings/src/index.ts @@ -1,4 +1,4 @@ -export { manifest as coreSettingsManifest } from './manifest'; +export * from './manifest'; export * from './createSettingsGroup'; export * from './SettingsService'; export * from './LocalStorageSaveService'; diff --git a/webapp/packages/core-settings/src/manifest.ts b/webapp/packages/core-settings/src/manifest.ts index 9fb07ab852..e5e5f2844a 100644 --- a/webapp/packages/core-settings/src/manifest.ts +++ b/webapp/packages/core-settings/src/manifest.ts @@ -11,7 +11,7 @@ import { LocalStorageSaveService } from './LocalStorageSaveService'; import { SettingsManagerService } from './SettingsManagerService'; import { SettingsService } from './SettingsService'; -export const manifest: PluginManifest = { +export const coreSettingsManifest: PluginManifest = { info: { name: 'Core Settings', }, diff --git a/webapp/packages/core-settings/tsconfig.json b/webapp/packages/core-settings/tsconfig.json index bd4ed8f7d0..80b1e6b08d 100644 --- a/webapp/packages/core-settings/tsconfig.json +++ b/webapp/packages/core-settings/tsconfig.json @@ -1,10 +1,34 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-browser" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-theming/package.json b/webapp/packages/core-theming/package.json index 1c0e5f643a..ac07b6357f 100644 --- a/webapp/packages/core-theming/package.json +++ b/webapp/packages/core-theming/package.json @@ -1,28 +1,24 @@ { "name": "@cloudbeaver/core-theming", - "sideEffects": true, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-settings": "~0.1.0", "@fontsource/roboto": "^5.0.8", "@material/button": "~4.0.0", "@material/checkbox": "~4.0.0", @@ -32,12 +28,22 @@ "@material/ripple": "~4.0.0", "@material/switch": "~4.0.0", "@material/theme": "~4.0.0", - "@material/typography": "~4.0.0" + "@material/typography": "~4.0.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-settings": "~0.1.0" }, "peerDependencies": { "@testing-library/jest-dom": "~6.x.x", "mobx": "~6.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/core-theming/src/ThemeSettingsService.test.ts b/webapp/packages/core-theming/src/ThemeSettingsService.test.ts index 191e85d874..e619581b8e 100644 --- a/webapp/packages/core-theming/src/ThemeSettingsService.test.ts +++ b/webapp/packages/core-theming/src/ThemeSettingsService.test.ts @@ -7,20 +7,37 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { createApp } from '@cloudbeaver/tests-runner'; +import { coreThemingManifest } from './manifest'; import { IThemeSettings, ThemeSettingsService } from './ThemeSettingsService'; const endpoint = createGQLEndpoint(); -const app = createApp(); +const app = createApp( + coreThemingManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + coreLocalizationManifest, +); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/core-theming/src/index.ts b/webapp/packages/core-theming/src/index.ts index 6128c7da44..397825a164 100644 --- a/webapp/packages/core-theming/src/index.ts +++ b/webapp/packages/core-theming/src/index.ts @@ -1,4 +1,4 @@ -export { manifest as coreThemingManifest } from './manifest'; +export * from './manifest'; export * from './ComponentStyle'; export * from './ThemeService'; export * from './themeUtils'; diff --git a/webapp/packages/core-theming/src/manifest.ts b/webapp/packages/core-theming/src/manifest.ts index 3db455383c..dee0ce72e1 100644 --- a/webapp/packages/core-theming/src/manifest.ts +++ b/webapp/packages/core-theming/src/manifest.ts @@ -11,7 +11,7 @@ import { LocaleService } from './LocaleService'; import { ThemeService } from './ThemeService'; import { ThemeSettingsService } from './ThemeSettingsService'; -export const manifest: PluginManifest = { +export const coreThemingManifest: PluginManifest = { info: { name: 'Core Theming', }, diff --git a/webapp/packages/core-theming/tsconfig.json b/webapp/packages/core-theming/tsconfig.json index bd4ed8f7d0..051d00ed9a 100644 --- a/webapp/packages/core-theming/tsconfig.json +++ b/webapp/packages/core-theming/tsconfig.json @@ -1,10 +1,46 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-ui/package.json b/webapp/packages/core-ui/package.json index b354007653..0ddd2d9d25 100644 --- a/webapp/packages/core-ui/package.json +++ b/webapp/packages/core-ui/package.json @@ -1,39 +1,42 @@ { "name": "@cloudbeaver/core-ui", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-authentication": "~0.1.0", - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-theming": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", - "@cloudbeaver/core-routing": "~0.1.0", "react-dnd": "~16.0.1", - "react-dnd-html5-backend": "~16.0.1" + "react-dnd-html5-backend": "~16.0.1", + "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-dialogs": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-executor": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-routing": "~0.1.0", + "@cloudbeaver/core-theming": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0", + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "reakit": "~1.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-ui/src/DragAndDrop/useDNDBox.ts b/webapp/packages/core-ui/src/DragAndDrop/useDNDBox.ts index 3bb8b8d178..562b0285fb 100644 --- a/webapp/packages/core-ui/src/DragAndDrop/useDNDBox.ts +++ b/webapp/packages/core-ui/src/DragAndDrop/useDNDBox.ts @@ -10,7 +10,7 @@ import React, { useRef } from 'react'; import { useDrop } from 'react-dnd'; import { useObjectRef, useObservableRef } from '@cloudbeaver/core-blocks'; -import type { IDataContextProvider } from '@cloudbeaver/core-view'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { DND_ELEMENT_TYPE } from './DND_ELEMENT_TYPE'; import type { DNDAcceptType } from './DNDAcceptType'; diff --git a/webapp/packages/core-ui/src/DragAndDrop/useDNDData.ts b/webapp/packages/core-ui/src/DragAndDrop/useDNDData.ts index 6f77c35a7c..662d4310d6 100644 --- a/webapp/packages/core-ui/src/DragAndDrop/useDNDData.ts +++ b/webapp/packages/core-ui/src/DragAndDrop/useDNDData.ts @@ -9,7 +9,7 @@ import { observable } from 'mobx'; import { useDrag } from 'react-dnd'; import { useObjectRef, useObservableRef } from '@cloudbeaver/core-blocks'; -import type { IDataContextProvider } from '@cloudbeaver/core-view'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { DND_ELEMENT_TYPE } from './DND_ELEMENT_TYPE'; diff --git a/webapp/packages/core-ui/src/Form/DATA_CONTEXT_FORM_STATE.ts b/webapp/packages/core-ui/src/Form/DATA_CONTEXT_FORM_STATE.ts index 9a3d7829d3..de3b2524e3 100644 --- a/webapp/packages/core-ui/src/Form/DATA_CONTEXT_FORM_STATE.ts +++ b/webapp/packages/core-ui/src/Form/DATA_CONTEXT_FORM_STATE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { IFormState } from './IFormState'; diff --git a/webapp/packages/core-ui/src/Form/FormState.ts b/webapp/packages/core-ui/src/Form/FormState.ts index 7ccd7cc3f1..20ec2bae0a 100644 --- a/webapp/packages/core-ui/src/Form/FormState.ts +++ b/webapp/packages/core-ui/src/Form/FormState.ts @@ -7,17 +7,12 @@ */ import { action, makeObservable, observable } from 'mobx'; +import { dataContextAddDIProvider, type IDataContext, TempDataContext } from '@cloudbeaver/core-data-context'; import type { App } from '@cloudbeaver/core-di'; import type { ENotificationType } from '@cloudbeaver/core-events'; import { Executor, IExecutionContextProvider, type IExecutor } from '@cloudbeaver/core-executor'; import { isLoadableStateHasException, MetadataMap, uuid } from '@cloudbeaver/core-utils'; -import { - DATA_CONTEXT_LOADABLE_STATE, - dataContextAddDIProvider, - type IDataContext, - loadableStateContext, - TempDataContext, -} from '@cloudbeaver/core-view'; +import { DATA_CONTEXT_LOADABLE_STATE, loadableStateContext } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_FORM_STATE } from './DATA_CONTEXT_FORM_STATE'; import type { FormBaseService } from './FormBaseService'; diff --git a/webapp/packages/core-ui/src/Form/IFormState.ts b/webapp/packages/core-ui/src/Form/IFormState.ts index 63a79720ee..2afc2b1d96 100644 --- a/webapp/packages/core-ui/src/Form/IFormState.ts +++ b/webapp/packages/core-ui/src/Form/IFormState.ts @@ -5,10 +5,10 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContext } from '@cloudbeaver/core-data-context'; import type { ENotificationType } from '@cloudbeaver/core-events'; import type { IExecutor } from '@cloudbeaver/core-executor'; import type { ILoadableState, MetadataMap } from '@cloudbeaver/core-utils'; -import type { IDataContext } from '@cloudbeaver/core-view'; import type { FormBaseService } from './FormBaseService'; import type { FormMode } from './FormMode'; diff --git a/webapp/packages/core-ui/src/InlineEditor/EditorDialog.tsx b/webapp/packages/core-ui/src/InlineEditor/EditorDialog.tsx index d7c4758a5a..a902e0a478 100644 --- a/webapp/packages/core-ui/src/InlineEditor/EditorDialog.tsx +++ b/webapp/packages/core-ui/src/InlineEditor/EditorDialog.tsx @@ -8,15 +8,17 @@ import { observer } from 'mobx-react-lite'; import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react'; -import { Button, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; import { + Button, CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, - DialogComponent, - DialogComponentProps, -} from '@cloudbeaver/core-dialogs'; + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponent, DialogComponentProps } from '@cloudbeaver/core-dialogs'; import style from './EditorDialog.m.css'; diff --git a/webapp/packages/core-ui/src/Tabs/DATA_CONTEXT_TABS_FORM_VALIDATION.ts b/webapp/packages/core-ui/src/Tabs/DATA_CONTEXT_TABS_FORM_VALIDATION.ts index a58fa890a9..3e6a59d6bf 100644 --- a/webapp/packages/core-ui/src/Tabs/DATA_CONTEXT_TABS_FORM_VALIDATION.ts +++ b/webapp/packages/core-ui/src/Tabs/DATA_CONTEXT_TABS_FORM_VALIDATION.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_TABS_FORM_VALIDATION = createDataContext('Tabs Form Validation', () => null); diff --git a/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TABS_CONTEXT.ts b/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TABS_CONTEXT.ts index 7040ecca13..d54ce83478 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TABS_CONTEXT.ts +++ b/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TABS_CONTEXT.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { ITabsContext } from '../TabsContext'; diff --git a/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TAB_ID.ts b/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TAB_ID.ts index 9badc95978..de05601733 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TAB_ID.ts +++ b/webapp/packages/core-ui/src/Tabs/Tab/DATA_CONTEXT_TAB_ID.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_TAB_ID = createDataContext('tab-id'); diff --git a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx index 47ec172016..821670cab8 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx +++ b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx @@ -11,8 +11,9 @@ import { Tab as BaseTab } from 'reakit/Tab'; import styled, { use } from 'reshadow'; import { getComputed, Icon, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import { IDataContext, useMenu } from '@cloudbeaver/core-view'; +import { useMenu } from '@cloudbeaver/core-view'; import { ContextMenu } from '../../ContextMenu/ContextMenu'; import { TabContext } from '../TabContext'; diff --git a/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts b/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts index 98c263e16e..f9b36d7072 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts +++ b/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts @@ -7,8 +7,8 @@ */ import type { PropsWithChildren } from 'react'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import type { IDataContext } from '@cloudbeaver/core-view'; import type { ITabData } from '../TabsContainer/ITabsContainer'; diff --git a/webapp/packages/core-ui/src/Tabs/TabsContainer/ITabsContainer.ts b/webapp/packages/core-ui/src/Tabs/TabsContainer/ITabsContainer.ts index c94c1cdbe9..5aecc42c41 100644 --- a/webapp/packages/core-ui/src/Tabs/TabsContainer/ITabsContainer.ts +++ b/webapp/packages/core-ui/src/Tabs/TabsContainer/ITabsContainer.ts @@ -5,8 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import type { ILoadableState, MetadataMap, MetadataValueGetter } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '@cloudbeaver/core-view'; import type { TabProps } from '../Tab/TabProps'; diff --git a/webapp/packages/core-ui/src/Tabs/TabsContext.ts b/webapp/packages/core-ui/src/Tabs/TabsContext.ts index fb0b6befce..fdab6acf15 100644 --- a/webapp/packages/core-ui/src/Tabs/TabsContext.ts +++ b/webapp/packages/core-ui/src/Tabs/TabsContext.ts @@ -8,9 +8,9 @@ import { createContext } from 'react'; import type { TabStateReturn } from 'reakit/Tab'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import type { IExecutor } from '@cloudbeaver/core-executor'; import type { MetadataMap, MetadataValueGetter } from '@cloudbeaver/core-utils'; -import type { IDataContext } from '@cloudbeaver/core-view'; import type { ITabData, ITabInfo, ITabsContainer } from './TabsContainer/ITabsContainer'; diff --git a/webapp/packages/core-ui/src/Tabs/TabsState.tsx b/webapp/packages/core-ui/src/Tabs/TabsState.tsx index e21fe555e1..1c263e4232 100644 --- a/webapp/packages/core-ui/src/Tabs/TabsState.tsx +++ b/webapp/packages/core-ui/src/Tabs/TabsState.tsx @@ -11,13 +11,12 @@ import { useEffect, useMemo, useState } from 'react'; import { useTabState } from 'reakit/Tab'; import { useAutoLoad, useExecutor, useObjectRef, useObservableRef } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { Executor, ExecutorInterrupter } from '@cloudbeaver/core-executor'; import { isDefined, isNull, isUndefined, MetadataMap, MetadataValueGetter } from '@cloudbeaver/core-utils'; -import { useDataContext } from '@cloudbeaver/core-view'; import type { ITabData, ITabInfo, ITabsContainer } from './TabsContainer/ITabsContainer'; -import { ITabsContext, TabsContext } from './TabsContext'; -import type { TabDirection } from './TabsContext'; +import { ITabsContext, type TabDirection, TabsContext } from './TabsContext'; type ExtractContainerProps = T extends void ? Record : T; diff --git a/webapp/packages/core-ui/tsconfig.json b/webapp/packages/core-ui/tsconfig.json index bd4ed8f7d0..5bc2522095 100644 --- a/webapp/packages/core-ui/tsconfig.json +++ b/webapp/packages/core-ui/tsconfig.json @@ -1,10 +1,58 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-utils/package.json b/webapp/packages/core-utils/package.json index 615343dd26..d670dcb44e 100644 --- a/webapp/packages/core-utils/package.json +++ b/webapp/packages/core-utils/package.json @@ -1,20 +1,22 @@ { "name": "@cloudbeaver/core-utils", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/core-utils.js", - "module": "lib/core-utils.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", - "postbuild": "tsc", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@timohausmann/quadtree-ts": "~2.0.0-beta.1", diff --git a/webapp/packages/core-utils/src/TempMap.ts b/webapp/packages/core-utils/src/TempMap.ts index 032f6c71b8..45b710095b 100644 --- a/webapp/packages/core-utils/src/TempMap.ts +++ b/webapp/packages/core-utils/src/TempMap.ts @@ -8,12 +8,7 @@ import { action, makeObservable, observable } from 'mobx'; import { cacheValue, ICachedValueObject } from './cacheValue'; - -const combine = (a: IterableIterator, b: IterableIterator): IterableIterator => - (function* () { - yield* a; - yield* b; - })(); +import { combineITerableIterators } from './combineITerableIterators'; export class TempMap implements Map { get size(): number { @@ -124,7 +119,9 @@ export class TempMap implements Map { } keys(): IterableIterator { - return this.keysTemp.value(() => Array.from(new Set(combine(this.target.keys(), this.temp.keys()))).filter(key => !this.isDeleted(key))).values(); + return this.keysTemp + .value(() => Array.from(new Set(combineITerableIterators(this.target.keys(), this.temp.keys()))).filter(key => !this.isDeleted(key))) + .values(); } values(): IterableIterator { diff --git a/webapp/packages/core-utils/src/combineITerableIterators.ts b/webapp/packages/core-utils/src/combineITerableIterators.ts new file mode 100644 index 0000000000..6adf974b0b --- /dev/null +++ b/webapp/packages/core-utils/src/combineITerableIterators.ts @@ -0,0 +1,13 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +export function* combineITerableIterators(...iterators: IterableIterator[]): IterableIterator { + for (const iterator of iterators) { + yield* iterator; + } +} diff --git a/webapp/packages/core-utils/src/generateFileName.test.ts b/webapp/packages/core-utils/src/generateFileName.test.ts index 67e6675b4b..608976211c 100644 --- a/webapp/packages/core-utils/src/generateFileName.test.ts +++ b/webapp/packages/core-utils/src/generateFileName.test.ts @@ -10,7 +10,7 @@ import { generateFileName } from './generateFileName'; describe('generateFileName', () => { it('should generate a file name in the expected format', () => { const mockDate = new Date('2020-09-09T14:13:20'); - const spy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate as unknown as string); + const spy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate); const fileName = 'my-file'; const fileFormat = '.txt'; diff --git a/webapp/packages/core-utils/src/index.ts b/webapp/packages/core-utils/src/index.ts index 0232e77d33..d5646f9b6f 100644 --- a/webapp/packages/core-utils/src/index.ts +++ b/webapp/packages/core-utils/src/index.ts @@ -12,6 +12,7 @@ export * from './blobToData'; export * from './bytesToSize'; export * from './cacheValue'; export * from './clsx'; +export * from './combineITerableIterators'; export * from './copyToClipboard'; export * from './declensionOfNumber'; export * from './isNotNullDefined'; diff --git a/webapp/packages/core-utils/src/md5.ts b/webapp/packages/core-utils/src/md5.ts index bb718786ba..68b29dcb00 100644 --- a/webapp/packages/core-utils/src/md5.ts +++ b/webapp/packages/core-utils/src/md5.ts @@ -5,6 +5,4 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import md5 from 'md5'; - -export { md5 }; +export { default as md5 } from 'md5'; diff --git a/webapp/packages/core-utils/tsconfig.json b/webapp/packages/core-utils/tsconfig.json index 7a2ca6af8a..870c9252f8 100644 --- a/webapp/packages/core-utils/tsconfig.json +++ b/webapp/packages/core-utils/tsconfig.json @@ -1,12 +1,21 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib", - "declarationMap": true, - "declaration": true + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/", "src/**/*.test.ts", "src/**/*.test.tsx"], - "references": [] + "references": [], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/core-version-update/package.json b/webapp/packages/core-version-update/package.json index d53756b8d2..b9330cf722 100644 --- a/webapp/packages/core-version-update/package.json +++ b/webapp/packages/core-version-update/package.json @@ -1,25 +1,26 @@ { "name": "@cloudbeaver/core-version-update", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "semver": "~7.5.4", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-version": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", - "semver": "~7.5.4" + "@cloudbeaver/core-version": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x" diff --git a/webapp/packages/core-version-update/tsconfig.json b/webapp/packages/core-version-update/tsconfig.json index 1ec09b92d9..2dba0949e3 100644 --- a/webapp/packages/core-version-update/tsconfig.json +++ b/webapp/packages/core-version-update/tsconfig.json @@ -1,15 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-version" + } + ], "include": [ - "src" + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" ], "exclude": [ - "**/node_modules", - "**/.*/" - ], - "references": [{ "path": "../*" }] -} \ No newline at end of file + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/core-version/package.json b/webapp/packages/core-version/package.json index 118dd9a56b..7f6c1f49e8 100644 --- a/webapp/packages/core-version/package.json +++ b/webapp/packages/core-version/package.json @@ -1,28 +1,30 @@ { "name": "@cloudbeaver/core-version", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/core-version/src/VersionResource.ts b/webapp/packages/core-version/src/VersionResource.ts index 7f2d3099ab..7c7b7fa547 100644 --- a/webapp/packages/core-version/src/VersionResource.ts +++ b/webapp/packages/core-version/src/VersionResource.ts @@ -8,8 +8,8 @@ import { computed, makeObservable, observable } from 'mobx'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapResource, resourceKeyList } from '@cloudbeaver/core-sdk'; export interface IVersion { number: string; diff --git a/webapp/packages/core-version/tsconfig.json b/webapp/packages/core-version/tsconfig.json index 1ec09b92d9..2024326681 100644 --- a/webapp/packages/core-version/tsconfig.json +++ b/webapp/packages/core-version/tsconfig.json @@ -1,15 +1,37 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-utils" + } + ], "include": [ - "src" + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" ], "exclude": [ - "**/node_modules", - "**/.*/" - ], - "references": [{ "path": "../*" }] -} \ No newline at end of file + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/core-view/package.json b/webapp/packages/core-view/package.json index 475f86ccf0..85469eb8b4 100644 --- a/webapp/packages/core-view/package.json +++ b/webapp/packages/core-view/package.json @@ -1,33 +1,36 @@ { "name": "@cloudbeaver/core-view", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-localization": "~0.1.0", + "react-hotkeys-hook": "~4.4.1", "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-extensions": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", - "react-hotkeys-hook": "~4.4.1" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/core-view/src/Action/ActionItem.ts b/webapp/packages/core-view/src/Action/ActionItem.ts index 6daee77c9d..6786787e15 100644 --- a/webapp/packages/core-view/src/Action/ActionItem.ts +++ b/webapp/packages/core-view/src/Action/ActionItem.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { flat } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import type { IAction } from './IAction'; import type { IActionHandler } from './IActionHandler'; import type { IActionInfo } from './IActionInfo'; diff --git a/webapp/packages/core-view/src/Action/ActionService.ts b/webapp/packages/core-view/src/Action/ActionService.ts index 001213bfb8..58db481b53 100644 --- a/webapp/packages/core-view/src/Action/ActionService.ts +++ b/webapp/packages/core-view/src/Action/ActionService.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { injectable } from '@cloudbeaver/core-di'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import { ActionItem } from './ActionItem'; import type { IAction } from './IAction'; import type { IActionHandler } from './IActionHandler'; diff --git a/webapp/packages/core-view/src/Action/IActionHandler.ts b/webapp/packages/core-view/src/Action/IActionHandler.ts index f9b4523141..035f12c7a2 100644 --- a/webapp/packages/core-view/src/Action/IActionHandler.ts +++ b/webapp/packages/core-view/src/Action/IActionHandler.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import type { ILoadableState } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import type { IAction } from './IAction'; import type { IActionInfo } from './IActionInfo'; diff --git a/webapp/packages/core-view/src/Action/KeyBinding/IKeyBindingHandler.ts b/webapp/packages/core-view/src/Action/KeyBinding/IKeyBindingHandler.ts index c66d440b2a..70fb088210 100644 --- a/webapp/packages/core-view/src/Action/KeyBinding/IKeyBindingHandler.ts +++ b/webapp/packages/core-view/src/Action/KeyBinding/IKeyBindingHandler.ts @@ -5,8 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; + import type { IAction } from '../../Action/IAction'; -import type { IDataContextProvider } from '../../DataContext/IDataContextProvider'; import type { IKeyBinding } from './IKeyBinding'; export interface IKeyBindingHandler { diff --git a/webapp/packages/core-view/src/Action/KeyBinding/KeyBindingService.ts b/webapp/packages/core-view/src/Action/KeyBinding/KeyBindingService.ts index 55e63fda8b..b7709ad3e5 100644 --- a/webapp/packages/core-view/src/Action/KeyBinding/KeyBindingService.ts +++ b/webapp/packages/core-view/src/Action/KeyBinding/KeyBindingService.ts @@ -5,10 +5,10 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { injectable } from '@cloudbeaver/core-di'; import type { IAction } from '../../Action/IAction'; -import type { IDataContextProvider } from '../../DataContext/IDataContextProvider'; import type { IKeyBindingHandler } from './IKeyBindingHandler'; @injectable() diff --git a/webapp/packages/core-view/src/LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE.ts b/webapp/packages/core-view/src/LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE.ts index d0678c7a3d..7738b7b2c5 100644 --- a/webapp/packages/core-view/src/LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE.ts +++ b/webapp/packages/core-view/src/LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE.ts @@ -7,10 +7,9 @@ */ import { observable } from 'mobx'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import { flat, ILoadableState } from '@cloudbeaver/core-utils'; -import { createDataContext } from '../DataContext/createDataContext'; - interface ILoadableStateContext { readonly loaders: ILoadableState[]; getState(id: string, defaultState: () => ILoadableState | ILoadableState[]): ILoadableState[]; diff --git a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU.ts b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU.ts index 3fbe232816..a31ebc18fb 100644 --- a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU.ts +++ b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU.ts @@ -5,7 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '../DataContext/createDataContext'; +import { createDataContext } from '@cloudbeaver/core-data-context'; + import type { IMenu } from './IMenu'; export const DATA_CONTEXT_MENU = createDataContext('menu'); diff --git a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_LOCAL.ts b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_LOCAL.ts index 2d19833be6..f453e47446 100644 --- a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_LOCAL.ts +++ b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_LOCAL.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '../DataContext/createDataContext'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_MENU_LOCAL = createDataContext('menu-local', () => false); diff --git a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_NESTED.ts b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_NESTED.ts index 15c1edcb78..a00d583c11 100644 --- a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_NESTED.ts +++ b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_MENU_NESTED.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '../DataContext/createDataContext'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_MENU_NESTED = createDataContext('menu-nested', () => false); diff --git a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_SUBMENU_ITEM.ts b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_SUBMENU_ITEM.ts index 5fd7bc5556..5e6c4a4fc5 100644 --- a/webapp/packages/core-view/src/Menu/DATA_CONTEXT_SUBMENU_ITEM.ts +++ b/webapp/packages/core-view/src/Menu/DATA_CONTEXT_SUBMENU_ITEM.ts @@ -5,7 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '../DataContext/createDataContext'; +import { createDataContext } from '@cloudbeaver/core-data-context'; + import type { IMenuSubMenuItem } from './MenuItem/IMenuSubMenuItem'; export const DATA_CONTEXT_SUBMENU_ITEM = createDataContext('submenu-item'); diff --git a/webapp/packages/core-view/src/Menu/IMenuHandler.ts b/webapp/packages/core-view/src/Menu/IMenuHandler.ts index 3d79e79d63..fcd1e38c04 100644 --- a/webapp/packages/core-view/src/Menu/IMenuHandler.ts +++ b/webapp/packages/core-view/src/Menu/IMenuHandler.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import type { ILoadableState } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import type { IMenu } from './IMenu'; import type { MenuSubMenuItemIconComponent } from './MenuItem/IMenuSubMenuItem'; diff --git a/webapp/packages/core-view/src/Menu/IMenuItemsCreator.ts b/webapp/packages/core-view/src/Menu/IMenuItemsCreator.ts index 4a5b2e6bd9..dc0feb0cc7 100644 --- a/webapp/packages/core-view/src/Menu/IMenuItemsCreator.ts +++ b/webapp/packages/core-view/src/Menu/IMenuItemsCreator.ts @@ -5,9 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { DataContextGetter, IDataContextProvider } from '@cloudbeaver/core-data-context'; + import type { IAction } from '../Action/IAction'; -import type { DataContextGetter } from '../DataContext/DataContextGetter'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import type { IMenu } from './IMenu'; import type { IMenuItem } from './MenuItem/IMenuItem'; diff --git a/webapp/packages/core-view/src/Menu/MenuService.ts b/webapp/packages/core-view/src/Menu/MenuService.ts index f81dbcc91f..3c877ac2e4 100644 --- a/webapp/packages/core-view/src/Menu/MenuService.ts +++ b/webapp/packages/core-view/src/Menu/MenuService.ts @@ -5,13 +5,13 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { injectable } from '@cloudbeaver/core-di'; import { flat, ILoadableState } from '@cloudbeaver/core-utils'; import { ActionService } from '../Action/ActionService'; import { isAction } from '../Action/createAction'; import type { IAction } from '../Action/IAction'; -import type { IDataContextProvider } from '../DataContext/IDataContextProvider'; import { isMenu } from './createMenu'; import { DATA_CONTEXT_MENU } from './DATA_CONTEXT_MENU'; import { DATA_CONTEXT_MENU_LOCAL } from './DATA_CONTEXT_MENU_LOCAL'; diff --git a/webapp/packages/core-view/src/Menu/useMenu.ts b/webapp/packages/core-view/src/Menu/useMenu.ts index 6abbad0ede..19632ee57f 100644 --- a/webapp/packages/core-view/src/Menu/useMenu.ts +++ b/webapp/packages/core-view/src/Menu/useMenu.ts @@ -8,10 +8,10 @@ import { computed, observable } from 'mobx'; import { useObservableRef } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { flat, ILoadableState } from '@cloudbeaver/core-utils'; -import type { IDataContext } from '../DataContext/IDataContext'; import { DATA_CONTEXT_MENU_LOCAL } from './DATA_CONTEXT_MENU_LOCAL'; import type { IMenu } from './IMenu'; import type { IMenuHandler } from './IMenuHandler'; diff --git a/webapp/packages/core-view/src/Menu/useMenuContext.ts b/webapp/packages/core-view/src/Menu/useMenuContext.ts index 1d656f6593..56494cdff0 100644 --- a/webapp/packages/core-view/src/Menu/useMenuContext.ts +++ b/webapp/packages/core-view/src/Menu/useMenuContext.ts @@ -7,8 +7,8 @@ */ import { useContext } from 'react'; -import type { IDataContext } from '../DataContext/IDataContext'; -import { useDataContext } from '../DataContext/useDataContext'; +import { type IDataContext, useDataContext } from '@cloudbeaver/core-data-context'; + import { DATA_CONTEXT_LOADABLE_STATE, loadableStateContext } from '../LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE'; import { CaptureViewContext } from '../View/CaptureViewContext'; import { DATA_CONTEXT_MENU } from './DATA_CONTEXT_MENU'; diff --git a/webapp/packages/core-view/src/View/CaptureViewContext.ts b/webapp/packages/core-view/src/View/CaptureViewContext.ts index 5a89095133..76ad304c54 100644 --- a/webapp/packages/core-view/src/View/CaptureViewContext.ts +++ b/webapp/packages/core-view/src/View/CaptureViewContext.ts @@ -7,6 +7,6 @@ */ import { createContext } from 'react'; -import type { IDataContext } from '../DataContext/IDataContext'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; export const CaptureViewContext = createContext(undefined); diff --git a/webapp/packages/core-view/src/View/DATA_CONTEXT_VIEW.ts b/webapp/packages/core-view/src/View/DATA_CONTEXT_VIEW.ts index 81ddd4dba4..8a1ec55aa3 100644 --- a/webapp/packages/core-view/src/View/DATA_CONTEXT_VIEW.ts +++ b/webapp/packages/core-view/src/View/DATA_CONTEXT_VIEW.ts @@ -5,7 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '../DataContext/createDataContext'; +import { createDataContext } from '@cloudbeaver/core-data-context'; + import type { IView } from './IView'; export const DATA_CONTEXT_VIEW = createDataContext>('app-view'); diff --git a/webapp/packages/core-view/src/View/useCaptureViewContext.ts b/webapp/packages/core-view/src/View/useCaptureViewContext.ts index d1bbf8e58d..5c10738873 100644 --- a/webapp/packages/core-view/src/View/useCaptureViewContext.ts +++ b/webapp/packages/core-view/src/View/useCaptureViewContext.ts @@ -7,8 +7,8 @@ */ import { useContext } from 'react'; -import type { IDataContext } from '../DataContext/IDataContext'; -import { useDynamicDataContext } from '../DataContext/useDynamicDataContext'; +import { IDataContext, useDynamicDataContext } from '@cloudbeaver/core-data-context'; + import { CaptureViewContext } from './CaptureViewContext'; export function useCaptureViewContext(capture: (context: IDataContext | undefined) => void): void { diff --git a/webapp/packages/core-view/src/View/useViewContext.ts b/webapp/packages/core-view/src/View/useViewContext.ts index 794d987944..ebd5c437b1 100644 --- a/webapp/packages/core-view/src/View/useViewContext.ts +++ b/webapp/packages/core-view/src/View/useViewContext.ts @@ -7,8 +7,8 @@ */ import { useContext } from 'react'; -import type { IDataContext } from '../DataContext/IDataContext'; -import { useDataContext } from '../DataContext/useDataContext'; +import { IDataContext, useDataContext } from '@cloudbeaver/core-data-context'; + import { CaptureViewContext } from './CaptureViewContext'; import { DATA_CONTEXT_VIEW } from './DATA_CONTEXT_VIEW'; import type { IView } from './IView'; diff --git a/webapp/packages/core-view/src/index.ts b/webapp/packages/core-view/src/index.ts index 88acec5833..197185f995 100644 --- a/webapp/packages/core-view/src/index.ts +++ b/webapp/packages/core-view/src/index.ts @@ -31,16 +31,6 @@ export * from './Action/IActionItem'; export * from './Action/KeyBinding/IKeyBinding'; export * from './Action/KeyBinding/getCommonAndOSSpecificKeys'; export * from './Action/KeyBinding/getBindingLabel'; -export * from './DataContext/createDataContext'; -export * from './DataContext/DATA_CONTEXT_DI_PROVIDER'; -export * from './DataContext/DataContext'; -export * from './DataContext/dataContextAddDIProvider'; -export * from './DataContext/DynamicDataContext'; -export * from './DataContext/IDataContext'; -export * from './DataContext/IDataContextProvider'; -export * from './DataContext/TempDataContext'; -export * from './DataContext/useDataContext'; -export * from './DataContext/useDynamicDataContext'; export * from './LoadableStateContext/DATA_CONTEXT_LOADABLE_STATE'; export * from './Menu/MenuItem/IMenuCheckboxItem'; export * from './Menu/MenuItem/IMenuActionItem'; diff --git a/webapp/packages/core-view/tsconfig.json b/webapp/packages/core-view/tsconfig.json index bd4ed8f7d0..0560925fb0 100644 --- a/webapp/packages/core-view/tsconfig.json +++ b/webapp/packages/core-view/tsconfig.json @@ -1,10 +1,43 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/eslint-config/package.json b/webapp/packages/eslint-config/package.json index f3ab8cb897..23bc860d34 100644 --- a/webapp/packages/eslint-config/package.json +++ b/webapp/packages/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@cloudbeaver/eslint-config", - "sideEffects": false, + "sideEffects": [], "version": "0.1.0", "main": "index.js", "description": "ESLint for CloudBeaver", diff --git a/webapp/packages/plugin-administration/package.json b/webapp/packages/plugin-administration/package.json index 7833c872ca..32035218e1 100644 --- a/webapp/packages/plugin-administration/package.json +++ b/webapp/packages/plugin-administration/package.json @@ -1,22 +1,22 @@ { "name": "@cloudbeaver/plugin-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-administration": "~0.1.0", "@cloudbeaver/plugin-settings-menu": "~0.1.0", "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-administration": "~0.1.0", @@ -28,6 +28,7 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", @@ -39,5 +40,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBar.tsx b/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBar.tsx index 2080241c7f..3ed0b906a1 100644 --- a/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBar.tsx +++ b/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBar.tsx @@ -5,13 +5,13 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { Placeholder } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { TopNavBar } from '@cloudbeaver/plugin-top-app-bar'; import { AdministrationTopAppBarService } from './AdministrationTopAppBarService'; export function AdministrationTopAppBar() { const administrationTopAppBarService = useService(AdministrationTopAppBarService); - return ; + return ; } diff --git a/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService.ts b/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService.ts index 8de2a6d044..846e6fa1d1 100644 --- a/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService.ts +++ b/webapp/packages/plugin-administration/src/AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService.ts @@ -12,6 +12,7 @@ import { Fill } from './Fill'; @injectable() export class AdministrationTopAppBarService { + readonly navBarPlaceholder = new PlaceholderContainer(); readonly placeholder = new PlaceholderContainer(); constructor() { diff --git a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx index 9813070510..d3c06d594f 100644 --- a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx +++ b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/Form/ServerConfigurationFeaturesForm.tsx @@ -12,7 +12,8 @@ import { AdministrationSettingsService } from '@cloudbeaver/core-administration' import { FormContext, GroupTitle, PlaceholderComponent, Switch, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { FeaturesResource } from '@cloudbeaver/core-root'; -import type { IConfigurationPlaceholderProps } from '@cloudbeaver/plugin-administration'; + +import type { IConfigurationPlaceholderProps } from '../ServerConfigurationService'; export const ServerConfigurationFeaturesForm: PlaceholderComponent = observer( function ServerConfigurationFeaturesForm({ state: { serverConfig }, configurationWizard }) { diff --git a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationDriversForm.tsx b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationDriversForm.tsx index cb3dd4ce82..d4e3f7ba97 100644 --- a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationDriversForm.tsx +++ b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationDriversForm.tsx @@ -9,21 +9,10 @@ import { observer } from 'mobx-react-lite'; import { useCallback } from 'react'; import styled from 'reshadow'; -import { - Combobox, - Group, - GroupTitle, - ITag, - s, - Tag, - Tags, - useResource, - useS, - useStyles, - useTranslate, -} from '@cloudbeaver/core-blocks'; +import { Combobox, Group, GroupTitle, ITag, s, Tag, Tags, useResource, useS, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; import { DBDriverResource } from '@cloudbeaver/core-connections'; -import { CachedMapAllKey, resourceKeyList, ServerConfigInput } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-resource'; +import type { ServerConfigInput } from '@cloudbeaver/core-sdk'; import style from './ServerConfigurationDriversForm.m.css'; diff --git a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationPage.tsx b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationPage.tsx index e0f871b2f4..94cd32626a 100644 --- a/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationPage.tsx +++ b/webapp/packages/plugin-administration/src/ConfigurationWizard/ServerConfiguration/ServerConfigurationPage.tsx @@ -11,6 +11,7 @@ import styled, { css } from 'reshadow'; import { ADMINISTRATION_TOOLS_PANEL_STYLES, AdministrationItemContentComponent, ConfigurationWizardService } from '@cloudbeaver/core-administration'; import { ColoredContainer, + ConfirmationDialog, Container, Form, Group, @@ -26,7 +27,7 @@ import { useTranslate, } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { ServerConfigResource } from '@cloudbeaver/core-root'; import { ServerConfigurationConfigurationForm } from './Form/ServerConfigurationConfigurationForm'; diff --git a/webapp/packages/plugin-administration/tsconfig.json b/webapp/packages/plugin-administration/tsconfig.json index bd4ed8f7d0..bfcc53c251 100644 --- a/webapp/packages/plugin-administration/tsconfig.json +++ b/webapp/packages/plugin-administration/tsconfig.json @@ -1,10 +1,73 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-authentication-administration/package.json b/webapp/packages/plugin-authentication-administration/package.json index 9fa38dec8d..813ac13f25 100644 --- a/webapp/packages/plugin-authentication-administration/package.json +++ b/webapp/packages/plugin-authentication-administration/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-authentication-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-administration": "~0.1.0", @@ -22,23 +23,25 @@ "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-notifications": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0" + "@cloudbeaver/core-utils": "~0.1.0", + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationFormState.ts b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationFormState.ts index 80735b6349..f3a96b4840 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationFormState.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationFormState.ts @@ -8,7 +8,8 @@ import { computed, makeObservable, observable } from 'mobx'; import { Executor, IExecutionContextProvider, IExecutor } from '@cloudbeaver/core-executor'; -import type { AdminAuthProviderConfiguration, CachedMapResource, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; +import type { CachedMapResource } from '@cloudbeaver/core-resource'; +import type { AdminAuthProviderConfiguration, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; import type { AuthConfigurationFormService } from './AuthConfigurationFormService'; import { authConfigurationFormConfigureContext } from './Contexts/authConfigurationFormConfigureContext'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsAdministrationService.ts b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsAdministrationService.ts index 2c55d286e7..674d601e59 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsAdministrationService.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsAdministrationService.ts @@ -12,7 +12,8 @@ import { AuthConfigurationsResource, AuthProviderService, AuthProvidersResource import { PlaceholderContainer } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; -import { AdminAuthProviderConfiguration, CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { AdminAuthProviderConfiguration } from '@cloudbeaver/core-sdk'; import { CreateAuthConfigurationService } from './CreateAuthConfigurationService'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsTable/useConfigurationsTable.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsTable/useConfigurationsTable.tsx index 2c2515cac5..ebd47d5564 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsTable/useConfigurationsTable.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/AuthConfigurationsTable/useConfigurationsTable.tsx @@ -8,11 +8,12 @@ import { computed, observable } from 'mobx'; import { AuthConfigurationsResource, compareAuthConfigurations } from '@cloudbeaver/core-authentication'; -import { TableState, useObservableRef, useTranslate } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialogDelete, TableState, useObservableRef, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { AdminAuthProviderConfiguration, CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-resource'; +import type { AdminAuthProviderConfiguration } from '@cloudbeaver/core-sdk'; interface State { tableState: TableState; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/IAuthConfigurationFormProps.ts b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/IAuthConfigurationFormProps.ts index 34a2b3f075..5eb125396e 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/IAuthConfigurationFormProps.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/IAuthConfigurationFormProps.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ import type { IExecutorHandlersCollection } from '@cloudbeaver/core-executor'; -import type { AdminAuthProviderConfiguration, CachedMapResource, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; +import type { CachedMapResource } from '@cloudbeaver/core-resource'; +import type { AdminAuthProviderConfiguration, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; export type AuthConfigurationFormMode = 'edit' | 'create'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptions.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptions.tsx index bd704fd784..9141d2c1a2 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptions.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptions.tsx @@ -27,7 +27,8 @@ import { useStyles, useTranslate, } from '@cloudbeaver/core-blocks'; -import { AuthProviderConfigurationParametersFragment, CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { AuthProviderConfigurationParametersFragment } from '@cloudbeaver/core-sdk'; import type { TabContainerPanelComponent } from '@cloudbeaver/core-ui'; import type { IAuthConfigurationFormProps } from '../IAuthConfigurationFormProps'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptionsTabService.ts b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptionsTabService.ts index 048392f4f5..fe311ba7de 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptionsTabService.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/Options/AuthConfigurationOptionsTabService.ts @@ -10,7 +10,7 @@ import React from 'react'; import { AuthConfigurationsResource, AuthProvidersResource } from '@cloudbeaver/core-authentication'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { getUniqueName } from '@cloudbeaver/core-utils'; import { AuthConfigurationFormService } from '../AuthConfigurationFormService'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/useAuthConfigurationFormState.ts b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/useAuthConfigurationFormState.ts index 40568bcfe5..0aa0fb427b 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/useAuthConfigurationFormState.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/IdentityProviders/useAuthConfigurationFormState.ts @@ -8,7 +8,8 @@ import { useState } from 'react'; import { useService } from '@cloudbeaver/core-di'; -import type { AdminAuthProviderConfiguration, CachedMapResource, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; +import type { CachedMapResource } from '@cloudbeaver/core-resource'; +import type { AdminAuthProviderConfiguration, GetAuthProviderConfigurationsQueryVariables } from '@cloudbeaver/core-sdk'; import { AuthConfigurationFormService } from './AuthConfigurationFormService'; import { AuthConfigurationFormState } from './AuthConfigurationFormState'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/AuthenticationProviders.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/AuthenticationProviders.tsx index 9769860358..8810379ffc 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/AuthenticationProviders.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/AuthenticationProviders.tsx @@ -17,7 +17,7 @@ import { } from '@cloudbeaver/core-authentication'; import { FormContext, Group, GroupTitle, PlaceholderComponent, Switch, useExecutor, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import type { IConfigurationPlaceholderProps } from '@cloudbeaver/plugin-administration'; import { ServerConfigurationAdminForm } from './ServerConfigurationAdminForm'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/ServerConfigurationAuthenticationBootstrap.ts b/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/ServerConfigurationAuthenticationBootstrap.ts index 0db9de4e32..056aff4f77 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/ServerConfigurationAuthenticationBootstrap.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/ServerConfiguration/ServerConfigurationAuthenticationBootstrap.ts @@ -10,8 +10,8 @@ import { AUTH_PROVIDER_LOCAL_ID, AuthProvidersResource } from '@cloudbeaver/core import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter, IExecutorHandler } from '@cloudbeaver/core-executor'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { ILoadConfigData, IServerConfigSaveData, diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnections.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnections.tsx index f7926a1a78..f9d53126ba 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnections.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnections.tsx @@ -24,7 +24,7 @@ import { import { Connection, ConnectionInfoProjectKey, ConnectionInfoResource, DBDriverResource, isCloudConnection } from '@cloudbeaver/core-connections'; import type { TLocalizationToken } from '@cloudbeaver/core-localization'; import { isGlobalProject, ProjectInfo, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui'; import type { ITeamFormProps } from '../ITeamFormProps'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnectionsTabService.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnectionsTabService.ts index 2f8894c3d8..209a3ae815 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnectionsTabService.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedConnections/GrantedConnectionsTabService.ts @@ -12,7 +12,8 @@ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { executorHandlerFilter, IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { isGlobalProject, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, GraphQLService } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; import { isArraysEqual, MetadataValueGetter } from '@cloudbeaver/core-utils'; import { teamContext } from '../Contexts/teamContext'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedUsers/GrantedUsers.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedUsers/GrantedUsers.tsx index 4d47d1f3a6..b86a554097 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedUsers/GrantedUsers.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/GrantedUsers/GrantedUsers.tsx @@ -22,7 +22,7 @@ import { useStyles, useTranslate, } from '@cloudbeaver/core-blocks'; -import { CachedResourcePageListKey } from '@cloudbeaver/core-sdk'; +import { CachedResourceOffsetPageListKey } from '@cloudbeaver/core-resource'; import { TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui'; import type { ITeamFormProps } from '../ITeamFormProps'; @@ -53,7 +53,7 @@ export const GrantedUsers: TabContainerPanelComponent = observer const state = useGrantedUsers(formState.config, formState.mode); const { selected } = useTab(tabId); - const users = useResource(GrantedUsers, UsersResource, CachedResourcePageListKey(0, 1000).setTarget(UsersResourceFilterKey()), { + const users = useResource(GrantedUsers, UsersResource, CachedResourceOffsetPageListKey(0, 1000).setTarget(UsersResourceFilterKey()), { active: selected, }); diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/Permissions.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/Permissions.tsx index 8aec49e4a3..5d80fc0391 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/Permissions.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/Permissions.tsx @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite'; import { PermissionsResource } from '@cloudbeaver/core-administration'; import { FieldCheckbox, Group, GroupTitle, useResource, useTranslate } from '@cloudbeaver/core-blocks'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import type { ITeamFormProps } from '../ITeamFormProps'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamsTable/useTeamsTable.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamsTable/useTeamsTable.tsx index 793080abb9..1617e8cde3 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamsTable/useTeamsTable.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamsTable/useTeamsTable.tsx @@ -8,11 +8,11 @@ import { computed, observable } from 'mobx'; import { compareTeams, TeamInfo, TeamsResource } from '@cloudbeaver/core-authentication'; -import { TableState, useObservableRef, useResource, useTranslate } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialogDelete, TableState, useObservableRef, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-resource'; import type { ILoadableState } from '@cloudbeaver/core-utils'; interface State { diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART.ts index 540d2084bb..450dc041dc 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART.ts @@ -6,8 +6,8 @@ * you may not use this file except in compliance with the License. */ import { UsersResource } from '@cloudbeaver/core-authentication'; +import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-data-context'; import { DATA_CONTEXT_FORM_STATE } from '@cloudbeaver/core-ui'; -import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-view'; import type { AdministrationUserFormState } from '../AdministrationUserFormState'; import { DATA_CONTEXT_USER_FORM_INFO_PART } from '../Info/DATA_CONTEXT_USER_FORM_INFO_PART'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccess.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccess.tsx index 4b32a74add..f16458cf38 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccess.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccess.tsx @@ -30,7 +30,7 @@ import { } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { isGlobalProject, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, resourceKeyList } from '@cloudbeaver/core-resource'; import { type TabContainerPanelComponent, useTab, useTabState } from '@cloudbeaver/core-ui'; import { isDefined } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccessPartBootstrap.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccessPartBootstrap.ts index 5bd5b3cec1..d59b617916 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccessPartBootstrap.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/ConnectionAccess/UserFormConnectionAccessPartBootstrap.ts @@ -9,7 +9,7 @@ import React from 'react'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { isGlobalProject, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { AdministrationUserFormService } from '../AdministrationUserFormService'; import { DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART } from './DATA_CONTEXT_USER_FORM_CONNECTION_ACCESS_PART'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/DATA_CONTEXT_USER_FORM_INFO_PART.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/DATA_CONTEXT_USER_FORM_INFO_PART.ts index 8d05cd95db..930a29ba2c 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/DATA_CONTEXT_USER_FORM_INFO_PART.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/DATA_CONTEXT_USER_FORM_INFO_PART.ts @@ -6,9 +6,9 @@ * you may not use this file except in compliance with the License. */ import { UsersResource } from '@cloudbeaver/core-authentication'; +import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-data-context'; import { ServerConfigResource } from '@cloudbeaver/core-root'; import { DATA_CONTEXT_FORM_STATE } from '@cloudbeaver/core-ui'; -import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-view'; import type { AdministrationUserFormState } from '../AdministrationUserFormState'; import { UserFormInfoPart } from './UserFormInfoPart'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts index 6cce6658c8..0bc19ff03e 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts @@ -9,8 +9,8 @@ import { observable } from 'mobx'; import type { AdminUser, UsersResource } from '@cloudbeaver/core-authentication'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; +import { getCachedDataResourceLoaderState } from '@cloudbeaver/core-resource'; import type { ServerConfigResource } from '@cloudbeaver/core-root'; -import { getCachedDataResourceLoaderState } from '@cloudbeaver/core-sdk'; import { FormMode, FormPart, formValidationContext, IFormState } from '@cloudbeaver/core-ui'; import { isArraysEqual, isDefined, isObjectsEqual, isValuesEqual } from '@cloudbeaver/core-utils'; import { DATA_CONTEXT_LOADABLE_STATE } from '@cloudbeaver/core-view'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoTeams.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoTeams.tsx index 808daa2dc2..7a4a589e3f 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoTeams.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoTeams.tsx @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite'; import { compareTeams, TeamsResource } from '@cloudbeaver/core-authentication'; import { FieldCheckbox, Group, GroupTitle, useResource, useTranslate } from '@cloudbeaver/core-blocks'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { isDefined } from '@cloudbeaver/core-utils'; import type { UserFormProps } from '../AdministrationUserFormService'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts index f52a44d50c..2a8edb1a49 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/CreateUserBootstrap.ts @@ -8,7 +8,7 @@ import { DATA_CONTEXT_ADMINISTRATION_ITEM_ROUTE } from '@cloudbeaver/core-administration'; import { AUTH_PROVIDER_LOCAL_ID, AuthProvidersResource } from '@cloudbeaver/core-authentication'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { ACTION_CREATE, ActionService, MenuService } from '@cloudbeaver/core-view'; import { MENU_USERS_ADMINISTRATION } from '../../../Menus/MENU_USERS_ADMINISTRATION'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/UserCredentialsList.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/UserCredentialsList.tsx index f8d6a21314..f6de878f22 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/UserCredentialsList.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/UserCredentialsList.tsx @@ -9,9 +9,9 @@ import { observer } from 'mobx-react-lite'; import { Fragment } from 'react'; import { AUTH_PROVIDER_LOCAL_ID, UsersResource } from '@cloudbeaver/core-authentication'; -import { Icon, PlaceholderComponent, s, StaticImage, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialog, Icon, PlaceholderComponent, s, StaticImage, useS, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import type { ObjectOrigin } from '@cloudbeaver/core-sdk'; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/useUsersTable.tsx b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/useUsersTable.tsx index 15c6ebfbf1..f5c26d0798 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/useUsersTable.tsx +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UsersTable/useUsersTable.tsx @@ -8,11 +8,11 @@ import { action, computed, observable } from 'mobx'; import { AdminUser, compareUsers, UsersResource, UsersResourceFilterKey, UsersResourceNewUsers } from '@cloudbeaver/core-authentication'; -import { TableState, useObservableRef, usePagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialogDelete, TableState, useObservableRef, useOffsetPagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { ILoadableState, isArraysEqual, isDefined } from '@cloudbeaver/core-utils'; import type { IUserFilters } from './Filters/useUsersTableFilters'; @@ -31,7 +31,7 @@ interface State { export function useUsersTable(filters: IUserFilters) { const translate = useTranslate(); const usersResource = useService(UsersResource); - const pagination = usePagination(UsersResource, { + const pagination = useOffsetPagination(UsersResource, { key: UsersResourceFilterKey(filters.search, filters.status === 'true' ? true : filters.status === 'false' ? false : undefined), }); const usersLoader = useResource(useUsersTable, usersResource, pagination.key); diff --git a/webapp/packages/plugin-authentication-administration/tsconfig.json b/webapp/packages/plugin-authentication-administration/tsconfig.json index bd4ed8f7d0..919b66f95e 100644 --- a/webapp/packages/plugin-authentication-administration/tsconfig.json +++ b/webapp/packages/plugin-authentication-administration/tsconfig.json @@ -1,10 +1,79 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-administration" + }, + { + "path": "..\\plugin-authentication" + }, + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-authentication/package.json b/webapp/packages/plugin-authentication/package.json index 4c690991cb..a68484d5ea 100644 --- a/webapp/packages/plugin-authentication/package.json +++ b/webapp/packages/plugin-authentication/package.json @@ -1,21 +1,23 @@ { "name": "@cloudbeaver/plugin-authentication", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/plugin-administration": "~0.1.0", "@cloudbeaver/plugin-settings-menu": "~0.1.0", "@cloudbeaver/core-administration": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", @@ -25,6 +27,7 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", @@ -37,5 +40,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-authentication/src/AuthenticationService.ts b/webapp/packages/plugin-authentication/src/AuthenticationService.ts index 296462d869..20ab3ebac6 100644 --- a/webapp/packages/plugin-authentication/src/AuthenticationService.ts +++ b/webapp/packages/plugin-authentication/src/AuthenticationService.ts @@ -23,9 +23,9 @@ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import type { DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { Executor, ExecutorInterrupter, IExecutionContextProvider, IExecutorHandler } from '@cloudbeaver/core-executor'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ISessionAction, ServerConfigResource, sessionActionContext, SessionActionService, SessionDataResource } from '@cloudbeaver/core-root'; import { ScreenService, WindowsService } from '@cloudbeaver/core-routing'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { NavigationService } from '@cloudbeaver/core-ui'; import { AuthDialogService } from './Dialog/AuthDialogService'; diff --git a/webapp/packages/plugin-authentication/src/Dialog/AuthDialog.tsx b/webapp/packages/plugin-authentication/src/Dialog/AuthDialog.tsx index 4ec05ae783..4da36264eb 100644 --- a/webapp/packages/plugin-authentication/src/Dialog/AuthDialog.tsx +++ b/webapp/packages/plugin-authentication/src/Dialog/AuthDialog.tsx @@ -9,16 +9,24 @@ import { observer } from 'mobx-react-lite'; import styled from 'reshadow'; import { AuthProvider, AuthProviderConfiguration, UserInfoResource } from '@cloudbeaver/core-authentication'; -import { ErrorMessage, Form, getComputed, Link, s, TextPlaceholder, useErrorDetails, useS, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; -import { useService } from '@cloudbeaver/core-di'; import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, - CommonDialogService, CommonDialogWrapper, - DialogComponent, -} from '@cloudbeaver/core-dialogs'; + ErrorMessage, + Form, + getComputed, + Link, + s, + TextPlaceholder, + useErrorDetails, + useS, + useStyles, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import { CommonDialogService, DialogComponent } from '@cloudbeaver/core-dialogs'; import { BASE_TAB_STYLES, Tab, TabList, TabsState, TabTitle, UNDERLINE_TAB_BIG_STYLES, UNDERLINE_TAB_STYLES } from '@cloudbeaver/core-ui'; import { AuthenticationService } from '../AuthenticationService'; diff --git a/webapp/packages/plugin-authentication/src/Dialog/useAuthDialogState.ts b/webapp/packages/plugin-authentication/src/Dialog/useAuthDialogState.ts index eb6dab08e2..43529d781a 100644 --- a/webapp/packages/plugin-authentication/src/Dialog/useAuthDialogState.ts +++ b/webapp/packages/plugin-authentication/src/Dialog/useAuthDialogState.ts @@ -14,7 +14,8 @@ import { useObservableRef, useResource } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import type { ITask } from '@cloudbeaver/core-executor'; -import { CachedMapAllKey, UserInfo } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { UserInfo } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; import { FEDERATED_AUTH } from './FEDERATED_AUTH'; diff --git a/webapp/packages/plugin-authentication/src/UserLoadingErrorDialogBootstrap.ts b/webapp/packages/plugin-authentication/src/UserLoadingErrorDialogBootstrap.ts index a5518c3a34..5820b7219e 100644 --- a/webapp/packages/plugin-authentication/src/UserLoadingErrorDialogBootstrap.ts +++ b/webapp/packages/plugin-authentication/src/UserLoadingErrorDialogBootstrap.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { UserInfoResource } from '@cloudbeaver/core-authentication'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; @injectable() diff --git a/webapp/packages/plugin-authentication/tsconfig.json b/webapp/packages/plugin-authentication/tsconfig.json index bd4ed8f7d0..1c8c19fe18 100644 --- a/webapp/packages/plugin-authentication/tsconfig.json +++ b/webapp/packages/plugin-authentication/tsconfig.json @@ -1,10 +1,73 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-administration" + }, + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-browser/package.json b/webapp/packages/plugin-browser/package.json index 358e5b8a57..4e398a6681 100644 --- a/webapp/packages/plugin-browser/package.json +++ b/webapp/packages/plugin-browser/package.json @@ -1,32 +1,33 @@ { "name": "@cloudbeaver/plugin-browser", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-resource-manager": "~0.1.0", - "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-browser": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0" + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-browser/tsconfig.json b/webapp/packages/plugin-browser/tsconfig.json index 25945c5e1f..07902d1871 100644 --- a/webapp/packages/plugin-browser/tsconfig.json +++ b/webapp/packages/plugin-browser/tsconfig.json @@ -1,14 +1,37 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], "references": [ { - "path": "../*" + "path": "..\\core-blocks" + }, + { + "path": "..\\core-browser" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" ] } diff --git a/webapp/packages/plugin-codemirror6/package.json b/webapp/packages/plugin-codemirror6/package.json index d17c01ab5c..04ad3cfe9a 100644 --- a/webapp/packages/plugin-codemirror6/package.json +++ b/webapp/packages/plugin-codemirror6/package.json @@ -1,22 +1,22 @@ { "name": "@cloudbeaver/plugin-codemirror6", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "@codemirror/lang-html": "6.4.6", "@codemirror/lang-javascript": "6.2.1", "@codemirror/lang-json": "6.0.1", @@ -28,7 +28,10 @@ "@codemirror/search": "6.5.2", "@codemirror/language": "6.9.0", "@codemirror/state": "6.2.1", - "@codemirror/view": "6.18.0" + "@codemirror/view": "6.18.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-theming": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", @@ -37,5 +40,6 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/plugin-codemirror6/tsconfig.json b/webapp/packages/plugin-codemirror6/tsconfig.json index bd4ed8f7d0..ee6b7b73b5 100644 --- a/webapp/packages/plugin-codemirror6/tsconfig.json +++ b/webapp/packages/plugin-codemirror6/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-connection-custom/package.json b/webapp/packages/plugin-connection-custom/package.json index bbea66201c..b94d953188 100644 --- a/webapp/packages/plugin-connection-custom/package.json +++ b/webapp/packages/plugin-connection-custom/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-connection-custom", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-connections": "~0.1.0", @@ -23,8 +24,9 @@ "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, @@ -33,5 +35,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnection/CustomConnectionController.ts b/webapp/packages/plugin-connection-custom/src/CustomConnection/CustomConnectionController.ts index 540238dd1d..3ad960563f 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnection/CustomConnectionController.ts +++ b/webapp/packages/plugin-connection-custom/src/CustomConnection/CustomConnectionController.ts @@ -11,7 +11,7 @@ import { ConnectionsManagerService, DBDriver, DBDriverResource } from '@cloudbea import { IInitializableController, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { isArraysEqual } from '@cloudbeaver/core-utils'; import { PublicConnectionFormService } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnection/DriverSelectorDialog/DriverSelectorDialog.tsx b/webapp/packages/plugin-connection-custom/src/CustomConnection/DriverSelectorDialog/DriverSelectorDialog.tsx index c7bc098176..c8d62d124f 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnection/DriverSelectorDialog/DriverSelectorDialog.tsx +++ b/webapp/packages/plugin-connection-custom/src/CustomConnection/DriverSelectorDialog/DriverSelectorDialog.tsx @@ -7,8 +7,7 @@ */ import { observer } from 'mobx-react-lite'; -import { Loader, s, useS } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogHeader, CommonDialogWrapper } from '@cloudbeaver/core-dialogs'; +import { CommonDialogBody, CommonDialogHeader, CommonDialogWrapper, Loader, s, useS } from '@cloudbeaver/core-blocks'; import type { IDriver } from './Driver'; import { DriverSelector } from './DriverSelector'; diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts index ec3f52ee93..f28864745a 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts +++ b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts @@ -9,7 +9,7 @@ import { ConnectionsManagerService } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { ActionService, MenuService } from '@cloudbeaver/core-view'; import { MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-custom/tsconfig.json b/webapp/packages/plugin-connection-custom/tsconfig.json index bd4ed8f7d0..ab968dfe5d 100644 --- a/webapp/packages/plugin-connection-custom/tsconfig.json +++ b/webapp/packages/plugin-connection-custom/tsconfig.json @@ -1,10 +1,58 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-connection-search/package.json b/webapp/packages/plugin-connection-search/package.json index fc29f9c9d0..d811f1d3ce 100644 --- a/webapp/packages/plugin-connection-search/package.json +++ b/webapp/packages/plugin-connection-search/package.json @@ -1,22 +1,24 @@ { "name": "@cloudbeaver/plugin-connection-search", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-connections": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", @@ -24,7 +26,9 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -35,5 +39,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-connection-search/src/Search/ConnectionSearchService.ts b/webapp/packages/plugin-connection-search/src/Search/ConnectionSearchService.ts index a4025a5864..8a72233de6 100644 --- a/webapp/packages/plugin-connection-search/src/Search/ConnectionSearchService.ts +++ b/webapp/packages/plugin-connection-search/src/Search/ConnectionSearchService.ts @@ -7,9 +7,10 @@ */ import { makeObservable, observable } from 'mobx'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, ConnectionsManagerService, createConnectionParam } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter, IExecutorHandler } from '@cloudbeaver/core-executor'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; diff --git a/webapp/packages/plugin-connection-search/src/Search/SearchDatabase.tsx b/webapp/packages/plugin-connection-search/src/Search/SearchDatabase.tsx index 8f0f8c9131..2fac5c612d 100644 --- a/webapp/packages/plugin-connection-search/src/Search/SearchDatabase.tsx +++ b/webapp/packages/plugin-connection-search/src/Search/SearchDatabase.tsx @@ -12,7 +12,8 @@ import { Loader, useResource } from '@cloudbeaver/core-blocks'; import { DBDriverResource } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { AdminConnectionSearchInfo, CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { AdminConnectionSearchInfo } from '@cloudbeaver/core-sdk'; import { ConnectionFormLoader } from '@cloudbeaver/plugin-connections'; import { ConnectionSearchService } from './ConnectionSearchService'; diff --git a/webapp/packages/plugin-connection-search/src/SearchConnectionPluginBootstrap.ts b/webapp/packages/plugin-connection-search/src/SearchConnectionPluginBootstrap.ts index 475e1b2600..8bb60f8fdf 100644 --- a/webapp/packages/plugin-connection-search/src/SearchConnectionPluginBootstrap.ts +++ b/webapp/packages/plugin-connection-search/src/SearchConnectionPluginBootstrap.ts @@ -9,8 +9,8 @@ import { EAdminPermission } from '@cloudbeaver/core-authentication'; import { ConnectionsManagerService } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { PermissionsService } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; import { ActionService, DATA_CONTEXT_MENU, MenuService } from '@cloudbeaver/core-view'; import { MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-search/tsconfig.json b/webapp/packages/plugin-connection-search/tsconfig.json index bd4ed8f7d0..30062f973e 100644 --- a/webapp/packages/plugin-connection-search/tsconfig.json +++ b/webapp/packages/plugin-connection-search/tsconfig.json @@ -1,10 +1,70 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-connection-template/package.json b/webapp/packages/plugin-connection-template/package.json index 96cafb3ec0..03191c693a 100644 --- a/webapp/packages/plugin-connection-template/package.json +++ b/webapp/packages/plugin-connection-template/package.json @@ -1,31 +1,32 @@ { "name": "@cloudbeaver/plugin-connection-template", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-connections": "~0.1.0", - "@cloudbeaver/core-administration": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-notifications": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", @@ -36,5 +37,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionController.ts b/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionController.ts index 3ae03862cd..65e3512aae 100644 --- a/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionController.ts +++ b/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionController.ts @@ -7,6 +7,7 @@ */ import { computed, makeObservable, observable } from 'mobx'; +import { ErrorDetailsDialog } from '@cloudbeaver/core-blocks'; import { Connection, ConnectionInfoProjectKey, @@ -21,9 +22,9 @@ import { import { IDestructibleController, IInitializableController, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications'; import { ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, DatabaseAuthModel, DetailsError, NetworkHandlerAuthType } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import { DatabaseAuthModel, DetailsError, NetworkHandlerAuthType } from '@cloudbeaver/core-sdk'; import { errorOf, getUniqueName } from '@cloudbeaver/core-utils'; import type { IConnectionAuthenticationConfig } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionDialog.tsx b/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionDialog.tsx index e05120ab47..e1b19445b5 100644 --- a/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionDialog.tsx +++ b/webapp/packages/plugin-connection-template/src/ConnectionDialog/ConnectionDialog.tsx @@ -7,9 +7,22 @@ */ import { observer } from 'mobx-react-lite'; -import { ErrorMessage, Form, Loader, s, useAdministrationSettings, useFocus, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + ErrorMessage, + Form, + Loader, + s, + useAdministrationSettings, + useFocus, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { useController } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { ConnectionAuthenticationFormLoader } from '@cloudbeaver/plugin-connections'; import { ConnectionController, ConnectionStep } from './ConnectionController'; diff --git a/webapp/packages/plugin-connection-template/src/TemplateConnectionPluginBootstrap.ts b/webapp/packages/plugin-connection-template/src/TemplateConnectionPluginBootstrap.ts index 2bebf1e0c2..1c0039d4e2 100644 --- a/webapp/packages/plugin-connection-template/src/TemplateConnectionPluginBootstrap.ts +++ b/webapp/packages/plugin-connection-template/src/TemplateConnectionPluginBootstrap.ts @@ -9,7 +9,7 @@ import { AppAuthService } from '@cloudbeaver/core-authentication'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, getCachedDataResourceLoaderState, getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, getCachedDataResourceLoaderState, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { ActionService, DATA_CONTEXT_MENU, MenuService } from '@cloudbeaver/core-view'; import { MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-template/src/TemplateConnectionsResource.ts b/webapp/packages/plugin-connection-template/src/TemplateConnectionsResource.ts index d944e8ba70..0843b0de30 100644 --- a/webapp/packages/plugin-connection-template/src/TemplateConnectionsResource.ts +++ b/webapp/packages/plugin-connection-template/src/TemplateConnectionsResource.ts @@ -8,8 +8,9 @@ import { AppAuthService } from '@cloudbeaver/core-authentication'; import { Connection, ConnectionInfoResource } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { SessionDataResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class TemplateConnectionsResource extends CachedDataResource { diff --git a/webapp/packages/plugin-connection-template/tsconfig.json b/webapp/packages/plugin-connection-template/tsconfig.json index bd4ed8f7d0..3753bfc8e5 100644 --- a/webapp/packages/plugin-connection-template/tsconfig.json +++ b/webapp/packages/plugin-connection-template/tsconfig.json @@ -1,10 +1,64 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-connections-administration/package.json b/webapp/packages/plugin-connections-administration/package.json index e86c4dfbbc..da59c0c92d 100644 --- a/webapp/packages/plugin-connections-administration/package.json +++ b/webapp/packages/plugin-connections-administration/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-connections-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-connections": "~0.1.0", @@ -27,6 +28,7 @@ "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -37,5 +39,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministration.tsx b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministration.tsx index 0aac7efb21..47eba59847 100644 --- a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministration.tsx +++ b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministration.tsx @@ -24,7 +24,7 @@ import { } from '@cloudbeaver/core-blocks'; import { ConnectionInfoActiveProjectKey, ConnectionInfoResource, DBDriverResource } from '@cloudbeaver/core-connections'; import { useController, useService } from '@cloudbeaver/core-di'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ConnectionsAdministrationController } from './ConnectionsAdministrationController'; import { ConnectionsTable } from './ConnectionsTable/ConnectionsTable'; diff --git a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationController.ts b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationController.ts index 075aa44331..1ca2ae523a 100644 --- a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationController.ts +++ b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationController.ts @@ -7,6 +7,7 @@ */ import { computed, makeObservable, observable } from 'mobx'; +import { ConfirmationDialogDelete } from '@cloudbeaver/core-blocks'; import { compareConnectionsInfo, compareNewConnectionsInfo, @@ -18,11 +19,11 @@ import { IConnectionInfoParams, } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { isGlobalProject, isSharedProject, ProjectInfoResource, projectInfoSortByName } from '@cloudbeaver/core-projects'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { isArraysEqual, isDefined, isObjectsEqual } from '@cloudbeaver/core-utils'; @injectable() diff --git a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationService.ts b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationService.ts index 6e5d013602..e77cebae90 100644 --- a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationService.ts +++ b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsAdministrationService.ts @@ -8,13 +8,13 @@ import React from 'react'; import { AdministrationItemService, AdministrationItemType } from '@cloudbeaver/core-administration'; -import { PlaceholderContainer } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialog, PlaceholderContainer } from '@cloudbeaver/core-blocks'; import { ConnectionInfoActiveProjectKey, ConnectionInfoResource, DatabaseConnection, DBDriverResource } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { CreateConnectionService } from './CreateConnectionService'; diff --git a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsTable/ConnectionsTable.tsx b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsTable/ConnectionsTable.tsx index 361878d4a1..a9946dcfa6 100644 --- a/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsTable/ConnectionsTable.tsx +++ b/webapp/packages/plugin-connections-administration/src/Administration/Connections/ConnectionsTable/ConnectionsTable.tsx @@ -11,7 +11,7 @@ import { getComputed, Table, TableBody, TableColumnHeader, TableHeader, TableSel import { DatabaseConnection, IConnectionInfoParams, serializeConnectionParam } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { isGlobalProject, isSharedProject, ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { Connection } from './Connection'; diff --git a/webapp/packages/plugin-connections-administration/src/Administration/Connections/CreateConnection/Manual/CustomConnection.tsx b/webapp/packages/plugin-connections-administration/src/Administration/Connections/CreateConnection/Manual/CustomConnection.tsx index 675051f499..908d8e8e6d 100644 --- a/webapp/packages/plugin-connections-administration/src/Administration/Connections/CreateConnection/Manual/CustomConnection.tsx +++ b/webapp/packages/plugin-connections-administration/src/Administration/Connections/CreateConnection/Manual/CustomConnection.tsx @@ -14,7 +14,7 @@ import { DBDriverResource } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { isSharedProject, ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ConnectionManualService } from './ConnectionManualService'; import { DriverList } from './DriverList'; diff --git a/webapp/packages/plugin-connections-administration/src/ConnectionForm/ConnectionAccess/ConnectionAccess.tsx b/webapp/packages/plugin-connections-administration/src/ConnectionForm/ConnectionAccess/ConnectionAccess.tsx index fc6b866265..63b3a0f77b 100644 --- a/webapp/packages/plugin-connections-administration/src/ConnectionForm/ConnectionAccess/ConnectionAccess.tsx +++ b/webapp/packages/plugin-connections-administration/src/ConnectionForm/ConnectionAccess/ConnectionAccess.tsx @@ -24,7 +24,7 @@ import { } from '@cloudbeaver/core-blocks'; import { isCloudConnection } from '@cloudbeaver/core-connections'; import type { TLocalizationToken } from '@cloudbeaver/core-localization'; -import { CachedMapAllKey, CachedResourcePageListKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, CachedResourceOffsetPageListKey } from '@cloudbeaver/core-resource'; import { TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui'; import type { IConnectionFormProps } from '@cloudbeaver/plugin-connections'; @@ -56,7 +56,7 @@ export const ConnectionAccess: TabContainerPanelComponent useAutoLoad(ConnectionAccess, state, selected); - const users = useResource(ConnectionAccess, UsersResource, CachedResourcePageListKey(0, 1000).setTarget(UsersResourceFilterKey()), { + const users = useResource(ConnectionAccess, UsersResource, CachedResourceOffsetPageListKey(0, 1000).setTarget(UsersResourceFilterKey()), { active: selected, }); const teams = useResource(ConnectionAccess, TeamsResource, CachedMapAllKey, { active: selected }); diff --git a/webapp/packages/plugin-connections-administration/tsconfig.json b/webapp/packages/plugin-connections-administration/tsconfig.json index bd4ed8f7d0..64612c201b 100644 --- a/webapp/packages/plugin-connections-administration/tsconfig.json +++ b/webapp/packages/plugin-connections-administration/tsconfig.json @@ -1,10 +1,70 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-connections/package.json b/webapp/packages/plugin-connections/package.json index 06cef4549c..d2384bc086 100644 --- a/webapp/packages/plugin-connections/package.json +++ b/webapp/packages/plugin-connections/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-connections", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-authentication": "~0.1.0", @@ -23,17 +24,19 @@ "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", - "@cloudbeaver/core-notifications": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" @@ -43,5 +46,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationDialog.tsx b/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationDialog.tsx index 8a0f6c8d62..a0cd46544c 100644 --- a/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationDialog.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationDialog.tsx @@ -7,56 +7,65 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, Form, s, useFocus, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Form, + s, + useFocus, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { useDBDriver } from '@cloudbeaver/core-connections'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import type { ConnectionConfig } from '@cloudbeaver/core-sdk'; import style from './ConnectionAuthenticationDialog.m.css'; import { ConnectionAuthenticationFormLoader } from './ConnectionAuthenticationFormLoader'; -interface Payload { +export interface ConnectionAuthenticationDialogPayload { config: ConnectionConfig; authModelId: string | null; networkHandlers?: string[]; driverId?: string; } -export const ConnectionAuthenticationDialog: DialogComponent = observer(function ConnectionAuthenticationDialog({ - payload, - rejectDialog, - resolveDialog, -}) { - const translate = useTranslate(); - const styles = useS(style); - const [focusedRef] = useFocus({ focusFirstChild: true }); - const { driver } = useDBDriver(payload.driverId || ''); +export const ConnectionAuthenticationDialog: DialogComponent = observer( + function ConnectionAuthenticationDialog({ payload, rejectDialog, resolveDialog }) { + const translate = useTranslate(); + const styles = useS(style); + const [focusedRef] = useFocus({ focusFirstChild: true }); + const { driver } = useDBDriver(payload.driverId || ''); - return ( - - - -
resolveDialog()}> - - -
- - - -
- ); -}); + return ( + + + +
resolveDialog()}> + + +
+ + + +
+ ); + }, +); diff --git a/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationForm.tsx b/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationForm.tsx index d1b86691c9..058f7b3049 100644 --- a/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationForm.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionAuthentication/ConnectionAuthenticationForm.tsx @@ -23,7 +23,7 @@ import type { ObjectPropertyInfo } from '@cloudbeaver/core-sdk'; import type { IConnectionAuthenticationConfig } from './IConnectionAuthenticationConfig'; import { NetworkHandlers } from './NetworkHandlers'; -interface Props { +export interface ConnectionAuthenticationFormProps { config: Partial; authModelId: string | null; authProperties?: ObjectPropertyInfo[]; @@ -35,7 +35,7 @@ interface Props { hideFeatures?: string[]; } -export const ConnectionAuthenticationForm = observer(function ConnectionAuthenticationForm({ +export const ConnectionAuthenticationForm = observer(function ConnectionAuthenticationForm({ config, networkHandlers, authProperties, diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionForm.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionForm.tsx index c38fb9263d..2b14c1a281 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionForm.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionForm.tsx @@ -9,17 +9,7 @@ import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; import styled, { css } from 'reshadow'; -import { - ExceptionMessage, - IconOrImage, - Loader, - Placeholder, - StatusMessage, - useExecutor, - useObjectRef, - useStyles, - useTranslate, -} from '@cloudbeaver/core-blocks'; +import { ExceptionMessage, Loader, Placeholder, StatusMessage, useExecutor, useObjectRef, useStyles } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { ENotificationType } from '@cloudbeaver/core-events'; import type { ConnectionConfig } from '@cloudbeaver/core-sdk'; @@ -104,15 +94,14 @@ const formStyles = css` } `; -interface Props { +export interface ConnectionFormProps { state: IConnectionFormState; onCancel?: () => void; onSave?: (config: ConnectionConfig) => void; className?: string; } -export const ConnectionForm = observer(function ConnectionForm({ state, onCancel, onSave = () => {}, className }) { - const translate = useTranslate(); +export const ConnectionForm = observer(function ConnectionForm({ state, onCancel, onSave = () => {}, className }) { const props = useObjectRef({ onSave }); const style = [BASE_TAB_STYLES, tabsStyles, UNDERLINE_TAB_STYLES, UNDERLINE_TAB_BIG_STYLES]; const styles = useStyles(style, topBarStyles, formStyles); diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormState.ts b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormState.ts index 2bfa321018..aff0455fcd 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormState.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormState.ts @@ -10,7 +10,8 @@ import { action, computed, makeObservable, observable } from 'mobx'; import { ConnectionInfoResource, createConnectionParam, DatabaseConnection, IConnectionInfoParams } from '@cloudbeaver/core-connections'; import { Executor, IExecutionContextProvider, IExecutor } from '@cloudbeaver/core-executor'; import type { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import type { ConnectionConfig, ResourceKeySimple } from '@cloudbeaver/core-sdk'; +import type { ResourceKeySimple } from '@cloudbeaver/core-resource'; +import type { ConnectionConfig } from '@cloudbeaver/core-sdk'; import { formStateContext, type IFormStateInfo } from '@cloudbeaver/core-ui'; import { MetadataMap, uuid } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx index 3a41adb5ac..ecec62ab9c 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx @@ -33,10 +33,10 @@ import { } from '@cloudbeaver/core-blocks'; import { DatabaseAuthModelsResource, DBDriverResource, isLocalConnection } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; +import { CachedResourceListEmptyKey, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedResourceListEmptyKey, DriverConfigurationType, resourceKeyList } from '@cloudbeaver/core-sdk'; -import type { TabContainerPanelComponent } from '@cloudbeaver/core-ui'; -import { useAuthenticationAction } from '@cloudbeaver/core-ui'; +import { DriverConfigurationType } from '@cloudbeaver/core-sdk'; +import { type TabContainerPanelComponent, useAuthenticationAction } from '@cloudbeaver/core-ui'; import { isSafari } from '@cloudbeaver/core-utils'; import { ProjectSelect } from '@cloudbeaver/plugin-projects'; diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/ConnectionSSLTabService.ts b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/ConnectionSSLTabService.ts index ce2f2c3592..5318b35ace 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/ConnectionSSLTabService.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/ConnectionSSLTabService.ts @@ -11,7 +11,8 @@ import React from 'react'; import { DBDriverResource, NetworkHandlerResource } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; -import { CachedMapAllKey, type NetworkHandlerConfigInput } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { NetworkHandlerConfigInput } from '@cloudbeaver/core-sdk'; import { formStateContext } from '@cloudbeaver/core-ui'; import { isNotNullDefined, isObjectsEqual } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLPanel.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLPanel.tsx index 560d87ed4c..37845646a5 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLPanel.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLPanel.tsx @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite'; import { useResource } from '@cloudbeaver/core-blocks'; import { DBDriverResource, NetworkHandlerResource } from '@cloudbeaver/core-connections'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { TabContainerTabComponent, useTab } from '@cloudbeaver/core-ui'; import type { IConnectionFormProps } from '../IConnectionFormProps'; diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLTab.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLTab.tsx index 9da4f4be7e..3f24fffd40 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLTab.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/SSL/SSLTab.tsx @@ -10,7 +10,7 @@ import styled from 'reshadow'; import { Translate, useResource, useStyles } from '@cloudbeaver/core-blocks'; import { DBDriverResource, NetworkHandlerResource } from '@cloudbeaver/core-connections'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { Tab, TabContainerTabComponent, TabTitle } from '@cloudbeaver/core-ui'; import type { IConnectionFormProps } from '../IConnectionFormProps'; diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/connectionFormConfigureContext.ts b/webapp/packages/plugin-connections/src/ConnectionForm/connectionFormConfigureContext.ts index 2480dbc0ec..ee682dd27e 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/connectionFormConfigureContext.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/connectionFormConfigureContext.ts @@ -7,7 +7,8 @@ */ import type { DatabaseConnection } from '@cloudbeaver/core-connections'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; -import type { CachedResourceIncludeArgs, GetUserConnectionsQueryVariables } from '@cloudbeaver/core-sdk'; +import type { CachedResourceIncludeArgs } from '@cloudbeaver/core-resource'; +import type { GetUserConnectionsQueryVariables } from '@cloudbeaver/core-sdk'; import type { IConnectionFormState } from './IConnectionFormProps'; diff --git a/webapp/packages/plugin-connections/src/ContextMenu/ConnectionMenuBootstrap.ts b/webapp/packages/plugin-connections/src/ContextMenu/ConnectionMenuBootstrap.ts index 5a907da27d..15f10c5f5a 100644 --- a/webapp/packages/plugin-connections/src/ContextMenu/ConnectionMenuBootstrap.ts +++ b/webapp/packages/plugin-connections/src/ContextMenu/ConnectionMenuBootstrap.ts @@ -12,10 +12,12 @@ import { ConnectionsManagerService, ConnectionsSettingsService, createConnectionParam, + DATA_CONTEXT_CONNECTION, } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { DATA_CONTEXT_NAV_NODE, EObjectFeature, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; +import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { CONNECTION_NAVIGATOR_VIEW_SETTINGS, isNavigatorViewSettingsEqual, @@ -23,7 +25,6 @@ import { PermissionsService, ServerConfigResource, } from '@cloudbeaver/core-root'; -import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; import { ACTION_DELETE, ActionService, DATA_CONTEXT_MENU, DATA_CONTEXT_MENU_NESTED, MenuSeparatorItem, MenuService } from '@cloudbeaver/core-view'; import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar'; @@ -37,7 +38,6 @@ import { ACTION_CONNECTION_EDIT } from './Actions/ACTION_CONNECTION_EDIT'; import { ACTION_CONNECTION_VIEW_ADVANCED } from './Actions/ACTION_CONNECTION_VIEW_ADVANCED'; import { ACTION_CONNECTION_VIEW_SIMPLE } from './Actions/ACTION_CONNECTION_VIEW_SIMPLE'; import { ACTION_CONNECTION_VIEW_SYSTEM_OBJECTS } from './Actions/ACTION_CONNECTION_VIEW_SYSTEM_OBJECTS'; -import { DATA_CONTEXT_CONNECTION } from './DATA_CONTEXT_CONNECTION'; import { MENU_CONNECTION_VIEW } from './MENU_CONNECTION_VIEW'; import { MENU_CONNECTIONS } from './MENU_CONNECTIONS'; diff --git a/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DBAuthDialogController.ts b/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DBAuthDialogController.ts index 563a475ba7..df6c939394 100644 --- a/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DBAuthDialogController.ts +++ b/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DBAuthDialogController.ts @@ -7,6 +7,7 @@ */ import { makeObservable, observable } from 'mobx'; +import { ErrorDetailsDialog } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, ConnectionInitConfig, @@ -17,8 +18,8 @@ import { import { IDestructibleController, IInitializableController, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications'; -import { CachedMapAllKey, GQLErrorCatcher, NetworkHandlerAuthType } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import { GQLErrorCatcher, NetworkHandlerAuthType } from '@cloudbeaver/core-sdk'; import type { IConnectionAuthenticationConfig } from '../ConnectionAuthentication/IConnectionAuthenticationConfig'; diff --git a/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DatabaseAuthDialog.tsx b/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DatabaseAuthDialog.tsx index bf170d379b..00a6c23d63 100644 --- a/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DatabaseAuthDialog.tsx +++ b/webapp/packages/plugin-connections/src/DatabaseAuthDialog/DatabaseAuthDialog.tsx @@ -7,10 +7,22 @@ */ import { observer } from 'mobx-react-lite'; -import { ErrorMessage, Form, Loader, s, useAdministrationSettings, useFocus, useS } from '@cloudbeaver/core-blocks'; +import { + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + ErrorMessage, + Form, + Loader, + s, + useAdministrationSettings, + useFocus, + useS, +} from '@cloudbeaver/core-blocks'; import { IConnectionInfoParams, useConnectionInfo, useDBDriver } from '@cloudbeaver/core-connections'; import { useController } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { ConnectionAuthenticationFormLoader } from '../ConnectionAuthentication/ConnectionAuthenticationFormLoader'; import style from './DatabaseAuthDialog.m.css'; diff --git a/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts b/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts index 9e6bd72176..67b3bbc04c 100644 --- a/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts +++ b/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts @@ -8,6 +8,7 @@ import { untracked } from 'mobx'; import { UserInfoResource } from '@cloudbeaver/core-authentication'; +import { ConfirmationDialogDelete } from '@cloudbeaver/core-blocks'; import { CONNECTION_FOLDER_NAME_VALIDATION, ConnectionFolderProjectKey, @@ -21,8 +22,9 @@ import { IConnectionFolderParam, IConnectionInfoParams, } from '@cloudbeaver/core-connections'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter, IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { LocalizationService } from '@cloudbeaver/core-localization'; @@ -41,9 +43,9 @@ import { ROOT_NODE_PATH, } from '@cloudbeaver/core-navigation-tree'; import { getProjectNodeId, NAV_NODE_TYPE_PROJECT, ProjectInfoResource } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, ResourceKeyAlias, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, ResourceKeyAlias, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { createPath } from '@cloudbeaver/core-utils'; -import { ACTION_NEW_FOLDER, ActionService, DATA_CONTEXT_MENU, IAction, IDataContextProvider, MenuService } from '@cloudbeaver/core-view'; +import { ACTION_NEW_FOLDER, ActionService, DATA_CONTEXT_MENU, IAction, MenuService } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_ELEMENTS_TREE, type IElementsTree, MENU_ELEMENTS_TREE_TOOLS } from '@cloudbeaver/plugin-navigation-tree'; import { FolderDialog } from '@cloudbeaver/plugin-projects'; diff --git a/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts b/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts index bfb51e459e..fa12400e1b 100644 --- a/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts +++ b/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts @@ -8,13 +8,15 @@ import { action, makeObservable, observable } from 'mobx'; import { UserInfoResource } from '@cloudbeaver/core-authentication'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, createConnectionParam, IConnectionInfoParams } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { executorHandlerFilter, ExecutorInterrupter, IExecutorHandler } from '@cloudbeaver/core-executor'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import type { ConnectionConfig, ResourceKey, ResourceKeySimple } from '@cloudbeaver/core-sdk'; +import type { ResourceKey, ResourceKeySimple } from '@cloudbeaver/core-resource'; +import type { ConnectionConfig } from '@cloudbeaver/core-sdk'; import { OptionsPanelService } from '@cloudbeaver/core-ui'; import { AuthenticationService } from '@cloudbeaver/plugin-authentication'; diff --git a/webapp/packages/plugin-connections/src/index.ts b/webapp/packages/plugin-connections/src/index.ts index 04b25664f1..d591853d3c 100644 --- a/webapp/packages/plugin-connections/src/index.ts +++ b/webapp/packages/plugin-connections/src/index.ts @@ -14,7 +14,6 @@ export * from './ConnectionForm/ConnectionFormService'; export * from './ConnectionForm/ConnectionFormState'; export * from './ConnectionForm/IConnectionFormProps'; export * from './ConnectionForm/useConnectionFormState'; -export * from './ContextMenu/DATA_CONTEXT_CONNECTION'; export * from './ContextMenu/MENU_CONNECTION_VIEW'; export * from './ContextMenu/MENU_CONNECTIONS'; export * from './PublicConnectionForm/PublicConnectionFormService'; diff --git a/webapp/packages/plugin-connections/tsconfig.json b/webapp/packages/plugin-connections/tsconfig.json index bd4ed8f7d0..ebd9f46039 100644 --- a/webapp/packages/plugin-connections/tsconfig.json +++ b/webapp/packages/plugin-connections/tsconfig.json @@ -1,10 +1,91 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-authentication" + }, + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-projects" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-d3js/package.json b/webapp/packages/plugin-d3js/package.json index 674ce5a27d..10ad418fae 100644 --- a/webapp/packages/plugin-d3js/package.json +++ b/webapp/packages/plugin-d3js/package.json @@ -1,27 +1,31 @@ { "name": "@cloudbeaver/plugin-d3js", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "The plugin reexports d3js library and contains utility functions and components for d3js", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "d3": "^7.8.5", - "d3-drag": "^3.0.0" + "d3-drag": "^3.0.0", + "@cloudbeaver/core-di": "~0.1.0" }, "devDependencies": { "@types/d3": "^7.4.0", "@types/d3-drag": "^3.0.3" - } + }, + "peerDependencies": {} } diff --git a/webapp/packages/plugin-d3js/tsconfig.json b/webapp/packages/plugin-d3js/tsconfig.json index bd4ed8f7d0..959c65dd59 100644 --- a/webapp/packages/plugin-d3js/tsconfig.json +++ b/webapp/packages/plugin-d3js/tsconfig.json @@ -1,10 +1,25 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-data-export/package.json b/webapp/packages/plugin-data-export/package.json index 0f1cdeefc2..705478b9d4 100644 --- a/webapp/packages/plugin-data-export/package.json +++ b/webapp/packages/plugin-data-export/package.json @@ -1,31 +1,26 @@ { "name": "@cloudbeaver/plugin-data-export", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-connections": "~0.1.0", "@cloudbeaver/plugin-data-viewer": "~0.1.0", - "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", - "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/plugin-object-viewer": "~0.1.0", "@cloudbeaver/plugin-sql-editor": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", @@ -33,8 +28,8 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", - "@cloudbeaver/core-notifications": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -47,5 +42,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-data-export/src/DataExportMenuService.ts b/webapp/packages/plugin-data-export/src/DataExportMenuService.ts index 48e757a6aa..4dcec1dcf6 100644 --- a/webapp/packages/plugin-data-export/src/DataExportMenuService.ts +++ b/webapp/packages/plugin-data-export/src/DataExportMenuService.ts @@ -5,13 +5,12 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createConnectionParam } from '@cloudbeaver/core-connections'; +import { createConnectionParam, DATA_CONTEXT_CONNECTION } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, IMenuContext } from '@cloudbeaver/core-dialogs'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { DATA_CONTEXT_NAV_NODE, EObjectFeature } from '@cloudbeaver/core-navigation-tree'; import { ACTION_EXPORT, ActionService, DATA_CONTEXT_MENU_NESTED, MenuService } from '@cloudbeaver/core-view'; -import { DATA_CONTEXT_CONNECTION } from '@cloudbeaver/plugin-connections'; import { IDatabaseDataSource, IDataContainerOptions, ITableFooterMenuContext, TableFooterMenuService } from '@cloudbeaver/plugin-data-viewer'; import type { IDataQueryOptions } from '@cloudbeaver/plugin-sql-editor'; diff --git a/webapp/packages/plugin-data-export/src/DataExportSettingsService.test.ts b/webapp/packages/plugin-data-export/src/DataExportSettingsService.test.ts index d55ff10f6a..dd37fdf68f 100644 --- a/webapp/packages/plugin-data-export/src/DataExportSettingsService.test.ts +++ b/webapp/packages/plugin-data-export/src/DataExportSettingsService.test.ts @@ -7,24 +7,68 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; -import dataViewer from '@cloudbeaver/plugin-data-viewer'; -import datasourceContextSwitch from '@cloudbeaver/plugin-datasource-context-switch'; -import navigationTabs from '@cloudbeaver/plugin-navigation-tabs'; -import navigationTree from '@cloudbeaver/plugin-navigation-tree'; -import objectViewer from '@cloudbeaver/plugin-object-viewer'; +import { coreAdministrationManifest } from '@cloudbeaver/core-administration'; +import { coreAppManifest } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { dataViewerManifest } from '@cloudbeaver/plugin-data-viewer'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { navigationTreePlugin } from '@cloudbeaver/plugin-navigation-tree'; +import { objectViewerManifest } from '@cloudbeaver/plugin-object-viewer'; +import { createApp } from '@cloudbeaver/tests-runner'; import { DataExportSettings, DataExportSettingsService } from './DataExportSettingsService'; -import { manifest } from './manifest'; +import { dataExportManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(datasourceContextSwitch, navigationTree, navigationTabs, objectViewer, dataViewer, manifest); +const app = createApp( + dataExportManifest, + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreBrowserManifest, + coreSettingsManifest, + coreViewManifest, + coreAuthenticationManifest, + coreProjectsManifest, + coreUIManifest, + coreRoutingManifest, + coreAdministrationManifest, + coreConnectionsManifest, + coreDialogsManifest, + coreNavigationTree, + coreAppManifest, + coreThemingManifest, + datasourceContextSwitchPluginManifest, + navigationTreePlugin, + navigationTabsPlugin, + objectViewerManifest, + dataViewerManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-data-export/src/DataTransferProcessorsResource.ts b/webapp/packages/plugin-data-export/src/DataTransferProcessorsResource.ts index 6f970abf15..9601cc7acf 100644 --- a/webapp/packages/plugin-data-export/src/DataTransferProcessorsResource.ts +++ b/webapp/packages/plugin-data-export/src/DataTransferProcessorsResource.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; +import { CachedMapAllKey, CachedMapResource, resourceKeyList } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, CachedMapResource, DataTransferProcessorInfo, GraphQLService, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { DataTransferProcessorInfo, GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class DataTransferProcessorsResource extends CachedMapResource { diff --git a/webapp/packages/plugin-data-export/src/Dialog/DataExportController.ts b/webapp/packages/plugin-data-export/src/Dialog/DataExportController.ts index 1dda3d5148..97002c9a21 100644 --- a/webapp/packages/plugin-data-export/src/Dialog/DataExportController.ts +++ b/webapp/packages/plugin-data-export/src/Dialog/DataExportController.ts @@ -7,18 +7,11 @@ */ import { computed, makeObservable, observable } from 'mobx'; -import type { IProperty } from '@cloudbeaver/core-blocks'; +import { ErrorDetailsDialog, type IProperty } from '@cloudbeaver/core-blocks'; import { IDestructibleController, IInitializableController, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; -import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications'; -import { - DataTransferOutputSettings, - DataTransferProcessorInfo, - GQLErrorCatcher, - ObjectPropertyInfo, - ObjectPropertyLength, -} from '@cloudbeaver/core-sdk'; +import { DataTransferOutputSettings, DataTransferProcessorInfo, GQLErrorCatcher } from '@cloudbeaver/core-sdk'; import { DataExportService } from '../DataExportService'; import type { IExportContext } from '../IExportContext'; diff --git a/webapp/packages/plugin-data-export/src/Dialog/DefaultExportOutputSettingsResource.ts b/webapp/packages/plugin-data-export/src/Dialog/DefaultExportOutputSettingsResource.ts index 3cf66d1835..0077c40a2e 100644 --- a/webapp/packages/plugin-data-export/src/Dialog/DefaultExportOutputSettingsResource.ts +++ b/webapp/packages/plugin-data-export/src/Dialog/DefaultExportOutputSettingsResource.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; -import { CachedDataResource, DataTransferDefaultExportSettings, GraphQLService } from '@cloudbeaver/core-sdk'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; +import { DataTransferDefaultExportSettings, GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class DefaultExportOutputSettingsResource extends CachedDataResource { diff --git a/webapp/packages/plugin-data-export/src/Dialog/ProcessorConfigureDialog.tsx b/webapp/packages/plugin-data-export/src/Dialog/ProcessorConfigureDialog.tsx index 5bdbbb74ec..7ed14bec05 100644 --- a/webapp/packages/plugin-data-export/src/Dialog/ProcessorConfigureDialog.tsx +++ b/webapp/packages/plugin-data-export/src/Dialog/ProcessorConfigureDialog.tsx @@ -9,8 +9,19 @@ import { observer } from 'mobx-react-lite'; import { useState } from 'react'; import styled from 'reshadow'; -import { ErrorMessage, IProperty, PropertiesTable, s, useS, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper } from '@cloudbeaver/core-dialogs'; +import { + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + ErrorMessage, + IProperty, + PropertiesTable, + s, + useS, + useStyles, + useTranslate, +} from '@cloudbeaver/core-blocks'; import type { DataTransferOutputSettings, DataTransferProcessorInfo, GQLErrorCatcher } from '@cloudbeaver/core-sdk'; import { ITabData, Tab, TabList, TabsState, TabTitle, UNDERLINE_TAB_STYLES } from '@cloudbeaver/core-ui'; diff --git a/webapp/packages/plugin-data-export/src/Dialog/ProcessorSelectDialog.tsx b/webapp/packages/plugin-data-export/src/Dialog/ProcessorSelectDialog.tsx index bcd27b71fc..0f5a986c55 100644 --- a/webapp/packages/plugin-data-export/src/Dialog/ProcessorSelectDialog.tsx +++ b/webapp/packages/plugin-data-export/src/Dialog/ProcessorSelectDialog.tsx @@ -7,8 +7,7 @@ */ import { observer } from 'mobx-react-lite'; -import { Loader, s, useS } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogHeader, CommonDialogWrapper } from '@cloudbeaver/core-dialogs'; +import { CommonDialogBody, CommonDialogHeader, CommonDialogWrapper, Loader, s, useS } from '@cloudbeaver/core-blocks'; import type { DataTransferProcessorInfo } from '@cloudbeaver/core-sdk'; import type { IExportContext } from '../IExportContext'; diff --git a/webapp/packages/plugin-data-export/src/ExportNotification/ExportNotificationController.ts b/webapp/packages/plugin-data-export/src/ExportNotification/ExportNotificationController.ts index 9eb28c26cc..0a2b452496 100644 --- a/webapp/packages/plugin-data-export/src/ExportNotification/ExportNotificationController.ts +++ b/webapp/packages/plugin-data-export/src/ExportNotification/ExportNotificationController.ts @@ -7,12 +7,12 @@ */ import { computed, makeObservable, observable } from 'mobx'; +import { ErrorDetailsDialog } from '@cloudbeaver/core-blocks'; import { IInitializableController, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { ENotificationType, INotification } from '@cloudbeaver/core-events'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; -import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications'; import { ServerErrorType, ServerInternalError } from '@cloudbeaver/core-sdk'; import { Deferred, EDeferredState, errorOf } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-data-export/src/index.ts b/webapp/packages/plugin-data-export/src/index.ts index 3e0de375a2..e3b911ba54 100644 --- a/webapp/packages/plugin-data-export/src/index.ts +++ b/webapp/packages/plugin-data-export/src/index.ts @@ -1,6 +1,4 @@ -import { manifest } from './manifest'; - -export default manifest; +export * from './manifest'; export * from './DataExportMenuService'; export * from './DataExportService'; diff --git a/webapp/packages/plugin-data-export/src/manifest.ts b/webapp/packages/plugin-data-export/src/manifest.ts index 0841f74ce2..a110f606d3 100644 --- a/webapp/packages/plugin-data-export/src/manifest.ts +++ b/webapp/packages/plugin-data-export/src/manifest.ts @@ -16,7 +16,7 @@ import { DataTransferProcessorsResource } from './DataTransferProcessorsResource import { DefaultExportOutputSettingsResource } from './Dialog/DefaultExportOutputSettingsResource'; import { LocaleService } from './LocaleService'; -export const manifest: PluginManifest = { +export const dataExportManifest: PluginManifest = { info: { name: 'Data Export Plugin', }, diff --git a/webapp/packages/plugin-data-export/tsconfig.json b/webapp/packages/plugin-data-export/tsconfig.json index bd4ed8f7d0..4a14518ac9 100644 --- a/webapp/packages/plugin-data-export/tsconfig.json +++ b/webapp/packages/plugin-data-export/tsconfig.json @@ -1,10 +1,73 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-data-spreadsheet-new/package.json b/webapp/packages/plugin-data-spreadsheet-new/package.json index 36b61fd118..81c0bc4084 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/package.json +++ b/webapp/packages/plugin-data-spreadsheet-new/package.json @@ -1,44 +1,40 @@ { "name": "@cloudbeaver/plugin-data-spreadsheet-new", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@popperjs/core": "~2.11.8", + "react-popper": "~2.3.0", "@cloudbeaver/plugin-data-viewer": "~0.1.0", - "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", - "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/plugin-object-viewer": "~0.1.0", "@cloudbeaver/plugin-react-data-grid": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@popperjs/core": "~2.11.8", - "react-popper": "~2.3.0" + "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", @@ -46,5 +42,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/FilterCustomValueDialog.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/FilterCustomValueDialog.tsx index a3d4af0c7d..14192c0b75 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/FilterCustomValueDialog.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/FilterCustomValueDialog.tsx @@ -8,16 +8,19 @@ import { observer } from 'mobx-react-lite'; import { useCallback, useEffect, useRef, useState } from 'react'; -import { Button, InputField, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { useService } from '@cloudbeaver/core-di'; import { + Button, CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, - DialogComponent, - DialogComponentProps, -} from '@cloudbeaver/core-dialogs'; + InputField, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import { useService } from '@cloudbeaver/core-di'; +import type { DialogComponent, DialogComponentProps } from '@cloudbeaver/core-dialogs'; import { ClipboardService } from '@cloudbeaver/core-ui'; import style from './FilterCustomValueDialog.m.css'; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx index 9ed01b9ccf..e3dd643458 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx @@ -25,9 +25,8 @@ import { ResultSetDataKeysUtils, ResultSetSelectAction, } from '@cloudbeaver/plugin-data-viewer'; -import type { DataGridHandle, Position } from '@cloudbeaver/plugin-react-data-grid'; -import DataGrid from '@cloudbeaver/plugin-react-data-grid'; -import '@cloudbeaver/plugin-react-data-grid/lib/lib/styles.css'; +import DataGrid, { type DataGridHandle, type Position } from '@cloudbeaver/plugin-react-data-grid'; +import '@cloudbeaver/plugin-react-data-grid/react-data-grid-dist/lib/styles.css'; import { CellPosition, EditingContext } from '../Editing/EditingContext'; import { useEditing } from '../Editing/useEditing'; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx index 34769838a8..727f319e79 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx @@ -8,9 +8,8 @@ import { observer } from 'mobx-react-lite'; import styled from 'reshadow'; -import { Icon } from '@cloudbeaver/core-blocks'; +import { Icon, MenuTrigger } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { MenuTrigger } from '@cloudbeaver/core-dialogs'; import { EventContext, EventStopPropagationFlag } from '@cloudbeaver/core-events'; import type { IDatabaseDataModel, IDataPresentationActions, IDataTableActions, IResultSetElementKey } from '@cloudbeaver/plugin-data-viewer'; 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 433ab12018..ab24da00f7 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 @@ -6,8 +6,8 @@ * you may not use this file except in compliance with the License. */ import { useCombinedRef } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { IDNDBox, IDNDData, useDNDBox, useDNDData } from '@cloudbeaver/core-ui'; -import { useDataContext } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX, diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGridSettingsService.test.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGridSettingsService.test.ts index 0f273cb3a1..b1831f1c08 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGridSettingsService.test.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGridSettingsService.test.ts @@ -7,24 +7,68 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; -import dataViewer from '@cloudbeaver/plugin-data-viewer'; -import datasourceContextSwitch from '@cloudbeaver/plugin-datasource-context-switch'; -import navigationTabs from '@cloudbeaver/plugin-navigation-tabs'; -import navigationTree from '@cloudbeaver/plugin-navigation-tree'; -import objectViewer from '@cloudbeaver/plugin-object-viewer'; +import { coreAdministrationManifest } from '@cloudbeaver/core-administration'; +import { coreAppManifest } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { dataViewerManifest } from '@cloudbeaver/plugin-data-viewer'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { navigationTreePlugin } from '@cloudbeaver/plugin-navigation-tree'; +import { objectViewerManifest } from '@cloudbeaver/plugin-object-viewer'; +import { createApp } from '@cloudbeaver/tests-runner'; import { DataGridSettings, DataGridSettingsService } from './DataGridSettingsService'; -import { manifest } from './manifest'; +import { dataSpreadsheetNewManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(datasourceContextSwitch, navigationTree, navigationTabs, objectViewer, dataViewer, manifest); +const app = createApp( + dataSpreadsheetNewManifest, + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreBrowserManifest, + coreSettingsManifest, + coreViewManifest, + coreAuthenticationManifest, + coreProjectsManifest, + coreUIManifest, + coreRoutingManifest, + coreAdministrationManifest, + coreConnectionsManifest, + coreDialogsManifest, + coreNavigationTree, + coreAppManifest, + coreThemingManifest, + datasourceContextSwitchPluginManifest, + navigationTreePlugin, + navigationTabsPlugin, + objectViewerManifest, + dataViewerManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/index.ts b/webapp/packages/plugin-data-spreadsheet-new/src/index.ts index e2e38fb300..ab5e0e1f96 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/index.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/index.ts @@ -1,3 +1 @@ -import { manifest } from './manifest'; - -export default manifest; +export * from './manifest'; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/manifest.ts b/webapp/packages/plugin-data-spreadsheet-new/src/manifest.ts index 6c3fb4aa01..e1238fe1c9 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/manifest.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/manifest.ts @@ -16,7 +16,7 @@ import { DataGridSettingsService } from './DataGridSettingsService'; import { LocaleService } from './LocaleService'; import { SpreadsheetBootstrap } from './SpreadsheetBootstrap'; -export const manifest: PluginManifest = { +export const dataSpreadsheetNewManifest: PluginManifest = { info: { name: 'New spreadsheet implementation' }, providers: [ SpreadsheetBootstrap, diff --git a/webapp/packages/plugin-data-spreadsheet-new/tsconfig.json b/webapp/packages/plugin-data-spreadsheet-new/tsconfig.json index bd4ed8f7d0..58e4e2b7ac 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/tsconfig.json +++ b/webapp/packages/plugin-data-spreadsheet-new/tsconfig.json @@ -1,10 +1,67 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-react-data-grid" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-data-viewer-result-set-grouping/package.json b/webapp/packages/plugin-data-viewer-result-set-grouping/package.json index 3940a8659c..e533f68fa4 100644 --- a/webapp/packages/plugin-data-viewer-result-set-grouping/package.json +++ b/webapp/packages/plugin-data-viewer-result-set-grouping/package.json @@ -1,30 +1,33 @@ { "name": "@cloudbeaver/plugin-data-viewer-result-set-grouping", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-data-viewer": "~0.1.0", "@cloudbeaver/plugin-sql-editor": "~0.1.0", - "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { @@ -32,5 +35,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVGroupingColumnEditorDialog/DVGroupingColumnEditorDialog.tsx b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVGroupingColumnEditorDialog/DVGroupingColumnEditorDialog.tsx index 1adc5b4a86..9dac44ff19 100644 --- a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVGroupingColumnEditorDialog/DVGroupingColumnEditorDialog.tsx +++ b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVGroupingColumnEditorDialog/DVGroupingColumnEditorDialog.tsx @@ -8,8 +8,19 @@ import { observer } from 'mobx-react-lite'; import { useState } from 'react'; -import { Button, Container, Group, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Container, + Group, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import type { IResultSetGroupingData } from '../DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING'; import styles from './DVGroupingColumnEditorDialog.m.css'; diff --git a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVResultSetGroupingPresentation.tsx b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVResultSetGroupingPresentation.tsx index 62d9456b3d..87feae22c0 100644 --- a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVResultSetGroupingPresentation.tsx +++ b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DVResultSetGroupingPresentation.tsx @@ -10,8 +10,9 @@ import { useContext, useState } from 'react'; import styled, { css, use } from 'reshadow'; import { useTranslate } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { useTabLocalState } from '@cloudbeaver/core-ui'; -import { CaptureViewContext, useDataContext } from '@cloudbeaver/core-view'; +import { CaptureViewContext } from '@cloudbeaver/core-view'; import { DataPresentationComponent, IDatabaseResultSet, TableViewerLoader } from '@cloudbeaver/plugin-data-viewer'; import { DATA_CONTEXT_DV_DDM_RS_GROUPING } from './DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING'; diff --git a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING.ts b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING.ts index c4bdba6e25..5f7bba7c9d 100644 --- a/webapp/packages/plugin-data-viewer-result-set-grouping/src/DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING.ts +++ b/webapp/packages/plugin-data-viewer-result-set-grouping/src/DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export interface IResultSetGroupingData { getColumns(): string[]; diff --git a/webapp/packages/plugin-data-viewer-result-set-grouping/tsconfig.json b/webapp/packages/plugin-data-viewer-result-set-grouping/tsconfig.json index bd4ed8f7d0..eb281367a9 100644 --- a/webapp/packages/plugin-data-viewer-result-set-grouping/tsconfig.json +++ b/webapp/packages/plugin-data-viewer-result-set-grouping/tsconfig.json @@ -1,10 +1,58 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-data-viewer/package.json b/webapp/packages/plugin-data-viewer/package.json index ef76eac4c8..1f7f76c41f 100644 --- a/webapp/packages/plugin-data-viewer/package.json +++ b/webapp/packages/plugin-data-viewer/package.json @@ -1,30 +1,31 @@ { "name": "@cloudbeaver/plugin-data-viewer", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", + "@cloudbeaver/plugin-codemirror6": "~0.1.0", "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", "@cloudbeaver/plugin-object-viewer": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", @@ -32,8 +33,10 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", @@ -45,5 +48,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-data-viewer/src/DataViewerDataChangeConfirmationService.ts b/webapp/packages/plugin-data-viewer/src/DataViewerDataChangeConfirmationService.ts index 6c5acd482d..d553a9d841 100644 --- a/webapp/packages/plugin-data-viewer/src/DataViewerDataChangeConfirmationService.ts +++ b/webapp/packages/plugin-data-viewer/src/DataViewerDataChangeConfirmationService.ts @@ -5,8 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter, IExecutionContextProvider } from '@cloudbeaver/core-executor'; diff --git a/webapp/packages/plugin-data-viewer/src/DataViewerSettingsService.test.ts b/webapp/packages/plugin-data-viewer/src/DataViewerSettingsService.test.ts index ce3f0e7a45..9d5f53144d 100644 --- a/webapp/packages/plugin-data-viewer/src/DataViewerSettingsService.test.ts +++ b/webapp/packages/plugin-data-viewer/src/DataViewerSettingsService.test.ts @@ -7,23 +7,66 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; -import datasourceContextSwitch from '@cloudbeaver/plugin-datasource-context-switch'; -import navigationTabs from '@cloudbeaver/plugin-navigation-tabs'; -import navigationTree from '@cloudbeaver/plugin-navigation-tree'; -import objectViewer from '@cloudbeaver/plugin-object-viewer'; +import { coreAdministrationManifest } from '@cloudbeaver/core-administration'; +import { coreAppManifest } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { navigationTreePlugin } from '@cloudbeaver/plugin-navigation-tree'; +import { objectViewerManifest } from '@cloudbeaver/plugin-object-viewer'; +import { createApp } from '@cloudbeaver/tests-runner'; import { DataViewerSettings, DataViewerSettingsService } from './DataViewerSettingsService'; -import { manifest } from './manifest'; +import { dataViewerManifest } from './manifest'; const endpoint = createGQLEndpoint(); -const app = createApp(datasourceContextSwitch, navigationTree, navigationTabs, objectViewer, manifest); +const app = createApp( + dataViewerManifest, + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreBrowserManifest, + coreSettingsManifest, + coreViewManifest, + coreAuthenticationManifest, + coreProjectsManifest, + coreUIManifest, + coreRoutingManifest, + coreAdministrationManifest, + coreConnectionsManifest, + coreDialogsManifest, + coreNavigationTree, + coreAppManifest, + coreThemingManifest, + datasourceContextSwitchPluginManifest, + navigationTreePlugin, + navigationTabsPlugin, + objectViewerManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-data-viewer/src/DataViewerTabService.ts b/webapp/packages/plugin-data-viewer/src/DataViewerTabService.ts index 51367e05a8..72c6b36ec1 100644 --- a/webapp/packages/plugin-data-viewer/src/DataViewerTabService.ts +++ b/webapp/packages/plugin-data-viewer/src/DataViewerTabService.ts @@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter, IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { INodeNavigationData, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { ITab, NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs'; import { DBObjectPageService, IObjectViewerTabState, isObjectViewerTab, ObjectPage, ObjectViewerTabService } from '@cloudbeaver/plugin-object-viewer'; diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/DataContext/DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/DataContext/DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY.ts index 1b1b7eae06..95991dcffe 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/DataContext/DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/DataContext/DATA_CONTEXT_DV_DDM_RS_COLUMN_KEY.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { IResultSetColumnKey } from '../IResultSetDataKey'; diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM.ts index adf6271e05..95c4a6d980 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { IDatabaseDataModel } from '../IDatabaseDataModel'; import type { IDatabaseDataOptions } from '../IDatabaseDataOptions'; diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX.ts index 150409518e..29f1a73916 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_DV_DDM_RESULT_INDEX = createDataContext('data-viewer-database-data-model-result-index'); diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/AutoRefreshSettingsDialog.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/AutoRefreshSettingsDialog.tsx index 02eb42b9af..32737807f1 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/AutoRefreshSettingsDialog.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/AutoRefreshSettingsDialog.tsx @@ -8,8 +8,23 @@ import { observer } from 'mobx-react-lite'; import { useRef } from 'react'; -import { Button, Container, FieldCheckbox, Fill, Form, Group, InputField, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Container, + FieldCheckbox, + Fill, + Form, + Group, + InputField, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import style from './AutoRefreshSettingsDialog.m.css'; import type { IAutoRefreshSettings } from './IAutoRefreshSettings'; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooter.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooter.tsx index 2bf3b50bea..db21fd2988 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooter.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooter.tsx @@ -10,8 +10,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import styled, { css, use } from 'reshadow'; import { Form, getComputed, ToolsPanel } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; -import type { IDataContext } from '@cloudbeaver/core-view'; import type { IDatabaseDataModel } from '../../DatabaseDataModel/IDatabaseDataModel'; import { DataViewerSettingsService } from '../../DataViewerSettingsService'; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.tsx index b765735442..c672134122 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.tsx @@ -8,9 +8,10 @@ import { observer } from 'mobx-react-lite'; import { s, useS } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { MenuBar } from '@cloudbeaver/core-ui'; -import { IDataContext, useMenu } from '@cloudbeaver/core-view'; +import { useMenu } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_DV_DDM } from '../../../DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM'; import { DATA_CONTEXT_DV_DDM_RESULT_INDEX } from '../../../DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX'; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuItem.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuItem.tsx index d1997593aa..5634c39415 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuItem.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuItem.tsx @@ -9,8 +9,8 @@ import { observer } from 'mobx-react-lite'; import type { ButtonHTMLAttributes } from 'react'; import styled, { css, use } from 'reshadow'; -import { IconOrImage, ToolsAction, useTranslate } from '@cloudbeaver/core-blocks'; -import { IMenuItem, MenuTrigger } from '@cloudbeaver/core-dialogs'; +import { IconOrImage, MenuTrigger, ToolsAction, useTranslate } from '@cloudbeaver/core-blocks'; +import type { IMenuItem } from '@cloudbeaver/core-dialogs'; type Props = ButtonHTMLAttributes & { menuItem: IMenuItem; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/DATA_CONTEXT_DATA_VIEWER_SIMPLE.ts b/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/DATA_CONTEXT_DATA_VIEWER_SIMPLE.ts index 86de5ecb3e..5fb848270c 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/DATA_CONTEXT_DATA_VIEWER_SIMPLE.ts +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/DATA_CONTEXT_DATA_VIEWER_SIMPLE.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_DATA_VIEWER_SIMPLE = createDataContext('data-viewer-database-simple'); diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableViewer.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableViewer.tsx index 168d57c1a9..572c2fc3ae 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableViewer.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableViewer.tsx @@ -22,9 +22,9 @@ import { useS, useSplitUserState, } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { ResultDataFormat } from '@cloudbeaver/core-sdk'; -import type { IDataContext } from '@cloudbeaver/core-view'; import { ResultSetConstraintAction } from '../DatabaseDataModel/Actions/ResultSet/ResultSetConstraintAction'; import { DataPresentationService, DataPresentationType } from '../DataPresentationService'; @@ -38,7 +38,7 @@ import { TableToolsPanel } from './TableToolsPanel'; import style from './TableViewer.m.css'; import { TableViewerStorageService } from './TableViewerStorageService'; -interface Props { +export interface TableViewerProps { tableId: string; resultIndex: number | undefined; presentationId: string | undefined; @@ -51,7 +51,7 @@ interface Props { onValuePresentationChange: (id: string | null) => void; } -export const TableViewer = observer( +export const TableViewer = observer( forwardRef(function TableViewer( { tableId, diff --git a/webapp/packages/plugin-data-viewer/src/index.ts b/webapp/packages/plugin-data-viewer/src/index.ts index 5706e5762f..cdc7eff691 100644 --- a/webapp/packages/plugin-data-viewer/src/index.ts +++ b/webapp/packages/plugin-data-viewer/src/index.ts @@ -1,6 +1,4 @@ -import { manifest } from './manifest'; - -export default manifest; +export * from './manifest'; export * from './DatabaseDataModel/Actions/Document/DocumentDataAction'; export * from './DatabaseDataModel/Actions/Document/DocumentEditAction'; diff --git a/webapp/packages/plugin-data-viewer/src/manifest.ts b/webapp/packages/plugin-data-viewer/src/manifest.ts index 07f2004bbf..9c600e801c 100644 --- a/webapp/packages/plugin-data-viewer/src/manifest.ts +++ b/webapp/packages/plugin-data-viewer/src/manifest.ts @@ -25,7 +25,7 @@ import { ImageValuePresentationBootstrap } from './ValuePanelPresentation/ImageV import { TextValuePresentationBootstrap } from './ValuePanelPresentation/TextValue/TextValuePresentationBootstrap'; import { TextValuePresentationService } from './ValuePanelPresentation/TextValue/TextValuePresentationService'; -export const manifest: PluginManifest = { +export const dataViewerManifest: PluginManifest = { info: { name: 'Data Viewer Plugin', }, diff --git a/webapp/packages/plugin-data-viewer/tsconfig.json b/webapp/packages/plugin-data-viewer/tsconfig.json index bd4ed8f7d0..4148a5b36f 100644 --- a/webapp/packages/plugin-data-viewer/tsconfig.json +++ b/webapp/packages/plugin-data-viewer/tsconfig.json @@ -1,10 +1,91 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-codemirror6" + }, + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-object-viewer" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-datasource-context-switch/package.json b/webapp/packages/plugin-datasource-context-switch/package.json index daf33deb68..3da295a95f 100644 --- a/webapp/packages/plugin-datasource-context-switch/package.json +++ b/webapp/packages/plugin-datasource-context-switch/package.json @@ -1,24 +1,25 @@ { "name": "@cloudbeaver/plugin-datasource-context-switch", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-connections": "~0.1.0", "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", "@cloudbeaver/plugin-top-app-bar": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", @@ -27,8 +28,7 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" @@ -38,5 +38,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerBootstrap.ts b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerBootstrap.ts index 6c25038a2e..2bfa8e7dd4 100644 --- a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerBootstrap.ts +++ b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerBootstrap.ts @@ -18,7 +18,7 @@ import { import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { EObjectFeature, NodeManagerUtils } from '@cloudbeaver/core-navigation-tree'; -import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { OptionsPanelService } from '@cloudbeaver/core-ui'; import { DATA_CONTEXT_MENU, MenuBaseItem, menuExtractItems, MenuSeparatorItem, MenuService } from '@cloudbeaver/core-view'; import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar'; diff --git a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerService.ts b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerService.ts index b44ac7f382..aa4899d734 100644 --- a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerService.ts +++ b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSchemaManagerService.ts @@ -41,7 +41,7 @@ import { isProjectSetter, isProjectSetterState, } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { ITab, NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs'; export interface IConnectionInfo { diff --git a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIcon.tsx b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIcon.tsx index 704335862c..6ebd824d23 100644 --- a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIcon.tsx +++ b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIcon.tsx @@ -18,7 +18,7 @@ import { useStyles, } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, DBDriverResource } from '@cloudbeaver/core-connections'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { default as ConnectionImageWithMaskSvgBackgroundStyles } from './ConnectionImageWithMask.m.css'; diff --git a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIconSmall.tsx b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIconSmall.tsx index d89f903f1a..2e4c6e5a91 100644 --- a/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIconSmall.tsx +++ b/webapp/packages/plugin-datasource-context-switch/src/ConnectionSchemaManager/ConnectionSelector/ConnectionIconSmall.tsx @@ -18,7 +18,7 @@ import { useStyles, } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, DBDriverResource } from '@cloudbeaver/core-connections'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { default as ConnectionImageWithMaskSvgBackgroundStyles } from './ConnectionImageWithMask.m.css'; diff --git a/webapp/packages/plugin-datasource-context-switch/src/index.ts b/webapp/packages/plugin-datasource-context-switch/src/index.ts index b013c543a9..ed176fc2aa 100644 --- a/webapp/packages/plugin-datasource-context-switch/src/index.ts +++ b/webapp/packages/plugin-datasource-context-switch/src/index.ts @@ -1,6 +1,4 @@ -import { datasourceContextSwitchPluginManifest } from './manifest'; +export * from './manifest'; export * from './ConnectionSchemaManager/ConnectionSchemaManagerBootstrap'; export * from './ConnectionSchemaManager/ConnectionSchemaManagerService'; - -export default datasourceContextSwitchPluginManifest; diff --git a/webapp/packages/plugin-datasource-context-switch/tsconfig.json b/webapp/packages/plugin-datasource-context-switch/tsconfig.json index bd4ed8f7d0..309e66f0d0 100644 --- a/webapp/packages/plugin-datasource-context-switch/tsconfig.json +++ b/webapp/packages/plugin-datasource-context-switch/tsconfig.json @@ -1,10 +1,67 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-ddl-viewer/package.json b/webapp/packages/plugin-ddl-viewer/package.json index da50dfd97a..90755f9216 100644 --- a/webapp/packages/plugin-ddl-viewer/package.json +++ b/webapp/packages/plugin-ddl-viewer/package.json @@ -1,29 +1,33 @@ { "name": "@cloudbeaver/plugin-ddl-viewer", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/plugin-codemirror6": "~0.1.0", + "@cloudbeaver/plugin-navigation-tree": "~0.1.0", "@cloudbeaver/plugin-sql-editor": "~0.1.0", "@cloudbeaver/plugin-sql-editor-navigation-tab": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/plugin-sql-editor-new": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", @@ -34,5 +38,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_NODE.ts b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_NODE.ts index c6e5724c41..0e6a73d4aa 100644 --- a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_NODE.ts +++ b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_NODE.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_DDL_VIEWER_NODE = createDataContext('ddl-node'); diff --git a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_VALUE.ts b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_VALUE.ts index b9fa3043e1..fc28ba4daa 100644 --- a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_VALUE.ts +++ b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DATA_CONTEXT_DDL_VIEWER_VALUE.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_DDL_VIEWER_VALUE = createDataContext('ddl-value'); diff --git a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DdlResource.ts b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DdlResource.ts index a4cb20baae..a2a9c351b7 100644 --- a/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DdlResource.ts +++ b/webapp/packages/plugin-ddl-viewer/src/DdlViewer/DdlResource.ts @@ -7,7 +7,8 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { NavNodeInfoResource } from '@cloudbeaver/core-navigation-tree'; -import { CachedMapResource, GraphQLService, isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { CachedMapResource, isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class DdlResource extends CachedMapResource { diff --git a/webapp/packages/plugin-ddl-viewer/src/ExtendedDDLViewer/ExtendedDDLResource.ts b/webapp/packages/plugin-ddl-viewer/src/ExtendedDDLViewer/ExtendedDDLResource.ts index aec7f9b57e..f419ddd819 100644 --- a/webapp/packages/plugin-ddl-viewer/src/ExtendedDDLViewer/ExtendedDDLResource.ts +++ b/webapp/packages/plugin-ddl-viewer/src/ExtendedDDLViewer/ExtendedDDLResource.ts @@ -7,7 +7,8 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { NavNodeInfoResource } from '@cloudbeaver/core-navigation-tree'; -import { CachedMapResource, GraphQLService, isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { CachedMapResource, isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class ExtendedDDLResource extends CachedMapResource { diff --git a/webapp/packages/plugin-ddl-viewer/tsconfig.json b/webapp/packages/plugin-ddl-viewer/tsconfig.json index bd4ed8f7d0..1e095dae7a 100644 --- a/webapp/packages/plugin-ddl-viewer/tsconfig.json +++ b/webapp/packages/plugin-ddl-viewer/tsconfig.json @@ -1,10 +1,67 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-codemirror6" + }, + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-sql-editor-navigation-tab" + }, + { + "path": "..\\plugin-sql-editor-new" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-devtools/package.json b/webapp/packages/plugin-devtools/package.json index 6df4b0c193..bd2eecaf76 100644 --- a/webapp/packages/plugin-devtools/package.json +++ b/webapp/packages/plugin-devtools/package.json @@ -1,28 +1,30 @@ { "name": "@cloudbeaver/plugin-devtools", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-settings-menu": "~0.1.0", "@cloudbeaver/plugin-user-profile": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" @@ -32,5 +34,6 @@ "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-devtools/src/ContextMenu/DATA_CONTEXT_MENU_SEARCH.ts b/webapp/packages/plugin-devtools/src/ContextMenu/DATA_CONTEXT_MENU_SEARCH.ts index f85befec58..23b9729de9 100644 --- a/webapp/packages/plugin-devtools/src/ContextMenu/DATA_CONTEXT_MENU_SEARCH.ts +++ b/webapp/packages/plugin-devtools/src/ContextMenu/DATA_CONTEXT_MENU_SEARCH.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_MENU_SEARCH = createDataContext('menu-local', () => ''); diff --git a/webapp/packages/plugin-devtools/src/PluginBootstrap.ts b/webapp/packages/plugin-devtools/src/PluginBootstrap.ts index c0fd979d96..ac43aac65e 100644 --- a/webapp/packages/plugin-devtools/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-devtools/src/PluginBootstrap.ts @@ -7,8 +7,8 @@ */ import { EAdminPermission } from '@cloudbeaver/core-authentication'; import { App, Bootstrap, DIService, injectable, IServiceConstructor } from '@cloudbeaver/core-di'; +import { CachedResource } from '@cloudbeaver/core-resource'; import { PermissionsService } from '@cloudbeaver/core-root'; -import { CachedResource } from '@cloudbeaver/core-sdk'; import { ActionService, DATA_CONTEXT_MENU, DATA_CONTEXT_SUBMENU_ITEM, MenuBaseItem, MenuService } from '@cloudbeaver/core-view'; import { TOP_NAV_BAR_SETTINGS_MENU } from '@cloudbeaver/plugin-settings-menu'; import { MENU_USER_PROFILE } from '@cloudbeaver/plugin-user-profile'; diff --git a/webapp/packages/plugin-devtools/tsconfig.json b/webapp/packages/plugin-devtools/tsconfig.json index bd4ed8f7d0..0650e5585b 100644 --- a/webapp/packages/plugin-devtools/tsconfig.json +++ b/webapp/packages/plugin-devtools/tsconfig.json @@ -1,10 +1,55 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\plugin-user-profile" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-gis-viewer/package.json b/webapp/packages/plugin-gis-viewer/package.json index f3d0bcd372..e736c44641 100644 --- a/webapp/packages/plugin-gis-viewer/package.json +++ b/webapp/packages/plugin-gis-viewer/package.json @@ -1,30 +1,31 @@ { "name": "@cloudbeaver/plugin-gis-viewer", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "leaflet": "~1.9.4", + "react-leaflet": "~4.2.1", + "wellknown": "~0.5.0", "@cloudbeaver/plugin-data-viewer": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", - "leaflet": "~1.9.4", - "react-leaflet": "~4.2.1", - "wellknown": "~0.5.0" + "@cloudbeaver/core-ui": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", diff --git a/webapp/packages/plugin-gis-viewer/tsconfig.json b/webapp/packages/plugin-gis-viewer/tsconfig.json index bd4ed8f7d0..a3c285114a 100644 --- a/webapp/packages/plugin-gis-viewer/tsconfig.json +++ b/webapp/packages/plugin-gis-viewer/tsconfig.json @@ -1,10 +1,40 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-help/package.json b/webapp/packages/plugin-help/package.json index 56ea30ffb4..83ce0e2522 100644 --- a/webapp/packages/plugin-help/package.json +++ b/webapp/packages/plugin-help/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-help", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-navigation-tree": "~0.1.0", @@ -21,18 +22,20 @@ "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-routing": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", - "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/core-settings": "~0.1.0" + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-routing": "~0.1.0", + "@cloudbeaver/core-settings": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0", + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx b/webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx index ca9ed1f6fc..e69a84f081 100644 --- a/webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx +++ b/webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx @@ -5,8 +5,21 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { Button, Container, Group, GroupTitle, Link, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Container, + Group, + GroupTitle, + Link, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { Shortcut } from './Shortcut'; import { DATA_VIEWER_SHORTCUTS, NAVIGATION_TREE_SHORTCUTS, SQL_EDITOR_SHORTCUTS } from './SHORTCUTS_DATA'; diff --git a/webapp/packages/plugin-help/tsconfig.json b/webapp/packages/plugin-help/tsconfig.json index bd4ed8f7d0..3109018d45 100644 --- a/webapp/packages/plugin-help/tsconfig.json +++ b/webapp/packages/plugin-help/tsconfig.json @@ -1,10 +1,61 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-localization/package.json b/webapp/packages/plugin-localization/package.json index 4afe3ade01..714e8d8df9 100644 --- a/webapp/packages/plugin-localization/package.json +++ b/webapp/packages/plugin-localization/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-localization", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-settings-menu": "~0.1.0", @@ -27,5 +28,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-localization/tsconfig.json b/webapp/packages/plugin-localization/tsconfig.json index bd4ed8f7d0..d1816d7975 100644 --- a/webapp/packages/plugin-localization/tsconfig.json +++ b/webapp/packages/plugin-localization/tsconfig.json @@ -1,10 +1,37 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-log-viewer/package.json b/webapp/packages/plugin-log-viewer/package.json index 2f2edd300f..84e33111be 100644 --- a/webapp/packages/plugin-log-viewer/package.json +++ b/webapp/packages/plugin-log-viewer/package.json @@ -1,31 +1,32 @@ { "name": "@cloudbeaver/plugin-log-viewer", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-tools-panel": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", @@ -37,5 +38,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts index 5bd9258d16..d279f0bdd8 100644 --- a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts +++ b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts @@ -7,23 +7,48 @@ */ import '@testing-library/jest-dom'; -import { CoreSettingsService } from '@cloudbeaver/core-app'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; -import administrationPlugin from '@cloudbeaver/plugin-administration'; -import toolsPanel from '@cloudbeaver/plugin-tools-panel'; -import topAppBarPlugin from '@cloudbeaver/plugin-top-app-bar'; +import { coreAppManifest, CoreSettingsService } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import toolsPanelPlugin from '@cloudbeaver/plugin-tools-panel'; +import { createApp } from '@cloudbeaver/tests-runner'; import { logViewerPlugin } from '../manifest'; import { LogViewerSettings, LogViewerSettingsService } from './LogViewerSettingsService'; const endpoint = createGQLEndpoint(); -const app = createApp(administrationPlugin, topAppBarPlugin, toolsPanel, logViewerPlugin); +const app = createApp( + logViewerPlugin, + toolsPanelPlugin, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreViewManifest, + coreAuthenticationManifest, + coreSettingsManifest, + coreBrowserManifest, + coreLocalizationManifest, + coreEventsManifest, + coreAppManifest, + coreRoutingManifest, + coreThemingManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts b/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts index d7c0a675a3..b157d90e9a 100644 --- a/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts +++ b/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts @@ -10,8 +10,9 @@ import { runInAction } from 'mobx'; import { CoreSettingsService } from '@cloudbeaver/core-app'; import { AppAuthService } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { ServerEventId, SessionDataResource } from '@cloudbeaver/core-root'; -import { CachedDataResource, GraphQLService, LogEntry } from '@cloudbeaver/core-sdk'; +import { GraphQLService, LogEntry } from '@cloudbeaver/core-sdk'; import { uuid } from '@cloudbeaver/core-utils'; import { LogViewerSettingsService } from './LogViewer/LogViewerSettingsService'; diff --git a/webapp/packages/plugin-log-viewer/tsconfig.json b/webapp/packages/plugin-log-viewer/tsconfig.json index bd4ed8f7d0..5601954486 100644 --- a/webapp/packages/plugin-log-viewer/tsconfig.json +++ b/webapp/packages/plugin-log-viewer/tsconfig.json @@ -1,10 +1,61 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-tools-panel" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-navigation-tabs/package.json b/webapp/packages/plugin-navigation-tabs/package.json index c207a36068..541ef2f71e 100644 --- a/webapp/packages/plugin-navigation-tabs/package.json +++ b/webapp/packages/plugin-navigation-tabs/package.json @@ -1,40 +1,43 @@ { "name": "@cloudbeaver/plugin-navigation-tabs", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-administration": "~0.1.0", + "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-extensions": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/core-projects": "~0.1.0" + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsService.ts b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsService.ts index 61a5167c93..7fc78c0aff 100644 --- a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsService.ts +++ b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsService.ts @@ -13,7 +13,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; import { ProjectsService } from '@cloudbeaver/core-projects'; -import { resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { LocalStorageSaveService } from '@cloudbeaver/core-settings'; import { isArraysEqual, MetadataMap, TempMap } from '@cloudbeaver/core-utils'; import { ACTION_OPEN_IN_TAB, IActiveView, View } from '@cloudbeaver/core-view'; diff --git a/webapp/packages/plugin-navigation-tabs/src/PluginBootstrap.ts b/webapp/packages/plugin-navigation-tabs/src/PluginBootstrap.ts index 5cb98d6fdd..fba333d43f 100644 --- a/webapp/packages/plugin-navigation-tabs/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-navigation-tabs/src/PluginBootstrap.ts @@ -5,15 +5,25 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import React from 'react'; + +import { AppScreenService } from '@cloudbeaver/core-app'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; +const NavigationTabsBar = React.lazy(async () => { + const { NavigationTabsBar } = await import('./NavigationTabs/NavigationTabsBar'); + return { default: NavigationTabsBar }; +}); + @injectable() export class PluginBootstrap extends Bootstrap { - constructor() { + constructor(private readonly appScreenService: AppScreenService) { super(); } - register(): void | Promise {} + register(): void | Promise { + this.appScreenService.rightAreaTop.add(NavigationTabsBar); + } load(): void | Promise {} } diff --git a/webapp/packages/plugin-navigation-tabs/src/index.ts b/webapp/packages/plugin-navigation-tabs/src/index.ts index a542d8fb6e..92b114aae1 100644 --- a/webapp/packages/plugin-navigation-tabs/src/index.ts +++ b/webapp/packages/plugin-navigation-tabs/src/index.ts @@ -1,4 +1,4 @@ -import { navigationTabsPlugin } from './manifest'; +export * from './manifest'; export * from './NavigationTabs/NavigationTabsService'; export * from './NavigationTabs/TabNavigationContext'; @@ -6,5 +6,3 @@ export * from './NavigationTabs/ITab'; export * from './NavigationTabs/TabHandler'; export * from './NavigationTabs/NavigationTabsBar/Tabs/useTab'; export * from './NavigationTabs/NavigationTabsBar'; - -export default navigationTabsPlugin; diff --git a/webapp/packages/plugin-navigation-tabs/tsconfig.json b/webapp/packages/plugin-navigation-tabs/tsconfig.json index bd4ed8f7d0..e8bf0a8ba4 100644 --- a/webapp/packages/plugin-navigation-tabs/tsconfig.json +++ b/webapp/packages/plugin-navigation-tabs/tsconfig.json @@ -1,10 +1,67 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-navigation-tree-filters/package.json b/webapp/packages/plugin-navigation-tree-filters/package.json index a6272faf1a..b61b9fa07e 100644 --- a/webapp/packages/plugin-navigation-tree-filters/package.json +++ b/webapp/packages/plugin-navigation-tree-filters/package.json @@ -1,20 +1,22 @@ { "name": "@cloudbeaver/plugin-navigation-tree-filters", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-blocks": "~0.1.0", @@ -23,6 +25,8 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { @@ -31,5 +35,6 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/plugin-navigation-tree-filters/src/NavigationTreeFiltersDialog/NavigationTreeFiltersDialog.tsx b/webapp/packages/plugin-navigation-tree-filters/src/NavigationTreeFiltersDialog/NavigationTreeFiltersDialog.tsx index 20c3046093..dae8cec63f 100644 --- a/webapp/packages/plugin-navigation-tree-filters/src/NavigationTreeFiltersDialog/NavigationTreeFiltersDialog.tsx +++ b/webapp/packages/plugin-navigation-tree-filters/src/NavigationTreeFiltersDialog/NavigationTreeFiltersDialog.tsx @@ -7,9 +7,21 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, Group, Loader, s, useAutoLoad, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Group, + Loader, + s, + useAutoLoad, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { type NavNode, NavTreeResource } from '@cloudbeaver/core-navigation-tree'; diff --git a/webapp/packages/plugin-navigation-tree-filters/tsconfig.json b/webapp/packages/plugin-navigation-tree-filters/tsconfig.json index bd4ed8f7d0..7937c231df 100644 --- a/webapp/packages/plugin-navigation-tree-filters/tsconfig.json +++ b/webapp/packages/plugin-navigation-tree-filters/tsconfig.json @@ -1,10 +1,49 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-navigation-tree-rm/package.json b/webapp/packages/plugin-navigation-tree-rm/package.json index 1f056c9b5b..eaf906ed77 100644 --- a/webapp/packages/plugin-navigation-tree-rm/package.json +++ b/webapp/packages/plugin-navigation-tree-rm/package.json @@ -1,24 +1,31 @@ { "name": "@cloudbeaver/plugin-navigation-tree-rm", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-resource-manager": "~0.1.0", "@cloudbeaver/plugin-navigation-tree": "~0.1.0", + "@cloudbeaver/plugin-projects": "~0.1.0", + "@cloudbeaver/plugin-resource-manager": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", @@ -26,9 +33,8 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-resource-manager": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, @@ -38,5 +44,6 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts index 5f3891f5bb..9e487e0d8d 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts @@ -7,6 +7,7 @@ */ import { UserInfoResource } from '@cloudbeaver/core-authentication'; import { CONNECTION_FOLDER_NAME_VALIDATION } from '@cloudbeaver/core-connections'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; @@ -23,6 +24,13 @@ import { ProjectsNavNodeService, } from '@cloudbeaver/core-navigation-tree'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; +import { + CachedMapAllKey, + CachedTreeChildrenKey, + getCachedMapResourceLoaderState, + resourceKeyList, + ResourceKeyUtils, +} from '@cloudbeaver/core-resource'; import { getRmResourceKey, getRmResourcePath, @@ -31,9 +39,8 @@ import { ResourceManagerResource, RESOURCES_NODE_PATH, } from '@cloudbeaver/core-resource-manager'; -import { CachedMapAllKey, CachedTreeChildrenKey, getCachedMapResourceLoaderState, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; import { createPath, getPathParent } from '@cloudbeaver/core-utils'; -import { ACTION_NEW_FOLDER, ActionService, DATA_CONTEXT_MENU, IAction, IDataContextProvider, MenuService } from '@cloudbeaver/core-view'; +import { ACTION_NEW_FOLDER, ActionService, DATA_CONTEXT_MENU, IAction, MenuService } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_ELEMENTS_TREE, MENU_ELEMENTS_TREE_TOOLS } from '@cloudbeaver/plugin-navigation-tree'; import { FolderDialog } from '@cloudbeaver/plugin-projects'; import { ResourceManagerService } from '@cloudbeaver/plugin-resource-manager'; diff --git a/webapp/packages/plugin-navigation-tree-rm/src/NavResourceNodeService.ts b/webapp/packages/plugin-navigation-tree-rm/src/NavResourceNodeService.ts index d83898d272..2e45dd0714 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/NavResourceNodeService.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/NavResourceNodeService.ts @@ -5,8 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { ConfirmationDialogDelete } from '@cloudbeaver/core-blocks'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { ResourceManagerResource } from '@cloudbeaver/core-resource-manager'; import { getPathName } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-navigation-tree-rm/src/NavTreeRMContextMenuService.ts b/webapp/packages/plugin-navigation-tree-rm/src/NavTreeRMContextMenuService.ts index d879df8b56..fa22495661 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/NavTreeRMContextMenuService.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/NavTreeRMContextMenuService.ts @@ -5,8 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { RenameDialog } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, DialogueStateResult, RenameDialog } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { DATA_CONTEXT_NAV_NODE, ENodeFeature } from '@cloudbeaver/core-navigation-tree'; diff --git a/webapp/packages/plugin-navigation-tree-rm/src/Tree/DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID.ts b/webapp/packages/plugin-navigation-tree-rm/src/Tree/DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID.ts index 56a558b23e..fb0559da0f 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/Tree/DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/Tree/DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID = createDataContext('resource-manager-tree-resource-type-id'); diff --git a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeProjectFilter.ts b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeProjectFilter.ts index c0a560552a..8c55e12745 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeProjectFilter.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeProjectFilter.ts @@ -7,8 +7,8 @@ */ import type { NavNode, NavNodeInfoResource, NavTreeResource, ProjectsNavNodeService } from '@cloudbeaver/core-navigation-tree'; import type { ProjectsService } from '@cloudbeaver/core-projects'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { NAV_NODE_TYPE_RM_PROJECT, RESOURCES_NODE_PATH } from '@cloudbeaver/core-resource-manager'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; import { createPath, isDefined } from '@cloudbeaver/core-utils'; import type { IElementsTreeFilter } from '@cloudbeaver/plugin-navigation-tree'; import type { ResourceManagerService } from '@cloudbeaver/plugin-resource-manager'; diff --git a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeResourceTypeFilter.ts b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeResourceTypeFilter.ts index acd912f8cc..98ad14cdb5 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeResourceTypeFilter.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ProjectsRenderer/navigationTreeResourceTypeFilter.ts @@ -7,8 +7,8 @@ */ import type { NavNode, NavNodeInfoResource, ProjectsNavNodeService } from '@cloudbeaver/core-navigation-tree'; import { isResourceOfType, ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { NAV_NODE_TYPE_RM_RESOURCE } from '@cloudbeaver/core-resource-manager'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; import { isNotNullDefined } from '@cloudbeaver/core-utils'; import type { IElementsTreeFilter } from '@cloudbeaver/plugin-navigation-tree'; diff --git a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ResourceManagerTree.tsx b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ResourceManagerTree.tsx index 1978246aea..83f4275d29 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/Tree/ResourceManagerTree.tsx +++ b/webapp/packages/plugin-navigation-tree-rm/src/Tree/ResourceManagerTree.tsx @@ -12,8 +12,8 @@ import { getComputed, s, useResource, useS, useUserData } from '@cloudbeaver/cor import { useService } from '@cloudbeaver/core-di'; import { NavNodeInfoResource, NavTreeResource, ProjectsNavNodeService } from '@cloudbeaver/core-navigation-tree'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import { getRmResourcePath, ResourceManagerResource, RESOURCES_NODE_PATH } from '@cloudbeaver/core-resource-manager'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; import { CaptureView } from '@cloudbeaver/core-view'; import { diff --git a/webapp/packages/plugin-navigation-tree-rm/tsconfig.json b/webapp/packages/plugin-navigation-tree-rm/tsconfig.json index e3af542617..82770d202e 100644 --- a/webapp/packages/plugin-navigation-tree-rm/tsconfig.json +++ b/webapp/packages/plugin-navigation-tree-rm/tsconfig.json @@ -1,9 +1,76 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-projects" + }, + { + "path": "..\\plugin-resource-manager" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-resource-manager" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-navigation-tree/package.json b/webapp/packages/plugin-navigation-tree/package.json index ace28f02c7..7842fd5d54 100644 --- a/webapp/packages/plugin-navigation-tree/package.json +++ b/webapp/packages/plugin-navigation-tree/package.json @@ -1,39 +1,39 @@ { "name": "@cloudbeaver/plugin-navigation-tree", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-connections": "~0.1.0", "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", - "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", @@ -45,5 +45,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ConnectionGroup/navigationTreeConnectionGroupFilter.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ConnectionGroup/navigationTreeConnectionGroupFilter.ts index 3cc6721896..ed70320ca1 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ConnectionGroup/navigationTreeConnectionGroupFilter.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ConnectionGroup/navigationTreeConnectionGroupFilter.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import { ENodeFeature, EObjectFeature, type NavNode, type NavNodeInfoResource, ROOT_NODE_PATH } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import type { IElementsTreeFilter } from '../ElementsTree/useElementsTree'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/DATA_CONTEXT_ELEMENTS_TREE.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/DATA_CONTEXT_ELEMENTS_TREE.ts index 7f41c5c263..0ffc26b47a 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/DATA_CONTEXT_ELEMENTS_TREE.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/DATA_CONTEXT_ELEMENTS_TREE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { IElementsTree } from './useElementsTree'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService.ts index 4fec38f906..7758fddc17 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService.ts @@ -6,6 +6,7 @@ * you may not use this file except in compliance with the License. */ import { UserDataService } from '@cloudbeaver/core-authentication'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { injectable } from '@cloudbeaver/core-di'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { @@ -15,7 +16,6 @@ import { DATA_CONTEXT_MENU, getBindingLabel, IAction, - IDataContextProvider, KeyBindingService, MenuService, } from '@cloudbeaver/core-view'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/DATA_CONTEXT_NAV_TREE_ROOT.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/DATA_CONTEXT_NAV_TREE_ROOT.ts index 2d85c00fde..d126879436 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/DATA_CONTEXT_NAV_TREE_ROOT.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/DATA_CONTEXT_NAV_TREE_ROOT.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_NAV_TREE_ROOT = createDataContext('nav-tree-root'); diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitFilter.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitFilter.ts index 00b5f9b6dd..a975da0a40 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitFilter.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitFilter.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import type { NavTreeResource } from '@cloudbeaver/core-navigation-tree'; -import { CachedResourcePageKey } from '@cloudbeaver/core-sdk'; +import { CachedResourceOffsetPageKey } from '@cloudbeaver/core-resource'; import type { IElementsTreeFilter } from '../useElementsTree'; @@ -16,7 +16,7 @@ export const NAVIGATION_TREE_LIMIT = { export function elementsTreeLimitFilter(navTreeResource: NavTreeResource): IElementsTreeFilter { return (tree, filter, node, children) => { - const pageInfo = navTreeResource.getPageInfo(CachedResourcePageKey(0, 0).setTarget(node.id)); + const pageInfo = navTreeResource.offsetPagination.getPageInfo(CachedResourceOffsetPageKey(0, 0).setTarget(node.id)); if (pageInfo && pageInfo.end === undefined) { return [...children, NAVIGATION_TREE_LIMIT.limit]; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitRenderer.tsx b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitRenderer.tsx index db14659aef..68742c71cc 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitRenderer.tsx +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavTreeLimitFilter/elementsTreeLimitRenderer.tsx @@ -10,7 +10,7 @@ import { observer } from 'mobx-react-lite'; import { Link, s, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { NavTreeResource } from '@cloudbeaver/core-navigation-tree'; -import { CachedResourcePageKey, getNextPageOffset } from '@cloudbeaver/core-sdk'; +import { CachedResourceOffsetPageKey, getNextPageOffset } from '@cloudbeaver/core-resource'; import type { NavigationNodeRendererComponent } from '../NavigationNodeComponent'; import { NAVIGATION_TREE_LIMIT } from './elementsTreeLimitFilter'; @@ -31,9 +31,9 @@ const NavTreeLimitMessage: NavigationNodeRendererComponent = observer(function N function loadMore() { const parentNodeId = path[path.length - 1]; - const pageInfo = navTreeResource.getPageInfo(CachedResourcePageKey(0, 0).setTarget(parentNodeId)); + const pageInfo = navTreeResource.offsetPagination.getPageInfo(CachedResourceOffsetPageKey(0, 0).setTarget(parentNodeId)); if (pageInfo) { - navTreeResource.load(CachedResourcePageKey(getNextPageOffset(pageInfo), limit).setTarget(parentNodeId)); + navTreeResource.load(CachedResourceOffsetPageKey(getNextPageOffset(pageInfo), limit).setTarget(parentNodeId)); } } diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode.tsx b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode.tsx index c30500238a..6c93e3bcc2 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode.tsx +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode.tsx @@ -9,10 +9,10 @@ import { observer } from 'mobx-react-lite'; import { useDeferredValue, useEffect } from 'react'; import { getComputed, s, TreeNode, useMergeRefs, useS } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { DATA_CONTEXT_NAV_NODE, DATA_CONTEXT_NAV_NODES, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; import { useDNDData } from '@cloudbeaver/core-ui'; -import { useDataContext } from '@cloudbeaver/core-view'; import { useNavTreeDropBox } from '../../useNavTreeDropBox'; import type { NavigationNodeComponent } from '../NavigationNodeComponent'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode/NavigationNodeEditor.tsx b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode/NavigationNodeEditor.tsx index 7973eee3cb..ffb342a502 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode/NavigationNodeEditor.tsx +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/NavigationNode/NavigationNodeEditor.tsx @@ -14,14 +14,19 @@ import { InlineEditor } from '@cloudbeaver/core-ui'; import style from './NavigationNodeEditor.m.css'; -interface Props { +export interface NavigationNodeEditorProps { name: string; disabled?: boolean; onSave: (name: string) => void; onClose: () => void; } -export const NavigationNodeEditor = observer(function NavigationNodeEditor({ name: initialName, disabled, onSave, onClose }) { +export const NavigationNodeEditor = observer(function NavigationNodeEditor({ + name: initialName, + disabled, + onSave, + onClose, +}) { const styles = useS(style); const [name, setName] = useState(initialName); const isNameChanged = initialName !== name; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/DATA_CONTEXT_NAV_NODE_ACTIONS.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/DATA_CONTEXT_NAV_NODE_ACTIONS.ts index 131a777b62..ac5c6ce443 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/DATA_CONTEXT_NAV_NODE_ACTIONS.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/DATA_CONTEXT_NAV_NODE_ACTIONS.ts @@ -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 { createDataContext } from '@cloudbeaver/core-data-context'; import type { INodeActions } from '@cloudbeaver/core-navigation-tree'; -import { createDataContext } from '@cloudbeaver/core-view'; export const DATA_CONTEXT_NAV_NODE_ACTIONS = createDataContext('nav-node-actions'); diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/TreeNodeMenu.tsx b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/TreeNodeMenu.tsx index 3be4137c1d..b9c557a0b2 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/TreeNodeMenu.tsx +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/TreeNodeMenu/TreeNodeMenu.tsx @@ -8,18 +8,17 @@ import { observer } from 'mobx-react-lite'; import { getComputed, Icon, IMouseContextMenu, s, useS } from '@cloudbeaver/core-blocks'; -import { ConnectionInfoResource } from '@cloudbeaver/core-connections'; +import { ConnectionInfoResource, DATA_CONTEXT_CONNECTION } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { DATA_CONTEXT_NAV_NODE, type INodeActions, type NavNode } from '@cloudbeaver/core-navigation-tree'; import { ContextMenu } from '@cloudbeaver/core-ui'; import { useMenu } from '@cloudbeaver/core-view'; -import { DATA_CONTEXT_CONNECTION } from '@cloudbeaver/plugin-connections'; import { MENU_NAV_TREE } from '../../MENU_NAV_TREE'; import { DATA_CONTEXT_NAV_NODE_ACTIONS } from './DATA_CONTEXT_NAV_NODE_ACTIONS'; import style from './TreeNodeMenu.m.css'; -interface Props { +export interface TreeNodeMenuProps { node: NavNode; actions?: INodeActions; selected?: boolean; @@ -27,7 +26,7 @@ interface Props { onClose?: () => void; } -export const TreeNodeMenu = observer(function TreeNodeMenu({ node, actions, selected, mouseContextMenu, onClose }) { +export const TreeNodeMenu = observer(function TreeNodeMenu({ node, actions, selected, mouseContextMenu, onClose }) { const styles = useS(style); const connectionsInfoResource = useService(ConnectionInfoResource); const menu = useMenu({ menu: MENU_NAV_TREE }); diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/useNavigationNode.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/useNavigationNode.ts index e30ba7b53c..b42c58e68f 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/useNavigationNode.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/NavigationTreeNode/useNavigationNode.ts @@ -11,7 +11,7 @@ import { getComputed, useExecutor, useObjectRef } from '@cloudbeaver/core-blocks import { useService } from '@cloudbeaver/core-di'; import { SyncExecutor } from '@cloudbeaver/core-executor'; import { EObjectFeature, type NavNode, NavNodeInfoResource } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import type { IDNDData } from '@cloudbeaver/core-ui'; import { useChildren } from '../../../NodesManager/useChildren'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/elementsTreeNameFilter.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/elementsTreeNameFilter.ts index ea57df0a5e..a202dcce62 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/elementsTreeNameFilter.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/elementsTreeNameFilter.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. */ import type { NavNode, NavNodeInfoResource, NavTreeResource } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import type { MetadataMap } from '@cloudbeaver/core-utils'; import { EEquality, NavNodeFilterCompareFn } from './NavNodeFilterCompareFn'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/transformFilteredNodeInfo.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/transformFilteredNodeInfo.ts index d281bb5e77..9ceb5e7053 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/transformFilteredNodeInfo.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/transformFilteredNodeInfo.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ import type { NavNodeInfoResource } from '@cloudbeaver/core-navigation-tree'; -import type { IElementsTreeCustomNodeInfo } from '@cloudbeaver/plugin-navigation-tree'; + +import type { IElementsTreeCustomNodeInfo } from './useElementsTree'; export function transformFilteredNodeInfo(navNodeInfoResource: NavNodeInfoResource): IElementsTreeCustomNodeInfo { return function transformFilteredNodeInfo(nodeId, info) { diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/useElementsTree.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/useElementsTree.ts index 18e63c8e9f..7ef4442738 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/useElementsTree.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ElementsTree/useElementsTree.ts @@ -15,7 +15,7 @@ import { NotificationService } from '@cloudbeaver/core-events'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; import { type NavNode, NavNodeInfoResource, NavTreeResource, ROOT_NODE_PATH } from '@cloudbeaver/core-navigation-tree'; import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey, CachedResourcePageKey, getNextPageOffset, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey, CachedResourceOffsetPageKey, getNextPageOffset, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import type { IDNDData } from '@cloudbeaver/core-ui'; import { ILoadableState, MetadataMap, throttle } from '@cloudbeaver/core-utils'; @@ -215,12 +215,12 @@ export function useElementsTree(options: IOptions): IElementsTree { return; } - const pageInfo = navTreeResource.getPageInfo(CachedResourcePageKey(0, 0).setTarget(child)); + const pageInfo = navTreeResource.offsetPagination.getPageInfo(CachedResourceOffsetPageKey(0, 0).setTarget(child)); if (pageInfo) { const lastOffset = getNextPageOffset(pageInfo); for (let offset = 0; offset < lastOffset; offset += navTreeResource.childrenLimit) { - await navTreeResource.load(CachedResourcePageKey(offset, navTreeResource.childrenLimit).setTarget(child)); + await navTreeResource.load(CachedResourceOffsetPageKey(offset, navTreeResource.childrenLimit).setTarget(child)); } } diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeService.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeService.ts index d008deb79e..71cead424e 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeService.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeService.ts @@ -15,10 +15,9 @@ import { NavNodeExtensionsService, } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; -import { NotificationService } from '@cloudbeaver/core-events'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; import { EObjectFeature, NavNodeInfoResource, NavNodeManagerService, NavTreeResource, ROOT_NODE_PATH } from '@cloudbeaver/core-navigation-tree'; -import { CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedResourcePageKey, ResourceKey, resourceKeyList } from '@cloudbeaver/core-sdk'; +import { CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, CachedResourceOffsetPageKey, ResourceKey, resourceKeyList } from '@cloudbeaver/core-resource'; import { MetadataMap } from '@cloudbeaver/core-utils'; import { ACTION_COLLAPSE_ALL, ACTION_FILTER, IActiveView, View } from '@cloudbeaver/core-view'; @@ -37,7 +36,6 @@ export class NavigationTreeService extends View { constructor( private readonly navNodeManagerService: NavNodeManagerService, - private readonly notificationService: NotificationService, private readonly connectionsManagerService: ConnectionsManagerService, private readonly connectionInfoResource: ConnectionInfoResource, private readonly navNodeExtensionsService: NavNodeExtensionsService, @@ -106,7 +104,9 @@ export class NavigationTreeService extends View { return false; } - await this.navTreeResource.load(CachedResourcePageKey(CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, this.navTreeResource.childrenLimit).setTarget(id)); + await this.navTreeResource.load( + CachedResourceOffsetPageKey(CACHED_RESOURCE_DEFAULT_PAGE_OFFSET, this.navTreeResource.childrenLimit).setTarget(id), + ); return true; } diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ProjectsRenderer/navigationTreeProjectFilter.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ProjectsRenderer/navigationTreeProjectFilter.ts index 09493215d6..54b84f4536 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/ProjectsRenderer/navigationTreeProjectFilter.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/ProjectsRenderer/navigationTreeProjectFilter.ts @@ -7,7 +7,7 @@ */ import { NavNode, NavNodeInfoResource, NavTreeResource, ProjectsNavNodeService, ROOT_NODE_PATH } from '@cloudbeaver/core-navigation-tree'; import { NAV_NODE_TYPE_PROJECT, ProjectsService } from '@cloudbeaver/core-projects'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import type { IElementsTreeFilter } from '../ElementsTree/useElementsTree'; diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/useNavTreeDropBox.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/useNavTreeDropBox.ts index 33acf9f0bd..76210d8b16 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/useNavTreeDropBox.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/useNavTreeDropBox.ts @@ -8,11 +8,11 @@ import { useCallback, useEffect } from 'react'; import { useStateDelay } from '@cloudbeaver/core-blocks'; +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { ENodeMoveType, type NavNode, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; import { IDNDBox, useDNDBox } from '@cloudbeaver/core-ui'; import { throttleAsync } from '@cloudbeaver/core-utils'; -import type { IDataContextProvider } from '@cloudbeaver/core-view'; interface INodeState { expanded: boolean; diff --git a/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeContextMenuService.ts b/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeContextMenuService.ts index 728b426b8b..b6a3b409e5 100644 --- a/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeContextMenuService.ts +++ b/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeContextMenuService.ts @@ -6,8 +6,9 @@ * you may not use this file except in compliance with the License. */ import { CoreSettingsService } from '@cloudbeaver/core-app'; +import { ConfirmationDialogDelete, RenameDialog } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult, RenameDialog } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ExecutorInterrupter } from '@cloudbeaver/core-executor'; import { LocalizationService } from '@cloudbeaver/core-localization'; @@ -25,7 +26,7 @@ import { nodeDeleteContext, NodeManagerUtils, } from '@cloudbeaver/core-navigation-tree'; -import { ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { ACTION_DELETE, ACTION_OPEN, diff --git a/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeView/NavNodeViewService.test.ts b/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeView/NavNodeViewService.test.ts index 7ca249dec4..87ec0a3be0 100644 --- a/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeView/NavNodeViewService.test.ts +++ b/webapp/packages/plugin-navigation-tree/src/NodesManager/NavNodeView/NavNodeViewService.test.ts @@ -7,26 +7,60 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { getService } from '@cloudbeaver/core-cli/tests/utils/getService'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import datasourceContextSwitchPlugin from '@cloudbeaver/plugin-datasource-context-switch'; -import navigationTabsPlugin from '@cloudbeaver/plugin-navigation-tabs'; +import { coreAdministrationManifest } from '@cloudbeaver/core-administration'; +import { coreAppManifest } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { createApp, getService } from '@cloudbeaver/tests-runner'; import { navigationTreePlugin } from '../../manifest'; import { NavNodeViewService } from './NavNodeViewService'; const endpoint = createGQLEndpoint(); const app = createApp( - // authenticationPlugin, - // administrationPlugin, - // topAppBarPlugin, - datasourceContextSwitchPlugin, - navigationTabsPlugin, navigationTreePlugin, + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreBrowserManifest, + coreSettingsManifest, + coreViewManifest, + coreAuthenticationManifest, + coreProjectsManifest, + coreUIManifest, + coreRoutingManifest, + coreAdministrationManifest, + coreConnectionsManifest, + coreDialogsManifest, + datasourceContextSwitchPluginManifest, + navigationTabsPlugin, + coreNavigationTree, + coreAppManifest, + coreThemingManifest, ); mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-navigation-tree/src/NodesManager/NodeLink.tsx b/webapp/packages/plugin-navigation-tree/src/NodesManager/NodeLink.tsx index 33b9706ccf..14e73c20a6 100644 --- a/webapp/packages/plugin-navigation-tree/src/NodesManager/NodeLink.tsx +++ b/webapp/packages/plugin-navigation-tree/src/NodesManager/NodeLink.tsx @@ -20,13 +20,13 @@ const style = css` } `; -interface Props { +export interface NodeLinkProps { name: string; nodeId?: string; } // TODO: we probably can get name from NavNodeInfoResource but element can be not loaded -export const NodeLink: React.FC> = function NodeLink({ children, name, nodeId }) { +export const NodeLink: React.FC> = function NodeLink({ children, name, nodeId }) { const navigationTreeService = useService(NavigationTreeService); const handleClick = useCallback(() => { diff --git a/webapp/packages/plugin-navigation-tree/src/index.ts b/webapp/packages/plugin-navigation-tree/src/index.ts index 81f960e9fe..762055ddd2 100644 --- a/webapp/packages/plugin-navigation-tree/src/index.ts +++ b/webapp/packages/plugin-navigation-tree/src/index.ts @@ -1,4 +1,4 @@ -import { navigationTreePlugin } from './manifest'; +export * from './manifest'; export * from './NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/createElementsTreeSettings'; export * from './NavigationTree/ElementsTree/ElementsTreeTools/NavigationTreeSettings/DATA_CONTEXT_NAV_TREE_ROOT'; @@ -46,6 +46,3 @@ export * from './NodesManager/useChildren'; export * from './NodesManager/NodeLinkLoader'; export * from './NavigationTreeSettingsService'; - -export { navigationTreePlugin }; -export default navigationTreePlugin; diff --git a/webapp/packages/plugin-navigation-tree/tsconfig.json b/webapp/packages/plugin-navigation-tree/tsconfig.json index bd4ed8f7d0..d9a74149b7 100644 --- a/webapp/packages/plugin-navigation-tree/tsconfig.json +++ b/webapp/packages/plugin-navigation-tree/tsconfig.json @@ -1,10 +1,82 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-datasource-context-switch" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-object-viewer/package.json b/webapp/packages/plugin-object-viewer/package.json index 70ab0cc577..eabf23704a 100644 --- a/webapp/packages/plugin-object-viewer/package.json +++ b/webapp/packages/plugin-object-viewer/package.json @@ -1,34 +1,37 @@ { "name": "@cloudbeaver/plugin-object-viewer", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-connections": "~0.1.0", "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", "@cloudbeaver/plugin-navigation-tree": "~0.1.0", "@cloudbeaver/plugin-react-data-grid": "~0.1.0", "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -40,5 +43,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/FolderTabRenderer.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/FolderTabRenderer.tsx index 6e65467fb2..e461da6f66 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/FolderTabRenderer.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/FolderTabRenderer.tsx @@ -11,7 +11,7 @@ import styled from 'reshadow'; import { getComputed, Loader, useStateDelay, useStyles } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { DBObjectResource } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; import { NavNodeViewService, useChildren, useNode } from '@cloudbeaver/plugin-navigation-tree'; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/NavNodeView/VirtualFolder/VirtualFolderPanel.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/NavNodeView/VirtualFolder/VirtualFolderPanel.tsx index 182d9d513f..2ccc4f2228 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/NavNodeView/VirtualFolder/VirtualFolderPanel.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/NavNodeView/VirtualFolder/VirtualFolderPanel.tsx @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; import styled, { css } from 'reshadow'; -import { TextPlaceholder, usePagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; +import { TextPlaceholder, useOffsetPagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { type DBObject, DBObjectParentKey, DBObjectResource, NavNodeInfoResource, NavTreeResource } from '@cloudbeaver/core-navigation-tree'; import { isDefined } from '@cloudbeaver/core-utils'; @@ -35,7 +35,7 @@ export const VirtualFolderPanel: NavNodeTransformViewComponent = observer(functi const navNodeInfoResource = useService(NavNodeInfoResource); const tree = useResource(VirtualFolderPanel, NavTreeResource, nodeId); - const pagination = usePagination(DBObjectResource, { + const pagination = useOffsetPagination(DBObjectResource, { key: DBObjectParentKey(nodeId), pageSize: tree.resource.childrenLimit, }); diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTable.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTable.tsx index b5951b8bc1..bcea45e567 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTable.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTable.tsx @@ -8,7 +8,7 @@ import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; -import { s, TextPlaceholder, usePagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; +import { s, TextPlaceholder, useOffsetPagination, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { type DBObject, DBObjectParentKey, DBObjectResource, NavTreeResource } from '@cloudbeaver/core-navigation-tree'; import { isDefined } from '@cloudbeaver/core-utils'; @@ -28,7 +28,7 @@ export const ObjectPropertyTable = observer(function O const navNodeViewService = useService(NavNodeViewService); const navTreeResource = useService(NavTreeResource); - const pagination = usePagination(DBObjectResource, { + const pagination = useOffsetPagination(DBObjectResource, { key: DBObjectParentKey(objectId), pageSize: navTreeResource.childrenLimit, }); diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterItem.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterItem.tsx index 59cbd80d31..4bbd5ccd39 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterItem.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterItem.tsx @@ -9,8 +9,8 @@ import { observer } from 'mobx-react-lite'; import type { ButtonHTMLAttributes } from 'react'; import styled, { css, use } from 'reshadow'; -import { IconOrImage, ToolsAction, useTranslate } from '@cloudbeaver/core-blocks'; -import { IMenuItem, MenuTrigger } from '@cloudbeaver/core-dialogs'; +import { IconOrImage, MenuTrigger, ToolsAction, useTranslate } from '@cloudbeaver/core-blocks'; +import type { IMenuItem } from '@cloudbeaver/core-dialogs'; type Props = ButtonHTMLAttributes & { menuItem: IMenuItem; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterService.ts b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterService.ts index 38d9b09fbd..6876b10099 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterService.ts +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/ObjectPropertyTableFooterService.ts @@ -11,7 +11,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, ContextMenuService, IContextMenuItem, IMenuContext, IMenuItem } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ENodeFeature, type NavNode, NavNodeInfoResource, NavTreeResource, NavTreeSettingsService } from '@cloudbeaver/core-navigation-tree'; -import { resourceKeyList } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; interface IObjectPropertyTableFooterContext { nodeIds: string[]; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/CellFormatter.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/CellFormatter.tsx index 66c3392f17..0cb2d2491f 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/CellFormatter.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/CellFormatter.tsx @@ -10,12 +10,11 @@ import { useContext, useState } from 'react'; import styled, { css, use } from 'reshadow'; import { getComputed, Icon, useMouse, useStateDelay } from '@cloudbeaver/core-blocks'; -import { ConnectionInfoResource } from '@cloudbeaver/core-connections'; +import { ConnectionInfoResource, DATA_CONTEXT_CONNECTION } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; import { DATA_CONTEXT_NAV_NODE, type DBObject, type NavNode, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; import { ContextMenu } from '@cloudbeaver/core-ui'; import { useMenu } from '@cloudbeaver/core-view'; -import { DATA_CONTEXT_CONNECTION } from '@cloudbeaver/plugin-connections'; import { MENU_NAV_TREE, useNode } from '@cloudbeaver/plugin-navigation-tree'; import type { RenderCellProps } from '@cloudbeaver/plugin-react-data-grid'; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnIcon/ColumnIcon.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnIcon/ColumnIcon.tsx index deefbb2733..3c268c9745 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnIcon/ColumnIcon.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnIcon/ColumnIcon.tsx @@ -10,7 +10,6 @@ import { IconFormatter } from './IconFormatter'; export const ColumnIcon: ICustomColumn = { key: 'columnIcon', - columnDataIndex: null, name: '', width: 40, maxWidth: 40, diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnSelect/ColumnSelect.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnSelect/ColumnSelect.tsx index 276329e999..40b36d789f 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnSelect/ColumnSelect.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Columns/ColumnSelect/ColumnSelect.tsx @@ -10,7 +10,6 @@ import { SelectorFormatter } from './SelectorFormatter'; export const ColumnSelect: ICustomColumn = { key: 'columnSelector', - columnDataIndex: null, name: '', width: 40, maxWidth: 40, diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx index ad0314c170..0277f3a16e 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx @@ -15,7 +15,7 @@ import type { ObjectPropertyInfo } from '@cloudbeaver/core-sdk'; import { useTabLocalState } from '@cloudbeaver/core-ui'; import { isDefined, TextTools } from '@cloudbeaver/core-utils'; import DataGrid from '@cloudbeaver/plugin-react-data-grid'; -import '@cloudbeaver/plugin-react-data-grid/lib/lib/styles.css'; +import '@cloudbeaver/plugin-react-data-grid/react-data-grid-dist/lib/styles.css'; import { getValue } from '../../helpers'; import { ObjectPropertyTableFooter } from '../ObjectPropertyTableFooter'; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/formControls/ObjectPropertyInput.tsx b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/formControls/ObjectPropertyInput.tsx index 5a1f52353b..e4f976abc8 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/formControls/ObjectPropertyInput.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectPropertiesPage/formControls/ObjectPropertyInput.tsx @@ -8,6 +8,8 @@ import { observer } from 'mobx-react-lite'; import styled, { css } from 'reshadow'; +import { useStyles } from '@cloudbeaver/core-blocks'; + import { additionalProps, getValue, matchType } from '../helpers'; import type { ObjectPropertyProps } from './ObjectPropertyProps'; diff --git a/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx b/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx index 100e95a159..a10aecfb0f 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx @@ -10,20 +10,15 @@ import { useContext } from 'react'; import styled from 'reshadow'; import { useStyles } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { ITabData, Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; -import { CaptureViewContext, useDataContext } from '@cloudbeaver/core-view'; +import { CaptureViewContext } from '@cloudbeaver/core-view'; import type { TabHandlerTabComponent } from '@cloudbeaver/plugin-navigation-tabs'; import { useNode } from '@cloudbeaver/plugin-navigation-tree'; import type { IObjectViewerTabState } from './IObjectViewerTabState'; -export const ObjectViewerTab: TabHandlerTabComponent = observer(function ObjectViewerTab({ - tab, - handler, - onSelect, - onClose, - style, -}) { +export const ObjectViewerTab: TabHandlerTabComponent = observer(function ObjectViewerTab({ tab, onSelect, onClose, style }) { // const connectionsInfoResource = useService(ConnectionInfoResource); const viewContext = useContext(CaptureViewContext); const tabMenuContext = useDataContext(viewContext); diff --git a/webapp/packages/plugin-object-viewer/src/ObjectViewerTabService.ts b/webapp/packages/plugin-object-viewer/src/ObjectViewerTabService.ts index 4a5d839895..cc0923dc56 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectViewerTabService.ts +++ b/webapp/packages/plugin-object-viewer/src/ObjectViewerTabService.ts @@ -23,7 +23,7 @@ import { NotificationService } from '@cloudbeaver/core-events'; import type { IExecutionContextProvider, ISyncContextLoader } from '@cloudbeaver/core-executor'; import { type INodeNavigationData, NavNodeManagerService, NodeManagerUtils, objectNavNodeProvider } from '@cloudbeaver/core-navigation-tree'; import { projectProvider } from '@cloudbeaver/core-projects'; -import { ResourceKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { ResourceKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { ITab, NavigationTabsService, TabHandler } from '@cloudbeaver/plugin-navigation-tabs'; import type { IObjectViewerTabContext } from './IObjectViewerTabContext'; diff --git a/webapp/packages/plugin-object-viewer/src/index.ts b/webapp/packages/plugin-object-viewer/src/index.ts index 4543e9a376..6decd9f6c9 100644 --- a/webapp/packages/plugin-object-viewer/src/index.ts +++ b/webapp/packages/plugin-object-viewer/src/index.ts @@ -1,6 +1,4 @@ -import { manifest } from './manifest'; - -export default manifest; +export * from './manifest'; // All Services and Components that is provided by this plugin should be exported here export * from './ObjectPage/DBObjectPageService'; diff --git a/webapp/packages/plugin-object-viewer/src/manifest.ts b/webapp/packages/plugin-object-viewer/src/manifest.ts index fcaf4c7896..6f95c2950f 100644 --- a/webapp/packages/plugin-object-viewer/src/manifest.ts +++ b/webapp/packages/plugin-object-viewer/src/manifest.ts @@ -16,7 +16,7 @@ import { ObjectPropertyTableFooterService } from './ObjectPropertiesPage/ObjectP import { ObjectViewerBootstrap } from './ObjectViewerBootstrap'; import { ObjectViewerTabService } from './ObjectViewerTabService'; -export const manifest: PluginManifest = { +export const objectViewerManifest: PluginManifest = { info: { name: 'Object Viewer Plugin' }, providers: [ diff --git a/webapp/packages/plugin-object-viewer/tsconfig.json b/webapp/packages/plugin-object-viewer/tsconfig.json index bd4ed8f7d0..0597a86623 100644 --- a/webapp/packages/plugin-object-viewer/tsconfig.json +++ b/webapp/packages/plugin-object-viewer/tsconfig.json @@ -1,10 +1,82 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-react-data-grid" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-product/package.json b/webapp/packages/plugin-product/package.json index 26d3654eb6..89ca7e0cd3 100644 --- a/webapp/packages/plugin-product/package.json +++ b/webapp/packages/plugin-product/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-product", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-settings-menu": "~0.1.0", @@ -31,5 +32,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-product/src/ProductInfoDialog.tsx b/webapp/packages/plugin-product/src/ProductInfoDialog.tsx index 47e88da7ba..1928310d42 100644 --- a/webapp/packages/plugin-product/src/ProductInfoDialog.tsx +++ b/webapp/packages/plugin-product/src/ProductInfoDialog.tsx @@ -10,6 +10,10 @@ import { observer } from 'mobx-react-lite'; import { Button, ColoredContainer, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, FormFieldDescription, Group, IconOrImage, @@ -20,7 +24,7 @@ import { useTranslate, } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import { ServerConfigResource } from '@cloudbeaver/core-root'; import { ThemeService } from '@cloudbeaver/core-theming'; import { useAppVersion } from '@cloudbeaver/plugin-version'; diff --git a/webapp/packages/plugin-product/tsconfig.json b/webapp/packages/plugin-product/tsconfig.json index bd4ed8f7d0..3639cb445b 100644 --- a/webapp/packages/plugin-product/tsconfig.json +++ b/webapp/packages/plugin-product/tsconfig.json @@ -1,10 +1,49 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\plugin-version" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-projects/package.json b/webapp/packages/plugin-projects/package.json index affd366f6d..a00f8e8f33 100644 --- a/webapp/packages/plugin-projects/package.json +++ b/webapp/packages/plugin-projects/package.json @@ -1,28 +1,28 @@ { "name": "@cloudbeaver/plugin-projects", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-projects": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { @@ -30,5 +30,6 @@ "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-projects/src/FolderDialog.tsx b/webapp/packages/plugin-projects/src/FolderDialog.tsx index 1637783dad..bda7714a3d 100644 --- a/webapp/packages/plugin-projects/src/FolderDialog.tsx +++ b/webapp/packages/plugin-projects/src/FolderDialog.tsx @@ -11,6 +11,10 @@ import { useEffect } from 'react'; import { Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, Container, Fill, Form, @@ -23,12 +27,12 @@ import { useS, useTranslate, } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { ProjectInfo, ProjectInfoResource } from '@cloudbeaver/core-projects'; import { createPath, throttleAsync } from '@cloudbeaver/core-utils'; -import { ProjectSelect } from '@cloudbeaver/plugin-projects'; import style from './FolderDialog.m.css'; +import { ProjectSelect } from './ProjectSelect'; interface IFolderDialogState { value: string; diff --git a/webapp/packages/plugin-projects/src/ProjectSelect.tsx b/webapp/packages/plugin-projects/src/ProjectSelect.tsx index d87ad3074c..d1de0ad90c 100644 --- a/webapp/packages/plugin-projects/src/ProjectSelect.tsx +++ b/webapp/packages/plugin-projects/src/ProjectSelect.tsx @@ -10,7 +10,7 @@ import { observer } from 'mobx-react-lite'; import { Combobox, useResource, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { ProjectInfo, ProjectInfoResource, projectInfoSortByName, ProjectsService } from '@cloudbeaver/core-projects'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; interface Props { value: string | null; diff --git a/webapp/packages/plugin-projects/tsconfig.json b/webapp/packages/plugin-projects/tsconfig.json index bd4ed8f7d0..d5674732c1 100644 --- a/webapp/packages/plugin-projects/tsconfig.json +++ b/webapp/packages/plugin-projects/tsconfig.json @@ -1,10 +1,43 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-react-data-grid/package.json b/webapp/packages/plugin-react-data-grid/package.json index 3c5d419bea..57c7e6066a 100644 --- a/webapp/packages/plugin-react-data-grid/package.json +++ b/webapp/packages/plugin-react-data-grid/package.json @@ -1,22 +1,24 @@ { "name": "@cloudbeaver/plugin-react-data-grid", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "react-data-grid": "file:lib" + "react-data-grid": "file:react-data-grid-dist" }, - "peerDependencies": { - } + "peerDependencies": {}, + "devDependencies": {} } diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/bundle.cjs b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.cjs similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/bundle.cjs rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.cjs diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/bundle.cjs.map b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.cjs.map similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/bundle.cjs.map rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.cjs.map diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/bundle.js b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.js similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/bundle.js rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.js diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/bundle.js.map b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.js.map similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/bundle.js.map rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/bundle.js.map diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/index.d.ts b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/index.d.ts similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/index.d.ts rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/index.d.ts diff --git a/webapp/packages/plugin-react-data-grid/lib/lib/styles.css b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/styles.css similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/lib/styles.css rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/lib/styles.css diff --git a/webapp/packages/plugin-react-data-grid/lib/package.json b/webapp/packages/plugin-react-data-grid/react-data-grid-dist/package.json similarity index 100% rename from webapp/packages/plugin-react-data-grid/lib/package.json rename to webapp/packages/plugin-react-data-grid/react-data-grid-dist/package.json diff --git a/webapp/packages/plugin-react-data-grid/tsconfig.json b/webapp/packages/plugin-react-data-grid/tsconfig.json index bd4ed8f7d0..3561ca0fa9 100644 --- a/webapp/packages/plugin-react-data-grid/tsconfig.json +++ b/webapp/packages/plugin-react-data-grid/tsconfig.json @@ -1,10 +1,21 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ], "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ] } diff --git a/webapp/packages/plugin-resource-manager-administration/package.json b/webapp/packages/plugin-resource-manager-administration/package.json index d9e4eed8bb..f3fe791ca8 100644 --- a/webapp/packages/plugin-resource-manager-administration/package.json +++ b/webapp/packages/plugin-resource-manager-administration/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-resource-manager-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-administration": "~0.1.0", @@ -29,5 +30,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-resource-manager-administration/tsconfig.json b/webapp/packages/plugin-resource-manager-administration/tsconfig.json index 25945c5e1f..488c6ec60f 100644 --- a/webapp/packages/plugin-resource-manager-administration/tsconfig.json +++ b/webapp/packages/plugin-resource-manager-administration/tsconfig.json @@ -1,14 +1,43 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], "references": [ { - "path": "../*" + "path": "..\\plugin-administration" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-root" } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" ] } diff --git a/webapp/packages/plugin-resource-manager-scripts/package.json b/webapp/packages/plugin-resource-manager-scripts/package.json index 3e70dc65f0..3b5d5a78dc 100644 --- a/webapp/packages/plugin-resource-manager-scripts/package.json +++ b/webapp/packages/plugin-resource-manager-scripts/package.json @@ -1,31 +1,45 @@ { "name": "@cloudbeaver/plugin-resource-manager-scripts", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-navigation-tree-rm": "~0.1.0", + "@cloudbeaver/plugin-projects": "~0.1.0", "@cloudbeaver/plugin-resource-manager": "~0.1.0", + "@cloudbeaver/plugin-tools-panel": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-dialogs": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", + "@cloudbeaver/core-resource-manager": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0" + "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-resource-manager-scripts/src/PluginBootstrap.ts b/webapp/packages/plugin-resource-manager-scripts/src/PluginBootstrap.ts index 03d8b3a1b8..faa96127bc 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/PluginBootstrap.ts @@ -6,8 +6,8 @@ * you may not use this file except in compliance with the License. */ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; +import { getCachedDataResourceLoaderState } from '@cloudbeaver/core-resource'; import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { getCachedDataResourceLoaderState } from '@cloudbeaver/core-sdk'; import { SideBarPanelService } from '@cloudbeaver/core-ui'; import { ActionService, DATA_CONTEXT_MENU, menuExtractItems, MenuService } from '@cloudbeaver/core-view'; import { MENU_TOOLS } from '@cloudbeaver/plugin-tools-panel'; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/SaveScriptDialog.tsx b/webapp/packages/plugin-resource-manager-scripts/src/SaveScriptDialog.tsx index c968d4ffb3..912d2cfc10 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/SaveScriptDialog.tsx +++ b/webapp/packages/plugin-resource-manager-scripts/src/SaveScriptDialog.tsx @@ -8,8 +8,22 @@ import { action, observable } from 'mobx'; import { observer } from 'mobx-react-lite'; -import { Button, Container, Fill, Form, InputField, Translate, useFocus, useObservableRef, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Container, + Fill, + Form, + InputField, + Translate, + useFocus, + useObservableRef, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { ProjectSelect } from '@cloudbeaver/plugin-projects'; export interface ISaveScriptDialogResult { diff --git a/webapp/packages/plugin-resource-manager-scripts/tsconfig.json b/webapp/packages/plugin-resource-manager-scripts/tsconfig.json index 25945c5e1f..3f00d16a8c 100644 --- a/webapp/packages/plugin-resource-manager-scripts/tsconfig.json +++ b/webapp/packages/plugin-resource-manager-scripts/tsconfig.json @@ -1,14 +1,73 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], "references": [ { - "path": "../*" + "path": "..\\plugin-navigation-tree-rm" + }, + { + "path": "..\\plugin-projects" + }, + { + "path": "..\\plugin-resource-manager" + }, + { + "path": "..\\plugin-tools-panel" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-resource-manager" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" ] } diff --git a/webapp/packages/plugin-resource-manager/package.json b/webapp/packages/plugin-resource-manager/package.json index ae3dec82e3..a1e9e629bb 100644 --- a/webapp/packages/plugin-resource-manager/package.json +++ b/webapp/packages/plugin-resource-manager/package.json @@ -1,43 +1,33 @@ { "name": "@cloudbeaver/plugin-resource-manager", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/plugin-projects": "~0.1.0", - "@cloudbeaver/plugin-tools-panel": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", - "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-resource-manager": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0" + "@cloudbeaver/core-sdk": "~0.1.0" }, "peerDependencies": { "react": "~18.x.x", @@ -45,5 +35,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.test.ts b/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.test.ts index 15a5537daa..aa9bbd6cfa 100644 --- a/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.test.ts +++ b/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.test.ts @@ -7,21 +7,37 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { createApp } from '@cloudbeaver/tests-runner'; import { resourceManagerPlugin } from './manifest'; import { ResourceManagerSettings, ResourceManagerSettingsService } from './ResourceManagerSettingsService'; const endpoint = createGQLEndpoint(); -const app = createApp(resourceManagerPlugin); +const app = createApp( + resourceManagerPlugin, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreSettingsManifest, + coreBrowserManifest, + coreLocalizationManifest, +); -const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); +const server = mockGraphQL(...mockAppInit(endpoint)); beforeAll(() => app.init()); diff --git a/webapp/packages/plugin-resource-manager/src/ResourceProjectsResource.ts b/webapp/packages/plugin-resource-manager/src/ResourceProjectsResource.ts index fb14c22a27..55be275a11 100644 --- a/webapp/packages/plugin-resource-manager/src/ResourceProjectsResource.ts +++ b/webapp/packages/plugin-resource-manager/src/ResourceProjectsResource.ts @@ -7,8 +7,9 @@ */ import { UserInfoResource } from '@cloudbeaver/core-authentication'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { SharedProjectsResource } from '@cloudbeaver/core-resource-manager'; -import { CachedDataResource, GraphQLService, RmProject } from '@cloudbeaver/core-sdk'; +import { GraphQLService, RmProject } from '@cloudbeaver/core-sdk'; export type Project = Omit; diff --git a/webapp/packages/plugin-resource-manager/tsconfig.json b/webapp/packages/plugin-resource-manager/tsconfig.json index 25945c5e1f..2c77860f90 100644 --- a/webapp/packages/plugin-resource-manager/tsconfig.json +++ b/webapp/packages/plugin-resource-manager/tsconfig.json @@ -1,14 +1,52 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], "references": [ { - "path": "../*" + "path": "..\\core-authentication" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-resource-manager" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\tests-runner" } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" ] } diff --git a/webapp/packages/plugin-root/package.json b/webapp/packages/plugin-root/package.json index 38d5df8ec2..7c5f58aef2 100644 --- a/webapp/packages/plugin-root/package.json +++ b/webapp/packages/plugin-root/package.json @@ -1,22 +1,22 @@ { "name": "@cloudbeaver/plugin-root", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", @@ -24,7 +24,6 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0" }, "peerDependencies": { @@ -32,5 +31,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-root/src/ServerNodeChangedDialog/ServerNodeChangedDialog.tsx b/webapp/packages/plugin-root/src/ServerNodeChangedDialog/ServerNodeChangedDialog.tsx index cc6ca74962..1fb235d4d8 100644 --- a/webapp/packages/plugin-root/src/ServerNodeChangedDialog/ServerNodeChangedDialog.tsx +++ b/webapp/packages/plugin-root/src/ServerNodeChangedDialog/ServerNodeChangedDialog.tsx @@ -7,9 +7,18 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { RouterService } from '@cloudbeaver/core-routing'; import style from './ServerNodeChangedDialog.m.css'; diff --git a/webapp/packages/plugin-root/src/index.ts b/webapp/packages/plugin-root/src/index.ts index 08a4490ca3..e7028d4b09 100644 --- a/webapp/packages/plugin-root/src/index.ts +++ b/webapp/packages/plugin-root/src/index.ts @@ -1,6 +1,5 @@ import { rootPlugin } from './manifest'; -export * from './SessionExpireDialog/SessionExpiredDialogService'; -export * from './SessionExpireWarningDialog/SessionExpireWarningDialogService'; +export { default as ServerNodeChangedDialogStyles } from './ServerNodeChangedDialog/ServerNodeChangedDialog.m.css'; export default rootPlugin; diff --git a/webapp/packages/plugin-root/src/manifest.ts b/webapp/packages/plugin-root/src/manifest.ts index 2136498a03..9fa1fd8702 100644 --- a/webapp/packages/plugin-root/src/manifest.ts +++ b/webapp/packages/plugin-root/src/manifest.ts @@ -12,18 +12,8 @@ import { LocaleService } from './LocaleService'; import { NetworkStateNotificationService } from './NetworkStateNotification/NetworkStateNotificationService'; import { PluginBootstrap } from './PluginBootstrap'; import { ServerNodeChangedDialogService } from './ServerNodeChangedDialog/ServerNodeChangedDialogService'; -import { SessionExpiredDialogService } from './SessionExpireDialog/SessionExpiredDialogService'; -import { SessionExpireWarningDialogService } from './SessionExpireWarningDialog/SessionExpireWarningDialogService'; export const rootPlugin: PluginManifest = { info: { name: 'Root plugin' }, - providers: [ - LocaleService, - PluginBootstrap, - SessionExpiredDialogService, - ServerNodeChangedDialogService, - SessionExpireWarningDialogService, - NetworkStateNotificationService, - DataSynchronizationResolverBootstrap, - ], + providers: [LocaleService, PluginBootstrap, ServerNodeChangedDialogService, NetworkStateNotificationService, DataSynchronizationResolverBootstrap], }; diff --git a/webapp/packages/plugin-root/tsconfig.json b/webapp/packages/plugin-root/tsconfig.json index bd4ed8f7d0..8d1099148c 100644 --- a/webapp/packages/plugin-root/tsconfig.json +++ b/webapp/packages/plugin-root/tsconfig.json @@ -1,10 +1,46 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-session-expiration/.gitignore b/webapp/packages/plugin-session-expiration/.gitignore new file mode 100644 index 0000000000..15bc16c7c3 --- /dev/null +++ b/webapp/packages/plugin-session-expiration/.gitignore @@ -0,0 +1,17 @@ +# dependencies +/node_modules + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/plugin-session-expiration/package.json b/webapp/packages/plugin-session-expiration/package.json new file mode 100644 index 0000000000..65c318437c --- /dev/null +++ b/webapp/packages/plugin-session-expiration/package.json @@ -0,0 +1,37 @@ +{ + "name": "@cloudbeaver/plugin-session-expiration", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/plugin-root": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-dialogs": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-routing": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0" + }, + "peerDependencies": { + "react": "~18.x.x", + "mobx": "~6.x.x", + "mobx-react-lite": "~3.x.x", + "reshadow": "~0.x.x" + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-session-expiration/src/PluginBootstrap.ts b/webapp/packages/plugin-session-expiration/src/PluginBootstrap.ts new file mode 100644 index 0000000000..5cb98d6fdd --- /dev/null +++ b/webapp/packages/plugin-session-expiration/src/PluginBootstrap.ts @@ -0,0 +1,19 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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'; + +@injectable() +export class PluginBootstrap extends Bootstrap { + constructor() { + super(); + } + + register(): void | Promise {} + + load(): void | Promise {} +} diff --git a/webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialog.tsx b/webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialog.tsx similarity index 77% rename from webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialog.tsx rename to webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialog.tsx index 5ddd34647f..65b7663569 100644 --- a/webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialog.tsx +++ b/webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialog.tsx @@ -7,15 +7,23 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import { RouterService } from '@cloudbeaver/core-routing'; - -import style from '../ServerNodeChangedDialog/ServerNodeChangedDialog.m.css'; +import { ServerNodeChangedDialogStyles } from '@cloudbeaver/plugin-root'; export const SessionExpiredDialog: DialogComponent = observer(function SessionExpiredDialog({ rejectDialog }) { - const styles = useS(style); + const styles = useS(ServerNodeChangedDialogStyles); const routerService = useService(RouterService); const translate = useTranslate(); function reload() { diff --git a/webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialogService.ts b/webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialogBootstrap.ts similarity index 96% rename from webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialogService.ts rename to webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialogBootstrap.ts index 374849907a..06d3a59641 100644 --- a/webapp/packages/plugin-root/src/SessionExpireDialog/SessionExpiredDialogService.ts +++ b/webapp/packages/plugin-session-expiration/src/SessionExpireDialog/SessionExpiredDialogBootstrap.ts @@ -15,7 +15,7 @@ import { RouterService } from '@cloudbeaver/core-routing'; import { SessionExpiredDialog } from './SessionExpiredDialog'; @injectable() -export class SessionExpiredDialogService extends Bootstrap { +export class SessionExpiredDialogBootstrap extends Bootstrap { constructor( private readonly routerService: RouterService, private readonly notificationService: NotificationService, diff --git a/webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx similarity index 74% rename from webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx rename to webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx index c2156a9aef..2ecbf3c492 100644 --- a/webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx +++ b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialog.tsx @@ -7,14 +7,22 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; - -import style from '../ServerNodeChangedDialog/ServerNodeChangedDialog.m.css'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + s, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; +import { ServerNodeChangedDialogStyles } from '@cloudbeaver/plugin-root'; export const SessionExpireWarningDialog: DialogComponent = observer(function SessionExpireWarningDialog({ rejectDialog }) { const translate = useTranslate(); - const styles = useS(style); + const styles = useS(ServerNodeChangedDialogStyles); return ( diff --git a/webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialogService.ts b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts similarity index 97% rename from webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialogService.ts rename to webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts index 9ac3e720dc..a695dab6d6 100644 --- a/webapp/packages/plugin-root/src/SessionExpireWarningDialog/SessionExpireWarningDialogService.ts +++ b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts @@ -16,9 +16,8 @@ import { SessionExpireWarningDialog } from './SessionExpireWarningDialog'; const WARN_IN = 5 * 1000 * 60; @injectable() -export class SessionExpireWarningDialogService extends Bootstrap { +export class SessionExpireWarningDialogBootstrap extends Bootstrap { private dialogInternalPromise: Promise | null; - constructor( private readonly commonDialogService: CommonDialogService, private readonly sessionExpireService: SessionExpireService, diff --git a/webapp/packages/plugin-session-expiration/src/index.ts b/webapp/packages/plugin-session-expiration/src/index.ts new file mode 100644 index 0000000000..eeefbcb351 --- /dev/null +++ b/webapp/packages/plugin-session-expiration/src/index.ts @@ -0,0 +1,4 @@ +import { sessionExpirationPlugin } from './manifest'; + +export { sessionExpirationPlugin }; +export default sessionExpirationPlugin; diff --git a/webapp/packages/plugin-session-expiration/src/manifest.ts b/webapp/packages/plugin-session-expiration/src/manifest.ts new file mode 100644 index 0000000000..ed717f52d4 --- /dev/null +++ b/webapp/packages/plugin-session-expiration/src/manifest.ts @@ -0,0 +1,17 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { PluginBootstrap } from './PluginBootstrap'; +import { SessionExpiredDialogBootstrap } from './SessionExpireDialog/SessionExpiredDialogBootstrap'; +import { SessionExpireWarningDialogBootstrap } from './SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap'; + +export const sessionExpirationPlugin: PluginManifest = { + info: { name: 'Session Expiration plugin' }, + providers: [PluginBootstrap, SessionExpiredDialogBootstrap, SessionExpireWarningDialogBootstrap], +}; diff --git a/webapp/packages/plugin-session-expiration/tsconfig.json b/webapp/packages/plugin-session-expiration/tsconfig.json new file mode 100644 index 0000000000..734ca73d9c --- /dev/null +++ b/webapp/packages/plugin-session-expiration/tsconfig.json @@ -0,0 +1,49 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\plugin-root" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-sdk" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/plugin-settings-menu-administration/package.json b/webapp/packages/plugin-settings-menu-administration/package.json index 89d38b72b9..72bfa1a4fe 100644 --- a/webapp/packages/plugin-settings-menu-administration/package.json +++ b/webapp/packages/plugin-settings-menu-administration/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-settings-menu-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0" @@ -23,5 +24,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-settings-menu-administration/tsconfig.json b/webapp/packages/plugin-settings-menu-administration/tsconfig.json index bd4ed8f7d0..959c65dd59 100644 --- a/webapp/packages/plugin-settings-menu-administration/tsconfig.json +++ b/webapp/packages/plugin-settings-menu-administration/tsconfig.json @@ -1,10 +1,25 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-settings-menu/package.json b/webapp/packages/plugin-settings-menu/package.json index 505b4c0c4d..4fb624bcfa 100644 --- a/webapp/packages/plugin-settings-menu/package.json +++ b/webapp/packages/plugin-settings-menu/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-settings-menu", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-top-app-bar": "~0.1.0", @@ -27,5 +28,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-settings-menu/tsconfig.json b/webapp/packages/plugin-settings-menu/tsconfig.json index bd4ed8f7d0..55faccbe6d 100644 --- a/webapp/packages/plugin-settings-menu/tsconfig.json +++ b/webapp/packages/plugin-settings-menu/tsconfig.json @@ -1,10 +1,37 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-settings-panel/package.json b/webapp/packages/plugin-settings-panel/package.json index 434cfed09c..16c6dfce0a 100644 --- a/webapp/packages/plugin-settings-panel/package.json +++ b/webapp/packages/plugin-settings-panel/package.json @@ -1,36 +1,38 @@ { "name": "@cloudbeaver/plugin-settings-panel", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/plugin-settings-menu": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", - "@cloudbeaver/core-localization": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", - "@cloudbeaver/core-view": "~0.1.0", - "@cloudbeaver/plugin-settings-menu": "~0.1.0" + "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/plugin-settings-panel/tsconfig.json b/webapp/packages/plugin-settings-panel/tsconfig.json index bd4ed8f7d0..5a23006bba 100644 --- a/webapp/packages/plugin-settings-panel/tsconfig.json +++ b/webapp/packages/plugin-settings-panel/tsconfig.json @@ -1,10 +1,49 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-script/package.json b/webapp/packages/plugin-sql-editor-navigation-tab-script/package.json index 757db16051..0673f29dc8 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-script/package.json +++ b/webapp/packages/plugin-sql-editor-navigation-tab-script/package.json @@ -1,26 +1,29 @@ { "name": "@cloudbeaver/plugin-sql-editor-navigation-tab-script", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", + "@cloudbeaver/plugin-navigation-tree-rm": "~0.1.0", "@cloudbeaver/plugin-resource-manager": "~0.1.0", + "@cloudbeaver/plugin-resource-manager-scripts": "~0.1.0", "@cloudbeaver/plugin-sql-editor": "~0.1.0", "@cloudbeaver/plugin-sql-editor-navigation-tab": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree-rm": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", @@ -30,11 +33,10 @@ "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-resource-manager": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, @@ -43,5 +45,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/PluginBootstrap.ts b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/PluginBootstrap.ts index 4b0db404d7..f778fd15ab 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/PluginBootstrap.ts @@ -11,8 +11,8 @@ import { NotificationService } from '@cloudbeaver/core-events'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { type INodeNavigationData, NavNodeInfoResource, NavNodeManagerService } from '@cloudbeaver/core-navigation-tree'; import { isResourceOfType, ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects'; +import { CachedMapAllKey, CachedTreeChildrenKey } from '@cloudbeaver/core-resource'; import { getRmResourcePath, NAV_NODE_TYPE_RM_RESOURCE, ResourceManagerResource, RESOURCES_NODE_PATH } from '@cloudbeaver/core-resource-manager'; -import { CachedMapAllKey, CachedTreeChildrenKey } from '@cloudbeaver/core-sdk'; import { createPath, getPathName } from '@cloudbeaver/core-utils'; import { ACTION_SAVE, ActionService, DATA_CONTEXT_MENU, KEY_BINDING_SAVE, KeyBindingService, MenuService } from '@cloudbeaver/core-view'; import { NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs'; diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSource.ts b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSource.ts index 0a5f9a1e2f..a724107bb6 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSource.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSource.ts @@ -15,8 +15,8 @@ import { } from '@cloudbeaver/core-connections'; import { TaskScheduler } from '@cloudbeaver/core-executor'; import type { ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { getRmResourceKey, ResourceManagerResource } from '@cloudbeaver/core-resource-manager'; -import { isResourceAlias, ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; import { debounce, getPathName, isArraysEqual, isNotNullDefined, isObjectsEqual, isValuesEqual } from '@cloudbeaver/core-utils'; import { SCRIPTS_TYPE_ID } from '@cloudbeaver/plugin-resource-manager-scripts'; import { BaseSqlDataSource, ESqlDataSourceFeatures, SqlEditorService } from '@cloudbeaver/plugin-sql-editor'; @@ -175,7 +175,7 @@ export class ResourceSqlDataSource extends BaseSqlDataSource { setResourceKey(resourceKey: string | undefined): void { if (this.state.resourceKey && this.resourceUseKeyId) { - this.resourceManagerResource.free(toJS(this.state.resourceKey), this.resourceUseKeyId); + this.resourceManagerResource.useTracker.free(toJS(this.state.resourceKey), this.resourceUseKeyId); this.resourceUseKeyId = null; } @@ -265,7 +265,7 @@ export class ResourceSqlDataSource extends BaseSqlDataSource { async load(): Promise { if (this.state.resourceKey && !this.resourceUseKeyId) { - this.resourceUseKeyId = this.resourceManagerResource.use(this.state.resourceKey); + this.resourceUseKeyId = this.resourceManagerResource.useTracker.use(this.state.resourceKey); } await this.read(); } @@ -284,7 +284,7 @@ export class ResourceSqlDataSource extends BaseSqlDataSource { super.dispose(); this.resourceManagerResource.onItemUpdate.removeHandler(this.syncResource); if (this.state.resourceKey && this.resourceUseKeyId) { - this.resourceManagerResource.free(this.state.resourceKey, this.resourceUseKeyId); + this.resourceManagerResource.useTracker.free(this.state.resourceKey, this.resourceUseKeyId); this.resourceUseKeyId = null; } } diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSourceBootstrap.ts b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSourceBootstrap.ts index 1f524838d3..fb006be0b6 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSourceBootstrap.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab-script/src/ResourceSqlDataSourceBootstrap.ts @@ -7,14 +7,15 @@ */ import { action, makeObservable, observable, untracked } from 'mobx'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, IConnectionExecutionContextInfo } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { CachedMapAllKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { getRmResourceKey, IResourceManagerMoveData, ResourceManagerResource } from '@cloudbeaver/core-resource-manager'; import { NetworkStateService, WindowEventsService } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; import { LocalStorageSaveService } from '@cloudbeaver/core-settings'; import { createPath, getPathParent, throttle } from '@cloudbeaver/core-utils'; import { NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs'; diff --git a/webapp/packages/plugin-sql-editor-navigation-tab-script/tsconfig.json b/webapp/packages/plugin-sql-editor-navigation-tab-script/tsconfig.json index bd4ed8f7d0..31d257fede 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab-script/tsconfig.json +++ b/webapp/packages/plugin-sql-editor-navigation-tab-script/tsconfig.json @@ -1,10 +1,88 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-navigation-tree-rm" + }, + { + "path": "..\\plugin-resource-manager" + }, + { + "path": "..\\plugin-resource-manager-scripts" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-sql-editor-navigation-tab" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-resource-manager" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/package.json b/webapp/packages/plugin-sql-editor-navigation-tab/package.json index fbf289f370..485bef6d67 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/package.json +++ b/webapp/packages/plugin-sql-editor-navigation-tab/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-sql-editor-navigation-tab", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-connections": "~0.1.0", @@ -22,6 +23,7 @@ "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", @@ -30,6 +32,7 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-projects": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -41,5 +44,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/DATA_CONTEXT_SQL_EDITOR_TAB.ts b/webapp/packages/plugin-sql-editor-navigation-tab/src/DATA_CONTEXT_SQL_EDITOR_TAB.ts index 225d21e4d5..f80201212b 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/DATA_CONTEXT_SQL_EDITOR_TAB.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/DATA_CONTEXT_SQL_EDITOR_TAB.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; export const DATA_CONTEXT_SQL_EDITOR_TAB = createDataContext('sql-editor-tab'); diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorBootstrap.ts b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorBootstrap.ts index 2be1594d75..7281342f2e 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorBootstrap.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorBootstrap.ts @@ -5,24 +5,26 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { RenameDialog } from '@cloudbeaver/core-blocks'; import { Connection, ConnectionInfoResource, createConnectionParam, + DATA_CONTEXT_CONNECTION, IConnectionInfoParams, isConnectionProvider, isObjectCatalogProvider, isObjectSchemaProvider, } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, DialogueStateResult, RenameDialog } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import type { IExecutorHandler } from '@cloudbeaver/core-executor'; import { ExtensionUtils } from '@cloudbeaver/core-extensions'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { DATA_CONTEXT_NAV_NODE, EObjectFeature, NodeManagerUtils } from '@cloudbeaver/core-navigation-tree'; import { ISessionAction, sessionActionContext, SessionActionService } from '@cloudbeaver/core-root'; import { ACTION_RENAME, ActionService, DATA_CONTEXT_MENU_NESTED, menuExtractItems, MenuService, ViewService } from '@cloudbeaver/core-view'; -import { DATA_CONTEXT_CONNECTION, MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; +import { MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; import { NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs'; import { DATA_CONTEXT_SQL_EDITOR_STATE, diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx index 42e07dc5d1..7d91a79f06 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx @@ -11,9 +11,10 @@ import styled from 'reshadow'; import { s, useStyles } from '@cloudbeaver/core-blocks'; import { Connection, ConnectionInfoResource, createConnectionParam } from '@cloudbeaver/core-connections'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import { useService } from '@cloudbeaver/core-di'; import { ITabData, Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; -import { CaptureViewContext, useDataContext } from '@cloudbeaver/core-view'; +import { CaptureViewContext } from '@cloudbeaver/core-view'; import type { TabHandlerTabComponent } from '@cloudbeaver/plugin-navigation-tabs'; import { DATA_CONTEXT_SQL_EDITOR_STATE, getSqlEditorName, ISqlEditorTabState, SqlDataSourceService } from '@cloudbeaver/plugin-sql-editor'; diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts index f1fd0fe203..85d73de51b 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts @@ -7,6 +7,7 @@ */ import { computed, makeObservable, observable, untracked } from 'mobx'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { ConnectionExecutionContextResource, ConnectionExecutionContextService, @@ -26,12 +27,13 @@ import { objectSchemaSetter, } from '@cloudbeaver/core-connections'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { Executor, ExecutorInterrupter, IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { NavNodeInfoResource, NodeManagerUtils, objectNavNodeProvider } from '@cloudbeaver/core-navigation-tree'; import { projectProvider, projectSetter, projectSetterState } from '@cloudbeaver/core-projects'; -import { NavNodeInfoFragment, resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-sdk'; +import { resourceKeyList, ResourceKeySimple, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import type { NavNodeInfoFragment } from '@cloudbeaver/core-sdk'; import { isArraysEqual } from '@cloudbeaver/core-utils'; import { ITab, ITabOptions, NavigationTabsService, TabHandler } from '@cloudbeaver/plugin-navigation-tabs'; import { diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/tsconfig.json b/webapp/packages/plugin-sql-editor-navigation-tab/tsconfig.json index bd4ed8f7d0..8a96587353 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/tsconfig.json +++ b/webapp/packages/plugin-sql-editor-navigation-tab/tsconfig.json @@ -1,10 +1,85 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-extensions" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-projects" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-editor-new/package.json b/webapp/packages/plugin-sql-editor-new/package.json index 33f1e2eed9..d4c1a02f33 100644 --- a/webapp/packages/plugin-sql-editor-new/package.json +++ b/webapp/packages/plugin-sql-editor-new/package.json @@ -1,25 +1,33 @@ { "name": "@cloudbeaver/plugin-sql-editor-new", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-codemirror6": "~0.1.0", "@cloudbeaver/plugin-sql-editor": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-di": "~0.1.0" + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-navigation-tree": "~0.1.0", + "@cloudbeaver/core-sdk": "~0.1.0", + "@cloudbeaver/core-ui": "~0.1.0", + "@cloudbeaver/core-utils": "~0.1.0" }, - "peerDependencies": {} -} \ No newline at end of file + "peerDependencies": {}, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-sql-editor-new/tsconfig.json b/webapp/packages/plugin-sql-editor-new/tsconfig.json index 053cd7948f..9283fc47a8 100644 --- a/webapp/packages/plugin-sql-editor-new/tsconfig.json +++ b/webapp/packages/plugin-sql-editor-new/tsconfig.json @@ -1,10 +1,52 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src", "../plugin-codemirror6/src/ReactCodemirror.tsx"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-codemirror6" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-editor-screen/package.json b/webapp/packages/plugin-sql-editor-screen/package.json index edb4f05725..65defddded 100644 --- a/webapp/packages/plugin-sql-editor-screen/package.json +++ b/webapp/packages/plugin-sql-editor-screen/package.json @@ -1,30 +1,32 @@ { "name": "@cloudbeaver/plugin-sql-editor-screen", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-sql-editor": "~0.1.0", "@cloudbeaver/plugin-sql-editor-navigation-tab": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" @@ -34,5 +36,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-sql-editor-screen/src/PluginBootstrap.ts b/webapp/packages/plugin-sql-editor-screen/src/PluginBootstrap.ts index f1cd55b62e..5370cdce3f 100644 --- a/webapp/packages/plugin-sql-editor-screen/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-sql-editor-screen/src/PluginBootstrap.ts @@ -5,6 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { MENU_TAB } from '@cloudbeaver/core-ui'; @@ -13,7 +14,6 @@ import { ActionService, DATA_CONTEXT_MENU, IAction, - IDataContextProvider, KEY_BINDING_OPEN_IN_TAB, KeyBindingService, MenuService, diff --git a/webapp/packages/plugin-sql-editor-screen/src/Screen/SqlEditorScreen.tsx b/webapp/packages/plugin-sql-editor-screen/src/Screen/SqlEditorScreen.tsx index 1a2d23e90a..a6f343efd5 100644 --- a/webapp/packages/plugin-sql-editor-screen/src/Screen/SqlEditorScreen.tsx +++ b/webapp/packages/plugin-sql-editor-screen/src/Screen/SqlEditorScreen.tsx @@ -15,8 +15,8 @@ import { IConnectionExecutionContextInfo, } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import type { ScreenComponent } from '@cloudbeaver/core-routing'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; import { uuid } from '@cloudbeaver/core-utils'; import { ISqlEditorTabState, MemorySqlDataSource, SqlDataSourceService, SqlEditor, SqlEditorService } from '@cloudbeaver/plugin-sql-editor'; diff --git a/webapp/packages/plugin-sql-editor-screen/tsconfig.json b/webapp/packages/plugin-sql-editor-screen/tsconfig.json index bd4ed8f7d0..f3507d1fc5 100644 --- a/webapp/packages/plugin-sql-editor-screen/tsconfig.json +++ b/webapp/packages/plugin-sql-editor-screen/tsconfig.json @@ -1,10 +1,61 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-sql-editor-navigation-tab" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-editor/package.json b/webapp/packages/plugin-sql-editor/package.json index af7b86d36a..519d7e1122 100644 --- a/webapp/packages/plugin-sql-editor/package.json +++ b/webapp/packages/plugin-sql-editor/package.json @@ -1,31 +1,30 @@ { "name": "@cloudbeaver/plugin-sql-editor", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/plugin-codemirror6": "~0.1.0", "@cloudbeaver/plugin-data-viewer": "~0.1.0", - "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/plugin-object-viewer": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", + "@cloudbeaver/core-data-context": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", @@ -33,6 +32,7 @@ "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", "@cloudbeaver/core-plugin": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-settings": "~0.1.0", @@ -47,5 +47,8 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" + }, + "devDependencies": { + "@cloudbeaver/tests-runner": "~0.1.0" } } diff --git a/webapp/packages/plugin-sql-editor/src/DATA_CONTEXT_SQL_EDITOR_STATE.ts b/webapp/packages/plugin-sql-editor/src/DATA_CONTEXT_SQL_EDITOR_STATE.ts index 0800d9032b..7391c13884 100644 --- a/webapp/packages/plugin-sql-editor/src/DATA_CONTEXT_SQL_EDITOR_STATE.ts +++ b/webapp/packages/plugin-sql-editor/src/DATA_CONTEXT_SQL_EDITOR_STATE.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { ISqlEditorTabState } from './ISqlEditorTabState'; diff --git a/webapp/packages/plugin-sql-editor/src/MenuBootstrap.ts b/webapp/packages/plugin-sql-editor/src/MenuBootstrap.ts index a99f4a8511..7b8540f542 100644 --- a/webapp/packages/plugin-sql-editor/src/MenuBootstrap.ts +++ b/webapp/packages/plugin-sql-editor/src/MenuBootstrap.ts @@ -5,17 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; -import { - ACTION_REDO, - ACTION_UNDO, - ActionService, - IAction, - IDataContextProvider, - KEY_BINDING_REDO, - KEY_BINDING_UNDO, - KeyBindingService, -} from '@cloudbeaver/core-view'; +import { ACTION_REDO, ACTION_UNDO, ActionService, IAction, KEY_BINDING_REDO, KEY_BINDING_UNDO, KeyBindingService } from '@cloudbeaver/core-view'; import { ACTION_SQL_EDITOR_EXECUTE } from './actions/ACTION_SQL_EDITOR_EXECUTE'; import { ACTION_SQL_EDITOR_EXECUTE_NEW } from './actions/ACTION_SQL_EDITOR_EXECUTE_NEW'; @@ -28,7 +20,6 @@ import { KEY_BINDING_SQL_EDITOR_EXECUTE_NEW } from './actions/bindings/KEY_BINDI import { KEY_BINDING_SQL_EDITOR_EXECUTE_SCRIPT } from './actions/bindings/KEY_BINDING_SQL_EDITOR_EXECUTE_SCRIPT'; import { KEY_BINDING_SQL_EDITOR_FORMAT } from './actions/bindings/KEY_BINDING_SQL_EDITOR_FORMAT'; import { KEY_BINDING_SQL_EDITOR_SHOW_EXECUTION_PLAN } from './actions/bindings/KEY_BINDING_SQL_EDITOR_SHOW_EXECUTION_PLAN'; -import { KEY_BINDING_SQL_EDITOR_SHOW_OUTPUT } from './actions/bindings/KEY_BINDING_SQL_EDITOR_SHOW_OUTPUT'; import { ESqlDataSourceFeatures } from './SqlDataSource/ESqlDataSourceFeatures'; import { DATA_CONTEXT_SQL_EDITOR_DATA } from './SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA.ts b/webapp/packages/plugin-sql-editor/src/SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA.ts index 6a017f9235..0a53c9d549 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { ISQLEditorData } from './ISQLEditorData'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/ScriptImportDialog.tsx b/webapp/packages/plugin-sql-editor/src/SqlEditor/ScriptImportDialog.tsx index b64fedc6d7..513d0ff6c5 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/ScriptImportDialog.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/ScriptImportDialog.tsx @@ -5,8 +5,18 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { Button, Fill, s, Translate, useS } from '@cloudbeaver/core-blocks'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Fill, + s, + Translate, + useS, +} from '@cloudbeaver/core-blocks'; +import type { DialogComponent } from '@cloudbeaver/core-dialogs'; import style from './ScriptImportDialog.m.css'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorActionsMenu.tsx b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorActionsMenu.tsx index b3bdde3ca3..f33f54e54b 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorActionsMenu.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorActionsMenu.tsx @@ -8,8 +8,9 @@ import { observer } from 'mobx-react-lite'; import { s, SContext, StyleRegistry, useS } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { MenuBar, MenuBarItemStyles, MenuBarStyles } from '@cloudbeaver/core-ui'; -import { IDataContext, useMenu } from '@cloudbeaver/core-view'; +import { useMenu } from '@cloudbeaver/core-view'; import type { ISqlEditorTabState } from '../ISqlEditorTabState'; import { SQL_EDITOR_ACTIONS_MENU } from './SQL_EDITOR_ACTIONS_MENU'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorToolsMenu.tsx b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorToolsMenu.tsx index 9d9b373ad3..f9961ea9d7 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorToolsMenu.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorToolsMenu.tsx @@ -8,8 +8,9 @@ import { observer } from 'mobx-react-lite'; import { s, SContext, type StyleRegistry, useS } from '@cloudbeaver/core-blocks'; +import type { IDataContext } from '@cloudbeaver/core-data-context'; import { MenuBar, MenuBarItemStyles, MenuBarStyles } from '@cloudbeaver/core-ui'; -import { IDataContext, useMenu } from '@cloudbeaver/core-view'; +import { useMenu } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_SQL_EDITOR_STATE } from '../DATA_CONTEXT_SQL_EDITOR_STATE'; import type { ISqlEditorTabState } from '../ISqlEditorTabState'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts b/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts index 7234ee2131..1b275724b8 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts @@ -8,10 +8,10 @@ import { action, autorun, computed, IReactionDisposer, observable, untracked } from 'mobx'; import { useEffect } from 'react'; -import { useExecutor, useObservableRef } from '@cloudbeaver/core-blocks'; +import { ConfirmationDialog, useExecutor, useObservableRef } from '@cloudbeaver/core-blocks'; import { ConnectionExecutionContextService, createConnectionParam } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; import { SyncExecutor } from '@cloudbeaver/core-executor'; import type { SqlCompletionProposal, SqlDialectInfo, SqlScriptInfoFragment } from '@cloudbeaver/core-sdk'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditorService.ts b/webapp/packages/plugin-sql-editor/src/SqlEditorService.ts index 7d625aaa36..46ae935668 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditorService.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditorService.ts @@ -22,8 +22,9 @@ import { import { injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { FEATURE_GIT_ID, ServerConfigResource } from '@cloudbeaver/core-root'; -import { CachedMapAllKey, GraphQLService, SqlCompletionProposal, SqlScriptInfoFragment } from '@cloudbeaver/core-sdk'; +import { GraphQLService, SqlCompletionProposal, SqlScriptInfoFragment } from '@cloudbeaver/core-sdk'; import { getSqlEditorName } from './getSqlEditorName'; import type { ISqlEditorTabState } from './ISqlEditorTabState'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.test.ts b/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.test.ts index c55b363d38..7d5628d927 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.test.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.test.ts @@ -7,24 +7,68 @@ */ import '@testing-library/jest-dom'; -import { mockAuthentication } from '@cloudbeaver/core-authentication/mocks/mockAuthentication'; -import { createApp } from '@cloudbeaver/core-cli/tests/utils/createApp'; -import { ServerConfigResource } from '@cloudbeaver/core-root'; -import { createGQLEndpoint } from '@cloudbeaver/core-root/mocks/createGQLEndpoint'; -import { mockAppInit } from '@cloudbeaver/core-root/mocks/mockAppInit'; -import { mockGraphQL } from '@cloudbeaver/core-root/mocks/mockGraphQL'; -import { mockServerConfig } from '@cloudbeaver/core-root/mocks/resolvers/mockServerConfig'; -import dataViewer from '@cloudbeaver/plugin-data-viewer'; -import datasourceContextSwitch from '@cloudbeaver/plugin-datasource-context-switch'; -import navigationTabs from '@cloudbeaver/plugin-navigation-tabs'; -import navigationTree from '@cloudbeaver/plugin-navigation-tree'; -import objectViewer from '@cloudbeaver/plugin-object-viewer'; +import { coreAdministrationManifest } from '@cloudbeaver/core-administration'; +import { coreAppManifest } from '@cloudbeaver/core-app'; +import { coreAuthenticationManifest } from '@cloudbeaver/core-authentication'; +import { mockAuthentication } from '@cloudbeaver/core-authentication/dist/__custom_mocks__/mockAuthentication'; +import { coreBrowserManifest } from '@cloudbeaver/core-browser'; +import { coreConnectionsManifest } from '@cloudbeaver/core-connections'; +import { coreDialogsManifest } from '@cloudbeaver/core-dialogs'; +import { coreEventsManifest } from '@cloudbeaver/core-events'; +import { coreLocalizationManifest } from '@cloudbeaver/core-localization'; +import { coreNavigationTree } from '@cloudbeaver/core-navigation-tree'; +import { corePluginManifest } from '@cloudbeaver/core-plugin'; +import { coreProductManifest } from '@cloudbeaver/core-product'; +import { coreProjectsManifest } from '@cloudbeaver/core-projects'; +import { coreRootManifest, ServerConfigResource } from '@cloudbeaver/core-root'; +import { createGQLEndpoint } from '@cloudbeaver/core-root/dist/__custom_mocks__/createGQLEndpoint'; +import { mockAppInit } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockAppInit'; +import { mockGraphQL } from '@cloudbeaver/core-root/dist/__custom_mocks__/mockGraphQL'; +import { mockServerConfig } from '@cloudbeaver/core-root/dist/__custom_mocks__/resolvers/mockServerConfig'; +import { coreRoutingManifest } from '@cloudbeaver/core-routing'; +import { coreSDKManifest } from '@cloudbeaver/core-sdk'; +import { coreSettingsManifest } from '@cloudbeaver/core-settings'; +import { coreThemingManifest } from '@cloudbeaver/core-theming'; +import { coreUIManifest } from '@cloudbeaver/core-ui'; +import { coreViewManifest } from '@cloudbeaver/core-view'; +import { dataViewerManifest } from '@cloudbeaver/plugin-data-viewer'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { navigationTreePlugin } from '@cloudbeaver/plugin-navigation-tree'; +import { objectViewerManifest } from '@cloudbeaver/plugin-object-viewer'; +import { createApp } from '@cloudbeaver/tests-runner'; import { sqlEditorPluginManifest } from './manifest'; import { SqlEditorSettings, SqlEditorSettingsService } from './SqlEditorSettingsService'; const endpoint = createGQLEndpoint(); -const app = createApp(datasourceContextSwitch, navigationTabs, navigationTree, objectViewer, dataViewer, sqlEditorPluginManifest); +const app = createApp( + sqlEditorPluginManifest, + coreLocalizationManifest, + coreEventsManifest, + corePluginManifest, + coreProductManifest, + coreRootManifest, + coreSDKManifest, + coreBrowserManifest, + coreSettingsManifest, + coreViewManifest, + coreAuthenticationManifest, + coreProjectsManifest, + coreUIManifest, + coreRoutingManifest, + coreAdministrationManifest, + coreConnectionsManifest, + coreDialogsManifest, + coreNavigationTree, + coreAppManifest, + coreThemingManifest, + datasourceContextSwitchPluginManifest, + navigationTreePlugin, + navigationTabsPlugin, + objectViewerManifest, + dataViewerManifest, +); const server = mockGraphQL(...mockAppInit(endpoint), ...mockAuthentication(endpoint)); diff --git a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/DATA_CONTEXT_SQL_EDITOR_RESULT_ID.ts b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/DATA_CONTEXT_SQL_EDITOR_RESULT_ID.ts index 79e9db1227..3195bd3d26 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/DATA_CONTEXT_SQL_EDITOR_RESULT_ID.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/DATA_CONTEXT_SQL_EDITOR_RESULT_ID.ts @@ -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 { createDataContext } from '@cloudbeaver/core-view'; +import { createDataContext } from '@cloudbeaver/core-data-context'; import type { ISqlEditorResultTab } from '../ISqlEditorTabState'; diff --git a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/OutputLogs/OutputLogsResource.ts b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/OutputLogs/OutputLogsResource.ts index 4a03614823..6b5eb125bc 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/OutputLogs/OutputLogsResource.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/OutputLogs/OutputLogsResource.ts @@ -7,8 +7,9 @@ */ import { ConnectionExecutionContextResource } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; +import { CachedDataResource } from '@cloudbeaver/core-resource'; import { ServerEventId } from '@cloudbeaver/core-root'; -import { CachedDataResource, CbDatabaseOutputLogEvent } from '@cloudbeaver/core-sdk'; +import type { CbDatabaseOutputLogEvent } from '@cloudbeaver/core-sdk'; import type { IOutputLogType } from './IOutputLogTypes'; import { OutputLogsEventHandler } from './OutputLogsEventHandler'; @@ -38,7 +39,7 @@ export class OutputLogsResource extends CachedDataResource { ); // hack, we need to call this.use() to initialize resource at startup - this.use(undefined); + this.useTracker.use(undefined); this.connectionExecutionContextResource.onItemDelete.addHandler(key => { this.setData(this.data.filter(log => log.contextId !== key)); diff --git a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx index 258b5463d9..9e3b8fefc9 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx @@ -10,9 +10,10 @@ import { useContext } from 'react'; import styled from 'reshadow'; import { useStyles } from '@cloudbeaver/core-blocks'; +import { useDataContext } from '@cloudbeaver/core-data-context'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { ITabData, Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; -import { CaptureViewContext, useDataContext } from '@cloudbeaver/core-view'; +import { CaptureViewContext } from '@cloudbeaver/core-view'; import type { ISqlEditorResultTab } from '../ISqlEditorTabState'; import { DATA_CONTEXT_SQL_EDITOR_RESULT_ID } from './DATA_CONTEXT_SQL_EDITOR_RESULT_ID'; diff --git a/webapp/packages/plugin-sql-editor/tsconfig.json b/webapp/packages/plugin-sql-editor/tsconfig.json index bd4ed8f7d0..b5b01184b7 100644 --- a/webapp/packages/plugin-sql-editor/tsconfig.json +++ b/webapp/packages/plugin-sql-editor/tsconfig.json @@ -1,10 +1,88 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-codemirror6" + }, + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-data-context" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-settings" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + }, + { + "path": "..\\tests-runner" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sql-generator/package.json b/webapp/packages/plugin-sql-generator/package.json index 7267442041..129913f7b9 100644 --- a/webapp/packages/plugin-sql-generator/package.json +++ b/webapp/packages/plugin-sql-generator/package.json @@ -1,45 +1,37 @@ { "name": "@cloudbeaver/plugin-sql-generator", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", "test": "core-cli-test", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-sql-editor-new": "~0.1.0", + "@cloudbeaver/plugin-codemirror6": "~0.1.0", "@cloudbeaver/plugin-data-viewer": "~0.1.0", - "@cloudbeaver/plugin-datasource-context-switch": "~0.1.0", - "@cloudbeaver/plugin-navigation-tabs": "~0.1.0", - "@cloudbeaver/plugin-navigation-tree": "~0.1.0", - "@cloudbeaver/plugin-object-viewer": "~0.1.0", - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", - "@cloudbeaver/core-authentication": "~0.1.0", + "@cloudbeaver/plugin-sql-editor": "~0.1.0", + "@cloudbeaver/plugin-sql-editor-new": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-connections": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-events": "~0.1.0", - "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", "@cloudbeaver/core-navigation-tree": "~0.1.0", - "@cloudbeaver/core-plugin": "~0.1.0", - "@cloudbeaver/core-root": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", - "@cloudbeaver/core-settings": "~0.1.0", - "@cloudbeaver/core-theming": "~0.1.0", - "@cloudbeaver/core-ui": "~0.1.0", - "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, "peerDependencies": { @@ -48,5 +40,6 @@ "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x", "@testing-library/jest-dom": "~6.x.x" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/plugin-sql-generator/src/ScriptPreview/ScriptPreviewDialog.tsx b/webapp/packages/plugin-sql-generator/src/ScriptPreview/ScriptPreviewDialog.tsx index 7dc306523b..c879519c0d 100644 --- a/webapp/packages/plugin-sql-generator/src/ScriptPreview/ScriptPreviewDialog.tsx +++ b/webapp/packages/plugin-sql-generator/src/ScriptPreview/ScriptPreviewDialog.tsx @@ -7,10 +7,22 @@ */ import { observer } from 'mobx-react-lite'; -import { Button, Fill, s, useClipboard, useResource, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + Fill, + s, + useClipboard, + useResource, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { ConnectionDialectResource, ConnectionExecutionContextService, createConnectionParam } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import { useCodemirrorExtensions } from '@cloudbeaver/plugin-codemirror6'; import type { IDatabaseDataModel } from '@cloudbeaver/plugin-data-viewer'; import { SQLCodeEditorLoader, useSqlDialectExtension } from '@cloudbeaver/plugin-sql-editor-new'; diff --git a/webapp/packages/plugin-sql-generator/src/SqlGenerators/GeneratedSqlDialog.tsx b/webapp/packages/plugin-sql-generator/src/SqlGenerators/GeneratedSqlDialog.tsx index d0ae7fd0d8..5233d9f07f 100644 --- a/webapp/packages/plugin-sql-generator/src/SqlGenerators/GeneratedSqlDialog.tsx +++ b/webapp/packages/plugin-sql-generator/src/SqlGenerators/GeneratedSqlDialog.tsx @@ -9,10 +9,24 @@ import { computed, observable } from 'mobx'; import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; -import { Button, ErrorMessage, Loader, s, useClipboard, useErrorDetails, useObservableRef, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { + Button, + CommonDialogBody, + CommonDialogFooter, + CommonDialogHeader, + CommonDialogWrapper, + ErrorMessage, + Loader, + s, + useClipboard, + useErrorDetails, + useObservableRef, + useS, + useTranslate, +} from '@cloudbeaver/core-blocks'; import { ConnectionInfoResource, createConnectionParam } from '@cloudbeaver/core-connections'; import { useService } from '@cloudbeaver/core-di'; -import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponentProps } from '@cloudbeaver/core-dialogs'; +import type { DialogComponentProps } from '@cloudbeaver/core-dialogs'; import { GQLErrorCatcher, SqlDialectInfo } from '@cloudbeaver/core-sdk'; import { useCodemirrorExtensions } from '@cloudbeaver/plugin-codemirror6'; import { SqlDialectInfoService } from '@cloudbeaver/plugin-sql-editor'; diff --git a/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsBootstrap.ts b/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsBootstrap.ts index 33ba3374ab..7f732c8fe9 100644 --- a/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsBootstrap.ts +++ b/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsBootstrap.ts @@ -8,7 +8,7 @@ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; import { DATA_CONTEXT_NAV_NODE, EObjectFeature } from '@cloudbeaver/core-navigation-tree'; -import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-sdk'; +import { getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { DATA_CONTEXT_MENU, DATA_CONTEXT_MENU_NESTED, MenuBaseItem, MenuService } from '@cloudbeaver/core-view'; import { GeneratedSqlDialog } from './GeneratedSqlDialog'; diff --git a/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsResource.ts b/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsResource.ts index 152784bd3a..653e27ad98 100644 --- a/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsResource.ts +++ b/webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsResource.ts @@ -7,15 +7,8 @@ */ import { injectable } from '@cloudbeaver/core-di'; import { NavNodeInfoResource } from '@cloudbeaver/core-navigation-tree'; -import { - CachedMapResource, - GraphQLService, - isResourceAlias, - ResourceKey, - resourceKeyList, - ResourceKeyUtils, - SqlQueryGenerator, -} from '@cloudbeaver/core-sdk'; +import { CachedMapResource, isResourceAlias, type ResourceKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; +import { GraphQLService, SqlQueryGenerator } from '@cloudbeaver/core-sdk'; export const MAX_GENERATORS_LENGTH = 15; diff --git a/webapp/packages/plugin-sql-generator/tsconfig.json b/webapp/packages/plugin-sql-generator/tsconfig.json index bd4ed8f7d0..a81d95c5cd 100644 --- a/webapp/packages/plugin-sql-generator/tsconfig.json +++ b/webapp/packages/plugin-sql-generator/tsconfig.json @@ -1,10 +1,64 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-codemirror6" + }, + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-sql-editor-new" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-connections" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-navigation-tree" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-sso/package.json b/webapp/packages/plugin-sso/package.json index deece37bc3..90761ff150 100644 --- a/webapp/packages/plugin-sso/package.json +++ b/webapp/packages/plugin-sso/package.json @@ -1,19 +1,24 @@ { "name": "@cloudbeaver/plugin-sso", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, - "peerDependencies": {} -} \ No newline at end of file + "peerDependencies": {}, + "dependencies": { + "@cloudbeaver/core-di": "~0.1.0" + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-sso/src/index.ts b/webapp/packages/plugin-sso/src/index.ts index cb0ff5c3b5..ab5e0e1f96 100644 --- a/webapp/packages/plugin-sso/src/index.ts +++ b/webapp/packages/plugin-sso/src/index.ts @@ -1 +1 @@ -export {}; +export * from './manifest'; diff --git a/webapp/packages/plugin-sso/src/manifest.ts b/webapp/packages/plugin-sso/src/manifest.ts new file mode 100644 index 0000000000..cc556e7b1f --- /dev/null +++ b/webapp/packages/plugin-sso/src/manifest.ts @@ -0,0 +1,16 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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'; + +export const ssoPlugin: PluginManifest = { + info: { + name: 'SSO Plugin', + }, + + providers: [], +}; diff --git a/webapp/packages/plugin-sso/tsconfig.json b/webapp/packages/plugin-sso/tsconfig.json index bd4ed8f7d0..959c65dd59 100644 --- a/webapp/packages/plugin-sso/tsconfig.json +++ b/webapp/packages/plugin-sso/tsconfig.json @@ -1,10 +1,25 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-theme/package.json b/webapp/packages/plugin-theme/package.json index 1beb8cbddd..f6a92dcfa8 100644 --- a/webapp/packages/plugin-theme/package.json +++ b/webapp/packages/plugin-theme/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-theme", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-settings-menu": "~0.1.0", @@ -26,5 +27,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-theme/tsconfig.json b/webapp/packages/plugin-theme/tsconfig.json index bd4ed8f7d0..c7485c9f8a 100644 --- a/webapp/packages/plugin-theme/tsconfig.json +++ b/webapp/packages/plugin-theme/tsconfig.json @@ -1,10 +1,34 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-tools-panel/package.json b/webapp/packages/plugin-tools-panel/package.json index 2682c3304b..78098a7828 100644 --- a/webapp/packages/plugin-tools-panel/package.json +++ b/webapp/packages/plugin-tools-panel/package.json @@ -1,25 +1,28 @@ { "name": "@cloudbeaver/plugin-tools-panel", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-top-app-bar": "~0.1.0", + "@cloudbeaver/core-app": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-plugin": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-utils": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" @@ -29,5 +32,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-tools-panel/src/PluginBootstrap.ts b/webapp/packages/plugin-tools-panel/src/PluginBootstrap.ts index 31e8c99c8e..a8add79e59 100644 --- a/webapp/packages/plugin-tools-panel/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-tools-panel/src/PluginBootstrap.ts @@ -5,6 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import React from 'react'; + +import { AppScreenService } from '@cloudbeaver/core-app'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { DATA_CONTEXT_MENU, MenuService } from '@cloudbeaver/core-view'; import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar'; @@ -12,13 +15,27 @@ import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar'; import { MENU_TOOLS } from './Menu/MENU_TOOLS'; import { ToolsPanelService } from './ToolsPanel/ToolsPanelService'; +const ToolsPanel = React.lazy(async () => { + const { ToolsPanel } = await import('./ToolsPanel/ToolsPanel'); + return { default: ToolsPanel }; +}); + @injectable() export class PluginBootstrap extends Bootstrap { - constructor(private readonly menuService: MenuService, private readonly toolsPanelService: ToolsPanelService) { + constructor( + private readonly appScreenService: AppScreenService, + private readonly menuService: MenuService, + private readonly toolsPanelService: ToolsPanelService, + ) { super(); } register(): void { + this.appScreenService.rightAreaBottom.add( + ToolsPanel, + undefined, + () => this.toolsPanelService.disabled || this.toolsPanelService.tabsContainer.getDisplayed().length === 0, + ); this.menuService.addCreator({ menus: [MENU_APP_ACTIONS], getItems: (context, items) => [...items, MENU_TOOLS], diff --git a/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx b/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx index cd7d5803b2..7d2dc80757 100644 --- a/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx +++ b/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx @@ -11,9 +11,12 @@ import { useRef } from 'react'; import styled, { css } from 'reshadow'; import { useStyles, useUserData } from '@cloudbeaver/core-blocks'; -import { BASE_TAB_STYLES, ITabData, ITabsContainer, TabList, TabPanelList, TabsState, UNDERLINE_TAB_STYLES } from '@cloudbeaver/core-ui'; +import { useService } from '@cloudbeaver/core-di'; +import { BASE_TAB_STYLES, ITabData, TabList, TabPanelList, TabsState, UNDERLINE_TAB_STYLES } from '@cloudbeaver/core-ui'; import { isArraysEqual } from '@cloudbeaver/core-utils'; +import { ToolsPanelService } from './ToolsPanelService'; + const tabsStyles = css` TabList { display: flex; @@ -47,18 +50,16 @@ const formStyles = css` } `; -interface Props { - container: ITabsContainer; -} - interface IToolsState { selectedTabId: string | undefined; } -export const ToolsPanel = observer(function ToolsPanel({ container }) { +export const ToolsPanel = observer(function ToolsPanel() { + const toolsPanelService = useService(ToolsPanelService); + const state = useUserData('tools', () => ({ selectedTabId: undefined })); const tabStyle = [BASE_TAB_STYLES, tabsStyles, UNDERLINE_TAB_STYLES]; - const tabs = container.getIdList(); + const tabs = toolsPanelService.tabsContainer.getIdList(); const prevTabs = useRef(tabs); const equal = isArraysEqual(prevTabs.current, tabs); @@ -92,7 +93,7 @@ export const ToolsPanel = observer(function ToolsPanel({ container }) { } return styled(useStyles(tabStyle, formStyles))( - + diff --git a/webapp/packages/plugin-tools-panel/tsconfig.json b/webapp/packages/plugin-tools-panel/tsconfig.json index bd4ed8f7d0..e5f4e05efb 100644 --- a/webapp/packages/plugin-tools-panel/tsconfig.json +++ b/webapp/packages/plugin-tools-panel/tsconfig.json @@ -1,10 +1,49 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-plugin" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-utils" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-top-app-bar-administration/.gitignore b/webapp/packages/plugin-top-app-bar-administration/.gitignore new file mode 100644 index 0000000000..15bc16c7c3 --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/.gitignore @@ -0,0 +1,17 @@ +# dependencies +/node_modules + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/plugin-top-app-bar-administration/package.json b/webapp/packages/plugin-top-app-bar-administration/package.json new file mode 100644 index 0000000000..467f62d76e --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/package.json @@ -0,0 +1,31 @@ +{ + "name": "@cloudbeaver/plugin-top-app-bar-administration", + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@cloudbeaver/plugin-administration": "~0.1.0", + "@cloudbeaver/plugin-top-app-bar": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0" + }, + "peerDependencies": { + "react": "~18.x.x", + "mobx": "~6.x.x", + "mobx-react-lite": "~3.x.x", + "reshadow": "~0.x.x" + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-top-app-bar-administration/src/PluginBootstrap.ts b/webapp/packages/plugin-top-app-bar-administration/src/PluginBootstrap.ts new file mode 100644 index 0000000000..87c8be0df4 --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/src/PluginBootstrap.ts @@ -0,0 +1,24 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { AdministrationTopAppBarService } from '@cloudbeaver/plugin-administration'; + +import { AdminTopNavBar } from './TopNavBar/AdminTopNavBar'; + +@injectable() +export class PluginBootstrap extends Bootstrap { + constructor(private readonly administrationTopAppBarService: AdministrationTopAppBarService) { + super(); + } + + register(): void | Promise { + this.administrationTopAppBarService.navBarPlaceholder.add(AdminTopNavBar); + } + + load(): void | Promise {} +} diff --git a/webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdminTopNavBar.tsx b/webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdminTopNavBar.tsx new file mode 100644 index 0000000000..d15fb270de --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdminTopNavBar.tsx @@ -0,0 +1,18 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { useService } from '@cloudbeaver/core-di'; +import { AdministrationTopAppBarService } from '@cloudbeaver/plugin-administration'; +import { TopNavBar } from '@cloudbeaver/plugin-top-app-bar'; + +interface Props { + className?: string; +} +export const AdminTopNavBar: React.FC = function PublicTopNavBar({ className }) { + const administrationTopAppBarService = useService(AdministrationTopAppBarService); + return ; +}; diff --git a/webapp/packages/plugin-top-app-bar/src/TopNavBar/AdministrationTopAppBarBootstrapService.ts b/webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdministrationTopAppBarBootstrap.ts similarity index 86% rename from webapp/packages/plugin-top-app-bar/src/TopNavBar/AdministrationTopAppBarBootstrapService.ts rename to webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdministrationTopAppBarBootstrap.ts index 021920b2a6..5e673567a3 100644 --- a/webapp/packages/plugin-top-app-bar/src/TopNavBar/AdministrationTopAppBarBootstrapService.ts +++ b/webapp/packages/plugin-top-app-bar-administration/src/TopNavBar/AdministrationTopAppBarBootstrap.ts @@ -7,11 +7,10 @@ */ import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { AdministrationTopAppBarService, WizardTopAppBarService } from '@cloudbeaver/plugin-administration'; - -import { Logo } from './Logo'; +import { Logo } from '@cloudbeaver/plugin-top-app-bar'; @injectable() -export class AdministrationTopAppBarBootstrapService extends Bootstrap { +export class AdministrationTopAppBarBootstrap extends Bootstrap { constructor( private readonly administrationTopAppBarService: AdministrationTopAppBarService, private readonly wizardTopAppBarService: WizardTopAppBarService, diff --git a/webapp/packages/plugin-top-app-bar-administration/src/index.ts b/webapp/packages/plugin-top-app-bar-administration/src/index.ts new file mode 100644 index 0000000000..da6b453280 --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/src/index.ts @@ -0,0 +1,6 @@ +import { administrationTopAppBarPlugin } from './manifest'; + +export * from './TopNavBar/AdministrationTopAppBarBootstrap'; + +export { administrationTopAppBarPlugin }; +export default administrationTopAppBarPlugin; diff --git a/webapp/packages/plugin-top-app-bar-administration/src/manifest.ts b/webapp/packages/plugin-top-app-bar-administration/src/manifest.ts new file mode 100644 index 0000000000..1ab6f4954d --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/src/manifest.ts @@ -0,0 +1,18 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 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 { PluginBootstrap } from './PluginBootstrap'; +import { AdministrationTopAppBarBootstrap } from './TopNavBar/AdministrationTopAppBarBootstrap'; + +export const administrationTopAppBarPlugin: PluginManifest = { + info: { + name: 'Administration Top App Bar plugin', + }, + providers: [PluginBootstrap, AdministrationTopAppBarBootstrap], +}; diff --git a/webapp/packages/plugin-top-app-bar-administration/tsconfig.json b/webapp/packages/plugin-top-app-bar-administration/tsconfig.json new file mode 100644 index 0000000000..02c4cdb2e7 --- /dev/null +++ b/webapp/packages/plugin-top-app-bar-administration/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\plugin-administration" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/packages/plugin-top-app-bar/package.json b/webapp/packages/plugin-top-app-bar/package.json index 8458f039af..e117fc4e7e 100644 --- a/webapp/packages/plugin-top-app-bar/package.json +++ b/webapp/packages/plugin-top-app-bar/package.json @@ -1,30 +1,29 @@ { "name": "@cloudbeaver/plugin-top-app-bar", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/plugin-version": "~0.1.0", - "@cloudbeaver/plugin-administration": "~0.1.0", - "@cloudbeaver/core-administration": "~0.1.0", + "@cloudbeaver/core-app": "~0.1.0", + "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-dialogs": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", "@cloudbeaver/core-routing": "~0.1.0", - "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", "@cloudbeaver/core-view": "~0.1.0" }, @@ -33,5 +32,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-top-app-bar/src/index.ts b/webapp/packages/plugin-top-app-bar/src/index.ts index 2be1be1935..e9f4ae3fea 100644 --- a/webapp/packages/plugin-top-app-bar/src/index.ts +++ b/webapp/packages/plugin-top-app-bar/src/index.ts @@ -4,7 +4,6 @@ export * from './TopNavBar/AppStateMenu/AppStateMenu'; export * from './TopNavBar/AppStateMenu/MENU_APP_STATE'; export * from './TopNavBar/MainMenu/MENU_APP_ACTIONS'; export * from './TopNavBar/TopNavService'; -export * from './TopNavBar/AdministrationTopAppBarBootstrapService'; export * from './TopNavBar/Logo'; export * from './TopNavBar/TopNavBar'; export { default as TopMenuWrapperStyles } from './TopNavBar/shared/TopMenuWrapper.m.css'; diff --git a/webapp/packages/plugin-top-app-bar/src/manifest.ts b/webapp/packages/plugin-top-app-bar/src/manifest.ts index 39a7523df0..0b624752af 100644 --- a/webapp/packages/plugin-top-app-bar/src/manifest.ts +++ b/webapp/packages/plugin-top-app-bar/src/manifest.ts @@ -8,12 +8,11 @@ import type { PluginManifest } from '@cloudbeaver/core-di'; import { PluginBootstrap } from './PluginBootstrap'; -import { AdministrationTopAppBarBootstrapService } from './TopNavBar/AdministrationTopAppBarBootstrapService'; import { TopNavService } from './TopNavBar/TopNavService'; export const topAppBarPlugin: PluginManifest = { info: { name: 'Top App Bar plugin', }, - providers: [PluginBootstrap, TopNavService, AdministrationTopAppBarBootstrapService], + providers: [PluginBootstrap, TopNavService], }; diff --git a/webapp/packages/plugin-top-app-bar/tsconfig.json b/webapp/packages/plugin-top-app-bar/tsconfig.json index bd4ed8f7d0..74e21438b9 100644 --- a/webapp/packages/plugin-top-app-bar/tsconfig.json +++ b/webapp/packages/plugin-top-app-bar/tsconfig.json @@ -1,10 +1,49 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-version" + }, + { + "path": "..\\core-app" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-routing" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-user-profile-administration/package.json b/webapp/packages/plugin-user-profile-administration/package.json index 49324fae5a..aaea4e6a11 100644 --- a/webapp/packages/plugin-user-profile-administration/package.json +++ b/webapp/packages/plugin-user-profile-administration/package.json @@ -1,23 +1,24 @@ { "name": "@cloudbeaver/plugin-user-profile-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "@cloudbeaver/plugin-administration": "~0.1.0", "@cloudbeaver/plugin-user-profile": "~0.1.0", - "@cloudbeaver/core-administration": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0" }, "peerDependencies": { @@ -25,5 +26,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-user-profile-administration/tsconfig.json b/webapp/packages/plugin-user-profile-administration/tsconfig.json index bd4ed8f7d0..7ad4ede8d8 100644 --- a/webapp/packages/plugin-user-profile-administration/tsconfig.json +++ b/webapp/packages/plugin-user-profile-administration/tsconfig.json @@ -1,10 +1,31 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-administration" + }, + { + "path": "..\\plugin-user-profile" + }, + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-user-profile/package.json b/webapp/packages/plugin-user-profile/package.json index 77ee8ee9ed..7ee90e7338 100644 --- a/webapp/packages/plugin-user-profile/package.json +++ b/webapp/packages/plugin-user-profile/package.json @@ -1,23 +1,24 @@ { "name": "@cloudbeaver/plugin-user-profile", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/plugin-authentication": "~0.1.0", + "@cloudbeaver/plugin-top-app-bar": "~0.1.0", "@cloudbeaver/core-authentication": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", @@ -25,6 +26,7 @@ "@cloudbeaver/core-events": "~0.1.0", "@cloudbeaver/core-executor": "~0.1.0", "@cloudbeaver/core-localization": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-theming": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", @@ -35,5 +37,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/AuthProvidersList.tsx b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/AuthProvidersList.tsx index afac0b08a1..7be62cb45d 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/AuthProvidersList.tsx +++ b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/AuthProvidersList.tsx @@ -10,7 +10,8 @@ import styled, { css } from 'reshadow'; import { AuthProvidersResource } from '@cloudbeaver/core-authentication'; import { Cell, getComputed, IconOrImage, Link, Loader, useResource, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; -import { resourceKeyList, UserInfo } from '@cloudbeaver/core-sdk'; +import { resourceKeyList } from '@cloudbeaver/core-resource'; +import type { UserInfo } from '@cloudbeaver/core-sdk'; const styles = css` container { diff --git a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/UserAuthProvidersTab.tsx b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/UserAuthProvidersTab.tsx index 4fa1639c63..133994ff5d 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/UserAuthProvidersTab.tsx +++ b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthProviders/UserAuthProvidersTab.tsx @@ -8,6 +8,7 @@ import { observer } from 'mobx-react-lite'; import styled from 'reshadow'; +import { useStyles, useTranslate } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { Tab, TabTitle } from '@cloudbeaver/core-ui'; diff --git a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/AuthTokenList.tsx b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/AuthTokenList.tsx index 4a0718e650..e97923e524 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/AuthTokenList.tsx +++ b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/AuthTokenList.tsx @@ -11,7 +11,8 @@ import styled, { css } from 'reshadow'; import { AuthProviderConfiguration, AuthProvidersResource } from '@cloudbeaver/core-authentication'; import { Button, Cell, IconOrImage, Link, Loader, useResource, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CachedMapAllKey, UserInfo } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; +import type { UserInfo } from '@cloudbeaver/core-sdk'; import { AuthenticationService } from '@cloudbeaver/plugin-authentication'; const styles = css` diff --git a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/UserAuthProvidersTab.tsx b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/UserAuthProvidersTab.tsx index 4fa1639c63..133994ff5d 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/UserAuthProvidersTab.tsx +++ b/webapp/packages/plugin-user-profile/src/UserProfileForm/AuthTokens/UserAuthProvidersTab.tsx @@ -8,6 +8,7 @@ import { observer } from 'mobx-react-lite'; import styled from 'reshadow'; +import { useStyles, useTranslate } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { Tab, TabTitle } from '@cloudbeaver/core-ui'; diff --git a/webapp/packages/plugin-user-profile/src/UserProfileService.ts b/webapp/packages/plugin-user-profile/src/UserProfileService.ts index ebac6e1e1f..c2f3b917c6 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileService.ts +++ b/webapp/packages/plugin-user-profile/src/UserProfileService.ts @@ -8,8 +8,9 @@ import { action, makeObservable, observable } from 'mobx'; import { UserInfoResource } from '@cloudbeaver/core-authentication'; +import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { injectable } from '@cloudbeaver/core-di'; -import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs'; +import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { ExecutorInterrupter, IExecutorHandler } from '@cloudbeaver/core-executor'; import { OptionsPanelService } from '@cloudbeaver/core-ui'; diff --git a/webapp/packages/plugin-user-profile/tsconfig.json b/webapp/packages/plugin-user-profile/tsconfig.json index bd4ed8f7d0..7bff914f9e 100644 --- a/webapp/packages/plugin-user-profile/tsconfig.json +++ b/webapp/packages/plugin-user-profile/tsconfig.json @@ -1,10 +1,64 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-authentication" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\core-authentication" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-dialogs" + }, + { + "path": "..\\core-events" + }, + { + "path": "..\\core-executor" + }, + { + "path": "..\\core-localization" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-sdk" + }, + { + "path": "..\\core-theming" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-view" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-version-update-administration/package.json b/webapp/packages/plugin-version-update-administration/package.json index 7f84346203..8c2abe09bc 100644 --- a/webapp/packages/plugin-version-update-administration/package.json +++ b/webapp/packages/plugin-version-update-administration/package.json @@ -1,36 +1,37 @@ { "name": "@cloudbeaver/plugin-version-update-administration", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { + "react-markdown": "7.1.1", "@cloudbeaver/core-administration": "~0.1.0", "@cloudbeaver/core-blocks": "~0.1.0", "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-events": "~0.1.0", + "@cloudbeaver/core-resource": "~0.1.0", "@cloudbeaver/core-root": "~0.1.0", - "@cloudbeaver/core-sdk": "~0.1.0", "@cloudbeaver/core-ui": "~0.1.0", - "@cloudbeaver/core-version-update": "~0.1.0", "@cloudbeaver/core-version": "~0.1.0", - "react-markdown": "7.1.1" + "@cloudbeaver/core-version-update": "~0.1.0" }, "peerDependencies": { "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "react": "~18.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx index f51e7b693f..003987ca90 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdate.tsx @@ -12,7 +12,7 @@ import { gte } from 'semver'; import type { AdministrationItemContentComponent } from '@cloudbeaver/core-administration'; import { ColoredContainer, useResource, useStyles } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { VersionResource, VersionService } from '@cloudbeaver/core-version'; import { Instructions } from './Instructions'; diff --git a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx index d760a3b52c..564034c548 100644 --- a/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx +++ b/webapp/packages/plugin-version-update-administration/src/VersionUpdateDrawerItem.tsx @@ -11,7 +11,7 @@ import styled, { css } from 'reshadow'; import type { AdministrationItemDrawerProps } from '@cloudbeaver/core-administration'; import { Translate, useResource, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; +import { CachedMapAllKey } from '@cloudbeaver/core-resource'; import { Tab, TabIcon, TabTitle } from '@cloudbeaver/core-ui'; import { VersionResource } from '@cloudbeaver/core-version'; import { VersionUpdateService } from '@cloudbeaver/core-version-update'; diff --git a/webapp/packages/plugin-version-update-administration/tsconfig.json b/webapp/packages/plugin-version-update-administration/tsconfig.json index bd4ed8f7d0..d0cd0e7e20 100644 --- a/webapp/packages/plugin-version-update-administration/tsconfig.json +++ b/webapp/packages/plugin-version-update-administration/tsconfig.json @@ -1,10 +1,46 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-administration" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-resource" + }, + { + "path": "..\\core-root" + }, + { + "path": "..\\core-ui" + }, + { + "path": "..\\core-version" + }, + { + "path": "..\\core-version-update" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/plugin-version/package.json b/webapp/packages/plugin-version/package.json index ece7c9aa98..ece2a51f4a 100644 --- a/webapp/packages/plugin-version/package.json +++ b/webapp/packages/plugin-version/package.json @@ -1,19 +1,20 @@ { "name": "@cloudbeaver/plugin-version", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "0.1.0", "description": "", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/*", - "build": "webpack --config ../../configs/webpack.plugin.config.js", - "postbuild": "tsc", + "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", - "validate-dependencies": "core-cli-validate-dependencies" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { "@cloudbeaver/core-di": "~0.1.0", @@ -24,5 +25,6 @@ "mobx": "~6.x.x", "mobx-react-lite": "~3.x.x", "reshadow": "~0.x.x" - } -} \ No newline at end of file + }, + "devDependencies": {} +} diff --git a/webapp/packages/plugin-version/tsconfig.json b/webapp/packages/plugin-version/tsconfig.json index bd4ed8f7d0..973d713091 100644 --- a/webapp/packages/plugin-version/tsconfig.json +++ b/webapp/packages/plugin-version/tsconfig.json @@ -1,10 +1,28 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\core-di" + }, + { + "path": "..\\core-version" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/product-default/package.json b/webapp/packages/product-default/package.json index 7cf0927168..817df44ce1 100644 --- a/webapp/packages/product-default/package.json +++ b/webapp/packages/product-default/package.json @@ -1,30 +1,27 @@ { "name": "@cloudbeaver/product-default", - "sideEffects": false, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], "version": "23.2.2", - "description": "", + "description": "CloudBeaver Community", "license": "Apache-2.0", - "main": "lib/index.js", - "module": "lib/index.js", - "types": "src/index.ts", + "main": "dist/index.js", "scripts": { - "prebuild": "rimraf --glob lib/* && rimraf tsconfig.tsbuildinfo && cd ../../ && lerna run gql:gen --stream --parallel", + "prebuild": "rimraf --glob lib/* && lerna run gql:gen --stream --parallel && tsc -b", "build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.product.config.js", - "dev": "concurrently -P -k \"cd ../../ && 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 {@}\"", - "preanalyse": "rimraf --glob lib/* && if not exist lib mkdir lib", + "dev": "yarn run prebuild && concurrently -P -k \"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", "postanalyse": "core-cli-analyzer ./lib/stats.json", "lint": "eslint ./src/ --ext .ts,.tsx", "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "version:new": "yarn version --no-git-tag-version", - "postinstall": "rimraf node_modules/.cache" + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" }, "dependencies": { - "@cloudbeaver/core-blocks": "~0.1.0", - "@cloudbeaver/core-bootstrap": "~0.1.0", - "@cloudbeaver/core-di": "~0.1.0", - "@cloudbeaver/core-product": "~0.1.0", - "@cloudbeaver/core-version-update": "~0.1.0", "@cloudbeaver/plugin-administration": "~0.1.0", "@cloudbeaver/plugin-authentication": "~0.1.0", "@cloudbeaver/plugin-authentication-administration": "~0.1.0", @@ -54,7 +51,9 @@ "@cloudbeaver/plugin-projects": "~0.1.0", "@cloudbeaver/plugin-resource-manager": "~0.1.0", "@cloudbeaver/plugin-resource-manager-administration": "~0.1.0", + "@cloudbeaver/plugin-resource-manager-scripts": "~0.1.0", "@cloudbeaver/plugin-root": "~0.1.0", + "@cloudbeaver/plugin-session-expiration": "~0.1.0", "@cloudbeaver/plugin-settings-menu": "~0.1.0", "@cloudbeaver/plugin-settings-menu-administration": "~0.1.0", "@cloudbeaver/plugin-settings-panel": "~0.1.0", @@ -67,15 +66,22 @@ "@cloudbeaver/plugin-theme": "~0.1.0", "@cloudbeaver/plugin-tools-panel": "~0.1.0", "@cloudbeaver/plugin-top-app-bar": "~0.1.0", + "@cloudbeaver/plugin-top-app-bar-administration": "~0.1.0", "@cloudbeaver/plugin-user-profile": "~0.1.0", "@cloudbeaver/plugin-user-profile-administration": "~0.1.0", "@cloudbeaver/plugin-version": "~0.1.0", - "@cloudbeaver/plugin-version-update-administration": "~0.1.0" - }, - "peerDependencies": { + "@cloudbeaver/plugin-version-update-administration": "~0.1.0", + "@cloudbeaver/core-blocks": "~0.1.0", + "@cloudbeaver/core-bootstrap": "~0.1.0", + "@cloudbeaver/core-di": "~0.1.0", + "@cloudbeaver/core-product": "~0.1.0", + "@cloudbeaver/core-version-update": "~0.1.0", + "@cloudbeaver/plugin-sso": "~0.1.0", "reflect-metadata": "~0.x.x" }, + "peerDependencies": {}, "product": { "name": "CloudBeaver Community" - } + }, + "devDependencies": {} } diff --git a/webapp/packages/product-default/src/index.ts b/webapp/packages/product-default/src/index.ts index a2980f05bd..2742dcde9d 100644 --- a/webapp/packages/product-default/src/index.ts +++ b/webapp/packages/product-default/src/index.ts @@ -11,28 +11,29 @@ import connectionSearch from '@cloudbeaver/plugin-connection-search'; import connectionTemplate from '@cloudbeaver/plugin-connection-template'; import connectionPlugin from '@cloudbeaver/plugin-connections'; import connectionAdministration from '@cloudbeaver/plugin-connections-administration'; -import dataExport from '@cloudbeaver/plugin-data-export'; -import spreadsheetNew from '@cloudbeaver/plugin-data-spreadsheet-new'; -import dataViewer from '@cloudbeaver/plugin-data-viewer'; +import { dataExportManifest } from '@cloudbeaver/plugin-data-export'; +import { dataSpreadsheetNewManifest } from '@cloudbeaver/plugin-data-spreadsheet-new'; +import { dataViewerManifest } from '@cloudbeaver/plugin-data-viewer'; import { dvResultSetGroupingPlugin } from '@cloudbeaver/plugin-data-viewer-result-set-grouping'; -import datasourceContextSwitch from '@cloudbeaver/plugin-datasource-context-switch'; +import { datasourceContextSwitchPluginManifest } from '@cloudbeaver/plugin-datasource-context-switch'; import ddlViewer from '@cloudbeaver/plugin-ddl-viewer'; import devTools from '@cloudbeaver/plugin-devtools'; import gisViewer from '@cloudbeaver/plugin-gis-viewer'; import help from '@cloudbeaver/plugin-help'; import localization from '@cloudbeaver/plugin-localization'; import logViewer from '@cloudbeaver/plugin-log-viewer'; -import navigationTabs from '@cloudbeaver/plugin-navigation-tabs'; -import navigationTree from '@cloudbeaver/plugin-navigation-tree'; +import { navigationTabsPlugin } from '@cloudbeaver/plugin-navigation-tabs'; +import { navigationTreePlugin } from '@cloudbeaver/plugin-navigation-tree'; import navigationTreeFilters from '@cloudbeaver/plugin-navigation-tree-filters'; import { navigationTreeRMPlugin } from '@cloudbeaver/plugin-navigation-tree-rm'; -import objectViewer from '@cloudbeaver/plugin-object-viewer'; +import { objectViewerManifest } from '@cloudbeaver/plugin-object-viewer'; import productPlugin from '@cloudbeaver/plugin-product'; import projects from '@cloudbeaver/plugin-projects'; import resourceManager from '@cloudbeaver/plugin-resource-manager'; import resourceManagerAdministration from '@cloudbeaver/plugin-resource-manager-administration'; import resourceManagerScripts from '@cloudbeaver/plugin-resource-manager-scripts'; import root from '@cloudbeaver/plugin-root'; +import { sessionExpirationPlugin } from '@cloudbeaver/plugin-session-expiration'; import settingsMenu from '@cloudbeaver/plugin-settings-menu'; import settingsMenuAdministration from '@cloudbeaver/plugin-settings-menu-administration'; import settingsPanelPlugin from '@cloudbeaver/plugin-settings-panel'; @@ -42,9 +43,11 @@ import sqlEditorResource from '@cloudbeaver/plugin-sql-editor-navigation-tab-scr import sqlEditorNew from '@cloudbeaver/plugin-sql-editor-new'; import sqlEditorScreen from '@cloudbeaver/plugin-sql-editor-screen'; import { sqlGeneratorPlugin } from '@cloudbeaver/plugin-sql-generator'; +import { ssoPlugin } from '@cloudbeaver/plugin-sso'; import theme from '@cloudbeaver/plugin-theme'; import toolsPanel from '@cloudbeaver/plugin-tools-panel'; import topAppBar from '@cloudbeaver/plugin-top-app-bar'; +import { administrationTopAppBarPlugin } from '@cloudbeaver/plugin-top-app-bar-administration'; import userProfile from '@cloudbeaver/plugin-user-profile'; import userProfileAdministration from '@cloudbeaver/plugin-user-profile-administration'; import version from '@cloudbeaver/plugin-version'; @@ -53,9 +56,10 @@ import versionUpdate from '@cloudbeaver/plugin-version-update-administration'; import { defaultProductManifest } from './manifest'; const PLUGINS: PluginManifest[] = [ + ssoPlugin, devTools, administration, - spreadsheetNew, + dataSpreadsheetNewManifest, authentication, authenticationAdministration, theme, @@ -63,12 +67,12 @@ const PLUGINS: PluginManifest[] = [ connectionCustom, connectionTemplate, connectionSearch, - dataExport, - dataViewer, + dataExportManifest, + dataViewerManifest, dvResultSetGroupingPlugin, gisViewer, ddlViewer, - objectViewer, + objectViewerManifest, sqlEditor, sqlEditorTab, sqlEditorScreen, @@ -90,13 +94,15 @@ const PLUGINS: PluginManifest[] = [ resourceManagerScripts, sqlEditorResource, logViewer, - navigationTree, + navigationTreePlugin, navigationTreeRMPlugin, - datasourceContextSwitch, + datasourceContextSwitchPluginManifest, topAppBar, + administrationTopAppBarPlugin, version, - navigationTabs, + navigationTabsPlugin, root, + sessionExpirationPlugin, toolsPanel, projects, browserPlugin, diff --git a/webapp/packages/product-default/tsconfig.json b/webapp/packages/product-default/tsconfig.json index bd4ed8f7d0..f3774f2a36 100644 --- a/webapp/packages/product-default/tsconfig.json +++ b/webapp/packages/product-default/tsconfig.json @@ -1,10 +1,187 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "rootDir": "src", - "outDir": "lib" + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" }, - "include": ["src"], - "exclude": ["**/node_modules", "**/.*/"], - "references": [{ "path": "../*" }] + "references": [ + { + "path": "..\\plugin-administration" + }, + { + "path": "..\\plugin-authentication" + }, + { + "path": "..\\plugin-authentication-administration" + }, + { + "path": "..\\plugin-browser" + }, + { + "path": "..\\plugin-connection-custom" + }, + { + "path": "..\\plugin-connection-search" + }, + { + "path": "..\\plugin-connection-template" + }, + { + "path": "..\\plugin-connections" + }, + { + "path": "..\\plugin-connections-administration" + }, + { + "path": "..\\plugin-data-export" + }, + { + "path": "..\\plugin-data-spreadsheet-new" + }, + { + "path": "..\\plugin-data-viewer" + }, + { + "path": "..\\plugin-data-viewer-result-set-grouping" + }, + { + "path": "..\\plugin-datasource-context-switch" + }, + { + "path": "..\\plugin-ddl-viewer" + }, + { + "path": "..\\plugin-devtools" + }, + { + "path": "..\\plugin-gis-viewer" + }, + { + "path": "..\\plugin-help" + }, + { + "path": "..\\plugin-localization" + }, + { + "path": "..\\plugin-log-viewer" + }, + { + "path": "..\\plugin-navigation-tabs" + }, + { + "path": "..\\plugin-navigation-tree" + }, + { + "path": "..\\plugin-navigation-tree-filters" + }, + { + "path": "..\\plugin-navigation-tree-rm" + }, + { + "path": "..\\plugin-object-viewer" + }, + { + "path": "..\\plugin-product" + }, + { + "path": "..\\plugin-projects" + }, + { + "path": "..\\plugin-resource-manager" + }, + { + "path": "..\\plugin-resource-manager-administration" + }, + { + "path": "..\\plugin-resource-manager-scripts" + }, + { + "path": "..\\plugin-root" + }, + { + "path": "..\\plugin-session-expiration" + }, + { + "path": "..\\plugin-settings-menu" + }, + { + "path": "..\\plugin-settings-menu-administration" + }, + { + "path": "..\\plugin-settings-panel" + }, + { + "path": "..\\plugin-sql-editor" + }, + { + "path": "..\\plugin-sql-editor-navigation-tab" + }, + { + "path": "..\\plugin-sql-editor-navigation-tab-script" + }, + { + "path": "..\\plugin-sql-editor-new" + }, + { + "path": "..\\plugin-sql-editor-screen" + }, + { + "path": "..\\plugin-sql-generator" + }, + { + "path": "..\\plugin-theme" + }, + { + "path": "..\\plugin-tools-panel" + }, + { + "path": "..\\plugin-top-app-bar" + }, + { + "path": "..\\plugin-top-app-bar-administration" + }, + { + "path": "..\\plugin-user-profile" + }, + { + "path": "..\\plugin-user-profile-administration" + }, + { + "path": "..\\plugin-version" + }, + { + "path": "..\\plugin-version-update-administration" + }, + { + "path": "..\\core-blocks" + }, + { + "path": "..\\core-bootstrap" + }, + { + "path": "..\\core-di" + }, + { + "path": "..\\core-product" + }, + { + "path": "..\\core-version-update" + }, + { + "path": "..\\plugin-sso" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] } diff --git a/webapp/packages/tests-runner/.gitignore b/webapp/packages/tests-runner/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/tests-runner/.gitignore @@ -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* diff --git a/webapp/packages/tests-runner/package.json b/webapp/packages/tests-runner/package.json new file mode 100644 index 0000000000..730b182470 --- /dev/null +++ b/webapp/packages/tests-runner/package.json @@ -0,0 +1,32 @@ +{ + "name": "@cloudbeaver/tests-runner", + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "dist/index.js", + "scripts": { + "build": "tsc -b", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", + "pretest": "tsc -b", + "test": "core-cli-test", + "validate-dependencies": "core-cli-validate-dependencies", + "update-ts-references": "rimraf --glob dist/* && typescript-resolve-references" + }, + "dependencies": { + "@testing-library/react": "^14.x.x", + "@cloudbeaver/core-di": "~0.1.0" + }, + "peerDependencies": { + "@testing-library/jest-dom": "~6.x.x", + "mobx": "~6.x.x", + "react": "~18.x.x", + "reshadow": "~0.x.x" + }, + "sideEffects": [ + "src/**/*.css", + "src/**/*.scss", + "public/**/*" + ], + "devDependencies": {} +} diff --git a/webapp/packages/core-cli/tests/utils/createApp.ts b/webapp/packages/tests-runner/src/createApp.ts similarity index 88% rename from webapp/packages/core-cli/tests/utils/createApp.ts rename to webapp/packages/tests-runner/src/createApp.ts index d2eb5fd0b4..515427e0f5 100644 --- a/webapp/packages/core-cli/tests/utils/createApp.ts +++ b/webapp/packages/tests-runner/src/createApp.ts @@ -7,7 +7,6 @@ */ import { configure } from 'mobx'; -import coreManifests from '@cloudbeaver/core-bootstrap'; import { App, IServiceInjector, PluginManifest } from '@cloudbeaver/core-di'; export interface IApplication { @@ -21,16 +20,19 @@ export function createApp(...plugins: PluginManifest[]): IApplication { (globalThis as any)._VERSION_ = '00.0.0'; configure({ enforceActions: 'never' }); - const app = new App([...coreManifests, ...plugins]); + const app = new App(plugins); const injector = app.getServiceInjector(); + //@ts-expect-error app.registerServices(); return { app, injector, async init() { + //@ts-expect-error await app.initializeServices(); + //@ts-expect-error await app.loadServices(); }, }; diff --git a/webapp/packages/core-cli/tests/utils/getService.ts b/webapp/packages/tests-runner/src/getService.ts similarity index 100% rename from webapp/packages/core-cli/tests/utils/getService.ts rename to webapp/packages/tests-runner/src/getService.ts diff --git a/webapp/packages/tests-runner/src/index.ts b/webapp/packages/tests-runner/src/index.ts new file mode 100644 index 0000000000..a0b7463e18 --- /dev/null +++ b/webapp/packages/tests-runner/src/index.ts @@ -0,0 +1,3 @@ +export * from './createApp'; +export * from './getService'; +export * from './renderInApp'; diff --git a/webapp/packages/core-cli/tests/utils/renderInApp.tsx b/webapp/packages/tests-runner/src/renderInApp.tsx similarity index 100% rename from webapp/packages/core-cli/tests/utils/renderInApp.tsx rename to webapp/packages/tests-runner/src/renderInApp.tsx diff --git a/webapp/packages/tests-runner/tsconfig.json b/webapp/packages/tests-runner/tsconfig.json new file mode 100644 index 0000000000..959c65dd59 --- /dev/null +++ b/webapp/packages/tests-runner/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + }, + "references": [ + { + "path": "..\\core-di" + } + ], + "include": [ + "__custom_mocks__/**/*", + "src/**/*", + "src/**/*.json", + "src/**/*.css", + "src/**/*.scss" + ], + "exclude": [ + "lib/**/*", + "dist/**/*", + "**/node_modules" + ] +} diff --git a/webapp/tsconfig.json b/webapp/tsconfig.base.json similarity index 84% rename from webapp/tsconfig.json rename to webapp/tsconfig.base.json index 6d1d4f36e8..c1fc2d48f1 100644 --- a/webapp/tsconfig.json +++ b/webapp/tsconfig.base.json @@ -1,25 +1,19 @@ { - "compileOnSave": false, - "exclude": ["node_modules"], "compilerOptions": { "baseUrl": ".", "allowUnreachableCode": false, "allowSyntheticDefaultImports": true, "allowJs": true, "lib": ["dom", "ES2019", "ES2022.Error"], - "useDefineForClassFields": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, - "emitDeclarationOnly": true, "importsNotUsedAsValues": "error", + "forceConsistentCasingInFileNames": true, "ignoreDeprecations": "5.0", "jsx": "preserve", "target": "esnext", "module": "esnext", - "esModuleInterop": true, "moduleResolution": "node", - "declaration": true, - "declarationMap": true, "noImplicitAny": true, "noImplicitThis": true, "noImplicitReturns": true, @@ -27,16 +21,25 @@ "noUnusedParameters": false, "removeComments": false, "preserveConstEnums": true, - "sourceMap": true, + "sourceMap": false, "strict": true, "skipLibCheck": true, "skipDefaultLibCheck": true, - "incremental": true, - "noEmit": false, "strictNullChecks": true, "isolatedModules": true, "allowArbitraryExtensions": true, - "composite": false, + + "useDefineForClassFields": false, + "esModuleInterop": true, + + // project references + "composite": true, + "incremental": true, + "declaration": true, + "declarationMap": true, + + "disableReferencedProjectLoad": true, + "disableSolutionSearching": true, "types": ["reflect-metadata", "node", "jest", "@cloudbeaver/core-cli/global.d.ts"], "plugins": [ diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 00c0c5aaf3..156304f74e 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -4121,7 +4121,7 @@ lodash "^4.17.15" redent "^3.0.0" -"@testing-library/react@^14.0.0": +"@testing-library/react@^14.0.0", "@testing-library/react@^14.x.x": version "14.0.0" resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-14.0.0.tgz#59030392a6792450b9ab8e67aea5f3cc18d6347c" integrity sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg== @@ -8274,7 +8274,7 @@ end-of-stream@^1.4.1: dependencies: once "^1.4.0" -enhanced-resolve@^5.0.0, enhanced-resolve@^5.15.0, enhanced-resolve@^5.8.3: +enhanced-resolve@^5.0.0, enhanced-resolve@^5.15.0, enhanced-resolve@^5.7.0, enhanced-resolve@^5.8.3: version "5.15.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== @@ -15101,7 +15101,7 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -"react-data-grid@file:packages/plugin-react-data-grid/lib": +"react-data-grid@file:packages/plugin-react-data-grid/react-data-grid-dist": version "7.0.0-beta.37" dependencies: clsx "^2.0.0" @@ -15389,7 +15389,7 @@ redux@^4.2.0: dependencies: "@babel/runtime" "^7.9.2" -reflect-metadata@~0.1.13: +reflect-metadata@~0.1.13, reflect-metadata@~0.x.x: version "0.1.13" resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== @@ -17107,6 +17107,15 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== +tsconfig-paths-webpack-plugin@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.1.0.tgz#3c6892c5e7319c146eee1e7302ed9e6f2be4f763" + integrity sha512-xWFISjviPydmtmgeUAuXp4N1fky+VCtfhOkDUFIv5ea7p4wuTomI4QTrXvFBX2S4jZsmyTSrStQl+E+4w+RzxA== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.7.0" + tsconfig-paths "^4.1.2" + tsconfig-paths@^3.10.1, tsconfig-paths@^3.14.2: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"