From 6af849e87594e4b3615cf3f1ef61cb47d924dec3 Mon Sep 17 00:00:00 2001
From: renovate <29139614+renovate@users.noreply.github.com>
Date: Thu, 25 Apr 2024 07:32:48 +0000
Subject: [PATCH 1/3] chore: bump up supertest version to v7 (#6690)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [supertest](https://togithub.com/ladjs/supertest) | [`^6.3.4` -> `^7.0.0`](https://renovatebot.com/diffs/npm/supertest/6.3.4/7.0.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
ladjs/supertest (supertest)
### [`v7.0.0`](https://togithub.com/ladjs/supertest/releases/tag/v7.0.0)
[Compare Source](https://togithub.com/ladjs/supertest/compare/v6.3.4...v7.0.0)
- Merge pull request [#834](https://togithub.com/ladjs/supertest/issues/834) from Bruception/master [`225118c`](https://togithub.com/ladjs/supertest/commit/225118c)
- Fix TestAgent not inheriting Agent properties [`f290431`](https://togithub.com/ladjs/supertest/commit/f290431)
- fix: bump deps, drop Node.js v<14.16.0 [`1e18c20`](https://togithub.com/ladjs/supertest/commit/1e18c20)
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
â™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE).
---
packages/backend/server/package.json | 2 +-
yarn.lock | 31 ++++++++++++++--------------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/packages/backend/server/package.json b/packages/backend/server/package.json
index f745c53117..f48064a5ea 100644
--- a/packages/backend/server/package.json
+++ b/packages/backend/server/package.json
@@ -118,7 +118,7 @@
"c8": "^9.1.0",
"nodemon": "^3.1.0",
"sinon": "^17.0.1",
- "supertest": "^6.3.4"
+ "supertest": "^7.0.0"
},
"ava": {
"timeout": "1m",
diff --git a/yarn.lock b/yarn.lock
index 539f2f5bd7..8ab7f61706 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -740,7 +740,7 @@ __metadata:
sinon: "npm:^17.0.1"
socket.io: "npm:^4.7.5"
stripe: "npm:^15.0.0"
- supertest: "npm:^6.3.4"
+ supertest: "npm:^7.0.0"
tiktoken: "npm:^1.0.13"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
@@ -22847,15 +22847,14 @@ __metadata:
languageName: node
linkType: hard
-"formidable@npm:^2.1.2":
- version: 2.1.2
- resolution: "formidable@npm:2.1.2"
+"formidable@npm:^3.5.1":
+ version: 3.5.1
+ resolution: "formidable@npm:3.5.1"
dependencies:
dezalgo: "npm:^1.0.4"
hexoid: "npm:^1.0.0"
once: "npm:^1.4.0"
- qs: "npm:^6.11.0"
- checksum: 10/d385180e0461f65e6f7b70452859fe1c32aa97a290c2ca33f00cdc33145ef44fa68bbc9b93af2c3af73ae726e42c3477c6619c49f3c34b49934e9481275b7b4c
+ checksum: 10/c9a7bbbd4ca8142893da88b51cf7797adee022344ea180cf157a108bf999bed5ad8bc07a10a28d8a39fcbfaa02e8cba07f4ba336fbeb330deb23907336ba1fc2
languageName: node
linkType: hard
@@ -34751,21 +34750,21 @@ __metadata:
languageName: node
linkType: hard
-"superagent@npm:^8.1.2":
- version: 8.1.2
- resolution: "superagent@npm:8.1.2"
+"superagent@npm:^9.0.1":
+ version: 9.0.1
+ resolution: "superagent@npm:9.0.1"
dependencies:
component-emitter: "npm:^1.3.0"
cookiejar: "npm:^2.1.4"
debug: "npm:^4.3.4"
fast-safe-stringify: "npm:^2.1.1"
form-data: "npm:^4.0.0"
- formidable: "npm:^2.1.2"
+ formidable: "npm:^3.5.1"
methods: "npm:^1.1.2"
mime: "npm:2.6.0"
qs: "npm:^6.11.0"
semver: "npm:^7.3.8"
- checksum: 10/33d0072e051baf91c7d68131c70682a0650dd1bd0b8dfb6f88e5bdfcb02e18cc2b42a66e44b32fd405ac6bcf5fd57c6e267bf80e2a8ce57a18166a9d3a78f57d
+ checksum: 10/a6e7cd5b93aa51b297cc66ede2f08c5143d4645d3ec424f9ee45dd890e6ba33637e63ce0d724c2a9536f83a8d913c0e0a52575fd9c02e0043a5a7d61708a0a45
languageName: node
linkType: hard
@@ -34781,13 +34780,13 @@ __metadata:
languageName: node
linkType: hard
-"supertest@npm:^6.3.4":
- version: 6.3.4
- resolution: "supertest@npm:6.3.4"
+"supertest@npm:^7.0.0":
+ version: 7.0.0
+ resolution: "supertest@npm:7.0.0"
dependencies:
methods: "npm:^1.1.2"
- superagent: "npm:^8.1.2"
- checksum: 10/93015318f5a90398915a032747973d9eacf9aebec3f07b413eba9d8b3db83ff48fbf6f5a92f9526578cae50153b0f76a37de197141030d856db4371a711b86ee
+ superagent: "npm:^9.0.1"
+ checksum: 10/73bf2a37e13856a1b3e6a37b9df5cec8e506aa0360a5f5ecd989d1f4b0edf168883e306012e81e371d5252c17d4c7bef4ba30633dbf3877cbf52fc7af51cca9b
languageName: node
linkType: hard
From 74b7d024be94019da90455df8c42ce64988f3611 Mon Sep 17 00:00:00 2001
From: dependabot <49699333+dependabot@users.noreply.github.com>
Date: Thu, 25 Apr 2024 07:47:47 +0000
Subject: [PATCH 2/3] chore(deps): bump rustls from 0.21.10 to 0.21.11 (#6683)
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.10 to 0.21.11.
Commits
7b8d1db Prepare 0.21.11
ebcb478 complete_io: bail out if progress is impossible
20f35df Regression test for complete_io infinite loop bug
2f2aae1 Don't specially handle unauthenticated close_notify alerts
e163587 Don't deny warnings from nightly clippy
9f86487 server::handy: fix new nightly clippy lint
7e0e8ab Correct assorted clippy warnings in test code
3587d98 Apply clippy suggestions from Rust 1.72
d082e83 Address clippy::redundant_static_lifetimes
5e7a06c Address clippy::slow_vector_initialization
- Additional commits viewable in compare view
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/toeverything/AFFiNE/network/alerts).
---
Cargo.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 5326a95155..c1451a34f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -823,7 +823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
- "windows-targets 0.52.5",
+ "windows-targets 0.48.5",
]
[[package]]
@@ -1393,9 +1393,9 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.21.10"
+version = "0.21.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
+checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
dependencies = [
"ring",
"rustls-webpki",
From ea3f42791823f46d9e610a9eade17f8b9580c1f7 Mon Sep 17 00:00:00 2001
From: darkskygit
Date: Thu, 25 Apr 2024 08:33:20 +0000
Subject: [PATCH 3/3] fix: large transaction (#6695)
---
.../src/data/migrations/utils/prompts.ts | 60 ++++++-------
.../src/data/migrations/utils/user-quotas.ts | 90 ++++++++++---------
2 files changed, 77 insertions(+), 73 deletions(-)
diff --git a/packages/backend/server/src/data/migrations/utils/prompts.ts b/packages/backend/server/src/data/migrations/utils/prompts.ts
index aaa6d5ba00..95d1f13497 100644
--- a/packages/backend/server/src/data/migrations/utils/prompts.ts
+++ b/packages/backend/server/src/data/migrations/utils/prompts.ts
@@ -593,37 +593,35 @@ export const prompts: Prompt[] = [
];
export async function refreshPrompts(db: PrismaClient) {
- await db.$transaction(async tx => {
- for (const prompt of prompts) {
- await tx.aiPrompt.upsert({
- create: {
- name: prompt.name,
- action: prompt.action,
- model: prompt.model,
- messages: {
- create: prompt.messages.map((message, idx) => ({
- idx,
- role: message.role,
- content: message.content,
- params: message.params,
- })),
- },
+ for (const prompt of prompts) {
+ await db.aiPrompt.upsert({
+ create: {
+ name: prompt.name,
+ action: prompt.action,
+ model: prompt.model,
+ messages: {
+ create: prompt.messages.map((message, idx) => ({
+ idx,
+ role: message.role,
+ content: message.content,
+ params: message.params,
+ })),
},
- where: { name: prompt.name },
- update: {
- action: prompt.action,
- model: prompt.model,
- messages: {
- deleteMany: {},
- create: prompt.messages.map((message, idx) => ({
- idx,
- role: message.role,
- content: message.content,
- params: message.params,
- })),
- },
+ },
+ where: { name: prompt.name },
+ update: {
+ action: prompt.action,
+ model: prompt.model,
+ messages: {
+ deleteMany: {},
+ create: prompt.messages.map((message, idx) => ({
+ idx,
+ role: message.role,
+ content: message.content,
+ params: message.params,
+ })),
},
- });
- }
- });
+ },
+ });
+ }
}
diff --git a/packages/backend/server/src/data/migrations/utils/user-quotas.ts b/packages/backend/server/src/data/migrations/utils/user-quotas.ts
index 7a8c5f9677..3c7d9d0201 100644
--- a/packages/backend/server/src/data/migrations/utils/user-quotas.ts
+++ b/packages/backend/server/src/data/migrations/utils/user-quotas.ts
@@ -13,56 +13,62 @@ export async function upgradeQuotaVersion(
// add new quota
await upsertFeature(db, quota);
// migrate all users that using old quota to new quota
- await db.$transaction(async tx => {
- const latestQuotaVersion = await tx.features.findFirstOrThrow({
- where: { feature: quota.feature },
- orderBy: { version: 'desc' },
- select: { id: true },
- });
+ await db.$transaction(
+ async tx => {
+ const latestQuotaVersion = await tx.features.findFirstOrThrow({
+ where: { feature: quota.feature },
+ orderBy: { version: 'desc' },
+ select: { id: true },
+ });
- // find all users that have old free plan
- const userIds = await tx.user.findMany({
- where: {
- features: {
- some: {
- feature: {
- type: FeatureKind.Quota,
- feature: quota.feature,
- version: { lt: quota.version },
+ // find all users that have old free plan
+ const userIds = await tx.user.findMany({
+ where: {
+ features: {
+ some: {
+ feature: {
+ type: FeatureKind.Quota,
+ feature: quota.feature,
+ version: { lt: quota.version },
+ },
+ activated: true,
},
- activated: true,
},
},
- },
- select: { id: true },
- });
+ select: { id: true },
+ });
- // deactivate all old quota for the user
- await tx.userFeatures.updateMany({
- where: {
- id: undefined,
- userId: {
- in: userIds.map(({ id }) => id),
+ // deactivate all old quota for the user
+ await tx.userFeatures.updateMany({
+ where: {
+ id: undefined,
+ userId: {
+ in: userIds.map(({ id }) => id),
+ },
+ feature: {
+ type: FeatureKind.Quota,
+ },
+ activated: true,
},
- feature: {
- type: FeatureKind.Quota,
+ data: {
+ activated: false,
},
- activated: true,
- },
- data: {
- activated: false,
- },
- });
+ });
- await tx.userFeatures.createMany({
- data: userIds.map(({ id: userId }) => ({
- userId,
- featureId: latestQuotaVersion.id,
- reason,
- activated: true,
- })),
- });
- });
+ await tx.userFeatures.createMany({
+ data: userIds.map(({ id: userId }) => ({
+ userId,
+ featureId: latestQuotaVersion.id,
+ reason,
+ activated: true,
+ })),
+ });
+ },
+ {
+ maxWait: 10000,
+ timeout: 20000,
+ }
+ );
}
export async function upsertLatestQuotaVersion(