From d38df9c600846ec29ac7700bb22ee72de6f6f0bb Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Tue, 17 Sep 2024 23:26:46 +0700 Subject: [PATCH] UBERF-8150: Update to fresh mongo (#6603) Signed-off-by: Andrey Sobolev --- .vscode/launch.json | 2 +- common/config/rush/pnpm-lock.yaml | 110 +++++++++++------- dev/tool/package.json | 2 +- dev/tool/src/index.ts | 16 +-- packages/core/src/measurements/context.ts | 3 +- pods/account/package.json | 2 +- pods/authProviders/package.json | 2 +- pods/workspace/package.json | 2 +- server-plugins/ai-bot-resources/package.json | 2 +- server/account-service/package.json | 2 +- server/account/package.json | 2 +- server/collaborator/package.json | 2 +- server/core/src/fulltext.ts | 4 +- server/core/src/pipeline.ts | 15 ++- server/middleware/src/model.ts | 4 +- server/mongo/package.json | 2 +- server/mongo/src/utils.ts | 5 +- server/server-pipeline/src/pipeline.ts | 31 ++--- server/tool/package.json | 2 +- server/tool/src/index.ts | 10 +- server/workspace-service/src/ws-operations.ts | 37 +++--- services/ai-bot/pod-ai-bot/package.json | 2 +- .../pod-analytics-collector/package.json | 2 +- services/calendar/pod-calendar/package.json | 2 +- services/github/pod-github/package.json | 2 +- services/gmail/pod-gmail/package.json | 2 +- services/sign/pod-sign/package.json | 2 +- .../pod-telegram-bot/package.json | 2 +- services/telegram/pod-telegram/package.json | 2 +- 29 files changed, 162 insertions(+), 111 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5735b8797b..2c27625582 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -242,7 +242,7 @@ "name": "Debug tool upgrade", "type": "node", "request": "launch", - "args": ["src/__start.ts", "create-workspace", "sanity-ws", "-w sanity-ws"], + "args": ["src/__start.ts", "upgrade", "--force"], "env": { "SERVER_SECRET": "secret", "MINIO_ACCESS_KEY": "minioadmin", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 82cc5ac829..faebe81328 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1671,8 +1671,8 @@ dependencies: specifier: ^8.0.0 version: 8.0.0 mongodb: - specifier: ^6.8.0 - version: 6.8.0 + specifier: ^6.9.0 + version: 6.9.0 morgan: specifier: ^1.10.0 version: 1.10.0 @@ -18502,6 +18502,38 @@ packages: mongodb-connection-string-url: 3.0.0 dev: false + /mongodb@6.9.0: + resolution: {integrity: sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==} + engines: {node: '>=16.20.1'} + peerDependencies: + '@aws-sdk/credential-providers': ^3.188.0 + '@mongodb-js/zstd': ^1.1.0 + gcp-metadata: ^5.2.0 + kerberos: ^2.0.1 + mongodb-client-encryption: '>=6.0.0 <7' + snappy: ^7.2.2 + socks: ^2.7.1 + peerDependenciesMeta: + '@aws-sdk/credential-providers': + optional: true + '@mongodb-js/zstd': + optional: true + gcp-metadata: + optional: true + kerberos: + optional: true + mongodb-client-encryption: + optional: true + snappy: + optional: true + socks: + optional: true + dependencies: + '@mongodb-js/saslprep': 1.1.7 + bson: 6.8.0 + mongodb-connection-string-url: 3.0.0 + dev: false + /monitor-event-loop-delay@1.0.0: resolution: {integrity: sha512-YRIr1exCIfBDLZle8WHOfSo7Xg3M+phcZfq9Fx1L6Abo+atGp7cge5pM7PjyBn4s1oZI/BRD4EMrzQBbPpVb5Q==} dev: false @@ -24359,7 +24391,7 @@ packages: dev: false file:projects/account-service.tgz: - resolution: {integrity: sha512-ezhFLrsQ8CjpPUIvobegFaStE0c6PJyHqd4V8731uyNwVe+Vhm+Wx5Qoa/VOVqdCWOixjZdP9sBWILsRU9nKkA==, tarball: file:projects/account-service.tgz} + resolution: {integrity: sha512-Z1uqHeIat92THVFMgHd4yBhVLKJ76ix4IRnjesgUmD/L2OYdIPydaA2vA1Rxr9QqSjhJynMwBPW2dvHP3s40QQ==, tarball: file:projects/account-service.tgz} name: '@rush-temp/account-service' version: 0.0.0 dependencies: @@ -24385,7 +24417,7 @@ packages: koa-bodyparser: 4.4.1 koa-morgan: 1.0.1 koa-router: 12.0.1 - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) ts-node: 10.9.2(@types/node@20.11.19)(typescript@5.3.3) @@ -24409,7 +24441,7 @@ packages: dev: false file:projects/account.tgz(@types/node@20.11.19)(bufferutil@4.0.8)(esbuild@0.20.1)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-DvyfbaDA/mO99PJfqk/phC+LK9BcE0UvdVNgH9aritUgfPI9yCNePIy8FIXcosZKgOyFxi4XQLmfgkr2U8M6kw==, tarball: file:projects/account.tgz} + resolution: {integrity: sha512-sEHRVls95wOjTM2vjmYddoKb4ZADPH+hM73ieICjebrBzdQeu41+2YjQMrUhpkd04Q1VtOHtvBx2uQgeWWetDw==, tarball: file:projects/account.tgz} id: file:projects/account.tgz name: '@rush-temp/account' version: 0.0.0 @@ -24426,7 +24458,7 @@ packages: eslint-plugin-n: 15.7.0(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 otp-generator: 4.0.1 prettier: 3.2.5 @@ -24913,7 +24945,7 @@ packages: dev: false file:projects/auth-providers.tgz(@types/node@20.11.19)(esbuild@0.20.1)(ts-node@10.9.2): - resolution: {integrity: sha512-5ii9QDKZ+v5awKhzsUOf7Y83PSCUzX6BKFZjY21w8oy+pJRZPTVbKYJhQC4i1AuvahXCObkMbCc3ljs0L+vgIw==, tarball: file:projects/auth-providers.tgz} + resolution: {integrity: sha512-RDD+zkNosRxJuY+bq2skRGbRPr4saOaAvlkKv3gvvIXT5RxnmOXnznS6haxIcXw4VA96oxv08U9Mu8+3PjgpwQ==, tarball: file:projects/auth-providers.tgz} id: file:projects/auth-providers.tgz name: '@rush-temp/auth-providers' version: 0.0.0 @@ -24940,7 +24972,7 @@ packages: koa-passport: 6.0.0 koa-router: 12.0.1 koa-session: 6.4.0 - mongodb: 6.8.0 + mongodb: 6.9.0 passport-custom: 1.1.1 passport-github2: 0.1.12 passport-google-oauth20: 2.0.0 @@ -25570,7 +25602,7 @@ packages: dev: false file:projects/collaborator.tgz(@tiptap/pm@2.2.4)(bufferutil@4.0.8)(utf-8-validate@6.0.4)(y-protocols@1.0.6): - resolution: {integrity: sha512-svaotn6ykOZH+tModYWz/Y3hct1yHDm/enwC9NCpH17VVNALvRIqUx8F2DWvQV5mUwJYxLcKgdsBqNPB4MjMag==, tarball: file:projects/collaborator.tgz} + resolution: {integrity: sha512-kbQ3FQjOfFmNC2bJNReWaDGp98qd50fnbNaMVHj/1KFzodBvkDP2adyAuXrCx6Gndah7TzH5+jQsDyGvy+ICPA==, tarball: file:projects/collaborator.tgz} id: file:projects/collaborator.tgz name: '@rush-temp/collaborator' version: 0.0.0 @@ -25599,7 +25631,7 @@ packages: eslint-plugin-promise: 6.1.1(eslint@8.56.0) express: 4.19.2 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) ts-node: 10.9.2(@types/node@20.11.19)(typescript@5.3.3) @@ -29120,7 +29152,7 @@ packages: dev: false file:projects/mongo.tgz(esbuild@0.20.1)(ts-node@10.9.2): - resolution: {integrity: sha512-KZpBO9U1lb9A5pxEVDhez06AEKqg9YKivXmefDmsW53CBgqV9so2eprzgsRlxIQvPz/aMTI7s0bMGL9WUjseRQ==, tarball: file:projects/mongo.tgz} + resolution: {integrity: sha512-2metf8b2bUeEB5fJB/ULlDXMgRk5UDkaanw/H40GwsJTWMxygWg5IhdbwZ9l8gXHFntx2HFQOtOK4ryOsFY+Ww==, tarball: file:projects/mongo.tgz} id: file:projects/mongo.tgz name: '@rush-temp/mongo' version: 0.0.0 @@ -29136,7 +29168,7 @@ packages: eslint-plugin-n: 15.7.0(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 prettier-plugin-svelte: 3.2.1(prettier@3.2.5)(svelte@4.2.11) ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -29512,7 +29544,7 @@ packages: dev: false file:projects/pod-account.tgz: - resolution: {integrity: sha512-4GzxbT2fBrGb3XHE1U4rRqzn73jrkUyIaWJUsjDzDAYzmOGAUX3n+DplPLC3rPCql58F6XxniPQH25KcmLkkCw==, tarball: file:projects/pod-account.tgz} + resolution: {integrity: sha512-9wMWikXlXBfJQxuSgyWDrZZpIXzg3KTzD3krxImy0o7TRSTyB2whxQdQcA9HtuibsC8CVTyH5p7Ij2RsEAQadQ==, tarball: file:projects/pod-account.tgz} name: '@rush-temp/pod-account' version: 0.0.0 dependencies: @@ -29536,7 +29568,7 @@ packages: koa: 2.15.3 koa-bodyparser: 4.4.1 koa-router: 12.0.1 - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 prettier-plugin-svelte: 3.2.1(prettier@3.2.5)(svelte@4.2.11) ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -29561,7 +29593,7 @@ packages: dev: false file:projects/pod-ai-bot.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4)(zod@3.23.8): - resolution: {integrity: sha512-/UB67RfT0fI4XW6vu6sYFLs57ciAWNBNDq5Au/5qgN1ilwh/VvgqJNgwiGTPkqt4b1Q9AKfpy7AIRy2FoAk1/A==, tarball: file:projects/pod-ai-bot.tgz} + resolution: {integrity: sha512-aMlSGJ89IhINflYpenenAXdbK+Vw6eAHu3R9rO1nsd7pmsOWxRLG6Hp5f+sN1q6S1cmPVQeD/q/tuvp6byFK8g==, tarball: file:projects/pod-ai-bot.tgz} id: file:projects/pod-ai-bot.tgz name: '@rush-temp/pod-ai-bot' version: 0.0.0 @@ -29588,7 +29620,7 @@ packages: fast-equals: 5.0.1 form-data: 4.0.0 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 openai: 4.56.0(zod@3.23.8) prettier: 3.2.5 @@ -29620,7 +29652,7 @@ packages: dev: false file:projects/pod-analytics-collector.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-PbfH6v1MeYjOCQjFEQ2Lb63CwlQrqeeHkEzZYbPjgMC1x9XoUOzv+2krfWR8RXHCm7pW1TnWn8UHRbaZIUVJzg==, tarball: file:projects/pod-analytics-collector.tgz} + resolution: {integrity: sha512-lwu1owtUXY2YQrV5oeAbjx4yYOiX7qGKsr6Jj1dXtXzupoMGdL9RYQXwatDJCQcBuE9XegmcVmPQQfSz+a0x5g==, tarball: file:projects/pod-analytics-collector.tgz} id: file:projects/pod-analytics-collector.tgz name: '@rush-temp/pod-analytics-collector' version: 0.0.0 @@ -29644,7 +29676,7 @@ packages: eslint-plugin-promise: 6.1.1(eslint@8.56.0) express: 4.19.2 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 puppeteer: 22.14.0(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@6.0.4) ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -29708,7 +29740,7 @@ packages: dev: false file:projects/pod-calendar.tgz(bufferutil@4.0.8)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-1kg3vKf6VEBcDutX3v29cjqDtrRghg7rXglm3OHuMwXC6WewfD+aM6xQ8hlUZjcVIq09Hv0nVr/n2SxUtal8LQ==, tarball: file:projects/pod-calendar.tgz} + resolution: {integrity: sha512-XUGpIUp1qokoJXVLf9iKTUfYErDmObsJHDe7kTXQwe3k4qkcsGtXfnhrzuOerQZ6OM+oFxqasadS9fplTc6VrQ==, tarball: file:projects/pod-calendar.tgz} id: file:projects/pod-calendar.tgz name: '@rush-temp/pod-calendar' version: 0.0.0 @@ -29739,7 +29771,7 @@ packages: googleapis: 122.0.0 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) jwt-simple: 0.5.6 - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -29849,7 +29881,7 @@ packages: dev: false file:projects/pod-github.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4)(y-prosemirror@1.2.2): - resolution: {integrity: sha512-RA87aZVbfB6BoGlJ19b/c8Hqd6Xc8T0VjxDw/cmrGWVBP5itbg/Vliquag/JsEXrqzRKr/c0WkNWB6lkr4ojSQ==, tarball: file:projects/pod-github.tgz} + resolution: {integrity: sha512-xqGjmgo5n8V+GlEVR18AoREc41WC73vMNfewuczc0QwYEkvA6JmB49lnVm6cyGjtRQ3EjLxxgL7SuW5R5koE9w==, tarball: file:projects/pod-github.tgz} id: file:projects/pod-github.tgz name: '@rush-temp/pod-github' version: 0.0.0 @@ -29908,7 +29940,7 @@ packages: graphql-binding: 2.5.2 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) markdown-it: 14.0.0 - mongodb: 6.8.0 + mongodb: 6.9.0 octokit: 3.2.1 prettier: 3.2.5 smee-client: 1.2.5 @@ -29938,7 +29970,7 @@ packages: dev: false file:projects/pod-gmail.tgz(bufferutil@4.0.8)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-o5Ml8egkEHpCTaZ/hYgdA/5naofYkU52SAHnIZhyeFgIYKttpuNqi0wb25P36h3xhAA5WFdyytNPHOf7OBL4VA==, tarball: file:projects/pod-gmail.tgz} + resolution: {integrity: sha512-0O5H4lF5Hh+cyQasyYyQBiCpb9tFDA6J0zix12os3TLw9cRtdxpTwWkkkktugyptII0yIWPqAOU0XWAhtDkK0g==, tarball: file:projects/pod-gmail.tgz} id: file:projects/pod-gmail.tgz name: '@rush-temp/pod-gmail' version: 0.0.0 @@ -29971,7 +30003,7 @@ packages: googleapis: 122.0.0 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) jwt-simple: 0.5.6 - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -30171,7 +30203,7 @@ packages: dev: false file:projects/pod-sign.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-kceqIYAazdwqnkcouhx4BZzUIJ1cxvYas4XtukNGHEB1Sc+mK+mag390ljMcM6fSHSZz9Ix1ke0OZGmNqbCTCQ==, tarball: file:projects/pod-sign.tgz} + resolution: {integrity: sha512-I1OLN4V4OgGZvKUFnkoxokTTpYUPRarvuca+JOt+ce68hbp/ZvJ7GYdBTr6QpPnSDRIUI+Hw+x4YiaMmmb/F6Q==, tarball: file:projects/pod-sign.tgz} id: file:projects/pod-sign.tgz name: '@rush-temp/pod-sign' version: 0.0.0 @@ -30199,7 +30231,7 @@ packages: eslint-plugin-promise: 6.1.1(eslint@8.56.0) express: 4.19.2 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 node-forge: 1.3.1 pdf-lib: 1.17.1 prettier: 3.2.5 @@ -30228,7 +30260,7 @@ packages: dev: false file:projects/pod-telegram-bot.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-iYHC3LQQX/oFuRh+llDGC7Sj4smIcYENpabAX4HN+Gr0bmN8A2dKK69P7ngJ8ozhjAIUpLKwPKmCSwzyz+ZRpw==, tarball: file:projects/pod-telegram-bot.tgz} + resolution: {integrity: sha512-ytBZ1LMObeiEgq1Nroue4mWRtiaYvd8Jgm5cEBE1muqps1ZNCrRSoE+2kCYrDOv7MlJBViid2fMU+3H2hGn2Eg==, tarball: file:projects/pod-telegram-bot.tgz} id: file:projects/pod-telegram-bot.tgz name: '@rush-temp/pod-telegram-bot' version: 0.0.0 @@ -30256,7 +30288,7 @@ packages: express: 4.19.2 htmlparser2: 9.1.0 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 otp-generator: 4.0.1 prettier: 3.2.5 @@ -30287,7 +30319,7 @@ packages: dev: false file:projects/pod-telegram.tgz(bufferutil@4.0.8)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-GCgA0Jny/OVcKWLkF1oA4awBVXQhFnHrfWujxfxke9g9S5FXNKrzZe/DCTlK/d/hRJ1XFj0Zw03rvBDhAKfOsg==, tarball: file:projects/pod-telegram.tgz} + resolution: {integrity: sha512-dD1qmXqRBs/o4Hdywguab5+NB5FeeEKzO+BgShhQzD9sz98CbwOmtKFYQHiLyJvPI0MHvRdzTAkRXe59TssTSQ==, tarball: file:projects/pod-telegram.tgz} id: file:projects/pod-telegram.tgz name: '@rush-temp/pod-telegram' version: 0.0.0 @@ -30319,7 +30351,7 @@ packages: jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) jwt-simple: 0.5.6 mime: 3.0.0 - mongodb: 6.8.0 + mongodb: 6.9.0 node-fetch: 2.7.0 prettier: 3.2.5 telegram: 2.22.2 @@ -30351,7 +30383,7 @@ packages: dev: false file:projects/pod-workspace.tgz: - resolution: {integrity: sha512-3hJxKzpd+0/zfr++zNy57willy+3axei4d1ehwmhxivlQh0/iKsV2RvKCMD7q74b/grO+gewyFY7XsVzBlkvrg==, tarball: file:projects/pod-workspace.tgz} + resolution: {integrity: sha512-nC9coSAonWR/2WPwI4CYFxvPYcIkmU5lAQVQeiWaACTquGi5poDJ0Lq/lERb7+bMEcx5Dhj8HDuxpVoAk6sw6A==, tarball: file:projects/pod-workspace.tgz} name: '@rush-temp/pod-workspace' version: 0.0.0 dependencies: @@ -30367,7 +30399,7 @@ packages: eslint-plugin-n: 15.7.0(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) ts-node: 10.9.2(@types/node@20.11.19)(typescript@5.3.3) @@ -31495,7 +31527,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-YOa1XOLVz87AjouR9Qn4Wkiib/9nXkIiMIW7XVzCl+lVqfdjXDRn4kjxXj363Wh8bw5Ato7kpuj0M9C1Vsh+zw==, tarball: file:projects/server-ai-bot-resources.tgz} + resolution: {integrity: sha512-xg5klAybCHnYN9ATNatmTborTaMu5UAxMW8E+qi77BAS/eUSYw8Lvi/k7W1hvsCeZleMTQKi1hMJAdP9ceZJfg==, 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 @@ -31509,7 +31541,7 @@ packages: eslint-plugin-n: 15.7.0(eslint@8.56.0) eslint-plugin-promise: 6.1.1(eslint@8.56.0) jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) typescript: 5.3.3 @@ -33340,7 +33372,7 @@ packages: dev: false file:projects/server-tool.tgz(@types/node@20.11.19)(bufferutil@4.0.8)(esbuild@0.20.1)(ts-node@10.9.2)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-GNqSQpgao0m+VBNx/GMS9FVTgAu38RYMHB6wHx75ZNzbCctyIiS2DLc+SfxTPZWkDprZb71Gs0y7A4e9nGc8qA==, tarball: file:projects/server-tool.tgz} + resolution: {integrity: sha512-laY4rfz2M3gZw+L9hEHz3Ew3kVSUXEbiQNawxzPvnWXd1QfazHMNBqf0odz6OfqKlRDBCqtb+qx/F7c45wDP5Q==, tarball: file:projects/server-tool.tgz} id: file:projects/server-tool.tgz name: '@rush-temp/server-tool' version: 0.0.0 @@ -33359,7 +33391,7 @@ packages: fast-equals: 5.0.1 jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) js-yaml: 4.1.0 - mongodb: 6.8.0 + mongodb: 6.9.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) typescript: 5.3.3 @@ -34817,7 +34849,7 @@ packages: dev: false file:projects/tool.tgz(bufferutil@4.0.8)(utf-8-validate@6.0.4): - resolution: {integrity: sha512-lYSbeq8uIDsDUr/awBsGP6yBmVJO+2iToNOy93OhjZ8meyneJvNUnOeoAOWj/vtmO+UIyEc5pKYHlHJW4NNsAw==, tarball: file:projects/tool.tgz} + resolution: {integrity: sha512-RSAbkqDJ6ZPQeb+14nifm31Puoq/ufGazM4zEu+oXzsYdpBZIv8peGii6BgGOGmAJaUPBkEXauieXvkdSnLIWg==, tarball: file:projects/tool.tgz} id: file:projects/tool.tgz name: '@rush-temp/tool' version: 0.0.0 @@ -34847,7 +34879,7 @@ packages: jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2) libphonenumber-js: 1.10.56 mime-types: 2.1.35 - mongodb: 6.8.0 + mongodb: 6.9.0 pg: 8.12.0 prettier: 3.2.5 ts-jest: 29.1.2(esbuild@0.20.1)(jest@29.7.0)(typescript@5.3.3) @@ -35518,7 +35550,7 @@ packages: dev: false file:projects/workspace-service.tgz: - resolution: {integrity: sha512-/ACNv9VVAkel1YYEF3LyqV49qXKzbEzFpO7g5cb1P+f1bmzxQmpfYBc5sDssrHF0nB0o2+Fzqud6BdI7S+n+Uw==, tarball: file:projects/workspace-service.tgz} + resolution: {integrity: sha512-Zatq+n1b+cqzu59FxdcoDfKlrno6G7c5JWS75k5d8DvdxNdX+yECbZ/nn8Es0EuUbTxvtMJIzKzQhXnaOxKyXA==, tarball: file:projects/workspace-service.tgz} name: '@rush-temp/workspace-service' version: 0.0.0 dependencies: diff --git a/dev/tool/package.json b/dev/tool/package.json index cbb03b0ce6..34f8c58a31 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -155,7 +155,7 @@ "got": "^11.8.3", "libphonenumber-js": "^1.9.46", "mime-types": "~2.1.34", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "pg": "8.12.0", "ws": "^8.18.0" } diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index 90d5e97aaa..b4369e4a20 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -86,7 +86,7 @@ import core, { } from '@hcengineering/core' import { consoleModelLogger, type MigrateOperation } from '@hcengineering/model' import contact from '@hcengineering/model-contact' -import { getMongoClient, getWorkspaceDB } from '@hcengineering/mongo' +import { getMongoClient, getWorkspaceDB, shutdown } from '@hcengineering/mongo' import type { StorageAdapter, StorageAdapterEx } from '@hcengineering/server-core' import { deepEqual } from 'fast-equals' import { createWriteStream, readFileSync } from 'fs' @@ -205,6 +205,7 @@ export function devTool ( } client.close() console.log(`closing database connection to '${uri}'...`) + await shutdown() } async function withStorage (mongodbUri: string, f: (storageAdapter: StorageAdapter) => Promise): Promise { @@ -552,11 +553,12 @@ export function devTool ( const measureCtx = new MeasureMetricsContext('upgrade', {}) for (const ws of workspaces) { - try { - const logger = cmd.console - ? consoleModelLogger - : new FileModelLogger(path.join(cmd.logs, `${ws.workspace}.log`)) + console.warn('UPGRADING', ws.workspaceName) + const logger = cmd.console + ? consoleModelLogger + : new FileModelLogger(path.join(cmd.logs, `${ws.workspace}.log`)) + try { await upgradeWorkspace( measureCtx, version, @@ -577,10 +579,10 @@ export function devTool ( attempts: 0 }) } catch (err: any) { - console.error(err) + toolCtx.error('failed to upgrade', { err, workspace: ws.workspace, workspaceName: ws.workspaceName }) + continue } } - console.log('upgrade done') }) }) diff --git a/packages/core/src/measurements/context.ts b/packages/core/src/measurements/context.ts index b3b8aff4ee..25595c0889 100644 --- a/packages/core/src/measurements/context.ts +++ b/packages/core/src/measurements/context.ts @@ -141,10 +141,9 @@ export class MeasureMetricsContext implements MeasureContext { const value = op(c) if (value != null && value instanceof Promise) { needFinally = false - void value.finally(() => { + return value.finally(() => { c.end() }) - return value } else { return Promise.resolve(value) } diff --git a/pods/account/package.json b/pods/account/package.json index 5ae1ba8424..68dd4ec70f 100644 --- a/pods/account/package.json +++ b/pods/account/package.json @@ -57,7 +57,7 @@ "@hcengineering/platform": "^0.6.11", "@hcengineering/auth-providers": "^0.6.0", "@hcengineering/core": "^0.6.32", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "koa": "^2.15.3", "koa-router": "^12.0.1", "koa-bodyparser": "^4.4.1", diff --git a/pods/authProviders/package.json b/pods/authProviders/package.json index 2ded298ef8..4735797719 100644 --- a/pods/authProviders/package.json +++ b/pods/authProviders/package.json @@ -46,7 +46,7 @@ "@types/querystringify": "^2.0.2" }, "dependencies": { - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "@hcengineering/core": "^0.6.32", "@hcengineering/account": "^0.6.0", "passport-custom": "~1.1.1", diff --git a/pods/workspace/package.json b/pods/workspace/package.json index fa34631d18..093383552d 100644 --- a/pods/workspace/package.json +++ b/pods/workspace/package.json @@ -51,7 +51,7 @@ "@hcengineering/workspace-service": "^0.6.0", "@hcengineering/platform": "^0.6.11", "@hcengineering/core": "^0.6.32", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "@hcengineering/server-token": "^0.6.11", "@hcengineering/server-core": "^0.6.1", "@hcengineering/model-all": "^0.6.0", diff --git a/server-plugins/ai-bot-resources/package.json b/server-plugins/ai-bot-resources/package.json index 4c28e91d80..6076bd1973 100644 --- a/server-plugins/ai-bot-resources/package.json +++ b/server-plugins/ai-bot-resources/package.json @@ -50,6 +50,6 @@ "@hcengineering/ai-bot": "^0.6.0", "@hcengineering/server-ai-bot": "^0.6.0", "@hcengineering/analytics-collector": "^0.6.0", - "mongodb": "^6.8.0" + "mongodb": "^6.9.0" } } diff --git a/server/account-service/package.json b/server/account-service/package.json index 6f5257b0d2..182635f212 100644 --- a/server/account-service/package.json +++ b/server/account-service/package.json @@ -48,7 +48,7 @@ "@hcengineering/auth-providers": "^0.6.0", "@hcengineering/core": "^0.6.32", "@hcengineering/mongo": "^0.6.1", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "koa": "^2.15.3", "koa-router": "^12.0.1", "koa-bodyparser": "^4.4.1", diff --git a/server/account/package.json b/server/account/package.json index f5ebc3a125..a890a19650 100644 --- a/server/account/package.json +++ b/server/account/package.json @@ -40,7 +40,7 @@ "@types/otp-generator": "^4.0.2" }, "dependencies": { - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "@hcengineering/platform": "^0.6.11", "@hcengineering/core": "^0.6.32", "@hcengineering/contact": "^0.6.24", diff --git a/server/collaborator/package.json b/server/collaborator/package.json index c8795b5e7a..e67267bf4e 100644 --- a/server/collaborator/package.json +++ b/server/collaborator/package.json @@ -66,7 +66,7 @@ "@hocuspocus/transformer": "^2.13.5", "@tiptap/core": "^2.2.4", "@tiptap/html": "^2.2.4", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "yjs": "^13.5.52", "y-prosemirror": "^1.2.1", "express": "^4.19.2", diff --git a/server/core/src/fulltext.ts b/server/core/src/fulltext.ts index 328fce5024..8a2436c14e 100644 --- a/server/core/src/fulltext.ts +++ b/server/core/src/fulltext.ts @@ -72,7 +72,9 @@ export class FullTextIndex implements WithFind { } async close (): Promise { - await this.indexer.cancel() + if (!this.upgrade) { + await this.indexer.cancel() + } } async tx (ctx: MeasureContext, txes: Tx[]): Promise { diff --git a/server/core/src/pipeline.ts b/server/core/src/pipeline.ts index 147e261586..17d4b95af1 100644 --- a/server/core/src/pipeline.ts +++ b/server/core/src/pipeline.ts @@ -74,11 +74,18 @@ class PipelineImpl implements Pipeline { let current: Middleware | undefined for (let index = constructors.length - 1; index >= 0; index--) { const element = constructors[index] - const newCur = await element(ctx, context, current) - if (newCur != null) { - this.middlewares.push(newCur) + try { + const newCur = await element(ctx, context, current) + if (newCur != null) { + this.middlewares.push(newCur) + } + current = newCur ?? current + } catch (err: any) { + ctx.error('failed to initialize pipeline', { err, workspace: context.workspace.name }) + // We need to call close for all items. + await this.close() + throw err } - current = newCur ?? current } this.middlewares.reverse() diff --git a/server/middleware/src/model.ts b/server/middleware/src/model.ts index 2352ce5452..546c94017e 100644 --- a/server/middleware/src/model.ts +++ b/server/middleware/src/model.ts @@ -46,8 +46,8 @@ export class ModelMiddleware extends BaseMiddleware implements Middleware { } const txAdapter = this.context.adapterManager.getAdapter(DOMAIN_TX, true) as TxAdapter - this.model = await ctx.with('get model', {}, async (ctx) => { - const model = await ctx.with('fetch-model', {}, async (ctx) => await txAdapter.getModel(ctx)) + this.model = await ctx.with('get-model', {}, async (ctx) => { + const model = await ctx.with('fetch-model', {}, (ctx) => txAdapter.getModel(ctx)) for (const tx of model) { try { this.context.hierarchy.tx(tx) diff --git a/server/mongo/package.json b/server/mongo/package.json index 9081a4904c..73b9412aa2 100644 --- a/server/mongo/package.json +++ b/server/mongo/package.json @@ -37,7 +37,7 @@ "@hcengineering/core": "^0.6.32", "@hcengineering/platform": "^0.6.11", "@hcengineering/server-core": "^0.6.1", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "bson": "^6.8.0" } } diff --git a/server/mongo/src/utils.ts b/server/mongo/src/utils.ts index 616e8dab30..6292bf003a 100644 --- a/server/mongo/src/utils.ts +++ b/server/mongo/src/utils.ts @@ -81,7 +81,10 @@ class MongoClientReferenceImpl { } this.onclose() void (async () => { - const cl = await this.client + let cl = this.client + if (cl instanceof Promise) { + cl = await cl + } await cl.close() })() } diff --git a/server/server-pipeline/src/pipeline.ts b/server/server-pipeline/src/pipeline.ts index 53069c1b90..d6aec71b4f 100644 --- a/server/server-pipeline/src/pipeline.ts +++ b/server/server-pipeline/src/pipeline.ts @@ -1,16 +1,16 @@ /* eslint-disable @typescript-eslint/unbound-method */ import { - type Branding, DOMAIN_BENCHMARK, DOMAIN_BLOB, DOMAIN_FULLTEXT_BLOB, DOMAIN_MODEL, DOMAIN_TRANSIENT, DOMAIN_TX, - type WorkspaceIdWithUrl, Hierarchy, ModelDb, - type MeasureContext + type Branding, + type MeasureContext, + type WorkspaceIdWithUrl } from '@hcengineering/core' import { createElasticAdapter, createElasticBackupDataAdapter } from '@hcengineering/elastic' import { @@ -35,8 +35,8 @@ import { TriggersMiddleware, TxMiddleware } from '@hcengineering/middleware' -import { createPostgresAdapter, createPostgresTxAdapter } from '@hcengineering/postgres' import { createMongoAdapter, createMongoTxAdapter } from '@hcengineering/mongo' +import { createPostgresAdapter, createPostgresTxAdapter } from '@hcengineering/postgres' import { buildStorageFromConfig, createNullAdapter, @@ -49,18 +49,18 @@ import { createBenchmarkAdapter, createInMemoryAdapter, createPipeline, - type Middleware, - type DbAdapterFactory, + DummyFullTextAdapter, FullTextMiddleware, + type AggregatorStorageAdapter, + type DbAdapterFactory, type DbConfiguration, + type Middleware, type MiddlewareCreator, + type Pipeline, type PipelineContext, type PipelineFactory, type StorageAdapter, - type Pipeline, - type StorageConfiguration, - DummyFullTextAdapter, - type AggregatorStorageAdapter + type StorageConfiguration } from '@hcengineering/server-core' import { createIndexStages } from './indexing' @@ -200,9 +200,14 @@ export async function getServerPipeline ( } ) - return { - pipeline: await pipelineFactory(ctx, wsUrl, true, () => {}, null), - storageAdapter + try { + return { + pipeline: await pipelineFactory(ctx, wsUrl, true, () => {}, null), + storageAdapter + } + } catch (err: any) { + await storageAdapter.close() + throw err } } diff --git a/server/tool/package.json b/server/tool/package.json index 1ac615f1df..e3e3e35022 100644 --- a/server/tool/package.json +++ b/server/tool/package.json @@ -40,7 +40,7 @@ "@types/js-yaml": "^4.0.9" }, "dependencies": { - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "@hcengineering/platform": "^0.6.11", "@hcengineering/core": "^0.6.32", "@hcengineering/contact": "^0.6.24", diff --git a/server/tool/src/index.ts b/server/tool/src/index.ts index b9a5755e78..23aefeba97 100644 --- a/server/tool/src/index.ts +++ b/server/tool/src/index.ts @@ -253,7 +253,7 @@ export async function upgradeModel ( workspaceId: WorkspaceIdWithUrl, txes: Tx[], pipeline: Pipeline, - storageAdapter: AggregatorStorageAdapter, + storageAdapter: StorageAdapter, migrateOperations: [string, MigrateOperation][], logger: ModelLogger = consoleModelLogger, skipTxUpdate: boolean = false, @@ -413,9 +413,7 @@ export async function upgradeModel ( let i = 0 for (const op of migrateOperations) { const t = Date.now() - await ctx.with(op[0], {}, async () => { - await op[1].upgrade(migrateState, getUpgradeClient, logger) - }) + await ctx.with(op[0], {}, () => op[1].upgrade(migrateState, getUpgradeClient, logger)) logger.log('upgrade:', { operation: op[0], time: Date.now() - t, workspaceId: workspaceId.name }) await progress(60 + ((100 / migrateOperations.length) * i * 30) / 100) i++ @@ -474,11 +472,11 @@ export async function fetchModel ( const modelDb = new ModelDb(hierarchy) if (model === undefined) { - const res = await ctx.with('get-model', {}, async (ctx) => await pipeline.loadModel(ctx, 0)) + const res = await ctx.with('load-model', {}, (ctx) => pipeline.loadModel(ctx, 0)) model = Array.isArray(res) ? res : res.transactions } - await ctx.with('build local model', {}, async () => { + ctx.withSync('build local model', {}, () => { for (const tx of model ?? []) { try { hierarchy.tx(tx) diff --git a/server/workspace-service/src/ws-operations.ts b/server/workspace-service/src/ws-operations.ts index 8fe3bebfef..cc32f0066e 100644 --- a/server/workspace-service/src/ws-operations.ts +++ b/server/workspace-service/src/ws-operations.ts @@ -21,6 +21,7 @@ import { SessionDataImpl, type Pipeline, type PipelineFactory, + type StorageAdapter, type StorageConfiguration } from '@hcengineering/server-core' import { @@ -284,22 +285,23 @@ export async function upgradeWorkspace ( workspaceName: ws.workspaceName ?? '', workspaceUrl: ws.workspaceUrl ?? '' } - - const { pipeline, storageAdapter } = await getServerPipeline(ctx, mongodbUri, dbUrl, wsUrl) - const contextData = new SessionDataImpl( - systemAccountEmail, - 'backup', - true, - { targets: {}, txes: [] }, - wsUrl, - null, - false, - new Map(), - new Map(), - pipeline.context.modelDb - ) - ctx.contextData = contextData + let pipeline: Pipeline | undefined + let storageAdapter: StorageAdapter | undefined try { + ;({ pipeline, storageAdapter } = await getServerPipeline(ctx, mongodbUri, dbUrl, wsUrl)) + const contextData = new SessionDataImpl( + systemAccountEmail, + 'backup', + true, + { targets: {}, txes: [] }, + wsUrl, + null, + false, + new Map(), + new Map(), + pipeline.context.modelDb + ) + ctx.contextData = contextData await handleWsEvent?.('upgrade-started', version, 0) await upgradeModel( @@ -322,9 +324,10 @@ export async function upgradeWorkspace ( } catch (err: any) { ctx.error('upgrade-failed', { message: err.message }) await handleWsEvent?.('ping', version, 0, `Upgrade failed: ${err.message}`) + throw err } finally { - await pipeline.close() - await storageAdapter.close() + await pipeline?.close() + await storageAdapter?.close() clearInterval(updateProgressHandle) } } diff --git a/services/ai-bot/pod-ai-bot/package.json b/services/ai-bot/pod-ai-bot/package.json index 5524a6ea9c..b1932b3be9 100644 --- a/services/ai-bot/pod-ai-bot/package.json +++ b/services/ai-bot/pod-ai-bot/package.json @@ -79,7 +79,7 @@ "express": "^4.19.2", "fast-equals": "^5.0.1", "form-data": "^4.0.0", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "node-fetch": "^2.6.6", "openai": "^4.56.0", "tiktoken": "^1.0.16", diff --git a/services/analytics-collector/pod-analytics-collector/package.json b/services/analytics-collector/pod-analytics-collector/package.json index 4cf7c44b44..f9fc40769f 100644 --- a/services/analytics-collector/pod-analytics-collector/package.json +++ b/services/analytics-collector/pod-analytics-collector/package.json @@ -101,7 +101,7 @@ "cors": "^2.8.5", "dotenv": "~16.0.0", "express": "^4.19.2", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "puppeteer": "^22.6.1", "ws": "^8.18.0" } diff --git a/services/calendar/pod-calendar/package.json b/services/calendar/pod-calendar/package.json index 85cd48949f..79ebaa0d4f 100644 --- a/services/calendar/pod-calendar/package.json +++ b/services/calendar/pod-calendar/package.json @@ -73,7 +73,7 @@ "googleapis": "^122.0.0", "google-auth-library": "^8.0.2", "jwt-simple": "^0.5.6", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "ws": "^8.18.0" } } diff --git a/services/github/pod-github/package.json b/services/github/pod-github/package.json index e0e86a8768..d90ba5bad3 100644 --- a/services/github/pod-github/package.json +++ b/services/github/pod-github/package.json @@ -113,7 +113,7 @@ "express": "^4.19.2", "cors": "^2.8.5", "body-parser": "^1.20.2", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "@hcengineering/setting": "^0.6.17", "@hcengineering/preference": "^0.6.13", "@hcengineering/login": "^0.6.12", diff --git a/services/gmail/pod-gmail/package.json b/services/gmail/pod-gmail/package.json index 9a18167297..d31077f9b2 100644 --- a/services/gmail/pod-gmail/package.json +++ b/services/gmail/pod-gmail/package.json @@ -76,7 +76,7 @@ "google-auth-library": "^8.0.2", "gaxios": "^5.0.1", "jwt-simple": "^0.5.6", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "ws": "^8.18.0", "uuid": "^8.3.2" } diff --git a/services/sign/pod-sign/package.json b/services/sign/pod-sign/package.json index 4b6549bcf0..477f5362b3 100644 --- a/services/sign/pod-sign/package.json +++ b/services/sign/pod-sign/package.json @@ -72,6 +72,6 @@ "node-forge": "^1.3.1", "pdf-lib": "^1.12.0", "ws": "^8.18.0", - "mongodb": "^6.8.0" + "mongodb": "^6.9.0" } } diff --git a/services/telegram-bot/pod-telegram-bot/package.json b/services/telegram-bot/pod-telegram-bot/package.json index 721c82ead9..032ab01960 100644 --- a/services/telegram-bot/pod-telegram-bot/package.json +++ b/services/telegram-bot/pod-telegram-bot/package.json @@ -79,7 +79,7 @@ "dotenv": "~16.0.0", "express": "^4.19.2", "htmlparser2": "^9.0.0", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "node-fetch": "^2.6.6", "otp-generator": "^4.0.1", "telegraf": "^4.16.3", diff --git a/services/telegram/pod-telegram/package.json b/services/telegram/pod-telegram/package.json index e9261ea4ee..2a4094a8cb 100644 --- a/services/telegram/pod-telegram/package.json +++ b/services/telegram/pod-telegram/package.json @@ -76,7 +76,7 @@ "htmlparser2": "^9.0.0", "jwt-simple": "^0.5.6", "mime": "^3.0.0", - "mongodb": "^6.8.0", + "mongodb": "^6.9.0", "telegram": "2.22.2", "ws": "^8.18.0", "uuid": "^8.3.2"