Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update NestJS and Fastify dependencies #36

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions apps/auth/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import './vault';

import fastifyCors from '@fastify/cors';
import { fastifyHelmet } from '@fastify/helmet';
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import {
Expand All @@ -17,7 +15,6 @@ import {
} from '@nestjs/swagger';
import {
bearerSecurityScheme,
getCookieOptions,
GLOBAL_API_PREFIX,
SecurityRequirements,
sessionSecurityScheme,
Expand Down Expand Up @@ -68,12 +65,6 @@ async function bootstrap(): Promise<void> {
},
},
});
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: getCookieOptions(environment),
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());
if (!proxyServerUrls.length && environment === 'production') {
await app.register(fastifyCors, {
origin: (origin, cb) => {
Expand Down
17 changes: 2 additions & 15 deletions apps/auth/test/users.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines-per-function */
/* eslint-disable sonarjs/no-duplicate-string */
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ConfigModule } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
import { MongooseModule } from '@nestjs/mongoose';
import {
Expand All @@ -15,7 +13,7 @@ import { loadEnv, validate } from '@ticketing/microservices/shared/env';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
import { UserCredentials } from '@ticketing/shared/models';

import { AppConfigService, EnvironmentVariables } from '../src/app/env';
import { EnvironmentVariables } from '../src/app/env';
import { UsersModule } from '../src/app/users/users.module';
import { envFilePath } from './constants';
import { signUpAndLogin } from './helpers';
Expand Down Expand Up @@ -47,17 +45,6 @@ describe('UsersController (e2e)', () => {

app = moduleFixture.createNestApplication(new FastifyAdapter());

const configService = app.get<AppConfigService>(ConfigService);
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: {
secure: false,
signed: false,
},
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());

await app.init();
});

Expand Down
8 changes: 4 additions & 4 deletions apps/expiration/src/app/orders/orders.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
type AmqpOptions,
AmqpClient,
} from '@getlarge/nestjs-tools-amqp-transport';
import { BullModule } from '@nestjs/bull';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
Expand All @@ -6,10 +10,6 @@ import {
CustomClientOptions,
Transport,
} from '@nestjs/microservices';
import {
type AmqpOptions,
AmqpClient,
} from '@s1seven/nestjs-tools-amqp-transport';
import { getReplyQueueName } from '@ticketing/microservices/shared/rmq';
import { Services } from '@ticketing/shared/constants';

Expand Down
3 changes: 2 additions & 1 deletion apps/expiration/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import './vault';
import 'reflect-metadata';

import { fastifyHelmet } from '@fastify/helmet';
import { AmqpOptions, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import type { CustomStrategy } from '@nestjs/microservices';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { AmqpOptions, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import { GLOBAL_API_PREFIX } from '@ticketing/microservices/shared/constants';
import { Services } from '@ticketing/shared/constants';
import { Logger } from 'nestjs-pino';
Expand Down
2 changes: 1 addition & 1 deletion apps/orders/src/app/orders/orders.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
OryRelationshipsModule,
} from '@getlarge/keto-client-wrapper';
import { OryFrontendModule } from '@getlarge/kratos-client-wrapper';
import { AmqpClient, AmqpOptions } from '@getlarge/nestjs-tools-amqp-transport';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
Expand All @@ -11,7 +12,6 @@ import {
CustomClientOptions,
Transport,
} from '@nestjs/microservices';
import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
import { getReplyQueueName } from '@ticketing/microservices/shared/rmq';
import { Services } from '@ticketing/shared/constants';
Expand Down
14 changes: 2 additions & 12 deletions apps/orders/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './vault';
import 'reflect-metadata';

import fastifyCors from '@fastify/cors';
import { fastifyHelmet } from '@fastify/helmet';
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { AmqpOptions, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { CustomStrategy } from '@nestjs/microservices';
Expand All @@ -16,10 +16,8 @@ import {
SwaggerCustomOptions,
SwaggerModule,
} from '@nestjs/swagger';
import { AmqpOptions, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import {
bearerSecurityScheme,
getCookieOptions,
GLOBAL_API_PREFIX,
SecurityRequirements,
sessionSecurityScheme,
Expand All @@ -40,8 +38,6 @@ async function bootstrap(): Promise<void> {
new FastifyAdapter({
trustProxy: true,
bodyLimit: 1048576,
// bodyLimit: +process.env.MAX_PAYLOAD_SIZE || 5,
// maxParamLength: 100,
}),
{ bufferLogs: true, abortOnError: false },
);
Expand Down Expand Up @@ -69,12 +65,6 @@ async function bootstrap(): Promise<void> {
},
},
});
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: getCookieOptions(environment),
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());
if (!proxyServerUrls.length && environment === 'development') {
await app.register(fastifyCors, {
origin: (origin, cb) => {
Expand Down
17 changes: 2 additions & 15 deletions apps/orders/test/orders.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines-per-function */
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ConfigModule } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
import { getModelToken, MongooseModule } from '@nestjs/mongoose';
import {
Expand All @@ -19,7 +17,7 @@ import {
} from '@ticketing/microservices/shared/testing';
import { Model, Types } from 'mongoose';

import { AppConfigService, EnvironmentVariables } from '../src/app/env';
import { EnvironmentVariables } from '../src/app/env';
import { CreateOrder, Order, OrderStatus } from '../src/app/orders/models';
import { OrdersModule } from '../src/app/orders/orders.module';
import { Order as OrderSchema, OrderDocument } from '../src/app/orders/schemas';
Expand Down Expand Up @@ -76,17 +74,6 @@ describe('OrdersController (e2e)', () => {

app = moduleFixture.createNestApplication(new FastifyAdapter());

const configService = app.get<AppConfigService>(ConfigService);
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: {
secure: false,
signed: false,
},
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());

orderModel = app.get<Model<OrderDocument>>(getModelToken(OrderSchema.name));
ticketModel = app.get<Model<TicketDocument>>(
getModelToken(TicketSchema.name),
Expand Down
2 changes: 1 addition & 1 deletion apps/orders/test/tickets-ms.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines-per-function */
import { AmqpClient, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { INestMicroservice } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { CustomStrategy } from '@nestjs/microservices';
Expand All @@ -9,7 +10,6 @@ import {
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { Test, TestingModule } from '@nestjs/testing';
import { AmqpClient, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import { loadEnv, validate } from '@ticketing/microservices/shared/env';
import { Patterns } from '@ticketing/microservices/shared/events';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
Expand Down
2 changes: 1 addition & 1 deletion apps/payments/src/app/payments/payments.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
OryRelationshipsModule,
} from '@getlarge/keto-client-wrapper';
import { OryFrontendModule } from '@getlarge/kratos-client-wrapper';
import { AmqpClient, AmqpOptions } from '@getlarge/nestjs-tools-amqp-transport';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
Expand All @@ -12,7 +13,6 @@ import {
Transport,
} from '@nestjs/microservices';
import { MongooseModule } from '@nestjs/mongoose';
import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
import { getReplyQueueName } from '@ticketing/microservices/shared/rmq';
import { Services } from '@ticketing/shared/constants';
Expand Down
14 changes: 2 additions & 12 deletions apps/payments/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './vault';
import 'reflect-metadata';

import fastifyCors from '@fastify/cors';
import { fastifyHelmet } from '@fastify/helmet';
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { AmqpOptions, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { CustomStrategy } from '@nestjs/microservices';
Expand All @@ -16,10 +16,8 @@ import {
SwaggerCustomOptions,
SwaggerModule,
} from '@nestjs/swagger';
import { AmqpOptions, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import {
bearerSecurityScheme,
getCookieOptions,
GLOBAL_API_PREFIX,
SecurityRequirements,
sessionSecurityScheme,
Expand All @@ -40,8 +38,6 @@ async function bootstrap(): Promise<void> {
new FastifyAdapter({
trustProxy: true,
bodyLimit: 1048576,
// bodyLimit: +process.env.MAX_PAYLOAD_SIZE || 5,
// maxParamLength: 100,
}),
{ bufferLogs: true, abortOnError: false },
);
Expand Down Expand Up @@ -69,12 +65,6 @@ async function bootstrap(): Promise<void> {
},
},
});
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: getCookieOptions(environment),
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());
if (!proxyServerUrls.length && environment === 'development') {
await app.register(fastifyCors, {
origin: (origin, cb) => {
Expand Down
17 changes: 2 additions & 15 deletions apps/payments/test/payments.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines-per-function */
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ConfigModule } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
import { getModelToken, MongooseModule } from '@nestjs/mongoose';
import {
Expand All @@ -19,7 +17,7 @@ import {
import { OrderStatus } from '@ticketing/shared/models';
import { Model, Types } from 'mongoose';

import { AppConfigService, EnvironmentVariables } from '../src/app/env';
import { EnvironmentVariables } from '../src/app/env';
import { Order } from '../src/app/orders/models';
import { Order as OrderSchema, OrderDocument } from '../src/app/orders/schemas';
import { CreatePayment } from '../src/app/payments/models';
Expand Down Expand Up @@ -67,17 +65,6 @@ describe('PaymentsController (e2e)', () => {

app = moduleFixture.createNestApplication(new FastifyAdapter());

const configService = app.get<AppConfigService>(ConfigService);
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: {
secure: false,
signed: false,
},
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());

stripeService = app.get(StripeService);
orderModel = app.get<Model<OrderDocument>>(getModelToken(OrderSchema.name));
paymentModel = app.get<Model<PaymentDocument>>(
Expand Down
2 changes: 1 addition & 1 deletion apps/tickets/src/app/tickets/tickets.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OryRelationshipsModule,
} from '@getlarge/keto-client-wrapper';
import { OryFrontendModule } from '@getlarge/kratos-client-wrapper';
import { AmqpClient, AmqpOptions } from '@getlarge/nestjs-tools-amqp-transport';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
Expand All @@ -13,7 +14,6 @@ import {
Transport,
} from '@nestjs/microservices';
import { MongooseModule } from '@nestjs/mongoose';
import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
import {
OryAuthenticationGuard,
Expand Down
14 changes: 2 additions & 12 deletions apps/tickets/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './vault';
import 'reflect-metadata';

import fastifyCors from '@fastify/cors';
import { fastifyHelmet } from '@fastify/helmet';
import fastifyPassport from '@fastify/passport';
import fastifySecureSession from '@fastify/secure-session';
import { AmqpOptions, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { CustomStrategy } from '@nestjs/microservices';
Expand All @@ -16,10 +16,8 @@ import {
SwaggerCustomOptions,
SwaggerModule,
} from '@nestjs/swagger';
import { AmqpOptions, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import {
bearerSecurityScheme,
getCookieOptions,
GLOBAL_API_PREFIX,
SecurityRequirements,
sessionSecurityScheme,
Expand All @@ -40,8 +38,6 @@ async function bootstrap(): Promise<void> {
new FastifyAdapter({
trustProxy: true,
bodyLimit: 1048576,
// bodyLimit: +process.env.MAX_PAYLOAD_SIZE || 5,
// maxParamLength: 100,
}),
{ bufferLogs: true, abortOnError: false },
);
Expand Down Expand Up @@ -69,12 +65,6 @@ async function bootstrap(): Promise<void> {
},
},
});
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: getCookieOptions(environment),
});
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());
if (!proxyServerUrls.length && environment === 'development') {
await app.register(fastifyCors, {
origin: (origin, cb) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/tickets/test/orders-ms.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines-per-function */
import { AmqpClient, AmqpServer } from '@getlarge/nestjs-tools-amqp-transport';
import { INestMicroservice } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { CustomStrategy } from '@nestjs/microservices';
Expand All @@ -9,7 +10,6 @@ import {
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { Test, TestingModule } from '@nestjs/testing';
import { AmqpClient, AmqpServer } from '@s1seven/nestjs-tools-amqp-transport';
import { loadEnv, validate } from '@ticketing/microservices/shared/env';
import { Patterns } from '@ticketing/microservices/shared/events';
import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters';
Expand Down
Loading