From 0c653648f305a5767f7229ad775dda8033856dc0 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Wed, 15 Jun 2022 17:51:22 +0700 Subject: [PATCH 1/3] Add tracker server plugins Signed-off-by: Sergei Ogorelkov --- common/config/rush/pnpm-lock.yaml | 92 +++++++++++++++++-- dev/prod/package.json | 2 + dev/prod/src/platform-dev.ts | 2 + dev/tool/package.json | 2 + dev/tool/src/elastic.ts | 2 + models/all/package.json | 1 + models/all/src/index.ts | 2 + models/server-tracker/.eslintrc.js | 7 ++ models/server-tracker/.npmignore | 4 + models/server-tracker/config/rig.json | 18 ++++ models/server-tracker/package.json | 33 +++++++ models/server-tracker/src/index.ts | 25 +++++ models/server-tracker/tsconfig.json | 8 ++ products/tracker/package.json | 2 + products/tracker/src/platform-dev.ts | 2 + rush.json | 17 +++- server-plugins/tracker-resources/.eslintrc.js | 7 ++ server-plugins/tracker-resources/.npmignore | 4 + .../tracker-resources/config/rig.json | 18 ++++ server-plugins/tracker-resources/package.json | 34 +++++++ server-plugins/tracker-resources/src/index.ts | 42 +++++++++ .../tracker-resources/tsconfig.json | 8 ++ server-plugins/tracker/.eslintrc.js | 7 ++ server-plugins/tracker/.npmignore | 4 + server-plugins/tracker/config/rig.json | 18 ++++ server-plugins/tracker/package.json | 33 +++++++ server-plugins/tracker/src/index.ts | 32 +++++++ server-plugins/tracker/tsconfig.json | 9 ++ server/server/package.json | 2 + server/server/src/server.ts | 2 + 30 files changed, 429 insertions(+), 10 deletions(-) create mode 100644 models/server-tracker/.eslintrc.js create mode 100644 models/server-tracker/.npmignore create mode 100644 models/server-tracker/config/rig.json create mode 100644 models/server-tracker/package.json create mode 100644 models/server-tracker/src/index.ts create mode 100644 models/server-tracker/tsconfig.json create mode 100644 server-plugins/tracker-resources/.eslintrc.js create mode 100644 server-plugins/tracker-resources/.npmignore create mode 100644 server-plugins/tracker-resources/config/rig.json create mode 100644 server-plugins/tracker-resources/package.json create mode 100644 server-plugins/tracker-resources/src/index.ts create mode 100644 server-plugins/tracker-resources/tsconfig.json create mode 100644 server-plugins/tracker/.eslintrc.js create mode 100644 server-plugins/tracker/.npmignore create mode 100644 server-plugins/tracker/config/rig.json create mode 100644 server-plugins/tracker/package.json create mode 100644 server-plugins/tracker/src/index.ts create mode 100644 server-plugins/tracker/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 30f42369c24..dcd7a9d1780 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -87,6 +87,7 @@ specifiers: '@rush-temp/model-server-tags': file:./projects/model-server-tags.tgz '@rush-temp/model-server-task': file:./projects/model-server-task.tgz '@rush-temp/model-server-telegram': file:./projects/model-server-telegram.tgz + '@rush-temp/model-server-tracker': file:./projects/model-server-tracker.tgz '@rush-temp/model-setting': file:./projects/model-setting.tgz '@rush-temp/model-tags': file:./projects/model-tags.tgz '@rush-temp/model-task': file:./projects/model-task.tgz @@ -149,6 +150,8 @@ specifiers: '@rush-temp/server-telegram-resources': file:./projects/server-telegram-resources.tgz '@rush-temp/server-token': file:./projects/server-token.tgz '@rush-temp/server-tool': file:./projects/server-tool.tgz + '@rush-temp/server-tracker': file:./projects/server-tracker.tgz + '@rush-temp/server-tracker-resources': file:./projects/server-tracker-resources.tgz '@rush-temp/server-ws': file:./projects/server-ws.tgz '@rush-temp/setting': file:./projects/setting.tgz '@rush-temp/setting-assets': file:./projects/setting-assets.tgz @@ -373,6 +376,7 @@ dependencies: '@rush-temp/model-server-tags': file:projects/model-server-tags.tgz_typescript@4.7.2 '@rush-temp/model-server-task': file:projects/model-server-task.tgz_typescript@4.7.2 '@rush-temp/model-server-telegram': file:projects/model-server-telegram.tgz_typescript@4.7.2 + '@rush-temp/model-server-tracker': file:projects/model-server-tracker.tgz_typescript@4.7.2 '@rush-temp/model-setting': file:projects/model-setting.tgz_typescript@4.7.2 '@rush-temp/model-tags': file:projects/model-tags.tgz_typescript@4.7.2 '@rush-temp/model-task': file:projects/model-task.tgz_typescript@4.7.2 @@ -435,6 +439,8 @@ dependencies: '@rush-temp/server-telegram-resources': file:projects/server-telegram-resources.tgz '@rush-temp/server-token': file:projects/server-token.tgz '@rush-temp/server-tool': file:projects/server-tool.tgz + '@rush-temp/server-tracker': file:projects/server-tracker.tgz + '@rush-temp/server-tracker-resources': file:projects/server-tracker-resources.tgz '@rush-temp/server-ws': file:projects/server-ws.tgz '@rush-temp/setting': file:projects/setting.tgz '@rush-temp/setting-assets': file:projects/setting-assets.tgz_typescript@4.7.2 @@ -10318,7 +10324,7 @@ packages: dev: false file:projects/chunter-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c: - resolution: {integrity: sha512-hGY42Nm8WN8xitrfk9Z56o/r8a09cytzluQ8o4ifrZ63vDHfU4Jy6EP2fGUrdwMRr8jx1R9PFpAsjp8H5IUWzw==, tarball: file:projects/chunter-resources.tgz} + resolution: {integrity: sha512-FJpFm8VsdeaSW1Y1bRuwulXv3PVLIM/4nvTbIwPMoYUHQDt47UL27zIPbUAEUK0+3ar5arsiUO02jZJxlKA+xg==, tarball: file:projects/chunter-resources.tgz} id: file:projects/chunter-resources.tgz name: '@rush-temp/chunter-resources' version: 0.0.0 @@ -10496,7 +10502,7 @@ packages: dev: false file:projects/contact.tgz: - resolution: {integrity: sha512-2B/7NhxU+dIDhbVwlaOzJq+OwDzsf53p2DVvI+AbZa9Zj6gP5ajfKfkWqVT7pItU6Kt5he3t/5pg7KWvCyN6lw==, tarball: file:projects/contact.tgz} + resolution: {integrity: sha512-BngWK0q+CMT4P/1R02H53uqYvfhnSkx52G5hZ49BpcvdJAnrn+F8G7NiVSoUO2Ag2Cccundu89oVlUsnYXH4dw==, tarball: file:projects/contact.tgz} name: '@rush-temp/contact' version: 0.0.0 dependencies: @@ -11306,7 +11312,7 @@ packages: dev: false file:projects/model-all.tgz_typescript@4.7.2: - resolution: {integrity: sha512-Ard+150yL0Y2NaemClMs5TuSMqKu2oFyYI7oy2WfnHtMzow+H4WEk68FHB/zC2D6KNWi51H6RZ1dIc2+9gcGUg==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-3KLZ8VdyN6qL7q5SOOeD9sU9xUoDeqJRxAbyLtFhAgaTU1tX9n3C+cnmlDZhXq8kcK/Ss/xK2hrHfq0kOI7ILw==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -11517,7 +11523,7 @@ packages: dev: false file:projects/model-inventory.tgz_typescript@4.7.2: - resolution: {integrity: sha512-PCAUuH2imVPnkolq5MCYxYnjoWvba3ctRhi6kDepGqgywCnyixHL5h7dYKf79X1fFoyTS3f0PZve5JSBPvIrYw==, tarball: file:projects/model-inventory.tgz} + resolution: {integrity: sha512-ZrDM3hzsPJZPI1EGZpP4sEkEnJmmfzW77c2g7JejOCROBy6gd7237XN/SPjPk85CcSg7iHyueJiG9QGgoRB5SQ==, tarball: file:projects/model-inventory.tgz} id: file:projects/model-inventory.tgz name: '@rush-temp/model-inventory' version: 0.0.0 @@ -12019,6 +12025,29 @@ packages: - typescript dev: false + file:projects/model-server-tracker.tgz_typescript@4.7.2: + resolution: {integrity: sha512-3HUhXzYc+nHrN4DYIYeelA1sHD5hbsxAHFd0CVmmTQ+9cCEWDJUroNEiGCCr7hVs9Kt0UXXG9PLdvDcyyKWMPA==, tarball: file:projects/model-server-tracker.tgz} + id: file:projects/model-server-tracker.tgz + name: '@rush-temp/model-server-tracker' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + - typescript + dev: false + file:projects/model-setting.tgz_typescript@4.7.2: resolution: {integrity: sha512-BcxU6vVAXEmrjraS3jewut5+oeAEQuzU/k4aSNrdWi4oaOWJm5p5v1O2gzVZXbjI39eThGIbTtzDLBCEX95n1Q==, tarball: file:projects/model-setting.tgz} id: file:projects/model-setting.tgz @@ -12066,7 +12095,7 @@ packages: dev: false file:projects/model-task.tgz_typescript@4.7.2: - resolution: {integrity: sha512-fGY5a9pnS61IS1HaBJsxOnVBc/K+6A8S2YVvFp1zkU0Tqji7SoR34sLKFKz0IDQ4uYzaadkAs9cZmqs7NvfnDQ==, tarball: file:projects/model-task.tgz} + resolution: {integrity: sha512-rKwvH48V41O/F7EAUZoGCFkI1y2QpgBplsoZBNiZ+72Fy+zSrMtUWkTYNF1PCm+t+Bk4OkTOdQ84lLS6pllwtw==, tarball: file:projects/model-task.tgz} id: file:projects/model-task.tgz name: '@rush-temp/model-task' version: 0.0.0 @@ -12158,7 +12187,7 @@ packages: dev: false file:projects/model-tracker.tgz_typescript@4.7.2: - resolution: {integrity: sha512-MrEr3RwNVjkxXv3qaVSJu80bxkfUo7h+Q3BryQngr+CmPQeqnunU2qPOykoZvAVbmXKRO3w9qYz4DNsZmMBy2A==, tarball: file:projects/model-tracker.tgz} + resolution: {integrity: sha512-3giT5Ql8N6I6UaeU038P16HSmmhnQdy2eIYaKok1cF+AX0Z/0dXcR/bSvgQ88WJxMrtAsusZkOkF+PyvUUJOYg==, tarball: file:projects/model-tracker.tgz} id: file:projects/model-tracker.tgz name: '@rush-temp/model-tracker' version: 0.0.0 @@ -12643,7 +12672,7 @@ packages: dev: false file:projects/prod.tgz_d1c3762ecb2c185353d3f02936f6ec22: - resolution: {integrity: sha512-QATm8tinHt8huisQGumkIxn/Ew4j8Bez88PjoKLuXhybtp5uhZh67ooqqvbN9V+RPaR/827nktjzSzS1vZ6ZQQ==, tarball: file:projects/prod.tgz} + resolution: {integrity: sha512-PehFsaG21mA1q8ou+ldHAfMX0O+nPv2zVXTuj/K5TPMZ/DEkCtQHZtaVElryGq4xD1PlMyaID/1mqppbYEpbPQ==, tarball: file:projects/prod.tgz} id: file:projects/prod.tgz name: '@rush-temp/prod' version: 0.0.0 @@ -13584,6 +13613,51 @@ packages: - utf-8-validate dev: false + file:projects/server-tracker-resources.tgz: + resolution: {integrity: sha512-6x3B3So0oUuhHsacUMij18L6kIHKCitekIsc8jC6KJMZiidfUnQN2Spa4npg6CnwUr3cupIq2Jyn2M+BxCddwQ==, tarball: file:projects/server-tracker-resources.tgz} + name: '@rush-temp/server-tracker-resources' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + typescript: 4.7.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: false + + file:projects/server-tracker.tgz: + resolution: {integrity: sha512-MX6s76LYP1+V2O0cX17+ZMRMshwLYFOVZ1H7p1P+dSjLYQvAGd/YLSm4+EBQDezhifALLdUYnRAJ63+6g3xwxA==, tarball: file:projects/server-tracker.tgz} + name: '@rush-temp/server-tracker' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@types/node': 16.11.38 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + typescript: 4.7.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: false + file:projects/server-ws.tgz: resolution: {integrity: sha512-3OcollkknCogTVUoodFYtWQY7HEqvk/IwIJcttmAOoiFMZ5bLxVJp4owsikDyltPo6xWLnjEwxYuyzInBaHg0A==, tarball: file:projects/server-ws.tgz} name: '@rush-temp/server-ws' @@ -13612,7 +13686,7 @@ packages: dev: false file:projects/server.tgz: - resolution: {integrity: sha512-DixjIA8WXXltcm2FxRmE1hQMwF3p/5eqoHsMCtEEj1g5Pr8a1XGGfwGcsulDCM3rsekYZ9i+6Rf9baMg47eL8A==, tarball: file:projects/server.tgz} + resolution: {integrity: sha512-YMw6QleaQlQlzkQhIncun4YVr77XcZSRLy8xzfJiy6X1PaBSve9WY9mGkKiiw119bo2/72HEHEHMnsHQU3VtSQ==, tarball: file:projects/server.tgz} name: '@rush-temp/server' version: 0.0.0 dependencies: @@ -14171,7 +14245,7 @@ packages: dev: false file:projects/tool.tgz: - resolution: {integrity: sha512-5wm5S9YigxgUWQofHRnls3wij0i4pohO/j/teRYNlR+VbEw1P82GIpZoSmOU1wL1VS+Kd2y29N8Gg8KwGsOA6w==, tarball: file:projects/tool.tgz} + resolution: {integrity: sha512-DjXKod82QKmRLFxiKxIxpZ2dZX1hY66/acG3srfyNyTS5xsA9+SD2oPxFUw6lF+aTxXgwaI5wPgVmEWl8otmXQ==, tarball: file:projects/tool.tgz} name: '@rush-temp/tool' version: 0.0.0 dependencies: diff --git a/dev/prod/package.json b/dev/prod/package.json index 91e9ec25d99..9cb30c93698 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -136,6 +136,8 @@ "@anticrm/server-telegram": "~0.6.0", "@anticrm/server-telegram-resources": "~0.6.0", "@anticrm/presentation": "~0.6.2", + "@anticrm/server-tracker": "~0.6.0", + "@anticrm/server-tracker-resources": "~0.6.0", "@anticrm/tracker": "~0.6.0", "@anticrm/tracker-assets": "~0.6.0", "@anticrm/tracker-resources": "~0.6.0", diff --git a/dev/prod/src/platform-dev.ts b/dev/prod/src/platform-dev.ts index 81892f9f186..ea726f597a2 100644 --- a/dev/prod/src/platform-dev.ts +++ b/dev/prod/src/platform-dev.ts @@ -27,6 +27,7 @@ import { serverInventoryId } from '@anticrm/server-inventory' import { serverLeadId } from '@anticrm/server-lead' import { serverRecruitId } from '@anticrm/server-recruit' import { serverTaskId } from '@anticrm/server-task' +import { serverTrackerId } from '@anticrm/server-tracker' import { serverTagsId } from '@anticrm/server-tags' import { serverCalendarId } from '@anticrm/server-calendar' import { serverGmailId } from '@anticrm/server-gmail' @@ -54,6 +55,7 @@ export function configurePlatformDev() { addLocation(serverLeadId, () => import(/* webpackChunkName: "server-lead" */ '@anticrm/server-lead-resources')) addLocation(serverRecruitId, () => import(/* webpackChunkName: "server-recruit" */ '@anticrm/server-recruit-resources')) addLocation(serverTaskId, () => import/* webpackChunkName: "server-task" */ ('@anticrm/server-task-resources')) + addLocation(serverTrackerId, () => import/* webpackChunkName: "server-tracker" */ ('@anticrm/server-tracker-resources')) addLocation(serverTagsId, () => import/* webpackChunkName: "server-tags" */ ('@anticrm/server-tags-resources')) addLocation(serverCalendarId, () => import/* webpackChunkName: "server-calendar" */ ('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import/* webpackChunkName: "server-gmail" */ ('@anticrm/server-gmail-resources')) diff --git a/dev/tool/package.json b/dev/tool/package.json index 8fcec5813d0..ea7a4e2730b 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -93,6 +93,8 @@ "@anticrm/server-recruit-resources": "~0.6.0", "@anticrm/server-task": "~0.6.0", "@anticrm/server-task-resources": "~0.6.0", + "@anticrm/server-tracker": "~0.6.0", + "@anticrm/server-tracker-resources": "~0.6.0", "@anticrm/server-tags": "~0.6.0", "@anticrm/server-tags-resources": "~0.6.0", "@anticrm/server-calendar": "~0.6.0", diff --git a/dev/tool/src/elastic.ts b/dev/tool/src/elastic.ts index 72039cae6b3..5909458f37c 100644 --- a/dev/tool/src/elastic.ts +++ b/dev/tool/src/elastic.ts @@ -68,6 +68,7 @@ import { serverRecruitId } from '@anticrm/server-recruit' import { serverSettingId } from '@anticrm/server-setting' import { serverTagsId } from '@anticrm/server-tags' import { serverTaskId } from '@anticrm/server-task' +import { serverTrackerId } from '@anticrm/server-tracker' import { serverTelegramId } from '@anticrm/server-telegram' import { Client as ElasticClient } from '@elastic/elasticsearch' import { Client } from 'minio' @@ -133,6 +134,7 @@ export class ElasticTool { addLocation(serverRecruitId, () => import('@anticrm/server-recruit-resources')) addLocation(serverSettingId, () => import('@anticrm/server-setting-resources')) addLocation(serverTaskId, () => import('@anticrm/server-task-resources')) + addLocation(serverTrackerId, () => import('@anticrm/server-tracker-resources')) addLocation(serverTagsId, () => import('@anticrm/server-tags-resources')) addLocation(serverCalendarId, () => import('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import('@anticrm/server-gmail-resources')) diff --git a/models/all/package.json b/models/all/package.json index ab5abb4d26f..b7af3a299d4 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -50,6 +50,7 @@ "@anticrm/model-server-setting": "~0.6.0", "@anticrm/model-server-chunter": "~0.6.0", "@anticrm/model-server-task": "~0.6.0", + "@anticrm/model-server-tracker": "~0.6.0", "@anticrm/model-server-tags": "~0.6.0", "@anticrm/model-server-recruit": "~0.6.0", "@anticrm/model-server-lead": "~0.6.0", diff --git a/models/all/src/index.ts b/models/all/src/index.ts index d9b249f236c..3e797d735e4 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -35,6 +35,7 @@ import { createModel as serverChunterModel } from '@anticrm/model-server-chunter import { createModel as serverInventoryModel } from '@anticrm/model-server-inventory' import { createModel as serverLeadModel } from '@anticrm/model-server-lead' import { createModel as serverTaskModel } from '@anticrm/model-server-task' +import { createModel as serverTrackerModel } from '@anticrm/model-server-tracker' import { createModel as serverTagsModel } from '@anticrm/model-server-tags' import { createModel as serveSettingModel } from '@anticrm/model-server-setting' import { createModel as serverRecruitModel } from '@anticrm/model-server-recruit' @@ -94,6 +95,7 @@ const builders: [(b: Builder) => void, string][] = [ [serverLeadModel, 'server-lead'], [serverTagsModel, 'server-tags'], [serverTaskModel, 'server-task'], + [serverTrackerModel, 'server-tracker'], [serverRecruitModel, 'server-recruit'], [serverCalendarModel, 'server-calendar'], [serverGmailModel, 'server-gmail'], diff --git a/models/server-tracker/.eslintrc.js b/models/server-tracker/.eslintrc.js new file mode 100644 index 00000000000..c3c2c494172 --- /dev/null +++ b/models/server-tracker/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/server-tracker/.npmignore b/models/server-tracker/.npmignore new file mode 100644 index 00000000000..e3ec093c383 --- /dev/null +++ b/models/server-tracker/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/server-tracker/config/rig.json b/models/server-tracker/config/rig.json new file mode 100644 index 00000000000..e9a9ee9addc --- /dev/null +++ b/models/server-tracker/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/model-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/models/server-tracker/package.json b/models/server-tracker/package.json new file mode 100644 index 00000000000..95eddfae232 --- /dev/null +++ b/models/server-tracker/package.json @@ -0,0 +1,33 @@ +{ + "name": "@anticrm/model-server-tracker", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.45.5" + }, + "dependencies": { + "@anticrm/core": "~0.6.16", + "@anticrm/model": "~0.6.0", + "@anticrm/server-core": "~0.6.1", + "@anticrm/server-tracker": "~0.6.0" + } +} diff --git a/models/server-tracker/src/index.ts b/models/server-tracker/src/index.ts new file mode 100644 index 00000000000..13902324e4c --- /dev/null +++ b/models/server-tracker/src/index.ts @@ -0,0 +1,25 @@ +// +// Copyright © 2022 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { Builder } from '@anticrm/model' +import core from '@anticrm/core' +import serverCore from '@anticrm/server-core' +import serverTracker from '@anticrm/server-tracker' + +export function createModel (builder: Builder): void { + builder.createDoc(serverCore.class.Trigger, core.space.Model, { + trigger: serverTracker.trigger.OnIssueProjectUpdate + }) +} diff --git a/models/server-tracker/tsconfig.json b/models/server-tracker/tsconfig.json new file mode 100644 index 00000000000..1d60db76b4b --- /dev/null +++ b/models/server-tracker/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/products/tracker/package.json b/products/tracker/package.json index b96abb11f53..f9382930ee3 100644 --- a/products/tracker/package.json +++ b/products/tracker/package.json @@ -112,6 +112,8 @@ "@anticrm/server-chunter-resources": "~0.6.0", "@anticrm/server-task": "~0.6.0", "@anticrm/server-task-resources": "~0.6.0", + "@anticrm/server-tracker": "~0.6.0", + "@anticrm/server-tracker-resources": "~0.6.0", "@anticrm/server-calendar": "~0.6.0", "@anticrm/server-calendar-resources": "~0.6.0", "@anticrm/server-gmail": "~0.6.0", diff --git a/products/tracker/src/platform-dev.ts b/products/tracker/src/platform-dev.ts index f0e0dd30af5..aeb1875927a 100644 --- a/products/tracker/src/platform-dev.ts +++ b/products/tracker/src/platform-dev.ts @@ -24,6 +24,7 @@ import { serverNotificationId } from '@anticrm/server-notification' import { serverSettingId } from '@anticrm/server-setting' import { serverChunterId } from '@anticrm/server-chunter' import { serverTaskId } from '@anticrm/server-task' +import { serverTrackerId } from '@anticrm/server-tracker' import { serverCalendarId } from '@anticrm/server-calendar' import { serverGmailId } from '@anticrm/server-gmail' import { serverTelegramId } from '@anticrm/server-telegram' @@ -47,6 +48,7 @@ export function configurePlatformDev() { addLocation(serverSettingId, () => import(/* webpackChunkName: "server-setting" */ '@anticrm/server-setting-resources')) addLocation(serverChunterId, () => import(/* webpackChunkName: "server-chunter" */ '@anticrm/server-chunter-resources')) addLocation(serverTaskId, () => import/* webpackChunkName: "server-task" */ ('@anticrm/server-task-resources')) + addLocation(serverTrackerId, () => import/* webpackChunkName: "server-tracker" */ ('@anticrm/server-tracker-resources')) addLocation(serverCalendarId, () => import/* webpackChunkName: "server-calendar" */ ('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import/* webpackChunkName: "server-gmail" */ ('@anticrm/server-gmail-resources')) addLocation(serverTelegramId, () => import/* webpackChunkName: "server-telegram" */ ('@anticrm/server-telegram-resources')) diff --git a/rush.json b/rush.json index 92c5125adbe..8090ddd4bfa 100644 --- a/rush.json +++ b/rush.json @@ -1116,6 +1116,21 @@ "projectFolder": "models/server-task", "shouldPublish": true }, + { + "packageName": "@anticrm/server-tracker", + "projectFolder": "server-plugins/tracker", + "shouldPublish": true + }, + { + "packageName": "@anticrm/model-server-tracker", + "projectFolder": "models/server-tracker", + "shouldPublish": true + }, + { + "packageName": "@anticrm/server-tracker-resources", + "projectFolder": "server-plugins/tracker-resources", + "shouldPublish": true + }, { "packageName": "@anticrm/server-task-resources", "projectFolder": "server-plugins/task-resources", @@ -1312,6 +1327,6 @@ "packageName": "@anticrm/pod-backup", "projectFolder": "pods/backup", "shouldPublish": false - }, + } ] } diff --git a/server-plugins/tracker-resources/.eslintrc.js b/server-plugins/tracker-resources/.eslintrc.js new file mode 100644 index 00000000000..5da5872d4ae --- /dev/null +++ b/server-plugins/tracker-resources/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/server-plugins/tracker-resources/.npmignore b/server-plugins/tracker-resources/.npmignore new file mode 100644 index 00000000000..e3ec093c383 --- /dev/null +++ b/server-plugins/tracker-resources/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server-plugins/tracker-resources/config/rig.json b/server-plugins/tracker-resources/config/rig.json new file mode 100644 index 00000000000..af1257a8969 --- /dev/null +++ b/server-plugins/tracker-resources/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/platform-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/server-plugins/tracker-resources/package.json b/server-plugins/tracker-resources/package.json new file mode 100644 index 00000000000..458a2dcde36 --- /dev/null +++ b/server-plugins/tracker-resources/package.json @@ -0,0 +1,34 @@ +{ + "name": "@anticrm/server-tracker-resources", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.45.5", + "typescript": "^4.3.5" + }, + "dependencies": { + "@anticrm/core": "~0.6.16", + "@anticrm/platform": "~0.6.6", + "@anticrm/server-core": "~0.6.1", + "@anticrm/tracker": "~0.6.0" + } +} diff --git a/server-plugins/tracker-resources/src/index.ts b/server-plugins/tracker-resources/src/index.ts new file mode 100644 index 00000000000..bf6260d399c --- /dev/null +++ b/server-plugins/tracker-resources/src/index.ts @@ -0,0 +1,42 @@ +// +// Copyright © 2022 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import core, { Tx, TxUpdateDoc } from '@anticrm/core' +import { extractTx, TriggerControl } from '@anticrm/server-core' +import tracker, { Issue } from '@anticrm/tracker' + +/** + * @public + */ +export async function OnIssueProjectUpdate (tx: Tx, control: TriggerControl): Promise { + const actualTx = extractTx(tx) + if (actualTx._class !== core.class.TxUpdateDoc) { + return [] + } + + const updateTx = actualTx as TxUpdateDoc + if (!control.hierarchy.isDerived(updateTx.objectClass, tracker.class.Issue)) { + return [] + } + + return [] +} + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export default async () => ({ + trigger: { + OnIssueProjectUpdate + } +}) diff --git a/server-plugins/tracker-resources/tsconfig.json b/server-plugins/tracker-resources/tsconfig.json new file mode 100644 index 00000000000..aeb0517b138 --- /dev/null +++ b/server-plugins/tracker-resources/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + } +} \ No newline at end of file diff --git a/server-plugins/tracker/.eslintrc.js b/server-plugins/tracker/.eslintrc.js new file mode 100644 index 00000000000..5da5872d4ae --- /dev/null +++ b/server-plugins/tracker/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/server-plugins/tracker/.npmignore b/server-plugins/tracker/.npmignore new file mode 100644 index 00000000000..e3ec093c383 --- /dev/null +++ b/server-plugins/tracker/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server-plugins/tracker/config/rig.json b/server-plugins/tracker/config/rig.json new file mode 100644 index 00000000000..af1257a8969 --- /dev/null +++ b/server-plugins/tracker/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/platform-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/server-plugins/tracker/package.json b/server-plugins/tracker/package.json new file mode 100644 index 00000000000..7bfb370e6c1 --- /dev/null +++ b/server-plugins/tracker/package.json @@ -0,0 +1,33 @@ +{ + "name": "@anticrm/server-tracker", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.2", + "@types/node": "~16.11.12", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.45.5", + "typescript": "^4.3.5" + }, + "dependencies": { + "@anticrm/platform": "~0.6.6", + "@anticrm/server-core": "~0.6.1" + } +} diff --git a/server-plugins/tracker/src/index.ts b/server-plugins/tracker/src/index.ts new file mode 100644 index 00000000000..64561336e23 --- /dev/null +++ b/server-plugins/tracker/src/index.ts @@ -0,0 +1,32 @@ +// +// Copyright © 2022 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import type { Plugin, Resource } from '@anticrm/platform' +import { plugin } from '@anticrm/platform' +import { TriggerFunc } from '@anticrm/server-core' + +/** + * @public + */ +export const serverTrackerId = 'server-tracker' as Plugin + +/** + * @public + */ +export default plugin(serverTrackerId, { + trigger: { + OnIssueProjectUpdate: '' as Resource + } +}) diff --git a/server-plugins/tracker/tsconfig.json b/server-plugins/tracker/tsconfig.json new file mode 100644 index 00000000000..fffbf4c3415 --- /dev/null +++ b/server-plugins/tracker/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/server/server/package.json b/server/server/package.json index 065d44a07bb..d68df54044c 100644 --- a/server/server/package.json +++ b/server/server/package.json @@ -65,6 +65,8 @@ "@anticrm/server-recruit-resources": "~0.6.0", "@anticrm/server-task": "~0.6.0", "@anticrm/server-task-resources": "~0.6.0", + "@anticrm/server-tracker": "~0.6.0", + "@anticrm/server-tracker-resources": "~0.6.0", "@anticrm/server-tags": "~0.6.0", "@anticrm/server-tags-resources": "~0.6.0", "@anticrm/server-calendar": "~0.6.0", diff --git a/server/server/src/server.ts b/server/server/src/server.ts index 05c57eef9ff..6a5cdb1cd11 100644 --- a/server/server/src/server.ts +++ b/server/server/src/server.ts @@ -58,6 +58,7 @@ import { serverRecruitId } from '@anticrm/server-recruit' import { serverSettingId } from '@anticrm/server-setting' import { serverTagsId } from '@anticrm/server-tags' import { serverTaskId } from '@anticrm/server-task' +import { serverTrackerId } from '@anticrm/server-tracker' import { serverTelegramId } from '@anticrm/server-telegram' import { Token } from '@anticrm/server-token' import { BroadcastCall, ClientSession, start as startJsonRpc } from '@anticrm/server-ws' @@ -131,6 +132,7 @@ export function start ( addLocation(serverLeadId, () => import('@anticrm/server-lead-resources')) addLocation(serverRecruitId, () => import('@anticrm/server-recruit-resources')) addLocation(serverTaskId, () => import('@anticrm/server-task-resources')) + addLocation(serverTrackerId, () => import('@anticrm/server-tracker-resources')) addLocation(serverTagsId, () => import('@anticrm/server-tags-resources')) addLocation(serverCalendarId, () => import('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import('@anticrm/server-gmail-resources')) From d658a1b542a81a3b82df02b0c8b71487881f8736 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Thu, 16 Jun 2022 15:22:17 +0700 Subject: [PATCH 2/3] Update project in all sub-issues on parent project change Signed-off-by: Sergei Ogorelkov --- server-plugins/tracker-resources/src/index.ts | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/server-plugins/tracker-resources/src/index.ts b/server-plugins/tracker-resources/src/index.ts index bf6260d399c..93804590396 100644 --- a/server-plugins/tracker-resources/src/index.ts +++ b/server-plugins/tracker-resources/src/index.ts @@ -13,10 +13,33 @@ // limitations under the License. // -import core, { Tx, TxUpdateDoc } from '@anticrm/core' +import core, { AttachedData, Tx, TxUpdateDoc } from '@anticrm/core' import { extractTx, TriggerControl } from '@anticrm/server-core' import tracker, { Issue } from '@anticrm/tracker' +async function updateSubIssues ( + control: TriggerControl, + node: Issue, + update: Partial>, + shouldSkip = false +): Promise[]> { + let txes: TxUpdateDoc[] = [] + + if (!shouldSkip && Object.entries(update).some(([key, value]) => value !== node[key as keyof Issue])) { + txes.push(control.txFactory.createTxUpdateDoc(node._class, node.space, node._id, update)) + } + + if (node.subIssues > 0) { + const subIssues = await control.findAll(tracker.class.Issue, { attachedTo: node._id }) + + for (const subIssue of subIssues) { + txes = txes.concat(await updateSubIssues(control, subIssue, update)) + } + } + + return txes +} + /** * @public */ @@ -31,7 +54,17 @@ export async function OnIssueProjectUpdate (tx: Tx, control: TriggerControl): Pr return [] } - return [] + if (!Object.prototype.hasOwnProperty.call(updateTx.operations, 'project')) { + return [] + } + + const update: Partial> = { project: updateTx.operations.project ?? null } + const [node] = await control.findAll( + updateTx.objectClass, + { _id: updateTx.objectId, subIssues: { $gt: 0 } }, + { limit: 1 } + ) + return node !== undefined ? await updateSubIssues(control, node, update, true) : [] } // eslint-disable-next-line @typescript-eslint/explicit-function-return-type From 700d041175e3dfc8fb623cc32ce87ac7503e5752 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Thu, 16 Jun 2022 17:56:28 +0700 Subject: [PATCH 3/3] Update changelog Signed-off-by: Sergei Ogorelkov --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 66622e6c250..ee6458d9cbf 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ Platform: - Allow to attach from clipboard +- Updating subtask project according to parent project Leads: