From 567989dac5365958bb1a92d78d9909e39eee6cc1 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Mon, 17 Feb 2025 12:32:42 +0700 Subject: [PATCH 01/13] fix: handle token decode errors (#8018) Signed-off-by: Alexander Onnikov --- server/account/src/utils.ts | 4 ++-- server/front/src/index.ts | 9 ++++++--- server/token/src/token.ts | 12 +++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/server/account/src/utils.ts b/server/account/src/utils.ts index feebb45a2c..7eca625b92 100644 --- a/server/account/src/utils.ts +++ b/server/account/src/utils.ts @@ -56,7 +56,7 @@ import { AccountEventType } from './types' import { Analytics } from '@hcengineering/analytics' -import { decodeTokenVerbose, generateToken } from '@hcengineering/server-token' +import { TokenError, decodeTokenVerbose, generateToken } from '@hcengineering/server-token' export const GUEST_ACCOUNT = 'b6996120-416f-49cd-841e-e4a5d2e49c9b' @@ -127,7 +127,7 @@ export function wrap ( ? err.status : new Status(Severity.ERROR, platform.status.InternalServerError, {}) - if (((err.message as string) ?? '') === 'Signature verification failed') { + if (err instanceof TokenError) { // Let's send un authorized return { error: new Status(Severity.ERROR, platform.status.Unauthorized, {}) diff --git a/server/front/src/index.ts b/server/front/src/index.ts index 64570ef079..f6838b16a1 100644 --- a/server/front/src/index.ts +++ b/server/front/src/index.ts @@ -23,7 +23,7 @@ import { metricsAggregate, type Ref } from '@hcengineering/core' -import { decodeToken } from '@hcengineering/server-token' +import { TokenError, decodeToken } from '@hcengineering/server-token' import { StorageAdapter } from '@hcengineering/storage' import bp from 'body-parser' import cors from 'cors' @@ -376,10 +376,13 @@ export function start ( }) res.end(json) } catch (err: any) { + if (err instanceof TokenError) { + res.status(401).send() + return + } ctx.error('statistics error', { err }) Analytics.handleError(err) - res.writeHead(404, {}) - res.end() + res.status(404).send() } }) diff --git a/server/token/src/token.ts b/server/token/src/token.ts index 77e2922742..13599e6450 100644 --- a/server/token/src/token.ts +++ b/server/token/src/token.ts @@ -12,6 +12,16 @@ export interface Token { extra?: Record } +/** + * @public + */ +export class TokenError extends Error { + constructor (message: string) { + super(message) + this.name = 'TokenError' + } +} + const getSecret = (): string => { return getMetadata(serverPlugin.metadata.Secret) ?? 'secret' } @@ -50,6 +60,6 @@ export function decodeTokenVerbose (ctx: MeasureContext, token: string): Token { } catch (err2: any) { // Nothing to do } - throw err + throw new TokenError(err.message) } } From 207e60a76e691261cad6a0d2c633508bdb40703d Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Mon, 17 Feb 2025 13:10:46 +0700 Subject: [PATCH 02/13] Minor import fixes (#8017) Signed-off-by: Andrey Sobolev --- models/activity/src/plugin.ts | 2 +- models/card/src/index.ts | 2 +- models/card/src/plugin.ts | 2 +- models/chunter/src/types.ts | 2 +- models/controlled-documents/src/plugin.ts | 2 +- models/document/src/plugin.ts | 2 +- models/drive/src/plugin.ts | 2 +- models/guest/src/index.ts | 2 +- models/guest/src/plugin.ts | 2 +- models/love/src/plugin.ts | 2 +- models/presence/src/plugin.ts | 2 +- models/print/src/plugin.ts | 2 +- models/task/src/index.ts | 2 +- models/text-editor/src/index.ts | 2 +- models/time/src/index.ts | 2 +- models/time/src/plugin.ts | 2 +- models/training/src/plugin.ts | 2 +- models/uploader/src/plugin.ts | 2 +- models/view/src/utils.ts | 2 +- models/workbench/src/index.ts | 2 +- packages/platform-rig/profiles/assets/tsconfig.json | 4 +++- packages/platform-rig/profiles/default/tsconfig.json | 3 ++- packages/platform-rig/profiles/model/tsconfig.json | 3 ++- packages/platform-rig/profiles/node/tsconfig.json | 3 ++- packages/platform-rig/profiles/package/tsconfig.json | 3 ++- packages/platform-rig/profiles/ui/tsconfig.json | 3 ++- .../presentation/src/components/breadcrumbs/types.ts | 2 +- packages/presentation/src/plugin.ts | 2 +- packages/presentation/src/types.ts | 2 +- .../src/components/AttachmentRefInput.svelte | 9 ++++----- plugins/bitrix-resources/src/plugin.ts | 2 +- plugins/board-resources/src/plugin.ts | 2 +- plugins/card-resources/src/plugin.ts | 2 +- plugins/chunter-resources/src/plugin.ts | 2 +- plugins/contact-resources/src/plugin.ts | 2 +- plugins/controlled-documents-resources/src/plugin.ts | 2 +- plugins/controlled-documents/src/plugin.ts | 2 +- plugins/document-resources/src/plugin.ts | 2 +- plugins/document/src/plugin.ts | 2 +- plugins/drive/src/plugin.ts | 2 +- plugins/lead-resources/src/plugin.ts | 2 +- plugins/love-resources/src/plugin.ts | 4 ++-- plugins/presence/src/plugin.ts | 2 +- plugins/print/src/plugin.ts | 2 +- plugins/products-resources/src/plugin.ts | 4 ++-- plugins/products/src/plugin.ts | 2 +- .../src/components/CreateCandidate.svelte | 1 - plugins/recruit-resources/src/plugin.ts | 4 ++-- plugins/setting-resources/src/plugin.ts | 2 +- plugins/survey-resources/src/plugin.ts | 2 +- plugins/tags-resources/src/plugin.ts | 2 +- plugins/telegram-resources/src/plugin.ts | 2 +- plugins/templates-resources/src/plugin.ts | 2 +- plugins/templates/src/index.ts | 6 +++--- plugins/test-management/src/plugin.ts | 2 +- plugins/tracker-resources/src/plugin.ts | 4 ++-- plugins/uploader-resources/src/plugin.ts | 2 +- plugins/uploader/src/plugin.ts | 2 +- plugins/view-resources/src/plugin.ts | 4 ++-- plugins/view/src/index.ts | 2 +- .../workbench-resources/src/components/Navigator.svelte | 2 +- plugins/workbench-resources/src/plugin.ts | 2 +- plugins/workbench-resources/src/utils.ts | 7 +++---- rush.json | 4 ++-- server/account/src/operations.ts | 1 + services/github/github-resources/src/plugin.ts | 2 +- services/github/model-github/src/plugin.ts | 2 +- 67 files changed, 86 insertions(+), 81 deletions(-) diff --git a/models/activity/src/plugin.ts b/models/activity/src/plugin.ts index 210ab46c36..f820672389 100644 --- a/models/activity/src/plugin.ts +++ b/models/activity/src/plugin.ts @@ -16,7 +16,7 @@ import { activityId, type ActivityMessage, type DocUpdateMessageViewlet } from ' import activity from '@hcengineering/activity-resources/src/plugin' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import { type Doc, type Ref } from '@hcengineering/core' -import type { Location } from '@hcengineering/ui' +import type { Location } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, diff --git a/models/card/src/index.ts b/models/card/src/index.ts index e36e4f342d..6d41c44afb 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -43,7 +43,7 @@ import view, { createAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import { getEmbeddedLabel, type IntlString } from '@hcengineering/platform' import time, { type ToDo } from '@hcengineering/time' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import card from './plugin' export { cardId } from '@hcengineering/card' diff --git a/models/card/src/plugin.ts b/models/card/src/plugin.ts index ef1ce2aa73..f8fc7524d4 100644 --- a/models/card/src/plugin.ts +++ b/models/card/src/plugin.ts @@ -19,7 +19,7 @@ import type { Client, Doc, Ref } from '@hcengineering/core' import {} from '@hcengineering/core' import { mergeIds, type Resource } from '@hcengineering/platform' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' -import { type Location, type ResolvedLocation } from '@hcengineering/ui' +import { type Location, type ResolvedLocation } from '@hcengineering/ui/src/types' import { type LocationData } from '@hcengineering/workbench' import { type Action, type ViewAction } from '@hcengineering/view' diff --git a/models/chunter/src/types.ts b/models/chunter/src/types.ts index 73c7213eec..f4205e5dc3 100644 --- a/models/chunter/src/types.ts +++ b/models/chunter/src/types.ts @@ -58,7 +58,7 @@ import type { IntlString, Resource } from '@hcengineering/platform' import type { DocNotifyContext } from '@hcengineering/notification' import chunter from './plugin' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' export const DOMAIN_CHUNTER = 'chunter' as Domain diff --git a/models/controlled-documents/src/plugin.ts b/models/controlled-documents/src/plugin.ts index 8d9c54b779..fdde0039ed 100644 --- a/models/controlled-documents/src/plugin.ts +++ b/models/controlled-documents/src/plugin.ts @@ -19,7 +19,7 @@ import type { Client, Doc, Ref } from '@hcengineering/core' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' import { mergeIds, type Resource } from '@hcengineering/platform' import { type TagCategory } from '@hcengineering/tags' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type ActionCategory, type ViewAction } from '@hcengineering/view' import { type NotificationType, type NotificationGroup } from '@hcengineering/notification' import { type TextActionVisibleFunction, type TextActionFunction } from '@hcengineering/text-editor' diff --git a/models/document/src/plugin.ts b/models/document/src/plugin.ts index e83a4ff7c7..78b3ce3f2d 100644 --- a/models/document/src/plugin.ts +++ b/models/document/src/plugin.ts @@ -20,7 +20,7 @@ import document from '@hcengineering/document-resources/src/plugin' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import { type TagCategory } from '@hcengineering/tags' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import type { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view' export default mergeIds(documentId, document, { diff --git a/models/drive/src/plugin.ts b/models/drive/src/plugin.ts index dc05a8f62e..3f351771c0 100644 --- a/models/drive/src/plugin.ts +++ b/models/drive/src/plugin.ts @@ -19,7 +19,7 @@ import { driveId } from '@hcengineering/drive' import drive from '@hcengineering/drive-resources/src/plugin' import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/model-presentation' import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform' -import { type AnyComponent, type Location } from '@hcengineering/ui' +import { type AnyComponent, type Location } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory, diff --git a/models/guest/src/index.ts b/models/guest/src/index.ts index bf9fe3e495..b0f26b103f 100644 --- a/models/guest/src/index.ts +++ b/models/guest/src/index.ts @@ -9,7 +9,7 @@ import { import { type PublicLink, type Restrictions, guestAccountEmail } from '@hcengineering/guest' import { type Builder, Model } from '@hcengineering/model' import core, { TDoc } from '@hcengineering/model-core' -import { type Location } from '@hcengineering/ui' +import { type Location } from '@hcengineering/ui/src/types' import guest from './plugin' export const GUEST_DOMAIN = 'guest' as Domain diff --git a/models/guest/src/plugin.ts b/models/guest/src/plugin.ts index deff851c67..d1c97d3099 100644 --- a/models/guest/src/plugin.ts +++ b/models/guest/src/plugin.ts @@ -2,7 +2,7 @@ import { type Account, type Doc, type Ref } from '@hcengineering/core' import { guestId } from '@hcengineering/guest' import guest from '@hcengineering/guest-resources/src/plugin' import { mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory } from '@hcengineering/view' export default mergeIds(guestId, guest, { diff --git a/models/love/src/plugin.ts b/models/love/src/plugin.ts index 1829a21dfd..f8819f6ed0 100644 --- a/models/love/src/plugin.ts +++ b/models/love/src/plugin.ts @@ -16,7 +16,7 @@ import { type Client, type Doc, type Ref } from '@hcengineering/core' import { type NotificationType, type NotificationGroup } from '@hcengineering/notification' import { type Resource, mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type ActionCategory, type ViewAction } from '@hcengineering/view' import { loveId } from '@hcengineering/love' import love from '@hcengineering/love-resources/src/plugin' diff --git a/models/presence/src/plugin.ts b/models/presence/src/plugin.ts index 1cb9b1449d..3c7bd4c46d 100644 --- a/models/presence/src/plugin.ts +++ b/models/presence/src/plugin.ts @@ -14,7 +14,7 @@ // import { mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { presenceId } from '@hcengineering/presence' import presence from '@hcengineering/presence-resources/src/plugin' diff --git a/models/print/src/plugin.ts b/models/print/src/plugin.ts index 154799ed6d..ae258440d3 100644 --- a/models/print/src/plugin.ts +++ b/models/print/src/plugin.ts @@ -16,7 +16,7 @@ import { type Doc, type Ref } from '@hcengineering/core' import { mergeIds } from '@hcengineering/platform' import { type ViewAction, type Action } from '@hcengineering/view' -import { type FilePreviewExtension } from '@hcengineering/presentation' +import { type FilePreviewExtension } from '@hcengineering/presentation/src/types' import { printId } from '@hcengineering/print' // This import is needed because of similar import in print plugin // Otherwise, TS complains about missing types for resulting merge diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 2574086d00..f1cf9eb6f9 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -76,8 +76,8 @@ import { type TaskTypeDescriptor, type TaskTypeKind } from '@hcengineering/task' -import type { AnyComponent } from '@hcengineering/ui' import { PaletteColorIndexes } from '@hcengineering/ui/src/colors' +import type { AnyComponent } from '@hcengineering/ui/src/types' import task from './plugin' diff --git a/models/text-editor/src/index.ts b/models/text-editor/src/index.ts index 82557e4dfb..0576c24f58 100644 --- a/models/text-editor/src/index.ts +++ b/models/text-editor/src/index.ts @@ -31,7 +31,7 @@ import { type TextEditorActionKind } from '@hcengineering/text-editor' // eslint-disable-next-line @typescript-eslint/no-unused-vars -import type { EditorKitOptions } from '@hcengineering/text-editor-resources' +import type { EditorKitOptions } from '@hcengineering/text-editor-resources/src/kits/editor-kit' import textEditor from './plugin' export { textEditorOperation } from './migration' diff --git a/models/time/src/index.ts b/models/time/src/index.ts index 77ad3f89fa..09ed08557b 100644 --- a/models/time/src/index.ts +++ b/models/time/src/index.ts @@ -53,7 +53,7 @@ import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' import recruit from '@hcengineering/recruit' import tags from '@hcengineering/tags' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type TodoDoneTester, timeId, diff --git a/models/time/src/plugin.ts b/models/time/src/plugin.ts index 19b134da99..5e799286fc 100644 --- a/models/time/src/plugin.ts +++ b/models/time/src/plugin.ts @@ -16,7 +16,7 @@ import { type Client, type Doc, type Ref } from '@hcengineering/core' import { type Application } from '@hcengineering/model-workbench' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type ActionCategory } from '@hcengineering/view' import { timeId } from '@hcengineering/time' import time from '@hcengineering/time-resources/src/plugin' diff --git a/models/training/src/plugin.ts b/models/training/src/plugin.ts index 2f78c449d9..b75a6c85e6 100644 --- a/models/training/src/plugin.ts +++ b/models/training/src/plugin.ts @@ -18,7 +18,7 @@ import { trainingId } from '@hcengineering/training' import training from '@hcengineering/training-resources/src/plugin' import { mergeIds, type Resource } from '@hcengineering/platform' import { type Doc, type Ref } from '@hcengineering/core' -import { type Location, type ResolvedLocation } from '@hcengineering/ui' +import { type Location, type ResolvedLocation } from '@hcengineering/ui/src/types' import { type Application } from '@hcengineering/workbench' import { type ActionCategory } from '@hcengineering/view' diff --git a/models/uploader/src/plugin.ts b/models/uploader/src/plugin.ts index b9ca3910b3..1f9566018b 100644 --- a/models/uploader/src/plugin.ts +++ b/models/uploader/src/plugin.ts @@ -14,7 +14,7 @@ // import { mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { uploaderId } from '@hcengineering/uploader' import uploader from '@hcengineering/uploader-resources/src/plugin' diff --git a/models/view/src/utils.ts b/models/view/src/utils.ts index f0c2f599b7..db2a45edbc 100644 --- a/models/view/src/utils.ts +++ b/models/view/src/utils.ts @@ -16,7 +16,7 @@ import { type Class, type Data, type Doc, type Ref } from '@hcengineering/core' import { type Builder } from '@hcengineering/model' import core from '@hcengineering/model-core' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Action, type AttributeCategory } from '@hcengineering/view' import view from '.' diff --git a/models/workbench/src/index.ts b/models/workbench/src/index.ts index 96dae1a6f1..880d2547ef 100644 --- a/models/workbench/src/index.ts +++ b/models/workbench/src/index.ts @@ -33,7 +33,7 @@ import type { SidebarEvent, WorkbenchTab } from '@hcengineering/workbench' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import core, { TClass, TDoc, TTx } from '@hcengineering/model-core' import presentation from '@hcengineering/model-presentation' diff --git a/packages/platform-rig/profiles/assets/tsconfig.json b/packages/platform-rig/profiles/assets/tsconfig.json index 8e578db9f7..94a2d03e17 100644 --- a/packages/platform-rig/profiles/assets/tsconfig.json +++ b/packages/platform-rig/profiles/assets/tsconfig.json @@ -16,6 +16,8 @@ "dom" ], "types": ["node", "jest"], - "incremental": true + "incremental": true, + "isolatedModules": true, + } } \ No newline at end of file diff --git a/packages/platform-rig/profiles/default/tsconfig.json b/packages/platform-rig/profiles/default/tsconfig.json index c434de43a6..f6ccee4ce9 100644 --- a/packages/platform-rig/profiles/default/tsconfig.json +++ b/packages/platform-rig/profiles/default/tsconfig.json @@ -17,6 +17,7 @@ "rootDir": "./src", "outDir": "./lib", "incremental": true, - "isolatedModules": true + "isolatedModules": true, + } } \ No newline at end of file diff --git a/packages/platform-rig/profiles/model/tsconfig.json b/packages/platform-rig/profiles/model/tsconfig.json index 3a7ae70f1b..1a954bd001 100644 --- a/packages/platform-rig/profiles/model/tsconfig.json +++ b/packages/platform-rig/profiles/model/tsconfig.json @@ -13,6 +13,7 @@ "esModuleInterop": true, "incremental": true, "types" : [], - "isolatedModules": true + "isolatedModules": true, + } } \ No newline at end of file diff --git a/packages/platform-rig/profiles/node/tsconfig.json b/packages/platform-rig/profiles/node/tsconfig.json index be325351a1..5430cf1c5a 100644 --- a/packages/platform-rig/profiles/node/tsconfig.json +++ b/packages/platform-rig/profiles/node/tsconfig.json @@ -15,6 +15,7 @@ "rootDir": "./src", "outDir": "./lib", "incremental": true, - "isolatedModules": true + "isolatedModules": true, + } } diff --git a/packages/platform-rig/profiles/package/tsconfig.json b/packages/platform-rig/profiles/package/tsconfig.json index 6c389326f9..be76b62921 100644 --- a/packages/platform-rig/profiles/package/tsconfig.json +++ b/packages/platform-rig/profiles/package/tsconfig.json @@ -15,6 +15,7 @@ "rootDir": "./src", "outDir": "./lib", "incremental": true, - "isolatedModules": true + "isolatedModules": true, + } } \ No newline at end of file diff --git a/packages/platform-rig/profiles/ui/tsconfig.json b/packages/platform-rig/profiles/ui/tsconfig.json index e095e09e86..cea4847109 100644 --- a/packages/platform-rig/profiles/ui/tsconfig.json +++ b/packages/platform-rig/profiles/ui/tsconfig.json @@ -18,6 +18,7 @@ ], "incremental": true, "types": ["jest"], - "isolatedModules": true + "isolatedModules": true, + } } \ No newline at end of file diff --git a/packages/presentation/src/components/breadcrumbs/types.ts b/packages/presentation/src/components/breadcrumbs/types.ts index d26b8ff2c5..d3dc40a1c3 100644 --- a/packages/presentation/src/components/breadcrumbs/types.ts +++ b/packages/presentation/src/components/breadcrumbs/types.ts @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { type AnyComponent, type AnySvelteComponent } from '@hcengineering/ui' +import { type AnyComponent, type AnySvelteComponent } from '@hcengineering/ui/src/types' interface BreadcrumbsProps { readonly color?: number | undefined diff --git a/packages/presentation/src/plugin.ts b/packages/presentation/src/plugin.ts index 7737e4a664..e5ec64fb44 100644 --- a/packages/presentation/src/plugin.ts +++ b/packages/presentation/src/plugin.ts @@ -32,7 +32,7 @@ import { } from '@hcengineering/core' import type { Asset, IntlString, Metadata, Plugin, StatusCode } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import { type ComponentExtensionId } from '@hcengineering/ui' +import { type ComponentExtensionId } from '@hcengineering/ui/src/types' import { type PresentationMiddlewareFactory } from './pipeline' import type { PreviewConfig } from './preview' import { diff --git a/packages/presentation/src/types.ts b/packages/presentation/src/types.ts index 0dbcd69ac3..a85e6c9afd 100644 --- a/packages/presentation/src/types.ts +++ b/packages/presentation/src/types.ts @@ -13,7 +13,7 @@ import { type TxOperations } from '@hcengineering/core' import { type Asset, type IntlString, type Resource } from '@hcengineering/platform' -import { type AnyComponent, type AnySvelteComponent, type ComponentExtensionId } from '@hcengineering/ui' +import { type AnyComponent, type AnySvelteComponent, type ComponentExtensionId } from '@hcengineering/ui/src/types' export * from './components/breadcrumbs/types' diff --git a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte index f6b2ebf556..72c4c39705 100644 --- a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte +++ b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte @@ -18,15 +18,15 @@ import { Asset, IntlString, setPlatformStatus, unknownError } from '@hcengineering/platform' import { DraftController, + canDisplayLinkPreview, createQuery, deleteFile, draftsStore, + fetchLinkPreviewDetails, getClient, getFileMetadata, - uploadFile, - fetchLinkPreviewDetails, - canDisplayLinkPreview, - isLinkPreviewEnabled + isLinkPreviewEnabled, + uploadFile } from '@hcengineering/presentation' import { EmptyMarkup } from '@hcengineering/text' import textEditor, { type RefAction } from '@hcengineering/text-editor' @@ -35,7 +35,6 @@ import { createEventDispatcher, onDestroy, tick } from 'svelte' import attachment from '../plugin' import AttachmentPresenter from './AttachmentPresenter.svelte' - import { rmSync } from 'fs' export let objectId: Ref export let space: Ref diff --git a/plugins/bitrix-resources/src/plugin.ts b/plugins/bitrix-resources/src/plugin.ts index 35eac13619..e9d48e46e1 100644 --- a/plugins/bitrix-resources/src/plugin.ts +++ b/plugins/bitrix-resources/src/plugin.ts @@ -18,7 +18,7 @@ import { type IntlString, mergeIds } from '@hcengineering/platform' import bitrix, { bitrixId } from '@hcengineering/bitrix' import { type Ref } from '@hcengineering/core' import { type Handler, type IntegrationType } from '@hcengineering/setting' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(bitrixId, bitrix, { string: { diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index 40fa6ec7f6..7937afe3b5 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -16,7 +16,7 @@ import board, { boardId } from '@hcengineering/board' import { type Ref, type StatusCategory } from '@hcengineering/core' import { type IntlString, mergeIds } from '@hcengineering/platform' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(boardId, board, { string: { diff --git a/plugins/card-resources/src/plugin.ts b/plugins/card-resources/src/plugin.ts index b1134284c1..8de66b1f4a 100644 --- a/plugins/card-resources/src/plugin.ts +++ b/plugins/card-resources/src/plugin.ts @@ -16,7 +16,7 @@ import card, { cardId } from '@hcengineering/card' import { type Ref } from '@hcengineering/core' import { type IntlString, mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Viewlet } from '@hcengineering/view' export default mergeIds(cardId, card, { diff --git a/plugins/chunter-resources/src/plugin.ts b/plugins/chunter-resources/src/plugin.ts index 5e70cb1c77..d2f93c3bdd 100644 --- a/plugins/chunter-resources/src/plugin.ts +++ b/plugins/chunter-resources/src/plugin.ts @@ -17,7 +17,7 @@ import chunter, { chunterId } from '@hcengineering/chunter' import type { Client, Doc, Ref, Space } from '@hcengineering/core' import type { IntlString, Resource } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' import { type ViewAction } from '@hcengineering/view' import { type DocNotifyContext, type InboxNotification } from '@hcengineering/notification' diff --git a/plugins/contact-resources/src/plugin.ts b/plugins/contact-resources/src/plugin.ts index b3c630f321..fe38707508 100644 --- a/plugins/contact-resources/src/plugin.ts +++ b/plugins/contact-resources/src/plugin.ts @@ -17,7 +17,7 @@ import contact, { contactId } from '@hcengineering/contact' import { type Client, type Doc } from '@hcengineering/core' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' -import { type LabelAndProps, type Location } from '@hcengineering/ui' +import { type LabelAndProps, type Location } from '@hcengineering/ui/src/types' import { type CreateAggregationManagerFunc, type GrouppingManagerResource, diff --git a/plugins/controlled-documents-resources/src/plugin.ts b/plugins/controlled-documents-resources/src/plugin.ts index 9e14aaa0cb..85a569dad6 100644 --- a/plugins/controlled-documents-resources/src/plugin.ts +++ b/plugins/controlled-documents-resources/src/plugin.ts @@ -20,7 +20,7 @@ import documents, { } from '@hcengineering/controlled-documents' import { type Client, type Doc, type Ref, type Space } from '@hcengineering/core' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' -import { type AnyComponent, type Location } from '@hcengineering/ui' +import { type AnyComponent, type Location } from '@hcengineering/ui/src/types' import type { KeyFilter, SortFunc, ViewActionAvailabilityFunction } from '@hcengineering/view' export default mergeIds(documentsId, documents, { diff --git a/plugins/controlled-documents/src/plugin.ts b/plugins/controlled-documents/src/plugin.ts index 28bca7c96d..d4262a15df 100644 --- a/plugins/controlled-documents/src/plugin.ts +++ b/plugins/controlled-documents/src/plugin.ts @@ -12,7 +12,7 @@ import { } from '@hcengineering/core' import type { Asset, Plugin, Resource } from '@hcengineering/platform' import { IntlString, plugin } from '@hcengineering/platform' -import type { AnyComponent, ResolvedLocation, Location } from '@hcengineering/ui' +import type { AnyComponent, ResolvedLocation, Location } from '@hcengineering/ui/src/types' import { Action } from '@hcengineering/view' import type { diff --git a/plugins/document-resources/src/plugin.ts b/plugins/document-resources/src/plugin.ts index 52e193a833..957500ec3a 100644 --- a/plugins/document-resources/src/plugin.ts +++ b/plugins/document-resources/src/plugin.ts @@ -16,7 +16,7 @@ import { type Client, type Doc, type Ref } from '@hcengineering/core' import document, { type Document, documentId } from '@hcengineering/document' import { mergeIds, type IntlString, type Resource } from '@hcengineering/platform' -import { type AnyComponent, type Location } from '@hcengineering/ui' +import { type AnyComponent, type Location } from '@hcengineering/ui/src/types' export default mergeIds(documentId, document, { component: { diff --git a/plugins/document/src/plugin.ts b/plugins/document/src/plugin.ts index 2c8fabcb29..7613d355f7 100644 --- a/plugins/document/src/plugin.ts +++ b/plugins/document/src/plugin.ts @@ -17,7 +17,7 @@ import type { Class, Doc, Mixin, Ref, SpaceType, SpaceTypeDescriptor } from '@hc import { NotificationGroup, NotificationType } from '@hcengineering/notification' import type { Asset, Plugin, Resource } from '@hcengineering/platform' import { IntlString, plugin } from '@hcengineering/platform' -import type { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui' +import type { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui/src/types' import { Action } from '@hcengineering/view' import { Document, DocumentSnapshot, SavedDocument, Teamspace } from './types' diff --git a/plugins/drive/src/plugin.ts b/plugins/drive/src/plugin.ts index 11c7d89a8b..4d52c95798 100644 --- a/plugins/drive/src/plugin.ts +++ b/plugins/drive/src/plugin.ts @@ -16,7 +16,7 @@ import type { Class, Doc, Mixin, Ref, SpaceType, SpaceTypeDescriptor, Type } from '@hcengineering/core' import type { Asset, IntlString, Plugin, Resource as PlatformResource } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import type { Location, ResolvedLocation } from '@hcengineering/ui' +import type { Location, ResolvedLocation } from '@hcengineering/ui/src/types' import { Drive, File, FileVersion, Folder, Resource } from './types' export * from './types' diff --git a/plugins/lead-resources/src/plugin.ts b/plugins/lead-resources/src/plugin.ts index 1a2a1c354b..c8f5f879bc 100644 --- a/plugins/lead-resources/src/plugin.ts +++ b/plugins/lead-resources/src/plugin.ts @@ -16,7 +16,7 @@ import lead, { leadId } from '@hcengineering/lead' import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import { type Client, type Doc, type Ref } from '@hcengineering/core' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(leadId, lead, { string: { diff --git a/plugins/love-resources/src/plugin.ts b/plugins/love-resources/src/plugin.ts index e2fef3a06c..699e784653 100644 --- a/plugins/love-resources/src/plugin.ts +++ b/plugins/love-resources/src/plugin.ts @@ -15,8 +15,8 @@ import love, { loveId } from '@hcengineering/love' import { mergeIds, type IntlString, type Resource } from '@hcengineering/platform' -import { type DocCreateFunction } from '@hcengineering/presentation' -import { type AnyComponent } from '@hcengineering/ui' +import { type DocCreateFunction } from '@hcengineering/presentation/src/types' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type ViewActionAvailabilityFunction } from '@hcengineering/view' export default mergeIds(loveId, love, { diff --git a/plugins/presence/src/plugin.ts b/plugins/presence/src/plugin.ts index 7f50ca851a..c6cb101e4a 100644 --- a/plugins/presence/src/plugin.ts +++ b/plugins/presence/src/plugin.ts @@ -15,7 +15,7 @@ import type { Metadata, Plugin } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import { AnyComponent } from '@hcengineering/ui' +import { AnyComponent } from '@hcengineering/ui/src/types' /** @public */ export const presenceId = 'presence' as Plugin diff --git a/plugins/print/src/plugin.ts b/plugins/print/src/plugin.ts index 967bb31660..24b758bb8c 100644 --- a/plugins/print/src/plugin.ts +++ b/plugins/print/src/plugin.ts @@ -4,7 +4,7 @@ import { type Doc } from '@hcengineering/core' import { type IntlString, type Metadata, type Plugin, plugin, type Asset, type Resource } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export const printId = 'print' as Plugin diff --git a/plugins/products-resources/src/plugin.ts b/plugins/products-resources/src/plugin.ts index 285cd9ae10..b36cc84d16 100644 --- a/plugins/products-resources/src/plugin.ts +++ b/plugins/products-resources/src/plugin.ts @@ -16,8 +16,8 @@ import products, { productsId } from '@hcengineering/products' import { type Ref, type Space } from '@hcengineering/core' import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform' -import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/presentation' -import { type AnyComponent } from '@hcengineering/ui' +import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/presentation/src/types' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type KeyFilter } from '@hcengineering/view' export default mergeIds(productsId, products, { diff --git a/plugins/products/src/plugin.ts b/plugins/products/src/plugin.ts index 078115f123..d92d8110fa 100644 --- a/plugins/products/src/plugin.ts +++ b/plugins/products/src/plugin.ts @@ -17,7 +17,7 @@ import { Mixin, Type, type Class, type Doc, type Ref } from '@hcengineering/core import type { Asset, IntlString, Plugin } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { ActionCategory, Viewlet } from '@hcengineering/view' import type { DocumentSpaceType, DocumentSpaceTypeDescriptor } from '@hcengineering/controlled-documents' import { Product, ProductVersion, ProductVersionState } from './types' diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte index 9767c92bf5..0c63a0fde8 100644 --- a/plugins/recruit-resources/src/components/CreateCandidate.svelte +++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte @@ -74,7 +74,6 @@ import recruit from '../plugin' import { getCandidateIdentifier } from '../utils' import YesNo from './YesNo.svelte' - import IconSwitch from './icons/Switch.svelte' import IconShuffle from './icons/Shuffle.svelte' export let shouldSaveDraft: boolean = true diff --git a/plugins/recruit-resources/src/plugin.ts b/plugins/recruit-resources/src/plugin.ts index a22e2b7c0d..f5a771c283 100644 --- a/plugins/recruit-resources/src/plugin.ts +++ b/plugins/recruit-resources/src/plugin.ts @@ -16,10 +16,10 @@ import { type Client, type Doc, type Ref } from '@hcengineering/core' import type { IntlString, Resource, StatusCode } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' -import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/presentation' +import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineering/presentation/src/types' import recruit, { recruitId } from '@hcengineering/recruit' import { type TagCategory } from '@hcengineering/tags' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type FilterFunction, type FilterMode, type Viewlet } from '@hcengineering/view' export default mergeIds(recruitId, recruit, { diff --git a/plugins/setting-resources/src/plugin.ts b/plugins/setting-resources/src/plugin.ts index 03b12565d7..10e523c4c4 100644 --- a/plugins/setting-resources/src/plugin.ts +++ b/plugins/setting-resources/src/plugin.ts @@ -17,7 +17,7 @@ import { type Ref } from '@hcengineering/core' import type { IntlString } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import setting, { settingId } from '@hcengineering/setting' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type Widget } from '@hcengineering/workbench' export default mergeIds(settingId, setting, { diff --git a/plugins/survey-resources/src/plugin.ts b/plugins/survey-resources/src/plugin.ts index 163ecbac44..5ce97071b8 100644 --- a/plugins/survey-resources/src/plugin.ts +++ b/plugins/survey-resources/src/plugin.ts @@ -16,7 +16,7 @@ import type { Client, Doc, Ref } from '@hcengineering/core' import { type Resource, mergeIds } from '@hcengineering/platform' import survey, { surveyId } from '@hcengineering/survey' -import type { Location, ResolvedLocation } from '@hcengineering/ui' +import type { Location, ResolvedLocation } from '@hcengineering/ui/src/types' import type { Action, ActionCategory, ViewAction } from '@hcengineering/view' export default mergeIds(surveyId, survey, { diff --git a/plugins/tags-resources/src/plugin.ts b/plugins/tags-resources/src/plugin.ts index dbcfccf147..6db1a5bda9 100644 --- a/plugins/tags-resources/src/plugin.ts +++ b/plugins/tags-resources/src/plugin.ts @@ -13,7 +13,7 @@ import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform' import tags, { tagsId } from '@hcengineering/tags' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import { type FilterFunction } from '@hcengineering/view' export default mergeIds(tagsId, tags, { diff --git a/plugins/telegram-resources/src/plugin.ts b/plugins/telegram-resources/src/plugin.ts index 1765a3cd1b..4d753f46d2 100644 --- a/plugins/telegram-resources/src/plugin.ts +++ b/plugins/telegram-resources/src/plugin.ts @@ -17,7 +17,7 @@ import { type IntlString, mergeIds } from '@hcengineering/platform' import telegram, { telegramId } from '@hcengineering/telegram' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(telegramId, telegram, { string: { diff --git a/plugins/templates-resources/src/plugin.ts b/plugins/templates-resources/src/plugin.ts index 9c6c238642..504ff63eab 100644 --- a/plugins/templates-resources/src/plugin.ts +++ b/plugins/templates-resources/src/plugin.ts @@ -15,7 +15,7 @@ // import { type IntlString, mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import templates, { templatesId } from '@hcengineering/templates' export default mergeIds(templatesId, templates, { diff --git a/plugins/templates/src/index.ts b/plugins/templates/src/index.ts index c3c22c8dd5..4a2e751177 100644 --- a/plugins/templates/src/index.ts +++ b/plugins/templates/src/index.ts @@ -14,9 +14,9 @@ // import type { Class, Doc, Markup, Ref, Space } from '@hcengineering/core' -import type { IntlString, Plugin, Resource } from '@hcengineering/platform' -import { Asset, plugin } from '@hcengineering/platform' -import { AnyComponent } from '@hcengineering/ui' +import type { IntlString, Plugin, Resource, Asset } from '@hcengineering/platform' +import { plugin } from '@hcengineering/platform' +import { type AnyComponent } from '@hcengineering/ui/src/types' /** * @public diff --git a/plugins/test-management/src/plugin.ts b/plugins/test-management/src/plugin.ts index 0074c5fe76..d306c4279e 100644 --- a/plugins/test-management/src/plugin.ts +++ b/plugins/test-management/src/plugin.ts @@ -26,7 +26,7 @@ import { import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import { type AnyComponent, type Location, type ResolvedLocation } from '@hcengineering/ui' +import { type AnyComponent, type Location, type ResolvedLocation } from '@hcengineering/ui/src/types' import { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view' import { diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 35c2619bde..6768e87652 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -15,10 +15,10 @@ import { type StatusCategory, type Client, type Doc, type Ref, type Space } from '@hcengineering/core' import type { Asset, IntlString, Metadata, Resource } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' -import type { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/presentation' +import type { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/presentation/src/types' import { type ProjectType, type TaskType } from '@hcengineering/task' import tracker, { trackerId, type IssueDraft, type Issue } from '@hcengineering/tracker' -import { type AnyComponent, type Location } from '@hcengineering/ui' +import { type AnyComponent, type Location } from '@hcengineering/ui/src/types' import { type CreateAggregationManagerFunc, type GetAllValuesFunc, diff --git a/plugins/uploader-resources/src/plugin.ts b/plugins/uploader-resources/src/plugin.ts index efbb5f2684..eedc77772c 100644 --- a/plugins/uploader-resources/src/plugin.ts +++ b/plugins/uploader-resources/src/plugin.ts @@ -14,7 +14,7 @@ // import { type IntlString, mergeIds } from '@hcengineering/platform' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' import uploader, { uploaderId } from '@hcengineering/uploader' export default mergeIds(uploaderId, uploader, { diff --git a/plugins/uploader/src/plugin.ts b/plugins/uploader/src/plugin.ts index 1ce8991cbe..6c6c4cfcfc 100644 --- a/plugins/uploader/src/plugin.ts +++ b/plugins/uploader/src/plugin.ts @@ -15,7 +15,7 @@ import type { IntlString, Plugin, Resource } from '@hcengineering/platform' import { plugin } from '@hcengineering/platform' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' import type { UploadFilesFn, UploadFilesPopupFn } from './types' diff --git a/plugins/view-resources/src/plugin.ts b/plugins/view-resources/src/plugin.ts index 8e33a660d6..bdac738f4a 100644 --- a/plugins/view-resources/src/plugin.ts +++ b/plugins/view-resources/src/plugin.ts @@ -15,8 +15,8 @@ // import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform' -import { type PresentationMiddlewareCreator } from '@hcengineering/presentation' -import { type AnyComponent } from '@hcengineering/ui' +import { type PresentationMiddlewareCreator } from '@hcengineering/presentation/src/pipeline' +import { type AnyComponent } from '@hcengineering/ui/src/types' import view, { viewId } from '@hcengineering/view' export default mergeIds(viewId, view, { diff --git a/plugins/view/src/index.ts b/plugins/view/src/index.ts index 7a163484a9..5cee522138 100644 --- a/plugins/view/src/index.ts +++ b/plugins/view/src/index.ts @@ -16,7 +16,7 @@ import { Class, Doc, DocumentQuery, FindOptions, Mixin, Ref } from '@hcengineering/core' import { Asset, IntlString, Plugin, Resource, plugin } from '@hcengineering/platform' -import { AnyComponent, PopupAlignment, PopupPosAlignment } from '@hcengineering/ui' +import { AnyComponent, PopupAlignment, PopupPosAlignment } from '@hcengineering/ui/src/types' import { Action, ActionCategory, diff --git a/plugins/workbench-resources/src/components/Navigator.svelte b/plugins/workbench-resources/src/components/Navigator.svelte index 0dbeadb02b..e121facb86 100644 --- a/plugins/workbench-resources/src/components/Navigator.svelte +++ b/plugins/workbench-resources/src/components/Navigator.svelte @@ -47,7 +47,7 @@ (it) => !hierarchy.isMixin(it) ) if (classes.length > 0) { - query.query( + query.query( classes.length === 1 ? classes[0] : core.class.Space, !adminUser ? { diff --git a/plugins/workbench-resources/src/plugin.ts b/plugins/workbench-resources/src/plugin.ts index 6e7593a338..2024032f0c 100644 --- a/plugins/workbench-resources/src/plugin.ts +++ b/plugins/workbench-resources/src/plugin.ts @@ -17,7 +17,7 @@ import { mergeIds } from '@hcengineering/platform' import type { IntlString, Metadata } from '@hcengineering/platform' import workbench, { workbenchId } from '@hcengineering/workbench' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(workbenchId, workbench, { string: { diff --git a/plugins/workbench-resources/src/utils.ts b/plugins/workbench-resources/src/utils.ts index c36a0d9dc1..b95905cba7 100644 --- a/plugins/workbench-resources/src/utils.ts +++ b/plugins/workbench-resources/src/utils.ts @@ -19,16 +19,15 @@ import core, { hasAccountRole } from '@hcengineering/core' import type { Workspace } from '@hcengineering/login' import login, { loginId } from '@hcengineering/login' import { getResource, setMetadata } from '@hcengineering/platform' -import { closeClient, getClient } from '@hcengineering/presentation' -import presentation from '@hcengineering/presentation/src/plugin' +import presentation, { closeClient, getClient } from '@hcengineering/presentation' import { closePanel, fetchMetadataLocalStorage, getCurrentLocation, type Location, + location, navigate, - setMetadataLocalStorage, - location + setMetadataLocalStorage } from '@hcengineering/ui' import view from '@hcengineering/view' import workbench, { type Application, type NavigatorModel } from '@hcengineering/workbench' diff --git a/rush.json b/rush.json index f8bebe78d7..0b771f87ab 100644 --- a/rush.json +++ b/rush.json @@ -16,7 +16,7 @@ * path segment in the "$schema" field for all your Rush config files. This will ensure * correct error-underlining and tab-completion for editors such as VS Code. */ - "rushVersion": "5.148.0", + "rushVersion": "5.149.0", /** * The next field selects which package manager should be installed and determines its version. @@ -124,7 +124,7 @@ * LTS schedule: https://nodejs.org/en/about/releases/ * LTS versions: https://nodejs.org/en/download/releases/ */ - "nodeSupportedVersionRange": ">=12.13.0 <13.0.0 || >=14.15.0 <15.0.0 || >=16.0.0", + "nodeSupportedVersionRange": ">=20.0.0 <23.0.0", /** * Odd-numbered major versions of Node.js are experimental. Even-numbered releases diff --git a/server/account/src/operations.ts b/server/account/src/operations.ts index 5c36039320..c265fac33f 100644 --- a/server/account/src/operations.ts +++ b/server/account/src/operations.ts @@ -1237,6 +1237,7 @@ export async function updateWorkspaceInfo ( case 'restore-done': update.mode = 'active' update.progress = 100 + update.lastProcessingTime = Date.now() - processingTimeoutMs // To not wait for next step break case 'archiving-backup-started': diff --git a/services/github/github-resources/src/plugin.ts b/services/github/github-resources/src/plugin.ts index d146ffdc40..c14e5ccefd 100644 --- a/services/github/github-resources/src/plugin.ts +++ b/services/github/github-resources/src/plugin.ts @@ -7,7 +7,7 @@ import { type IntlString, mergeIds } from '@hcengineering/platform' import github, { githubId } from '@hcengineering/github' import { type Ref } from '@hcengineering/core' import { type Handler, type IntegrationType } from '@hcengineering/setting' -import { type AnyComponent } from '@hcengineering/ui' +import { type AnyComponent } from '@hcengineering/ui/src/types' export default mergeIds(githubId, github, { string: { diff --git a/services/github/model-github/src/plugin.ts b/services/github/model-github/src/plugin.ts index 40768235b5..985a758441 100644 --- a/services/github/model-github/src/plugin.ts +++ b/services/github/model-github/src/plugin.ts @@ -14,7 +14,7 @@ import { type DocCreateAnalyticsPropsFunction } from '@hcengineering/model-presentation' import { type NotificationGroup } from '@hcengineering/notification' -import type { AnyComponent } from '@hcengineering/ui' +import type { AnyComponent } from '@hcengineering/ui/src/types' import { type ActionCategory, type Viewlet } from '@hcengineering/view' export default mergeIds(githubId, github, { From f0f63391ffa8b896d5984179a5eca4c59409d89a Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Mon, 17 Feb 2025 14:35:03 +0700 Subject: [PATCH 03/13] fix: use workspace uuid in image and blob links (#8019) Signed-off-by: Alexander Onnikov --- packages/presentation/src/file.ts | 15 ++++++--------- packages/presentation/src/preview.ts | 8 ++++---- plugins/guest-resources/src/connect.ts | 4 +--- .../src/components/Backup.svelte | 3 +-- plugins/workbench-resources/src/connect.ts | 4 +--- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/packages/presentation/src/file.ts b/packages/presentation/src/file.ts index 4b0e6860e8..a3405427f6 100644 --- a/packages/presentation/src/file.ts +++ b/packages/presentation/src/file.ts @@ -99,12 +99,9 @@ function getFilesUrl (): string { return filesUrl.includes('://') ? filesUrl : concatLink(frontUrl, filesUrl) } -export function getCurrentWorkspaceId (): WorkspaceDataId { - return ( - getMetadata(plugin.metadata.WorkspaceDataId) ?? - (getMetadata(plugin.metadata.WorkspaceUuid) as unknown as WorkspaceDataId) ?? - ('' as WorkspaceDataId) - ) +export function getCurrentWorkspaceUuid (): WorkspaceDataId { + const workspaceUuid = getMetadata(plugin.metadata.WorkspaceUuid) ?? '' + return workspaceUuid as WorkspaceDataId } /** @@ -120,7 +117,7 @@ export function generateFileId (): string { export function getUploadUrl (): string { const template = getMetadata(plugin.metadata.UploadURL) ?? defaultUploadUrl - return template.replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceId())) + return template.replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceUuid())) } function getUploadConfig (): UploadConfig { @@ -142,7 +139,7 @@ function getFileUploadMethod (blob: Blob): { method: FileUploadMethod, url: stri * @public */ export function getFileUploadParams (blobId: string, blob: Blob): FileUploadParams { - const workspaceId = encodeURIComponent(getCurrentWorkspaceId()) + const workspaceId = encodeURIComponent(getCurrentWorkspaceUuid()) const fileId = encodeURIComponent(blobId) const { method, url: urlTemplate } = getFileUploadMethod(blob) @@ -170,7 +167,7 @@ export function getFileUrl (file: string, filename?: string): string { const template = getFilesUrl() return template .replaceAll(':filename', encodeURIComponent(filename ?? file)) - .replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceId())) + .replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceUuid())) .replaceAll(':blobId', encodeURIComponent(file)) } diff --git a/packages/presentation/src/preview.ts b/packages/presentation/src/preview.ts index 256a9cd1c1..b91827c2bc 100644 --- a/packages/presentation/src/preview.ts +++ b/packages/presentation/src/preview.ts @@ -2,7 +2,7 @@ import type { Blob, Ref } from '@hcengineering/core' import { concatLink } from '@hcengineering/core' import { getMetadata } from '@hcengineering/platform' -import { getFileUrl, getCurrentWorkspaceId } from './file' +import { getFileUrl, getCurrentWorkspaceUuid } from './file' import presentation from './plugin' export interface PreviewConfig { @@ -16,7 +16,7 @@ export interface VideoMeta { hls: string } -const defaultImagePreview = (): string => `/files/${getCurrentWorkspaceId()}?file=:blobId&size=:size` +const defaultImagePreview = (): string => `/files/${getCurrentWorkspaceUuid()}?file=:blobId&size=:size` /** * @@ -93,7 +93,7 @@ function blobToSrcSet ( return '' } - let url = cfg.image.replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceId())) + let url = cfg.image.replaceAll(':workspace', encodeURIComponent(getCurrentWorkspaceUuid())) const downloadUrl = getFileUrl(blob) const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin @@ -139,7 +139,7 @@ export async function getVideoMeta (file: string, filename?: string): Promise Date: Mon, 17 Feb 2025 14:36:22 +0700 Subject: [PATCH 04/13] fix: do not display empty link preview in case of file error (#8020) Signed-off-by: Alexander Onnikov --- packages/presentation/src/file.ts | 6 +- .../src/components/AttachmentPresenter.svelte | 78 ++++++++++--------- .../components/LinkPreviewPresenter.svelte | 7 +- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/packages/presentation/src/file.ts b/packages/presentation/src/file.ts index a3405427f6..4eb95050de 100644 --- a/packages/presentation/src/file.ts +++ b/packages/presentation/src/file.ts @@ -286,12 +286,12 @@ async function uploadFileWithSignedUrl (file: File, uuid: string, uploadUrl: str } } -export async function getJsonOrEmpty (file: string, name: string): Promise { +export async function getJsonOrEmpty (file: string, name: string): Promise { try { const fileUrl = getFileUrl(file, name) const resp = await fetch(fileUrl) - return await resp.json() + return (await resp.json()) as T } catch { - return {} + return undefined } } diff --git a/plugins/attachment-resources/src/components/AttachmentPresenter.svelte b/plugins/attachment-resources/src/components/AttachmentPresenter.svelte index 2d1a904afd..d6c1cf2f00 100644 --- a/plugins/attachment-resources/src/components/AttachmentPresenter.svelte +++ b/plugins/attachment-resources/src/components/AttachmentPresenter.svelte @@ -123,45 +123,49 @@ {#await getJsonOrEmpty(value.file, value.name)} {:then linkPreviewDetails} -
- {#if linkPreviewDetails.icon !== undefined && !useDefaultIcon} - link-preview { - useDefaultIcon = true - }} - /> - {:else} - - {/if} -
-
- -
- - {#if linkPreviewDetails.description} - {trimFilename(linkPreviewDetails.description)} - - {/if} - { - ev.stopPropagation() - ev.preventDefault() - dispatch('remove', value) + {#if linkPreviewDetails !== undefined} +
+ {#if linkPreviewDetails.icon !== undefined && !useDefaultIcon} + link-preview { + useDefaultIcon = true }} - > -
-
+
+ +
+ + {#if linkPreviewDetails.description} + {trimFilename(linkPreviewDetails.description)} + + {/if} + + + { + ev.stopPropagation() + ev.preventDefault() + dispatch('remove', value) + }} + > + + +
+
+ {/if} {/await} {:else} {#await getBlobRef(value.file, value.name, sizeToWidth('large')) then valueRef} diff --git a/plugins/attachment-resources/src/components/LinkPreviewPresenter.svelte b/plugins/attachment-resources/src/components/LinkPreviewPresenter.svelte index ff72a3994a..6218c23ad9 100644 --- a/plugins/attachment-resources/src/components/LinkPreviewPresenter.svelte +++ b/plugins/attachment-resources/src/components/LinkPreviewPresenter.svelte @@ -26,7 +26,7 @@ let useDefaultIcon = false let retryCount = 0 - let viewModel: LinkPreviewDetails + let viewModel: LinkPreviewDetails | undefined let previewImageSrc: string | undefined function refreshPreviewImage (): void { @@ -53,12 +53,13 @@ ) } onMount(() => { - void getJsonOrEmpty(attachment.file, attachment.name) + void getJsonOrEmpty(attachment.file, attachment.name) .then((res) => { - viewModel = res as LinkPreviewDetails + viewModel = res refreshPreviewImage() }) .catch((err) => { + viewModel = undefined console.error(err) }) }) From fbd1ac5b33d581e5927ade6bf011d60a1902eb4c Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Mon, 17 Feb 2025 14:58:50 +0700 Subject: [PATCH 05/13] UBERF-9484: Fix findAll for PG driver (#8022) Signed-off-by: Andrey Sobolev --- server/middleware/src/spaceSecurity.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/middleware/src/spaceSecurity.ts b/server/middleware/src/spaceSecurity.ts index 9b5f9512f1..b8e94917d5 100644 --- a/server/middleware/src/spaceSecurity.ts +++ b/server/middleware/src/spaceSecurity.ts @@ -539,14 +539,14 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar const account = ctx.contextData.account const isSpace = this.context.hierarchy.isDerived(_class, core.class.Space) const field = this.getKey(domain) - const showArchived: boolean = shouldShowArchived(query, options) + const showArchived: boolean = shouldShowArchived(newQuery, options) let clientFilterSpaces: Set> | undefined if (!isSystem(account, ctx) && account.role !== AccountRole.DocGuest && domain !== DOMAIN_MODEL) { if (!isOwner(account, ctx) || !isSpace || !showArchived) { - if (query[field] !== undefined) { - const res = await this.mergeQuery(ctx, account, query[field], domain, isSpace, showArchived) + if (newQuery[field] !== undefined) { + const res = await this.mergeQuery(ctx, account, newQuery[field], domain, isSpace, showArchived) if (res === undefined) { // eslint-disable-next-line @typescript-eslint/no-dynamic-delete delete newQuery[field] @@ -575,7 +575,7 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar options = { allowedSpaces: Array.from(spaces.result) } } } else { - // Check if spaces > 85% of all domain spaces, in this case return all and filter on client. + // Check if spaces are greater than 85% of all domain spaces. In this case, return all and filter on the client. if (spaces.result.size / spaces.domainSpaces.size > 0.85 && options?.limit === undefined) { clientFilterSpaces = spaces.result delete newQuery.space From 2f27d09a057116506a506446697fad80efe0465d Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Mon, 17 Feb 2025 16:23:29 +0700 Subject: [PATCH 06/13] Reset attempts from UI (#8023) Signed-off-by: Andrey Sobolev --- dev/docker-compose.yaml | 1 + dev/prod/public/config-worker.json | 2 +- packages/account-client/src/client.ts | 7 +- packages/core/src/classes.ts | 2 + .../src/components/AdminWorkspaces.svelte | 291 +++++++++--------- plugins/login-resources/src/utils.ts | 5 +- server/account/src/operations.ts | 6 +- 7 files changed, 168 insertions(+), 146 deletions(-) diff --git a/dev/docker-compose.yaml b/dev/docker-compose.yaml index bb7e47299e..99a9ceab8e 100644 --- a/dev/docker-compose.yaml +++ b/dev/docker-compose.yaml @@ -73,6 +73,7 @@ services: environment: - ACCOUNT_PORT=3000 - SERVER_SECRET=secret + - ADMIN_EMAILS=admin - STATS_URL=http://host.docker.internal:4900 # - DB_URL=postgresql://root@host.docker.internal:26257/defaultdb?sslmode=disable - DB_URL=${MONGO_URL} diff --git a/dev/prod/public/config-worker.json b/dev/prod/public/config-worker.json index a8056e3d04..3fd5bb9b6c 100644 --- a/dev/prod/public/config-worker.json +++ b/dev/prod/public/config-worker.json @@ -26,5 +26,5 @@ "TELEGRAM_URL": "https://telegram.hc.engineering", "UPLOAD_CONFIG": "", "UPLOAD_URL": "https://dl.hc.engineering/upload/form-data/:workspace", - "TRANSACTOR_OVERRIDE": "wss://transactor00.hc.engineering" + "TRANSACTOR_OVERRIDE": "ws://localhost:3335" } \ No newline at end of file diff --git a/packages/account-client/src/client.ts b/packages/account-client/src/client.ts index 7595b7c74a..0958eeb884 100644 --- a/packages/account-client/src/client.ts +++ b/packages/account-client/src/client.ts @@ -24,7 +24,8 @@ import { type WorkspaceInfoWithStatus, type WorkspaceMemberInfo, WorkspaceMode, - concatLink + concatLink, + type WorkspaceUserOperation } from '@hcengineering/core' import platform, { PlatformError, Severity, Status } from '@hcengineering/platform' import type { LoginInfo, OtpInfo, WorkspaceLoginInfo, RegionInfo, WorkspaceOperation } from './types' @@ -99,7 +100,7 @@ export interface AccountClient { listWorkspaces: (region?: string | null, mode?: WorkspaceMode | null) => Promise performWorkspaceOperation: ( workspaceId: string | string[], - event: 'archive' | 'migrate-to' | 'unarchive' | 'delete', + event: WorkspaceUserOperation, ...params: any ) => Promise assignWorkspace: (email: string, workspaceUuid: string, role: AccountRole) => Promise @@ -517,7 +518,7 @@ class AccountClientImpl implements AccountClient { async performWorkspaceOperation ( workspaceId: string | string[], - event: 'archive' | 'migrate-to' | 'unarchive' | 'delete', + event: WorkspaceUserOperation, ...params: any ): Promise { const request = { diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 08ad008ad6..346abc96f3 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -737,6 +737,8 @@ export type WorkspaceMode = | 'pending-restore' // -> 'restoring' | 'restoring' // -> 'active' +export type WorkspaceUserOperation = 'archive' | 'migrate-to' | 'unarchive' | 'delete' | 'reset-attempts' + export function isActiveMode (mode?: WorkspaceMode): boolean { return mode === 'active' } diff --git a/plugins/login-resources/src/components/AdminWorkspaces.svelte b/plugins/login-resources/src/components/AdminWorkspaces.svelte index 2093540748..6a94db4424 100644 --- a/plugins/login-resources/src/components/AdminWorkspaces.svelte +++ b/plugins/login-resources/src/components/AdminWorkspaces.svelte @@ -1,4 +1,5 @@ + + + + 0 && isValidEmail(to)} + on:close={() => { + dispatch('close') + }} + on:changeContent +> + +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
diff --git a/plugins/mail-resources/src/components/MailThread.svelte b/plugins/mail-resources/src/components/MailThread.svelte new file mode 100644 index 0000000000..edfc34f958 --- /dev/null +++ b/plugins/mail-resources/src/components/MailThread.svelte @@ -0,0 +1,120 @@ + + + + +{#if object !== undefined} + + dispatch('close')} + > + +