diff --git a/.github/workflows/docker-e2e.yml b/.github/workflows/docker-e2e.yml index cab3c7321..ac7cec32a 100644 --- a/.github/workflows/docker-e2e.yml +++ b/.github/workflows/docker-e2e.yml @@ -23,15 +23,7 @@ jobs: run: docker cp ci-relational-api-1:/usr/src/app/prod.log . # - # - - name: Run e2e tests for NestJS with Mongoose - id: document - run: docker compose -f docker-compose.document.ci.yaml --env-file env-example-document -p ci-document up --build --exit-code-from api - - - name: Copy prod.log from container to host - if: ${{ failure() && steps.document.conclusion == 'failure' }} - run: docker cp ci-document-api-1:/usr/src/app/prod.log . - # + - name: Upload prod.log to artifacts for debugging if: failure() diff --git a/.hygen/generate/all-db-resource/app-module-import.ejs.t b/.hygen/generate/all-db-resource/app-module-import.ejs.t deleted file mode 100644 index 4481bed19..000000000 --- a/.hygen/generate/all-db-resource/app-module-import.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/app.module.ts -before: \@Module ---- -import { <%= h.inflection.transform(name, ['pluralize']) %>Module } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.module'; diff --git a/.hygen/generate/all-db-resource/app-module.ejs.t b/.hygen/generate/all-db-resource/app-module.ejs.t deleted file mode 100644 index caa4087fd..000000000 --- a/.hygen/generate/all-db-resource/app-module.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/app.module.ts -after: imports ---- - <%= h.inflection.transform(name, ['pluralize']) %>Module, \ No newline at end of file diff --git a/.hygen/generate/all-db-resource/controller.ejs.t b/.hygen/generate/all-db-resource/controller.ejs.t deleted file mode 100644 index affa16c05..000000000 --- a/.hygen/generate/all-db-resource/controller.ejs.t +++ /dev/null @@ -1,111 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.controller.ts ---- -import { - Controller, - Get, - Post, - Body, - Patch, - Param, - Delete, - UseGuards, - Query, -} from '@nestjs/common'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Service } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service'; -import { Create<%= name %>Dto } from './dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { Update<%= name %>Dto } from './dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { - ApiBearerAuth, - ApiCreatedResponse, - ApiOkResponse, - ApiParam, - ApiTags, -} from '@nestjs/swagger'; -import { <%= name %> } from './domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { AuthGuard } from '@nestjs/passport'; -import { - InfinityPaginationResponse, - InfinityPaginationResponseDto, -} from '../utils/dto/infinity-pagination-response.dto'; -import { infinityPagination } from '../utils/infinity-pagination'; -import { FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto } from './dto/find-all-<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.dto'; - -@ApiTags('<%= h.inflection.transform(name, ['pluralize', 'humanize']) %>') -@ApiBearerAuth() -@UseGuards(AuthGuard('jwt')) -@Controller({ - path: '<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>', - version: '1', -}) -export class <%= h.inflection.transform(name, ['pluralize']) %>Controller { - constructor(private readonly <%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service: <%= h.inflection.transform(name, ['pluralize']) %>Service) {} - - @Post() - @ApiCreatedResponse({ - type: <%= name %>, - }) - create(@Body() create<%= name %>Dto: Create<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.create(create<%= name %>Dto); - } - - @Get() - @ApiOkResponse({ - type: InfinityPaginationResponse(<%= name %>), - }) - async findAll( - @Query() query: FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto, - ): Promise>> { - const page = query?.page ?? 1; - let limit = query?.limit ?? 10; - if (limit > 50) { - limit = 50; - } - - return infinityPagination( - await this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.findAllWithPagination({ - paginationOptions: { - page, - limit, - }, - }), - { page, limit }, - ); - } - - @Get(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - findOne(@Param('id') id: string) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.findOne(id); - } - - @Patch(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - @ApiOkResponse({ - type: <%= name %>, - }) - update( - @Param('id') id: string, - @Body() update<%= name %>Dto: Update<%= name %>Dto, - ) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.update(id, update<%= name %>Dto); - } - - @Delete(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - remove(@Param('id') id: string) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.remove(id); - } -} diff --git a/.hygen/generate/all-db-resource/domain/domain.ejs.t b/.hygen/generate/all-db-resource/domain/domain.ejs.t deleted file mode 100644 index c8cbe44af..000000000 --- a/.hygen/generate/all-db-resource/domain/domain.ejs.t +++ /dev/null @@ -1,17 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.ts ---- -import { ApiProperty } from '@nestjs/swagger'; - -export class <%= name %> { - @ApiProperty({ - type: String, - }) - id: string; - - @ApiProperty() - createdAt: Date; - - @ApiProperty() - updatedAt: Date; -} diff --git a/.hygen/generate/all-db-resource/dto/create.dto.ejs.t b/.hygen/generate/all-db-resource/dto/create.dto.ejs.t deleted file mode 100644 index 892f53829..000000000 --- a/.hygen/generate/all-db-resource/dto/create.dto.ejs.t +++ /dev/null @@ -1,7 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto.ts ---- -// Don't forget to use the class-validator decorators in the DTO properties. -// import { Allow } from 'class-validator'; - -export class Create<%= name %>Dto {} diff --git a/.hygen/generate/all-db-resource/dto/find-all.dto.ejs.t b/.hygen/generate/all-db-resource/dto/find-all.dto.ejs.t deleted file mode 100644 index 1c2915e9b..000000000 --- a/.hygen/generate/all-db-resource/dto/find-all.dto.ejs.t +++ /dev/null @@ -1,20 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/find-all-<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.dto.ts ---- -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsNumber, IsOptional } from 'class-validator'; -import { Transform } from 'class-transformer'; - -export class FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto { - @ApiPropertyOptional() - @Transform(({ value }) => (value ? Number(value) : 1)) - @IsNumber() - @IsOptional() - page?: number; - - @ApiPropertyOptional() - @Transform(({ value }) => (value ? Number(value) : 10)) - @IsNumber() - @IsOptional() - limit?: number; -} diff --git a/.hygen/generate/all-db-resource/dto/update.dto.ejs.t b/.hygen/generate/all-db-resource/dto/update.dto.ejs.t deleted file mode 100644 index f6d399814..000000000 --- a/.hygen/generate/all-db-resource/dto/update.dto.ejs.t +++ /dev/null @@ -1,10 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto.ts ---- -// Don't forget to use the class-validator decorators in the DTO properties. -// import { Allow } from 'class-validator'; - -import { PartialType } from '@nestjs/swagger'; -import { Create<%= name %>Dto } from './create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; - -export class Update<%= name %>Dto extends PartialType(Create<%= name %>Dto) {} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/document/document-persistence.module.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/document/document-persistence.module.ejs.t deleted file mode 100644 index 7aefc318b..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/document/document-persistence.module.ejs.t +++ /dev/null @@ -1,27 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/document-persistence.module.ts ---- -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { - <%= name %>Schema, - <%= name %>SchemaClass, -} from './entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; -import { <%= name %>Repository } from '../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %>DocumentRepository } from './repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { name: <%= name %>SchemaClass.name, schema: <%= name %>Schema }, - ]), - ], - providers: [ - { - provide: <%= name %>Repository, - useClass: <%= name %>DocumentRepository, - }, - ], - exports: [<%= name %>Repository], -}) -export class Document<%= name %>PersistenceModule {} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/document/entities/schema.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/document/entities/schema.ejs.t deleted file mode 100644 index 3414c96b7..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/document/entities/schema.ejs.t +++ /dev/null @@ -1,28 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema.ts ---- -import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; -import { now, HydratedDocument } from 'mongoose'; -import { EntityDocumentHelper } from '../../../../../utils/document-entity-helper'; -import { ApiProperty } from '@nestjs/swagger'; - -export type <%= name %>SchemaDocument = HydratedDocument<<%= name %>SchemaClass>; - -@Schema({ - timestamps: true, - toJSON: { - virtuals: true, - getters: true, - }, -}) -export class <%= name %>SchemaClass extends EntityDocumentHelper { - @ApiProperty() - @Prop({ default: now }) - createdAt: Date; - - @ApiProperty() - @Prop({ default: now }) - updatedAt: Date; -} - -export const <%= name %>Schema = SchemaFactory.createForClass(<%= name %>SchemaClass); diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/document/mappers/mapper.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/document/mappers/mapper.ejs.t deleted file mode 100644 index e94cb5eac..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/document/mappers/mapper.ejs.t +++ /dev/null @@ -1,27 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper.ts ---- -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>SchemaClass } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; - -export class <%= name %>Mapper { - public static toDomain(raw: <%= name %>SchemaClass): <%= name %> { - const domainEntity = new <%= name %>(); - domainEntity.id = raw._id.toString(); - domainEntity.createdAt = raw.createdAt; - domainEntity.updatedAt = raw.updatedAt; - - return domainEntity; - } - - public static toPersistence(domainEntity: <%= name %>): <%= name %>SchemaClass { - const persistenceSchema = new <%= name %>SchemaClass(); - if (domainEntity.id) { - persistenceSchema._id = domainEntity.id; - } - persistenceSchema.createdAt = domainEntity.createdAt; - persistenceSchema.updatedAt = domainEntity.updatedAt; - - return persistenceSchema; - } -} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/document/repositories/repository.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/document/repositories/repository.ejs.t deleted file mode 100644 index a0b083c60..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/document/repositories/repository.ejs.t +++ /dev/null @@ -1,77 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository.ts ---- -import { Injectable } from '@nestjs/common'; -import { NullableType } from '../../../../../utils/types/nullable.type'; -import { InjectModel } from '@nestjs/mongoose'; -import { Model } from 'mongoose'; -import { <%= name %>SchemaClass } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; -import { <%= name %>Repository } from '../../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>Mapper } from '../mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper'; -import { IPaginationOptions } from '../../../../../utils/types/pagination-options'; - -@Injectable() -export class <%= name %>DocumentRepository implements <%= name %>Repository { - constructor( - @InjectModel(<%= name %>SchemaClass.name) - private readonly <%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model: Model<<%= name %>SchemaClass>, - ) {} - - async create(data: <%= name %>): Promise<<%= name %>> { - const persistenceModel = <%= name %>Mapper.toPersistence(data); - const createdEntity = new this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model(persistenceModel); - const entityObject = await createdEntity.save(); - return <%= name %>Mapper.toDomain(entityObject); - } - - async findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }): Promise<<%= name %>[]> { - const entityObjects = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model - .find() - .skip((paginationOptions.page - 1) * paginationOptions.limit) - .limit(paginationOptions.limit); - - return entityObjects.map((entityObject) => - <%= name %>Mapper.toDomain(entityObject), - ); - } - - async findById(id: <%= name %>['id']): Promise>> { - const entityObject = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findById(id); - return entityObject ? <%= name %>Mapper.toDomain(entityObject) : null; - } - - async update( - id: <%= name %>['id'], - payload: Partial<<%= name %>>, - ): Promise>> { - const clonedPayload = { ...payload }; - delete clonedPayload.id; - - const filter = { _id: id.toString() }; - const entity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findOne(filter); - - if (!entity) { - throw new Error('Record not found'); - } - - const entityObject = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findOneAndUpdate( - filter, - <%= name %>Mapper.toPersistence({ - ...<%= name %>Mapper.toDomain(entity), - ...clonedPayload, - }), - { new: true }, - ); - - return entityObject ? <%= name %>Mapper.toDomain(entityObject) : null; - } - - async remove(id: <%= name %>['id']): Promise { - await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.deleteOne({ _id: id }); - } -} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/entities/entity.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/relational/entities/entity.ejs.t deleted file mode 100644 index f67c87f6b..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/entities/entity.ejs.t +++ /dev/null @@ -1,28 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity.ts ---- -import { - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { EntityRelationalHelper } from '../../../../../utils/relational-entity-helper'; -import { ApiProperty } from '@nestjs/swagger'; - -@Entity({ - name: '<%= h.inflection.transform(name, ['underscore']) %>', -}) -export class <%= name %>Entity extends EntityRelationalHelper { - @ApiProperty() - @PrimaryGeneratedColumn('uuid') - id: string; - - @ApiProperty() - @CreateDateColumn() - createdAt: Date; - - @ApiProperty() - @UpdateDateColumn() - updatedAt: Date; -} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/mappers/mapper.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/relational/mappers/mapper.ejs.t deleted file mode 100644 index 48f9f87da..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/mappers/mapper.ejs.t +++ /dev/null @@ -1,27 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper.ts ---- -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>Entity } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity'; - -export class <%= name %>Mapper { - static toDomain(raw: <%= name %>Entity): <%= name %> { - const domainEntity = new <%= name %>(); - domainEntity.id = raw.id; - domainEntity.createdAt = raw.createdAt; - domainEntity.updatedAt = raw.updatedAt; - - return domainEntity; - } - - static toPersistence(domainEntity: <%= name %>): <%= name %>Entity { - const persistenceEntity = new <%= name %>Entity(); - if (domainEntity.id) { - persistenceEntity.id = domainEntity.id; - } - persistenceEntity.createdAt = domainEntity.createdAt; - persistenceEntity.updatedAt = domainEntity.updatedAt; - - return persistenceEntity; - } -} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/relational-persistence.module.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/relational/relational-persistence.module.ejs.t deleted file mode 100644 index 4aab6e673..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/relational-persistence.module.ejs.t +++ /dev/null @@ -1,20 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/relational-persistence.module.ts ---- -import { Module } from '@nestjs/common'; -import { <%= name %>Repository } from '../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %>RelationalRepository } from './repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { <%= name %>Entity } from './entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity'; - -@Module({ - imports: [TypeOrmModule.forFeature([<%= name %>Entity])], - providers: [ - { - provide: <%= name %>Repository, - useClass: <%= name %>RelationalRepository, - }, - ], - exports: [<%= name %>Repository], -}) -export class Relational<%= name %>PersistenceModule {} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/repositories/repository.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/relational/repositories/repository.ejs.t deleted file mode 100644 index 7d7a4c2ee..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/relational/repositories/repository.ejs.t +++ /dev/null @@ -1,77 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/relational/repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository.ts ---- -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; -import { <%= name %>Entity } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.entity'; -import { NullableType } from '../../../../../utils/types/nullable.type'; -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>Repository } from '../../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %>Mapper } from '../mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper'; -import { IPaginationOptions } from '../../../../../utils/types/pagination-options'; - -@Injectable() -export class <%= name %>RelationalRepository implements <%= name %>Repository { - constructor( - @InjectRepository(<%= name %>Entity) - private readonly <%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository: Repository<<%= name %>Entity>, - ) {} - - async create(data: <%= name %>): Promise<<%= name %>> { - const persistenceModel = <%= name %>Mapper.toPersistence(data); - const newEntity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.save( - this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.create(persistenceModel), - ); - return <%= name %>Mapper.toDomain(newEntity); - } - - async findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }): Promise<<%= name %>[]> { - const entities = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.find({ - skip: (paginationOptions.page - 1) * paginationOptions.limit, - take: paginationOptions.limit, - }); - - return entities.map((user) => <%= name %>Mapper.toDomain(user)); - } - - async findById(id: <%= name %>['id']): Promise>> { - const entity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findOne({ - where: { id }, - }); - - return entity ? <%= name %>Mapper.toDomain(entity) : null; - } - - async update( - id: <%= name %>['id'], - payload: Partial<<%= name %>>, - ): Promise<<%= name %>> { - const entity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findOne({ - where: { id }, - }); - - if (!entity) { - throw new Error('Record not found'); - } - - const updatedEntity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.save( - this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.create( - <%= name %>Mapper.toPersistence({ - ...<%= name %>Mapper.toDomain(entity), - ...payload, - }), - ), - ); - - return <%= name %>Mapper.toDomain(updatedEntity); - } - - async remove(id: <%= name %>['id']): Promise { - await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.delete(id); - } -} diff --git a/.hygen/generate/all-db-resource/infrastructure/persistence/repository.ejs.t b/.hygen/generate/all-db-resource/infrastructure/persistence/repository.ejs.t deleted file mode 100644 index 5b333c4fb..000000000 --- a/.hygen/generate/all-db-resource/infrastructure/persistence/repository.ejs.t +++ /dev/null @@ -1,28 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository.ts ---- -import { DeepPartial } from '../../../utils/types/deep-partial.type'; -import { NullableType } from '../../../utils/types/nullable.type'; -import { IPaginationOptions } from '../../../utils/types/pagination-options'; -import { <%= name %> } from '../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; - -export abstract class <%= name %>Repository { - abstract create( - data: Omit<<%= name %>, 'id' | 'createdAt' | 'updatedAt'>, - ): Promise<<%= name %>>; - - abstract findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }): Promise<<%= name %>[]>; - - abstract findById(id: <%= name %>['id']): Promise>>; - - abstract update( - id: <%= name %>['id'], - payload: DeepPartial<<%= name %>>, - ): Promise<<%= name %> | null>; - - abstract remove(id: <%= name %>['id']): Promise; -} diff --git a/.hygen/generate/all-db-resource/module.ejs.t b/.hygen/generate/all-db-resource/module.ejs.t deleted file mode 100644 index 549af1c56..000000000 --- a/.hygen/generate/all-db-resource/module.ejs.t +++ /dev/null @@ -1,23 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.module.ts ---- -import { Module } from '@nestjs/common'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Service } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Controller } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.controller'; -import { Relational<%= name %>PersistenceModule } from './infrastructure/persistence/relational/relational-persistence.module'; -import databaseConfig from '../database/config/database.config'; -import { DatabaseConfig } from '../database/config/database-config.type'; -import { Document<%= name %>PersistenceModule } from './infrastructure/persistence/document/document-persistence.module'; - -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? Document<%= name %>PersistenceModule - : Relational<%= name %>PersistenceModule; - -@Module({ - imports: [infrastructurePersistenceModule], - controllers: [<%= h.inflection.transform(name, ['pluralize']) %>Controller], - providers: [<%= h.inflection.transform(name, ['pluralize']) %>Service], - exports: [<%= h.inflection.transform(name, ['pluralize']) %>Service, infrastructurePersistenceModule], -}) -export class <%= h.inflection.transform(name, ['pluralize']) %>Module {} diff --git a/.hygen/generate/all-db-resource/service.ejs.t b/.hygen/generate/all-db-resource/service.ejs.t deleted file mode 100644 index 8fdc74f61..000000000 --- a/.hygen/generate/all-db-resource/service.ejs.t +++ /dev/null @@ -1,43 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service.ts ---- -import { Injectable } from '@nestjs/common'; -import { Create<%= name %>Dto } from './dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { Update<%= name %>Dto } from './dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { <%= name %>Repository } from './infrastructure/persistence/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { IPaginationOptions } from '../utils/types/pagination-options'; -import { <%= name %> } from './domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; - -@Injectable() -export class <%= h.inflection.transform(name, ['pluralize']) %>Service { - constructor(private readonly <%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository: <%= name %>Repository) {} - - create(create<%= name %>Dto: Create<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.create(create<%= name %>Dto); - } - - findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findAllWithPagination({ - paginationOptions: { - page: paginationOptions.page, - limit: paginationOptions.limit, - }, - }); - } - - findOne(id: <%= name %>['id']) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findById(id); - } - - update(id: <%= name %>['id'], update<%= name %>Dto: Update<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.update(id, update<%= name %>Dto); - } - - remove(id: <%= name %>['id']) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.remove(id); - } -} diff --git a/.hygen/generate/document-resource/app-module-import.ejs.t b/.hygen/generate/document-resource/app-module-import.ejs.t deleted file mode 100644 index 4481bed19..000000000 --- a/.hygen/generate/document-resource/app-module-import.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/app.module.ts -before: \@Module ---- -import { <%= h.inflection.transform(name, ['pluralize']) %>Module } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.module'; diff --git a/.hygen/generate/document-resource/app-module.ejs.t b/.hygen/generate/document-resource/app-module.ejs.t deleted file mode 100644 index caa4087fd..000000000 --- a/.hygen/generate/document-resource/app-module.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/app.module.ts -after: imports ---- - <%= h.inflection.transform(name, ['pluralize']) %>Module, \ No newline at end of file diff --git a/.hygen/generate/document-resource/controller.ejs.t b/.hygen/generate/document-resource/controller.ejs.t deleted file mode 100644 index affa16c05..000000000 --- a/.hygen/generate/document-resource/controller.ejs.t +++ /dev/null @@ -1,111 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.controller.ts ---- -import { - Controller, - Get, - Post, - Body, - Patch, - Param, - Delete, - UseGuards, - Query, -} from '@nestjs/common'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Service } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service'; -import { Create<%= name %>Dto } from './dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { Update<%= name %>Dto } from './dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { - ApiBearerAuth, - ApiCreatedResponse, - ApiOkResponse, - ApiParam, - ApiTags, -} from '@nestjs/swagger'; -import { <%= name %> } from './domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { AuthGuard } from '@nestjs/passport'; -import { - InfinityPaginationResponse, - InfinityPaginationResponseDto, -} from '../utils/dto/infinity-pagination-response.dto'; -import { infinityPagination } from '../utils/infinity-pagination'; -import { FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto } from './dto/find-all-<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.dto'; - -@ApiTags('<%= h.inflection.transform(name, ['pluralize', 'humanize']) %>') -@ApiBearerAuth() -@UseGuards(AuthGuard('jwt')) -@Controller({ - path: '<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>', - version: '1', -}) -export class <%= h.inflection.transform(name, ['pluralize']) %>Controller { - constructor(private readonly <%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service: <%= h.inflection.transform(name, ['pluralize']) %>Service) {} - - @Post() - @ApiCreatedResponse({ - type: <%= name %>, - }) - create(@Body() create<%= name %>Dto: Create<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.create(create<%= name %>Dto); - } - - @Get() - @ApiOkResponse({ - type: InfinityPaginationResponse(<%= name %>), - }) - async findAll( - @Query() query: FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto, - ): Promise>> { - const page = query?.page ?? 1; - let limit = query?.limit ?? 10; - if (limit > 50) { - limit = 50; - } - - return infinityPagination( - await this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.findAllWithPagination({ - paginationOptions: { - page, - limit, - }, - }), - { page, limit }, - ); - } - - @Get(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - findOne(@Param('id') id: string) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.findOne(id); - } - - @Patch(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - @ApiOkResponse({ - type: <%= name %>, - }) - update( - @Param('id') id: string, - @Body() update<%= name %>Dto: Update<%= name %>Dto, - ) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.update(id, update<%= name %>Dto); - } - - @Delete(':id') - @ApiParam({ - name: 'id', - type: String, - required: true, - }) - remove(@Param('id') id: string) { - return this.<%= h.inflection.transform(name, ['pluralize', 'camelize', 'underscore']) %>Service.remove(id); - } -} diff --git a/.hygen/generate/document-resource/domain/domain.ejs.t b/.hygen/generate/document-resource/domain/domain.ejs.t deleted file mode 100644 index c8cbe44af..000000000 --- a/.hygen/generate/document-resource/domain/domain.ejs.t +++ /dev/null @@ -1,17 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.ts ---- -import { ApiProperty } from '@nestjs/swagger'; - -export class <%= name %> { - @ApiProperty({ - type: String, - }) - id: string; - - @ApiProperty() - createdAt: Date; - - @ApiProperty() - updatedAt: Date; -} diff --git a/.hygen/generate/document-resource/dto/create.dto.ejs.t b/.hygen/generate/document-resource/dto/create.dto.ejs.t deleted file mode 100644 index 892f53829..000000000 --- a/.hygen/generate/document-resource/dto/create.dto.ejs.t +++ /dev/null @@ -1,7 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto.ts ---- -// Don't forget to use the class-validator decorators in the DTO properties. -// import { Allow } from 'class-validator'; - -export class Create<%= name %>Dto {} diff --git a/.hygen/generate/document-resource/dto/find-all.dto.ejs.t b/.hygen/generate/document-resource/dto/find-all.dto.ejs.t deleted file mode 100644 index 1c2915e9b..000000000 --- a/.hygen/generate/document-resource/dto/find-all.dto.ejs.t +++ /dev/null @@ -1,20 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/find-all-<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.dto.ts ---- -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsNumber, IsOptional } from 'class-validator'; -import { Transform } from 'class-transformer'; - -export class FindAll<%= h.inflection.transform(name, ['pluralize']) %>Dto { - @ApiPropertyOptional() - @Transform(({ value }) => (value ? Number(value) : 1)) - @IsNumber() - @IsOptional() - page?: number; - - @ApiPropertyOptional() - @Transform(({ value }) => (value ? Number(value) : 10)) - @IsNumber() - @IsOptional() - limit?: number; -} diff --git a/.hygen/generate/document-resource/dto/update.dto.ejs.t b/.hygen/generate/document-resource/dto/update.dto.ejs.t deleted file mode 100644 index f6d399814..000000000 --- a/.hygen/generate/document-resource/dto/update.dto.ejs.t +++ /dev/null @@ -1,10 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto.ts ---- -// Don't forget to use the class-validator decorators in the DTO properties. -// import { Allow } from 'class-validator'; - -import { PartialType } from '@nestjs/swagger'; -import { Create<%= name %>Dto } from './create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; - -export class Update<%= name %>Dto extends PartialType(Create<%= name %>Dto) {} diff --git a/.hygen/generate/document-resource/infrastructure/persistence/document/document-persistence.module.ejs.t b/.hygen/generate/document-resource/infrastructure/persistence/document/document-persistence.module.ejs.t deleted file mode 100644 index 7aefc318b..000000000 --- a/.hygen/generate/document-resource/infrastructure/persistence/document/document-persistence.module.ejs.t +++ /dev/null @@ -1,27 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/document-persistence.module.ts ---- -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { - <%= name %>Schema, - <%= name %>SchemaClass, -} from './entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; -import { <%= name %>Repository } from '../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %>DocumentRepository } from './repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { name: <%= name %>SchemaClass.name, schema: <%= name %>Schema }, - ]), - ], - providers: [ - { - provide: <%= name %>Repository, - useClass: <%= name %>DocumentRepository, - }, - ], - exports: [<%= name %>Repository], -}) -export class Document<%= name %>PersistenceModule {} diff --git a/.hygen/generate/document-resource/infrastructure/persistence/document/entities/schema.ejs.t b/.hygen/generate/document-resource/infrastructure/persistence/document/entities/schema.ejs.t deleted file mode 100644 index 3414c96b7..000000000 --- a/.hygen/generate/document-resource/infrastructure/persistence/document/entities/schema.ejs.t +++ /dev/null @@ -1,28 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema.ts ---- -import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; -import { now, HydratedDocument } from 'mongoose'; -import { EntityDocumentHelper } from '../../../../../utils/document-entity-helper'; -import { ApiProperty } from '@nestjs/swagger'; - -export type <%= name %>SchemaDocument = HydratedDocument<<%= name %>SchemaClass>; - -@Schema({ - timestamps: true, - toJSON: { - virtuals: true, - getters: true, - }, -}) -export class <%= name %>SchemaClass extends EntityDocumentHelper { - @ApiProperty() - @Prop({ default: now }) - createdAt: Date; - - @ApiProperty() - @Prop({ default: now }) - updatedAt: Date; -} - -export const <%= name %>Schema = SchemaFactory.createForClass(<%= name %>SchemaClass); diff --git a/.hygen/generate/document-resource/infrastructure/persistence/document/mappers/mapper.ejs.t b/.hygen/generate/document-resource/infrastructure/persistence/document/mappers/mapper.ejs.t deleted file mode 100644 index e94cb5eac..000000000 --- a/.hygen/generate/document-resource/infrastructure/persistence/document/mappers/mapper.ejs.t +++ /dev/null @@ -1,27 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper.ts ---- -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>SchemaClass } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; - -export class <%= name %>Mapper { - public static toDomain(raw: <%= name %>SchemaClass): <%= name %> { - const domainEntity = new <%= name %>(); - domainEntity.id = raw._id.toString(); - domainEntity.createdAt = raw.createdAt; - domainEntity.updatedAt = raw.updatedAt; - - return domainEntity; - } - - public static toPersistence(domainEntity: <%= name %>): <%= name %>SchemaClass { - const persistenceSchema = new <%= name %>SchemaClass(); - if (domainEntity.id) { - persistenceSchema._id = domainEntity.id; - } - persistenceSchema.createdAt = domainEntity.createdAt; - persistenceSchema.updatedAt = domainEntity.updatedAt; - - return persistenceSchema; - } -} diff --git a/.hygen/generate/document-resource/infrastructure/persistence/document/repositories/repository.ejs.t b/.hygen/generate/document-resource/infrastructure/persistence/document/repositories/repository.ejs.t deleted file mode 100644 index a0b083c60..000000000 --- a/.hygen/generate/document-resource/infrastructure/persistence/document/repositories/repository.ejs.t +++ /dev/null @@ -1,77 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/repositories/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository.ts ---- -import { Injectable } from '@nestjs/common'; -import { NullableType } from '../../../../../utils/types/nullable.type'; -import { InjectModel } from '@nestjs/mongoose'; -import { Model } from 'mongoose'; -import { <%= name %>SchemaClass } from '../entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; -import { <%= name %>Repository } from '../../<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { <%= name %> } from '../../../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; -import { <%= name %>Mapper } from '../mappers/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.mapper'; -import { IPaginationOptions } from '../../../../../utils/types/pagination-options'; - -@Injectable() -export class <%= name %>DocumentRepository implements <%= name %>Repository { - constructor( - @InjectModel(<%= name %>SchemaClass.name) - private readonly <%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model: Model<<%= name %>SchemaClass>, - ) {} - - async create(data: <%= name %>): Promise<<%= name %>> { - const persistenceModel = <%= name %>Mapper.toPersistence(data); - const createdEntity = new this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model(persistenceModel); - const entityObject = await createdEntity.save(); - return <%= name %>Mapper.toDomain(entityObject); - } - - async findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }): Promise<<%= name %>[]> { - const entityObjects = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model - .find() - .skip((paginationOptions.page - 1) * paginationOptions.limit) - .limit(paginationOptions.limit); - - return entityObjects.map((entityObject) => - <%= name %>Mapper.toDomain(entityObject), - ); - } - - async findById(id: <%= name %>['id']): Promise>> { - const entityObject = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findById(id); - return entityObject ? <%= name %>Mapper.toDomain(entityObject) : null; - } - - async update( - id: <%= name %>['id'], - payload: Partial<<%= name %>>, - ): Promise>> { - const clonedPayload = { ...payload }; - delete clonedPayload.id; - - const filter = { _id: id.toString() }; - const entity = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findOne(filter); - - if (!entity) { - throw new Error('Record not found'); - } - - const entityObject = await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.findOneAndUpdate( - filter, - <%= name %>Mapper.toPersistence({ - ...<%= name %>Mapper.toDomain(entity), - ...clonedPayload, - }), - { new: true }, - ); - - return entityObject ? <%= name %>Mapper.toDomain(entityObject) : null; - } - - async remove(id: <%= name %>['id']): Promise { - await this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Model.deleteOne({ _id: id }); - } -} diff --git a/.hygen/generate/document-resource/infrastructure/persistence/repository.ejs.t b/.hygen/generate/document-resource/infrastructure/persistence/repository.ejs.t deleted file mode 100644 index 5b333c4fb..000000000 --- a/.hygen/generate/document-resource/infrastructure/persistence/repository.ejs.t +++ /dev/null @@ -1,28 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository.ts ---- -import { DeepPartial } from '../../../utils/types/deep-partial.type'; -import { NullableType } from '../../../utils/types/nullable.type'; -import { IPaginationOptions } from '../../../utils/types/pagination-options'; -import { <%= name %> } from '../../domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; - -export abstract class <%= name %>Repository { - abstract create( - data: Omit<<%= name %>, 'id' | 'createdAt' | 'updatedAt'>, - ): Promise<<%= name %>>; - - abstract findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }): Promise<<%= name %>[]>; - - abstract findById(id: <%= name %>['id']): Promise>>; - - abstract update( - id: <%= name %>['id'], - payload: DeepPartial<<%= name %>>, - ): Promise<<%= name %> | null>; - - abstract remove(id: <%= name %>['id']): Promise; -} diff --git a/.hygen/generate/document-resource/module.ejs.t b/.hygen/generate/document-resource/module.ejs.t deleted file mode 100644 index c53def777..000000000 --- a/.hygen/generate/document-resource/module.ejs.t +++ /dev/null @@ -1,15 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.module.ts ---- -import { Module } from '@nestjs/common'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Service } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service'; -import { <%= h.inflection.transform(name, ['pluralize']) %>Controller } from './<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.controller'; -import { Document<%= name %>PersistenceModule } from './infrastructure/persistence/document/document-persistence.module'; - -@Module({ - imports: [Document<%= name %>PersistenceModule], - controllers: [<%= h.inflection.transform(name, ['pluralize']) %>Controller], - providers: [<%= h.inflection.transform(name, ['pluralize']) %>Service], - exports: [<%= h.inflection.transform(name, ['pluralize']) %>Service, Document<%= name %>PersistenceModule], -}) -export class <%= h.inflection.transform(name, ['pluralize']) %>Module {} diff --git a/.hygen/generate/document-resource/service.ejs.t b/.hygen/generate/document-resource/service.ejs.t deleted file mode 100644 index 8fdc74f61..000000000 --- a/.hygen/generate/document-resource/service.ejs.t +++ /dev/null @@ -1,43 +0,0 @@ ---- -to: src/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>.service.ts ---- -import { Injectable } from '@nestjs/common'; -import { Create<%= name %>Dto } from './dto/create-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { Update<%= name %>Dto } from './dto/update-<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.dto'; -import { <%= name %>Repository } from './infrastructure/persistence/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.repository'; -import { IPaginationOptions } from '../utils/types/pagination-options'; -import { <%= name %> } from './domain/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>'; - -@Injectable() -export class <%= h.inflection.transform(name, ['pluralize']) %>Service { - constructor(private readonly <%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository: <%= name %>Repository) {} - - create(create<%= name %>Dto: Create<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.create(create<%= name %>Dto); - } - - findAllWithPagination({ - paginationOptions, - }: { - paginationOptions: IPaginationOptions; - }) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findAllWithPagination({ - paginationOptions: { - page: paginationOptions.page, - limit: paginationOptions.limit, - }, - }); - } - - findOne(id: <%= name %>['id']) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.findById(id); - } - - update(id: <%= name %>['id'], update<%= name %>Dto: Update<%= name %>Dto) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.update(id, update<%= name %>Dto); - } - - remove(id: <%= name %>['id']) { - return this.<%= h.inflection.transform(name, ['camelize', 'underscore']) %>Repository.remove(id); - } -} diff --git a/.hygen/seeds/create-document/module.ejs.t b/.hygen/seeds/create-document/module.ejs.t deleted file mode 100644 index 2e02a9240..000000000 --- a/.hygen/seeds/create-document/module.ejs.t +++ /dev/null @@ -1,21 +0,0 @@ ---- -to: src/database/seeds/document/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module.ts ---- -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { <%= name %>Schema, <%= name %>SchemaClass } from '../../../../<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; -import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { - name: <%= name %>SchemaClass.name, - schema: <%= name %>Schema, - }, - ]), - ], - providers: [<%= name %>SeedService], - exports: [<%= name %>SeedService], -}) -export class <%= name %>SeedModule {} diff --git a/.hygen/seeds/create-document/run-seed-import.ejs.t b/.hygen/seeds/create-document/run-seed-import.ejs.t deleted file mode 100644 index 8f4f71c2d..000000000 --- a/.hygen/seeds/create-document/run-seed-import.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/database/seeds/document/run-seed.ts -after: \@nestjs\/core ---- -import { <%= name %>SeedService } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service'; \ No newline at end of file diff --git a/.hygen/seeds/create-document/run-seed-service.ejs.t b/.hygen/seeds/create-document/run-seed-service.ejs.t deleted file mode 100644 index 1fc573a37..000000000 --- a/.hygen/seeds/create-document/run-seed-service.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/database/seeds/document/run-seed.ts -before: close ---- - await app.get(<%= name %>SeedService).run(); diff --git a/.hygen/seeds/create-document/seed-module-import.ejs.t b/.hygen/seeds/create-document/seed-module-import.ejs.t deleted file mode 100644 index f18e94239..000000000 --- a/.hygen/seeds/create-document/seed-module-import.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/database/seeds/document/seed.module.ts -before: \@Module ---- -import { <%= name %>SeedModule } from './<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.module'; diff --git a/.hygen/seeds/create-document/seed-module.ejs.t b/.hygen/seeds/create-document/seed-module.ejs.t deleted file mode 100644 index e48a1452c..000000000 --- a/.hygen/seeds/create-document/seed-module.ejs.t +++ /dev/null @@ -1,6 +0,0 @@ ---- -inject: true -to: src/database/seeds/document/seed.module.ts -after: imports ---- - <%= name %>SeedModule, \ No newline at end of file diff --git a/.hygen/seeds/create-document/service.ejs.t b/.hygen/seeds/create-document/service.ejs.t deleted file mode 100644 index bdd080e60..000000000 --- a/.hygen/seeds/create-document/service.ejs.t +++ /dev/null @@ -1,24 +0,0 @@ ---- -to: src/database/seeds/document/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>-seed.service.ts ---- -import { Injectable } from '@nestjs/common'; -import { InjectModel } from '@nestjs/mongoose'; -import { Model } from 'mongoose'; -import { <%= name %>SchemaClass } from '../../../../<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/infrastructure/persistence/document/entities/<%= h.inflection.transform(name, ['underscore', 'dasherize']) %>.schema'; - -@Injectable() -export class <%= name %>SeedService { - constructor( - @InjectModel(<%= name %>SchemaClass.name) - private readonly model: Model<<%= name %>SchemaClass>, - ) {} - - async run() { - const count = await this.model.countDocuments(); - - if (count === 0) { - const data = new this.model({}); - await data.save(); - } - } -} diff --git a/.install-scripts/helpers/replace.ts b/.install-scripts/helpers/replace.ts deleted file mode 100644 index 455f0baa8..000000000 --- a/.install-scripts/helpers/replace.ts +++ /dev/null @@ -1,25 +0,0 @@ -import fs from 'fs'; - -const replace = (params: { - path: string; - actions: Array<{ - find: string | RegExp; - replace: string; - }>; -}) => { - const { path, actions } = params; - - try { - let content = fs.readFileSync(path, 'utf-8'); - - actions.forEach((action) => { - content = content.replace(action.find, action.replace); - }); - - fs.writeFileSync(path, content, 'utf-8'); - } catch (error) { - console.error(`Error replacing text in ${path}:`, error.message); - } -}; - -export default replace; diff --git a/.install-scripts/index.ts b/.install-scripts/index.ts deleted file mode 100644 index e7c63412d..000000000 --- a/.install-scripts/index.ts +++ /dev/null @@ -1,93 +0,0 @@ -import prompts from 'prompts'; -import removeFacebookAuth from './scripts/remove-auth-facebook'; -import removeGoogleAuth from './scripts/remove-auth-google'; -import removeAppleAuth from './scripts/remove-auth-apple'; -import removeTwitterAuth from './scripts/remove-auth-twitter'; -import removeInstallScripts from './scripts/remove-install-scripts'; -import removePostgreSql from './scripts/remove-postgresql'; -import removeMongoDb from './scripts/remove-mongodb'; -import removeRelationalResourceGeneration from './scripts/resource-generation-scripts/remove-relational'; -import removeDocumentResourceGeneration from './scripts/resource-generation-scripts/remove-document'; -import removeAllDbResourceGeneration from './scripts/resource-generation-scripts/remove-all-db'; - -(async () => { - const response = await prompts( - [ - { - type: 'select', - name: 'database', - message: 'Which database do you want to use?', - choices: [ - { title: 'PostgreSQL and MongoDB', value: 'pg-mongo' }, - { title: 'PostgreSQL', value: 'pg' }, - { title: 'MongoDB', value: 'mongo' }, - ], - }, - { - type: 'confirm', - name: 'isAuthFacebook', - message: 'Include Facebook auth?', - initial: true, - }, - { - type: 'confirm', - name: 'isAuthGoogle', - message: 'Include Google auth?', - initial: true, - }, - { - type: 'confirm', - name: 'isAuthTwitter', - message: 'Include Twitter auth?', - initial: true, - }, - { - type: 'confirm', - name: 'isAuthApple', - message: 'Include Apple auth?', - initial: true, - }, - ], - { - onCancel() { - process.exit(1); - }, - }, - ); - - if (response.database === 'pg-mongo') { - removeRelationalResourceGeneration(); - removeDocumentResourceGeneration(); - } - - if (response.database === 'mongo') { - removePostgreSql(); - removeRelationalResourceGeneration(); - removeAllDbResourceGeneration(); - } - - if (response.database === 'pg') { - removeMongoDb(); - removeDocumentResourceGeneration(); - removeAllDbResourceGeneration(); - } - - if (!response.isAuthFacebook) { - removeFacebookAuth(); - } - - if (!response.isAuthGoogle) { - removeGoogleAuth(); - } - - if (!response.isAuthTwitter) { - removeTwitterAuth(); - } - - if (!response.isAuthApple) { - removeAppleAuth(); - } - - removeInstallScripts(); - process.exit(0); -})(); diff --git a/.install-scripts/scripts/remove-auth-apple.ts b/.install-scripts/scripts/remove-auth-apple.ts deleted file mode 100644 index c6213caa6..000000000 --- a/.install-scripts/scripts/remove-auth-apple.ts +++ /dev/null @@ -1,55 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeAppleAuth = async () => { - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\s*AuthAppleModule\,.*/g, - replace: '', - }, - { - find: /\s*appleConfig\,.*/g, - replace: '', - }, - { - find: /\s*import \{ AuthAppleModule \} from \'\.\/auth\-apple\/auth\-apple\.module\'\;.*/g, - replace: '', - }, - { - find: /\s*import appleConfig from \'\.\/auth\-apple\/config\/apple\.config\'\;.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'config', 'config.type.ts'), - actions: [ - { - find: /\s*apple\: AppleConfig.*/g, - replace: '', - }, - { - find: /\s*import \{ AppleConfig \}.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"apple-signin-auth\":.*/g, - replace: '', - }, - ], - }); - fs.rmSync(path.join(process.cwd(), 'src', 'auth-apple'), { - recursive: true, - force: true, - }); -}; - -export default removeAppleAuth; diff --git a/.install-scripts/scripts/remove-auth-facebook.ts b/.install-scripts/scripts/remove-auth-facebook.ts deleted file mode 100644 index 709ab81a6..000000000 --- a/.install-scripts/scripts/remove-auth-facebook.ts +++ /dev/null @@ -1,60 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeFacebookAuth = async () => { - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\s*AuthFacebookModule\,.*/g, - replace: '', - }, - { - find: /\s*facebookConfig\,.*/g, - replace: '', - }, - { - find: /\s*import \{ AuthFacebookModule \} from '\.\/auth\-facebook\/auth\-facebook\.module'\;.*/g, - replace: '', - }, - { - find: /\s*import facebookConfig from '\.\/auth\-facebook\/config\/facebook\.config'\;.*/g, - replace: '', - }, - ], - }); - - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"fb\":.*/g, - replace: '', - }, - { - find: /\s*\"@types\/facebook\-js\-sdk\":.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'config', 'config.type.ts'), - actions: [ - { - find: /\s*facebook\: FacebookConfig.*/g, - replace: '', - }, - { - find: /\s*import \{ FacebookConfig \}.*/g, - replace: '', - }, - ], - }); - fs.rmSync(path.join(process.cwd(), 'src', 'auth-facebook'), { - recursive: true, - force: true, - }); -}; - -export default removeFacebookAuth; diff --git a/.install-scripts/scripts/remove-auth-google.ts b/.install-scripts/scripts/remove-auth-google.ts deleted file mode 100644 index 8b1e05e4f..000000000 --- a/.install-scripts/scripts/remove-auth-google.ts +++ /dev/null @@ -1,55 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeGoogleAuth = async () => { - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\s*AuthGoogleModule\,.*/g, - replace: '', - }, - { - find: /\s*googleConfig\,.*/g, - replace: '', - }, - { - find: /\s*import \{ AuthGoogleModule \} from \'\.\/auth\-google\/auth\-google\.module\'\;.*/g, - replace: '', - }, - { - find: /\s*import googleConfig from \'\.\/auth\-google\/config\/google\.config\'\;.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'config', 'config.type.ts'), - actions: [ - { - find: /\s*google\: GoogleConfig.*/g, - replace: '', - }, - { - find: /\s*import \{ GoogleConfig \}.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"google-auth-library\":.*/g, - replace: '', - }, - ], - }); - fs.rmSync(path.join(process.cwd(), 'src', 'auth-google'), { - recursive: true, - force: true, - }); -}; - -export default removeGoogleAuth; diff --git a/.install-scripts/scripts/remove-auth-twitter.ts b/.install-scripts/scripts/remove-auth-twitter.ts deleted file mode 100644 index a2e40cf62..000000000 --- a/.install-scripts/scripts/remove-auth-twitter.ts +++ /dev/null @@ -1,63 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeTwitterAuth = async () => { - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\s*AuthTwitterModule\,.*/g, - replace: '', - }, - { - find: /\s*twitterConfig\,.*/g, - replace: '', - }, - { - find: /\s*import \{ AuthTwitterModule \} from \'\.\/auth-twitter\/auth-twitter\.module\'\;.*/g, - replace: '', - }, - { - find: /\s*import twitterConfig from \'\.\/auth-twitter\/config\/twitter\.config\'\;.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'config', 'config.type.ts'), - actions: [ - { - find: /\s*twitter\: TwitterConfig.*/g, - replace: '', - }, - { - find: /\s*import \{ TwitterConfig \}.*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /,\s*\"twitter\":.*\"/g, - replace: '', - }, - { - find: /\s*\"twitter\":.*\,/g, - replace: '', - }, - { - find: /\s*\"@types\/twitter\":.*/g, - replace: '', - }, - ], - }); - fs.rmSync(path.join(process.cwd(), 'src', 'auth-twitter'), { - recursive: true, - force: true, - }); -}; - -export default removeTwitterAuth; diff --git a/.install-scripts/scripts/remove-install-scripts.ts b/.install-scripts/scripts/remove-install-scripts.ts deleted file mode 100644 index 7e704baae..000000000 --- a/.install-scripts/scripts/remove-install-scripts.ts +++ /dev/null @@ -1,25 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeInstallScripts = async () => { - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"app:config\".*/g, - replace: '', - }, - { - find: /\s*\"@types\/prompts\"\:.*/g, - replace: '', - }, - ], - }); - fs.rmSync(path.join(process.cwd(), '.install-scripts'), { - recursive: true, - force: true, - }); -}; - -export default removeInstallScripts; diff --git a/.install-scripts/scripts/remove-mongodb.ts b/.install-scripts/scripts/remove-mongodb.ts deleted file mode 100644 index f52ccb060..000000000 --- a/.install-scripts/scripts/remove-mongodb.ts +++ /dev/null @@ -1,333 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeMongoDb = async () => { - const filesToRemove = [ - path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'persistence', - 'document', - ), - path.join( - process.cwd(), - 'src', - 'session', - 'infrastructure', - 'persistence', - 'document', - ), - path.join( - process.cwd(), - 'src', - 'users', - 'infrastructure', - 'persistence', - 'document', - ), - path.join(process.cwd(), 'src', 'database', 'mongoose-config.service.ts'), - path.join(process.cwd(), 'src', 'database', 'seeds', 'document'), - path.join( - process.cwd(), - 'src', - 'roles', - 'infrastructure', - 'persistence', - 'document', - ), - path.join( - process.cwd(), - 'src', - 'statuses', - 'infrastructure', - 'persistence', - 'document', - ), - path.join(process.cwd(), 'env-example-document'), - path.join(process.cwd(), 'docker-compose.document.ci.yaml'), - path.join(process.cwd(), 'docker-compose.document.test.yaml'), - path.join(process.cwd(), 'docker-compose.document.yaml'), - path.join(process.cwd(), 'startup.document.ci.sh'), - path.join(process.cwd(), 'startup.document.dev.sh'), - path.join(process.cwd(), 'startup.document.test.sh'), - path.join(process.cwd(), 'document.Dockerfile'), - path.join(process.cwd(), 'document.e2e.Dockerfile'), - path.join(process.cwd(), 'document.test.Dockerfile'), - path.join(process.cwd(), '.hygen', 'seeds', 'create-document'), - path.join(process.cwd(), 'src', 'utils', 'document-entity-helper.ts'), - ]; - - replace({ - path: path.join(process.cwd(), '.github', 'workflows', 'docker-e2e.yml'), - actions: [ - { - find: /\# .*\# <\/database-document-block>/gs, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructureDatabaseModule = TypeOrmModule.forRootAsync({ - useClass: TypeOrmConfigService, - dataSourceFactory: async (options: DataSourceOptions) => { - return new DataSource(options).initialize(); - }, -});`, - }, - { - find: /\s*import \{ MongooseModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ MongooseConfigService \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'files', 'files.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalFilePersistenceModule;`, - }, - { - find: /\s*import \{ DocumentFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 'local', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalFilePersistenceModule;`, - }, - { - find: /\s*import \{ DocumentFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 's3', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalFilePersistenceModule;`, - }, - { - find: /\s*import \{ DocumentFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 's3-presigned', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalFilePersistenceModule;`, - }, - { - find: /\s*import \{ DocumentFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'session', 'session.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalSessionPersistenceModule;`, - }, - { - find: /\s*import \{ DocumentSessionPersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'users', 'users.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = RelationalUserPersistenceModule;`, - }, - { - find: /\s*import \{ DocumentUserPersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'users', 'domain', 'user.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = Number;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'statuses', 'domain', 'status.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = Number;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'roles', 'domain', 'role.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = Number;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"@nestjs\/mongoose\":.*/g, - replace: '', - }, - { - find: /\s*\"mongoose\":.*/g, - replace: '', - }, - { - find: /\s*\"seed:run:document\":.*/g, - replace: '', - }, - { - find: /\s*\"seed:create:document\":.*/g, - replace: '', - }, - { - find: /\s*\"test:e2e:document:docker\":.*/g, - replace: '', - }, - ], - }); - - filesToRemove.map((file) => { - fs.rmSync(file, { - recursive: true, - force: true, - }); - }); -}; - -export default removeMongoDb; diff --git a/.install-scripts/scripts/remove-postgresql.ts b/.install-scripts/scripts/remove-postgresql.ts deleted file mode 100644 index f75316f16..000000000 --- a/.install-scripts/scripts/remove-postgresql.ts +++ /dev/null @@ -1,364 +0,0 @@ -import replace from '../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removePostgreSql = async () => { - const filesToRemove = [ - path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'persistence', - 'relational', - ), - path.join( - process.cwd(), - 'src', - 'session', - 'infrastructure', - 'persistence', - 'relational', - ), - path.join( - process.cwd(), - 'src', - 'users', - 'infrastructure', - 'persistence', - 'relational', - ), - path.join(process.cwd(), 'src', 'database', 'migrations'), - path.join(process.cwd(), 'src', 'database', 'data-source.ts'), - path.join(process.cwd(), 'src', 'database', 'typeorm-config.service.ts'), - path.join(process.cwd(), 'src', 'database', 'seeds', 'relational'), - path.join( - process.cwd(), - 'src', - 'roles', - 'infrastructure', - 'persistence', - 'relational', - ), - path.join( - process.cwd(), - 'src', - 'statuses', - 'infrastructure', - 'persistence', - 'relational', - ), - path.join(process.cwd(), 'env-example-relational'), - path.join(process.cwd(), 'docker-compose.relational.ci.yaml'), - path.join(process.cwd(), 'docker-compose.relational.test.yaml'), - path.join(process.cwd(), 'docker-compose.yaml'), - path.join(process.cwd(), 'startup.relational.ci.sh'), - path.join(process.cwd(), 'startup.relational.test.sh'), - path.join(process.cwd(), 'startup.relational.dev.sh'), - path.join(process.cwd(), 'Dockerfile'), - path.join(process.cwd(), 'relational.e2e.Dockerfile'), - path.join(process.cwd(), 'relational.test.Dockerfile'), - path.join(process.cwd(), '.hygen', 'seeds', 'create-relational'), - path.join(process.cwd(), 'src', 'utils', 'relational-entity-helper.ts'), - ]; - - replace({ - path: path.join(process.cwd(), '.github', 'workflows', 'docker-e2e.yml'), - actions: [ - { - find: /\# .*\# <\/database-relational-block>/gs, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'app.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructureDatabaseModule = MongooseModule.forRootAsync({ - useClass: MongooseConfigService, -});`, - }, - { - find: /\s*import \{ TypeOrmModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ TypeOrmConfigService \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DataSource, DataSourceOptions \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'files', 'files.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentFilePersistenceModule;`, - }, - { - find: /\s*import \{ RelationalFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 'local', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentFilePersistenceModule;`, - }, - { - find: /\s*import \{ RelationalFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 's3', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentFilePersistenceModule;`, - }, - { - find: /\s*import \{ RelationalFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join( - process.cwd(), - 'src', - 'files', - 'infrastructure', - 'uploader', - 's3-presigned', - 'files.module.ts', - ), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentFilePersistenceModule;`, - }, - { - find: /\s*import \{ RelationalFilePersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'session', 'session.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentSessionPersistenceModule;`, - }, - { - find: /\s*import \{ RelationalSessionPersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'users', 'users.module.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const infrastructurePersistenceModule = DocumentUserPersistenceModule;`, - }, - { - find: /\s*import \{ RelationalUserPersistenceModule \} from .*/g, - replace: '', - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'users', 'domain', 'user.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = String;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'statuses', 'domain', 'status.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = String;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'src', 'roles', 'domain', 'role.ts'), - actions: [ - { - find: /\/\/ .*\/\/ <\/database-block>/gs, - replace: `const idType = String;`, - }, - { - find: /\s*import \{ DatabaseConfig \} from .*/g, - replace: '', - }, - { - find: /\s*import databaseConfig from .*/g, - replace: '', - }, - ], - }); - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"@nestjs\/typeorm\":.*/g, - replace: '', - }, - { - find: /,\s*\"typeorm\":.*\"/g, - replace: '', - }, - { - find: /\s*\"typeorm\":.*\,/g, - replace: '', - }, - { - find: /\s*\"migration:generate\":.*/g, - replace: '', - }, - { - find: /\s*\"migration:create\":.*/g, - replace: '', - }, - { - find: /\s*\"migration:run\":.*/g, - replace: '', - }, - { - find: /\s*\"migration:revert\":.*/g, - replace: '', - }, - { - find: /\s*\"seed:create:relational\":.*/g, - replace: '', - }, - { - find: /\s*\"seed:run:relational\":.*/g, - replace: '', - }, - { - find: /\s*\"schema:drop\":.*/g, - replace: '', - }, - { - find: /\s*\"test:e2e:relational:docker\":.*/g, - replace: '', - }, - { - find: /\s*\"pg\":.*/g, - replace: '', - }, - ], - }); - - filesToRemove.map((file) => { - fs.rmSync(file, { - recursive: true, - force: true, - }); - }); -}; - -export default removePostgreSql; diff --git a/.install-scripts/scripts/resource-generation-scripts/remove-all-db.ts b/.install-scripts/scripts/resource-generation-scripts/remove-all-db.ts deleted file mode 100644 index 3373a38be..000000000 --- a/.install-scripts/scripts/resource-generation-scripts/remove-all-db.ts +++ /dev/null @@ -1,32 +0,0 @@ -import replace from '../../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeAllDbResourceGeneration = async () => { - const filesToRemove = [ - path.join(process.cwd(), '.hygen', 'generate', 'all-db-resource'), - ]; - - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"generate:resource:all-db\":.*/g, - replace: '', - }, - { - find: /\s*\"postgenerate:resource:all-db\":.*/g, - replace: '', - }, - ], - }); - - filesToRemove.map((file) => { - fs.rmSync(file, { - recursive: true, - force: true, - }); - }); -}; - -export default removeAllDbResourceGeneration; diff --git a/.install-scripts/scripts/resource-generation-scripts/remove-document.ts b/.install-scripts/scripts/resource-generation-scripts/remove-document.ts deleted file mode 100644 index 403fc32b6..000000000 --- a/.install-scripts/scripts/resource-generation-scripts/remove-document.ts +++ /dev/null @@ -1,32 +0,0 @@ -import replace from '../../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeDocumentResourceGeneration = async () => { - const filesToRemove = [ - path.join(process.cwd(), '.hygen', 'generate', 'document-resource'), - ]; - - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"generate:resource:document\":.*/g, - replace: '', - }, - { - find: /\s*\"postgenerate:resource:document\":.*/g, - replace: '', - }, - ], - }); - - filesToRemove.map((file) => { - fs.rmSync(file, { - recursive: true, - force: true, - }); - }); -}; - -export default removeDocumentResourceGeneration; diff --git a/.install-scripts/scripts/resource-generation-scripts/remove-relational.ts b/.install-scripts/scripts/resource-generation-scripts/remove-relational.ts deleted file mode 100644 index f2391c773..000000000 --- a/.install-scripts/scripts/resource-generation-scripts/remove-relational.ts +++ /dev/null @@ -1,32 +0,0 @@ -import replace from '../../helpers/replace'; -import path from 'path'; -import fs from 'fs'; - -const removeRelationalResourceGeneration = async () => { - const filesToRemove = [ - path.join(process.cwd(), '.hygen', 'generate', 'relational-resource'), - ]; - - replace({ - path: path.join(process.cwd(), 'package.json'), - actions: [ - { - find: /\s*\"generate:resource:relational\":.*/g, - replace: '', - }, - { - find: /\s*\"postgenerate:resource:relational\":.*/g, - replace: '', - }, - ], - }); - - filesToRemove.map((file) => { - fs.rmSync(file, { - recursive: true, - force: true, - }); - }); -}; - -export default removeRelationalResourceGeneration; diff --git a/docker-compose.document.ci.yaml b/docker-compose.document.ci.yaml deleted file mode 100644 index d3ff9c0c6..000000000 --- a/docker-compose.document.ci.yaml +++ /dev/null @@ -1,30 +0,0 @@ -services: - mongo: - image: mongo:7.0.11 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD} - expose: - - 27017 - - maildev: - build: - context: . - dockerfile: maildev.Dockerfile - expose: - - 1080 - - 1025 - - # Uncomment to use redis - # redis: - # image: redis:7-alpine - # expose: - # - 6379 - - api: - build: - context: . - dockerfile: document.e2e.Dockerfile - env_file: - - env-example-document diff --git a/docker-compose.document.test.yaml b/docker-compose.document.test.yaml deleted file mode 100644 index caf5fb671..000000000 --- a/docker-compose.document.test.yaml +++ /dev/null @@ -1,33 +0,0 @@ -services: - mongo: - image: mongo:7.0.11 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD} - expose: - - 27017 - - maildev: - build: - context: . - dockerfile: maildev.Dockerfile - expose: - - 1080 - - 1025 - - # Uncomment to use redis - # redis: - # image: redis:7-alpine - # expose: - # - 6379 - - api: - build: - context: . - dockerfile: document.test.Dockerfile - env_file: - - env-example-document - volumes: - - ./src:/usr/src/app/src - - ./test:/usr/src/app/test diff --git a/docker-compose.document.yaml b/docker-compose.document.yaml deleted file mode 100644 index 684322e47..000000000 --- a/docker-compose.document.yaml +++ /dev/null @@ -1,45 +0,0 @@ -services: - maildev: - build: - context: . - dockerfile: maildev.Dockerfile - ports: - - ${MAIL_CLIENT_PORT}:1080 - - ${MAIL_PORT}:1025 - - mongo: - image: mongo:7.0.11 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD} - volumes: - - boilerplate-mongo-db:/data/db - ports: - - ${DATABASE_PORT}:27017 - - mongo-express: - image: mongo-express - restart: always - ports: - - 8081:8081 - environment: - ME_CONFIG_BASICAUTH_USERNAME: ${DATABASE_USERNAME} - ME_CONFIG_BASICAUTH_PASSWORD: ${DATABASE_PASSWORD} - ME_CONFIG_MONGODB_URL: mongodb://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@mongo:${DATABASE_PORT}/ - - # Uncomment to use redis - # redis: - # image: redis:7-alpine - # ports: - # - 6379:6379 - - api: - build: - context: . - dockerfile: document.Dockerfile - ports: - - ${APP_PORT}:${APP_PORT} - -volumes: - boilerplate-mongo-db: diff --git a/document.Dockerfile b/document.Dockerfile deleted file mode 100644 index a283cde79..000000000 --- a/document.Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:20.14.0-alpine - -RUN apk add --no-cache bash -RUN npm i -g @nestjs/cli typescript ts-node - -COPY package*.json /tmp/app/ -RUN cd /tmp/app && npm install - -COPY . /usr/src/app -RUN cp -a /tmp/app/node_modules /usr/src/app -COPY ./wait-for-it.sh /opt/wait-for-it.sh -RUN chmod +x /opt/wait-for-it.sh -COPY ./startup.document.dev.sh /opt/startup.document.dev.sh -RUN chmod +x /opt/startup.document.dev.sh -RUN sed -i 's/\r//g' /opt/wait-for-it.sh -RUN sed -i 's/\r//g' /opt/startup.document.dev.sh - -WORKDIR /usr/src/app -RUN if [ ! -f .env ]; then cp env-example-document .env; fi -RUN npm run build - -CMD ["/opt/startup.document.dev.sh"] diff --git a/document.e2e.Dockerfile b/document.e2e.Dockerfile deleted file mode 100644 index d53cf778a..000000000 --- a/document.e2e.Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:20.14.0-alpine - -RUN apk add --no-cache bash -RUN npm i -g @nestjs/cli typescript ts-node - -COPY package*.json /tmp/app/ -RUN cd /tmp/app && npm install - -COPY . /usr/src/app -RUN cp -a /tmp/app/node_modules /usr/src/app -COPY ./wait-for-it.sh /opt/wait-for-it.sh -RUN chmod +x /opt/wait-for-it.sh -COPY ./startup.document.ci.sh /opt/startup.document.ci.sh -RUN chmod +x /opt/startup.document.ci.sh -RUN sed -i 's/\r//g' /opt/wait-for-it.sh -RUN sed -i 's/\r//g' /opt/startup.document.ci.sh - -WORKDIR /usr/src/app -RUN echo "" > .env -RUN npm run build - -CMD ["/opt/startup.document.ci.sh"] diff --git a/document.test.Dockerfile b/document.test.Dockerfile deleted file mode 100644 index 71778cca8..000000000 --- a/document.test.Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:20.14.0-alpine - -RUN apk add --no-cache bash -RUN npm i -g @nestjs/cli typescript ts-node - -COPY package*.json /tmp/app/ -RUN cd /tmp/app && npm install - -COPY . /usr/src/app - -COPY ./wait-for-it.sh /opt/wait-for-it.sh -RUN chmod +x /opt/wait-for-it.sh -COPY ./startup.document.test.sh /opt/startup.document.test.sh -RUN chmod +x /opt/startup.document.test.sh -RUN sed -i 's/\r//g' /opt/wait-for-it.sh -RUN sed -i 's/\r//g' /opt/startup.document.test.sh - -WORKDIR /usr/src/app - -RUN echo "" > .env - -CMD ["/opt/startup.document.test.sh"] diff --git a/env-example-document b/env-example-document deleted file mode 100644 index 4b04d0017..000000000 --- a/env-example-document +++ /dev/null @@ -1,55 +0,0 @@ -NODE_ENV=development -APP_PORT=3000 -APP_NAME="NestJS API" -API_PREFIX=api -APP_FALLBACK_LANGUAGE=en -APP_HEADER_LANGUAGE=x-custom-lang -FRONTEND_DOMAIN=http://localhost:3000 -BACKEND_DOMAIN=http://localhost:3000 - -DATABASE_TYPE=mongodb -DATABASE_PORT=27017 -DATABASE_USERNAME=root -DATABASE_PASSWORD=secret -DATABASE_NAME=api -DATABASE_URL=mongodb://mongo:27017 - -# Support "local", "s3", "s3-presigned" -FILE_DRIVER=local -ACCESS_KEY_ID= -SECRET_ACCESS_KEY= -AWS_S3_REGION= -AWS_DEFAULT_S3_BUCKET= - -MAIL_HOST=maildev -MAIL_PORT=1025 -MAIL_USER= -MAIL_PASSWORD= -MAIL_IGNORE_TLS=true -MAIL_SECURE=false -MAIL_REQUIRE_TLS=false -MAIL_DEFAULT_EMAIL=noreply@example.com -MAIL_DEFAULT_NAME=Api -MAIL_CLIENT_PORT=1080 - -AUTH_JWT_SECRET=secret -AUTH_JWT_TOKEN_EXPIRES_IN=15m -AUTH_REFRESH_SECRET=secret_for_refresh -AUTH_REFRESH_TOKEN_EXPIRES_IN=3650d -AUTH_FORGOT_SECRET=secret_for_forgot -AUTH_FORGOT_TOKEN_EXPIRES_IN=30m -AUTH_CONFIRM_EMAIL_SECRET=secret_for_confirm_email -AUTH_CONFIRM_EMAIL_TOKEN_EXPIRES_IN=1d - -FACEBOOK_APP_ID= -FACEBOOK_APP_SECRET= - -GOOGLE_CLIENT_ID= -GOOGLE_CLIENT_SECRET= - -APPLE_APP_AUDIENCE=[] - -TWITTER_CONSUMER_KEY= -TWITTER_CONSUMER_SECRET= - -WORKER_HOST=redis://redis:6379/1 diff --git a/package-lock.json b/package-lock.json index bef93b0ed..5f964edde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,25 +15,20 @@ "@nestjs/config": "3.2.2", "@nestjs/core": "10.3.9", "@nestjs/jwt": "10.2.0", - "@nestjs/mongoose": "10.0.6", "@nestjs/passport": "10.0.3", "@nestjs/platform-express": "10.3.9", "@nestjs/swagger": "7.3.1", "@nestjs/typeorm": "10.0.2", "@types/multer-s3": "3.0.3", - "@types/prompts": "2.4.9", - "apple-signin-auth": "1.7.6", "bcryptjs": "2.4.3", "class-transformer": "0.5.1", "class-validator": "0.14.1", "dotenv": "16.4.5", - "fb": "2.0.0", - "google-auth-library": "9.10.0", "handlebars": "4.7.8", - "mongoose": "8.4.1", "ms": "2.1.3", "multer": "1.4.5-lts.1", "multer-s3": "3.0.1", + "mysql2": "^3.10.0", "nestjs-i18n": "10.4.5", "nodemailer": "6.9.13", "passport": "0.7.0", @@ -45,7 +40,6 @@ "rxjs": "7.8.1", "source-map-support": "0.5.21", "swagger-ui-express": "5.0.1", - "twitter": "1.7.1", "typeorm": "0.3.20" }, "devDependencies": { @@ -59,7 +53,6 @@ "@swc/core": "1.5.25", "@types/bcryptjs": "2.4.6", "@types/express": "4.17.21", - "@types/facebook-js-sdk": "3.3.11", "@types/jest": "29.5.12", "@types/ms": "0.7.34", "@types/multer": "1.4.11", @@ -67,7 +60,6 @@ "@types/passport-anonymous": "1.0.5", "@types/passport-jwt": "4.0.1", "@types/supertest": "6.0.2", - "@types/twitter": "1.7.4", "@typescript-eslint/eslint-plugin": "7.12.0", "@typescript-eslint/parser": "7.12.0", "env-cmd": "10.1.0", @@ -4463,14 +4455,6 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, - "node_modules/@mongodb-js/saslprep": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.5.tgz", - "integrity": "sha512-XLNOMH66KhJzUJNwT/qlMnS4WsNDWD5ASdyaSH3EtK+F4r/CFGa3jT4GNi4mfOitGvWXtdLgQJkQjxSVrio+jA==", - "dependencies": { - "sparse-bitfield": "^3.0.3" - } - }, "node_modules/@nestjs/cli": { "version": "10.3.2", "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-10.3.2.tgz", @@ -4833,17 +4817,6 @@ } } }, - "node_modules/@nestjs/mongoose": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@nestjs/mongoose/-/mongoose-10.0.6.tgz", - "integrity": "sha512-J8jFgSvCDEKMXU57QAIdXIlWQsOFWK+x0PM1KI/0zHe3/4JrAtFGTFD08hRX3IHk+WJT9g/XQIpMSNM7/10Jlg==", - "peerDependencies": { - "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", - "@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0", - "mongoose": "^6.0.2 || ^7.0.0 || ^8.0.0", - "rxjs": "^7.0.0" - } - }, "node_modules/@nestjs/passport": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/@nestjs/passport/-/passport-10.0.3.tgz", @@ -6605,12 +6578,6 @@ "@types/responselike": "^1.0.0" } }, - "node_modules/@types/caseless": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz", - "integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w==", - "dev": true - }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -6681,12 +6648,6 @@ "@types/range-parser": "*" } }, - "node_modules/@types/facebook-js-sdk": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/@types/facebook-js-sdk/-/facebook-js-sdk-3.3.11.tgz", - "integrity": "sha512-VMIZR6zG7rwGrviiKdujALtckGwsnz2V4tTFvmriAl4MKjNRwh5Gz6g3eExla9BB5eDPB+AREQVoIMekcxv9tg==", - "dev": true - }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -6853,15 +6814,6 @@ "@types/passport": "*" } }, - "node_modules/@types/prompts": { - "version": "2.4.9", - "resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.4.9.tgz", - "integrity": "sha512-qTxFi6Buiu8+50/+3DGIWLHM6QuWsEKugJnnP6iv2Mc4ncxE4A/OJkjuVOA+5X0X1S/nq5VJRa8Lu+nwcvbrKA==", - "dependencies": { - "@types/node": "*", - "kleur": "^3.0.3" - } - }, "node_modules/@types/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", @@ -6872,32 +6824,6 @@ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" }, - "node_modules/@types/request": { - "version": "2.48.5", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz", - "integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==", - "dev": true, - "dependencies": { - "@types/caseless": "*", - "@types/node": "*", - "@types/tough-cookie": "*", - "form-data": "^2.5.0" - } - }, - "node_modules/@types/request/node_modules/form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/@types/responselike": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", @@ -6943,40 +6869,11 @@ "@types/superagent": "^8.1.0" } }, - "node_modules/@types/tough-cookie": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.1.tgz", - "integrity": "sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg==", - "dev": true - }, - "node_modules/@types/twitter": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@types/twitter/-/twitter-1.7.4.tgz", - "integrity": "sha512-ueg2F6M7xFX4rB7kA6cqSn8CY8mIuxC8O4JT8O4yBhOiR4cPRCGHJG7X8L5cTrdU0Uk3Q8vBo/YiBYmwJPZbOw==", - "dev": true, - "dependencies": { - "@types/node": "*", - "@types/request": "*" - } - }, "node_modules/@types/validator": { "version": "13.11.8", "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.8.tgz", "integrity": "sha512-c/hzNDBh7eRF+KbCf+OoZxKbnkpaK/cKp9iLQWqB7muXtM+MtL9SUUH8vCFcLn6dH1Qm05jiexK0ofWY7TfOhQ==" }, - "node_modules/@types/webidl-conversions": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", - "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" - }, - "node_modules/@types/whatwg-url": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz", - "integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==", - "dependencies": { - "@types/webidl-conversions": "*" - } - }, "node_modules/@types/yargs": { "version": "17.0.12", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.12.tgz", @@ -7514,6 +7411,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dev": true, "dependencies": { "debug": "^4.3.4" }, @@ -7525,6 +7423,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -7540,12 +7439,14 @@ "node_modules/agent-base/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -7688,16 +7589,6 @@ "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", "integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=" }, - "node_modules/apple-signin-auth": { - "version": "1.7.6", - "resolved": "https://registry.npmjs.org/apple-signin-auth/-/apple-signin-auth-1.7.6.tgz", - "integrity": "sha512-edXKmteQRbsaxZRvF1mJpbI5UgTvoTnUrdco8+KLiFvOIh/naEB4BYu0xkWZ9+OeFQup1YyvVf5PlaaNAJHpGg==", - "dependencies": { - "jsonwebtoken": "^9.0.0", - "node-fetch": "^2.6.7", - "node-rsa": "^1.1.1" - } - }, "node_modules/arch": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", @@ -7892,22 +7783,6 @@ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/ast-types": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", @@ -7938,7 +7813,8 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "node_modules/available-typed-arrays": { "version": "1.0.5", @@ -7952,19 +7828,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==" - }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -8126,20 +7989,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dependencies": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "node_modules/babel-runtime/node_modules/regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -8173,14 +8022,6 @@ "node": ">=10.0.0" } }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/bcryptjs": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", @@ -8192,14 +8033,6 @@ "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", "dev": true }, - "node_modules/bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==", - "engines": { - "node": "*" - } - }, "node_modules/bin-check": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz", @@ -8678,15 +8511,6 @@ "node-int64": "^0.4.0" } }, - "node_modules/bson": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.7.0.tgz", - "integrity": "sha512-w2IquM5mYzYZv6rs3uN2DZTOBe2a0zXLj53TGDqwF4l6Sz/XsISrisXOJihArF9+BZ6Cq/GjVht7Sjfmri7ytQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=16.20.1" - } - }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -8863,11 +8687,6 @@ } ] }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -9217,6 +9036,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -9661,18 +9481,6 @@ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", "dev": true }, - "node_modules/core-decorators": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/core-decorators/-/core-decorators-0.17.0.tgz", - "integrity": "sha1-P0MYCobSqwzFEGn0ah7D5J5869Y=" - }, - "node_modules/core-js": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", - "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", - "hasInstallScript": true - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -9900,17 +9708,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/data-uri-to-buffer": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", @@ -9975,15 +9772,6 @@ } } }, - "node_modules/deep-extend": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", - "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -10119,10 +9907,20 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, "engines": { "node": ">=0.4.0" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -10253,15 +10051,6 @@ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -11306,11 +11095,6 @@ "node": ">=4" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -11325,18 +11109,11 @@ "node": ">=4" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "engines": [ - "node >=0.6.0" - ] - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-diff": { "version": "1.2.0", @@ -11363,7 +11140,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -11407,21 +11185,6 @@ "reusify": "^1.0.4" } }, - "node_modules/fb": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fb/-/fb-2.0.0.tgz", - "integrity": "sha1-kf1AMl2jTsQcaLJVMPw6Pg2s+mo=", - "dependencies": { - "any-promise": "^1.3.0", - "babel-runtime": "^6.23.0", - "core-decorators": "^0.17.0", - "debug": "^2.6.3", - "request": "^2.81.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -11431,19 +11194,6 @@ "bser": "2.1.1" } }, - "node_modules/fb/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/fb/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -11702,14 +11452,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "engines": { - "node": "*" - } - }, "node_modules/fork-ts-checker-webpack-plugin": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-9.0.2.tgz", @@ -11808,19 +11550,6 @@ "node": ">=8" } }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/form-data-encoder": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", @@ -11955,30 +11684,13 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gaxios": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.1.1.tgz", - "integrity": "sha512-bw8smrX+XlAoo9o1JAksBwX+hi/RG15J+NTSxmNPIclKC3ZVK6C2afwY8OSdRvOK0+ZLecUJYtj2MmjOt3Dm0w==", - "dependencies": { - "extend": "^3.0.2", - "https-proxy-agent": "^7.0.1", - "is-stream": "^2.0.0", - "node-fetch": "^2.6.9" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/gcp-metadata": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.0.tgz", - "integrity": "sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg==", + "node_modules/generate-function": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "license": "MIT", "dependencies": { - "gaxios": "^6.0.0", - "json-bigint": "^1.0.0" - }, - "engines": { - "node": ">=14" + "is-property": "^1.0.2" } }, "node_modules/gensync": { @@ -12117,14 +11829,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/git-raw-commits": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", @@ -12301,41 +12005,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-auth-library": { - "version": "9.10.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.10.0.tgz", - "integrity": "sha512-ol+oSa5NbcGdDqA+gZ3G3mev59OHBZksBTxY/tYwjtcp1H/scAFwJfSQU9/1RALoyZ7FslNbke8j4i3ipwlyuQ==", - "dependencies": { - "base64-js": "^1.3.0", - "ecdsa-sig-formatter": "^1.0.11", - "gaxios": "^6.1.1", - "gcp-metadata": "^6.1.0", - "gtoken": "^7.0.0", - "jws": "^4.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/google-auth-library/node_modules/jwa": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/google-auth-library/node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -12384,37 +12053,6 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "node_modules/gtoken": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.0.1.tgz", - "integrity": "sha512-KcFVtoP1CVFtQu0aSk3AyAt2og66PFhZAlkUOuWKwzMLoulHXG5W5wE5xAnHb+yl3/wEFoqGW7/cDGMU8igDZQ==", - "dependencies": { - "gaxios": "^6.0.0", - "jws": "^4.0.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/gtoken/node_modules/jwa": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/gtoken/node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -12443,27 +12081,6 @@ "node": ">=0.10.0" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -12678,20 +12295,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", @@ -12709,6 +12312,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "dev": true, "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -12721,6 +12325,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -12736,7 +12341,8 @@ "node_modules/https-proxy-agent/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/human-signals": { "version": "5.0.0", @@ -13167,7 +12773,7 @@ "version": "9.0.5", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", - "devOptional": true, + "dev": true, "dependencies": { "jsbn": "1.1.0", "sprintf-js": "^1.1.3" @@ -13180,13 +12786,13 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "devOptional": true + "dev": true }, "node_modules/ip-address/node_modules/sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "devOptional": true + "dev": true }, "node_modules/ipaddr.js": { "version": "1.9.1", @@ -13547,6 +13153,12 @@ "node": ">=0.10.0" } }, + "node_modules/is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==", + "license": "MIT" + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -13597,6 +13209,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true, "engines": { "node": ">=8" } @@ -13665,7 +13278,8 @@ "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "node_modules/is-unicode-supported": { "version": "0.1.0", @@ -13720,11 +13334,6 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, "node_modules/issue-parser": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-7.0.0.tgz", @@ -15717,11 +15326,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -15734,14 +15338,6 @@ "node": ">=4" } }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -15754,15 +15350,11 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -15773,7 +15365,8 @@ "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "node_modules/json5": { "version": "2.2.3", @@ -15851,20 +15444,6 @@ "npm": ">=6" } }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -15884,14 +15463,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/kareem": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.6.3.tgz", - "integrity": "sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -15905,6 +15476,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, "engines": { "node": ">=6" } @@ -16179,6 +15751,12 @@ "node": ">=8" } }, + "node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" + }, "node_modules/lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -16292,11 +15870,6 @@ "node": ">= 4.0.0" } }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" - }, "node_modules/meow": { "version": "12.1.1", "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", @@ -16437,211 +16010,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mongodb-connection-string-url": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz", - "integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==", - "dependencies": { - "@types/whatwg-url": "^11.0.2", - "whatwg-url": "^13.0.0" - } - }, - "node_modules/mongoose": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.4.1.tgz", - "integrity": "sha512-odQ2WEWGL3hb0Qex+QMN4eH6D34WdMEw7F1If2MGABApSDmG9cMmqv/G1H6WsXmuaH9mkuuadW/WbLE5+tHJwA==", - "license": "MIT", - "dependencies": { - "bson": "^6.7.0", - "kareem": "2.6.3", - "mongodb": "6.6.2", - "mpath": "0.9.0", - "mquery": "5.0.0", - "ms": "2.1.3", - "sift": "17.1.3" - }, - "engines": { - "node": ">=16.20.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mongoose/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/mongoose/node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/mongoose/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "license": "MIT", - "optional": true, - "peer": true - }, - "node_modules/mongoose/node_modules/gaxios": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.1.3.tgz", - "integrity": "sha512-95hVgBRgEIRQQQHIbnxBXeHbW4TqFk4ZDJW7wmVtvYar72FdhRIo1UGOLS2eRAKCPEdPBWu+M7+A33D9CdX9rA==", - "license": "Apache-2.0", - "optional": true, - "peer": true, - "dependencies": { - "extend": "^3.0.2", - "https-proxy-agent": "^5.0.0", - "is-stream": "^2.0.0", - "node-fetch": "^2.6.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/mongoose/node_modules/gcp-metadata": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz", - "integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==", - "license": "Apache-2.0", - "optional": true, - "peer": true, - "dependencies": { - "gaxios": "^5.0.0", - "json-bigint": "^1.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/mongoose/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/mongoose/node_modules/mongodb": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.6.2.tgz", - "integrity": "sha512-ZF9Ugo2JCG/GfR7DEb4ypfyJJyiKbg5qBYKRintebj8+DNS33CyGMkWbrS9lara+u+h+yEOGSRiLhFO/g1s1aw==", - "license": "Apache-2.0", - "dependencies": { - "@mongodb-js/saslprep": "^1.1.5", - "bson": "^6.7.0", - "mongodb-connection-string-url": "^3.0.0" - }, - "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 - } - } - }, - "node_modules/mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", - "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", - "dependencies": { - "debug": "4.x" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/mquery/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/mquery/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -16687,6 +16055,46 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/mysql2": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.10.0.tgz", + "integrity": "sha512-qx0mfWYt1DpTPkw8mAcHW/OwqqyNqBLBHvY5IjN8+icIYTjt6znrgYJ+gxqNNRpVknb5Wc/gcCM4XjbCR0j5tw==", + "license": "MIT", + "dependencies": { + "denque": "^2.1.0", + "generate-function": "^2.3.1", + "iconv-lite": "^0.6.3", + "long": "^5.2.1", + "lru-cache": "^8.0.0", + "named-placeholders": "^1.1.3", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.2" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/mysql2/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mysql2/node_modules/lru-cache": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-8.0.5.tgz", + "integrity": "sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA==", + "license": "ISC", + "engines": { + "node": ">=16.14" + } + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -16697,6 +16105,27 @@ "thenify-all": "^1.0.0" } }, + "node_modules/named-placeholders": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz", + "integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==", + "license": "MIT", + "dependencies": { + "lru-cache": "^7.14.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/named-placeholders/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -16917,14 +16346,6 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/node-rsa": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", - "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", - "dependencies": { - "asn1": "^0.2.4" - } - }, "node_modules/nodemailer": { "version": "6.9.13", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.13.tgz", @@ -16980,14 +16401,6 @@ "node": ">=8" } }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "engines": { - "node": "*" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -17805,11 +17218,6 @@ "url": "https://github.com/sponsors/Borewit" } }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, "node_modules/pg": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/pg/-/pg-8.12.0.tgz", @@ -18217,11 +17625,6 @@ "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", "dev": true }, - "node_modules/psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" - }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -18236,6 +17639,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "engines": { "node": ">=6" } @@ -19551,66 +18955,6 @@ "node": ">=0.10" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/request/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/request/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -19994,6 +19338,11 @@ "upper-case-first": "^1.1.2" } }, + "node_modules/seq-queue": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", + "integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==" + }, "node_modules/serialize-javascript": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", @@ -20099,11 +19448,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sift": { - "version": "17.1.3", - "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz", - "integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==" - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -20129,7 +19473,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "devOptional": true, + "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -20148,7 +19492,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.1.tgz", "integrity": "sha512-B6w7tkwNid7ToxjZ08rQMT8M9BJAf8DKx8Ft4NivzH0zBUfd6jldGcisJn/RLgxcX3FPNDdNQCUEMMT79b+oCQ==", - "devOptional": true, + "dev": true, "dependencies": { "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" @@ -20245,14 +19589,6 @@ "node": ">=0.10.0" } }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "dependencies": { - "memory-pager": "^1.0.2" - } - }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -20299,28 +19635,13 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "node_modules/sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, + "node_modules/sqlstring": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", + "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==", + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.6" } }, "node_modules/stack-utils": { @@ -20989,17 +20310,6 @@ "url": "https://github.com/sponsors/Borewit" } }, - "node_modules/tr46": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", - "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", - "dependencies": { - "punycode": "^2.3.0" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -21330,31 +20640,6 @@ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "license": "0BSD" }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "node_modules/twitter": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/twitter/-/twitter-1.7.1.tgz", - "integrity": "sha1-B2I3jx3BwFDkj2ZqypBOJLGpYvQ=", - "dependencies": { - "deep-extend": "^0.5.0", - "request": "^2.72.0" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -21942,6 +21227,7 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -22042,19 +21328,6 @@ "node": ">= 0.8" } }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -22095,14 +21368,6 @@ "node": ">= 8" } }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "engines": { - "node": ">=12" - } - }, "node_modules/webpack": { "version": "5.90.1", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", @@ -22168,18 +21433,6 @@ "node": ">=10.13.0" } }, - "node_modules/whatwg-url": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", - "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", - "dependencies": { - "tr46": "^4.1.1", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 2b1634db9..6699bcc46 100644 --- a/package.json +++ b/package.json @@ -13,16 +13,9 @@ "migration:revert": "npm run typeorm -- --dataSource=src/database/data-source.ts migration:revert", "schema:drop": "npm run typeorm -- --dataSource=src/database/data-source.ts schema:drop", "seed:create:relational": "hygen seeds create-relational", - "seed:create:document": "hygen seeds create-document", "generate:resource:relational": "hygen generate relational-resource", "postgenerate:resource:relational": "npm run lint -- --fix", - "generate:resource:document": "hygen generate document-resource", - "postgenerate:resource:document": "npm run lint -- --fix", - "generate:resource:all-db": "hygen generate all-db-resource", - "postgenerate:resource:all-db": "npm run lint -- --fix", - "app:config": "ts-node -r tsconfig-paths/register ./.install-scripts/index.ts && npm install && npm run lint -- --fix", "seed:run:relational": "ts-node -r tsconfig-paths/register ./src/database/seeds/relational/run-seed.ts", - "seed:run:document": "ts-node -r tsconfig-paths/register ./src/database/seeds/document/run-seed.ts", "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", @@ -37,7 +30,6 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "env-cmd jest --config ./test/jest-e2e.json", - "test:e2e:document:docker": "docker compose -f docker-compose.document.test.yaml --env-file env-example-document -p tests up -d --build && docker compose -f docker-compose.document.test.yaml -p tests exec api /opt/wait-for-it.sh -t 0 localhost:3000 -- npm run test:e2e -- --watchAll --runInBand && docker compose -f docker-compose.document.test.yaml -p tests down && docker compose -p tests rm -svf", "test:e2e:relational:docker": "docker compose -f docker-compose.relational.test.yaml --env-file env-example-relational -p tests up -d --build && docker compose -f docker-compose.relational.test.yaml -p tests exec api /opt/wait-for-it.sh -t 0 localhost:3000 -- npm run test:e2e -- --watchAll --runInBand && docker compose -f docker-compose.relational.test.yaml -p tests down && docker compose -p tests rm -svf", "prepare": "is-ci || husky", "release": "release-it" @@ -49,25 +41,20 @@ "@nestjs/config": "3.2.2", "@nestjs/core": "10.3.9", "@nestjs/jwt": "10.2.0", - "@nestjs/mongoose": "10.0.6", "@nestjs/passport": "10.0.3", "@nestjs/platform-express": "10.3.9", "@nestjs/swagger": "7.3.1", "@nestjs/typeorm": "10.0.2", "@types/multer-s3": "3.0.3", - "@types/prompts": "2.4.9", - "apple-signin-auth": "1.7.6", "bcryptjs": "2.4.3", "class-transformer": "0.5.1", "class-validator": "0.14.1", "dotenv": "16.4.5", - "fb": "2.0.0", - "google-auth-library": "9.10.0", "handlebars": "4.7.8", - "mongoose": "8.4.1", "ms": "2.1.3", "multer": "1.4.5-lts.1", "multer-s3": "3.0.1", + "mysql2": "^3.10.0", "nestjs-i18n": "10.4.5", "nodemailer": "6.9.13", "passport": "0.7.0", @@ -79,7 +66,6 @@ "rxjs": "7.8.1", "source-map-support": "0.5.21", "swagger-ui-express": "5.0.1", - "twitter": "1.7.1", "typeorm": "0.3.20" }, "devDependencies": { @@ -93,7 +79,6 @@ "@swc/core": "1.5.25", "@types/bcryptjs": "2.4.6", "@types/express": "4.17.21", - "@types/facebook-js-sdk": "3.3.11", "@types/jest": "29.5.12", "@types/ms": "0.7.34", "@types/multer": "1.4.11", @@ -101,7 +86,6 @@ "@types/passport-anonymous": "1.0.5", "@types/passport-jwt": "4.0.1", "@types/supertest": "6.0.2", - "@types/twitter": "1.7.4", "@typescript-eslint/eslint-plugin": "7.12.0", "@typescript-eslint/parser": "7.12.0", "env-cmd": "10.1.0", diff --git a/src/app.module.ts b/src/app.module.ts index 8a03601a9..5f8d0bdac 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -7,17 +7,9 @@ import authConfig from './auth/config/auth.config'; import appConfig from './config/app.config'; import mailConfig from './mail/config/mail.config'; import fileConfig from './files/config/file.config'; -import facebookConfig from './auth-facebook/config/facebook.config'; -import googleConfig from './auth-google/config/google.config'; -import twitterConfig from './auth-twitter/config/twitter.config'; -import appleConfig from './auth-apple/config/apple.config'; import path from 'path'; import { ConfigModule, ConfigService } from '@nestjs/config'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AuthAppleModule } from './auth-apple/auth-apple.module'; -import { AuthFacebookModule } from './auth-facebook/auth-facebook.module'; -import { AuthGoogleModule } from './auth-google/auth-google.module'; -import { AuthTwitterModule } from './auth-twitter/auth-twitter.module'; import { I18nModule } from 'nestjs-i18n/dist/i18n.module'; import { HeaderResolver } from 'nestjs-i18n'; import { TypeOrmConfigService } from './database/typeorm-config.service'; @@ -27,39 +19,19 @@ import { DataSource, DataSourceOptions } from 'typeorm'; import { AllConfigType } from './config/config.type'; import { SessionModule } from './session/session.module'; import { MailerModule } from './mailer/mailer.module'; -import { MongooseModule } from '@nestjs/mongoose'; -import { MongooseConfigService } from './database/mongoose-config.service'; -import { DatabaseConfig } from './database/config/database-config.type'; -// -const infrastructureDatabaseModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? MongooseModule.forRootAsync({ - useClass: MongooseConfigService, - }) - : TypeOrmModule.forRootAsync({ - useClass: TypeOrmConfigService, - dataSourceFactory: async (options: DataSourceOptions) => { - return new DataSource(options).initialize(); - }, - }); -// +const infrastructureDatabaseModule = TypeOrmModule.forRootAsync({ + useClass: TypeOrmConfigService, + dataSourceFactory: async (options: DataSourceOptions) => { + return new DataSource(options).initialize(); + }, +}); @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true, - load: [ - databaseConfig, - authConfig, - appConfig, - mailConfig, - fileConfig, - facebookConfig, - googleConfig, - twitterConfig, - appleConfig, - ], + load: [databaseConfig, authConfig, appConfig, mailConfig, fileConfig], envFilePath: ['.env'], }), infrastructureDatabaseModule, @@ -89,10 +61,6 @@ const infrastructureDatabaseModule = (databaseConfig() as DatabaseConfig) UsersModule, FilesModule, AuthModule, - AuthFacebookModule, - AuthGoogleModule, - AuthTwitterModule, - AuthAppleModule, SessionModule, MailModule, MailerModule, diff --git a/src/auth-apple/auth-apple.controller.ts b/src/auth-apple/auth-apple.controller.ts deleted file mode 100644 index f021d5084..000000000 --- a/src/auth-apple/auth-apple.controller.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - Body, - Controller, - HttpCode, - HttpStatus, - Post, - SerializeOptions, -} from '@nestjs/common'; -import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { AuthService } from '../auth/auth.service'; -import { AuthAppleService } from './auth-apple.service'; -import { AuthAppleLoginDto } from './dto/auth-apple-login.dto'; -import { LoginResponseDto } from '../auth/dto/login-response.dto'; - -@ApiTags('Auth') -@Controller({ - path: 'auth/apple', - version: '1', -}) -export class AuthAppleController { - constructor( - private readonly authService: AuthService, - private readonly authAppleService: AuthAppleService, - ) {} - - @ApiOkResponse({ - type: LoginResponseDto, - }) - @SerializeOptions({ - groups: ['me'], - }) - @Post('login') - @HttpCode(HttpStatus.OK) - async login(@Body() loginDto: AuthAppleLoginDto): Promise { - const socialData = await this.authAppleService.getProfileByToken(loginDto); - - return this.authService.validateSocialLogin('apple', socialData); - } -} diff --git a/src/auth-apple/auth-apple.module.ts b/src/auth-apple/auth-apple.module.ts deleted file mode 100644 index 8d620ffab..000000000 --- a/src/auth-apple/auth-apple.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from '@nestjs/common'; -import { AuthAppleService } from './auth-apple.service'; -import { ConfigModule } from '@nestjs/config'; -import { AuthAppleController } from './auth-apple.controller'; -import { AuthModule } from '../auth/auth.module'; - -@Module({ - imports: [ConfigModule, AuthModule], - providers: [AuthAppleService], - exports: [AuthAppleService], - controllers: [AuthAppleController], -}) -export class AuthAppleModule {} diff --git a/src/auth-apple/auth-apple.service.ts b/src/auth-apple/auth-apple.service.ts deleted file mode 100644 index 0e98508a5..000000000 --- a/src/auth-apple/auth-apple.service.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import appleSigninAuth from 'apple-signin-auth'; -import { ConfigService } from '@nestjs/config'; -import { SocialInterface } from '../social/interfaces/social.interface'; -import { AuthAppleLoginDto } from './dto/auth-apple-login.dto'; -import { AllConfigType } from '../config/config.type'; - -@Injectable() -export class AuthAppleService { - constructor(private configService: ConfigService) {} - - async getProfileByToken( - loginDto: AuthAppleLoginDto, - ): Promise { - const data = await appleSigninAuth.verifyIdToken(loginDto.idToken, { - audience: this.configService.get('apple.appAudience', { infer: true }), - }); - - return { - id: data.sub, - email: data.email, - firstName: loginDto.firstName, - lastName: loginDto.lastName, - }; - } -} diff --git a/src/auth-apple/config/apple-config.type.ts b/src/auth-apple/config/apple-config.type.ts deleted file mode 100644 index 5099373f2..000000000 --- a/src/auth-apple/config/apple-config.type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type AppleConfig = { - appAudience: string[]; -}; diff --git a/src/auth-apple/config/apple.config.ts b/src/auth-apple/config/apple.config.ts deleted file mode 100644 index bdae3867d..000000000 --- a/src/auth-apple/config/apple.config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { registerAs } from '@nestjs/config'; - -import { IsJSON, IsOptional } from 'class-validator'; -import validateConfig from '../../utils/validate-config'; -import { AppleConfig } from './apple-config.type'; - -class EnvironmentVariablesValidator { - @IsJSON() - @IsOptional() - APPLE_APP_AUDIENCE: string; -} - -export default registerAs('apple', () => { - validateConfig(process.env, EnvironmentVariablesValidator); - - return { - appAudience: JSON.parse(process.env.APPLE_APP_AUDIENCE ?? '[]'), - }; -}); diff --git a/src/auth-apple/dto/auth-apple-login.dto.ts b/src/auth-apple/dto/auth-apple-login.dto.ts deleted file mode 100644 index bb3118111..000000000 --- a/src/auth-apple/dto/auth-apple-login.dto.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { Allow, IsNotEmpty } from 'class-validator'; - -export class AuthAppleLoginDto { - @ApiProperty({ example: 'abc' }) - @IsNotEmpty() - idToken: string; - - @Allow() - @ApiPropertyOptional() - firstName?: string; - - @Allow() - @ApiPropertyOptional() - lastName?: string; -} diff --git a/src/auth-facebook/auth-facebook.controller.ts b/src/auth-facebook/auth-facebook.controller.ts deleted file mode 100644 index 2ca5400fe..000000000 --- a/src/auth-facebook/auth-facebook.controller.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - Body, - Controller, - HttpCode, - HttpStatus, - Post, - SerializeOptions, -} from '@nestjs/common'; -import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { AuthService } from '../auth/auth.service'; -import { AuthFacebookService } from './auth-facebook.service'; -import { AuthFacebookLoginDto } from './dto/auth-facebook-login.dto'; -import { LoginResponseDto } from '../auth/dto/login-response.dto'; - -@ApiTags('Auth') -@Controller({ - path: 'auth/facebook', - version: '1', -}) -export class AuthFacebookController { - constructor( - private readonly authService: AuthService, - private readonly authFacebookService: AuthFacebookService, - ) {} - - @ApiOkResponse({ - type: LoginResponseDto, - }) - @SerializeOptions({ - groups: ['me'], - }) - @Post('login') - @HttpCode(HttpStatus.OK) - async login( - @Body() loginDto: AuthFacebookLoginDto, - ): Promise { - const socialData = - await this.authFacebookService.getProfileByToken(loginDto); - - return this.authService.validateSocialLogin('facebook', socialData); - } -} diff --git a/src/auth-facebook/auth-facebook.module.ts b/src/auth-facebook/auth-facebook.module.ts deleted file mode 100644 index 28e7e9621..000000000 --- a/src/auth-facebook/auth-facebook.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from '@nestjs/common'; -import { AuthFacebookService } from './auth-facebook.service'; -import { ConfigModule } from '@nestjs/config'; -import { AuthFacebookController } from './auth-facebook.controller'; -import { AuthModule } from '../auth/auth.module'; - -@Module({ - imports: [ConfigModule, AuthModule], - providers: [AuthFacebookService], - exports: [AuthFacebookService], - controllers: [AuthFacebookController], -}) -export class AuthFacebookModule {} diff --git a/src/auth-facebook/auth-facebook.service.ts b/src/auth-facebook/auth-facebook.service.ts deleted file mode 100644 index a2dd867f5..000000000 --- a/src/auth-facebook/auth-facebook.service.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { Facebook } from 'fb'; -import { ConfigService } from '@nestjs/config'; -import { SocialInterface } from '../social/interfaces/social.interface'; -import { FacebookInterface } from './interfaces/facebook.interface'; -import { AuthFacebookLoginDto } from './dto/auth-facebook-login.dto'; -import { AllConfigType } from '../config/config.type'; - -@Injectable() -export class AuthFacebookService { - constructor(private configService: ConfigService) {} - - async getProfileByToken( - loginDto: AuthFacebookLoginDto, - ): Promise { - const fb: Facebook = new Facebook({ - appId: this.configService.get('facebook.appId', { - infer: true, - }), - appSecret: this.configService.get('facebook.appSecret', { - infer: true, - }), - version: 'v7.0', - }); - fb.setAccessToken(loginDto.accessToken); - - const data: FacebookInterface = await new Promise((resolve) => { - fb.api( - '/me', - 'get', - { fields: 'id,last_name,email,first_name' }, - (response) => { - resolve(response); - }, - ); - }); - - return { - id: data.id, - email: data.email, - firstName: data.first_name, - lastName: data.last_name, - }; - } -} diff --git a/src/auth-facebook/config/facebook-config.type.ts b/src/auth-facebook/config/facebook-config.type.ts deleted file mode 100644 index c4c16fc3d..000000000 --- a/src/auth-facebook/config/facebook-config.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type FacebookConfig = { - appId?: string; - appSecret?: string; -}; diff --git a/src/auth-facebook/config/facebook.config.ts b/src/auth-facebook/config/facebook.config.ts deleted file mode 100644 index 5bfaf460f..000000000 --- a/src/auth-facebook/config/facebook.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { registerAs } from '@nestjs/config'; - -import { IsOptional, IsString } from 'class-validator'; -import validateConfig from '../../utils/validate-config'; -import { FacebookConfig } from './facebook-config.type'; - -class EnvironmentVariablesValidator { - @IsString() - @IsOptional() - FACEBOOK_APP_ID: string; - - @IsString() - @IsOptional() - FACEBOOK_APP_SECRET: string; -} - -export default registerAs('facebook', () => { - validateConfig(process.env, EnvironmentVariablesValidator); - - return { - appId: process.env.FACEBOOK_APP_ID, - appSecret: process.env.FACEBOOK_APP_SECRET, - }; -}); diff --git a/src/auth-facebook/dto/auth-facebook-login.dto.ts b/src/auth-facebook/dto/auth-facebook-login.dto.ts deleted file mode 100644 index e9f2735c5..000000000 --- a/src/auth-facebook/dto/auth-facebook-login.dto.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty } from 'class-validator'; - -export class AuthFacebookLoginDto { - @ApiProperty({ example: 'abc' }) - @IsNotEmpty() - accessToken: string; -} diff --git a/src/auth-facebook/interfaces/facebook.interface.ts b/src/auth-facebook/interfaces/facebook.interface.ts deleted file mode 100644 index 054cffe50..000000000 --- a/src/auth-facebook/interfaces/facebook.interface.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface FacebookInterface { - id: string; - first_name?: string; - last_name?: string; - email?: string; -} diff --git a/src/auth-google/auth-google.controller.ts b/src/auth-google/auth-google.controller.ts deleted file mode 100644 index d55f4d532..000000000 --- a/src/auth-google/auth-google.controller.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - Body, - Controller, - HttpCode, - HttpStatus, - Post, - SerializeOptions, -} from '@nestjs/common'; -import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { AuthService } from '../auth/auth.service'; -import { AuthGoogleService } from './auth-google.service'; -import { AuthGoogleLoginDto } from './dto/auth-google-login.dto'; -import { LoginResponseDto } from '../auth/dto/login-response.dto'; - -@ApiTags('Auth') -@Controller({ - path: 'auth/google', - version: '1', -}) -export class AuthGoogleController { - constructor( - private readonly authService: AuthService, - private readonly authGoogleService: AuthGoogleService, - ) {} - - @ApiOkResponse({ - type: LoginResponseDto, - }) - @SerializeOptions({ - groups: ['me'], - }) - @Post('login') - @HttpCode(HttpStatus.OK) - async login(@Body() loginDto: AuthGoogleLoginDto): Promise { - const socialData = await this.authGoogleService.getProfileByToken(loginDto); - - return this.authService.validateSocialLogin('google', socialData); - } -} diff --git a/src/auth-google/auth-google.module.ts b/src/auth-google/auth-google.module.ts deleted file mode 100644 index fa49ea2a0..000000000 --- a/src/auth-google/auth-google.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from '@nestjs/common'; -import { AuthGoogleService } from './auth-google.service'; -import { ConfigModule } from '@nestjs/config'; -import { AuthGoogleController } from './auth-google.controller'; -import { AuthModule } from '../auth/auth.module'; - -@Module({ - imports: [ConfigModule, AuthModule], - providers: [AuthGoogleService], - exports: [AuthGoogleService], - controllers: [AuthGoogleController], -}) -export class AuthGoogleModule {} diff --git a/src/auth-google/auth-google.service.ts b/src/auth-google/auth-google.service.ts deleted file mode 100644 index e24ea289c..000000000 --- a/src/auth-google/auth-google.service.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - HttpStatus, - Injectable, - UnprocessableEntityException, -} from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import { OAuth2Client } from 'google-auth-library'; -import { SocialInterface } from '../social/interfaces/social.interface'; -import { AuthGoogleLoginDto } from './dto/auth-google-login.dto'; -import { AllConfigType } from '../config/config.type'; - -@Injectable() -export class AuthGoogleService { - private google: OAuth2Client; - - constructor(private configService: ConfigService) { - this.google = new OAuth2Client( - configService.get('google.clientId', { infer: true }), - configService.get('google.clientSecret', { infer: true }), - ); - } - - async getProfileByToken( - loginDto: AuthGoogleLoginDto, - ): Promise { - const ticket = await this.google.verifyIdToken({ - idToken: loginDto.idToken, - audience: [ - this.configService.getOrThrow('google.clientId', { infer: true }), - ], - }); - - const data = ticket.getPayload(); - - if (!data) { - throw new UnprocessableEntityException({ - status: HttpStatus.UNPROCESSABLE_ENTITY, - errors: { - user: 'wrongToken', - }, - }); - } - - return { - id: data.sub, - email: data.email, - firstName: data.given_name, - lastName: data.family_name, - }; - } -} diff --git a/src/auth-google/config/google-config.type.ts b/src/auth-google/config/google-config.type.ts deleted file mode 100644 index 5071db76a..000000000 --- a/src/auth-google/config/google-config.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type GoogleConfig = { - clientId?: string; - clientSecret?: string; -}; diff --git a/src/auth-google/config/google.config.ts b/src/auth-google/config/google.config.ts deleted file mode 100644 index dc58e3b25..000000000 --- a/src/auth-google/config/google.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { registerAs } from '@nestjs/config'; - -import { IsOptional, IsString } from 'class-validator'; -import validateConfig from '../../utils/validate-config'; -import { GoogleConfig } from './google-config.type'; - -class EnvironmentVariablesValidator { - @IsString() - @IsOptional() - GOOGLE_CLIENT_ID: string; - - @IsString() - @IsOptional() - GOOGLE_CLIENT_SECRET: string; -} - -export default registerAs('google', () => { - validateConfig(process.env, EnvironmentVariablesValidator); - - return { - clientId: process.env.GOOGLE_CLIENT_ID, - clientSecret: process.env.GOOGLE_CLIENT_SECRET, - }; -}); diff --git a/src/auth-google/dto/auth-google-login.dto.ts b/src/auth-google/dto/auth-google-login.dto.ts deleted file mode 100644 index 959be16e9..000000000 --- a/src/auth-google/dto/auth-google-login.dto.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty } from 'class-validator'; - -export class AuthGoogleLoginDto { - @ApiProperty({ example: 'abc' }) - @IsNotEmpty() - idToken: string; -} diff --git a/src/auth-twitter/auth-twitter.controller.ts b/src/auth-twitter/auth-twitter.controller.ts deleted file mode 100644 index b165f37ce..000000000 --- a/src/auth-twitter/auth-twitter.controller.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - Body, - Controller, - HttpCode, - HttpStatus, - Post, - SerializeOptions, -} from '@nestjs/common'; -import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { AuthService } from '../auth/auth.service'; -import { AuthTwitterService } from './auth-twitter.service'; -import { AuthTwitterLoginDto } from './dto/auth-twitter-login.dto'; -import { LoginResponseDto } from '../auth/dto/login-response.dto'; - -@ApiTags('Auth') -@Controller({ - path: 'auth/twitter', - version: '1', -}) -export class AuthTwitterController { - constructor( - private readonly authService: AuthService, - private readonly authTwitterService: AuthTwitterService, - ) {} - - @ApiOkResponse({ - type: LoginResponseDto, - }) - @SerializeOptions({ - groups: ['me'], - }) - @Post('login') - @HttpCode(HttpStatus.OK) - async login( - @Body() loginDto: AuthTwitterLoginDto, - ): Promise { - const socialData = - await this.authTwitterService.getProfileByToken(loginDto); - - return this.authService.validateSocialLogin('twitter', socialData); - } -} diff --git a/src/auth-twitter/auth-twitter.module.ts b/src/auth-twitter/auth-twitter.module.ts deleted file mode 100644 index 38d576dbb..000000000 --- a/src/auth-twitter/auth-twitter.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from '@nestjs/common'; -import { AuthTwitterService } from './auth-twitter.service'; -import { ConfigModule } from '@nestjs/config'; -import { AuthTwitterController } from './auth-twitter.controller'; -import { AuthModule } from '../auth/auth.module'; - -@Module({ - imports: [ConfigModule, AuthModule], - providers: [AuthTwitterService], - exports: [AuthTwitterService], - controllers: [AuthTwitterController], -}) -export class AuthTwitterModule {} diff --git a/src/auth-twitter/auth-twitter.service.ts b/src/auth-twitter/auth-twitter.service.ts deleted file mode 100644 index 3a8fe79a2..000000000 --- a/src/auth-twitter/auth-twitter.service.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import Twitter from 'twitter'; -import { SocialInterface } from '../social/interfaces/social.interface'; -import { AuthTwitterLoginDto } from './dto/auth-twitter-login.dto'; -import { AllConfigType } from '../config/config.type'; - -@Injectable() -export class AuthTwitterService { - constructor(private configService: ConfigService) {} - - async getProfileByToken( - loginDto: AuthTwitterLoginDto, - ): Promise { - const twitter = new Twitter({ - consumer_key: this.configService.getOrThrow('twitter.consumerKey', { - infer: true, - }), - consumer_secret: this.configService.getOrThrow('twitter.consumerSecret', { - infer: true, - }), - access_token_key: loginDto.accessTokenKey, - access_token_secret: loginDto.accessTokenSecret, - }); - - const data: Twitter.ResponseData = await new Promise((resolve) => { - twitter.get( - 'account/verify_credentials', - { include_email: true }, - (error, profile) => { - resolve(profile); - }, - ); - }); - - return { - id: data.id?.toString(), - email: data.email, - firstName: data.name, - }; - } -} diff --git a/src/auth-twitter/config/twitter-config.type.ts b/src/auth-twitter/config/twitter-config.type.ts deleted file mode 100644 index 6b984e690..000000000 --- a/src/auth-twitter/config/twitter-config.type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type TwitterConfig = { - consumerKey?: string; - consumerSecret?: string; -}; diff --git a/src/auth-twitter/config/twitter.config.ts b/src/auth-twitter/config/twitter.config.ts deleted file mode 100644 index 75f472eb1..000000000 --- a/src/auth-twitter/config/twitter.config.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { registerAs } from '@nestjs/config'; -import { IsString, IsOptional } from 'class-validator'; -import validateConfig from '../../utils/validate-config'; - -class EnvironmentVariablesValidator { - @IsString() - @IsOptional() - TWITTER_CONSUMER_KEY: string; - - @IsString() - @IsOptional() - TWITTER_CONSUMER_SECRET: string; -} - -export default registerAs('twitter', () => { - validateConfig(process.env, EnvironmentVariablesValidator); - - return { - consumerKey: process.env.TWITTER_CONSUMER_KEY, - consumerSecret: process.env.TWITTER_CONSUMER_SECRET, - }; -}); diff --git a/src/auth-twitter/dto/auth-twitter-login.dto.ts b/src/auth-twitter/dto/auth-twitter-login.dto.ts deleted file mode 100644 index 2ecc42bc1..000000000 --- a/src/auth-twitter/dto/auth-twitter-login.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty } from 'class-validator'; - -export class AuthTwitterLoginDto { - @ApiProperty({ example: 'abc' }) - @IsNotEmpty() - accessTokenKey: string; - - @ApiProperty({ example: 'abc' }) - @IsNotEmpty() - accessTokenSecret: string; -} diff --git a/src/config/config.type.ts b/src/config/config.type.ts index 950e04145..f2d28f46b 100644 --- a/src/config/config.type.ts +++ b/src/config/config.type.ts @@ -1,21 +1,13 @@ import { AppConfig } from './app-config.type'; -import { AppleConfig } from '../auth-apple/config/apple-config.type'; import { AuthConfig } from '../auth/config/auth-config.type'; import { DatabaseConfig } from '../database/config/database-config.type'; -import { FacebookConfig } from '../auth-facebook/config/facebook-config.type'; import { FileConfig } from '../files/config/file-config.type'; -import { GoogleConfig } from '../auth-google/config/google-config.type'; import { MailConfig } from '../mail/config/mail-config.type'; -import { TwitterConfig } from '../auth-twitter/config/twitter-config.type'; export type AllConfigType = { app: AppConfig; - apple: AppleConfig; auth: AuthConfig; database: DatabaseConfig; - facebook: FacebookConfig; file: FileConfig; - google: GoogleConfig; mail: MailConfig; - twitter: TwitterConfig; }; diff --git a/src/database/mongoose-config.service.ts b/src/database/mongoose-config.service.ts deleted file mode 100644 index 66d15b66b..000000000 --- a/src/database/mongoose-config.service.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import { - MongooseModuleOptions, - MongooseOptionsFactory, -} from '@nestjs/mongoose'; -import { AllConfigType } from '../config/config.type'; - -@Injectable() -export class MongooseConfigService implements MongooseOptionsFactory { - constructor(private configService: ConfigService) {} - - createMongooseOptions(): MongooseModuleOptions { - return { - uri: this.configService.get('database.url', { infer: true }), - dbName: this.configService.get('database.name', { infer: true }), - user: this.configService.get('database.username', { infer: true }), - pass: this.configService.get('database.password', { infer: true }), - }; - } -} diff --git a/src/database/seeds/document/run-seed.ts b/src/database/seeds/document/run-seed.ts deleted file mode 100644 index 9e43fbdef..000000000 --- a/src/database/seeds/document/run-seed.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NestFactory } from '@nestjs/core'; -import { UserSeedService } from './user/user-seed.service'; - -import { SeedModule } from './seed.module'; - -const runSeed = async () => { - const app = await NestFactory.create(SeedModule); - - // run - await app.get(UserSeedService).run(); - - await app.close(); -}; - -void runSeed(); diff --git a/src/database/seeds/document/seed.module.ts b/src/database/seeds/document/seed.module.ts deleted file mode 100644 index 6d24061e4..000000000 --- a/src/database/seeds/document/seed.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Module } from '@nestjs/common'; -import { ConfigModule } from '@nestjs/config'; - -import { MongooseModule } from '@nestjs/mongoose'; - -import { UserSeedModule } from './user/user-seed.module'; -import appConfig from '../../../config/app.config'; -import databaseConfig from '../../config/database.config'; -import { MongooseConfigService } from '../../mongoose-config.service'; - -@Module({ - imports: [ - UserSeedModule, - ConfigModule.forRoot({ - isGlobal: true, - load: [databaseConfig, appConfig], - envFilePath: ['.env'], - }), - MongooseModule.forRootAsync({ - useClass: MongooseConfigService, - }), - ], -}) -export class SeedModule {} diff --git a/src/database/seeds/document/user/user-seed.module.ts b/src/database/seeds/document/user/user-seed.module.ts deleted file mode 100644 index de629e839..000000000 --- a/src/database/seeds/document/user/user-seed.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { UserSeedService } from './user-seed.service'; -import { - UserSchemaClass, - UserSchema, -} from '../../../../users/infrastructure/persistence/document/entities/user.schema'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { - name: UserSchemaClass.name, - schema: UserSchema, - }, - ]), - ], - providers: [UserSeedService], - exports: [UserSeedService], -}) -export class UserSeedModule {} diff --git a/src/database/seeds/document/user/user-seed.service.ts b/src/database/seeds/document/user/user-seed.service.ts deleted file mode 100644 index fa36217f1..000000000 --- a/src/database/seeds/document/user/user-seed.service.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectModel } from '@nestjs/mongoose'; -import bcrypt from 'bcryptjs'; -import { Model } from 'mongoose'; -import { RoleEnum } from '../../../../roles/roles.enum'; -import { StatusEnum } from '../../../../statuses/statuses.enum'; -import { UserSchemaClass } from '../../../../users/infrastructure/persistence/document/entities/user.schema'; - -@Injectable() -export class UserSeedService { - constructor( - @InjectModel(UserSchemaClass.name) - private readonly model: Model, - ) {} - - async run() { - const admin = await this.model.findOne({ - email: 'admin@example.com', - }); - - if (!admin) { - const salt = await bcrypt.genSalt(); - const password = await bcrypt.hash('secret', salt); - - const data = new this.model({ - email: 'admin@example.com', - password: password, - firstName: 'Super', - lastName: 'Admin', - role: { - _id: RoleEnum.admin.toString(), - }, - status: { - _id: StatusEnum.active.toString(), - }, - }); - await data.save(); - } - - const user = await this.model.findOne({ - email: 'john.doe@example.com', - }); - - if (!user) { - const salt = await bcrypt.genSalt(); - const password = await bcrypt.hash('secret', salt); - - const data = new this.model({ - email: 'john.doe@example.com', - password: password, - firstName: 'John', - lastName: 'Doe', - role: { - _id: RoleEnum.user.toString(), - }, - status: { - _id: StatusEnum.active.toString(), - }, - }); - - await data.save(); - } - } -} diff --git a/src/files/files.module.ts b/src/files/files.module.ts index 16fcbcf06..6e0b194b9 100644 --- a/src/files/files.module.ts +++ b/src/files/files.module.ts @@ -1,6 +1,4 @@ import { Module } from '@nestjs/common'; - -import { DocumentFilePersistenceModule } from './infrastructure/persistence/document/document-persistence.module'; import { RelationalFilePersistenceModule } from './infrastructure/persistence/relational/relational-persistence.module'; import { FilesService } from './files.service'; import fileConfig from './config/file.config'; @@ -8,15 +6,8 @@ import { FileConfig, FileDriver } from './config/file-config.type'; import { FilesLocalModule } from './infrastructure/uploader/local/files.module'; import { FilesS3Module } from './infrastructure/uploader/s3/files.module'; import { FilesS3PresignedModule } from './infrastructure/uploader/s3-presigned/files.module'; -import { DatabaseConfig } from '../database/config/database-config.type'; -import databaseConfig from '../database/config/database.config'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentFilePersistenceModule - : RelationalFilePersistenceModule; -// +const infrastructurePersistenceModule = RelationalFilePersistenceModule; const infrastructureUploaderModule = (fileConfig() as FileConfig).driver === FileDriver.LOCAL diff --git a/src/files/infrastructure/persistence/document/document-persistence.module.ts b/src/files/infrastructure/persistence/document/document-persistence.module.ts deleted file mode 100644 index 955eba3f5..000000000 --- a/src/files/infrastructure/persistence/document/document-persistence.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { FileSchema, FileSchemaClass } from './entities/file.schema'; -import { FileRepository } from '../file.repository'; -import { FileDocumentRepository } from './repositories/file.repository'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { name: FileSchemaClass.name, schema: FileSchema }, - ]), - ], - providers: [ - { - provide: FileRepository, - useClass: FileDocumentRepository, - }, - ], - exports: [FileRepository], -}) -export class DocumentFilePersistenceModule {} diff --git a/src/files/infrastructure/persistence/document/entities/file.schema.ts b/src/files/infrastructure/persistence/document/entities/file.schema.ts deleted file mode 100644 index ea304b2d8..000000000 --- a/src/files/infrastructure/persistence/document/entities/file.schema.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3'; -import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; -import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; -// We use class-transformer in schema and domain entity. -// We duplicate these rules because you can choose not to use adapters -// in your project and return an schema entity directly in response. -import { Transform } from 'class-transformer'; -import { HydratedDocument } from 'mongoose'; -import { AppConfig } from '../../../../../config/app-config.type'; -import appConfig from '../../../../../config/app.config'; -import { EntityDocumentHelper } from '../../../../../utils/document-entity-helper'; -import { FileConfig, FileDriver } from '../../../../config/file-config.type'; -import fileConfig from '../../../../config/file.config'; -import { ApiResponseProperty } from '@nestjs/swagger'; - -export type FileSchemaDocument = HydratedDocument; - -@Schema({ - toJSON: { - virtuals: true, - getters: true, - }, -}) -export class FileSchemaClass extends EntityDocumentHelper { - @ApiResponseProperty({ - type: String, - example: 'https://example.com/path/to/file.jpg', - }) - @Prop() - @Transform( - ({ value }) => { - if ((fileConfig() as FileConfig).driver === FileDriver.LOCAL) { - return (appConfig() as AppConfig).backendDomain + value; - } else if ( - [FileDriver.S3_PRESIGNED, FileDriver.S3].includes( - (fileConfig() as FileConfig).driver, - ) - ) { - const s3 = new S3Client({ - region: (fileConfig() as FileConfig).awsS3Region ?? '', - credentials: { - accessKeyId: (fileConfig() as FileConfig).accessKeyId ?? '', - secretAccessKey: (fileConfig() as FileConfig).secretAccessKey ?? '', - }, - }); - - const command = new GetObjectCommand({ - Bucket: (fileConfig() as FileConfig).awsDefaultS3Bucket ?? '', - Key: value, - }); - - return getSignedUrl(s3, command, { expiresIn: 3600 }); - } - - return value; - }, - { - toPlainOnly: true, - }, - ) - path: string; -} - -export const FileSchema = SchemaFactory.createForClass(FileSchemaClass); diff --git a/src/files/infrastructure/persistence/document/mappers/file.mapper.ts b/src/files/infrastructure/persistence/document/mappers/file.mapper.ts deleted file mode 100644 index 912df6929..000000000 --- a/src/files/infrastructure/persistence/document/mappers/file.mapper.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { FileType } from '../../../../domain/file'; -import { FileSchemaClass } from '../entities/file.schema'; - -export class FileMapper { - static toDomain(raw: FileSchemaClass): FileType { - const file = new FileType(); - file.id = raw._id.toString(); - file.path = raw.path; - return file; - } - static toPersistence(file) { - const fileEntity = new FileSchemaClass(); - if (file.id) { - fileEntity._id = file.id; - } - fileEntity.path = file.path; - return fileEntity; - } -} diff --git a/src/files/infrastructure/persistence/document/repositories/file.repository.ts b/src/files/infrastructure/persistence/document/repositories/file.repository.ts deleted file mode 100644 index 427904b1c..000000000 --- a/src/files/infrastructure/persistence/document/repositories/file.repository.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import { FileRepository } from '../../file.repository'; -import { FileSchemaClass } from '../entities/file.schema'; -import { InjectModel } from '@nestjs/mongoose'; -import { Model } from 'mongoose'; -import { FileType } from '../../../../domain/file'; - -import { FileMapper } from '../mappers/file.mapper'; -import { NullableType } from '../../../../../utils/types/nullable.type'; - -@Injectable() -export class FileDocumentRepository implements FileRepository { - constructor( - @InjectModel(FileSchemaClass.name) - private fileModel: Model, - ) {} - - async create(data: Omit): Promise { - const createdFile = new this.fileModel(data); - const fileObject = await createdFile.save(); - return FileMapper.toDomain(fileObject); - } - - async findById(id: FileType['id']): Promise> { - const fileObject = await this.fileModel.findById(id); - return fileObject ? FileMapper.toDomain(fileObject) : null; - } -} diff --git a/src/files/infrastructure/uploader/local/files.module.ts b/src/files/infrastructure/uploader/local/files.module.ts index c94cdab5e..411fddff6 100644 --- a/src/files/infrastructure/uploader/local/files.module.ts +++ b/src/files/infrastructure/uploader/local/files.module.ts @@ -10,19 +10,10 @@ import { diskStorage } from 'multer'; import { randomStringGenerator } from '@nestjs/common/utils/random-string-generator.util'; import { FilesLocalService } from './files.service'; - -import { DocumentFilePersistenceModule } from '../../persistence/document/document-persistence.module'; import { RelationalFilePersistenceModule } from '../../persistence/relational/relational-persistence.module'; import { AllConfigType } from '../../../../config/config.type'; -import { DatabaseConfig } from '../../../../database/config/database-config.type'; -import databaseConfig from '../../../../database/config/database.config'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentFilePersistenceModule - : RelationalFilePersistenceModule; -// +const infrastructurePersistenceModule = RelationalFilePersistenceModule; @Module({ imports: [ diff --git a/src/files/infrastructure/uploader/s3-presigned/files.module.ts b/src/files/infrastructure/uploader/s3-presigned/files.module.ts index a9b003b5a..5a02a1e28 100644 --- a/src/files/infrastructure/uploader/s3-presigned/files.module.ts +++ b/src/files/infrastructure/uploader/s3-presigned/files.module.ts @@ -11,19 +11,10 @@ import { S3Client } from '@aws-sdk/client-s3'; import multerS3 from 'multer-s3'; import { FilesS3PresignedService } from './files.service'; - -import { DocumentFilePersistenceModule } from '../../persistence/document/document-persistence.module'; import { RelationalFilePersistenceModule } from '../../persistence/relational/relational-persistence.module'; import { AllConfigType } from '../../../../config/config.type'; -import { DatabaseConfig } from '../../../../database/config/database-config.type'; -import databaseConfig from '../../../../database/config/database.config'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentFilePersistenceModule - : RelationalFilePersistenceModule; -// +const infrastructurePersistenceModule = RelationalFilePersistenceModule; @Module({ imports: [ diff --git a/src/files/infrastructure/uploader/s3/files.module.ts b/src/files/infrastructure/uploader/s3/files.module.ts index 3afbe0c47..1a3c6b814 100644 --- a/src/files/infrastructure/uploader/s3/files.module.ts +++ b/src/files/infrastructure/uploader/s3/files.module.ts @@ -11,19 +11,10 @@ import { S3Client } from '@aws-sdk/client-s3'; import multerS3 from 'multer-s3'; import { FilesS3Service } from './files.service'; - -import { DocumentFilePersistenceModule } from '../../persistence/document/document-persistence.module'; import { RelationalFilePersistenceModule } from '../../persistence/relational/relational-persistence.module'; import { AllConfigType } from '../../../../config/config.type'; -import { DatabaseConfig } from '../../../../database/config/database-config.type'; -import databaseConfig from '../../../../database/config/database.config'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentFilePersistenceModule - : RelationalFilePersistenceModule; -// +const infrastructurePersistenceModule = RelationalFilePersistenceModule; @Module({ imports: [ diff --git a/src/roles/domain/role.ts b/src/roles/domain/role.ts index 1270c6f38..b52041962 100644 --- a/src/roles/domain/role.ts +++ b/src/roles/domain/role.ts @@ -1,13 +1,7 @@ import { ApiResponseProperty } from '@nestjs/swagger'; import { Allow } from 'class-validator'; -import databaseConfig from '../../database/config/database.config'; -import { DatabaseConfig } from '../../database/config/database-config.type'; -// -const idType = (databaseConfig() as DatabaseConfig).isDocumentDatabase - ? String - : Number; -// +const idType = Number; export class Role { @Allow() diff --git a/src/roles/infrastructure/persistence/document/entities/role.schema.ts b/src/roles/infrastructure/persistence/document/entities/role.schema.ts deleted file mode 100644 index 6d8055b93..000000000 --- a/src/roles/infrastructure/persistence/document/entities/role.schema.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ApiResponseProperty } from '@nestjs/swagger'; - -export class RoleSchema { - @ApiResponseProperty({ - type: String, - }) - _id: string; - - @ApiResponseProperty({ - type: String, - example: 'admin', - }) - name?: string; -} diff --git a/src/session/infrastructure/persistence/document/document-persistence.module.ts b/src/session/infrastructure/persistence/document/document-persistence.module.ts deleted file mode 100644 index 0b8ca009b..000000000 --- a/src/session/infrastructure/persistence/document/document-persistence.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { SessionSchema, SessionSchemaClass } from './entities/session.schema'; -import { SessionRepository } from '../session.repository'; -import { SessionDocumentRepository } from './repositories/session.repository'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { name: SessionSchemaClass.name, schema: SessionSchema }, - ]), - ], - providers: [ - { - provide: SessionRepository, - useClass: SessionDocumentRepository, - }, - ], - exports: [SessionRepository], -}) -export class DocumentSessionPersistenceModule {} diff --git a/src/session/infrastructure/persistence/document/entities/session.schema.ts b/src/session/infrastructure/persistence/document/entities/session.schema.ts deleted file mode 100644 index 568944ad7..000000000 --- a/src/session/infrastructure/persistence/document/entities/session.schema.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; -import mongoose, { now, HydratedDocument } from 'mongoose'; -import { UserSchemaClass } from '../../../../../users/infrastructure/persistence/document/entities/user.schema'; -import { EntityDocumentHelper } from '../../../../../utils/document-entity-helper'; - -export type SessionSchemaDocument = HydratedDocument; - -@Schema({ - timestamps: true, - toJSON: { - virtuals: true, - getters: true, - }, -}) -export class SessionSchemaClass extends EntityDocumentHelper { - @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'UserSchemaClass' }) - user: UserSchemaClass; - - @Prop() - hash: string; - - @Prop({ default: now }) - createdAt: Date; - - @Prop({ default: now }) - updatedAt: Date; - - @Prop() - deletedAt: Date; -} - -export const SessionSchema = SchemaFactory.createForClass(SessionSchemaClass); - -SessionSchema.index({ user: 1 }); diff --git a/src/session/infrastructure/persistence/document/mappers/session.mapper.ts b/src/session/infrastructure/persistence/document/mappers/session.mapper.ts deleted file mode 100644 index 78a32a77c..000000000 --- a/src/session/infrastructure/persistence/document/mappers/session.mapper.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { UserSchemaClass } from '../../../../../users/infrastructure/persistence/document/entities/user.schema'; -import { UserMapper } from '../../../../../users/infrastructure/persistence/document/mappers/user.mapper'; -import { Session } from '../../../../domain/session'; -import { SessionSchemaClass } from '../entities/session.schema'; - -export class SessionMapper { - static toDomain(raw: SessionSchemaClass): Session { - const session = new Session(); - session.id = raw._id.toString(); - - if (raw.user) { - session.user = UserMapper.toDomain(raw.user); - } - - session.hash = raw.hash; - session.createdAt = raw.createdAt; - session.updatedAt = raw.updatedAt; - session.deletedAt = raw.deletedAt; - return session; - } - static toPersistence(session: Session): SessionSchemaClass { - const user = new UserSchemaClass(); - user._id = session.user.id.toString(); - const sessionEntity = new SessionSchemaClass(); - if (session.id && typeof session.id === 'string') { - sessionEntity._id = session.id; - } - sessionEntity.user = user; - sessionEntity.hash = session.hash; - sessionEntity.createdAt = session.createdAt; - sessionEntity.updatedAt = session.updatedAt; - sessionEntity.deletedAt = session.deletedAt; - return sessionEntity; - } -} diff --git a/src/session/infrastructure/persistence/document/repositories/session.repository.ts b/src/session/infrastructure/persistence/document/repositories/session.repository.ts deleted file mode 100644 index 4dde36ce9..000000000 --- a/src/session/infrastructure/persistence/document/repositories/session.repository.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { NullableType } from '../../../../../utils/types/nullable.type'; -import { SessionRepository } from '../../session.repository'; -import { Session } from '../../../../domain/session'; -import { SessionSchemaClass } from '../entities/session.schema'; -import { Model } from 'mongoose'; -import { InjectModel } from '@nestjs/mongoose'; -import { SessionMapper } from '../mappers/session.mapper'; -import { User } from '../../../../../users/domain/user'; - -@Injectable() -export class SessionDocumentRepository implements SessionRepository { - constructor( - @InjectModel(SessionSchemaClass.name) - private sessionModel: Model, - ) {} - - async findById(id: Session['id']): Promise> { - const sessionObject = await this.sessionModel.findById(id); - return sessionObject ? SessionMapper.toDomain(sessionObject) : null; - } - - async create(data: Session): Promise { - const persistenceModel = SessionMapper.toPersistence(data); - const createdSession = new this.sessionModel(persistenceModel); - const sessionObject = await createdSession.save(); - return SessionMapper.toDomain(sessionObject); - } - - async update( - id: Session['id'], - payload: Partial, - ): Promise { - const clonedPayload = { ...payload }; - delete clonedPayload.id; - delete clonedPayload.createdAt; - delete clonedPayload.updatedAt; - delete clonedPayload.deletedAt; - - const filter = { _id: id.toString() }; - const session = await this.sessionModel.findOne(filter); - - if (!session) { - return null; - } - - const sessionObject = await this.sessionModel.findOneAndUpdate( - filter, - SessionMapper.toPersistence({ - ...SessionMapper.toDomain(session), - ...clonedPayload, - }), - { new: true }, - ); - - return sessionObject ? SessionMapper.toDomain(sessionObject) : null; - } - - async deleteById(id: Session['id']): Promise { - await this.sessionModel.deleteOne({ _id: id.toString() }); - } - - async deleteByUserId({ userId }: { userId: User['id'] }): Promise { - await this.sessionModel.deleteMany({ user: userId.toString() }); - } - - async deleteByUserIdWithExclude({ - userId, - excludeSessionId, - }: { - userId: User['id']; - excludeSessionId: Session['id']; - }): Promise { - const transformedCriteria = { - user: userId.toString(), - _id: { $not: { $eq: excludeSessionId.toString() } }, - }; - await this.sessionModel.deleteMany(transformedCriteria); - } -} diff --git a/src/session/session.module.ts b/src/session/session.module.ts index e379fb37a..b4d83415a 100644 --- a/src/session/session.module.ts +++ b/src/session/session.module.ts @@ -1,17 +1,8 @@ import { Module } from '@nestjs/common'; - -import { DocumentSessionPersistenceModule } from './infrastructure/persistence/document/document-persistence.module'; import { RelationalSessionPersistenceModule } from './infrastructure/persistence/relational/relational-persistence.module'; import { SessionService } from './session.service'; -import { DatabaseConfig } from '../database/config/database-config.type'; -import databaseConfig from '../database/config/database.config'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentSessionPersistenceModule - : RelationalSessionPersistenceModule; -// +const infrastructurePersistenceModule = RelationalSessionPersistenceModule; @Module({ imports: [infrastructurePersistenceModule], diff --git a/src/statuses/domain/status.ts b/src/statuses/domain/status.ts index 5625aba90..0368f6109 100644 --- a/src/statuses/domain/status.ts +++ b/src/statuses/domain/status.ts @@ -1,13 +1,7 @@ import { ApiResponseProperty } from '@nestjs/swagger'; import { Allow } from 'class-validator'; -import databaseConfig from '../../database/config/database.config'; -import { DatabaseConfig } from '../../database/config/database-config.type'; -// -const idType = (databaseConfig() as DatabaseConfig).isDocumentDatabase - ? String - : Number; -// +const idType = Number; export class Status { @Allow() diff --git a/src/statuses/infrastructure/persistence/document/entities/status.schema.ts b/src/statuses/infrastructure/persistence/document/entities/status.schema.ts deleted file mode 100644 index 34ffdc558..000000000 --- a/src/statuses/infrastructure/persistence/document/entities/status.schema.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ApiResponseProperty } from '@nestjs/swagger'; - -export class StatusSchema { - @ApiResponseProperty({ - type: String, - }) - _id: string; - - @ApiResponseProperty({ - type: String, - example: 'active', - }) - name?: string; -} diff --git a/src/users/domain/user.ts b/src/users/domain/user.ts index f5a92adf8..750742c24 100644 --- a/src/users/domain/user.ts +++ b/src/users/domain/user.ts @@ -3,14 +3,8 @@ import { FileType } from '../../files/domain/file'; import { Role } from '../../roles/domain/role'; import { Status } from '../../statuses/domain/status'; import { ApiResponseProperty } from '@nestjs/swagger'; -import databaseConfig from '../../database/config/database.config'; -import { DatabaseConfig } from '../../database/config/database-config.type'; -// -const idType = (databaseConfig() as DatabaseConfig).isDocumentDatabase - ? String - : Number; -// +const idType = Number; export class User { @ApiResponseProperty({ diff --git a/src/users/infrastructure/persistence/document/document-persistence.module.ts b/src/users/infrastructure/persistence/document/document-persistence.module.ts deleted file mode 100644 index d26ea4af4..000000000 --- a/src/users/infrastructure/persistence/document/document-persistence.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Module } from '@nestjs/common'; -import { MongooseModule } from '@nestjs/mongoose'; -import { UserSchema, UserSchemaClass } from './entities/user.schema'; -import { UserRepository } from '../user.repository'; -import { UsersDocumentRepository } from './repositories/user.repository'; - -@Module({ - imports: [ - MongooseModule.forFeature([ - { name: UserSchemaClass.name, schema: UserSchema }, - ]), - ], - providers: [ - { - provide: UserRepository, - useClass: UsersDocumentRepository, - }, - ], - exports: [UserRepository], -}) -export class DocumentUserPersistenceModule {} diff --git a/src/users/infrastructure/persistence/document/entities/user.schema.ts b/src/users/infrastructure/persistence/document/entities/user.schema.ts deleted file mode 100644 index dae84731d..000000000 --- a/src/users/infrastructure/persistence/document/entities/user.schema.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; -import { now, HydratedDocument } from 'mongoose'; - -// We use class-transformer in schema and domain entity. -// We duplicate these rules because you can choose not to use adapters -// in your project and return an schema entity directly in response. -import { Exclude, Expose, Type } from 'class-transformer'; -import { AuthProvidersEnum } from '../../../../../auth/auth-providers.enum'; -import { FileSchemaClass } from '../../../../../files/infrastructure/persistence/document/entities/file.schema'; -import { EntityDocumentHelper } from '../../../../../utils/document-entity-helper'; -import { StatusSchema } from '../../../../../statuses/infrastructure/persistence/document/entities/status.schema'; -import { RoleSchema } from '../../../../../roles/infrastructure/persistence/document/entities/role.schema'; -import { ApiResponseProperty } from '@nestjs/swagger'; - -export type UserSchemaDocument = HydratedDocument; - -@Schema({ - timestamps: true, - toJSON: { - virtuals: true, - getters: true, - }, -}) -export class UserSchemaClass extends EntityDocumentHelper { - @ApiResponseProperty({ - type: String, - example: 'john.doe@example.com', - }) - @Prop({ - type: String, - unique: true, - }) - @Expose({ groups: ['me', 'admin'], toPlainOnly: true }) - email: string | null; - - @Exclude({ toPlainOnly: true }) - @Prop() - password?: string; - - @Exclude({ toPlainOnly: true }) - previousPassword?: string; - - @ApiResponseProperty({ - type: String, - example: 'email', - }) - @Expose({ groups: ['me', 'admin'], toPlainOnly: true }) - @Prop({ - default: AuthProvidersEnum.email, - }) - provider: string; - - @ApiResponseProperty({ - type: String, - example: '1234567890', - }) - @Expose({ groups: ['me', 'admin'], toPlainOnly: true }) - @Prop({ - type: String, - default: null, - }) - socialId?: string | null; - - @ApiResponseProperty({ - type: String, - example: 'John', - }) - @Prop({ - type: String, - }) - firstName: string | null; - - @ApiResponseProperty({ - type: String, - example: 'Doe', - }) - @Prop({ - type: String, - }) - lastName: string | null; - - @ApiResponseProperty({ - type: () => FileSchemaClass, - }) - @Prop({ - type: FileSchemaClass, - }) - @Type(() => FileSchemaClass) - photo?: FileSchemaClass | null; - - @ApiResponseProperty({ - type: () => RoleSchema, - }) - @Prop({ - type: RoleSchema, - }) - role?: RoleSchema | null; - - @ApiResponseProperty({ - type: () => StatusSchema, - }) - @Prop({ - type: StatusSchema, - }) - status?: StatusSchema; - - @ApiResponseProperty() - @Prop({ default: now }) - createdAt: Date; - - @ApiResponseProperty() - @Prop({ default: now }) - updatedAt: Date; - - @ApiResponseProperty() - @Prop() - deletedAt: Date; -} - -export const UserSchema = SchemaFactory.createForClass(UserSchemaClass); - -UserSchema.virtual('previousPassword').get(function () { - return this.password; -}); - -UserSchema.index({ 'role._id': 1 }); diff --git a/src/users/infrastructure/persistence/document/mappers/user.mapper.ts b/src/users/infrastructure/persistence/document/mappers/user.mapper.ts deleted file mode 100644 index d3613aa6b..000000000 --- a/src/users/infrastructure/persistence/document/mappers/user.mapper.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { User } from '../../../../domain/user'; -import { UserSchemaClass } from '../entities/user.schema'; -import { FileSchemaClass } from '../../../../../files/infrastructure/persistence/document/entities/file.schema'; -import { FileMapper } from '../../../../../files/infrastructure/persistence/document/mappers/file.mapper'; -import { Role } from '../../../../../roles/domain/role'; -import { Status } from '../../../../../statuses/domain/status'; -import { RoleSchema } from '../../../../../roles/infrastructure/persistence/document/entities/role.schema'; -import { StatusSchema } from '../../../../../statuses/infrastructure/persistence/document/entities/status.schema'; - -export class UserMapper { - static toDomain(raw: UserSchemaClass): User { - const user = new User(); - user.id = raw._id.toString(); - user.email = raw.email; - user.password = raw.password; - user.previousPassword = raw.previousPassword; - user.provider = raw.provider; - user.socialId = raw.socialId; - user.firstName = raw.firstName; - user.lastName = raw.lastName; - if (raw.photo) { - user.photo = FileMapper.toDomain(raw.photo); - } else if (raw.photo === null) { - user.photo = null; - } - - if (raw.role) { - user.role = new Role(); - user.role.id = raw.role._id; - } - - if (raw.status) { - user.status = new Status(); - user.status.id = raw.status._id; - } - - user.createdAt = raw.createdAt; - user.updatedAt = raw.updatedAt; - user.deletedAt = raw.deletedAt; - return user; - } - - static toPersistence(user: User): UserSchemaClass { - let role: RoleSchema | undefined = undefined; - - if (user.role) { - role = new RoleSchema(); - role._id = user.role.id.toString(); - } - - let photo: FileSchemaClass | undefined = undefined; - - if (user.photo) { - photo = new FileSchemaClass(); - photo._id = user.photo.id; - photo.path = user.photo.path; - } - - let status: StatusSchema | undefined = undefined; - - if (user.status) { - status = new StatusSchema(); - status._id = user.status.id.toString(); - } - - const userEntity = new UserSchemaClass(); - if (user.id && typeof user.id === 'string') { - userEntity._id = user.id; - } - userEntity.email = user.email; - userEntity.password = user.password; - userEntity.previousPassword = user.previousPassword; - userEntity.provider = user.provider; - userEntity.socialId = user.socialId; - userEntity.firstName = user.firstName; - userEntity.lastName = user.lastName; - userEntity.photo = photo; - userEntity.role = role; - userEntity.status = status; - userEntity.createdAt = user.createdAt; - userEntity.updatedAt = user.updatedAt; - userEntity.deletedAt = user.deletedAt; - return userEntity; - } -} diff --git a/src/users/infrastructure/persistence/document/repositories/user.repository.ts b/src/users/infrastructure/persistence/document/repositories/user.repository.ts deleted file mode 100644 index 434c529fd..000000000 --- a/src/users/infrastructure/persistence/document/repositories/user.repository.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import { NullableType } from '../../../../../utils/types/nullable.type'; -import { FilterUserDto, SortUserDto } from '../../../../dto/query-user.dto'; -import { User } from '../../../../domain/user'; -import { UserRepository } from '../../user.repository'; -import { UserSchemaClass } from '../entities/user.schema'; -import { InjectModel } from '@nestjs/mongoose'; -import { FilterQuery, Model } from 'mongoose'; -import { UserMapper } from '../mappers/user.mapper'; -import { IPaginationOptions } from '../../../../../utils/types/pagination-options'; - -@Injectable() -export class UsersDocumentRepository implements UserRepository { - constructor( - @InjectModel(UserSchemaClass.name) - private readonly usersModel: Model, - ) {} - - async create(data: User): Promise { - const persistenceModel = UserMapper.toPersistence(data); - const createdUser = new this.usersModel(persistenceModel); - const userObject = await createdUser.save(); - return UserMapper.toDomain(userObject); - } - - async findManyWithPagination({ - filterOptions, - sortOptions, - paginationOptions, - }: { - filterOptions?: FilterUserDto | null; - sortOptions?: SortUserDto[] | null; - paginationOptions: IPaginationOptions; - }): Promise { - const where: FilterQuery = {}; - if (filterOptions?.roles?.length) { - where['role._id'] = { - $in: filterOptions.roles.map((role) => role.id.toString()), - }; - } - - const userObjects = await this.usersModel - .find(where) - .sort( - sortOptions?.reduce( - (accumulator, sort) => ({ - ...accumulator, - [sort.orderBy === 'id' ? '_id' : sort.orderBy]: - sort.order.toUpperCase() === 'ASC' ? 1 : -1, - }), - {}, - ), - ) - .skip((paginationOptions.page - 1) * paginationOptions.limit) - .limit(paginationOptions.limit); - - return userObjects.map((userObject) => UserMapper.toDomain(userObject)); - } - - async findById(id: User['id']): Promise> { - const userObject = await this.usersModel.findById(id); - return userObject ? UserMapper.toDomain(userObject) : null; - } - - async findByEmail(email: User['email']): Promise> { - if (!email) return null; - - const userObject = await this.usersModel.findOne({ email }); - return userObject ? UserMapper.toDomain(userObject) : null; - } - - async findBySocialIdAndProvider({ - socialId, - provider, - }: { - socialId: User['socialId']; - provider: User['provider']; - }): Promise> { - if (!socialId || !provider) return null; - - const userObject = await this.usersModel.findOne({ - socialId, - provider, - }); - - return userObject ? UserMapper.toDomain(userObject) : null; - } - - async update(id: User['id'], payload: Partial): Promise { - const clonedPayload = { ...payload }; - delete clonedPayload.id; - - const filter = { _id: id.toString() }; - const user = await this.usersModel.findOne(filter); - - if (!user) { - return null; - } - - const userObject = await this.usersModel.findOneAndUpdate( - filter, - UserMapper.toPersistence({ - ...UserMapper.toDomain(user), - ...clonedPayload, - }), - { new: true }, - ); - - return userObject ? UserMapper.toDomain(userObject) : null; - } - - async remove(id: User['id']): Promise { - await this.usersModel.deleteOne({ - _id: id.toString(), - }); - } -} diff --git a/src/users/users.module.ts b/src/users/users.module.ts index 5fac1841e..af0bf3042 100644 --- a/src/users/users.module.ts +++ b/src/users/users.module.ts @@ -3,18 +3,10 @@ import { Module } from '@nestjs/common'; import { UsersController } from './users.controller'; import { UsersService } from './users.service'; -import { DocumentUserPersistenceModule } from './infrastructure/persistence/document/document-persistence.module'; import { RelationalUserPersistenceModule } from './infrastructure/persistence/relational/relational-persistence.module'; -import { DatabaseConfig } from '../database/config/database-config.type'; -import databaseConfig from '../database/config/database.config'; import { FilesModule } from '../files/files.module'; -// -const infrastructurePersistenceModule = (databaseConfig() as DatabaseConfig) - .isDocumentDatabase - ? DocumentUserPersistenceModule - : RelationalUserPersistenceModule; -// +const infrastructurePersistenceModule = RelationalUserPersistenceModule; @Module({ imports: [infrastructurePersistenceModule, FilesModule], diff --git a/src/utils/document-entity-helper.ts b/src/utils/document-entity-helper.ts deleted file mode 100644 index 9ab02703c..000000000 --- a/src/utils/document-entity-helper.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Transform } from 'class-transformer'; - -export class EntityDocumentHelper { - @ApiProperty({ - type: String, - }) - @Transform( - (value) => { - if ('value' in value) { - // https://github.com/typestack/class-transformer/issues/879 - return value.obj[value.key].toString(); - } - - return 'unknown value'; - }, - { - toPlainOnly: true, - }, - ) - public _id: string; -} diff --git a/startup.document.ci.sh b/startup.document.ci.sh deleted file mode 100755 index b77ba28b7..000000000 --- a/startup.document.ci.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -e - -/opt/wait-for-it.sh mongo:27017 -npm run seed:run:document -npm run start:prod > prod.log 2>&1 & -/opt/wait-for-it.sh maildev:1080 -/opt/wait-for-it.sh localhost:3000 -npm run lint -npm run test:e2e -- --runInBand diff --git a/startup.document.dev.sh b/startup.document.dev.sh deleted file mode 100755 index fdacb0763..000000000 --- a/startup.document.dev.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e - -/opt/wait-for-it.sh mongo:27017 -cat .env -npm run seed:run:document -npm run start:prod diff --git a/startup.document.test.sh b/startup.document.test.sh deleted file mode 100755 index 2d8cca6e9..000000000 --- a/startup.document.test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -e - -/opt/wait-for-it.sh mongo:27017 -/opt/wait-for-it.sh maildev:1080 -npm install -npm run seed:run:document -npm run start:swc