mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
ci: speedup ci by reduce installation packages in certain job (#4457)
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user