diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 25859b30ae..72c47292cb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -272,6 +272,9 @@ dependencies: '@rush-temp/guest-resources': specifier: file:./projects/guest-resources.tgz version: file:projects/guest-resources.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2) + '@rush-temp/highlight': + specifier: file:./projects/highlight.tgz + version: file:projects/highlight.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2) '@rush-temp/hr': specifier: file:./projects/hr.tgz version: file:projects/hr.tgz(@types/node@20.11.19)(esbuild@0.20.1)(ts-node@10.9.2) @@ -1232,6 +1235,9 @@ dependencies: '@types/crypto-js': specifier: ^4.1.1 version: 4.2.2 + '@types/csvtojson': + specifier: ^2.0.0 + version: 2.0.0 '@types/diff': specifier: ~5.0.2 version: 5.0.9 @@ -23178,6 +23184,56 @@ packages: typescript: 5.3.3 dev: false + /svelte-preprocess@5.1.3(postcss-load-config@4.0.2)(postcss@8.4.35)(sass@1.71.1)(svelte@4.2.12)(typescript@5.6.2): + resolution: {integrity: sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==} + engines: {node: '>= 16.0.0', pnpm: ^8.0.0} + requiresBuild: true + peerDependencies: + '@babel/core': ^7.10.2 + coffeescript: ^2.5.1 + less: ^3.11.3 || ^4.0.0 + postcss: ^7 || ^8 + postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 + pug: ^3.0.0 + sass: ^1.26.8 + stylus: ^0.55.0 + sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0 + svelte: ^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0 + typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0' + peerDependenciesMeta: + '@babel/core': + optional: true + coffeescript: + optional: true + less: + optional: true + postcss: + optional: true + postcss-load-config: + optional: true + pug: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + typescript: + optional: true + dependencies: + '@types/pug': 2.0.10 + detect-indent: 6.1.0 + magic-string: 0.30.7 + postcss: 8.4.35 + postcss-load-config: 4.0.2(postcss@8.4.35)(ts-node@10.9.2) + sass: 1.71.1 + sorcery: 0.11.0 + strip-indent: 3.0.0 + svelte: 4.2.12 + typescript: 5.6.2 + dev: false + /svelte@4.2.11: resolution: {integrity: sha512-YIQk3J4X89wOLhjsqIW8tqY3JHPuBdtdOIkASP2PZeAMcSW9RsIjQzMesCrxOF3gdWYC0mKknlKF7OqmLM+Zqg==} engines: {node: '>=16'} @@ -27467,7 +27523,7 @@ packages: dev: false file:projects/diffview-resources.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2): - resolution: {integrity: sha512-fi0UUvQTrAAt70IEF8CC7O6h5UfknnXO0xHylpL/Wn7h6oOQHlfPl9VhAx0PJW6TDvw3CltEE35pVSLyDml1CA==, tarball: file:projects/diffview-resources.tgz} + resolution: {integrity: sha512-KZ6MRvsPCXYmTb05Jv0YgDwYMREnlmcyVC06L20SivCexX7nymqt6ul7oKdfu2keE9+qrIJjYtqHxAQUKQ4gFA==, tarball: file:projects/diffview-resources.tgz} id: file:projects/diffview-resources.tgz name: '@rush-temp/diffview-resources' version: 0.0.0 @@ -28170,6 +28226,53 @@ packages: - ts-node dev: false + file:projects/highlight.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2): + resolution: {integrity: sha512-xj/v9VAzl0qNSFarmoAujWSXP28ZkYEnnOBqx55GxBMULn54HimvBalNi/tymMwJV0LUSQbPyJbCY+HHV1tcuQ==, tarball: file:projects/highlight.tgz} + id: file:projects/highlight.tgz + name: '@rush-temp/highlight' + version: 0.0.0 + dependencies: + '@types/jest': 29.5.12 + '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.6.2) + '@typescript-eslint/parser': 6.21.0(eslint@8.56.0)(typescript@5.6.2) + eslint: 8.56.0 + eslint-config-standard-with-typescript: 40.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.56.0)(typescript@5.6.2) + eslint-plugin-import: 2.29.1(eslint@8.56.0) + eslint-plugin-n: 15.7.0(eslint@8.56.0) + eslint-plugin-promise: 6.1.1(eslint@8.56.0) + eslint-plugin-svelte: 2.35.1(eslint@8.56.0)(svelte@4.2.12)(ts-node@10.9.2) + highlight.js: 11.8.0 + jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) + lowlight: 3.1.0 + prettier: 3.2.5 + prettier-plugin-svelte: 3.2.2(prettier@3.2.5)(svelte@4.2.12) + sass: 1.71.1 + svelte: 4.2.12 + svelte-check: 3.6.9(postcss-load-config@4.0.2)(postcss@8.4.35)(sass@1.71.1)(svelte@4.2.12) + svelte-eslint-parser: 0.33.1(svelte@4.2.12) + svelte-loader: 3.2.0(svelte@4.2.12) + svelte-preprocess: 5.1.3(postcss-load-config@4.0.2)(postcss@8.4.35)(sass@1.71.1)(svelte@4.2.12)(typescript@5.6.2) + ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.6.2) + typescript: 5.6.2 + transitivePeerDependencies: + - '@babel/core' + - '@jest/types' + - '@types/node' + - babel-jest + - babel-plugin-macros + - coffeescript + - esbuild + - less + - node-notifier + - postcss + - postcss-load-config + - pug + - stylus + - sugarss + - supports-color + - ts-node + dev: false + file:projects/hr-assets.tgz(esbuild@0.20.1)(ts-node@10.9.2): resolution: {integrity: sha512-NHRl6EHEnHdUWlcw0CbP7m1ZIKiRytNEO0fXtbXW8aREXmUcplLyHsE6lf0f7Y3iDxtPUm0V7DdfKtmzkuMNtA==, tarball: file:projects/hr-assets.tgz} id: file:projects/hr-assets.tgz @@ -28356,7 +28459,7 @@ packages: dev: false file:projects/import-tool.tgz: - resolution: {integrity: sha512-QBo/RgAGnie95pESqQNJUQSCpQi1rEpXqZz1G1zZMfhAvisZtW2XutmaGMS1oDu2ZB05pk8WOO8x6bfdc+keZg==, tarball: file:projects/import-tool.tgz} + resolution: {integrity: sha512-KD9EB2XXo43QYnx8xp4j9z62JGValTBx2uTS4Egw11rsdAoENIxNxI+68CIKASfY8DMKMMuTmUZ6N6nK/6XSiw==, tarball: file:projects/import-tool.tgz} name: '@rush-temp/import-tool' version: 0.0.0 dependencies: @@ -30465,7 +30568,7 @@ packages: dev: false file:projects/notification-resources.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2): - resolution: {integrity: sha512-xpvJbpFBrKB3RPG8SgT9+cJj2IkysBNcl4jQAV69ACUvnTQMh4RS9P31zpaO7CObYXrm9/ImRF0fXbH+AkiJsg==, tarball: file:projects/notification-resources.tgz} + resolution: {integrity: sha512-7qZrSN1845Nti1pousixaoWtM8ISlPYqgw5pK4UtuhEPdrfSq2NkCSSMnl3pOeSU6bVFzAeJ6YlTZs8Jl2wJ7A==, tarball: file:projects/notification-resources.tgz} id: file:projects/notification-resources.tgz name: '@rush-temp/notification-resources' version: 0.0.0 @@ -31360,7 +31463,7 @@ packages: dev: false file:projects/pod-server.tgz(utf-8-validate@6.0.4): - resolution: {integrity: sha512-R0fObVPXSToiK7ioPeEbZ1gZFFjswVFLPCojWYsoNsHg9TL+kTNUdST63PJr4GCr8XVv9VplfYYcEs7qSARvAw==, tarball: file:projects/pod-server.tgz} + resolution: {integrity: sha512-boGyT8HkEJkWqcXXAAZ869HB68/GpHcMTUBZlhkUS9oztHADMfpAbGQ+yVVvypye4e9nsYTF1LhpsDrToOtPYw==, tarball: file:projects/pod-server.tgz} id: file:projects/pod-server.tgz name: '@rush-temp/pod-server' version: 0.0.0 @@ -32804,7 +32907,7 @@ packages: dev: false file:projects/server-ai-bot-resources.tgz(@types/node@20.11.19)(esbuild@0.20.1)(ts-node@10.9.2): - resolution: {integrity: sha512-m+ZYZxCuYOJxhC31c3misAQofis4BG32ek1OPxXXdpOOxPQUFI1WjmwVqJlZDTz3Yt9EXTGv3qkvrNwJuIyWZA==, tarball: file:projects/server-ai-bot-resources.tgz} + resolution: {integrity: sha512-UChmRA0uWxgRKIx9jl1+P4wlGdsdLjsMkR3VOFR3Ya/sYwYV78JOCBIvnsTox/vJha8hx4mynqxaTCSe2nqshA==, tarball: file:projects/server-ai-bot-resources.tgz} id: file:projects/server-ai-bot-resources.tgz name: '@rush-temp/server-ai-bot-resources' version: 0.0.0 @@ -32823,20 +32926,13 @@ packages: ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) typescript: 5.3.3 transitivePeerDependencies: - - '@aws-sdk/credential-providers' - '@babel/core' - '@jest/types' - - '@mongodb-js/zstd' - '@types/node' - babel-jest - babel-plugin-macros - esbuild - - gcp-metadata - - kerberos - - mongodb-client-encryption - node-notifier - - snappy - - socks - supports-color - ts-node dev: false @@ -33152,7 +33248,7 @@ packages: dev: false file:projects/server-client.tgz(bufferutil@4.0.8)(esbuild@0.20.1)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-L1a1mgOD2Qd1S0E6twotWEVeiFeZfvIK5v93gaPH+A5LkkQoOi4qXoEQv/Udul/cDP/MxPFA9HQ3WbdMIn8XYg==, tarball: file:projects/server-client.tgz} + resolution: {integrity: sha512-ixXx7EdCjt/KMKk6pVedAj/27hWqDwCBnHhmTJc694OR8wTEHyIaohP9t8gcjka/ugJRJJjOmAsF1sd8HphW4g==, tarball: file:projects/server-client.tgz} id: file:projects/server-client.tgz name: '@rush-temp/server-client' version: 0.0.0 @@ -35802,7 +35898,7 @@ packages: dev: false file:projects/text-editor-resources.tgz(@types/node@20.11.19)(bufferutil@4.0.8)(esbuild@0.20.1)(highlight.js@11.8.0)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-uffVYh80gs1A2XBETq/xa9TBTeZRZxTMb7sD/mjAvolpsXBd/cPCSKqhytZaoEFqIAFnZ6KfEMUqTlNIki4MoQ==, tarball: file:projects/text-editor-resources.tgz} + resolution: {integrity: sha512-0IJEwSBOHUuSL2q4FSBnhVcfzwK0qOc5KcM7cKXbOM8GO/+WgyGRtKULl1b3LDjuBC21wst3eZY3o03qFIBDIQ==, tarball: file:projects/text-editor-resources.tgz} id: file:projects/text-editor-resources.tgz name: '@rush-temp/text-editor-resources' version: 0.0.0 diff --git a/dev/import-tool/README.md b/dev/import-tool/README.md index b73bfe9ae1..cb0df79d5d 100644 --- a/dev/import-tool/README.md +++ b/dev/import-tool/README.md @@ -1,5 +1,5 @@ ### Supported Import Options -1. **Notion**: see [Import from Notion Guide](./notion/README.md) -2. **ClickUp**: see [Import from ClickUp Guide](./clickup/README.md) +1. **Notion**: see [Import from Notion Guide](./src/notion/README.md) +2. **ClickUp**: see [Import from ClickUp Guide](./src/clickup/README.md) diff --git a/dev/import-tool/src/clickup/clickup.ts b/dev/import-tool/src/clickup/clickup.ts index 191d71e964..f210de84b4 100644 --- a/dev/import-tool/src/clickup/clickup.ts +++ b/dev/import-tool/src/clickup/clickup.ts @@ -62,7 +62,7 @@ interface ImportIssueEx extends ImportIssue { } class ClickupMarkdownPreprocessor implements MarkdownPreprocessor { - private readonly MENTION_REGEX = /@([A-Za-z]+ [A-Za-z]+)/g + private readonly MENTION_REGEX = /@([\p{L}\p{M}]+ [\p{L}\p{M}]+)/gu constructor (private readonly personsByName: Map>) {} process (json: MarkupNode): MarkupNode { diff --git a/models/server-time/src/index.ts b/models/server-time/src/index.ts index 59b0cb3cb0..152eacf9f0 100644 --- a/models/server-time/src/index.ts +++ b/models/server-time/src/index.ts @@ -21,7 +21,7 @@ import { type Resource } from '@hcengineering/platform' import serverCore, { type TriggerControl } from '@hcengineering/server-core' import tracker from '@hcengineering/tracker' import serverTime, { type ToDoFactory, type OnToDo } from '@hcengineering/server-time' -import { type ToDo, type WorkSlot } from '@hcengineering/time' +import time, { type ToDo, type WorkSlot } from '@hcengineering/time' @Mixin(serverTime.mixin.ToDoFactory, core.class.Class) export class TToDoFactory extends TClass implements ToDoFactory { @@ -45,6 +45,7 @@ export function createModel (builder: Builder): void { trigger: serverTime.trigger.OnToDoUpdate, txMatch: { _class: core.class.TxCollectionCUD, + 'tx.objectClass': time.class.ToDo, 'tx._class': core.class.TxUpdateDoc } }) @@ -53,6 +54,7 @@ export function createModel (builder: Builder): void { trigger: serverTime.trigger.OnToDoRemove, txMatch: { _class: core.class.TxCollectionCUD, + 'tx.objectClass': time.class.ToDo, 'tx._class': core.class.TxRemoveDoc } }) @@ -61,6 +63,7 @@ export function createModel (builder: Builder): void { trigger: serverTime.trigger.OnToDoCreate, txMatch: { _class: core.class.TxCollectionCUD, + 'tx.objectClass': time.class.ToDo, 'tx._class': core.class.TxCreateDoc }, isAsync: true @@ -70,10 +73,20 @@ export function createModel (builder: Builder): void { trigger: serverTime.trigger.OnWorkSlotCreate, txMatch: { _class: core.class.TxCollectionCUD, + 'tx.objectClass': time.class.WorkSlot, 'tx._class': core.class.TxCreateDoc } }) + builder.createDoc(serverCore.class.Trigger, core.space.Model, { + trigger: serverTime.trigger.OnWorkSlotUpdate, + txMatch: { + _class: core.class.TxCollectionCUD, + 'tx.objectClass': time.class.WorkSlot, + 'tx._class': core.class.TxUpdateDoc + } + }) + builder.mixin(tracker.class.Issue, core.class.Class, serverTime.mixin.ToDoFactory, { factory: serverTime.function.IssueToDoFactory }) diff --git a/packages/core/src/__tests__/time.test.ts b/packages/core/src/__tests__/time.test.ts new file mode 100644 index 0000000000..a2cd245e57 --- /dev/null +++ b/packages/core/src/__tests__/time.test.ts @@ -0,0 +1,398 @@ +// +// Copyright © 2024 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 { Timestamp } from '../classes' +import { getDay, convertToDay } from '..' + +const supportedTimezones: string[] = [ + 'Europe/Andorra', + 'Asia/Dubai', + 'Asia/Kabul', + 'Europe/Tirane', + 'Asia/Yerevan', + 'Antarctica/Casey', + 'Antarctica/Davis', + 'Antarctica/DumontDUrville', + 'Antarctica/Mawson', + 'Antarctica/Palmer', + 'Antarctica/Rothera', + 'Antarctica/Syowa', + 'Antarctica/Troll', + 'Antarctica/Vostok', + 'America/Argentina/Buenos_Aires', + 'America/Argentina/Cordoba', + 'America/Argentina/Salta', + 'America/Argentina/Jujuy', + 'America/Argentina/Tucuman', + 'America/Argentina/Catamarca', + 'America/Argentina/La_Rioja', + 'America/Argentina/San_Juan', + 'America/Argentina/Mendoza', + 'America/Argentina/San_Luis', + 'America/Argentina/Rio_Gallegos', + 'America/Argentina/Ushuaia', + 'Pacific/Pago_Pago', + 'Europe/Vienna', + 'Australia/Lord_Howe', + 'Antarctica/Macquarie', + 'Australia/Hobart', + 'Australia/Currie', + 'Australia/Melbourne', + 'Australia/Sydney', + 'Australia/Broken_Hill', + 'Australia/Brisbane', + 'Australia/Lindeman', + 'Australia/Adelaide', + 'Australia/Darwin', + 'Australia/Perth', + 'Australia/Eucla', + 'Asia/Baku', + 'America/Barbados', + 'Asia/Dhaka', + 'Europe/Brussels', + 'Europe/Sofia', + 'Atlantic/Bermuda', + 'Asia/Brunei', + 'America/La_Paz', + 'America/Noronha', + 'America/Belem', + 'America/Fortaleza', + 'America/Recife', + 'America/Araguaina', + 'America/Maceio', + 'America/Bahia', + 'America/Sao_Paulo', + 'America/Campo_Grande', + 'America/Cuiaba', + 'America/Santarem', + 'America/Porto_Velho', + 'America/Boa_Vista', + 'America/Manaus', + 'America/Eirunepe', + 'America/Rio_Branco', + 'America/Nassau', + 'Asia/Thimphu', + 'Europe/Minsk', + 'America/Belize', + 'America/St_Johns', + 'America/Halifax', + 'America/Glace_Bay', + 'America/Moncton', + 'America/Goose_Bay', + 'America/Blanc-Sablon', + 'America/Toronto', + 'America/Nipigon', + 'America/Thunder_Bay', + 'America/Iqaluit', + 'America/Pangnirtung', + 'America/Atikokan', + 'America/Winnipeg', + 'America/Rainy_River', + 'America/Resolute', + 'America/Rankin_Inlet', + 'America/Regina', + 'America/Swift_Current', + 'America/Edmonton', + 'America/Cambridge_Bay', + 'America/Yellowknife', + 'America/Inuvik', + 'America/Creston', + 'America/Dawson_Creek', + 'America/Fort_Nelson', + 'America/Vancouver', + 'America/Whitehorse', + 'America/Dawson', + 'Indian/Cocos', + 'Europe/Zurich', + 'Africa/Abidjan', + 'Pacific/Rarotonga', + 'America/Santiago', + 'America/Punta_Arenas', + 'Pacific/Easter', + 'Asia/Shanghai', + 'Asia/Urumqi', + 'America/Bogota', + 'America/Costa_Rica', + 'America/Havana', + 'Atlantic/Cape_Verde', + 'America/Curacao', + 'Indian/Christmas', + 'Asia/Nicosia', + 'Asia/Famagusta', + 'Europe/Prague', + 'Europe/Berlin', + 'Europe/Copenhagen', + 'America/Santo_Domingo', + 'Africa/Algiers', + 'America/Guayaquil', + 'Pacific/Galapagos', + 'Europe/Tallinn', + 'Africa/Cairo', + 'Africa/El_Aaiun', + 'Europe/Madrid', + 'Africa/Ceuta', + 'Atlantic/Canary', + 'Europe/Helsinki', + 'Atlantic/Stanley', + 'Pacific/Chuuk', + 'Pacific/Pohnpei', + 'Atlantic/Faroe', + 'Europe/Paris', + 'Europe/London', + 'Asia/Tbilisi', + 'America/Cayenne', + 'Africa/Accra', + 'Europe/Gibraltar', + 'America/Godthab', + 'America/Danmarkshavn', + 'America/Scoresbysund', + 'America/Thule', + 'Europe/Athens', + 'Atlantic/South_Georgia', + 'America/Guatemala', + 'Pacific/Guam', + 'Africa/Bissau', + 'America/Guyana', + 'Asia/Hong_Kong', + 'America/Tegucigalpa', + 'America/Port-au-Prince', + 'Europe/Budapest', + 'Asia/Jakarta', + 'Asia/Pontianak', + 'Asia/Makassar', + 'Asia/Jayapura', + 'Europe/Dublin', + 'Asia/Jerusalem', + 'Asia/Kolkata', + 'Indian/Chagos', + 'Asia/Baghdad', + 'Asia/Tehran', + 'Atlantic/Reykjavik', + 'Europe/Rome', + 'America/Jamaica', + 'Asia/Amman', + 'Asia/Tokyo', + 'Africa/Nairobi', + 'Asia/Bishkek', + 'Asia/Pyongyang', + 'Asia/Seoul', + 'Asia/Almaty', + 'Asia/Qyzylorda', + 'Asia/Qostanay', + 'Asia/Aqtobe', + 'Asia/Aqtau', + 'Asia/Atyrau', + 'Asia/Oral', + 'Asia/Beirut', + 'Asia/Colombo', + 'Africa/Monrovia', + 'Europe/Vilnius', + 'Europe/Luxembourg', + 'Europe/Riga', + 'Africa/Tripoli', + 'Africa/Casablanca', + 'Europe/Monaco', + 'Europe/Chisinau', + 'Asia/Yangon', + 'Asia/Ulaanbaatar', + 'Asia/Hovd', + 'Asia/Choibalsan', + 'Asia/Macau', + 'America/Martinique', + 'Europe/Malta', + 'Indian/Mauritius', + 'Indian/Maldives', + 'America/Mexico_City', + 'America/Cancun', + 'America/Merida', + 'America/Monterrey', + 'America/Matamoros', + 'America/Mazatlan', + 'America/Chihuahua', + 'America/Ojinaga', + 'America/Hermosillo', + 'America/Tijuana', + 'America/Bahia_Banderas', + 'Asia/Kuala_Lumpur', + 'Asia/Kuching', + 'Africa/Maputo', + 'Africa/Windhoek', + 'Pacific/Noumea', + 'Africa/Lagos', + 'America/Managua', + 'Europe/Amsterdam', + 'Europe/Oslo', + 'Asia/Kathmandu', + 'Pacific/Niue', + 'America/Panama', + 'America/Lima', + 'Pacific/Tahiti', + 'Pacific/Marquesas', + 'Pacific/Gambier', + 'Pacific/Port_Moresby', + 'Pacific/Bougainville', + 'Asia/Manila', + 'Asia/Karachi', + 'Europe/Warsaw', + 'America/Miquelon', + 'Pacific/Pitcairn', + 'America/Puerto_Rico', + 'Asia/Gaza', + 'Asia/Hebron', + 'Europe/Lisbon', + 'Atlantic/Madeira', + 'Atlantic/Azores', + 'Pacific/Palau', + 'America/Asuncion', + 'Asia/Qatar', + 'Indian/Reunion', + 'Europe/Bucharest', + 'Europe/Belgrade', + 'Europe/Kaliningrad', + 'Europe/Moscow', + 'Europe/Simferopol', + 'Europe/Kirov', + 'Europe/Astrakhan', + 'Europe/Volgograd', + 'Europe/Saratov', + 'Europe/Ulyanovsk', + 'Europe/Samara', + 'Asia/Yekaterinburg', + 'Asia/Omsk', + 'Asia/Novosibirsk', + 'Asia/Barnaul', + 'Asia/Tomsk', + 'Asia/Novokuznetsk', + 'Asia/Krasnoyarsk', + 'Asia/Irkutsk', + 'Asia/Chita', + 'Asia/Yakutsk', + 'Asia/Khandyga', + 'Asia/Vladivostok', + 'Asia/Ust-Nera', + 'Asia/Magadan', + 'Asia/Sakhalin', + 'Asia/Srednekolymsk', + 'Asia/Riyadh', + 'Pacific/Guadalcanal', + 'Indian/Mahe', + 'Africa/Khartoum', + 'Europe/Stockholm', + 'Asia/Singapore', + 'America/Paramaribo', + 'Africa/Juba', + 'Africa/Sao_Tome', + 'America/El_Salvador', + 'Asia/Damascus', + 'America/Grand_Turk', + 'Africa/Ndjamena', + 'Indian/Kerguelen', + 'Asia/Bangkok', + 'Asia/Dushanbe', + 'Asia/Dili', + 'Asia/Ashgabat', + 'Africa/Tunis', + 'Europe/Istanbul', + 'America/Port_of_Spain', + 'Asia/Taipei', + 'Europe/Kiev', + 'Europe/Uzhgorod', + 'Europe/Zaporozhye', + 'America/New_York', + 'America/Detroit', + 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello', + 'America/Indiana/Indianapolis', + 'America/Indiana/Vincennes', + 'America/Indiana/Winamac', + 'America/Indiana/Marengo', + 'America/Indiana/Petersburg', + 'America/Indiana/Vevay', + 'America/Chicago', + 'America/Indiana/Tell_City', + 'America/Indiana/Knox', + 'America/Menominee', + 'America/North_Dakota/Center', + 'America/North_Dakota/New_Salem', + 'America/North_Dakota/Beulah', + 'America/Denver', + 'America/Boise', + 'America/Phoenix', + 'America/Los_Angeles', + 'America/Anchorage', + 'America/Juneau', + 'America/Sitka', + 'America/Metlakatla', + 'America/Yakutat', + 'America/Nome', + 'America/Adak', + 'Pacific/Honolulu', + 'America/Montevideo', + 'Asia/Samarkand', + 'Asia/Tashkent', + 'America/Caracas', + 'Asia/Ho_Chi_Minh', + 'Pacific/Efate', + 'Africa/Johannesburg' +] + +function testGetDay (date: Date, timezone: string): void { + const timestamp: Timestamp = getDay(date.getTime()) + const convertedDate: Date = new Date(timestamp) + const originalLocaleDate: string = date.toLocaleDateString('en-US', { timeZone: 'Europe/London' }) + const convertedLocaleDate: string = convertedDate.toLocaleDateString('en-US', { timeZone: timezone }) + expect(convertedLocaleDate).toEqual(originalLocaleDate) +} + +function testConvertToDay (date: Date, timezone: string): void { + const convertedDate: Date = convertToDay(date) + const originalLocaleDate: string = date.toLocaleDateString('en-US', { timeZone: 'Europe/London' }) + const convertedLocaleDate: string = convertedDate.toLocaleDateString('en-US', { timeZone: timezone }) + expect(convertedLocaleDate).toEqual(originalLocaleDate) +} + +describe('time', () => { + it.each(supportedTimezones)('dates are matched in `getDay` for locale %p', (timezone: string) => { + testGetDay(new Date(Date.UTC(1995, 11, 3, 12, 0)), timezone) + testGetDay(new Date(Date.UTC(2025, 0, 23, 55, 0)), timezone) + testGetDay(new Date(Date.UTC(2020, 4, 12, 30, 50)), timezone) + testGetDay(new Date(Date.UTC(2024, 5, 12, 30, 50)), timezone) + testGetDay(new Date(Date.UTC(2024, 7, 0, 0, 0)), timezone) + }) + + it.each(supportedTimezones)('dates are matched in `convertToDay` for locale %p', (timezone: string) => { + testConvertToDay(new Date(Date.UTC(1995, 11, 3, 12, 0)), timezone) + testConvertToDay(new Date(Date.UTC(2025, 0, 23, 55, 0)), timezone) + testConvertToDay(new Date(Date.UTC(2020, 4, 12, 30, 50)), timezone) + testConvertToDay(new Date(Date.UTC(2024, 5, 12, 30, 50)), timezone) + testConvertToDay(new Date(Date.UTC(2024, 7, 0, 0, 0)), timezone) + }) + + it.each([ + [0, 0, 0, 0], + [7, 59, 59, 999], + [12, 0, 0, 0], + [23, 59, 59, 999] + ])( + 'dates are matched for time [h: %p, m: %p, s: %p, ms: %p]', + (hours: number, minutes: number, seconds: number, milliSeconds: number) => { + const date: Date = new Date() + const expectedDay: number = date.getDate() + date.setHours(hours, minutes, seconds, milliSeconds) + const convertedDate: Date = convertToDay(date) + expect(convertedDate.getDate()).toEqual(expectedDay) + } + ) +}) diff --git a/packages/core/src/time.ts b/packages/core/src/time.ts index 5cb82eb0d9..ec6aa7d62c 100644 --- a/packages/core/src/time.ts +++ b/packages/core/src/time.ts @@ -16,8 +16,18 @@ import { Timestamp } from './classes' export function getDay (time: Timestamp): Timestamp { const date: Date = new Date(time) - date.setHours(0, 0, 0, 0) - return date.getTime() + return convertToDay(date).getTime() +} + +export function convertToDay (date: Date): Date { + const originalDay: number = date.getDate() + const convertedDate: Date = new Date(date) + // Set 12 AM UTC time, since it will be the same day in most timezones + convertedDate.setUTCHours(12, 0, 0, 0) + if (convertedDate.getDate() !== originalDay) { + convertedDate.setDate(originalDay) + } + return convertedDate } export function getHour (time: Timestamp): Timestamp { diff --git a/packages/highlight/.eslintrc.js b/packages/highlight/.eslintrc.js new file mode 100644 index 0000000000..bb8fd7450d --- /dev/null +++ b/packages/highlight/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + extends: ['./node_modules/@hcengineering/platform-rig/profiles/ui/eslint.config.json'], + parserOptions: { tsconfigRootDir: __dirname } +} diff --git a/packages/highlight/.prettierrc b/packages/highlight/.prettierrc new file mode 100644 index 0000000000..792942803a --- /dev/null +++ b/packages/highlight/.prettierrc @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "trailingComma": "none", + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "printWidth": 120, + "useTabs": false, + "bracketSpacing": true, + "proseWrap": "preserve", + "plugins": [ + "prettier-plugin-svelte" + ], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] +} \ No newline at end of file diff --git a/packages/highlight/config/rig.json b/packages/highlight/config/rig.json new file mode 100644 index 0000000000..bcad6f7c33 --- /dev/null +++ b/packages/highlight/config/rig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "@hcengineering/platform-rig", + "rigProfile": "ui" +} diff --git a/packages/highlight/jest.config.js b/packages/highlight/jest.config.js new file mode 100644 index 0000000000..2cfd408b67 --- /dev/null +++ b/packages/highlight/jest.config.js @@ -0,0 +1,7 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], + roots: ["./src"], + coverageReporters: ["text-summary", "html"] +} diff --git a/packages/highlight/package.json b/packages/highlight/package.json new file mode 100644 index 0000000000..04e522ef7a --- /dev/null +++ b/packages/highlight/package.json @@ -0,0 +1,46 @@ +{ + "name": "@hcengineering/highlight", + "version": "0.6.0", + "main": "src/index.ts", + "author": "Hardcore Engineering Inc.", + "license": "EPL-2.0", + "scripts": { + "build": "compile ui", + "build:docs": "api-extractor run --local", + "format": "format src", + "svelte-check": "do-svelte-check", + "_phase:svelte-check": "do-svelte-check", + "build:watch": "compile ui", + "_phase:build": "compile ui", + "_phase:format": "format src", + "_phase:validate": "compile validate" + }, + "devDependencies": { + "svelte-loader": "^3.2.0", + "sass": "^1.53.0", + "svelte-preprocess": "^5.1.3", + "@hcengineering/platform-rig": "^0.6.0", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "eslint-config-standard-with-typescript": "^40.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.4.0", + "eslint-plugin-promise": "^6.1.1", + "prettier-plugin-svelte": "^3.2.2", + "eslint": "^8.54.0", + "prettier": "^3.1.0", + "svelte-check": "^3.6.9", + "typescript": "^5.3.3", + "jest": "^29.7.0", + "ts-jest": "^29.1.1", + "@types/jest": "^29.5.5", + "eslint-plugin-svelte": "^2.35.1", + "svelte-eslint-parser": "^0.33.1" + }, + "dependencies": { + "svelte": "^4.2.12", + "@hcengineering/ui": "^0.6.15", + "highlight.js": "~11.8.0", + "lowlight": "^3.1.0" + } +} diff --git a/packages/highlight/postcss.config.js b/packages/highlight/postcss.config.js new file mode 100644 index 0000000000..88752c6cb0 --- /dev/null +++ b/packages/highlight/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} diff --git a/plugins/diffview-resources/src/highlight/highlight.ts b/packages/highlight/src/index.ts similarity index 80% rename from plugins/diffview-resources/src/highlight/highlight.ts rename to packages/highlight/src/index.ts index ea7ff87dd2..87695f55c3 100644 --- a/plugins/diffview-resources/src/highlight/highlight.ts +++ b/packages/highlight/src/index.ts @@ -1,5 +1,5 @@ // -// Copyright © 2023 Hardcore Engineering Inc. +// Copyright © 2024 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 @@ -13,16 +13,29 @@ // limitations under the License. // -import hljs from 'highlight.js' -import { hljsDefineSvelte } from './languages/svelte-hljs' +import hljs, { type LanguageFn } from 'highlight.js' +import { all } from 'lowlight' +import { svelte } from './languages/svelte' +import { vlang } from './languages/vlang' -hljs.registerLanguage('svelte', hljsDefineSvelte) +/** @public */ +export const grammars: Record = { + ...all, + svelte, + vlang +} +Object.entries(grammars).forEach((grammar) => { + hljs.registerLanguage(...grammar) +}) + +/** @public */ export interface HighlightOptions { auto?: boolean language: string | undefined } +/** @public */ export function highlightText (text: string, options: HighlightOptions): string { // We should always use highlighter because it sanitizes the input // We have to always use highlighter to ensure that the input is sanitized @@ -38,6 +51,7 @@ export function highlightText (text: string, options: HighlightOptions): string return normalizeHighlightTags(highlighted) } +/** @public */ export function highlightLines (lines: string[], options: HighlightOptions): string[] { const highlighted = highlightText(lines.join('\n'), options) return highlighted.split('\n') diff --git a/plugins/diffview-resources/src/highlight/languages/svelte-hljs.ts b/packages/highlight/src/languages/svelte.ts similarity index 61% rename from plugins/diffview-resources/src/highlight/languages/svelte-hljs.ts rename to packages/highlight/src/languages/svelte.ts index a47af00f5d..0de570970f 100644 --- a/plugins/diffview-resources/src/highlight/languages/svelte-hljs.ts +++ b/packages/highlight/src/languages/svelte.ts @@ -1,4 +1,19 @@ -export function hljsDefineSvelte (hljs: any): any { +// +// Copyright © 2024 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. +// + +export function svelte (hljs: any): any { return { subLanguage: 'xml', contains: [ diff --git a/packages/highlight/src/languages/vlang.ts b/packages/highlight/src/languages/vlang.ts new file mode 100644 index 0000000000..534d63aa14 --- /dev/null +++ b/packages/highlight/src/languages/vlang.ts @@ -0,0 +1,161 @@ +// +// Copyright © 2024 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. +// + +const LITERALS = ['true', 'false', 'nil'] + +const BUILT_INS = [ + 'close', + 'dump', + 'eprint', + 'eprintln', + 'error', + 'exit', + 'it', + 'panic', + 'print_backtrace', + 'print', + 'println' +] + +const TYPES = [ + 'bool', + 'string', + 'i8', + 'i16', + 'i32', + 'i64', + 'i128', + 'int', + 'u8', + 'u16', + 'u32', + 'u64', + 'u128', + 'rune', + 'f32', + 'f64', + 'isize', + 'usize', + 'voidptr', + 'charptr', + 'byteptr', + 'thread' +] + +const KWS = [ + 'as', + 'asm', + 'assert', + 'atomic', + 'break', + 'const', + 'continue', + 'defer', + 'else', + 'enum', + 'fn', + 'for', + 'go', + 'goto', + 'if', + 'import', + 'in', + 'interface', + 'is', + 'isreftype', + 'lock', + 'match', + 'module', + 'mut', + 'nil', + 'none', + 'or', + 'pub', + 'return', + 'rlock', + 'select', + 'shared', + 'sizeof', + 'spawn', + 'static', + 'struct', + 'type', + 'typeof', + 'union', + 'unsafe', + 'volatile', + '__global', + '__offsetof' +] + +export function vlang (hljs: any): any { + const KEYWORDS = { + keyword: KWS, + type: TYPES, + literal: LITERALS, + built_in: BUILT_INS + } + return { + name: 'V', + aliases: ['vlang'], + keywords: KEYWORDS, + illegal: ' + {@html sanitized} diff --git a/packages/ui/src/components/LinkWrapper.svelte b/packages/ui/src/components/LinkWrapper.svelte index 5abd9a82a1..1694b4de3d 100644 --- a/packages/ui/src/components/LinkWrapper.svelte +++ b/packages/ui/src/components/LinkWrapper.svelte @@ -30,5 +30,6 @@ {#if text} + {@html replaceURLs(text)} {/if} diff --git a/packages/ui/src/components/Separator.svelte b/packages/ui/src/components/Separator.svelte index 613177ce66..7ab8e37f72 100644 --- a/packages/ui/src/components/Separator.svelte +++ b/packages/ui/src/components/Separator.svelte @@ -38,6 +38,8 @@ let sState: SeparatorState $: sState = typeof float === 'string' ? SeparatorState.FLOAT : float ? SeparatorState.HIDDEN : SeparatorState.NORMAL + const checkFullWidth = (): boolean => + sState === SeparatorState.FLOAT && $deviceInfo.isMobile && $deviceInfo.isPortrait const direction: 'horizontal' | 'vertical' = 'horizontal' let separators: SeparatedItem[] | null = null @@ -67,6 +69,10 @@ let disabled: boolean = false let side: 'start' | 'end' | undefined = undefined + $: fs = $deviceInfo.fontSize + const remToPx = (rem: number): number => rem * fs + const pxToRem = (px: number): number => px / fs + const fetchSeparators = (): void => { const res = getSeparators(name, float) if (res !== null && !Array.isArray(res)) panel = res @@ -90,10 +96,6 @@ checkSizes() } - $: fs = $deviceInfo.fontSize - const remToPx = (rem: number): number => rem * fs - const pxToRem = (px: number): number => px / fs - const convertSize = (prop: TSeparatedItem): string => (typeof prop === 'number' ? `${prop}px` : '') const setSize = (element: HTMLElement, size: TSeparatedItem, next: boolean = false): void => { @@ -229,6 +231,12 @@ const checkSizes = (): void => { if (sState === SeparatorState.FLOAT) { + if (checkFullWidth() && panel != null) { + const s = pxToRem(window.innerWidth) + panel.size = s + panel.maxSize = s + panel.minSize = s + } if (parentElement != null && panel != null) initSize(parentElement, panel) } else if (sState === SeparatorState.NORMAL) { if (prevElement != null && prevElSize != null) initSize(prevElement, prevElSize) @@ -442,12 +450,13 @@ } } else if (sState === SeparatorState.FLOAT && parentElement != null) { parentElement.style.pointerEvents = 'all' - saveSeparator(name, float, panel) + if (!checkFullWidth()) saveSeparator(name, float, panel) } document.body.style.cursor = '' } function pointerDown (event: PointerEvent): void { + if (checkFullWidth()) return prepareSeparation(event) document.addEventListener('pointermove', pointerMove) document.addEventListener('pointerup', pointerUp) diff --git a/packages/ui/src/components/calendar/DatePopup.svelte b/packages/ui/src/components/calendar/DatePopup.svelte index d0a3254752..307762d726 100644 --- a/packages/ui/src/components/calendar/DatePopup.svelte +++ b/packages/ui/src/components/calendar/DatePopup.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> -
+
+
{#if room._id !== plugin.ids.Reception} {/if} {/if} -
+
{#if $isConnected} {/if}
+
{#if popup && fullScreen} .bar { + overflow-x: auto; position: relative; padding: 1rem; border-top: 1px solid var(--theme-divider-color); @@ -270,5 +292,9 @@ right: 1rem; height: 100%; } + + &.combinePanel .bar__left-panel { + position: static; + } } diff --git a/plugins/love-resources/src/components/Room.svelte b/plugins/love-resources/src/components/Room.svelte index e1d2bd92d4..93f8f6d093 100644 --- a/plugins/love-resources/src/components/Room.svelte +++ b/plugins/love-resources/src/components/Room.svelte @@ -17,7 +17,7 @@ import { personByIdStore } from '@hcengineering/contact-resources' import { Room as TypeRoom } from '@hcengineering/love' import { getMetadata } from '@hcengineering/platform' - import { Label, Loading, resizeObserver } from '@hcengineering/ui' + import { Label, Loading, resizeObserver, deviceOptionsStore as deviceInfo } from '@hcengineering/ui' import { LocalParticipant, LocalTrackPublication, @@ -333,7 +333,7 @@ $: if (((document.fullscreenElement && !$isFullScreen) || $isFullScreen) && roomEl) toggleFullscreen() -
+
{#if $isConnected && !$isCurrentInstanceConnected}
{#if applications > 0} @@ -71,6 +74,7 @@ config={preference?.config ?? viewlet.config} query={{ space: objectId }} loadingProps={{ length: applications }} + {readonly} /> {:else} @@ -80,9 +84,11 @@ - - + {#if !readonly} + + + {/if} {/if}
diff --git a/plugins/recruit-resources/src/components/VacancyList.svelte b/plugins/recruit-resources/src/components/VacancyList.svelte index 9435189794..58c3c24a34 100644 --- a/plugins/recruit-resources/src/components/VacancyList.svelte +++ b/plugins/recruit-resources/src/components/VacancyList.svelte @@ -72,11 +72,13 @@ {:else} - - - - + {#if !readonly} + + + + + {/if} {/if}
diff --git a/plugins/tags-resources/src/components/Tags.svelte b/plugins/tags-resources/src/components/Tags.svelte index f33a451bf0..eff37b91bd 100644 --- a/plugins/tags-resources/src/components/Tags.svelte +++ b/plugins/tags-resources/src/components/Tags.svelte @@ -22,6 +22,7 @@ export let object: Doc export let _class: Ref> export let key: KeyedAttribute + export let readonly: boolean = false const client = getClient() @@ -56,6 +57,7 @@ addRef(evt.detail)} diff --git a/plugins/tags-resources/src/components/TagsEditor.svelte b/plugins/tags-resources/src/components/TagsEditor.svelte index 65c4e972cc..f4c10e6f76 100644 --- a/plugins/tags-resources/src/components/TagsEditor.svelte +++ b/plugins/tags-resources/src/components/TagsEditor.svelte @@ -46,6 +46,7 @@ export let key: KeyedAttribute export let showTitle = true export let schema: '0' | '3' | '9' = key.attr.schema ?? '0' + export let readonly = false let elements: IdMap = new Map() const elementQuery = createQuery() @@ -113,13 +114,15 @@
{/if} diff --git a/plugins/text-editor-resources/package.json b/plugins/text-editor-resources/package.json index 9fd642347b..e8a021ebb9 100644 --- a/plugins/text-editor-resources/package.json +++ b/plugins/text-editor-resources/package.json @@ -45,6 +45,7 @@ "@hcengineering/analytics": "^0.6.0", "@hcengineering/presentation": "^0.6.3", "@hcengineering/core": "^0.6.32", + "@hcengineering/highlight": "^0.6.0", "@hcengineering/view": "^0.6.13", "@hcengineering/text": "^0.6.5", "@hcengineering/text-editor": "^0.6.0", diff --git a/plugins/text-editor-resources/src/components/extension/codeblock.ts b/plugins/text-editor-resources/src/components/extension/codeblock.ts index e9153f7a1b..377dbed45c 100644 --- a/plugins/text-editor-resources/src/components/extension/codeblock.ts +++ b/plugins/text-editor-resources/src/components/extension/codeblock.ts @@ -13,6 +13,7 @@ // limitations under the License. // +import { grammars } from '@hcengineering/highlight' import { backtickInputRegex, codeBlockOptions, tildeInputRegex } from '@hcengineering/text' import { DropdownLabelsPopup, getEventPositionElement, showPopup } from '@hcengineering/ui' import { isActive, textblockTypeInputRule } from '@tiptap/core' @@ -20,7 +21,7 @@ import { type CodeBlockLowlightOptions, CodeBlockLowlight } from '@tiptap/extens import { type Node as ProseMirrorNode } from '@tiptap/pm/model' import { Plugin, PluginKey } from '@tiptap/pm/state' import { Decoration, DecorationSet, type EditorView } from '@tiptap/pm/view' -import { common, createLowlight } from 'lowlight' +import { createLowlight } from 'lowlight' import { isChangeEditable } from './editable' type Lowlight = ReturnType @@ -31,7 +32,7 @@ const chevronSvg = ` import Play from '../icons/Play.svelte' - import { getPlatformColor, themeStore } from '@hcengineering/ui' + import { Html, getPlatformColor, themeStore } from '@hcengineering/ui' export let href: string const maxWidth = 400 @@ -75,7 +75,7 @@
{:else}
- {@html data.html} +
{/if}
diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 5a05d4788e..24f5ad5b49 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -647,6 +647,18 @@ const checkOnHide = (): void => { if ($deviceInfo.navigator.visible && $deviceInfo.docWidth <= 1024) $deviceInfo.navigator.visible = false } + let oldNavVisible: boolean = $deviceInfo.navigator.visible + let oldASideVisible: boolean = $deviceInfo.aside.visible + $: if (oldNavVisible !== $deviceInfo.navigator.visible || oldASideVisible !== $deviceInfo.aside.visible) { + if ($deviceInfo.isMobile && $deviceInfo.isPortrait && $deviceInfo.navigator.float) { + if ($deviceInfo.navigator.visible && $deviceInfo.aside.visible) { + if (oldNavVisible) $deviceInfo.navigator.visible = false + else $deviceInfo.aside.visible = false + } + } + oldNavVisible = $deviceInfo.navigator.visible + oldASideVisible = $deviceInfo.aside.visible + } $: $deviceInfo.navigator.direction = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'horizontal' : 'vertical' let appsMini: boolean $: appsMini = diff --git a/plugins/workbench-resources/src/components/WorkbenchTabs.svelte b/plugins/workbench-resources/src/components/WorkbenchTabs.svelte index e7c950a24e..6a32f54119 100644 --- a/plugins/workbench-resources/src/components/WorkbenchTabs.svelte +++ b/plugins/workbench-resources/src/components/WorkbenchTabs.svelte @@ -57,23 +57,25 @@
{:else if !mini} - +
{#each $tabsStore as tab (tab._id)} {/each} - +
{:else if selectedTab !== undefined} - + {#if $tabsStore.length > 1} + + {/if} {/if} {#if !popup} | TxUpdateDoc, + currentTx: TxMixin, control: TriggerControl ): Promise | undefined> { const txes = await control.findAll>( @@ -73,7 +73,7 @@ async function getOldDepartment ( async function buildHierarchy (_id: Ref, control: TriggerControl): Promise { const res: Department[] = [] const ancestors = new Map, Ref>() - const departments = await control.findAll(control.ctx, hr.class.Department, {}) + const departments = await control.queryFind(control.ctx, hr.class.Department, {}) for (const department of departments) { if (department._id === hr.ids.Head || department.parent === undefined) continue ancestors.set(department._id, department.parent) @@ -240,20 +240,20 @@ export async function OnEmployee (tx: Tx, control: TriggerControl): Promise { const actualTx = TxProcessor.extractTx(tx) - if (core.class.TxUpdateDoc !== actualTx._class) { + if (core.class.TxMixin !== actualTx._class) { return [] } - const ctx = actualTx as TxUpdateDoc - if (ctx.objectClass !== contact.mixin.Employee || ctx.operations.active !== false) { + const ctx = actualTx as TxMixin + if (ctx.mixin !== contact.mixin.Employee || ctx.attributes.active !== false) { return [] } const targetAccount = control.modelDb.getAccountByPersonId(ctx.objectId) as PersonAccount[] if (targetAccount.length === 0) return [] - const lastDepartment = await getOldDepartment(ctx, control) - if (lastDepartment === undefined) return [] + const set = new Set(targetAccount.map((it) => it._id)) - const removed = await buildHierarchy(lastDepartment, control) + const departments = await control.queryFind(control.ctx, hr.class.Department, {}) + const removed = departments.filter((dep) => dep.members.some((p) => set.has(p))) return getTxes( control.txFactory, targetAccount.map((it) => it._id), diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index 643070dfa6..9145bb9588 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -607,6 +607,8 @@ export async function createPushNotification ( } } +const errorMessages = ['expired', 'Unregistered', 'No such subscription'] + async function sendPushToSubscription ( control: TriggerControl, targetUser: Ref, @@ -617,9 +619,11 @@ async function sendPushToSubscription ( await webpush.sendNotification(subscription, JSON.stringify(data)) } catch (err) { control.ctx.info('Cannot send push notification to', { user: targetUser, err }) - if (err instanceof WebPushError && err.body.includes('expired')) { - const tx = control.txFactory.createTxRemoveDoc(subscription._class, subscription.space, subscription._id) - await control.apply(control.ctx, [tx]) + if (err instanceof WebPushError) { + if (errorMessages.some((p) => (err as WebPushError).body.includes(p))) { + const tx = control.txFactory.createTxRemoveDoc(subscription._class, subscription.space, subscription._id) + await control.apply(control.ctx, [tx]) + } } } } diff --git a/server-plugins/recruit-resources/src/index.ts b/server-plugins/recruit-resources/src/index.ts index beed747c1b..b7dd1bef11 100644 --- a/server-plugins/recruit-resources/src/index.ts +++ b/server-plugins/recruit-resources/src/index.ts @@ -85,20 +85,19 @@ export async function applicationTextPresenter (doc: Doc, control: TriggerContro * @public */ export async function OnRecruitUpdate (tx: Tx, control: TriggerControl): Promise { - const actualTx = TxProcessor.extractTx(tx) - const cud = actualTx as TxCUD - if (!control.hierarchy.isDerived(cud.objectClass, recruit.class.Vacancy)) { + const actualTx = TxProcessor.extractTx(tx) as TxCUD + if (!control.hierarchy.isDerived(actualTx.objectClass, recruit.class.Vacancy)) { return [] } const res: Tx[] = [] if (actualTx._class === core.class.TxCreateDoc) { - handleVacancyCreate(control, cud, actualTx, res) + handleVacancyCreate(control, actualTx, res) } else if (actualTx._class === core.class.TxUpdateDoc) { - await handleVacancyUpdate(control, cud, res) + await handleVacancyUpdate(control, actualTx, res) } else if (actualTx._class === core.class.TxRemoveDoc) { - await handleVacancyRemove(control, cud, actualTx) + handleVacancyRemove(control, actualTx, res) } return res } @@ -156,16 +155,13 @@ async function handleVacancyUpdate (control: TriggerControl, cud: TxCUD, re } } -async function handleVacancyRemove (control: TriggerControl, cud: TxCUD, actualTx: Tx): Promise { - const removeTx = actualTx as TxRemoveDoc +function handleVacancyRemove (control: TriggerControl, cud: TxCUD, res: Tx[]): void { + const removeTx = cud as TxRemoveDoc // It could be null or new value - const txes = ( - await control.findAll(control.ctx, core.class.TxCUD, { - objectId: removeTx.objectId - }) - ).filter((it) => it._id !== removeTx._id) - const vacancy = TxProcessor.buildDoc2Doc(txes) as Vacancy - const res: Tx[] = [] + const vacancy = control.removedMap.get(removeTx.objectId) as Vacancy + if (vacancy === undefined) { + return + } if (vacancy.company != null) { // We have old value res.push( @@ -182,8 +178,8 @@ async function handleVacancyRemove (control: TriggerControl, cud: TxCUD, ac } } -function handleVacancyCreate (control: TriggerControl, cud: TxCUD, actualTx: Tx, res: Tx[]): void { - const createTx = actualTx as TxCreateDoc +function handleVacancyCreate (control: TriggerControl, cud: TxCUD, res: Tx[]): void { + const createTx = cud as TxCreateDoc const vacancy = TxProcessor.createDoc2Doc(createTx) if (vacancy.company !== undefined) { res.push( diff --git a/server-plugins/time-resources/src/index.ts b/server-plugins/time-resources/src/index.ts index 20948b8c9e..49941a34e7 100644 --- a/server-plugins/time-resources/src/index.ts +++ b/server-plugins/time-resources/src/index.ts @@ -69,6 +69,21 @@ export async function OnTask (tx: Tx, control: TriggerControl): Promise { return [] } +export async function OnWorkSlotUpdate (tx: Tx, control: TriggerControl): Promise { + const actualTx = TxProcessor.extractTx(tx) as TxCUD + if (!control.hierarchy.isDerived(actualTx.objectClass, time.class.WorkSlot)) return [] + if (!control.hierarchy.isDerived(actualTx._class, core.class.TxUpdateDoc)) return [] + const updTx = actualTx as TxUpdateDoc + const visibility = updTx.operations.visibility + if (visibility !== undefined) { + const workslot = (await control.findAll(control.ctx, time.class.WorkSlot, { _id: updTx.objectId }, { limit: 1 }))[0] + if (workslot === undefined) return [] + const todo = (await control.findAll(control.ctx, time.class.ToDo, { _id: workslot.attachedTo }))[0] + return [control.txFactory.createTxUpdateDoc(todo._class, todo.space, todo._id, { visibility })] + } + return [] +} + export async function OnWorkSlotCreate (tx: Tx, control: TriggerControl): Promise { const actualTx = TxProcessor.extractTx(tx) as TxCUD if (!control.hierarchy.isDerived(actualTx.objectClass, time.class.WorkSlot)) return [] @@ -578,6 +593,22 @@ async function changeIssueStatusHandler ( } } } + } else if (status.category === task.statusCategory.Won || status.category === task.statusCategory.Lost) { + const issue = (await control.findAll(control.ctx, tracker.class.Issue, { _id: issueId }))[0] + if (issue !== undefined) { + const todos = await control.findAll(control.ctx, time.class.ToDo, { + attachedTo: issue._id, + doneOn: null + }) + const res: Tx[] = [] + const now = Date.now() + for (const todo of todos) { + if (todo.doneOn == null) { + res.push(control.txFactory.createTxUpdateDoc(todo._class, todo.space, todo._id, { doneOn: now })) + } + } + return res + } } return [] } @@ -648,6 +679,7 @@ export default async () => ({ OnToDoUpdate, OnToDoRemove, OnToDoCreate, - OnWorkSlotCreate + OnWorkSlotCreate, + OnWorkSlotUpdate } }) diff --git a/server-plugins/time/src/index.ts b/server-plugins/time/src/index.ts index fbe77ec547..f6a2878bcd 100644 --- a/server-plugins/time/src/index.ts +++ b/server-plugins/time/src/index.ts @@ -56,6 +56,7 @@ export default plugin(serverTimeId, { OnToDoUpdate: '' as Resource, OnToDoRemove: '' as Resource, OnToDoCreate: '' as Resource, - OnWorkSlotCreate: '' as Resource + OnWorkSlotCreate: '' as Resource, + OnWorkSlotUpdate: '' as Resource } }) diff --git a/server-plugins/view-resources/src/index.ts b/server-plugins/view-resources/src/index.ts index 25d2a0f5bf..10267a751f 100644 --- a/server-plugins/view-resources/src/index.ts +++ b/server-plugins/view-resources/src/index.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import core, { AnyAttribute, Hierarchy, Tx, TxCUD, TxProcessor, TxRemoveDoc } from '@hcengineering/core' +import core, { AnyAttribute, Hierarchy, Tx, TxRemoveDoc } from '@hcengineering/core' import type { TriggerControl } from '@hcengineering/server-core' import view from '@hcengineering/view' @@ -24,8 +24,7 @@ export async function OnCustomAttributeRemove (tx: Tx, control: TriggerControl): const hierarchy = control.hierarchy const ptx = tx as TxRemoveDoc if (!checkTx(ptx, hierarchy)) return [] - const txes = await control.findAll>(control.ctx, core.class.TxCUD, { objectId: ptx.objectId }) - const attribute = TxProcessor.buildDoc2Doc(txes) + const attribute = control.removedMap.get(ptx.objectId) as AnyAttribute if (attribute === undefined) return [] const preferences = await control.findAll(control.ctx, view.class.ViewletPreference, { config: attribute.name, diff --git a/server/front/src/index.ts b/server/front/src/index.ts index 422bc31d80..493c620dbe 100644 --- a/server/front/src/index.ts +++ b/server/front/src/index.ts @@ -35,7 +35,7 @@ import fs, { createReadStream, mkdtempSync } from 'fs' import { rm, writeFile } from 'fs/promises' import { tmpdir } from 'os' -const cacheControlValue = 'public, max-age=365d' +const cacheControlValue = 'public, no-cache, must-revalidate, max-age=365d' const cacheControlNoCache = 'public, no-store, no-cache, must-revalidate, max-age=0' async function storageUpload ( @@ -385,14 +385,14 @@ export function start ( 'handle-file', {}, async (ctx) => { - let payload: Token = { email: 'guest', workspace: { name: req.query.workspace as string } } try { const cookies = ((req?.headers?.cookie as string) ?? '').split(';').map((it) => it.trim().split('=')) const token = cookies.find((it) => it[0] === 'presentation-metadata-Token')?.[1] ?? - (req.query.token as string | undefined) - payload = token !== undefined ? decodeToken(token) : payload + (req.query.token as string | undefined) ?? + '' + const payload = decodeToken(token) const uuid = req.params.file ?? req.query.file if (uuid === undefined) { @@ -412,20 +412,6 @@ export function start ( return } - // try image and octet streams - const isImage = - blobInfo.contentType.includes('image/') || blobInfo.contentType.includes('application/octet-stream') - - if (token === undefined) { - if (blobInfo !== undefined && !isImage) { - // Do not allow to return non images with no token. - if (token === undefined) { - res.status(403).send() - return - } - } - } - if (req.method === 'HEAD') { res.writeHead(200, { 'accept-ranges': 'bytes', @@ -438,6 +424,9 @@ export function start ( res.end() return } + // try image and octet streams + const isImage = + blobInfo.contentType.includes('image/') || blobInfo.contentType.includes('application/octet-stream') const size = req.query.size !== undefined ? parseInt(req.query.size as string) : undefined const accept = req.headers.accept @@ -475,9 +464,7 @@ export function start ( error?.Code === 'NoSuchKey' ) { ctx.error('No such storage key', { - file: req.query.file, - workspace: payload?.workspace, - email: payload?.email + file: req.query.file }) res.status(404).send() return diff --git a/server/postgres/migrations/allSchema.sql b/server/postgres/migrations/allSchema.sql new file mode 100644 index 0000000000..03ef74e920 --- /dev/null +++ b/server/postgres/migrations/allSchema.sql @@ -0,0 +1,37 @@ +DO $$ +DECLARE + tbl_name text; + hash_col_not_exists boolean; + data_col_exists boolean; +BEGIN + FOR tbl_name IN + SELECT table_name + FROM information_schema.tables + WHERE table_schema = 'public' + AND table_type = 'BASE TABLE' + LOOP + EXECUTE format(' + SELECT EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = %L + AND column_name = ''data'' + AND data_type = ''jsonb'' + );', tbl_name) INTO data_col_exists; + + EXECUTE format(' + SELECT NOT EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = %L + AND column_name = ''"%%hash%%"'' + );', tbl_name) INTO hash_col_not_exists; + + IF data_col_exists AND hash_col_not_exists THEN + EXECUTE format(' + ALTER TABLE %I ADD COLUMN "%%hash%%" text;', tbl_name); + EXECUTE format(' + UPDATE %I SET "%%hash%%" = data->>''%%data%%'';', tbl_name); + END IF; + END LOOP; +END $$; \ No newline at end of file diff --git a/server/postgres/migrations/dncSchema.sql b/server/postgres/migrations/dncSchema.sql new file mode 100644 index 0000000000..0405e31699 --- /dev/null +++ b/server/postgres/migrations/dncSchema.sql @@ -0,0 +1,25 @@ +ALTER TABLE notification_dnc +ADD "objectId" text, +ADD "objectClass" text, +ADD "user" text; + +ALTER TABLE notification_dnc +DROP COLUMN "attachedTo"; + +UPDATE notification_dnc +SET "objectId" = (data->>'objectId'); + +UPDATE notification_dnc +SET "objectClass" = (data->>'objectClass'); + +UPDATE notification_dnc +SET "user" = (data->>'user'); + +ALTER TABLE notification_dnc +ALTER COLUMN "objectId" SET NOT NULL; + +ALTER TABLE notification_dnc +ALTER COLUMN "objectClass" SET NOT NULL; + +ALTER TABLE notification_dnc +ALTER COLUMN "user" SET NOT NULL; \ No newline at end of file diff --git a/server/postgres/migrations/docIndexStateSchema.sql b/server/postgres/migrations/docIndexStateSchema.sql new file mode 100644 index 0000000000..06ccb44898 --- /dev/null +++ b/server/postgres/migrations/docIndexStateSchema.sql @@ -0,0 +1,11 @@ +ALTER TABLE doc_index_state +ADD "needIndex" bool; + +ALTER TABLE doc_index_state +DROP COLUMN "attachedTo"; + +UPDATE doc_index_state +SET "needIndex" = (data->>'needIndex')::boolean; + +ALTER TABLE doc_index_state +ALTER COLUMN "needIndex" SET NOT NULL; \ No newline at end of file diff --git a/server/postgres/migrations/notificationSchema.sql b/server/postgres/migrations/notificationSchema.sql new file mode 100644 index 0000000000..8bd87d53a9 --- /dev/null +++ b/server/postgres/migrations/notificationSchema.sql @@ -0,0 +1,25 @@ +ALTER TABLE notification +ADD "isViewed" bool, +ADD archived bool, +ADD "user" text; + +ALTER TABLE notification +DROP COLUMN "attachedTo"; + +UPDATE notification +SET "isViewed" = (data->>'isViewed')::boolean; + +UPDATE notification +SET "archived" = (data->>'archived')::boolean; + +UPDATE notification +SET "user" = (data->>'user'); + +ALTER TABLE notification +ALTER COLUMN "isViewed" SET NOT NULL; + +ALTER TABLE notification +ALTER COLUMN archived SET NOT NULL; + +ALTER TABLE notification +ALTER COLUMN "user" SET NOT NULL; \ No newline at end of file diff --git a/server/postgres/migrations/txSchema.sql b/server/postgres/migrations/txSchema.sql new file mode 100644 index 0000000000..8c93d6f35d --- /dev/null +++ b/server/postgres/migrations/txSchema.sql @@ -0,0 +1,15 @@ +ALTER TABLE tx +ADD "objectSpace" text, +ADD "objectId" text; + +ALTER TABLE tx +DROP COLUMN "attachedTo"; + +UPDATE tx +SET "objectId" = (data->>'objectId'); + +UPDATE tx +SET "objectSpace" = (data->>'objectSpace'); + +ALTER TABLE tx +ALTER COLUMN "objectSpace" SET NOT NULL; \ No newline at end of file diff --git a/server/postgres/migrations/uncSchema.sql b/server/postgres/migrations/uncSchema.sql new file mode 100644 index 0000000000..125304c879 --- /dev/null +++ b/server/postgres/migrations/uncSchema.sql @@ -0,0 +1,11 @@ +ALTER TABLE notification_user +ADD "user" text; + +ALTER TABLE notification_user +DROP COLUMN "attachedTo"; + +UPDATE notification_user +SET "user" = (data->>'user'); + +ALTER TABLE notification_user +ALTER COLUMN "user" SET NOT NULL; \ No newline at end of file diff --git a/server/postgres/src/index.ts b/server/postgres/src/index.ts index 12dce9b0eb..faa3c82c2c 100644 --- a/server/postgres/src/index.ts +++ b/server/postgres/src/index.ts @@ -14,4 +14,5 @@ // export * from './storage' -export { getDBClient, convertDoc, createTable, retryTxn, translateDomain, getDocFieldsByDomains } from './utils' +export { getDBClient, convertDoc, createTable, retryTxn } from './utils' +export { getDocFieldsByDomains, translateDomain } from './schemas' diff --git a/server/postgres/src/schemas.ts b/server/postgres/src/schemas.ts index 9215cd65f6..1c866ec4c4 100644 --- a/server/postgres/src/schemas.ts +++ b/server/postgres/src/schemas.ts @@ -1,10 +1,10 @@ -import { DOMAIN_SPACE } from '@hcengineering/core' +import { DOMAIN_DOC_INDEX_STATE, DOMAIN_SPACE, DOMAIN_TX } from '@hcengineering/core' type DataType = 'bigint' | 'bool' | 'text' | 'text[]' type Schema = Record -export const defaultSchema: Schema = { +const baseSchema: Schema = { _id: ['text', true], _class: ['text', true], space: ['text', true], @@ -12,25 +12,68 @@ export const defaultSchema: Schema = { createdBy: ['text', false], modifiedOn: ['bigint', true], createdOn: ['bigint', false], + '%hash%': ['text', false] +} + +const defaultSchema: Schema = { + ...baseSchema, attachedTo: ['text', false] } -export const spaceSchema: Schema = { - _id: ['text', true], - _class: ['text', true], - space: ['text', true], - modifiedBy: ['text', true], - createdBy: ['text', false], - modifiedOn: ['bigint', true], - createdOn: ['bigint', false], +const spaceSchema: Schema = { + ...baseSchema, private: ['bool', true], members: ['text[]', true] } +const txSchema: Schema = { + ...baseSchema, + objectSpace: ['text', true], + objectId: ['text', false] +} + +const notificationSchema: Schema = { + ...baseSchema, + isViewed: ['bool', true], + archived: ['bool', true], + user: ['text', true] +} + +const dncSchema: Schema = { + ...baseSchema, + objectId: ['text', true], + objectClass: ['text', true], + user: ['text', true] +} + +const userNotificationSchema: Schema = { + ...baseSchema, + user: ['text', true] +} + +const docIndexStateSchema: Schema = { + ...baseSchema, + needIndex: ['bool', true] +} + +export function translateDomain (domain: string): string { + return domain.replaceAll('-', '_') +} + export const domainSchemas: Record = { - [DOMAIN_SPACE]: spaceSchema + [DOMAIN_SPACE]: spaceSchema, + [DOMAIN_TX]: txSchema, + [translateDomain(DOMAIN_DOC_INDEX_STATE)]: docIndexStateSchema, + notification: notificationSchema, + [translateDomain('notification-dnc')]: dncSchema, + [translateDomain('notification-user')]: userNotificationSchema } export function getSchema (domain: string): Schema { - return domainSchemas[domain] ?? defaultSchema + return domainSchemas[translateDomain(domain)] ?? defaultSchema +} + +export function getDocFieldsByDomains (domain: string): string[] { + const schema = domainSchemas[translateDomain(domain)] ?? defaultSchema + return Object.keys(schema) } diff --git a/server/postgres/src/storage.ts b/server/postgres/src/storage.ts index 89935257ed..9e72e4bb06 100644 --- a/server/postgres/src/storage.ts +++ b/server/postgres/src/storage.ts @@ -74,7 +74,6 @@ import { type DBDoc, escapeBackticks, getDBClient, - getDocFieldsByDomains, inferType, isDataField, isOwner, @@ -82,9 +81,9 @@ import { parseDoc, parseDocWithProjection, parseUpdate, - type PostgresClientReference, - translateDomain + type PostgresClientReference } from './utils' +import { getDocFieldsByDomains, translateDomain } from './schemas' abstract class PostgresAdapterBase implements DbAdapter { protected readonly _helper: DBCollectionHelper @@ -1550,7 +1549,7 @@ class PostgresTxAdapter extends PostgresAdapterBase implements TxAdapter { async getModel (ctx: MeasureContext): Promise { const res = await this - .client`SELECT * FROM ${this.client(translateDomain(DOMAIN_TX))} WHERE "workspaceId" = ${this.workspaceId.name} AND data->>'objectSpace' = ${core.space.Model} ORDER BY _id ASC, "modifiedOn" ASC` + .client`SELECT * FROM ${this.client(translateDomain(DOMAIN_TX))} WHERE "workspaceId" = ${this.workspaceId.name} AND "objectSpace" = ${core.space.Model} ORDER BY _id ASC, "modifiedOn" ASC` const model = res.map((p) => parseDoc(p as any)) // We need to put all core.account.System transactions first diff --git a/server/postgres/src/utils.ts b/server/postgres/src/utils.ts index fc0b04a9d6..fd031066f1 100644 --- a/server/postgres/src/utils.ts +++ b/server/postgres/src/utils.ts @@ -30,7 +30,7 @@ import core, { import { PlatformError, unknownStatus } from '@hcengineering/platform' import { type DomainHelperOperations } from '@hcengineering/server-core' import postgres from 'postgres' -import { defaultSchema, domainSchemas, getSchema } from './schemas' +import { getDocFieldsByDomains, getSchema, translateDomain } from './schemas' const connections = new Map() @@ -329,10 +329,6 @@ export class DBCollectionHelper implements DomainHelperOperations { } } -export function translateDomain (domain: string): string { - return domain.replaceAll('-', '_') -} - export function parseDocWithProjection (doc: DBDoc, projection: Projection | undefined): T { const { workspaceId, data, ...rest } = doc for (const key in rest) { @@ -397,11 +393,6 @@ export function isDataField (domain: string, field: string): boolean { return !getDocFieldsByDomains(domain).includes(field) } -export function getDocFieldsByDomains (domain: string): string[] { - const schema = domainSchemas[domain] ?? defaultSchema - return Object.keys(schema) -} - export interface JoinProps { table: string // table to join path: string // _id.roles, attachedTo.attachedTo, space... diff --git a/server/tool/src/index.ts b/server/tool/src/index.ts index 46c29b60ce..b2220d83e0 100644 --- a/server/tool/src/index.ts +++ b/server/tool/src/index.ts @@ -33,7 +33,6 @@ import core, { WorkspaceId, WorkspaceIdWithUrl, type Client, - type Doc, type Ref, type WithLookup } from '@hcengineering/core' @@ -112,15 +111,16 @@ export async function initModel ( try { logger.log('creating database...', workspaceId) - await adapter.upload(ctx, DOMAIN_TX, [ - { - _class: core.class.Tx, - _id: 'first-tx' as Ref, - modifiedBy: core.account.System, - modifiedOn: Date.now(), - space: core.space.DerivedTx - } - ]) + const firstTx: Tx = { + _class: core.class.Tx, + _id: 'first-tx' as Ref, + modifiedBy: core.account.System, + modifiedOn: Date.now(), + space: core.space.DerivedTx, + objectSpace: core.space.DerivedTx + } + + await adapter.upload(ctx, DOMAIN_TX, [firstTx]) await progress(30) diff --git a/tests/restore-workspace.sh b/tests/restore-workspace.sh index 05c494a8d8..59cbcd3d74 100755 --- a/tests/restore-workspace.sh +++ b/tests/restore-workspace.sh @@ -3,7 +3,7 @@ # Restore workspace contents in mongo/elastic ./tool.sh backup-restore ./sanity-ws sanity-ws -./tool.sh upgrade-workspace sanity-ws --indexes +./tool.sh upgrade-workspace sanity-ws --indexes --force # Re-assign user to workspace. ./tool.sh assign-workspace user1 sanity-ws diff --git a/tests/sanity-ws/000001/_migrations-1730472769365-0.snp.gz b/tests/sanity-ws/000001/_migrations-1730472769365-0.snp.gz new file mode 100644 index 0000000000..28f5aca43d Binary files /dev/null and b/tests/sanity-ws/000001/_migrations-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/_migrations-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/_migrations-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..ad44ebea4c Binary files /dev/null and b/tests/sanity-ws/000001/_migrations-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/activity-1729588583864-0.snp.gz b/tests/sanity-ws/000001/activity-1729588583864-0.snp.gz deleted file mode 100644 index b6f0ce426d..0000000000 Binary files a/tests/sanity-ws/000001/activity-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/activity-1730472769365-0.snp.gz b/tests/sanity-ws/000001/activity-1730472769365-0.snp.gz new file mode 100644 index 0000000000..d354c1c212 Binary files /dev/null and b/tests/sanity-ws/000001/activity-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/activity-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/activity-data-1729588583864-1.tar.gz deleted file mode 100644 index 1fd7b0103c..0000000000 Binary files a/tests/sanity-ws/000001/activity-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/activity-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/activity-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..7d7bf1a7c8 Binary files /dev/null and b/tests/sanity-ws/000001/activity-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/attachment-1729588583864-0.snp.gz b/tests/sanity-ws/000001/attachment-1730472769365-0.snp.gz similarity index 100% rename from tests/sanity-ws/000001/attachment-1729588583864-0.snp.gz rename to tests/sanity-ws/000001/attachment-1730472769365-0.snp.gz diff --git a/tests/sanity-ws/000001/attachment-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/attachment-data-1729588583864-1.tar.gz deleted file mode 100644 index e41b2d7085..0000000000 Binary files a/tests/sanity-ws/000001/attachment-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/attachment-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/attachment-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..76570a9f35 Binary files /dev/null and b/tests/sanity-ws/000001/attachment-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/blob-1729588583864-0.snp.gz b/tests/sanity-ws/000001/blob-1729588583864-0.snp.gz deleted file mode 100644 index d99682fe5c..0000000000 Binary files a/tests/sanity-ws/000001/blob-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/blob-1730472769365-0.snp.gz b/tests/sanity-ws/000001/blob-1730472769365-0.snp.gz new file mode 100644 index 0000000000..12e6feba46 Binary files /dev/null and b/tests/sanity-ws/000001/blob-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/blob-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/blob-data-1729588583864-1.tar.gz deleted file mode 100644 index 6aa1922190..0000000000 Binary files a/tests/sanity-ws/000001/blob-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/blob-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/blob-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..d88d61cd4b Binary files /dev/null and b/tests/sanity-ws/000001/blob-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/calendar-1730472769365-0.snp.gz b/tests/sanity-ws/000001/calendar-1730472769365-0.snp.gz new file mode 100644 index 0000000000..5895b7a13f Binary files /dev/null and b/tests/sanity-ws/000001/calendar-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/calendar-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/calendar-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..fa13e5860b Binary files /dev/null and b/tests/sanity-ws/000001/calendar-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/channel-1729588583864-0.snp.gz b/tests/sanity-ws/000001/channel-1730472769365-0.snp.gz similarity index 100% rename from tests/sanity-ws/000001/channel-1729588583864-0.snp.gz rename to tests/sanity-ws/000001/channel-1730472769365-0.snp.gz diff --git a/tests/sanity-ws/000001/channel-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/channel-data-1729588583864-1.tar.gz deleted file mode 100644 index 83bf9cd342..0000000000 Binary files a/tests/sanity-ws/000001/channel-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/channel-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/channel-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..35595d9ce5 Binary files /dev/null and b/tests/sanity-ws/000001/channel-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/chunter-1729588583864-0.snp.gz b/tests/sanity-ws/000001/chunter-1729588583864-0.snp.gz deleted file mode 100644 index 28f06f9e43..0000000000 Binary files a/tests/sanity-ws/000001/chunter-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/chunter-1730472769365-0.snp.gz b/tests/sanity-ws/000001/chunter-1730472769365-0.snp.gz new file mode 100644 index 0000000000..763c12b5cd Binary files /dev/null and b/tests/sanity-ws/000001/chunter-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/chunter-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/chunter-data-1729588583864-1.tar.gz deleted file mode 100644 index 3851f2b1b3..0000000000 Binary files a/tests/sanity-ws/000001/chunter-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/chunter-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/chunter-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..ba510a753e Binary files /dev/null and b/tests/sanity-ws/000001/chunter-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/contact-1729588583864-0.snp.gz b/tests/sanity-ws/000001/contact-1729588583864-0.snp.gz deleted file mode 100644 index 61d3188be9..0000000000 Binary files a/tests/sanity-ws/000001/contact-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/contact-1730472769365-0.snp.gz b/tests/sanity-ws/000001/contact-1730472769365-0.snp.gz new file mode 100644 index 0000000000..385e169f5e Binary files /dev/null and b/tests/sanity-ws/000001/contact-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/contact-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/contact-data-1729588583864-1.tar.gz deleted file mode 100644 index e43f838af6..0000000000 Binary files a/tests/sanity-ws/000001/contact-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/contact-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/contact-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..c489c75447 Binary files /dev/null and b/tests/sanity-ws/000001/contact-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/doc-index-state-1729588583864-0.snp.gz b/tests/sanity-ws/000001/doc-index-state-1729588583864-0.snp.gz deleted file mode 100644 index deded16d78..0000000000 Binary files a/tests/sanity-ws/000001/doc-index-state-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/doc-index-state-1730472769365-0.snp.gz b/tests/sanity-ws/000001/doc-index-state-1730472769365-0.snp.gz new file mode 100644 index 0000000000..c8942d64c2 Binary files /dev/null and b/tests/sanity-ws/000001/doc-index-state-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/doc-index-state-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/doc-index-state-data-1729588583864-1.tar.gz deleted file mode 100644 index cee19fa486..0000000000 Binary files a/tests/sanity-ws/000001/doc-index-state-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/doc-index-state-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/doc-index-state-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..032ce940b9 Binary files /dev/null and b/tests/sanity-ws/000001/doc-index-state-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/documents-1730472769365-0.snp.gz b/tests/sanity-ws/000001/documents-1730472769365-0.snp.gz new file mode 100644 index 0000000000..cbb0ea7b9e Binary files /dev/null and b/tests/sanity-ws/000001/documents-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/documents-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/documents-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..f99d967c01 Binary files /dev/null and b/tests/sanity-ws/000001/documents-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/hr-1730472769365-0.snp.gz b/tests/sanity-ws/000001/hr-1730472769365-0.snp.gz new file mode 100644 index 0000000000..f2ec9726df Binary files /dev/null and b/tests/sanity-ws/000001/hr-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/hr-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/hr-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..e4a3108d56 Binary files /dev/null and b/tests/sanity-ws/000001/hr-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/inventory-1729588583864-0.snp.gz b/tests/sanity-ws/000001/inventory-1729588583864-0.snp.gz deleted file mode 100644 index 98c2745906..0000000000 Binary files a/tests/sanity-ws/000001/inventory-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/inventory-1730472769365-0.snp.gz b/tests/sanity-ws/000001/inventory-1730472769365-0.snp.gz new file mode 100644 index 0000000000..915ae1a184 Binary files /dev/null and b/tests/sanity-ws/000001/inventory-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/inventory-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/inventory-data-1729588583864-1.tar.gz deleted file mode 100644 index f2585594b4..0000000000 Binary files a/tests/sanity-ws/000001/inventory-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/inventory-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/inventory-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..d7b573de58 Binary files /dev/null and b/tests/sanity-ws/000001/inventory-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/kanban-1729588583864-0.snp.gz b/tests/sanity-ws/000001/kanban-1729588583864-0.snp.gz deleted file mode 100644 index 7a80797f49..0000000000 Binary files a/tests/sanity-ws/000001/kanban-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/kanban-1730472769365-0.snp.gz b/tests/sanity-ws/000001/kanban-1730472769365-0.snp.gz new file mode 100644 index 0000000000..053935dcbb Binary files /dev/null and b/tests/sanity-ws/000001/kanban-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/kanban-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/kanban-data-1729588583864-1.tar.gz deleted file mode 100644 index 82dd03b8be..0000000000 Binary files a/tests/sanity-ws/000001/kanban-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/kanban-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/kanban-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..ad2aa67ba1 Binary files /dev/null and b/tests/sanity-ws/000001/kanban-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/love-1730472769365-0.snp.gz b/tests/sanity-ws/000001/love-1730472769365-0.snp.gz new file mode 100644 index 0000000000..6208b2980e Binary files /dev/null and b/tests/sanity-ws/000001/love-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/love-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/love-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..7e8d0bfeea Binary files /dev/null and b/tests/sanity-ws/000001/love-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/notification-1729588583864-0.snp.gz b/tests/sanity-ws/000001/notification-1729588583864-0.snp.gz deleted file mode 100644 index 5222cb208a..0000000000 Binary files a/tests/sanity-ws/000001/notification-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/notification-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/notification-data-1729588583864-1.tar.gz deleted file mode 100644 index c4083eca77..0000000000 Binary files a/tests/sanity-ws/000001/notification-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/notification-dnc-1730472769365-0.snp.gz b/tests/sanity-ws/000001/notification-dnc-1730472769365-0.snp.gz new file mode 100644 index 0000000000..d12213e601 Binary files /dev/null and b/tests/sanity-ws/000001/notification-dnc-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/notification-dnc-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/notification-dnc-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..8692b0f7c7 Binary files /dev/null and b/tests/sanity-ws/000001/notification-dnc-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/preference-1730472769365-0.snp.gz b/tests/sanity-ws/000001/preference-1730472769365-0.snp.gz new file mode 100644 index 0000000000..4d9ceffbd2 Binary files /dev/null and b/tests/sanity-ws/000001/preference-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/preference-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/preference-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..8c4269806c Binary files /dev/null and b/tests/sanity-ws/000001/preference-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/space-1729588583864-0.snp.gz b/tests/sanity-ws/000001/space-1729588583864-0.snp.gz deleted file mode 100644 index 5cf596d84a..0000000000 Binary files a/tests/sanity-ws/000001/space-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/space-1730472769365-0.snp.gz b/tests/sanity-ws/000001/space-1730472769365-0.snp.gz new file mode 100644 index 0000000000..58f1379998 Binary files /dev/null and b/tests/sanity-ws/000001/space-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/space-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/space-data-1729588583864-1.tar.gz deleted file mode 100644 index 790ee00274..0000000000 Binary files a/tests/sanity-ws/000001/space-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/space-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/space-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..5c943a5d1d Binary files /dev/null and b/tests/sanity-ws/000001/space-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/status-1729588583864-0.snp.gz b/tests/sanity-ws/000001/status-1729588583864-0.snp.gz deleted file mode 100644 index 07735bf4a4..0000000000 Binary files a/tests/sanity-ws/000001/status-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/status-1730472769365-0.snp.gz b/tests/sanity-ws/000001/status-1730472769365-0.snp.gz new file mode 100644 index 0000000000..c4ee48fa20 Binary files /dev/null and b/tests/sanity-ws/000001/status-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/status-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/status-data-1729588583864-1.tar.gz deleted file mode 100644 index 92b9c284a9..0000000000 Binary files a/tests/sanity-ws/000001/status-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/status-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/status-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..adbc17e05b Binary files /dev/null and b/tests/sanity-ws/000001/status-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/tags-1729588583864-0.snp.gz b/tests/sanity-ws/000001/tags-1729588583864-0.snp.gz deleted file mode 100644 index b39225ce11..0000000000 Binary files a/tests/sanity-ws/000001/tags-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/tags-1730472769365-0.snp.gz b/tests/sanity-ws/000001/tags-1730472769365-0.snp.gz new file mode 100644 index 0000000000..1470045162 Binary files /dev/null and b/tests/sanity-ws/000001/tags-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/tags-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/tags-data-1729588583864-1.tar.gz deleted file mode 100644 index 8cc79dc357..0000000000 Binary files a/tests/sanity-ws/000001/tags-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/tags-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/tags-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..20a9b26a06 Binary files /dev/null and b/tests/sanity-ws/000001/tags-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/task-1729588583864-0.snp.gz b/tests/sanity-ws/000001/task-1729588583864-0.snp.gz deleted file mode 100644 index a9c992c6ff..0000000000 Binary files a/tests/sanity-ws/000001/task-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/task-1730472769365-0.snp.gz b/tests/sanity-ws/000001/task-1730472769365-0.snp.gz new file mode 100644 index 0000000000..ef34eceebf Binary files /dev/null and b/tests/sanity-ws/000001/task-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/task-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/task-data-1729588583864-1.tar.gz deleted file mode 100644 index 94dc24ac89..0000000000 Binary files a/tests/sanity-ws/000001/task-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/task-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/task-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..f5490cb0d9 Binary files /dev/null and b/tests/sanity-ws/000001/task-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/time-1729588583864-0.snp.gz b/tests/sanity-ws/000001/time-1730472769365-0.snp.gz similarity index 100% rename from tests/sanity-ws/000001/time-1729588583864-0.snp.gz rename to tests/sanity-ws/000001/time-1730472769365-0.snp.gz diff --git a/tests/sanity-ws/000001/time-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/time-data-1729588583864-1.tar.gz deleted file mode 100644 index 8f3d3d43c3..0000000000 Binary files a/tests/sanity-ws/000001/time-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/time-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/time-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..8a7ec328bf Binary files /dev/null and b/tests/sanity-ws/000001/time-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/tracker-1729588583864-0.snp.gz b/tests/sanity-ws/000001/tracker-1730472769365-0.snp.gz similarity index 100% rename from tests/sanity-ws/000001/tracker-1729588583864-0.snp.gz rename to tests/sanity-ws/000001/tracker-1730472769365-0.snp.gz diff --git a/tests/sanity-ws/000001/tracker-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/tracker-data-1729588583864-1.tar.gz deleted file mode 100644 index 651243d8b6..0000000000 Binary files a/tests/sanity-ws/000001/tracker-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/tracker-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/tracker-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..542fc7b480 Binary files /dev/null and b/tests/sanity-ws/000001/tracker-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/training-1730472769365-0.snp.gz b/tests/sanity-ws/000001/training-1730472769365-0.snp.gz new file mode 100644 index 0000000000..cb79d599d5 Binary files /dev/null and b/tests/sanity-ws/000001/training-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/training-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/training-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..15df168a84 Binary files /dev/null and b/tests/sanity-ws/000001/training-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/000001/tx-1729588583864-0.snp.gz b/tests/sanity-ws/000001/tx-1729588583864-0.snp.gz deleted file mode 100644 index 4a2cee9ce5..0000000000 Binary files a/tests/sanity-ws/000001/tx-1729588583864-0.snp.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/tx-1730472769365-0.snp.gz b/tests/sanity-ws/000001/tx-1730472769365-0.snp.gz new file mode 100644 index 0000000000..5bb0bf49fe Binary files /dev/null and b/tests/sanity-ws/000001/tx-1730472769365-0.snp.gz differ diff --git a/tests/sanity-ws/000001/tx-data-1729588583864-1.tar.gz b/tests/sanity-ws/000001/tx-data-1729588583864-1.tar.gz deleted file mode 100644 index cd9155b45f..0000000000 Binary files a/tests/sanity-ws/000001/tx-data-1729588583864-1.tar.gz and /dev/null differ diff --git a/tests/sanity-ws/000001/tx-data-1730472769365-1.tar.gz b/tests/sanity-ws/000001/tx-data-1730472769365-1.tar.gz new file mode 100644 index 0000000000..93e5d049d3 Binary files /dev/null and b/tests/sanity-ws/000001/tx-data-1730472769365-1.tar.gz differ diff --git a/tests/sanity-ws/backup.json.gz b/tests/sanity-ws/backup.json.gz index e985e060e5..d08d28e3d1 100644 Binary files a/tests/sanity-ws/backup.json.gz and b/tests/sanity-ws/backup.json.gz differ diff --git a/tests/sanity-ws/backup.size.gz b/tests/sanity-ws/backup.size.gz index 781156afb9..06eb14de8a 100644 Binary files a/tests/sanity-ws/backup.size.gz and b/tests/sanity-ws/backup.size.gz differ diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts index 2bcb8572a6..e13a8453a3 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -73,7 +73,7 @@ test.describe('candidate/talents tests', () => { await talentsPage.checkTalentNotExist(talentName) }) - test('Merge contacts', async () => { + test.skip('Merge contacts', async () => { const firstLocation = 'Location 1' const secondLocation = 'Location 2' diff --git a/tests/update-snapshot.sh b/tests/update-snapshot.sh index 46d710498d..226ee7d046 100755 --- a/tests/update-snapshot.sh +++ b/tests/update-snapshot.sh @@ -1,9 +1,10 @@ export MINIO_ACCESS_KEY=minioadmin export MINIO_SECRET_KEY=minioadmin -export MINIO_ENDPOINT=localhost:9000 -export MONGO_URL=mongodb://localhost:27017 -export ELASTIC_URL=http://localhost:9200 +export MINIO_ENDPOINT=localhost:9002 +export ACCOUNTS_URL=http://localhost:3003 +export MONGO_URL=mongodb://localhost:27018 +export ELASTIC_URL=http://localhost:9201 export SERVER_SECRET=secret location="${1:-./sanity-ws}"