diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index d1043fda3f..18962092b7 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -302,6 +302,7 @@ specifiers: fast-equals: ^2.0.3 file-loader: ^6.2.0 filesize: ^8.0.3 + fork-ts-checker-webpack-plugin: ~7.3.0 got: ^11.8.3 html-to-text: ^9.0.3 html-webpack-plugin: ^5.5.0 @@ -671,6 +672,7 @@ dependencies: fast-equals: 2.0.4 file-loader: 6.2.0_webpack@5.75.0 filesize: 8.0.7 + fork-ts-checker-webpack-plugin: 7.3.0_typescript@4.8.4+webpack@5.75.0 got: 11.8.5 html-to-text: 9.0.3 html-webpack-plugin: 5.5.0_webpack@5.75.0 @@ -2714,6 +2716,26 @@ packages: defer-to-connect: 2.0.1 dev: false + /@tiptap/core/2.0.0-beta.209_88faf4ceee3e4a6aeb2426d142be0a06: + resolution: {integrity: sha512-DOOzfo2XKD5Qt2oEGW33/6ugwSnvpl4WbxtlKdPadLoApk6Kja3K1Eps3pihBgIGmo4tkctkCzmj8wNWS7KeWg==} + peerDependencies: + prosemirror-commands: ^1.3.1 + prosemirror-keymap: ^1.2.0 + prosemirror-model: ^1.18.1 + prosemirror-schema-list: ^1.2.2 + prosemirror-state: ^1.4.1 + prosemirror-transform: ^1.7.0 + prosemirror-view: ^1.28.2 + dependencies: + prosemirror-commands: 1.5.0 + prosemirror-keymap: 1.2.0 + prosemirror-model: 1.18.3 + prosemirror-schema-list: 1.2.2 + prosemirror-state: 1.4.2 + prosemirror-transform: 1.7.0 + prosemirror-view: 1.29.1 + dev: false + /@tiptap/core/2.0.0-beta.209_b7ea67b8e383e94e567bbd2a5d53cb52: resolution: {integrity: sha512-DOOzfo2XKD5Qt2oEGW33/6ugwSnvpl4WbxtlKdPadLoApk6Kja3K1Eps3pihBgIGmo4tkctkCzmj8wNWS7KeWg==} peerDependencies: @@ -3024,6 +3046,22 @@ packages: '@tiptap/core': 2.0.0-beta.209_b7ea67b8e383e94e567bbd2a5d53cb52 dev: false + /@tiptap/prosemirror-tables/1.1.4_820a2ec93be59195864136797737fd20: + resolution: {integrity: sha512-O2XnDhZV7xTHSFxMMl8Ei3UVeCxuMlbGYZ+J2QG8CzkK8mxDpBa66kFr5DdyAhvdi1ptpcH9u7/GMwItQpN4sA==} + peerDependencies: + prosemirror-keymap: ^1.1.2 + prosemirror-model: ^1.8.1 + prosemirror-state: ^1.3.1 + prosemirror-transform: ^1.2.1 + prosemirror-view: ^1.13.3 + dependencies: + prosemirror-keymap: 1.2.0 + prosemirror-model: 1.18.3 + prosemirror-state: 1.4.2 + prosemirror-transform: 1.7.0 + prosemirror-view: 1.29.1 + dev: false + /@tiptap/prosemirror-tables/1.1.4_825d0bccef8ba664696e76031c65278e: resolution: {integrity: sha512-O2XnDhZV7xTHSFxMMl8Ei3UVeCxuMlbGYZ+J2QG8CzkK8mxDpBa66kFr5DdyAhvdi1ptpcH9u7/GMwItQpN4sA==} peerDependencies: @@ -3074,6 +3112,41 @@ packages: - prosemirror-view dev: false + /@tiptap/starter-kit/2.0.0-beta.209_4bc2915a7798d139ce161d1059f26dca: + resolution: {integrity: sha512-uR68ZfDZ5PeygGey3xc9ZuFIP+K7VRElrABnZcM6t9/Crrs70UFwSTNlkS0ezx9woj8h+8N78a6r8W1YC04TOw==} + dependencies: + '@tiptap/core': 2.0.0-beta.209_88faf4ceee3e4a6aeb2426d142be0a06 + '@tiptap/extension-blockquote': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-bold': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-bullet-list': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-code': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-code-block': 2.0.0-beta.209_7c4b41d3b933ab120335c25fb0c64f89 + '@tiptap/extension-document': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-dropcursor': 2.0.0-beta.209_8146261db7b5e4b7ca8f9611f0136fd1 + '@tiptap/extension-gapcursor': 2.0.0-beta.209_ae82587580408645a82c84b21276f03e + '@tiptap/extension-hard-break': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-heading': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-history': 2.0.0-beta.209_e2f83d342d3e4fc6f345741d5563b0d1 + '@tiptap/extension-horizontal-rule': 2.0.0-beta.209_7c4b41d3b933ab120335c25fb0c64f89 + '@tiptap/extension-italic': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-list-item': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-ordered-list': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-paragraph': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-strike': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + '@tiptap/extension-text': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 + transitivePeerDependencies: + - prosemirror-commands + - prosemirror-dropcursor + - prosemirror-gapcursor + - prosemirror-history + - prosemirror-keymap + - prosemirror-model + - prosemirror-schema-list + - prosemirror-state + - prosemirror-transform + - prosemirror-view + dev: false + /@tiptap/suggestion/2.0.0-beta.209_6d771ef4ce96210c593056969447c447: resolution: {integrity: sha512-KKV64rTzTGY1q03nK0b4wCrAmihwThYJrYlPTUTelQm0AeJ4EPTNMRSR5rHD+fVF7agqrtrCkMw46vTXd6j1Jw==} peerDependencies: @@ -16248,12 +16321,12 @@ packages: dev: false file:projects/text-editor.tgz_1e646fd62a3adc9d0b41f256dafe3d38: - resolution: {integrity: sha512-cBdQh4hTVCpoolCLbnlHRe13ldtnGOFkf09z+B7W/Rqe1qJuY0t0KkX2KZKU/ibCQgA+duXx9rzgyjpMMThcaw==, tarball: file:projects/text-editor.tgz} + resolution: {integrity: sha512-4+cwBn+k4JdLN00mVFFMngvgdwonyINba4W27Ku8YKU6J0HQ6kLLY5d1htGHr1l6ZJvnrbe31tELdfJJTkJH/Q==, tarball: file:projects/text-editor.tgz} id: file:projects/text-editor.tgz name: '@rush-temp/text-editor' version: 0.0.0 dependencies: - '@tiptap/core': 2.0.0-beta.209_b7ea67b8e383e94e567bbd2a5d53cb52 + '@tiptap/core': 2.0.0-beta.209_88faf4ceee3e4a6aeb2426d142be0a06 '@tiptap/extension-code-block': 2.0.0-beta.209_7c4b41d3b933ab120335c25fb0c64f89 '@tiptap/extension-collaboration': 2.0.0-beta.209_c3e1167b714fc2c0e8099b0d893dd8f4 '@tiptap/extension-collaboration-cursor': 2.0.0-beta.209_542658698eb070984e7c071802d831ce @@ -16270,8 +16343,8 @@ packages: '@tiptap/extension-task-item': 2.0.0-beta.209_06eca8551536c047b95c272597601c00 '@tiptap/extension-task-list': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 '@tiptap/extension-typography': 2.0.0-beta.209_@tiptap+core@2.0.0-beta.209 - '@tiptap/prosemirror-tables': 1.1.4_825d0bccef8ba664696e76031c65278e - '@tiptap/starter-kit': 2.0.0-beta.209_3f796369a8f3f702340a0f7a928227c2 + '@tiptap/prosemirror-tables': 1.1.4_820a2ec93be59195864136797737fd20 + '@tiptap/starter-kit': 2.0.0-beta.209_4bc2915a7798d139ce161d1059f26dca '@tiptap/suggestion': 2.0.0-beta.209_6d771ef4ce96210c593056969447c447 '@types/diff': 5.0.2 '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 @@ -16292,6 +16365,7 @@ packages: prosemirror-dropcursor: 1.6.1 prosemirror-gapcursor: 1.3.1 prosemirror-history: 1.3.0 + prosemirror-keymap: 1.2.0 prosemirror-model: 1.18.3 prosemirror-schema-list: 1.2.2 prosemirror-state: 1.4.2 @@ -16314,7 +16388,6 @@ packages: - node-sass - postcss - postcss-load-config - - prosemirror-keymap - pug - stylus - sugarss diff --git a/dev/client-resources/src/connection.ts b/dev/client-resources/src/connection.ts index 2294c6fada..ee9cf218e4 100644 --- a/dev/client-resources/src/connection.ts +++ b/dev/client-resources/src/connection.ts @@ -112,20 +112,21 @@ export async function connect (handler: (tx: Tx) => void): Promise [] }, contentAdapter: { url: '', - factory: createNullContentTextAdapter, - metrics: new MeasureMetricsContext('', {}) + factory: createNullContentTextAdapter }, workspace: getWorkspaceId('') } - const serverStorage = await createServerStorage(conf) + const serverStorage = await createServerStorage(conf, { + upgrade: false + }) setMetadata(devmodel.metadata.DevModel, serverStorage) return new ServerStorageWrapper(serverStorage, handler) } diff --git a/dev/server/src/server.ts b/dev/server/src/server.ts index 14fc316515..3db5533c89 100644 --- a/dev/server/src/server.ts +++ b/dev/server/src/server.ts @@ -63,17 +63,16 @@ export async function start (port: number, host?: string): Promise { fulltextAdapter: { factory: createNullFullTextAdapter, url: '', - metrics: new MeasureMetricsContext('', {}), stages: () => [] }, + metrics: new MeasureMetricsContext('', {}), contentAdapter: { url: '', - factory: createNullContentTextAdapter, - metrics: new MeasureMetricsContext('', {}) + factory: createNullContentTextAdapter }, workspace: getWorkspaceId('') } - return createPipeline(conf, [], false) + return createPipeline(conf, [], false, () => {}) }, (token, pipeline, broadcast) => new ClientSession(broadcast, token, pipeline), port, diff --git a/models/all/src/migration.ts b/models/all/src/migration.ts index 3d1c1e7103..21b1899b63 100644 --- a/models/all/src/migration.ts +++ b/models/all/src/migration.ts @@ -47,7 +47,7 @@ export const migrateOperations: [string, MigrateOperation][] = [ ['telegram', telegramOperation], ['task', taskOperation], ['attachment', attachmentOperation], - ['', automationOperation], + ['automation', automationOperation], ['lead', leadOperation], ['recruit', recruitOperation], ['view', viewOperation], diff --git a/models/server-core/src/index.ts b/models/server-core/src/index.ts index d7a9a11fc7..157a14afdb 100644 --- a/models/server-core/src/index.ts +++ b/models/server-core/src/index.ts @@ -18,16 +18,25 @@ import { Model, Builder } from '@hcengineering/model' import type { Resource } from '@hcengineering/platform' import { TClass, TDoc } from '@hcengineering/model-core' -import type { ObjectDDParticipant, Trigger, TriggerFunc } from '@hcengineering/server-core' +import type { + AsyncTrigger, + ObjectDDParticipant, + Trigger, + TriggerFunc, + AsyncTriggerState, + AsyncTriggerFunc +} from '@hcengineering/server-core' import core, { Class, Doc, DocumentQuery, + DOMAIN_DOC_INDEX_STATE, DOMAIN_MODEL, FindOptions, FindResult, Hierarchy, - Ref + Ref, + TxCUD } from '@hcengineering/core' import serverCore from '@hcengineering/server-core' @@ -36,6 +45,18 @@ export class TTrigger extends TDoc implements Trigger { trigger!: Resource } +@Model(serverCore.class.AsyncTrigger, core.class.Doc, DOMAIN_MODEL) +export class TAsyncTrigger extends TDoc implements AsyncTrigger { + trigger!: Resource + classes!: Ref>[] +} + +@Model(serverCore.class.AsyncTriggerState, core.class.Doc, DOMAIN_DOC_INDEX_STATE) +export class TAsyncTriggerState extends TDoc implements AsyncTriggerState { + tx!: TxCUD + message!: string +} + @Model(serverCore.mixin.ObjectDDParticipant, core.class.Class) export class TObjectDDParticipant extends TClass implements ObjectDDParticipant { collectDocs!: Resource< @@ -52,5 +73,5 @@ export class TObjectDDParticipant extends TClass implements ObjectDDParticipant } export function createModel (builder: Builder): void { - builder.createModel(TTrigger, TObjectDDParticipant) + builder.createModel(TTrigger, TObjectDDParticipant, TAsyncTriggerState, TAsyncTrigger) } diff --git a/models/server-openai/package.json b/models/server-openai/package.json index 77f3ee4fb9..855002eb17 100644 --- a/models/server-openai/package.json +++ b/models/server-openai/package.json @@ -30,6 +30,8 @@ "@hcengineering/platform": "^0.6.8", "@hcengineering/model-core": "^0.6.0", "@hcengineering/openai": "^0.6.0", - "@hcengineering/server-core": "^0.6.1" + "@hcengineering/server-core": "^0.6.1", + "@hcengineering/model-chunter": "^0.6.0", + "@hcengineering/model-recruit": "^0.6.0" } } diff --git a/models/server-openai/src/index.ts b/models/server-openai/src/index.ts index f55a929d3a..c5b0fea263 100644 --- a/models/server-openai/src/index.ts +++ b/models/server-openai/src/index.ts @@ -22,6 +22,9 @@ import core, { DOMAIN_CONFIGURATION } from '@hcengineering/core' import openai, { OpenAIConfiguration } from '@hcengineering/openai/src/plugin' import serverCore from '@hcengineering/server-core' +import chunter from '@hcengineering/model-chunter' +import recruit from '@hcengineering/model-recruit' + @Model(openai.class.OpenAIConfiguration, core.class.Configuration, DOMAIN_CONFIGURATION) @UX(getEmbeddedLabel('OpenAI')) export class TOpenAIConfiguration extends TConfiguration implements OpenAIConfiguration { @@ -41,7 +44,8 @@ export class TOpenAIConfiguration extends TConfiguration implements OpenAIConfig export function createModel (builder: Builder): void { builder.createModel(TOpenAIConfiguration) - builder.createDoc(serverCore.class.Trigger, core.space.Model, { - trigger: openai.trigger.OnGPTRequest + builder.createDoc(serverCore.class.AsyncTrigger, core.space.Model, { + trigger: openai.trigger.AsyncOnGPTRequest, + classes: [chunter.class.Comment, recruit.class.ApplicantMatch] }) } diff --git a/packages/core/src/server.ts b/packages/core/src/server.ts index b1ff99be98..180b2fc2f2 100644 --- a/packages/core/src/server.ts +++ b/packages/core/src/server.ts @@ -66,5 +66,6 @@ export interface ServerStorage extends LowLevelStorage { options?: FindOptions ) => Promise> tx: (ctx: MeasureContext, tx: Tx) => Promise<[TxResult, Tx[]]> + apply: (ctx: MeasureContext, tx: Tx[], broadcast: boolean) => Promise close: () => Promise } diff --git a/packages/kanban/package.json b/packages/kanban/package.json index 3ae6ad2d07..d50066e1c3 100644 --- a/packages/kanban/package.json +++ b/packages/kanban/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/packages/panel/package.json b/packages/panel/package.json index a4c14159f7..9d8cd54def 100644 --- a/packages/panel/package.json +++ b/packages/panel/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/packages/presentation/package.json b/packages/presentation/package.json index 997f0dc754..50ff9e1975 100644 --- a/packages/presentation/package.json +++ b/packages/presentation/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/packages/presentation/src/components/IndexedDocumentCompare.svelte b/packages/presentation/src/components/IndexedDocumentCompare.svelte new file mode 100644 index 0000000000..89d0e12fd6 --- /dev/null +++ b/packages/presentation/src/components/IndexedDocumentCompare.svelte @@ -0,0 +1,55 @@ + + + + +
+
+
+
+ +
+ {#if right !== undefined} +
+ +
+ {/if} +
+
+
+
+ + diff --git a/packages/presentation/src/components/IndexedDocumentContent.svelte b/packages/presentation/src/components/IndexedDocumentContent.svelte new file mode 100644 index 0000000000..aca8ff1086 --- /dev/null +++ b/packages/presentation/src/components/IndexedDocumentContent.svelte @@ -0,0 +1,91 @@ + + +{#if summary} + {#if search.length > 0} + Result: + {#each summary.split('\n').filter((line) => line.toLowerCase().includes(search.toLowerCase())) as line} + {line} + {/each} +
+ {/if} + Summary: + {#each summary.split('\n') as line} + {@const hl = search.length > 0 && line.toLowerCase().includes(search.toLowerCase())} + {line} + {/each} +{:else if indexDoc} + {#each attributes as attr} + {@const clOf = client.getHierarchy().getClass(attr[0].attributeOf)} +
+ {#if clOf.icon} +
+ +
+ {/if} +
+
+ {#each attr[1] as doc} +
1}> + {#if search.length > 0} + Result: + {#each doc.filter((line) => line.toLowerCase().includes(search.toLowerCase())) as line} + {line} + {/each} +
+ {/if} + {#each doc as line} + {@const hl = search.length > 0 && line.toLowerCase().includes(search.toLowerCase())} + {line} + {/each} +
+ {/each} +
+ {/each} +{/if} + + diff --git a/packages/presentation/src/components/IndexedDocumentPreview.svelte b/packages/presentation/src/components/IndexedDocumentPreview.svelte index 083c284d3a..c8f5dfce95 100644 --- a/packages/presentation/src/components/IndexedDocumentPreview.svelte +++ b/packages/presentation/src/components/IndexedDocumentPreview.svelte @@ -1,15 +1,15 @@
- {#if summary} - {#if search.length > 0} - Result: - {#each summary.split('\n').filter((line) => line.toLowerCase().includes(search.toLowerCase())) as line} - {line} - {/each} -
- {/if} - Summary: - {#each summary.split('\n') as line} - {@const hl = search.length > 0 && line.toLowerCase().includes(search.toLowerCase())} - {line} - {/each} - {:else if indexDoc} - {#each attributes as attr} - {@const clOf = client.getHierarchy().getClass(attr[0].attributeOf)} -
- {#if clOf.icon} -
- -
- {/if} -
-
- {#each attr[1] as doc} -
1}> - {#if search.length > 0} - Result: - {#each doc.filter((line) => line.toLowerCase().includes(search.toLowerCase())) as line} - {line} - {/each} -
- {/if} - {#each doc as line} - {@const hl = search.length > 0 && line.toLowerCase().includes(search.toLowerCase())} - {line} - {/each} -
- {/each} -
- {/each} + {#if indexDoc} + {/if}
@@ -113,8 +43,5 @@ background-color: white; color: black; user-select: text; - .highlight { - color: blue; - } } diff --git a/packages/presentation/src/index.ts b/packages/presentation/src/index.ts index 20b8116fab..b91bbb8d7c 100644 --- a/packages/presentation/src/index.ts +++ b/packages/presentation/src/index.ts @@ -46,6 +46,7 @@ export { default as IconPerson } from './components/icons/Person.svelte' export { default as IconMembersOutline } from './components/icons/MembersOutline.svelte' export { default as ObjectSearchPopup } from './components/ObjectSearchPopup.svelte' export { default as IndexedDocumentPreview } from './components/IndexedDocumentPreview.svelte' +export { default as IndexedDocumentCompare } from './components/IndexedDocumentCompare.svelte' export { default as DraggableList } from './components/DraggableList.svelte' export { connect, versionError } from './connect' export { default } from './plugin' diff --git a/packages/text-editor/package.json b/packages/text-editor/package.json index e2f34fed41..007df63f5c 100644 --- a/packages/text-editor/package.json +++ b/packages/text-editor/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", @@ -65,6 +66,7 @@ "prosemirror-model": "^1.18.3", "prosemirror-view": "^1.29.1", "prosemirror-history": "^1.3.0", + "prosemirror-keymap": "^1.2.0", "rfc6902": "^5.0.1", "diff": "^5.1.0", "@tiptap/extension-code-block": "~2.0.0-beta.209", diff --git a/packages/theme/package.json b/packages/theme/package.json index 00df832f69..7cbf1b6077 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -9,7 +9,8 @@ "build": "tsc --incremental --noEmit --outDir ./dist_cache && echo build", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/packages/ui/package.json b/packages/ui/package.json index ee47113e3c..8461369c78 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -6,7 +6,7 @@ "license": "EPL-2.0", "scripts": { "build": "tsc --incremental --noEmit --outDir ./dist_cache && echo build", - "build:watch": "tsc", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache", "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", diff --git a/plugins/activity-resources/package.json b/plugins/activity-resources/package.json index e5b987ce25..bb7811a0a2 100644 --- a/plugins/activity-resources/package.json +++ b/plugins/activity-resources/package.json @@ -9,7 +9,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/attachment-resources/package.json b/plugins/attachment-resources/package.json index aa378e03ab..5b29c14404 100644 --- a/plugins/attachment-resources/package.json +++ b/plugins/attachment-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte index e67f18ca96..100bd28953 100644 --- a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte +++ b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte @@ -210,12 +210,9 @@ async function onMessage (event: CustomEvent) { loading = true - try { - await createAttachments() - dispatch('message', { message: event.detail, attachments: attachments.size }) - } finally { - loading = false - } + await createAttachments() + loading = false + dispatch('message', { message: event.detail, attachments: attachments.size }) } async function onUpdate (event: CustomEvent) { diff --git a/plugins/automation-resources/package.json b/plugins/automation-resources/package.json index f32b52d953..1db96811f7 100644 --- a/plugins/automation-resources/package.json +++ b/plugins/automation-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/bitrix-resources/package.json b/plugins/bitrix-resources/package.json index 6e2af89b80..182818802b 100644 --- a/plugins/bitrix-resources/package.json +++ b/plugins/bitrix-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/bitrix/package.json b/plugins/bitrix/package.json index 07d74d73b4..066ca64896 100644 --- a/plugins/bitrix/package.json +++ b/plugins/bitrix/package.json @@ -23,7 +23,7 @@ "eslint-config-standard-with-typescript": "^23.0.0", "prettier": "^2.7.1", "@rushstack/heft": "^0.47.9", - "typescript": "^4.3.5", + "typescript": "^4.3.5", "@types/qs": "~6.9.7" }, "dependencies": { diff --git a/plugins/board-resources/package.json b/plugins/board-resources/package.json index 34bcd4436f..2f1fb55608 100644 --- a/plugins/board-resources/package.json +++ b/plugins/board-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/calendar-resources/package.json b/plugins/calendar-resources/package.json index a21715912b..49f891bb0e 100644 --- a/plugins/calendar-resources/package.json +++ b/plugins/calendar-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/chunter-resources/package.json b/plugins/chunter-resources/package.json index 0e73a11521..b57d7393a7 100644 --- a/plugins/chunter-resources/package.json +++ b/plugins/chunter-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/chunter-resources/src/components/CommentInput.svelte b/plugins/chunter-resources/src/components/CommentInput.svelte index f604c93761..e70abbd39e 100644 --- a/plugins/chunter-resources/src/components/CommentInput.svelte +++ b/plugins/chunter-resources/src/components/CommentInput.svelte @@ -112,29 +112,26 @@ async function onMessage (event: CustomEvent) { loading = true - try { - const { message, attachments } = event.detail - await client.addCollection( - _class, - object.space, - object._id, - object._class, - 'comments', - { message, attachments }, - _id - ) + const { message, attachments } = event.detail + await client.addCollection( + _class, + object.space, + object._id, + object._class, + 'comments', + { message, attachments }, + _id + ) - // Create an backlink to document - await createBacklinks(client, object._id, object._class, _id, message) + // Create an backlink to document + await createBacklinks(client, object._id, object._class, _id, message) - // Remove draft from Local Storage - _id = generateId() - draftComment = undefined - await saveDraft(object) - commentInputBox.removeDraft(false) - } finally { - loading = false - } + // Remove draft from Local Storage + _id = generateId() + draftComment = undefined + await saveDraft(object) + commentInputBox.removeDraft(false) + loading = false } diff --git a/plugins/contact-resources/package.json b/plugins/contact-resources/package.json index 0fbf330c12..7aa231e3c4 100644 --- a/plugins/contact-resources/package.json +++ b/plugins/contact-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/devmodel-resources/package.json b/plugins/devmodel-resources/package.json index be760321f7..68385b2fdf 100644 --- a/plugins/devmodel-resources/package.json +++ b/plugins/devmodel-resources/package.json @@ -9,7 +9,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/document-resources/package.json b/plugins/document-resources/package.json index 3577222158..5a98ab4e92 100644 --- a/plugins/document-resources/package.json +++ b/plugins/document-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/gmail-resources/package.json b/plugins/gmail-resources/package.json index 6869a04219..83d8f63ade 100644 --- a/plugins/gmail-resources/package.json +++ b/plugins/gmail-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/hr-resources/package.json b/plugins/hr-resources/package.json index 64d02d56d7..a85b1c0125 100644 --- a/plugins/hr-resources/package.json +++ b/plugins/hr-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/image-cropper-resources/package.json b/plugins/image-cropper-resources/package.json index 650321a1c1..6ffb902624 100644 --- a/plugins/image-cropper-resources/package.json +++ b/plugins/image-cropper-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/inventory-resources/package.json b/plugins/inventory-resources/package.json index 78cdc88b40..355a6fb09e 100644 --- a/plugins/inventory-resources/package.json +++ b/plugins/inventory-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/lead-resources/package.json b/plugins/lead-resources/package.json index 5aec415fff..a23f969707 100644 --- a/plugins/lead-resources/package.json +++ b/plugins/lead-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/login-resources/package.json b/plugins/login-resources/package.json index d5bdac214e..1b68e9b02a 100644 --- a/plugins/login-resources/package.json +++ b/plugins/login-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/notification-resources/package.json b/plugins/notification-resources/package.json index 66826cc4c9..5cfcc0986a 100644 --- a/plugins/notification-resources/package.json +++ b/plugins/notification-resources/package.json @@ -10,7 +10,8 @@ "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", - "svelte-check": "svelte-check" + "svelte-check": "svelte-check", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "@hcengineering/platform-rig": "^0.6.0", diff --git a/plugins/recruit-resources/package.json b/plugins/recruit-resources/package.json index aef1f09207..2e47e1508c 100644 --- a/plugins/recruit-resources/package.json +++ b/plugins/recruit-resources/package.json @@ -9,7 +9,8 @@ "build:docs": "api-extractor run --local", "lint": "svelte-check && eslint", "lint:fix": "eslint --fix src", - "format": "prettier --write --plugin-search-dir=. src && eslint --fix src" + "format": "prettier --write --plugin-search-dir=. src && eslint --fix src", + "build:watch": "tsc --incremental --noEmit --outDir ./dist_cache" }, "devDependencies": { "svelte-loader": "^3.1.3", diff --git a/plugins/recruit-resources/src/components/MatchVacancy.svelte b/plugins/recruit-resources/src/components/MatchVacancy.svelte index f8f12e7bea..77e7c79850 100644 --- a/plugins/recruit-resources/src/components/MatchVacancy.svelte +++ b/plugins/recruit-resources/src/components/MatchVacancy.svelte @@ -5,15 +5,15 @@ Card, createQuery, getClient, - IndexedDocumentPreview, + IndexedDocumentCompare, MessageViewer, SpaceSelect } from '@hcengineering/presentation' import { Applicant, ApplicantMatch, Candidate, Vacancy } from '@hcengineering/recruit' - import { Button, IconActivity, IconAdd, Label, resizeObserver, showPopup, tooltip } from '@hcengineering/ui' + import { Button, IconActivity, IconAdd, Label, resizeObserver, showPopup, Spinner, tooltip } from '@hcengineering/ui' import Scroller from '@hcengineering/ui/src/components/Scroller.svelte' import { MarkupPreviewPopup, ObjectPresenter } from '@hcengineering/view-resources' - import { cosinesim } from '@hcengineering/view-resources/src/utils' + import { calcSørensenDiceCoefficient, cosinesim } from '@hcengineering/view-resources/src/utils' import { createEventDispatcher } from 'svelte' import recruit from '../plugin' import CreateApplication from './CreateApplication.svelte' @@ -50,8 +50,20 @@ state = new Map(res.map((it) => [it._id, it] ?? [])) } ) + $: vacancyState = state.get(_space as unknown as Ref) + $: scoreState = new Map( + _objects.map((it) => [ + it._id, + Math.round( + calcSørensenDiceCoefficient(state.get(it._id)?.fullSummary ?? '', vacancyState?.fullSummary ?? '') * 100 + ) / 100 + ]) + ) + + $: _sortedObjects = [..._objects].sort((a, b) => (scoreState.get(b._id) ?? 0) - (scoreState.get(a._id) ?? 0)) + const matchQuery = createQuery() let matches: Map, ApplicantMatch> = new Map() @@ -88,6 +100,7 @@ } } $: vacancyEmbedding = vacancyState && getEmbedding(vacancyState) + const dispatch = createEventDispatcher() const client = getClient() @@ -126,8 +139,8 @@ 'top' ) } - async function showSummary (doc: Candidate): Promise { - showPopup(IndexedDocumentPreview, { objectId: doc._id }, 'top') + async function showSummary (left: DocIndexState, right?: DocIndexState): Promise { + showPopup(IndexedDocumentCompare, { left, right }, 'top') } @@ -172,7 +185,7 @@
{#if vacancy} -
+
{#if vacancy.description} {vacancy.description} {/if} @@ -197,7 +210,7 @@ - {#each _objects as doc} + {#each _sortedObjects as doc} {@const docState = state.get(doc._id)} {@const docEmbedding = docState && getEmbedding(docState)} {@const match = matches.get(doc._id)} @@ -213,10 +226,12 @@ {/if}
- + {#if docEmbedding && vacancyEmbedding} {Math.round(cosinesim(docEmbedding, vacancyEmbedding) * 100)} + / {/if} + {scoreState.get(doc._id) ?? 0} {#if match?.complete} @@ -232,13 +247,13 @@ {#if docState}