diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e6093a9039..1c8cbe5039 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -89,6 +89,7 @@ specifiers: '@rush-temp/model-preference': file:./projects/model-preference.tgz '@rush-temp/model-presentation': file:./projects/model-presentation.tgz '@rush-temp/model-recruit': file:./projects/model-recruit.tgz + '@rush-temp/model-request': file:./projects/model-request.tgz '@rush-temp/model-rig': file:./projects/model-rig.tgz '@rush-temp/model-server-attachment': file:./projects/model-server-attachment.tgz '@rush-temp/model-server-calendar': file:./projects/model-server-calendar.tgz @@ -101,6 +102,7 @@ specifiers: '@rush-temp/model-server-lead': file:./projects/model-server-lead.tgz '@rush-temp/model-server-notification': file:./projects/model-server-notification.tgz '@rush-temp/model-server-recruit': file:./projects/model-server-recruit.tgz + '@rush-temp/model-server-request': file:./projects/model-server-request.tgz '@rush-temp/model-server-setting': file:./projects/model-server-setting.tgz '@rush-temp/model-server-tags': file:./projects/model-server-tags.tgz '@rush-temp/model-server-task': file:./projects/model-server-task.tgz @@ -136,6 +138,9 @@ specifiers: '@rush-temp/recruit-assets': file:./projects/recruit-assets.tgz '@rush-temp/recruit-resources': file:./projects/recruit-resources.tgz '@rush-temp/rekoni': file:./projects/rekoni.tgz + '@rush-temp/request': file:./projects/request.tgz + '@rush-temp/request-assets': file:./projects/request-assets.tgz + '@rush-temp/request-resources': file:./projects/request-resources.tgz '@rush-temp/server': file:./projects/server.tgz '@rush-temp/server-attachment': file:./projects/server-attachment.tgz '@rush-temp/server-attachment-resources': file:./projects/server-attachment-resources.tgz @@ -160,6 +165,8 @@ specifiers: '@rush-temp/server-preference': file:./projects/server-preference.tgz '@rush-temp/server-recruit': file:./projects/server-recruit.tgz '@rush-temp/server-recruit-resources': file:./projects/server-recruit-resources.tgz + '@rush-temp/server-request': file:./projects/server-request.tgz + '@rush-temp/server-request-resources': file:./projects/server-request-resources.tgz '@rush-temp/server-setting': file:./projects/server-setting.tgz '@rush-temp/server-setting-resources': file:./projects/server-setting-resources.tgz '@rush-temp/server-tags': file:./projects/server-tags.tgz @@ -433,6 +440,7 @@ dependencies: '@rush-temp/model-preference': file:projects/model-preference.tgz_typescript@4.8.4 '@rush-temp/model-presentation': file:projects/model-presentation.tgz_typescript@4.8.4 '@rush-temp/model-recruit': file:projects/model-recruit.tgz_typescript@4.8.4 + '@rush-temp/model-request': file:projects/model-request.tgz_typescript@4.8.4 '@rush-temp/model-rig': file:projects/model-rig.tgz_d0c406d687f2989aaac2d60d2a9fee8c '@rush-temp/model-server-attachment': file:projects/model-server-attachment.tgz_typescript@4.8.4 '@rush-temp/model-server-calendar': file:projects/model-server-calendar.tgz_typescript@4.8.4 @@ -445,6 +453,7 @@ dependencies: '@rush-temp/model-server-lead': file:projects/model-server-lead.tgz_typescript@4.8.4 '@rush-temp/model-server-notification': file:projects/model-server-notification.tgz_typescript@4.8.4 '@rush-temp/model-server-recruit': file:projects/model-server-recruit.tgz_typescript@4.8.4 + '@rush-temp/model-server-request': file:projects/model-server-request.tgz_typescript@4.8.4 '@rush-temp/model-server-setting': file:projects/model-server-setting.tgz_typescript@4.8.4 '@rush-temp/model-server-tags': file:projects/model-server-tags.tgz_typescript@4.8.4 '@rush-temp/model-server-task': file:projects/model-server-task.tgz_typescript@4.8.4 @@ -480,6 +489,9 @@ dependencies: '@rush-temp/recruit-assets': file:projects/recruit-assets.tgz_typescript@4.8.4 '@rush-temp/recruit-resources': file:projects/recruit-resources.tgz_49b4785992daa3b61a639b2b31601e76 '@rush-temp/rekoni': file:projects/rekoni.tgz_svelte@3.53.1 + '@rush-temp/request': file:projects/request.tgz + '@rush-temp/request-assets': file:projects/request-assets.tgz_typescript@4.8.4 + '@rush-temp/request-resources': file:projects/request-resources.tgz_49b4785992daa3b61a639b2b31601e76 '@rush-temp/server': file:projects/server.tgz '@rush-temp/server-attachment': file:projects/server-attachment.tgz '@rush-temp/server-attachment-resources': file:projects/server-attachment-resources.tgz @@ -504,6 +516,8 @@ dependencies: '@rush-temp/server-preference': file:projects/server-preference.tgz '@rush-temp/server-recruit': file:projects/server-recruit.tgz '@rush-temp/server-recruit-resources': file:projects/server-recruit-resources.tgz + '@rush-temp/server-request': file:projects/server-request.tgz + '@rush-temp/server-request-resources': file:projects/server-request-resources.tgz '@rush-temp/server-setting': file:projects/server-setting.tgz '@rush-temp/server-setting-resources': file:projects/server-setting-resources.tgz '@rush-temp/server-tags': file:projects/server-tags.tgz @@ -11558,7 +11572,7 @@ packages: dev: false file:projects/bitrix-resources.tgz_49b4785992daa3b61a639b2b31601e76: - resolution: {integrity: sha512-QQs9ffRu6ZbMcDsIHbbqwEnqlVIFPT5SOemp5PMLCfLcAhJn4arE89dCCuVLZ6p/JMYF3g7SCy/dgUllg4nNxA==, tarball: file:projects/bitrix-resources.tgz} + resolution: {integrity: sha512-178ugQAzdkKfmvq8EhfYkH91cYzYy2eqXRVv4JSAKH0T9zURX7EOqDlxCDuY4JF0EcVCTuVxV/s7vhXQA+OWHg==, tarball: file:projects/bitrix-resources.tgz} id: file:projects/bitrix-resources.tgz name: '@rush-temp/bitrix-resources' version: 0.0.0 @@ -11598,7 +11612,7 @@ packages: dev: false file:projects/bitrix.tgz: - resolution: {integrity: sha512-fLYL3iRRLeMJbRIjfkylukQ/uDZ/OfDuzAvrVHW/dCu2RIEFSpbYDvTlH4Cu0CR6adruVNSP4E3F+yAZSIHmQg==, tarball: file:projects/bitrix.tgz} + resolution: {integrity: sha512-PcaLfbhB2omp8QxZL539v0At2YmDpnHm5+90TMI2cQ6IUeJ0+8ZvvmqX4OFBC2DYBsnRji4C6thm4ETMyPPr7g==, tarball: file:projects/bitrix.tgz} name: '@rush-temp/bitrix' version: 0.0.0 dependencies: @@ -12879,7 +12893,7 @@ packages: dev: false file:projects/model-all.tgz_typescript@4.8.4: - resolution: {integrity: sha512-ypjI0QqQeCCDYXOlHjJqJ4Xpq/KaUIvpYqHoCz3kjRHqR3IuW+nOgxCNYfk5oB5kY2MDhWym0KQ5m05WjVfyGA==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-cceIYPJh6ybok4vnoo8AOkDZTj+f767K+XB7zwYYiUrLyddVM9F5azKmh/MIww7ruz2syGTb9G1Cuzu6U4IrXg==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -12946,7 +12960,7 @@ packages: dev: false file:projects/model-bitrix.tgz_typescript@4.8.4: - resolution: {integrity: sha512-8dZO37adBNzvRYUR8UsawVY1GPRN9F4g4IZj2viQyCZBx0z5vtY+Y+xfoDbHhY23D6pFSBMEz7O0vSCrH2jPSQ==, tarball: file:projects/model-bitrix.tgz} + resolution: {integrity: sha512-Mq3hdb43Kxj7zYn/jSN0/ktbgJ9pECGYoBWjDct5dw1clbxpMRAZepXXwXRCo5dDRhJtJL/nCtDlgt3PyAGvzw==, tarball: file:projects/model-bitrix.tgz} id: file:projects/model-bitrix.tgz name: '@rush-temp/model-bitrix' version: 0.0.0 @@ -13284,6 +13298,27 @@ packages: - typescript dev: false + file:projects/model-request.tgz_typescript@4.8.4: + resolution: {integrity: sha512-cp8ab34sOYVYsvFyXgzRZ2A/7jfSHe0uk+Js0LXlYUPBcRfcKtXTIZKawIiFbrlxHs+q0ilCO1d2vHUjZcjYuQ==, tarball: file:projects/model-request.tgz} + id: file:projects/model-request.tgz + name: '@rush-temp/model-request' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + file:projects/model-rig.tgz_d0c406d687f2989aaac2d60d2a9fee8c: resolution: {integrity: sha512-ZX1eKz9luTRYqbHYtHOLDtlSRzxkUytKqTko7niAPE/xHbKxvoxyJmfpHlW4hogCknARPxNluGb7hpc75HPTiQ==, tarball: file:projects/model-rig.tgz} id: file:projects/model-rig.tgz @@ -13534,6 +13569,27 @@ packages: - typescript dev: false + file:projects/model-server-request.tgz_typescript@4.8.4: + resolution: {integrity: sha512-ZLE63KwWhyNqO5JIr0fkBadQlPFdM1SPNM8qmu2aQtIIyQNnuPcqA+AGfofJ0WFJZR3KWoPwPpw6hvpihWGLAw==, tarball: file:projects/model-server-request.tgz} + id: file:projects/model-server-request.tgz + name: '@rush-temp/model-server-request' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + file:projects/model-server-setting.tgz_typescript@4.8.4: resolution: {integrity: sha512-vRzqTQTDigwIoObZPTwEuA482og33QycfSoK8pRY6pnLQrFjnYj2umdtPPYl7T3jVdMQoW9rE5N46a6hdRLiOw==, tarball: file:projects/model-server-setting.tgz} id: file:projects/model-server-setting.tgz @@ -14430,7 +14486,7 @@ packages: dev: false file:projects/recruit.tgz: - resolution: {integrity: sha512-+uz0YNeuB5qkYjqz/8Xyw7TXq0eayOdJwNkLTLQQgmlB9SlJujVmcKO3ov/yyVvHQyNNSNJKJB7wWGlblM4ZeQ==, tarball: file:projects/recruit.tgz} + resolution: {integrity: sha512-2bkLdmWr6143xDmsQ237suJnL0+KjZzDs0SGYxte02CKpnYv/I4nxyyPmuhZyWLYOUoMhtqeoduN9iAel0JfjQ==, tarball: file:projects/recruit.tgz} name: '@rush-temp/recruit' version: 0.0.0 dependencies: @@ -14472,6 +14528,84 @@ packages: - svelte dev: false + file:projects/request-assets.tgz_typescript@4.8.4: + resolution: {integrity: sha512-C/ygyzlQ33sZLRCNdPZWaRnQRcCeXXqa4f/WQcS81+9X8t9AfAVgty3TL+Q3VO7dQoceapxY/v1r6X8/X9NBHA==, tarball: file:projects/request-assets.tgz} + id: file:projects/request-assets.tgz + name: '@rush-temp/request-assets' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@types/node': 16.11.68 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + transitivePeerDependencies: + - supports-color + - typescript + dev: false + + file:projects/request-resources.tgz_49b4785992daa3b61a639b2b31601e76: + resolution: {integrity: sha512-rOmhKA3gIrctWaK8BfIPPZOfFaFfzelAR4C8ZJ6zCKLCQUa6fET27PbSRL2GLOmUmpMntsXqcNKXpE8oYxcsfw==, tarball: file:projects/request-resources.tgz} + id: file:projects/request-resources.tgz + name: '@rush-temp/request-resources' + version: 0.0.0 + dependencies: + '@types/deep-equal': 1.0.1 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + eslint-plugin-svelte3: 4.0.0_eslint@8.27.0+svelte@3.53.1 + prettier: 2.7.1 + prettier-plugin-svelte: 2.8.0_prettier@2.7.1+svelte@3.53.1 + sass: 1.56.1 + svelte: 3.53.1 + svelte-check: 2.9.2_911be9570a99ae2f9e069a41b9f14a00 + svelte-loader: 3.1.4_svelte@3.53.1 + svelte-preprocess: 4.10.7_1cd24d71cb02643c0a6ca17ff2edd158 + typescript: 4.8.4 + transitivePeerDependencies: + - '@babel/core' + - coffeescript + - less + - node-sass + - postcss + - postcss-load-config + - pug + - stylus + - sugarss + - supports-color + dev: false + + file:projects/request.tgz: + resolution: {integrity: sha512-cj+TDFeOo2pyiCmwTTG2FjSUgN/u4NCY1OWKTsZfaOeqVN1heBS1uuPowVm5igiaWodk+Uv+/v8FuCUTwvx1kA==, tarball: file:projects/request.tgz} + name: '@rush-temp/request' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/server-attachment-resources.tgz: resolution: {integrity: sha512-tXWhfEUm/y6epz3A7sl9aLV1+I3xTJP1m43qrQODdL/OaQWNeubTbwUN0+9ZktwrEUaOfIFChCzvLTuJzYhoJQ==, tarball: file:projects/server-attachment-resources.tgz} name: '@rush-temp/server-attachment-resources' @@ -14951,6 +15085,47 @@ packages: - supports-color dev: false + file:projects/server-request-resources.tgz: + resolution: {integrity: sha512-MzGrK/qc4ZpT94I7pz0EzDxAbT6YWBzGFr4peZHuHwvmKIkLJ3lqyE6NNvOQCW6qcVB70uhwaLyj5UrSaN3akw==, tarball: file:projects/server-request-resources.tgz} + name: '@rush-temp/server-request-resources' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: false + + file:projects/server-request.tgz: + resolution: {integrity: sha512-Ht+d0AKOHOqTja76xjYqQpt0Z8pKktiGYZPEBpXyP1pBzFu6QibiZmzInDs6zEZSxz+0+Hx3RAz9y6gBzDK8Pg==, tarball: file:projects/server-request.tgz} + name: '@rush-temp/server-request' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.47.11 + '@types/heft-jest': 1.0.3 + '@types/node': 16.11.68 + '@typescript-eslint/eslint-plugin': 5.42.1_d506b9be61cb4ac2646ecbc6e0680464 + '@typescript-eslint/parser': 5.42.1_eslint@8.27.0+typescript@4.8.4 + eslint: 8.27.0 + eslint-config-standard-with-typescript: 23.0.0_c9fe9619f50f4e82337a86c3af25e566 + eslint-plugin-import: 2.26.0_eslint@8.27.0 + eslint-plugin-n: 15.5.1_eslint@8.27.0 + eslint-plugin-promise: 6.1.1_eslint@8.27.0 + prettier: 2.7.1 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/server-setting-resources.tgz: resolution: {integrity: sha512-q2VKbFbhxcwmfGawfNOC6MgQZALRcNwfzHpceiTtso8oClhP2su/Ugji1DdiJmnbcBmLsxPeGp3A+VGZ87t9ig==, tarball: file:projects/server-setting-resources.tgz} name: '@rush-temp/server-setting-resources' diff --git a/dev/prod/package.json b/dev/prod/package.json index cb1b59ac2b..6a3b758b78 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -155,9 +155,13 @@ "@hcengineering/document": "^0.6.0", "@hcengineering/document-assets": "^0.6.0", "@hcengineering/document-resources": "^0.6.0", - "@hcengineering/bitrix": "^0.6.0", "@hcengineering/bitrix-assets": "^0.6.0", - "@hcengineering/bitrix-resources": "^0.6.0" + "@hcengineering/bitrix-resources": "^0.6.0", + "@hcengineering/request": "~0.6.0", + "@hcengineering/request-assets": "~0.6.0", + "@hcengineering/request-resources": "~0.6.0", + "@hcengineering/server-request": "~0.6.0", + "@hcengineering/server-request-resources": "~0.6.0" } } diff --git a/dev/prod/src/platform-dev.ts b/dev/prod/src/platform-dev.ts index 74301f796e..9628b24d34 100644 --- a/dev/prod/src/platform-dev.ts +++ b/dev/prod/src/platform-dev.ts @@ -32,6 +32,7 @@ import { serverCalendarId } from '@hcengineering/server-calendar' import { serverGmailId } from '@hcengineering/server-gmail' import { serverTelegramId } from '@hcengineering/server-telegram' import { serverHrId } from '@hcengineering/server-hr' +import { serverRequestId } from '@hcengineering/server-request' import { setMetadata } from '@hcengineering/platform' @@ -58,7 +59,8 @@ export function configurePlatformDev() { addLocation(serverCalendarId, () => import/* webpackChunkName: "server-calendar" */ ('@hcengineering/server-calendar-resources')) addLocation(serverGmailId, () => import/* webpackChunkName: "server-gmail" */ ('@hcengineering/server-gmail-resources')) addLocation(serverTelegramId, () => import/* webpackChunkName: "server-telegram" */ ('@hcengineering/server-telegram-resources')) - addLocation(serverHrId, () => import(/* webpackChunkName: "server-attachment" */ '@hcengineering/server-hr-resources')) + addLocation(serverHrId, () => import(/* webpackChunkName: "server-hr" */ '@hcengineering/server-hr-resources')) + addLocation(serverRequestId, () => import(/* webpackChunkName: "server-request" */ '@hcengineering/server-request-resources')) // Set devmodel to hook client to be able to present all activity enableDevModel() } diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index a0e6e77a64..e8b0ed182b 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -41,6 +41,7 @@ import { calendarId } from '@hcengineering/calendar' import { trackerId } from '@hcengineering/tracker' import { boardId } from '@hcengineering/board' import { hrId } from '@hcengineering/hr' +import { requestId } from '@hcengineering/request' import rekoni from '@hcengineering/rekoni' import document, { documentId } from '@hcengineering/document' @@ -71,6 +72,7 @@ import '@hcengineering/preference-assets' import '@hcengineering/hr-assets' import '@hcengineering/document-assets' import '@hcengineering/bitrix-assets' +import '@hcengineering/request-assets' import presentation, { presentationId } from '@hcengineering/presentation' import { coreId } from '@hcengineering/core' @@ -136,8 +138,10 @@ export async function configurePlatform() { addLocation(boardId, () => import(/* webpackChunkName: "board" */ '@hcengineering/board-resources')) addLocation(automationId, () => import(/* webpackChunkName: "automation" */ '@hcengineering/automation-resources')) addLocation(hrId, () => import(/* webpackChunkName: "hr" */ '@hcengineering/hr-resources')) - addLocation(documentId, () => import(/* webpackChunkName: "hr" */ '@hcengineering/document-resources')) + addLocation(documentId, () => import(/* webpackChunkName: "document" */ '@hcengineering/document-resources')) addLocation(bitrixId, () => import(/* webpackChunkName: "bitrix" */ '@hcengineering/bitrix-resources')) + addLocation(requestId, () => import(/* webpackChunkName: "request" */ '@hcengineering/request-resources')) + setMetadata(workbench.metadata.PlatformTitle, 'Platform') } diff --git a/dev/tool/package.json b/dev/tool/package.json index dc2e4b5a84..ccc38293aa 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -103,6 +103,8 @@ "@hcengineering/server-telegram-resources": "~0.6.0", "@hcengineering/server-hr": "~0.6.0", "@hcengineering/server-hr-resources": "~0.6.0", + "@hcengineering/server-request": "~0.6.0", + "@hcengineering/server-request-resources": "~0.6.0", "@hcengineering/rekoni": "~0.6.0", "got": "^11.8.3", "@hcengineering/tags": "~0.6.2", diff --git a/dev/tool/src/__start.ts b/dev/tool/src/__start.ts index fc4bb03045..db6ea38d01 100644 --- a/dev/tool/src/__start.ts +++ b/dev/tool/src/__start.ts @@ -36,6 +36,7 @@ import { serverTaskId } from '@hcengineering/server-task' import { serverTrackerId } from '@hcengineering/server-tracker' import { serverTelegramId } from '@hcengineering/server-telegram' import { serverHrId } from '@hcengineering/server-hr' +import { serverRequestId } from '@hcengineering/server-request' import { addLocation } from '@hcengineering/platform' addLocation(serverAttachmentId, () => import('@hcengineering/server-attachment-resources')) @@ -53,6 +54,7 @@ addLocation(serverCalendarId, () => import('@hcengineering/server-calendar-resou addLocation(serverGmailId, () => import('@hcengineering/server-gmail-resources')) addLocation(serverTelegramId, () => import('@hcengineering/server-telegram-resources')) addLocation(serverHrId, () => import('@hcengineering/server-hr-resources')) +addLocation(serverRequestId, () => import('@hcengineering/server-request-resources')) function prepareTools (): { mongodbUri: string diff --git a/models/all/package.json b/models/all/package.json index 18e01fe9d7..161431d7d9 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -75,6 +75,8 @@ "@hcengineering/model-hr": "~0.6.0", "@hcengineering/model-server-hr": "~0.6.0", "@hcengineering/model-document": "~0.6.0", - "@hcengineering/model-bitrix": "~0.6.0" + "@hcengineering/model-bitrix": "~0.6.0", + "@hcengineering/model-request": "~0.6.0", + "@hcengineering/model-server-request": "~0.6.0" } } diff --git a/models/all/src/index.ts b/models/all/src/index.ts index 2f7f5d0620..d75f01853e 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -60,6 +60,8 @@ import { createModel as hrModel } from '@hcengineering/model-hr' import { createModel as serverHrModel } from '@hcengineering/model-server-hr' import { createModel as documentModel } from '@hcengineering/model-document' import { createModel as bitrixModel } from '@hcengineering/model-bitrix' +import { createModel as requestModel } from '@hcengineering/model-request' +import { createModel as serverRequestModel } from '@hcengineering/model-server-request' export const version: Data = jsonVersion as Data @@ -92,6 +94,7 @@ const builders: [(b: Builder) => void, string][] = [ [boardModel, 'board'], [calendarModel, 'calendar'], [bitrixModel, 'bitrix'], + [requestModel, 'request'], [serverCoreModel, 'server-core'], [serverAttachmentModel, 'server-attachment'], @@ -109,6 +112,7 @@ const builders: [(b: Builder) => void, string][] = [ [serverTelegramModel, 'server-telegram'], [serverHrModel, 'server-hr'], [serverNotificationModel, 'server-notification'], + [serverRequestModel, 'server-request'], [automationModel, 'automation'] ] diff --git a/models/request/.eslintrc.js b/models/request/.eslintrc.js new file mode 100644 index 0000000000..59eb1482fa --- /dev/null +++ b/models/request/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/request/config/rig.json b/models/request/config/rig.json new file mode 100644 index 0000000000..45672e5d25 --- /dev/null +++ b/models/request/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": "@hcengineering/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/request/package.json b/models/request/package.json new file mode 100644 index 0000000000..a1b51d91b4 --- /dev/null +++ b/models/request/package.json @@ -0,0 +1,40 @@ +{ + "name": "@hcengineering/model-request", + "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": { + "@hcengineering/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.26.0", + "@types/heft-jest": "^1.0.3", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9" + }, + "dependencies": { + "@hcengineering/core": "^0.6.19", + "@hcengineering/model": "~0.6.0", + "@hcengineering/ui": "^0.6.2", + "@hcengineering/contact": "~0.6.8", + "@hcengineering/platform": "^0.6.8", + "@hcengineering/model-core": "~0.6.0", + "@hcengineering/model-view": "~0.6.0", + "@hcengineering/request": "~0.6.0", + "@hcengineering/activity": "~0.6.0", + "@hcengineering/chunter": "~0.6.1", + "@hcengineering/request-resources": "~0.6.0" + } +} diff --git a/models/request/src/index.ts b/models/request/src/index.ts new file mode 100644 index 0000000000..a25d97e165 --- /dev/null +++ b/models/request/src/index.ts @@ -0,0 +1,68 @@ +// +// 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 activity from '@hcengineering/activity' +import chunter from '@hcengineering/chunter' +import type { EmployeeAccount } from '@hcengineering/contact' +import contact from '@hcengineering/contact' +import { Doc, Domain, IndexKind, Ref, TxCUD } from '@hcengineering/core' +import { ArrOf, Builder, Collection, Index, Model, Prop, TypeRef, TypeString, UX } from '@hcengineering/model' +import core, { TAttachedDoc } from '@hcengineering/model-core' +import { Request, RequestStatus } from '@hcengineering/request' +import request from './plugin' + +export const DOMAIN_REQUEST = 'request' as Domain + +@Model(request.class.Request, core.class.AttachedDoc, DOMAIN_REQUEST) +@UX(request.string.Request) +export class TRequest extends TAttachedDoc implements Request { + @Prop(ArrOf(TypeRef(contact.class.EmployeeAccount)), request.string.Requested) + @Index(IndexKind.Indexed) + requested!: Ref[] + + @Prop(ArrOf(TypeRef(contact.class.EmployeeAccount)), request.string.Approved) + approved!: Ref[] + + requiredApprovesCount!: number + + @Prop(TypeString(), request.string.Status) + @Index(IndexKind.Indexed) + status!: RequestStatus + + tx!: TxCUD + + @Prop(Collection(chunter.class.Comment), chunter.string.Comments) + comments?: number +} + +export function createModel (builder: Builder): void { + builder.createModel(TRequest) + + builder.createDoc( + activity.class.TxViewlet, + core.space.Model, + { + objectClass: request.class.Request, + icon: request.icon.Requests, + txClass: core.class.TxCreateDoc, + component: request.activity.TxCreateRequest, + label: request.string.CreatedRequest, + display: 'emphasized' + }, + request.ids.TxRequestCreate + ) +} + +export { default } from './plugin' diff --git a/models/request/src/plugin.ts b/models/request/src/plugin.ts new file mode 100644 index 0000000000..59576e4d0a --- /dev/null +++ b/models/request/src/plugin.ts @@ -0,0 +1,37 @@ +// +// 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 { Ref } from '@hcengineering/core' +import type { IntlString } from '@hcengineering/platform' +import { mergeIds } from '@hcengineering/platform' +import { requestId } from '@hcengineering/request' +import request from '@hcengineering/request-resources/src/plugin' +import { AnyComponent } from '@hcengineering/ui' +import type { TxViewlet } from '@hcengineering/activity' + +export default mergeIds(requestId, request, { + activity: { + TxCreateRequest: '' as AnyComponent + }, + ids: { + TxRequestCreate: '' as Ref + }, + string: { + Request: '' as IntlString, + Status: '' as IntlString, + Approved: '' as IntlString, + Requested: '' as IntlString + } +}) diff --git a/models/request/tsconfig.json b/models/request/tsconfig.json new file mode 100644 index 0000000000..8070cdbc97 --- /dev/null +++ b/models/request/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@hcengineering/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/models/server-request/.eslintrc.js b/models/server-request/.eslintrc.js new file mode 100644 index 0000000000..59eb1482fa --- /dev/null +++ b/models/server-request/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/server-request/.npmignore b/models/server-request/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/server-request/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/server-request/config/rig.json b/models/server-request/config/rig.json new file mode 100644 index 0000000000..45672e5d25 --- /dev/null +++ b/models/server-request/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": "@hcengineering/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-request/package.json b/models/server-request/package.json new file mode 100644 index 0000000000..06663e5702 --- /dev/null +++ b/models/server-request/package.json @@ -0,0 +1,35 @@ +{ + "name": "@hcengineering/model-server-request", + "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": { + "@hcengineering/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.26.0", + "@types/heft-jest": "^1.0.3", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9" + }, + "dependencies": { + "@hcengineering/core": "^0.6.19", + "@hcengineering/model": "~0.6.0", + "@hcengineering/model-core": "~0.6.0", + "@hcengineering/platform": "^0.6.8", + "@hcengineering/server-request": "~0.6.0", + "@hcengineering/server-core": "~0.6.1" + } +} diff --git a/models/server-request/src/index.ts b/models/server-request/src/index.ts new file mode 100644 index 0000000000..a61e849ead --- /dev/null +++ b/models/server-request/src/index.ts @@ -0,0 +1,26 @@ +// +// 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 '@hcengineering/model' + +import core from '@hcengineering/core' +import serverCore from '@hcengineering/server-core' +import serverRequest from '@hcengineering/server-request' + +export function createModel (builder: Builder): void { + builder.createDoc(serverCore.class.Trigger, core.space.Model, { + trigger: serverRequest.trigger.OnRequestUpdate + }) +} diff --git a/models/server-request/tsconfig.json b/models/server-request/tsconfig.json new file mode 100644 index 0000000000..807a92c38c --- /dev/null +++ b/models/server-request/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@hcengineering/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/packages/platform/package.json b/packages/platform/package.json index 7455d58c70..10a6a70351 100644 --- a/packages/platform/package.json +++ b/packages/platform/package.json @@ -3,7 +3,11 @@ "version": "0.6.8", "main": "lib/index.js", "typings": "lib/index.d.ts", - "files": ["lib/**/*", "src/**/*", "tsconfig.json"], + "files": [ + "lib/**/*", + "src/**/*", + "tsconfig.json" + ], "author": "Anticrm Platform Contributors", "license": "EPL-2.0", "scripts": { diff --git a/plugins/activity-resources/src/activity.ts b/plugins/activity-resources/src/activity.ts index 04e62cc4d7..e9b8f8ea53 100644 --- a/plugins/activity-resources/src/activity.ts +++ b/plugins/activity-resources/src/activity.ts @@ -197,7 +197,7 @@ class ActivityImpl implements Activity { for (const tx of ownTxes) { if (!this.filterUpdateTx(tx)) continue - const result = this.createDisplayTx(tx, parents) + const [result] = this.createDisplayTx(tx, parents) // Combine previous update transaction for same field and if same operation and time treshold is ok ownResults = this.integrateTxWithResults(ownResults, result, editable) this.updateRemovedState(result, ownResults) @@ -212,10 +212,12 @@ class ActivityImpl implements Activity { if (changeAttached) { tx = await this.createFakeTx(doc, tx) } - const result = this.createDisplayTx(tx, parents) - // Combine previous update transaction for same field and if same operation and time treshold is ok - attachedResults = this.integrateTxWithResults(attachedResults, result, editable) - this.updateRemovedState(result, attachedResults) + const [result, isUpdated, isMixin] = this.createDisplayTx(tx, parents) + if (!(isUpdated || isMixin)) { + // Combine previous update transaction for same field and if same operation and time treshold is ok + attachedResults = this.integrateTxWithResults(attachedResults, result, editable) + this.updateRemovedState(result, attachedResults) + } } } return Array.from(ownResults).concat(attachedResults) @@ -267,7 +269,11 @@ class ActivityImpl implements Activity { return false } const tx = TxProcessor.extractTx(cltx) - if ([core.class.TxCreateDoc, core.class.TxUpdateDoc, core.class.TxRemoveDoc].includes(tx._class)) return true + if ( + [core.class.TxCreateDoc, core.class.TxUpdateDoc, core.class.TxRemoveDoc, core.class.TxMixin].includes(tx._class) + ) { + return true + } return false } @@ -300,7 +306,7 @@ class ActivityImpl implements Activity { return !this.hiddenAttributes.has(ops[0]) } - createDisplayTx (tx: TxCUD, parents: Map, DisplayTx>): DisplayTx { + createDisplayTx (tx: TxCUD, parents: Map, DisplayTx>): [DisplayTx, boolean, boolean] { let collectionAttribute: Attribute> | undefined if (this.hierarchy.isDerived(tx._class, core.class.TxCollectionCUD)) { const cltx = tx as TxCollectionCUD @@ -328,11 +334,11 @@ class ActivityImpl implements Activity { parents.set(tx.objectId, firstTx) // If we have updates also apply them all. - this.checkUpdateState(result, firstTx) - this.checkMixinState(result, firstTx) + const isUpdated = this.checkUpdateState(result, firstTx) + const isMixin = this.checkMixinState(result, firstTx) this.checkRemoveState(tx, firstTx, result) - return result + return [result, isUpdated, isMixin] } private checkRemoveState (tx: TxCUD, firstTx: DisplayTx, result: DisplayTx): void { diff --git a/plugins/activity-resources/src/components/Activity.svelte b/plugins/activity-resources/src/components/Activity.svelte index b87e835231..ebbdcaa5d1 100644 --- a/plugins/activity-resources/src/components/Activity.svelte +++ b/plugins/activity-resources/src/components/Activity.svelte @@ -22,7 +22,7 @@ import { Component, Grid, IconActivity, Label, Scroller, Button, showPopup } from '@hcengineering/ui' import { ActivityKey, activityKey, DisplayTx, newActivity } from '../activity' import TxView from './TxView.svelte' - import { filterCollectionTxes } from './utils' + import { filterCollectionTxes } from '../utils' import { Writable } from 'svelte/store' import view from '@hcengineering/view' import activityPlg from '../plugin' diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte index 6fd9f67237..c581a51f37 100644 --- a/plugins/activity-resources/src/components/TxView.svelte +++ b/plugins/activity-resources/src/components/TxView.svelte @@ -36,7 +36,7 @@ import { ActivityKey, DisplayTx } from '../activity' import activity from '../plugin' import TxViewTx from './TxViewTx.svelte' - import { getValue, TxDisplayViewlet, updateViewlet } from './utils' + import { getValue, TxDisplayViewlet, updateViewlet } from '../utils' export let tx: DisplayTx export let viewlets: Map @@ -452,4 +452,8 @@ .message { flex-basis: 100%; } + + .lower { + text-transform: lowercase; + } diff --git a/plugins/activity-resources/src/components/TxViewTx.svelte b/plugins/activity-resources/src/components/TxViewTx.svelte index 0e24c2363a..192ac103d8 100644 --- a/plugins/activity-resources/src/components/TxViewTx.svelte +++ b/plugins/activity-resources/src/components/TxViewTx.svelte @@ -2,7 +2,7 @@ import core, { Class, Doc, Ref } from '@hcengineering/core' import { Component, IconAdd, IconDelete } from '@hcengineering/ui' import { DisplayTx } from '../activity' - import { getDTxProps, TxDisplayViewlet } from './utils' + import { getDTxProps, TxDisplayViewlet } from '../utils' export let tx: DisplayTx export let viewlet: TxDisplayViewlet diff --git a/plugins/activity-resources/src/index.ts b/plugins/activity-resources/src/index.ts index ee6873bb6f..52462c5380 100644 --- a/plugins/activity-resources/src/index.ts +++ b/plugins/activity-resources/src/index.ts @@ -20,6 +20,7 @@ import TxView from './components/TxView.svelte' export { TxView } export * from './activity' +export * from './utils' export default async (): Promise => ({ component: { diff --git a/plugins/activity-resources/src/components/utils.ts b/plugins/activity-resources/src/utils.ts similarity index 98% rename from plugins/activity-resources/src/components/utils.ts rename to plugins/activity-resources/src/utils.ts index 37e42f79f7..03ebebf847 100644 --- a/plugins/activity-resources/src/components/utils.ts +++ b/plugins/activity-resources/src/utils.ts @@ -17,8 +17,8 @@ import { Asset, IntlString, translate } from '@hcengineering/platform' import { AnyComponent, AnySvelteComponent } from '@hcengineering/ui' import { AttributeModel } from '@hcengineering/view' import { buildModel, getObjectPresenter } from '@hcengineering/view-resources' -import { ActivityKey, activityKey, DisplayTx } from '../activity' -import activity from '../plugin' +import { ActivityKey, activityKey, DisplayTx } from './activity' +import activity from './plugin' export type TxDisplayViewlet = | (Pick & { diff --git a/plugins/client-resources/package.json b/plugins/client-resources/package.json index a73b0d5475..2fa8d3fdef 100644 --- a/plugins/client-resources/package.json +++ b/plugins/client-resources/package.json @@ -3,7 +3,11 @@ "version": "0.6.10", "main": "lib/index.js", "typings": "lib/index.d.ts", - "files": ["lib/**/*", "src/**/*", "tsconfig.json"], + "files": [ + "lib/**/*", + "src/**/*", + "tsconfig.json" + ], "author": "Anticrm Platform Contributors", "license": "EPL-2.0", "scripts": { diff --git a/plugins/client/package.json b/plugins/client/package.json index c5399590f6..689098bceb 100644 --- a/plugins/client/package.json +++ b/plugins/client/package.json @@ -5,7 +5,11 @@ "author": "Anticrm Platform Contributors", "license": "EPL-2.0", "typings": "lib/index.d.ts", - "files": ["lib/**/*", "src/**/*", "tsconfig.json"], + "files": [ + "lib/**/*", + "src/**/*", + "tsconfig.json" + ], "scripts": { "build": "heft build", "build:watch": "tsc", diff --git a/plugins/request-assets/.eslintrc.js b/plugins/request-assets/.eslintrc.js new file mode 100644 index 0000000000..8f8d9f363a --- /dev/null +++ b/plugins/request-assets/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/assets/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/plugins/request-assets/assets/icons.svg b/plugins/request-assets/assets/icons.svg new file mode 100644 index 0000000000..377778877c --- /dev/null +++ b/plugins/request-assets/assets/icons.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/request-assets/config/rig.json b/plugins/request-assets/config/rig.json new file mode 100644 index 0000000000..b75800b9b7 --- /dev/null +++ b/plugins/request-assets/config/rig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "@hcengineering/platform-rig", + "rigProfile": "assets" +} diff --git a/plugins/request-assets/lang/en.json b/plugins/request-assets/lang/en.json new file mode 100644 index 0000000000..fe80d170d6 --- /dev/null +++ b/plugins/request-assets/lang/en.json @@ -0,0 +1,13 @@ +{ + "string": { + "Requests": "Reqests", + "Request": "Request", + "Approve": "Approve", + "Approved": "Approved", + "CreatedRequest": "Created a request", + "For": "For", + "Change": "Change", + "Add": "Add", + "Remove": "Remove" + } +} \ No newline at end of file diff --git a/plugins/request-assets/lang/ru.json b/plugins/request-assets/lang/ru.json new file mode 100644 index 0000000000..fb78b81263 --- /dev/null +++ b/plugins/request-assets/lang/ru.json @@ -0,0 +1,13 @@ +{ + "string": { + "Requests": "Запросы", + "Request": "Запрос", + "Approve": "Одобрить", + "Approved": "Одобрил", + "CreatedRequest": "Создал запрос", + "For": "Для", + "Change": "Изменить", + "Add": "Добавить", + "Remove": "Удалить" + } +} \ No newline at end of file diff --git a/plugins/request-assets/package.json b/plugins/request-assets/package.json new file mode 100644 index 0000000000..70ecbba71b --- /dev/null +++ b/plugins/request-assets/package.json @@ -0,0 +1,35 @@ +{ + "name": "@hcengineering/request-assets", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "template": "@hcengineering/assets-package", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "test": "heft test", + "build:docs": "", + "lint": "eslint src", + "lint:fix": "eslint --fix src", + "format": "prettier --write src && eslint --fix src", + "build:watch": "tsc" + }, + "devDependencies": { + "@hcengineering/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.4.0", + "eslint-plugin-promise": "^6.1.1", + "eslint": "^8.26.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9", + "@types/node": "~16.11.12" + }, + "dependencies": { + "@hcengineering/platform": "^0.6.8", + "@hcengineering/request": "~0.6.0" + } +} diff --git a/plugins/request-assets/src/__tests__/lang.test.ts b/plugins/request-assets/src/__tests__/lang.test.ts new file mode 100644 index 0000000000..cf96c6dcf7 --- /dev/null +++ b/plugins/request-assets/src/__tests__/lang.test.ts @@ -0,0 +1,6 @@ +import { makeLocalesTest } from '@hcengineering/platform' + +it( + 'Locales are equale', + makeLocalesTest((lang) => import(`../../lang/${lang}.json`)) +) diff --git a/plugins/request-assets/src/index.ts b/plugins/request-assets/src/index.ts new file mode 100644 index 0000000000..2d649623a2 --- /dev/null +++ b/plugins/request-assets/src/index.ts @@ -0,0 +1,24 @@ +// +// 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 { addStringsLoader, loadMetadata } from '@hcengineering/platform' +import request, { requestId } from '@hcengineering/request' + +const icons = require('../assets/icons.svg') as string // eslint-disable-line +loadMetadata(request.icon, { + Requests: `${icons}#requests` +}) + +addStringsLoader(requestId, async (lang: string) => await import(`../lang/${lang}.json`)) diff --git a/plugins/request-assets/tsconfig.json b/plugins/request-assets/tsconfig.json new file mode 100644 index 0000000000..e161b20ea1 --- /dev/null +++ b/plugins/request-assets/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "target": "esnext", + "module": "commonjs", + "sourceMap": true, + "types": ["node", "heft-jest"], + "declaration": true, + "outDir": "./lib", + "strict": true, + "skipLibCheck": true, + "esModuleInterop": true, + "lib": [ + "esnext", + "dom" + ] + } +} \ No newline at end of file diff --git a/plugins/request-resources/.eslintrc.js b/plugins/request-resources/.eslintrc.js new file mode 100644 index 0000000000..8e724805a8 --- /dev/null +++ b/plugins/request-resources/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/ui/config/eslint.config.json'], + parserOptions: { tsconfigRootDir: __dirname }, + settings: { + 'svelte3/ignore-styles': () => true + } +} diff --git a/plugins/request-resources/package.json b/plugins/request-resources/package.json new file mode 100644 index 0000000000..7496f123ed --- /dev/null +++ b/plugins/request-resources/package.json @@ -0,0 +1,45 @@ +{ + "name": "@hcengineering/request-resources", + "version": "0.6.0", + "main": "src/index.ts", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "tsc --incremental --noEmit --outDir ./dist_cache && echo build", + "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" + }, + "devDependencies": { + "svelte-loader": "^3.1.3", + "sass": "^1.53.0", + "svelte-preprocess": "^4.10.7", + "@hcengineering/platform-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.4.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-svelte3": "^4.0.0", + "prettier-plugin-svelte": "^2.8.0", + "eslint": "^8.26.0", + "prettier": "^2.7.1", + "svelte-check": "^2.8.0", + "@types/deep-equal": "^1.0.1", + "typescript": "^4.3.5" + }, + "dependencies": { + "@hcengineering/platform": "^0.6.8", + "@hcengineering/core": "^0.6.19", + "@hcengineering/presentation": "~0.6.2", + "svelte": "^3.47", + "@hcengineering/ui": "^0.6.2", + "@hcengineering/request": "~0.6.0", + "@hcengineering/activity": "~0.6.0", + "@hcengineering/activity-resources": "~0.6.1", + "@hcengineering/contact": "~0.6.8", + "@hcengineering/view-resources": "~0.6.0" + } +} diff --git a/plugins/request-resources/postcss.config.js b/plugins/request-resources/postcss.config.js new file mode 100644 index 0000000000..88752c6cb0 --- /dev/null +++ b/plugins/request-resources/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} diff --git a/plugins/request-resources/src/components/RequestPresenter.svelte b/plugins/request-resources/src/components/RequestPresenter.svelte new file mode 100644 index 0000000000..4e90f2dfdb --- /dev/null +++ b/plugins/request-resources/src/components/RequestPresenter.svelte @@ -0,0 +1,22 @@ + + + + diff --git a/plugins/request-resources/src/components/RequestView.svelte b/plugins/request-resources/src/components/RequestView.svelte new file mode 100644 index 0000000000..83e371bd0a --- /dev/null +++ b/plugins/request-resources/src/components/RequestView.svelte @@ -0,0 +1,100 @@ + + +
+
+
+
+ {#if employee} + {formatName(employee.name)} + {/if} +
+ + + +
+
+
+ + {#if approvable} +
+
+ {/if} +
+ + diff --git a/plugins/request-resources/src/components/RequestsPopup.svelte b/plugins/request-resources/src/components/RequestsPopup.svelte new file mode 100644 index 0000000000..d8d9a3adfb --- /dev/null +++ b/plugins/request-resources/src/components/RequestsPopup.svelte @@ -0,0 +1,48 @@ + + + +
+
+ +
+ +
+ {#each requests as request (request._id)} + + {/each} +
+
+
diff --git a/plugins/request-resources/src/components/TxView.svelte b/plugins/request-resources/src/components/TxView.svelte new file mode 100644 index 0000000000..ff78955e1a --- /dev/null +++ b/plugins/request-resources/src/components/TxView.svelte @@ -0,0 +1,237 @@ + + + +{#if model.length > 0} +
+
+
+
+ {#if ptx.updateTx} + {#each model as m} + {#await getValue(client, m, ptx) then value} + {#if value.set === null || value.set === undefined} + + {:else if value.added.length} + + +
+
1}> + {#each value.added as cvalue} + + {/each} +
+
+ {:else if value.removed.length} + + +
+
1}> + {#each value.removed as cvalue} + + {/each} +
+
+ {:else} + + + {#if isMessageType(m.attribute)} +
+ +
+ {:else} +
+ +
+ {/if} + {/if} + {/await} + {/each} + {:else if ptx.mixinTx} + {#each model as m} + {#await getValue(client, m, ptx) then value} + {#if value.set === null} + + + {:else} + + + {#if isMessageType(m.attribute)} +
+ +
+ {:else} +
+ +
+ {/if} + {/if} + {/await} + {/each} + {/if} +
+
+
+
+{/if} + + diff --git a/plugins/request-resources/src/components/activity/TxCreateRequest.svelte b/plugins/request-resources/src/components/activity/TxCreateRequest.svelte new file mode 100644 index 0000000000..450ccf5f25 --- /dev/null +++ b/plugins/request-resources/src/components/activity/TxCreateRequest.svelte @@ -0,0 +1,23 @@ + + + + diff --git a/plugins/request-resources/src/index.ts b/plugins/request-resources/src/index.ts new file mode 100644 index 0000000000..85884c58c7 --- /dev/null +++ b/plugins/request-resources/src/index.ts @@ -0,0 +1,27 @@ +// +// 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 { Resources } from '@hcengineering/platform' +import RequestsPopup from './components/RequestsPopup.svelte' +import TxCreateRequest from './components/activity/TxCreateRequest.svelte' + +export default async (): Promise => ({ + activity: { + TxCreateRequest + }, + component: { + RequestsPopup + } +}) diff --git a/plugins/request-resources/src/plugin.ts b/plugins/request-resources/src/plugin.ts new file mode 100644 index 0000000000..324627155f --- /dev/null +++ b/plugins/request-resources/src/plugin.ts @@ -0,0 +1,29 @@ +// +// 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 { IntlString } from '@hcengineering/platform' +import { mergeIds } from '@hcengineering/platform' +import request, { requestId } from '@hcengineering/request' + +export default mergeIds(requestId, request, { + string: { + Approve: '' as IntlString, + CreatedRequest: '' as IntlString, + For: '' as IntlString, + Change: '' as IntlString, + Add: '' as IntlString, + Remove: '' as IntlString + } +}) diff --git a/plugins/request-resources/svelte.config.js b/plugins/request-resources/svelte.config.js new file mode 100644 index 0000000000..944a06f73e --- /dev/null +++ b/plugins/request-resources/svelte.config.js @@ -0,0 +1,5 @@ +const sveltePreprocess = require('svelte-preprocess') + +module.exports = { + preprocess: sveltePreprocess() +}; \ No newline at end of file diff --git a/plugins/request-resources/tsconfig.json b/plugins/request-resources/tsconfig.json new file mode 100644 index 0000000000..3dd18db780 --- /dev/null +++ b/plugins/request-resources/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@hcengineering/platform-rig/profiles/ui/tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/plugins/request/.eslintrc.js b/plugins/request/.eslintrc.js new file mode 100644 index 0000000000..7f7cebe58b --- /dev/null +++ b/plugins/request/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/plugins/request/config/rig.json b/plugins/request/config/rig.json new file mode 100644 index 0000000000..2fdc07ba20 --- /dev/null +++ b/plugins/request/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": "@hcengineering/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/plugins/request/package.json b/plugins/request/package.json new file mode 100644 index 0000000000..a062248105 --- /dev/null +++ b/plugins/request/package.json @@ -0,0 +1,34 @@ +{ + "name": "@hcengineering/request", + "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": { + "@hcengineering/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.26.0", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9", + "typescript": "^4.3.5" + }, + "dependencies": { + "@hcengineering/platform": "^0.6.8", + "@hcengineering/core": "^0.6.19", + "@hcengineering/ui": "^0.6.2", + "@hcengineering/contact": "~0.6.8" + } +} diff --git a/plugins/request/src/index.ts b/plugins/request/src/index.ts new file mode 100644 index 0000000000..a168eeb003 --- /dev/null +++ b/plugins/request/src/index.ts @@ -0,0 +1,65 @@ +// +// 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 { EmployeeAccount } from '@hcengineering/contact' +import type { AttachedDoc, Class, Doc, Ref, TxCUD } from '@hcengineering/core' +import type { Asset, IntlString, Plugin } from '@hcengineering/platform' +import { plugin } from '@hcengineering/platform' +import { AnyComponent } from '@hcengineering/ui' + +/** + * @public + */ +export interface Request extends AttachedDoc { + requested: Ref[] + approved: Ref[] + requiredApprovesCount: number + status: RequestStatus + tx: TxCUD + comments?: number +} + +/** + * @public + */ +export enum RequestStatus { + Active = 'Active', + Completed = 'Completed' +} + +/** + * @public + */ +export const requestId = 'request' as Plugin + +/** + * @public + */ +const request = plugin(requestId, { + class: { + Request: '' as Ref> + }, + component: { + RequestsPopup: '' as AnyComponent + }, + string: { + Requests: '' as IntlString + }, + icon: { + Requests: '' as Asset + } +}) + +export default request diff --git a/plugins/request/tsconfig.json b/plugins/request/tsconfig.json new file mode 100644 index 0000000000..b88f95eba6 --- /dev/null +++ b/plugins/request/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/plugins/view-resources/src/index.ts b/plugins/view-resources/src/index.ts index b26d140af8..5c921e383b 100644 --- a/plugins/view-resources/src/index.ts +++ b/plugins/view-resources/src/index.ts @@ -82,6 +82,7 @@ export { default as FixedColumn } from './components/FixedColumn.svelte' export { default as ViewOptionsButton } from './components/ViewOptionsButton.svelte' export { default as ValueSelector } from './components/ValueSelector.svelte' export { default as ObjectBox } from './components/ObjectBox.svelte' +export { default as ObjectPresenter } from './components/ObjectPresenter.svelte' export * from './context' export * from './filter' export * from './selection' diff --git a/plugins/workbench-resources/package.json b/plugins/workbench-resources/package.json index fb9951b934..62af75049f 100644 --- a/plugins/workbench-resources/package.json +++ b/plugins/workbench-resources/package.json @@ -41,6 +41,7 @@ "@hcengineering/login": "~0.6.1", "@hcengineering/setting": "~0.6.1", "@hcengineering/calendar": "~0.6.1", + "@hcengineering/request": "~0.6.0", "@hcengineering/notification": "~0.6.4", "@hcengineering/notification-resources": "~0.6.0", "@hcengineering/preference": "^0.6.1", diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index ed0197da72..0f0129a04c 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -17,6 +17,7 @@ import contact, { Employee, EmployeeAccount } from '@hcengineering/contact' import core, { Class, Client, Doc, getCurrentAccount, Ref, setCurrentAccount, Space } from '@hcengineering/core' import notification, { NotificationStatus } from '@hcengineering/notification' + import request from '@hcengineering/request' import { BrowserNotificatator, NotificationClientImpl } from '@hcengineering/notification-resources' import { getMetadata, getResource, IntlString } from '@hcengineering/platform' import { Avatar, createQuery, setClient } from '@hcengineering/presentation' @@ -444,6 +445,15 @@ }} />
+ { + showPopup(request.component.RequestsPopup, {}, popupPosition) + }} + notify={false} + /> import('@hcengineering/server-calendar-resources')) addLocation(serverGmailId, () => import('@hcengineering/server-gmail-resources')) addLocation(serverTelegramId, () => import('@hcengineering/server-telegram-resources')) + addLocation(serverRequestId, () => import('@hcengineering/server-request-resources')) addLocation(serverHrId, () => import('@hcengineering/server-hr-resources')) const middlewares: MiddlewareCreator[] = [ModifiedMiddleware.create, PrivateMiddleware.create] diff --git a/rush.json b/rush.json index 3cf5fac239..20da70e416 100644 --- a/rush.json +++ b/rush.json @@ -1414,7 +1414,6 @@ "projectFolder": "server/minio", "shouldPublish": true }, - { "packageName": "@hcengineering/bitrix", "projectFolder": "plugins/bitrix", @@ -1434,6 +1433,41 @@ "packageName": "@hcengineering/model-bitrix", "projectFolder": "models/bitrix", "shouldPublish": true - }, + }, + { + "packageName": "@hcengineering/request", + "projectFolder": "plugins/request", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/request-assets", + "projectFolder": "plugins/request-assets", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/request-resources", + "projectFolder": "plugins/request-resources", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/model-request", + "projectFolder": "models/request", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/server-request", + "projectFolder": "server-plugins/request", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/model-server-request", + "projectFolder": "models/server-request", + "shouldPublish": true + }, + { + "packageName": "@hcengineering/server-request-resources", + "projectFolder": "server-plugins/request-resources", + "shouldPublish": true + }, ] } diff --git a/server-plugins/request-resources/.eslintrc.js b/server-plugins/request-resources/.eslintrc.js new file mode 100644 index 0000000000..7f7cebe58b --- /dev/null +++ b/server-plugins/request-resources/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/server-plugins/request-resources/.npmignore b/server-plugins/request-resources/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/server-plugins/request-resources/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server-plugins/request-resources/config/rig.json b/server-plugins/request-resources/config/rig.json new file mode 100644 index 0000000000..2fdc07ba20 --- /dev/null +++ b/server-plugins/request-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": "@hcengineering/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/request-resources/package.json b/server-plugins/request-resources/package.json new file mode 100644 index 0000000000..6cfe4d9dc0 --- /dev/null +++ b/server-plugins/request-resources/package.json @@ -0,0 +1,38 @@ +{ + "name": "@hcengineering/server-request-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": { + "@hcengineering/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.26.0", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9", + "typescript": "^4.3.5" + }, + "dependencies": { + "@hcengineering/core": "^0.6.19", + "@hcengineering/platform": "^0.6.8", + "@hcengineering/server-core": "~0.6.1", + "@hcengineering/server-request": "~0.6.0", + "@hcengineering/request": "~0.6.0", + "@hcengineering/chunter": "~0.6.1", + "@hcengineering/view": "^0.6.1", + "@hcengineering/contact": "~0.6.8" + } +} diff --git a/server-plugins/request-resources/src/index.ts b/server-plugins/request-resources/src/index.ts new file mode 100644 index 0000000000..3e8e40b90d --- /dev/null +++ b/server-plugins/request-resources/src/index.ts @@ -0,0 +1,68 @@ +// +// 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, { Doc, Hierarchy, Tx, TxCollectionCUD, TxUpdateDoc } from '@hcengineering/core' +import request, { Request, RequestStatus } from '@hcengineering/request' +import type { TriggerControl } from '@hcengineering/server-core' + +/** + * @public + */ +export async function OnRequestUpdate (tx: Tx, control: TriggerControl): Promise { + const hierarchy = control.hierarchy + const ptx = tx as TxCollectionCUD + if (!checkTx(ptx, hierarchy)) return [] + const ctx = ptx.tx as TxUpdateDoc + if (ctx.operations.$push?.approved === undefined) return [] + const request = (await control.findAll(ctx.objectClass, { _id: ctx.objectId }))[0] + if (request.approved.length === request.requiredApprovesCount) { + const collectionTx = control.txFactory.createTxUpdateDoc(ctx.objectClass, ctx.objectSpace, ctx.objectId, { + status: RequestStatus.Completed + }) + const resTx = control.txFactory.createTxCollectionCUD( + ptx.objectClass, + ptx.objectId, + ptx.objectSpace, + 'requests', + collectionTx + ) + return [ + { + ...request.tx, + modifiedOn: resTx.modifiedOn + }, + resTx + ] + } + return [] +} + +function checkTx (ptx: TxCollectionCUD, hierarchy: Hierarchy): boolean { + if (ptx._class !== core.class.TxCollectionCUD) { + return false + } + + if (ptx.tx._class !== core.class.TxUpdateDoc || !hierarchy.isDerived(ptx.tx.objectClass, request.class.Request)) { + return false + } + return true +} + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export default async () => ({ + trigger: { + OnRequestUpdate + } +}) diff --git a/server-plugins/request-resources/tsconfig.json b/server-plugins/request-resources/tsconfig.json new file mode 100644 index 0000000000..9b47eded03 --- /dev/null +++ b/server-plugins/request-resources/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + } +} \ No newline at end of file diff --git a/server-plugins/request/.eslintrc.js b/server-plugins/request/.eslintrc.js new file mode 100644 index 0000000000..7f7cebe58b --- /dev/null +++ b/server-plugins/request/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/server-plugins/request/.npmignore b/server-plugins/request/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/server-plugins/request/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server-plugins/request/config/rig.json b/server-plugins/request/config/rig.json new file mode 100644 index 0000000000..2fdc07ba20 --- /dev/null +++ b/server-plugins/request/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": "@hcengineering/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/request/package.json b/server-plugins/request/package.json new file mode 100644 index 0000000000..62c34dded9 --- /dev/null +++ b/server-plugins/request/package.json @@ -0,0 +1,33 @@ +{ + "name": "@hcengineering/server-request", + "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": { + "@hcengineering/platform-rig": "~0.6.0", + "@types/heft-jest": "^1.0.3", + "@types/node": "~16.11.12", + "@typescript-eslint/eslint-plugin": "^5.41.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-n": "^15.4.0", + "eslint": "^8.26.0", + "@typescript-eslint/parser": "^5.41.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "prettier": "^2.7.1", + "@rushstack/heft": "^0.47.9", + "typescript": "^4.3.5" + }, + "dependencies": { + "@hcengineering/platform": "^0.6.8", + "@hcengineering/server-core": "~0.6.1" + } +} diff --git a/server-plugins/request/src/index.ts b/server-plugins/request/src/index.ts new file mode 100644 index 0000000000..03fd37e951 --- /dev/null +++ b/server-plugins/request/src/index.ts @@ -0,0 +1,31 @@ +// +// 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 { Plugin, plugin, Resource } from '@hcengineering/platform' +import type { TriggerFunc } from '@hcengineering/server-core' + +/** + * @public + */ +export const serverRequestId = 'server-request' as Plugin + +/** + * @public + */ +export default plugin(serverRequestId, { + trigger: { + OnRequestUpdate: '' as Resource + } +}) diff --git a/server-plugins/request/tsconfig.json b/server-plugins/request/tsconfig.json new file mode 100644 index 0000000000..b88f95eba6 --- /dev/null +++ b/server-plugins/request/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/server/tool/package.json b/server/tool/package.json index 9cf8c795a3..a5ab1bb15a 100644 --- a/server/tool/package.json +++ b/server/tool/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "mongodb": "^4.11.0", - "@hcengineering/platform": "^0.6.8", + "@hcengineering/platform": "^0.6.8", "@hcengineering/core": "^0.6.19", "@hcengineering/contact": "~0.6.8", "@hcengineering/client-resources": "~0.6.4",