mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
ci: speedup ci by reduce installation packages in certain job (#4457)
This commit is contained in:
@@ -266,7 +266,6 @@ export const createConfiguration: (
|
||||
useDefineForClassFields: false,
|
||||
},
|
||||
experimental: {
|
||||
keepImportAssertions: true,
|
||||
plugins: [
|
||||
buildFlags.coverage && [
|
||||
'swc-plugin-coverage-instrument',
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
"async-call-rpc": "^6.3.1",
|
||||
"css-spring": "^4.1.0",
|
||||
"cssnano": "^6.0.1",
|
||||
"graphql": "^16.8.0",
|
||||
"graphql": "^16.8.1",
|
||||
"intl-segmenter-polyfill-rs": "^0.1.6",
|
||||
"jotai": "^2.4.1",
|
||||
"jotai": "^2.4.2",
|
||||
"jotai-devtools": "^0.6.2",
|
||||
"lit": "^2.8.0",
|
||||
"lottie-web": "^5.12.2",
|
||||
"mini-css-extract-plugin": "^2.7.6",
|
||||
"next-auth": "^4.22.1",
|
||||
"next-auth": "^4.23.1",
|
||||
"next-themes": "^0.2.1",
|
||||
"postcss-loader": "^7.3.3",
|
||||
"react": "18.2.0",
|
||||
@@ -63,17 +63,17 @@
|
||||
"ses": "^0.18.8",
|
||||
"swr": "2.2.0",
|
||||
"valtio": "^1.11.2",
|
||||
"y-protocols": "^1.0.5",
|
||||
"y-protocols": "^1.0.6",
|
||||
"yjs": "^13.6.8",
|
||||
"zod": "^3.22.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-sdk/client-s3": "3.400.0",
|
||||
"@aws-sdk/client-s3": "3.418.0",
|
||||
"@perfsee/webpack": "^1.8.4",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
||||
"@sentry/webpack-plugin": "^2.7.0",
|
||||
"@sentry/webpack-plugin": "^2.7.1",
|
||||
"@svgr/webpack": "^8.1.0",
|
||||
"@swc/core": "^1.3.81",
|
||||
"@swc/core": "^1.3.87",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
"@types/webpack-env": "^1.18.1",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
const path = require('node:path');
|
||||
const { rm, symlink } = require('node:fs/promises');
|
||||
|
||||
const {
|
||||
utils: { fromBuildIdentifier },
|
||||
} = require('@electron-forge/core');
|
||||
|
||||
const path = require('node:path');
|
||||
|
||||
const {
|
||||
arch,
|
||||
buildType,
|
||||
@@ -25,7 +26,7 @@ const makers = [
|
||||
icon: icnsPath,
|
||||
name: 'AFFiNE',
|
||||
'icon-size': 128,
|
||||
background: path.resolve(
|
||||
background: path.join(
|
||||
__dirname,
|
||||
'./resources/icons/dmg-background.png'
|
||||
),
|
||||
@@ -34,7 +35,7 @@ const makers = [
|
||||
x: 176,
|
||||
y: 192,
|
||||
type: 'file',
|
||||
path: path.resolve(
|
||||
path: path.join(
|
||||
__dirname,
|
||||
'out',
|
||||
buildType,
|
||||
@@ -45,7 +46,7 @@ const makers = [
|
||||
{ x: 432, y: 192, type: 'link', path: '/Applications' },
|
||||
],
|
||||
iconSize: 118,
|
||||
file: path.resolve(
|
||||
file: path.join(
|
||||
__dirname,
|
||||
'out',
|
||||
buildType,
|
||||
@@ -129,35 +130,14 @@ module.exports = {
|
||||
packageJson.productName = productName;
|
||||
},
|
||||
prePackage: async () => {
|
||||
const { rm, cp } = require('node:fs/promises');
|
||||
const { resolve } = require('node:path');
|
||||
|
||||
await rm(resolve(__dirname, './node_modules/@toeverything/infra'), {
|
||||
await rm(path.join(__dirname, 'node_modules'), {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
|
||||
await cp(
|
||||
resolve(__dirname, '../../packages/infra'),
|
||||
resolve(__dirname, './node_modules/@toeverything/infra'),
|
||||
{
|
||||
recursive: true,
|
||||
force: true,
|
||||
}
|
||||
);
|
||||
|
||||
await rm(resolve(__dirname, './node_modules/@affine/sdk'), {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
|
||||
await cp(
|
||||
resolve(__dirname, '../../packages/sdk'),
|
||||
resolve(__dirname, './node_modules/@affine/sdk'),
|
||||
{
|
||||
recursive: true,
|
||||
force: true,
|
||||
}
|
||||
await symlink(
|
||||
path.join(__dirname, '..', '..', 'node_modules'),
|
||||
path.join(__dirname, 'node_modules')
|
||||
);
|
||||
},
|
||||
generateAssets: async (_, platform, arch) => {
|
||||
|
||||
@@ -26,46 +26,53 @@
|
||||
"main": "./dist/main.js",
|
||||
"devDependencies": {
|
||||
"@affine-test/kit": "workspace:*",
|
||||
"@affine/bookmark-plugin": "workspace:*",
|
||||
"@affine/copilot-plugin": "workspace:*",
|
||||
"@affine/env": "workspace:*",
|
||||
"@affine/hello-world-plugin": "workspace:*",
|
||||
"@affine/image-preview-plugin": "workspace:*",
|
||||
"@affine/native": "workspace:*",
|
||||
"@affine/outline-plugin": "workspace:*",
|
||||
"@affine/sdk": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@affine/vue-hello-world-plugin": "workspace:*",
|
||||
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@electron-forge/cli": "^6.4.1",
|
||||
"@electron-forge/core": "^6.4.1",
|
||||
"@electron-forge/core-utils": "^6.4.1",
|
||||
"@electron-forge/maker-deb": "^6.4.1",
|
||||
"@electron-forge/maker-squirrel": "^6.4.1",
|
||||
"@electron-forge/maker-zip": "^6.4.1",
|
||||
"@electron-forge/shared-types": "^6.4.1",
|
||||
"@electron-forge/cli": "^6.4.2",
|
||||
"@electron-forge/core": "^6.4.2",
|
||||
"@electron-forge/core-utils": "^6.4.2",
|
||||
"@electron-forge/maker-deb": "^6.4.2",
|
||||
"@electron-forge/maker-squirrel": "^6.4.2",
|
||||
"@electron-forge/maker-zip": "^6.4.2",
|
||||
"@electron-forge/shared-types": "^6.4.2",
|
||||
"@electron/remote": "2.0.11",
|
||||
"@reforged/maker-appimage": "^3.3.1",
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"@types/uuid": "^9.0.3",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"cross-env": "7.0.3",
|
||||
"electron": "^26.2.1",
|
||||
"electron-log": "^5.0.0-beta.28",
|
||||
"electron": "^26.2.2",
|
||||
"electron-log": "^5.0.0-beta.29",
|
||||
"electron-squirrel-startup": "1.0.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"esbuild": "^0.19.2",
|
||||
"esbuild": "^0.19.3",
|
||||
"fs-extra": "^11.1.1",
|
||||
"glob": "^10.3.4",
|
||||
"jotai": "^2.4.1",
|
||||
"glob": "^10.3.5",
|
||||
"jotai": "^2.4.2",
|
||||
"lodash-es": "^4.17.21",
|
||||
"rxjs": "^7.8.1",
|
||||
"tinykeys": "^2.1.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"undici": "^5.23.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vitest": "0.33.0",
|
||||
"undici": "^5.25.2",
|
||||
"uuid": "^9.0.1",
|
||||
"vitest": "0.34.5",
|
||||
"which": "^4.0.0",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"async-call-rpc": "^6.3.1",
|
||||
"electron-updater": "^6.1.4",
|
||||
"electron-updater": "^6.1.5",
|
||||
"link-preview-js": "^3.0.5",
|
||||
"nanoid": "^4.0.2",
|
||||
"yjs": "^13.6.8"
|
||||
@@ -81,9 +88,6 @@
|
||||
]
|
||||
},
|
||||
"stableVersion": "0.5.3",
|
||||
"installConfig": {
|
||||
"hoistingLimits": "workspaces"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ts-node": "*"
|
||||
}
|
||||
|
||||
@@ -46,13 +46,21 @@ export async function getWorkspaceMeta(
|
||||
try {
|
||||
const basePath = await getWorkspaceBasePath(workspaceId);
|
||||
const metaPath = await getWorkspaceMetaPath(workspaceId);
|
||||
if (!(await fs.exists(metaPath))) {
|
||||
if (
|
||||
!(await fs
|
||||
.access(metaPath)
|
||||
.then(() => true)
|
||||
.catch(() => false))
|
||||
) {
|
||||
// since not meta is found, we will migrate symlinked db file if needed
|
||||
await fs.ensureDir(basePath);
|
||||
const dbPath = await getWorkspaceDBPath(workspaceId);
|
||||
|
||||
// todo: remove this after migration (in stable version)
|
||||
const realDBPath = (await fs.exists(dbPath))
|
||||
const realDBPath = (await fs
|
||||
.access(dbPath)
|
||||
.then(() => true)
|
||||
.catch(() => false))
|
||||
? await fs.realpath(dbPath)
|
||||
: dbPath;
|
||||
const isLink = realDBPath !== dbPath;
|
||||
|
||||
@@ -17,76 +17,76 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/server": "^4.9.3",
|
||||
"@auth/prisma-adapter": "^1.0.1",
|
||||
"@aws-sdk/client-s3": "^3.400.0",
|
||||
"@auth/prisma-adapter": "^1.0.2",
|
||||
"@aws-sdk/client-s3": "^3.418.0",
|
||||
"@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.17.0",
|
||||
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0",
|
||||
"@keyv/redis": "^2.7.0",
|
||||
"@nestjs/apollo": "^12.0.7",
|
||||
"@nestjs/common": "^10.2.4",
|
||||
"@nestjs/core": "^10.2.4",
|
||||
"@nestjs/graphql": "^12.0.8",
|
||||
"@nestjs/platform-express": "^10.2.4",
|
||||
"@nestjs/platform-socket.io": "^10.2.4",
|
||||
"@nestjs/throttler": "^4.2.1",
|
||||
"@nestjs/websockets": "^10.2.4",
|
||||
"@keyv/redis": "^2.7.1",
|
||||
"@nestjs/apollo": "^12.0.9",
|
||||
"@nestjs/common": "^10.2.6",
|
||||
"@nestjs/core": "^10.2.6",
|
||||
"@nestjs/graphql": "^12.0.9",
|
||||
"@nestjs/platform-express": "^10.2.6",
|
||||
"@nestjs/platform-socket.io": "^10.2.6",
|
||||
"@nestjs/throttler": "^5.0.0",
|
||||
"@nestjs/websockets": "^10.2.6",
|
||||
"@node-rs/argon2": "^1.5.2",
|
||||
"@node-rs/crc32": "^1.7.2",
|
||||
"@node-rs/jsonwebtoken": "^0.2.3",
|
||||
"@opentelemetry/api": "^1.4.1",
|
||||
"@opentelemetry/instrumentation": "^0.41.2",
|
||||
"@opentelemetry/api": "^1.6.0",
|
||||
"@opentelemetry/instrumentation": "^0.43.0",
|
||||
"@opentelemetry/instrumentation-graphql": "^0.35.1",
|
||||
"@opentelemetry/instrumentation-http": "^0.41.2",
|
||||
"@opentelemetry/instrumentation-http": "^0.43.0",
|
||||
"@opentelemetry/instrumentation-ioredis": "^0.35.1",
|
||||
"@opentelemetry/instrumentation-nestjs-core": "^0.33.1",
|
||||
"@opentelemetry/instrumentation-socket.io": "^0.34.1",
|
||||
"@opentelemetry/sdk-metrics": "^1.15.2",
|
||||
"@opentelemetry/sdk-node": "^0.41.2",
|
||||
"@opentelemetry/sdk-trace-node": "^1.15.2",
|
||||
"@prisma/client": "^5.2.0",
|
||||
"@prisma/instrumentation": "^5.2.0",
|
||||
"@opentelemetry/sdk-metrics": "^1.17.0",
|
||||
"@opentelemetry/sdk-node": "^0.43.0",
|
||||
"@opentelemetry/sdk-trace-node": "^1.17.0",
|
||||
"@prisma/client": "^5.3.1",
|
||||
"@prisma/instrumentation": "^5.3.1",
|
||||
"@socket.io/redis-adapter": "^8.2.1",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"file-type": "^18.5.0",
|
||||
"get-stream": "^8.0.1",
|
||||
"graphql": "^16.8.0",
|
||||
"graphql": "^16.8.1",
|
||||
"graphql-type-json": "^0.3.2",
|
||||
"graphql-upload": "^16.0.2",
|
||||
"ioredis": "^5.3.2",
|
||||
"keyv": "^4.5.3",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nanoid": "^4.0.2",
|
||||
"nestjs-throttler-storage-redis": "^0.4.0",
|
||||
"next-auth": "4.22.5",
|
||||
"nodemailer": "^6.9.4",
|
||||
"nestjs-throttler-storage-redis": "^0.4.1",
|
||||
"next-auth": "4.23.1",
|
||||
"nodemailer": "^6.9.5",
|
||||
"on-headers": "^1.0.2",
|
||||
"parse-duration": "^1.1.0",
|
||||
"pretty-time": "^1.1.0",
|
||||
"prisma": "^5.2.0",
|
||||
"prisma": "^5.3.1",
|
||||
"prom-client": "^14.2.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.8.1",
|
||||
"semver": "^7.5.4",
|
||||
"socket.io": "^4.7.2",
|
||||
"ws": "^8.13.0",
|
||||
"ws": "^8.14.2",
|
||||
"yjs": "^13.6.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@affine-test/kit": "workspace:*",
|
||||
"@affine/storage": "workspace:*",
|
||||
"@napi-rs/image": "^1.6.1",
|
||||
"@nestjs/testing": "^10.2.4",
|
||||
"@nestjs/testing": "^10.2.6",
|
||||
"@types/cookie-parser": "^1.4.4",
|
||||
"@types/engine.io": "^3.1.7",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/graphql-upload": "^16.0.1",
|
||||
"@types/graphql-upload": "^16.0.2",
|
||||
"@types/keyv": "^4.2.0",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
"@types/node": "^18.17.12",
|
||||
"@types/nodemailer": "^6.4.9",
|
||||
"@types/on-headers": "^1.0.0",
|
||||
"@types/node": "^18.17.18",
|
||||
"@types/nodemailer": "^6.4.10",
|
||||
"@types/on-headers": "^1.0.1",
|
||||
"@types/pretty-time": "^1.1.2",
|
||||
"@types/sinon": "^10.0.16",
|
||||
"@types/supertest": "^2.0.12",
|
||||
@@ -103,7 +103,9 @@
|
||||
"extensions": {
|
||||
"ts": "module"
|
||||
},
|
||||
"workerThreads": false,
|
||||
"nodeArguments": [
|
||||
"--trace-sigint",
|
||||
"--loader",
|
||||
"ts-node/esm/transpile-only.mjs",
|
||||
"--es-module-specifier-resolution",
|
||||
|
||||
@@ -81,7 +81,6 @@ export const NextAuthOptionsProvider: FactoryProvider<NextAuthOptions> = {
|
||||
sendVerificationRequest(config, logger, mailer, session, params),
|
||||
}),
|
||||
],
|
||||
// @ts-expect-error Third part library type mismatch
|
||||
adapter: prismaAdapter,
|
||||
debug: !config.node.prod,
|
||||
session: {
|
||||
|
||||
@@ -50,7 +50,12 @@ export class NextAuthController {
|
||||
}
|
||||
|
||||
@UseGuards(AuthThrottlerGuard)
|
||||
@Throttle(60, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 60,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@All('*')
|
||||
async auth(
|
||||
@Req() req: Request,
|
||||
|
||||
@@ -50,7 +50,12 @@ export class AuthResolver {
|
||||
private readonly session: SessionService
|
||||
) {}
|
||||
|
||||
@Throttle(20, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 20,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@ResolveField(() => TokenType)
|
||||
async token(
|
||||
@Context() ctx: { req: Request },
|
||||
@@ -82,7 +87,12 @@ export class AuthResolver {
|
||||
};
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => UserType)
|
||||
async signUp(
|
||||
@Context() ctx: { req: Request },
|
||||
@@ -95,7 +105,12 @@ export class AuthResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => UserType)
|
||||
async signIn(
|
||||
@Context() ctx: { req: Request },
|
||||
@@ -107,7 +122,12 @@ export class AuthResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => UserType)
|
||||
@Auth()
|
||||
async changePassword(
|
||||
@@ -126,7 +146,12 @@ export class AuthResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => UserType)
|
||||
@Auth()
|
||||
async changeEmail(
|
||||
@@ -147,7 +172,12 @@ export class AuthResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => Boolean)
|
||||
@Auth()
|
||||
async sendChangePasswordEmail(
|
||||
@@ -165,7 +195,12 @@ export class AuthResolver {
|
||||
return !res.rejected.length;
|
||||
}
|
||||
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => Boolean)
|
||||
@Auth()
|
||||
async sendSetPasswordEmail(
|
||||
@@ -190,7 +225,12 @@ export class AuthResolver {
|
||||
// 4. user open confirm email page from new email
|
||||
// 5. user click confirm button
|
||||
// 6. send notification email
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => Boolean)
|
||||
@Auth()
|
||||
async sendChangeEmail(
|
||||
@@ -208,7 +248,12 @@ export class AuthResolver {
|
||||
return !res.rejected.length;
|
||||
}
|
||||
|
||||
@Throttle(5, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 5,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => Boolean)
|
||||
@Auth()
|
||||
async sendVerifyChangeEmail(
|
||||
|
||||
@@ -91,7 +91,12 @@ export class UserResolver {
|
||||
private readonly users: UsersService
|
||||
) {}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Query(() => UserType, {
|
||||
name: 'currentUser',
|
||||
description: 'Get current user',
|
||||
@@ -112,7 +117,12 @@ export class UserResolver {
|
||||
};
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Query(() => UserType, {
|
||||
name: 'user',
|
||||
description: 'Get user by email',
|
||||
@@ -140,7 +150,12 @@ export class UserResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => UserType, {
|
||||
name: 'uploadAvatar',
|
||||
description: 'Upload user avatar',
|
||||
@@ -160,7 +175,12 @@ export class UserResolver {
|
||||
});
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => RemoveAvatar, {
|
||||
name: 'removeAvatar',
|
||||
description: 'Remove user avatar',
|
||||
@@ -176,14 +196,24 @@ export class UserResolver {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => DeleteAccount)
|
||||
async deleteAccount(@CurrentUser() user: UserType): Promise<DeleteAccount> {
|
||||
await this.users.deleteUser(user.id);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@Throttle(10, 60)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 60,
|
||||
},
|
||||
})
|
||||
@Mutation(() => AddToNewFeaturesWaitingList)
|
||||
async addToNewFeaturesWaitingList(
|
||||
@CurrentUser() user: UserType,
|
||||
|
||||
@@ -282,7 +282,12 @@ export class WorkspaceResolver {
|
||||
});
|
||||
}
|
||||
|
||||
@Throttle(10, 30)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 30,
|
||||
},
|
||||
})
|
||||
@Public()
|
||||
@Query(() => WorkspaceType, {
|
||||
description: 'Get public workspace by id',
|
||||
@@ -515,7 +520,12 @@ export class WorkspaceResolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Throttle(10, 30)
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
ttl: 30,
|
||||
},
|
||||
})
|
||||
@Public()
|
||||
@Query(() => InvitationType, {
|
||||
description: 'Update workspace',
|
||||
|
||||
@@ -20,8 +20,12 @@ import { getRequestResponseFromContext } from './utils/nestjs';
|
||||
inject: [Config],
|
||||
useFactory: (config: Config): ThrottlerModuleOptions => {
|
||||
const options: ThrottlerModuleOptions = {
|
||||
ttl: config.rateLimiter.ttl,
|
||||
limit: config.rateLimiter.limit,
|
||||
throttlers: [
|
||||
{
|
||||
ttl: config.rateLimiter.ttl,
|
||||
limit: config.rateLimiter.limit,
|
||||
},
|
||||
],
|
||||
skipIf: () => {
|
||||
return !config.node.prod || config.affine.canary;
|
||||
},
|
||||
@@ -49,8 +53,10 @@ export class CloudThrottlerGuard extends ThrottlerGuard {
|
||||
return getRequestResponseFromContext(context) as any;
|
||||
}
|
||||
|
||||
protected override getTracker(req: Record<string, any>): string {
|
||||
return req?.get('CF-Connecting-IP') ?? req?.get('CF-ray') ?? req?.ip;
|
||||
protected override getTracker(req: Record<string, any>): Promise<string> {
|
||||
return Promise.resolve(
|
||||
req?.get('CF-Connecting-IP') ?? req?.get('CF-ray') ?? req?.ip
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +71,16 @@ export class AuthThrottlerGuard extends CloudThrottlerGuard {
|
||||
|
||||
if (req?.url === '/api/auth/session') {
|
||||
// relax throttle for session auto renew
|
||||
return super.handleRequest(context, limit * 20, ttl);
|
||||
return super.handleRequest(context, limit * 20, ttl, {
|
||||
ttl: ttl * 20,
|
||||
limit: limit * 20,
|
||||
});
|
||||
}
|
||||
|
||||
return super.handleRequest(context, limit, ttl);
|
||||
return super.handleRequest(context, limit, ttl, {
|
||||
ttl,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import { Transformer } from '@napi-rs/image';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { hashSync } from '@node-rs/argon2';
|
||||
import { User } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import { Express } from 'express';
|
||||
import { type User } from '@prisma/client';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import type { Express } from 'express';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
import request from 'supertest';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
import { AppModule } from '../src/app';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mock } from 'node:test';
|
||||
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import test from 'ava';
|
||||
import { register } from 'prom-client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, INestApplication } from '@nestjs/common';
|
||||
import { Controller, Get, type INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import test from 'ava';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from '@affine-test/kit/utils/cloud';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
|
||||
import { ConfigModule } from '../src/config';
|
||||
import { GqlModule } from '../src/graphql.module';
|
||||
|
||||
@@ -3,8 +3,8 @@ import { randomUUID } from 'node:crypto';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { hashSync } from '@node-rs/argon2';
|
||||
import { User } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import { type User } from '@prisma/client';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
import { AppModule } from '../src/app';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
|
||||
import { ConfigModule } from '../src/config';
|
||||
import { SessionModule, SessionService } from '../src/session';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"target": "ESNext",
|
||||
@@ -7,6 +7,7 @@
|
||||
"experimentalDecorators": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "../lib/tests",
|
||||
"verbatimModuleSyntax": false,
|
||||
"tsBuildInfoFile": "../lib/tests/.tsbuildinfo"
|
||||
},
|
||||
"references": [
|
||||
|
||||
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';
|
||||
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { hashSync } from '@node-rs/argon2';
|
||||
import { PrismaClient, User } from '@prisma/client';
|
||||
import { PrismaClient, type User } from '@prisma/client';
|
||||
import request from 'supertest';
|
||||
|
||||
import type { TokenType } from '../src/modules/auth';
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
import { AppModule } from '../src/app';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import { stub } from 'sinon';
|
||||
|
||||
import { AppModule } from '../src/app';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import ava, { type TestFn } from 'ava';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
import request from 'supertest';
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"types": ["node"],
|
||||
"outDir": "dist",
|
||||
"noEmit": false,
|
||||
"tsBuildInfoFile": "./dist/.tsbuildinfo",
|
||||
"verbatimModuleSyntax": false,
|
||||
"rootDir": "./src"
|
||||
},
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@storybook/addon-actions": "^7.4.0",
|
||||
"@storybook/addon-essentials": "^7.4.0",
|
||||
"@storybook/addon-interactions": "^7.4.0",
|
||||
"@storybook/addon-links": "^7.4.0",
|
||||
"@storybook/addon-storysource": "^7.4.0",
|
||||
"@storybook/blocks": "^7.4.0",
|
||||
"@storybook/builder-vite": "^7.4.0",
|
||||
"@storybook/addon-actions": "^7.4.4",
|
||||
"@storybook/addon-essentials": "^7.4.4",
|
||||
"@storybook/addon-interactions": "^7.4.4",
|
||||
"@storybook/addon-links": "^7.4.4",
|
||||
"@storybook/addon-storysource": "^7.4.4",
|
||||
"@storybook/blocks": "^7.4.4",
|
||||
"@storybook/builder-vite": "^7.4.4",
|
||||
"@storybook/jest": "^0.2.2",
|
||||
"@storybook/react": "^7.4.0",
|
||||
"@storybook/react-vite": "^7.4.0",
|
||||
"@storybook/react": "^7.4.4",
|
||||
"@storybook/react-vite": "^7.4.4",
|
||||
"@storybook/test-runner": "^0.13.0",
|
||||
"@storybook/testing-library": "^0.2.0",
|
||||
"@storybook/testing-library": "^0.2.1",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"concurrently": "^8.2.1",
|
||||
"jest-mock": "^29.6.3",
|
||||
"jest-mock": "^29.7.0",
|
||||
"serve": "^14.2.1",
|
||||
"ses": "^0.18.8",
|
||||
"storybook": "^7.4.0",
|
||||
@@ -39,7 +39,7 @@
|
||||
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
|
||||
"@tomfreudenberg/next-auth-mock": "^0.5.6",
|
||||
"chromatic": "^6.24.1",
|
||||
"chromatic": "^7.2.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"storybook-addon-react-router-v6": "^2.0.7"
|
||||
|
||||
Reference in New Issue
Block a user