diff --git a/.vscode/settings.json b/.vscode/settings.json index 8bfa895fc..1d5a45a67 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -61,6 +61,6 @@ "html", "vue" ], - "typescript.preferences.importModuleSpecifier": "relative", + "typescript.preferences.importModuleSpecifier": "shortest", "typescript.updateImportsOnFileMove.enabled": "always" } diff --git a/apps/admin/CHANGELOG.md b/apps/admin/CHANGELOG.md index ec2f7c951..32b24c4b4 100644 --- a/apps/admin/CHANGELOG.md +++ b/apps/admin/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/apps/api/CHANGELOG.md b/apps/api/CHANGELOG.md index 4b5079c0c..d881da8b0 100644 --- a/apps/api/CHANGELOG.md +++ b/apps/api/CHANGELOG.md @@ -2,6 +2,41 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* resolve conversation and make the api start without settings env ([87d4465](https://github.com/tractr/traxion/commit/87d446509dd3c182c92a9d269dfbe24a826899ec)) +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/apps/api/package.json b/apps/api/package.json index 88fa2e52a..0c58043f3 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/traxion-api", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 2bb90d94e..3905a7784 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -1,8 +1,10 @@ import { Module } from '@nestjs/common'; +import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'; import { ConsoleModule } from 'nestjs-console'; import { AuthenticationModule, + CaslModule, DatabaseModule, FileStorageModule, GraphQLModule, @@ -11,6 +13,8 @@ import { PasswordModule, } from './modules'; +import { JwtGlobalAuthGuard } from '@trxn/nestjs-authentication'; +import { CaslExceptionInterceptor, PoliciesGuard } from '@trxn/nestjs-casl'; import { LoggerModule } from '@trxn/nestjs-core'; @Module({ @@ -23,6 +27,7 @@ import { LoggerModule } from '@trxn/nestjs-core'; GraphQLModule, // Authentication modules + CaslModule, AuthenticationModule, PasswordModule, @@ -36,5 +41,11 @@ import { LoggerModule } from '@trxn/nestjs-core'; // Cli ConsoleModule, ], + + providers: [ + { provide: APP_GUARD, useClass: JwtGlobalAuthGuard }, + { provide: APP_GUARD, useClass: PoliciesGuard }, + { provide: APP_INTERCEPTOR, useClass: CaslExceptionInterceptor }, + ], }) export class AppModule {} diff --git a/apps/api/src/app/modules/authentication.module.ts b/apps/api/src/app/modules/authentication.module.ts index 73d0be8a1..66e618ca0 100644 --- a/apps/api/src/app/modules/authentication.module.ts +++ b/apps/api/src/app/modules/authentication.module.ts @@ -1,42 +1,20 @@ import { Module } from '@nestjs/common'; -import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'; -import { CaslModule } from './casl.module'; -import { EncryptionModule } from './encryption.module'; -import { ModelsModule } from './models.module'; +import { UserModule } from './user.module'; import { getSelectPrismaUserQuery } from '@trxn/generated-casl'; -import { USER_SERVICE } from '@trxn/generated-nestjs-models-common'; -import { - JwtGlobalAuthGuard, - AuthenticationModule as TraxionAuthenticationModule, -} from '@trxn/nestjs-authentication'; -import { BcryptService } from '@trxn/nestjs-bcrypt'; -import { CaslExceptionInterceptor, PoliciesGuard } from '@trxn/nestjs-casl'; +import { AuthenticationModule as TraxionAuthenticationModule } from '@trxn/nestjs-authentication'; @Module({ imports: [ - CaslModule, - TraxionAuthenticationModule.registerAsync({ - imports: [ModelsModule, EncryptionModule], - useFactory: (userService, encryptionService) => ({ - user: { - customSelect: getSelectPrismaUserQuery(), - }, - jwtModuleOptions: { - secret: 'secret', - }, - userService, - encryptionService, - }), - inject: [USER_SERVICE, BcryptService], + TraxionAuthenticationModule.register({ + imports: [UserModule], + customSelect: getSelectPrismaUserQuery(), + jwtModuleOptions: { + secret: 'secret', + }, }), ], - providers: [ - { provide: APP_GUARD, useClass: JwtGlobalAuthGuard }, - { provide: APP_GUARD, useClass: PoliciesGuard }, - { provide: APP_INTERCEPTOR, useClass: CaslExceptionInterceptor }, - ], exports: [TraxionAuthenticationModule], }) export class AuthenticationModule {} diff --git a/apps/api/src/app/modules/casl.module.ts b/apps/api/src/app/modules/casl.module.ts index 53c6ef2c8..06284361b 100644 --- a/apps/api/src/app/modules/casl.module.ts +++ b/apps/api/src/app/modules/casl.module.ts @@ -7,6 +7,10 @@ import { CaslModule as TraxionCaslModule } from '@trxn/nestjs-casl'; imports: [ TraxionCaslModule.register({ rolePermissions, + getRoles: (user) => user.roles, + publicPermissions: (ability) => { + ability.can('read', 'all'); + }, }), ], exports: [TraxionCaslModule], diff --git a/apps/api/src/app/modules/mailer.module.ts b/apps/api/src/app/modules/mailer.module.ts index d18c521a0..666b26d57 100644 --- a/apps/api/src/app/modules/mailer.module.ts +++ b/apps/api/src/app/modules/mailer.module.ts @@ -1,14 +1,18 @@ import { Module } from '@nestjs/common'; import { MailerModule as TraxionMailerModule } from '@trxn/nestjs-mailer'; +import { MailjetModule, MailjetService } from '@trxn/nestjs-mailjet'; @Module({ imports: [ - TraxionMailerModule.registerAsync({ - useFactory: () => ({ - privateApiKey: 'test', - publicApiKey: 'test', - }), + TraxionMailerModule.register({ + imports: [ + MailjetModule.register({ + apiKey: process.env.MAILJET_API_KEY || 'apiKey', + apiSecret: process.env.MAILJET_API_SECRET || 'apiSecret', + }), + ], + MailerClient: MailjetService, }), ], exports: [TraxionMailerModule], diff --git a/apps/api/src/app/modules/password.module.ts b/apps/api/src/app/modules/password.module.ts index 86aeb70fa..0dc37bd2a 100644 --- a/apps/api/src/app/modules/password.module.ts +++ b/apps/api/src/app/modules/password.module.ts @@ -2,36 +2,24 @@ import { Module } from '@nestjs/common'; import { EncryptionModule } from './encryption.module'; import { MailerModule } from './mailer.module'; -import { ModelsModule } from './models.module'; +import { UserModule } from './user.module'; -import { USER_SERVICE } from '@trxn/generated-nestjs-models-common'; -import { BcryptService, EncryptionService } from '@trxn/nestjs-bcrypt'; -import { ResetPasswordSendEmailService } from '@trxn/nestjs-mailer'; -import { PasswordModule as TraxionPasswordModule } from '@trxn/nestjs-password'; +import { BcryptService } from '@trxn/nestjs-bcrypt'; +import { + ENCRYPTION_SERVICE, + PasswordModule as TraxionPasswordModule, +} from '@trxn/nestjs-password'; +import { ResetPasswordModule } from '@trxn/nestjs-reset-password'; @Module({ imports: [ - TraxionPasswordModule.registerAsync({ - imports: [ModelsModule, MailerModule, EncryptionModule], - useFactory: ( - userService, - resetPasswordSendEmailService: ResetPasswordSendEmailService, - encryptionService: EncryptionService, - ) => ({ - resetPasswordSendEmail: { - request: - resetPasswordSendEmailService.sendRequestResetPasswordEmailFactory({ - from: 'admin@traxion.com', - }), - updated: - resetPasswordSendEmailService.sendUpdatedPasswordEmailFactory({ - from: 'admin@traxion.com', - }), - }, - userService, - encryptionService, - }), - inject: [USER_SERVICE, ResetPasswordSendEmailService, BcryptService], + TraxionPasswordModule.register({ + imports: [UserModule, EncryptionModule], + providers: [{ provide: ENCRYPTION_SERVICE, useExisting: BcryptService }], + }), + ResetPasswordModule.register({ + imports: [UserModule, MailerModule], + from: 'admin@traxion.com', }), ], exports: [TraxionPasswordModule], diff --git a/apps/api/src/app/modules/user.module.ts b/apps/api/src/app/modules/user.module.ts new file mode 100644 index 000000000..28d6daad7 --- /dev/null +++ b/apps/api/src/app/modules/user.module.ts @@ -0,0 +1,15 @@ +import { Module } from '@nestjs/common'; + +import { ModelsModule } from './models.module'; + +import { UserModule as TraxionUserModule } from '@trxn/nestjs-user'; + +@Module({ + imports: [ + TraxionUserModule.register({ + imports: [ModelsModule], + }), + ], + exports: [TraxionUserModule], +}) +export class UserModule {} diff --git a/apps/docs/CHANGELOG.md b/apps/docs/CHANGELOG.md index 62f9d04bc..8223972e5 100644 --- a/apps/docs/CHANGELOG.md +++ b/apps/docs/CHANGELOG.md @@ -2,6 +2,45 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + +### Bug Fixes + +* remove [@tractr](https://github.com/tractr) and replace it by [@trxn](https://github.com/trxn) ([129058f](https://github.com/tractr/traxion/commit/129058fee9f88c34ac4f124f9d1d54470939a0e7)) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/apps/docs/docs/how-to/authentication/0-use-nestjs-user.mdx b/apps/docs/docs/how-to/authentication/0-use-nestjs-user.mdx new file mode 100644 index 000000000..11ffdaab2 --- /dev/null +++ b/apps/docs/docs/how-to/authentication/0-use-nestjs-user.mdx @@ -0,0 +1,9 @@ +--- +id: use-nestjs-user +hide_title: true +sidebar_label: The user module +--- + +import SourceMarkdown from '../../../../../libs/nestjs/user/README.md'; + + diff --git a/apps/docs/docs/how-to/authentication/1-use-nestjs-authentication copy.mdx b/apps/docs/docs/how-to/authentication/1-use-nestjs-authentication copy.mdx new file mode 100644 index 000000000..5723b97cb --- /dev/null +++ b/apps/docs/docs/how-to/authentication/1-use-nestjs-authentication copy.mdx @@ -0,0 +1,9 @@ +--- +id: use-nestjs-authentication +hide_title: true +sidebar_label: Authenticate your routes +--- + +import SourceMarkdown from '../../../../../libs/nestjs/authentication/README.md'; + + diff --git a/apps/docs/docs/how-to/authentication/2-use-nestjs-casl.mdx b/apps/docs/docs/how-to/authentication/2-use-nestjs-casl.mdx new file mode 100644 index 000000000..9cc97e8fb --- /dev/null +++ b/apps/docs/docs/how-to/authentication/2-use-nestjs-casl.mdx @@ -0,0 +1,9 @@ +--- +id: use-nestjs-casl +hide_title: true +sidebar_label: Authorization +--- + +import SourceMarkdown from '../../../../../libs/nestjs/casl/README.md'; + + diff --git a/apps/docs/docs/how-to/authentication/3-use-nestjs-password copy.mdx b/apps/docs/docs/how-to/authentication/3-use-nestjs-password copy.mdx new file mode 100644 index 000000000..f70d3298f --- /dev/null +++ b/apps/docs/docs/how-to/authentication/3-use-nestjs-password copy.mdx @@ -0,0 +1,12 @@ +--- +id: use-nestjs-password +hide_title: true +sidebar_label: Play with the password +--- + +import PasswordMarkdown from '../../../../../libs/nestjs/password/README.md'; +import ResetPasswordMarkdown from '../../../../../libs/nestjs/reset-password/README.md'; + + + + diff --git a/apps/docs/docs/how-to/file-storage/file-storage-on-aws-s3.md b/apps/docs/docs/how-to/file-storage/file-storage-on-aws-s3.md index 176731cff..4f9846fea 100644 --- a/apps/docs/docs/how-to/file-storage/file-storage-on-aws-s3.md +++ b/apps/docs/docs/how-to/file-storage/file-storage-on-aws-s3.md @@ -42,32 +42,32 @@ import { @Module({ imports: [ FileStorageModule.register({ - // Public key of your file storage user + // Public key of your file storage user accessKey: 'minio', - // Private key of your file storage user + // Private key of your file storage user secretKey: 'password', - // Domain to access the file storage + // Domain to access the file storage endPoint: 'localhost', - // Port to access the file storage + // Port to access the file storage port: 9000, - // Denotes if ssl should be used + // Denotes if ssl should be used // (can be disabled for dev envs, but should be used in production) useSSL: false, - // The name of your file storage bucket + // The name of your file storage bucket defaultBucket: 'bucket', - // Here you can configure the validity time of presigned download urls - // (default to 300s) + // Here you can configure the validity time of presigned download urls + // (default to 300s) presignedDownload: {} as PresignedDownloadConfiguration, - // Here you can configure the validity time of presigned download urls - // (default to 300s) - // You can also add restrictions on allowed file size and mime type + // Here you can configure the validity time of presigned download urls + // (default to 300s) + // You can also add restrictions on allowed file size and mime type presignedUpload: {} as PresignedUploadConfiguration, }), ], @@ -85,13 +85,13 @@ import { FileStorageModule } from '@trxn/angular-file-storage'; @NgModule({ imports: [ FileStorageModule.register({ - // The name of your file storage bucket + // The name of your file storage bucket defaultBucket: 'bucket', - - // Endpoint to request presigned upload url (default to 'upload') + + // Endpoint to request presigned upload url (default to 'upload') presignedUploadEndpoint: 'upload', - // Endpoint to request presigned download url (default to 'download') + // Endpoint to request presigned download url (default to 'download') presignedDownloadEndpoint: 'download', }), ], @@ -136,8 +136,8 @@ Simply import it from `@trxn/nestjs-file-storage` and add it to your `app.module // file: apps/api/src/app/app.module.ts import { - FileStorageModule, - FileStorageController + FileStorageModule, + FileStorageController } from '@trxn/nestjs-file-storage'; @Module({ @@ -163,7 +163,7 @@ The `FileStorageController` exposes two endpoints: - The `upload` endpoint can be used to request an upload presigned URL. - The `download` endpoint can be used to request a download presigned URL. -On the frontend side of your application, you can use the `tractr-file-storage-upload-button` button component exported from `@tractr/angular-file-storage` to automatically send files uploaded by the users to the file storage. +On the frontend side of your application, you can use the `tractr-file-storage-upload-button` button component exported from `@trxn/angular-file-storage` to automatically send files uploaded by the users to the file storage. Then you should listen to the `uploadResult` event to get information about the uploaded file. @@ -244,9 +244,9 @@ NestJS controller example: import { Controller, Get, Query } from '@nestjs/common'; import { - GetPresignedDownloadUrlQueryDto, + GetPresignedDownloadUrlQueryDto, GetPresignedUploadUrlQueryDto, - FileStorageService + FileStorageService } from '@trxn/nestjs-file-storage'; @Controller('file-storage') @@ -259,16 +259,16 @@ export class FileStorageController { @Get('upload') getPresignedUploadUrl(@Query() queryDto: GetPresignedUploadUrlQueryDto) { - // Business logique could be added here or in some nestjs guards + // Business logique could be added here or in some nestjs guards const { mimeType, fileSize } = queryDto; - // Request presigned url to the file storage and returns it + // Request presigned url to the file storage and returns it return this.fileStorageService.getPresignedUploadUrl(mimeType, fileSize); } } ``` -### Download a file from file storage with a presigned URL. +### Download a file from file storage with a presigned URL Read access to a file can also be restricted by using presigned URLs for downloading. The mechanism is very similar to the one presented in the upload section. @@ -316,7 +316,7 @@ import { Controller, Get, Query } from '@nestjs/common'; import { GetPresignedDownloadUrlQueryDto, GetPresignedUploadUrlQueryDto, - FileStorageService + FileStorageService } from '@trxn/nestjs-file-storage'; @Controller('file-storage') @@ -331,10 +331,10 @@ export class FileStorageController { @Query() queryDto: GetPresignedDownloadUrlQueryDto, ) { - // Business logique could be added here or in some nestjs guards + // Business logique could be added here or in some nestjs guards const { file } = queryDto; - // Request presigned url to the file storage and returns it + // Request presigned url to the file storage and returns it const url = await this.fileStorageService.getPresignedDownloadUrl(file); return { url }; } @@ -362,25 +362,25 @@ import { FileStorageService } from '@trxn/nestjs-file-storage'; Injectable() export class UserService { - - constructor(private fileStorageService: FileStorageService) {} - - async create(user: User) { - const avatarImageTempPath = user.avatarUrl; - const avatarImageDefinitivePath = `images/${uuid()}.jpg`; - - try { - // Move the file out of the temporary folder - await this.fileStorageService.commitTemporaryFile( - avatarImageTempPath, - avatarImageDefinitivePath - ); - } catch (e) { - // handle potential errors with the file storage - } - //... - // Save your user with the new avatar path - } + + constructor(private fileStorageService: FileStorageService) {} + + async create(user: User) { + const avatarImageTempPath = user.avatarUrl; + const avatarImageDefinitivePath = `images/${uuid()}.jpg`; + + try { + // Move the file out of the temporary folder + await this.fileStorageService.commitTemporaryFile( + avatarImageTempPath, + avatarImageDefinitivePath + ); + } catch (e) { + // handle potential errors with the file storage + } + //... + // Save your user with the new avatar path + } } ``` @@ -397,4 +397,3 @@ This method should be called periodically (e.g. in a Cron) if you don't want the The NestJS `FileStorageService` uses the Minio javascript client and extends it, making all the Minio client methods available for custom operations as well. For more information, please refer to the [Minio documentation](https://min.io/docs/minio/linux/developers/javascript/API.html). ::: - diff --git a/apps/docs/docs/how-to/mailer/use-mailer-with-mailjet.mdx b/apps/docs/docs/how-to/mailer/use-mailer-with-mailjet.mdx new file mode 100644 index 000000000..b3521110f --- /dev/null +++ b/apps/docs/docs/how-to/mailer/use-mailer-with-mailjet.mdx @@ -0,0 +1,9 @@ +--- +id: use-mailer-with-mailjet +hide_title: true +sidebar_label: Configure Mailer with MailjetModule +--- + +import SourceMarkdown from '../../../../../libs/nestjs/mailer/README.md'; + + diff --git a/apps/docs/docs/how-to/mailer/use-mailjet.mdx b/apps/docs/docs/how-to/mailer/use-mailjet.mdx new file mode 100644 index 000000000..c2e0969a9 --- /dev/null +++ b/apps/docs/docs/how-to/mailer/use-mailjet.mdx @@ -0,0 +1,9 @@ +--- +id: use-mailjet +hide_title: true +sidebar_label: Configure Mailjet +--- + +import SourceMarkdown from '../../../../../libs/nestjs/mailjet/README.md'; + + diff --git a/apps/docs/docs/how-to/terraform/configuration.md b/apps/docs/docs/how-to/terraform/configuration.md index 6543985b5..17668282f 100644 --- a/apps/docs/docs/how-to/terraform/configuration.md +++ b/apps/docs/docs/how-to/terraform/configuration.md @@ -11,7 +11,6 @@ Soon, schematics will automate some or all of these manual operations. ::: - ## Install libraries The following libraries are required by the `terraform` application we will create: @@ -22,13 +21,13 @@ npm install --save \ cdktf \ cdktf-cli \ @cdktf/provider-aws \ - @tractr/terraform-aws-stack \ - @tractr/terraform-group-network \ - @tractr/terraform-group-pool \ - @tractr/terraform-group-registry \ - @tractr/terraform-group-zone \ - @tractr/terraform-service-api \ - @tractr/terraform-service-postgres \ - @tractr/terraform-service-pwa \ - @tractr/terraform-service-reverse-proxy + @trxn/terraform-aws-stack \ + @trxn/terraform-group-network \ + @trxn/terraform-group-pool \ + @trxn/terraform-group-registry \ + @trxn/terraform-group-zone \ + @trxn/terraform-service-api \ + @trxn/terraform-service-postgres \ + @trxn/terraform-service-pwa \ + @trxn/terraform-service-reverse-proxy ``` diff --git a/apps/docs/package.json b/apps/docs/package.json index 5f821b866..81b29d9cd 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/traxion-api", - "version": "2.0.13", + "version": "2.1.0-next.1", "dependencies": { "@docusaurus/core": "^2.2.0", "@docusaurus/mdx-loader": "^2.2.0", diff --git a/apps/docs/sidebars.js b/apps/docs/sidebars.js index e0cedaac6..63c963485 100644 --- a/apps/docs/sidebars.js +++ b/apps/docs/sidebars.js @@ -13,28 +13,36 @@ module.exports = { items: [ { type: 'category', - label: 'Angular', + label: 'Database', items: [ - 'how-to/angular/configure-lazy-loading', - 'how-to/angular/configure-storybook', - 'how-to/angular/configure-tailwind-css', + 'how-to/database/configuration', + 'how-to/database/database-migration-with-prisma', ], }, { type: 'category', - label: 'NestJS', + label: 'Authentication', items: [ - 'how-to/nestjs/extend-a-generated-controller', + 'how-to/authentication/use-nestjs-user', + 'how-to/authentication/use-nestjs-authentication', + 'how-to/authentication/use-nestjs-casl', + 'how-to/authentication/use-nestjs-password', ], }, { type: 'category', - label: 'Database', + label: 'Angular', items: [ - 'how-to/database/configuration', - 'how-to/database/database-migration-with-prisma' + 'how-to/angular/configure-lazy-loading', + 'how-to/angular/configure-storybook', + 'how-to/angular/configure-tailwind-css', ], }, + { + type: 'category', + label: 'NestJS', + items: ['how-to/nestjs/extend-a-generated-controller'], + }, { type: 'category', label: 'File storage', @@ -43,6 +51,14 @@ module.exports = { 'how-to/file-storage/use-minio', ], }, + { + type: 'category', + label: 'Mailer', + items: [ + 'how-to/mailer/use-mailjet', + 'how-to/mailer/use-mailer-with-mailjet', + ], + }, { type: 'category', label: 'Terraform', diff --git a/apps/pwa-e2e/CHANGELOG.md b/apps/pwa-e2e/CHANGELOG.md index 75557c299..a1f3a97c0 100644 --- a/apps/pwa-e2e/CHANGELOG.md +++ b/apps/pwa-e2e/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/apps/pwa/CHANGELOG.md b/apps/pwa/CHANGELOG.md index 682ca25fd..e1de3d404 100644 --- a/apps/pwa/CHANGELOG.md +++ b/apps/pwa/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/apps/pwa/package.json b/apps/pwa/package.json index f5ab589db..be6dde6a0 100644 --- a/apps/pwa/package.json +++ b/apps/pwa/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/traxion-pwa", - "version": "2.0.13", + "version": "2.1.0-next.1", "peerDependencies": { "@angular/common": "^12.1.1", "@angular/core": "^12.1.1" diff --git a/apps/pwa/src/app/app.module.ts b/apps/pwa/src/app/app.module.ts index 58296dace..e4309eddd 100644 --- a/apps/pwa/src/app/app.module.ts +++ b/apps/pwa/src/app/app.module.ts @@ -6,9 +6,9 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterModule } from '@angular/router'; import { User as UserType } from '@prisma/client'; -import { AppConfig } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { AppConfig } from '../environments/environment'; import { AngularAuthenticationModule, diff --git a/apps/terraform/CHANGELOG.md b/apps/terraform/CHANGELOG.md index ea1b2d98c..a18d8ebe1 100644 --- a/apps/terraform/CHANGELOG.md +++ b/apps/terraform/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/jest.config.ts b/jest.config.ts index 7af4b6527..f4bfeb76b 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -74,5 +74,6 @@ export default { '/apps/pwa', '/libs/nestjs/password', '/libs/config/client', + '/libs/nestjs/mailjet', ], }; diff --git a/libs/angular/authentication/CHANGELOG.md b/libs/angular/authentication/CHANGELOG.md index b44cc076f..c8d8000af 100644 --- a/libs/angular/authentication/CHANGELOG.md +++ b/libs/angular/authentication/CHANGELOG.md @@ -2,944 +2,106 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). -## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) - - - -## [2.0.12](https://github.com/tractr/traxion/compare/v2.0.11...v2.0.12) (2023-02-23) +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) -## [2.0.11](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11) (2023-02-23) +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) -## [2.0.10](https://github.com/tractr/traxion/compare/v2.0.9...v2.0.10) (2023-02-14) +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) -## [2.0.9](https://github.com/tractr/traxion/compare/v2.0.8...v2.0.9) (2023-02-14) - +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) -## [2.0.8](https://github.com/tractr/traxion/compare/v2.0.7...v2.0.8) (2023-02-14) +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) -## [2.0.7](https://github.com/tractr/traxion/compare/v2.0.6...v2.0.7) (2023-02-09) +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) -## [2.0.6](https://github.com/tractr/traxion/compare/v2.0.5...v2.0.6) (2023-02-09) +## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) +## [2.0.9](https://github.com/tractr/traxion/compare/v2.0.8...v2.0.9) (2023-02-14) ## [2.0.5](https://github.com/tractr/traxion/compare/v2.0.4...v2.0.5) (2023-02-07) - - -## [2.0.4](https://github.com/tractr/traxion/compare/v2.0.3...v2.0.4) (2023-02-07) - - - -## [2.0.3](https://github.com/tractr/traxion/compare/v2.0.2...v2.0.3) (2023-02-06) - - - -## [2.0.2](https://github.com/tractr/traxion/compare/v2.0.1...v2.0.2) (2023-02-06) - - - ## [2.0.1](https://github.com/tractr/traxion/compare/v2.0.0...v2.0.1) (2023-02-06) - - -# [2.0.0](https://github.com/tractr/traxion/compare/v1.65.12...v2.0.0) (2023-02-06) - - -### chore - -* migrate nx and angular to version 15 ([#556](https://github.com/tractr/traxion/issues/556)) ([6b8973d](https://github.com/tractr/traxion/commit/6b8973df221203b035437c248c74f03d8f582ba2)), closes [#555](https://github.com/tractr/traxion/issues/555) [#557](https://github.com/tractr/traxion/issues/557) [#558](https://github.com/tractr/traxion/issues/558) [#560](https://github.com/tractr/traxion/issues/560) [#536](https://github.com/tractr/traxion/issues/536) - - ### BREAKING CHANGES -* Updating angular and nx to 15 will not work with nx 14 and angular 14 packages - -* chore: update major packages version - -* chore(prerelease): prerelease next version 1.65.13-next.1 - - - # [2.0.0-next.2](https://github.com/tractr/traxion/compare/v2.0.0-next.1...v2.0.0-next.2) (2023-02-06) - - -# [2.0.0-next.1](https://github.com/tractr/traxion/compare/v2.0.0-next.0...v2.0.0-next.1) (2023-02-06) - - - -# [2.0.0-next.0](https://github.com/tractr/traxion/compare/v1.65.13-next.8...v2.0.0-next.0) (2023-02-06) - - - -## [1.65.13-next.8](https://github.com/tractr/traxion/compare/v1.65.13-next.7...v1.65.13-next.8) (2023-01-26) - - - ## [1.65.13-next.7](https://github.com/tractr/traxion/compare/v1.65.13-next.6...v1.65.13-next.7) (2023-01-26) - - -## [1.65.13-next.6](https://github.com/tractr/traxion/compare/v1.65.13-next.5...v1.65.13-next.6) (2023-01-26) - - - -## [1.65.13-next.5](https://github.com/tractr/traxion/compare/v1.65.13-next.4...v1.65.13-next.5) (2023-01-26) - - - -## [1.65.13-next.4](https://github.com/tractr/traxion/compare/v1.65.13-next.3...v1.65.13-next.4) (2023-01-25) - - - -## [1.65.13-next.3](https://github.com/tractr/traxion/compare/v1.65.13-next.2...v1.65.13-next.3) (2023-01-25) - - - -## [1.65.13-next.2](https://github.com/tractr/traxion/compare/v1.65.13-next.1...v1.65.13-next.2) (2023-01-25) - - ### Features -* add peer dependencies executor helper to publish pacakges ([#560](https://github.com/tractr/traxion/issues/560)) ([ddfd62d](https://github.com/tractr/traxion/commit/ddfd62d7109e2023511f2aabe7b4f24ce6dc83e6)) - - - ## [1.65.13-next.1](https://github.com/tractr/traxion/compare/v1.65.13-next.0...v1.65.13-next.1) (2023-01-25) - - -## [1.65.13-next.0](https://github.com/tractr/traxion/compare/v1.65.12...v1.65.13-next.0) (2023-01-24) - - -### Features - * update major nx and angular dependencies ([#555](https://github.com/tractr/traxion/issues/555)) ([3b2a0cc](https://github.com/tractr/traxion/commit/3b2a0cc282df60e08a31fc58a32a682a37ae5c2b)) - - -## [1.65.12](https://github.com/tractr/traxion/compare/v1.65.11...v1.65.12) (2023-01-19) - - - -## [1.65.11](https://github.com/tractr/traxion/compare/v1.65.10...v1.65.11) (2023-01-19) - - -### Bug Fixes - * update schematics to match the last updates with traxion best practices ([#551](https://github.com/tractr/traxion/issues/551)) ([7512b4a](https://github.com/tractr/traxion/commit/7512b4a69e2b82c09d40651d53b28d17bc61a365)) - - -## [1.65.11-next.0](https://github.com/tractr/traxion/compare/v1.65.11-beta.3...v1.65.11-next.0) (2023-01-18) - - - -## [1.65.11-beta.3](https://github.com/tractr/traxion/compare/v1.65.11-beta.2...v1.65.11-beta.3) (2023-01-18) - - - -## [1.65.11-beta.2](https://github.com/tractr/traxion/compare/v1.65.11-beta.1...v1.65.11-beta.2) (2023-01-18) - - - ## [1.65.11-beta.1](https://github.com/tractr/traxion/compare/v1.65.11-beta.0...v1.65.11-beta.1) (2023-01-18) - - -## [1.65.11-beta.0](https://github.com/tractr/traxion/compare/v1.65.10...v1.65.11-beta.0) (2023-01-17) - - - -## [1.65.10](https://github.com/tractr/traxion/compare/v1.65.9...v1.65.10) (2023-01-17) - - - -## [1.65.9](https://github.com/tractr/traxion/compare/v1.65.8...v1.65.9) (2023-01-10) - - - ## [1.65.8](https://github.com/tractr/traxion/compare/v1.65.7...v1.65.8) (2023-01-10) - - -## [1.65.7](https://github.com/tractr/traxion/compare/v1.65.6...v1.65.7) (2022-12-21) - - - -## [1.65.6](https://github.com/tractr/traxion/compare/v1.65.5...v1.65.6) (2022-12-20) - - -### Bug Fixes - -* update error management in angular-authentication to have details errors ([#542](https://github.com/tractr/traxion/issues/542)) ([e10e55a](https://github.com/tractr/traxion/commit/e10e55ac213a59c561a341363ab23eaaaca172a5)) - - - -## [1.65.5](https://github.com/tractr/traxion/compare/v1.65.4...v1.65.5) (2022-12-19) - - - -## [1.65.4](https://github.com/tractr/traxion/compare/v1.65.3...v1.65.4) (2022-12-08) - - - -## [1.65.3](https://github.com/tractr/traxion/compare/v1.65.2...v1.65.3) (2022-12-07) - - - -## [1.65.2](https://github.com/tractr/traxion/compare/v1.65.1...v1.65.2) (2022-11-30) - - - -## [1.65.1](https://github.com/tractr/traxion/compare/v1.65.0...v1.65.1) (2022-11-30) - - - -# [1.65.0](https://github.com/tractr/traxion/compare/v1.64.9...v1.65.0) (2022-11-30) - - -### Features - -* change [@tractr](https://github.com/tractr) to [@trxn](https://github.com/trxn) and publish to npmjs registry ([#532](https://github.com/tractr/traxion/issues/532)) ([443668a](https://github.com/tractr/traxion/commit/443668afe75401f4c288f239ee6052c2f7910585)) - - - ## [1.64.9](https://github.com/tractr/stack/compare/v1.64.8...v1.64.9) (2022-11-28) - - -## [1.64.8](https://github.com/tractr/stack/compare/v1.64.7...v1.64.8) (2022-11-24) - - - ## [1.64.7](https://github.com/tractr/stack/compare/v1.64.6...v1.64.7) (2022-11-22) - - -## [1.64.6](https://github.com/tractr/stack/compare/v1.64.5...v1.64.6) (2022-11-18) - - - -## [1.64.5](https://github.com/tractr/stack/compare/v1.64.4...v1.64.5) (2022-11-16) - - - -## [1.64.4](https://github.com/tractr/stack/compare/v1.64.3...v1.64.4) (2022-11-16) - - - ## [1.64.3](https://github.com/tractr/stack/compare/v1.64.2...v1.64.3) (2022-11-10) - - -## [1.64.2](https://github.com/tractr/stack/compare/v1.64.1...v1.64.2) (2022-11-04) - - - -## [1.64.1](https://github.com/tractr/stack/compare/v1.64.0...v1.64.1) (2022-11-04) - - - -# [1.64.0](https://github.com/tractr/stack/compare/v1.63.0...v1.64.0) (2022-11-03) - - - -# [1.63.0](https://github.com/tractr/stack/compare/v1.62.0...v1.63.0) (2022-10-18) - - - -# [1.62.0](https://github.com/tractr/stack/compare/v1.61.3...v1.62.0) (2022-10-12) - - - -## [1.61.3](https://github.com/tractr/stack/compare/v1.61.2...v1.61.3) (2022-10-12) - - - -## [1.61.2](https://github.com/tractr/stack/compare/v1.61.1...v1.61.2) (2022-10-06) - - - -## [1.61.1](https://github.com/tractr/stack/compare/v1.61.0...v1.61.1) (2022-10-05) - - - -# [1.61.0](https://github.com/tractr/stack/compare/v1.60.2...v1.61.0) (2022-09-29) - - - -## [1.60.2](https://github.com/tractr/stack/compare/v1.60.1...v1.60.2) (2022-09-22) - - - -## [1.60.1](https://github.com/tractr/stack/compare/v1.60.0...v1.60.1) (2022-09-21) - - - -# [1.60.0](https://github.com/tractr/stack/compare/v1.59.0...v1.60.0) (2022-09-19) - - - -# [1.59.0](https://github.com/tractr/stack/compare/v1.58.7...v1.59.0) (2022-09-19) - - - -## [1.58.7](https://github.com/tractr/stack/compare/v1.58.6...v1.58.7) (2022-09-19) - - - -## [1.58.6](https://github.com/tractr/stack/compare/v1.58.5...v1.58.6) (2022-09-13) - - - -## [1.58.5](https://github.com/tractr/stack/compare/v1.58.4...v1.58.5) (2022-09-13) - - -### Bug Fixes - -* **authentication:** export controller + fix interface password ([#507](https://github.com/tractr/stack/issues/507)) ([1825cf7](https://github.com/tractr/stack/commit/1825cf799356fbf1df00241c60ad13d95fca9ec8)) - - - -## [1.58.4](https://github.com/tractr/stack/compare/v1.58.3...v1.58.4) (2022-09-08) - - - -## [1.58.3](https://github.com/tractr/stack/compare/v1.58.2...v1.58.3) (2022-09-08) - - -### Bug Fixes - -* **angular-authentication:** fix logout ([#504](https://github.com/tractr/stack/issues/504)) ([fc374e9](https://github.com/tractr/stack/commit/fc374e9e7bb88e468051051a0db0f1f7c80448bf)) - - - ## [1.58.2](https://github.com/tractr/stack/compare/v1.58.1...v1.58.2) (2022-09-07) - - -## [1.58.1](https://github.com/tractr/stack/compare/v1.58.0...v1.58.1) (2022-09-06) - - - # [1.58.0](https://github.com/tractr/stack/compare/v1.57.2...v1.58.0) (2022-09-02) - - -## [1.57.2](https://github.com/tractr/stack/compare/v1.57.1...v1.57.2) (2022-09-01) - - - -## [1.57.1](https://github.com/tractr/stack/compare/v1.57.0...v1.57.1) (2022-08-31) - - - -# [1.57.0](https://github.com/tractr/stack/compare/v1.56.1...v1.57.0) (2022-08-31) - - - ## [1.56.1](https://github.com/tractr/stack/compare/v1.56.0...v1.56.1) (2022-08-26) +## [1.43.5](https://github.com/tractr/stack/compare/v1.43.4...v1.43.5) (2022-04-07) +## [1.43.1](https://github.com/tractr/stack/compare/v1.43.0...v1.43.1) (2022-04-06) -# [1.56.0](https://github.com/tractr/stack/compare/v1.55.0...v1.56.0) (2022-08-19) - - - -# [1.55.0](https://github.com/tractr/stack/compare/v1.54.5...v1.55.0) (2022-08-18) - - - -## [1.54.5](https://github.com/tractr/stack/compare/v1.54.4...v1.54.5) (2022-08-18) - - +# [1.43.0](https://github.com/tractr/stack/compare/v1.42.1...v1.43.0) (2022-04-05) -## [1.54.4](https://github.com/tractr/stack/compare/v1.54.3...v1.54.4) (2022-08-17) +# [1.41.0](https://github.com/tractr/stack/compare/v1.40.0...v1.41.0) (2022-03-03) +## [1.39.3](https://github.com/tractr/stack/compare/v1.39.2...v1.39.3) (2022-02-22) +# [1.38.0](https://github.com/tractr/stack/compare/v1.37.1...v1.38.0) (2022-02-17) -## [1.54.3](https://github.com/tractr/stack/compare/v1.54.2...v1.54.3) (2022-08-17) +# [1.34.0](https://github.com/tractr/stack/compare/v1.33.0...v1.34.0) (2022-01-31) +### Features +* use typeof instead of the dto to type the angular injection token ([#320](https://github.com/tractr/stack/issues/320)) ([4653bdf](https://github.com/tractr/stack/commit/4653bdfe66d458949cea94a61bf615ac703a4cd4)) -## [1.54.2](https://github.com/tractr/stack/compare/v1.54.1...v1.54.2) (2022-08-17) +## [1.23.1](https://github.com/tractr/stack/compare/v1.23.0...v1.23.1) (2021-11-09) +## [1.22.2](https://github.com/tractr/stack/compare/v1.22.1...v1.22.2) (2021-10-28) +## [1.21.3](https://github.com/tractr/stack/compare/v1.21.2...v1.21.3) (2021-10-15) -## [1.54.1](https://github.com/tractr/stack/compare/v1.54.0...v1.54.1) (2022-08-17) +## [0.6.4](https://github.com/tractr/stack/compare/angular-authentication-0.6.3...angular-authentication-0.6.4) (2021-09-28) +### Bug Fixes +* do not fail when the fetch user fail that cause the whole rx chain to complete with error ([#218](https://github.com/tractr/stack/issues/218)) ([ce6d04f](https://github.com/tractr/stack/commit/ce6d04f702b7b9f9b88e2fdec0ea403bb9f3e9ba)) -# [1.54.0](https://github.com/tractr/stack/compare/v1.53.1...v1.54.0) (2022-08-17) +* remove the http dependencies from angular config service that was causing circular deps ([#198](https://github.com/tractr/stack/issues/198)) ([c52152a](https://github.com/tractr/stack/commit/c52152a061fcd54bed3a36931c0cf88f05310d8d)) +## [0.4.1](https://github.com/tractr/stack/compare/angular-authentication-0.4.0...angular-authentication-0.4.1) (2021-07-19) ### Features -* update angular, nestjs, prisma and react-admin ([#468](https://github.com/tractr/stack/issues/468)) ([8122574](https://github.com/tractr/stack/commit/8122574544697a29a2acf1aef799fc568fb50be0)) - - - -## [1.53.1](https://github.com/tractr/stack/compare/v1.53.0...v1.53.1) (2022-08-16) - - -### Bug Fixes - -* add test coverage to 80% ([#446](https://github.com/tractr/stack/issues/446)) ([04f1857](https://github.com/tractr/stack/commit/04f18577cf177db6024bd3536aa8e7f6fb6199d8)) - - - -# [1.53.0](https://github.com/tractr/stack/compare/v1.52.2...v1.53.0) (2022-08-15) - - - -## [1.52.2](https://github.com/tractr/stack/compare/v1.52.1...v1.52.2) (2022-08-12) - - - -## [1.52.1](https://github.com/tractr/stack/compare/v1.52.0...v1.52.1) (2022-08-12) - - - -# [1.52.0](https://github.com/tractr/stack/compare/v1.51.1...v1.52.0) (2022-08-11) - - - -## [1.51.1](https://github.com/tractr/stack/compare/v1.51.0...v1.51.1) (2022-08-09) - - - -# [1.51.0](https://github.com/tractr/stack/compare/v1.50.1...v1.51.0) (2022-08-02) - - - -## [1.50.1](https://github.com/tractr/stack/compare/v1.50.0...v1.50.1) (2022-07-19) - - - -# [1.50.0](https://github.com/tractr/stack/compare/v1.49.0...v1.50.0) (2022-07-14) - - - -# [1.49.0](https://github.com/tractr/stack/compare/v1.48.4...v1.49.0) (2022-07-06) - - - -## [1.48.4](https://github.com/tractr/stack/compare/v1.48.3...v1.48.4) (2022-07-04) - - - -## [1.48.3](https://github.com/tractr/stack/compare/v1.48.2...v1.48.3) (2022-07-04) - - - -## [1.48.2](https://github.com/tractr/stack/compare/v1.48.1...v1.48.2) (2022-06-22) - - - -## [1.48.1](https://github.com/tractr/stack/compare/v1.48.0...v1.48.1) (2022-06-22) - - - -# [1.48.0](https://github.com/tractr/stack/compare/v1.47.0...v1.48.0) (2022-06-22) +* add nestjs-file-storage and angular-file-storage libs ([#149](https://github.com/tractr/stack/issues/149)) ([804c4a6](https://github.com/tractr/stack/commit/804c4a6b1062a087804bfa2abec60db62c816269)) +# [0.2.0](https://github.com/tractr/stack/compare/angular-authentication-0.1.0...angular-authentication-0.2.0) (2021-07-12) ### Features - -* update stack's packages ([#444](https://github.com/tractr/stack/issues/444)) ([703410a](https://github.com/tractr/stack/commit/703410afd5a2761095620652f063c292305e4cdc)) - - - -# [1.47.0](https://github.com/tractr/stack/compare/v1.46.3...v1.47.0) (2022-06-07) - - - -## [1.46.3](https://github.com/tractr/stack/compare/v1.46.2...v1.46.3) (2022-06-06) - - - -## [1.46.2](https://github.com/tractr/stack/compare/v1.46.1...v1.46.2) (2022-06-06) - - - -## [1.46.1](https://github.com/tractr/stack/compare/v1.46.0...v1.46.1) (2022-06-06) - - - -# [1.46.0](https://github.com/tractr/stack/compare/v1.45.5...v1.46.0) (2022-06-02) - - - -## [1.45.5](https://github.com/tractr/stack/compare/v1.45.4...v1.45.5) (2022-05-31) - - - -## [1.45.4](https://github.com/tractr/stack/compare/v1.45.3...v1.45.4) (2022-05-30) - - - -## [1.45.3](https://github.com/tractr/stack/compare/v1.45.2...v1.45.3) (2022-05-25) - - - -## [1.45.2](https://github.com/tractr/stack/compare/v1.45.1...v1.45.2) (2022-05-18) - - - -## [1.45.1](https://github.com/tractr/stack/compare/v1.45.0...v1.45.1) (2022-05-18) - - - -# [1.45.0](https://github.com/tractr/stack/compare/v1.44.0...v1.45.0) (2022-05-17) - - - -# [1.44.0](https://github.com/tractr/stack/compare/v1.43.16...v1.44.0) (2022-05-16) - - - -## [1.43.16](https://github.com/tractr/stack/compare/v1.43.15...v1.43.16) (2022-05-16) - - - -## [1.43.15](https://github.com/tractr/stack/compare/v1.43.14...v1.43.15) (2022-05-11) - - - -## [1.43.14](https://github.com/tractr/stack/compare/v1.43.13...v1.43.14) (2022-05-10) - - - -## [1.43.13](https://github.com/tractr/stack/compare/v1.43.12...v1.43.13) (2022-05-03) - - - -## [1.43.12](https://github.com/tractr/stack/compare/v1.43.11...v1.43.12) (2022-05-03) - - - -## [1.43.11](https://github.com/tractr/stack/compare/v1.43.10...v1.43.11) (2022-05-02) - - - -## [1.43.10](https://github.com/tractr/stack/compare/v1.43.9...v1.43.10) (2022-04-28) - - - -## [1.43.9](https://github.com/tractr/stack/compare/v1.43.8...v1.43.9) (2022-04-14) - - - -## [1.43.8](https://github.com/tractr/stack/compare/v1.43.7...v1.43.8) (2022-04-12) - - - -## [1.43.7](https://github.com/tractr/stack/compare/v1.43.6...v1.43.7) (2022-04-11) - - - -## [1.43.6](https://github.com/tractr/stack/compare/v1.43.5...v1.43.6) (2022-04-08) - - - -## [1.43.5](https://github.com/tractr/stack/compare/v1.43.4...v1.43.5) (2022-04-07) - - - -## [1.43.4](https://github.com/tractr/stack/compare/v1.43.3...v1.43.4) (2022-04-06) - - - -## [1.43.3](https://github.com/tractr/stack/compare/v1.43.2...v1.43.3) (2022-04-06) - - - -## [1.43.2](https://github.com/tractr/stack/compare/v1.43.1...v1.43.2) (2022-04-06) - - - -## [1.43.1](https://github.com/tractr/stack/compare/v1.43.0...v1.43.1) (2022-04-06) - - - -# [1.43.0](https://github.com/tractr/stack/compare/v1.42.1...v1.43.0) (2022-04-05) - - - -## [1.42.1](https://github.com/tractr/stack/compare/v1.42.0...v1.42.1) (2022-03-15) - - - -# [1.42.0](https://github.com/tractr/stack/compare/v1.41.0...v1.42.0) (2022-03-03) - - - -# [1.41.0](https://github.com/tractr/stack/compare/v1.40.0...v1.41.0) (2022-03-03) - - - -# [1.40.0](https://github.com/tractr/stack/compare/v1.39.6...v1.40.0) (2022-02-28) - - - -## [1.39.6](https://github.com/tractr/stack/compare/v1.39.5...v1.39.6) (2022-02-23) - - - -## [1.39.5](https://github.com/tractr/stack/compare/v1.39.4...v1.39.5) (2022-02-23) - - - -## [1.39.4](https://github.com/tractr/stack/compare/v1.39.3...v1.39.4) (2022-02-22) - - - -## [1.39.3](https://github.com/tractr/stack/compare/v1.39.2...v1.39.3) (2022-02-22) - - - -## [1.39.2](https://github.com/tractr/stack/compare/v1.39.1...v1.39.2) (2022-02-22) - - - -## [1.39.1](https://github.com/tractr/stack/compare/v1.39.0...v1.39.1) (2022-02-19) - - - -# [1.39.0](https://github.com/tractr/stack/compare/v1.38.0...v1.39.0) (2022-02-18) - - - -# [1.38.0](https://github.com/tractr/stack/compare/v1.37.1...v1.38.0) (2022-02-17) - - -### Features - -* add create hapify workspace command ([#387](https://github.com/tractr/stack/issues/387)) ([98119b9](https://github.com/tractr/stack/commit/98119b9be282b5afcd8bf7ee82af8b677eeaab0a)) - - - -## [1.37.1](https://github.com/tractr/stack/compare/v1.37.0...v1.37.1) (2022-02-17) - - - -# [1.37.0](https://github.com/tractr/stack/compare/v1.36.3...v1.37.0) (2022-02-16) - - - -## [1.36.3](https://github.com/tractr/stack/compare/v1.36.2...v1.36.3) (2022-02-11) - - - -## [1.36.2](https://github.com/tractr/stack/compare/v1.36.1...v1.36.2) (2022-02-10) - - - -## [1.36.1](https://github.com/tractr/stack/compare/v1.36.0...v1.36.1) (2022-02-09) - - - -# [1.36.0](https://github.com/tractr/stack/compare/v1.35.0...v1.36.0) (2022-02-08) - - - -# [1.35.0](https://github.com/tractr/stack/compare/v1.34.0...v1.35.0) (2022-02-08) - - - -# [1.34.0](https://github.com/tractr/stack/compare/v1.33.0...v1.34.0) (2022-01-31) - - -### Features - -* update nx and angular to v13 and prisma to v3 ([#362](https://github.com/tractr/stack/issues/362)) ([7432363](https://github.com/tractr/stack/commit/7432363cdc5f4e7b80bb513f5d9aef1152109d46)) - - - -# [1.33.0](https://github.com/tractr/stack/compare/v1.32.1...v1.33.0) (2022-01-20) - - - -## [1.32.1](https://github.com/tractr/stack/compare/v1.32.0...v1.32.1) (2022-01-20) - - - -# [1.32.0](https://github.com/tractr/stack/compare/v1.31.0...v1.32.0) (2022-01-07) - - - -# [1.31.0](https://github.com/tractr/stack/compare/v1.30.0...v1.31.0) (2021-12-21) - - - -# [1.30.0](https://github.com/tractr/stack/compare/v1.29.3...v1.30.0) (2021-12-15) - - - -## [1.29.3](https://github.com/tractr/stack/compare/v1.29.2...v1.29.3) (2021-12-14) - - - -## [1.29.2](https://github.com/tractr/stack/compare/v1.29.1...v1.29.2) (2021-12-14) - - - -## [1.29.1](https://github.com/tractr/stack/compare/v1.29.0...v1.29.1) (2021-12-09) - - - -# [1.29.0](https://github.com/tractr/stack/compare/v1.28.5...v1.29.0) (2021-12-07) - - -### Features - -* update angular authentication with dto check ([#324](https://github.com/tractr/stack/issues/324)) ([078c93a](https://github.com/tractr/stack/commit/078c93a54cc778884b2323be392a66f40e0156a0)) - - - -## [1.28.5](https://github.com/tractr/stack/compare/v1.28.4...v1.28.5) (2021-12-06) - - - -## [1.28.4](https://github.com/tractr/stack/compare/v1.28.3...v1.28.4) (2021-12-03) - - -### Bug Fixes - -* remove User validate nested from authentication options dto ([#321](https://github.com/tractr/stack/issues/321)) ([fc3d8cf](https://github.com/tractr/stack/commit/fc3d8cfae3cf88f1e5ba0dbd38f4753e7e7830e5)) - - - -## [1.28.3](https://github.com/tractr/stack/compare/v1.28.2...v1.28.3) (2021-12-03) - - -### Bug Fixes - -* use typeof instead of the dto to type the angular injection token ([#320](https://github.com/tractr/stack/issues/320)) ([4653bdf](https://github.com/tractr/stack/commit/4653bdfe66d458949cea94a61bf615ac703a4cd4)) - - - -## [1.28.2](https://github.com/tractr/stack/compare/v1.28.1...v1.28.2) (2021-12-03) - - - -## [1.28.1](https://github.com/tractr/stack/compare/v1.28.0...v1.28.1) (2021-12-02) - - - -# [1.28.0](https://github.com/tractr/stack/compare/v1.27.2...v1.28.0) (2021-12-02) - - - -## [1.27.2](https://github.com/tractr/stack/compare/v1.27.1...v1.27.2) (2021-12-01) - - - -## [1.27.1](https://github.com/tractr/stack/compare/v1.27.0...v1.27.1) (2021-11-30) - - - -# [1.27.0](https://github.com/tractr/stack/compare/v1.26.0...v1.27.0) (2021-11-30) - - -### Features - -* remove generated code from nestjs authentication and angular authentication package ([#312](https://github.com/tractr/stack/issues/312)) ([4fa7bfa](https://github.com/tractr/stack/commit/4fa7bfa536d1accb483fa8b83f93c9395de5e1e0)), closes [#313](https://github.com/tractr/stack/issues/313) - - - -# [1.26.0](https://github.com/tractr/stack/compare/v1.25.0...v1.26.0) (2021-11-30) - - - -# [1.25.0](https://github.com/tractr/stack/compare/v1.24.0...v1.25.0) (2021-11-29) - - - -# [1.24.0](https://github.com/tractr/stack/compare/v1.23.2...v1.24.0) (2021-11-18) - - - -## [1.23.2](https://github.com/tractr/stack/compare/v1.23.1...v1.23.2) (2021-11-16) - - - -## [1.23.1](https://github.com/tractr/stack/compare/v1.23.0...v1.23.1) (2021-11-09) - - - -# [1.23.0](https://github.com/tractr/stack/compare/v1.22.4...v1.23.0) (2021-11-03) - - - -## [1.22.4](https://github.com/tractr/stack/compare/v1.22.3...v1.22.4) (2021-10-29) - - - -## [1.22.3](https://github.com/tractr/stack/compare/v1.22.2...v1.22.3) (2021-10-28) - - - -## [1.22.2](https://github.com/tractr/stack/compare/v1.22.1...v1.22.2) (2021-10-28) - - - -## [1.22.1](https://github.com/tractr/stack/compare/v1.22.0...v1.22.1) (2021-10-27) - - - -# [1.22.0](https://github.com/tractr/stack/compare/v1.21.4...v1.22.0) (2021-10-19) - - - -## [1.21.4](https://github.com/tractr/stack/compare/v1.21.3...v1.21.4) (2021-10-15) - - - -## [1.21.3](https://github.com/tractr/stack/compare/v1.21.2...v1.21.3) (2021-10-15) - - - -## [1.21.2](https://github.com/tractr/stack/compare/v1.21.1...v1.21.2) (2021-10-15) - - - -## [1.21.1](https://github.com/tractr/stack/compare/v1.21.0...v1.21.1) (2021-10-13) - - - -# [1.21.0](https://github.com/tractr/stack/compare/v1.20.1...v1.21.0) (2021-10-13) - - - -## [0.6.4](https://github.com/tractr/stack/compare/angular-authentication-0.6.3...angular-authentication-0.6.4) (2021-09-28) - - -### Bug Fixes - -* **angular-authentication:** fix session in error ([#273](https://github.com/tractr/stack/issues/273)) ([70d45c6](https://github.com/tractr/stack/commit/70d45c669eebe37c445fee0d26c065e98bbb0f02)) - - - -## [0.6.3](https://github.com/tractr/stack/compare/angular-authentication-0.6.2...angular-authentication-0.6.3) (2021-08-10) - - -### Bug Fixes - -* angular authentication add password service in providers ([#225](https://github.com/tractr/stack/issues/225)) ([c261630](https://github.com/tractr/stack/commit/c2616304048ad908cbfcc4ab4e0c3a47c351b1d5)) - - - -## [0.6.2](https://github.com/tractr/stack/compare/angular-authentication-0.6.1...angular-authentication-0.6.2) (2021-08-06) - - -### Bug Fixes - -* do not fail when the fetch user fail that cause the whole rx chain to complete with error ([#218](https://github.com/tractr/stack/issues/218)) ([ce6d04f](https://github.com/tractr/stack/commit/ce6d04f702b7b9f9b88e2fdec0ea403bb9f3e9ba)) - - - -## [0.6.1](https://github.com/tractr/stack/compare/angular-authentication-0.6.0...angular-authentication-0.6.1) (2021-08-05) - - -### Bug Fixes - -* use the spread operator to decuonstruct correctly the options arguments ([#217](https://github.com/tractr/stack/issues/217)) ([3a6d15c](https://github.com/tractr/stack/commit/3a6d15c751b8fecc9b6fc091e44af1688cb22f2f)) - - - -# [0.6.0](https://github.com/tractr/stack/compare/angular-authentication-0.5.0...angular-authentication-0.6.0) (2021-07-30) - - - -# [0.5.0](https://github.com/tractr/stack/compare/angular-authentication-0.4.3...angular-authentication-0.5.0) (2021-07-28) - - -### Features - -* add casl packages to the stack to get a right policy via hapify ([#184](https://github.com/tractr/stack/issues/184)) ([cc241c1](https://github.com/tractr/stack/commit/cc241c1f3e737febadb5ecb90113732be8088d76)) -* add password recovery to the authentication process ([#191](https://github.com/tractr/stack/issues/191)) ([2f33209](https://github.com/tractr/stack/commit/2f332091d96728e8e407a20b781e9816344bca7b)) - - - -## [0.4.3](https://github.com/tractr/stack/compare/angular-authentication-0.4.2...angular-authentication-0.4.3) (2021-07-21) - - -### Bug Fixes - -* remove the http dependencies from angular config service that was causing circular deps ([#198](https://github.com/tractr/stack/issues/198)) ([c52152a](https://github.com/tractr/stack/commit/c52152a061fcd54bed3a36931c0cf88f05310d8d)) - - - -## [0.4.2](https://github.com/tractr/stack/compare/angular-authentication-0.4.1...angular-authentication-0.4.2) (2021-07-21) - - -### Bug Fixes - -* change module options factory typing ([#196](https://github.com/tractr/stack/issues/196)) ([9a55c71](https://github.com/tractr/stack/commit/9a55c71bd516b0812c560aecd91d7d2ebdb6c533)) - - - -## [0.4.1](https://github.com/tractr/stack/compare/angular-authentication-0.4.0...angular-authentication-0.4.1) (2021-07-19) - - -### Bug Fixes - -* update packages to get a module options factory that can set defaults & validate front & back ([#192](https://github.com/tractr/stack/issues/192)) ([3975d36](https://github.com/tractr/stack/commit/3975d3690f82221ce1f207acff0ae3f63346eca5)) - - - -# [0.4.0](https://github.com/tractr/stack/compare/angular-authentication-0.3.0...angular-authentication-0.4.0) (2021-07-15) - - -### Features - -* **angular-authentication:** fix guard redirect ([#189](https://github.com/tractr/stack/issues/189)) ([346455e](https://github.com/tractr/stack/commit/346455e064eeaff6c536a672fa60179897dab91f)) - - - -# [0.3.0](https://github.com/tractr/stack/compare/angular-authentication-0.2.1...angular-authentication-0.3.0) (2021-07-13) - - -### Features - -* add nestjs-file-storage and angular-file-storage libs ([#149](https://github.com/tractr/stack/issues/149)) ([804c4a6](https://github.com/tractr/stack/commit/804c4a6b1062a087804bfa2abec60db62c816269)) - - - -## [0.2.1](https://github.com/tractr/stack/compare/angular-authentication-0.2.0...angular-authentication-0.2.1) (2021-07-13) - - -### Bug Fixes - -* remove all reference to [@generated](https://github.com/generated) from the generated files and only use the relative paths ([#172](https://github.com/tractr/stack/issues/172)) ([8117df7](https://github.com/tractr/stack/commit/8117df7e58fd3ef4b0e9e051d1235c19b361149b)) - - - -# [0.2.0](https://github.com/tractr/stack/compare/angular-authentication-0.1.0...angular-authentication-0.2.0) (2021-07-12) - - -### Features - -* update all package json dependencies ([#167](https://github.com/tractr/stack/issues/167)) ([aee9606](https://github.com/tractr/stack/commit/aee96067b70286145162f57184a37f25dce1d274)) - - - -# 0.1.0 (2021-07-12) - - -### Features - -* add angular authentication package to the stack ([#156](https://github.com/tractr/stack/issues/156)) ([f23d2d8](https://github.com/tractr/stack/commit/f23d2d8691b84fed688cbc67c94457080f5719bd)) diff --git a/libs/angular/authentication/package.json b/libs/angular/authentication/package.json index 03584a672..90c575830 100644 --- a/libs/angular/authentication/package.json +++ b/libs/angular/authentication/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-authentication", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/casl/CHANGELOG.md b/libs/angular/casl/CHANGELOG.md index 023c0163f..97bb74375 100644 --- a/libs/angular/casl/CHANGELOG.md +++ b/libs/angular/casl/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/casl/package.json b/libs/angular/casl/package.json index f012584a8..7a94f3c05 100644 --- a/libs/angular/casl/package.json +++ b/libs/angular/casl/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-casl", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/components/CHANGELOG.md b/libs/angular/components/CHANGELOG.md index 82e68a8ec..c0461a637 100644 --- a/libs/angular/components/CHANGELOG.md +++ b/libs/angular/components/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/components/package.json b/libs/angular/components/package.json index d24a55fbc..64d4d652c 100644 --- a/libs/angular/components/package.json +++ b/libs/angular/components/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-components", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/components/src/lib/model/model.module.ts b/libs/angular/components/src/lib/model/model.module.ts index fe9e49b04..bf46ac956 100644 --- a/libs/angular/components/src/lib/model/model.module.ts +++ b/libs/angular/components/src/lib/model/model.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; -import { SelectModule } from '../select/select.module'; import { ModelSelectComponent } from './select/select.component'; +import { SelectModule } from '../select/select.module'; import { AngularToolsModule } from '@trxn/angular-tools'; diff --git a/libs/angular/config/CHANGELOG.md b/libs/angular/config/CHANGELOG.md index 4790490e4..4db4a485b 100644 --- a/libs/angular/config/CHANGELOG.md +++ b/libs/angular/config/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/config/package.json b/libs/angular/config/package.json index 1c781b6f7..1ab69bbb1 100644 --- a/libs/angular/config/package.json +++ b/libs/angular/config/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/file-storage/CHANGELOG.md b/libs/angular/file-storage/CHANGELOG.md index f507fc1f8..66fa0de24 100644 --- a/libs/angular/file-storage/CHANGELOG.md +++ b/libs/angular/file-storage/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/file-storage/package.json b/libs/angular/file-storage/package.json index 3a6169cd8..277be62ab 100644 --- a/libs/angular/file-storage/package.json +++ b/libs/angular/file-storage/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-file-storage", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/form/CHANGELOG.md b/libs/angular/form/CHANGELOG.md index 247dcdf91..d4ecd85f1 100644 --- a/libs/angular/form/CHANGELOG.md +++ b/libs/angular/form/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/form/package.json b/libs/angular/form/package.json index 72a15a3fe..243266b63 100644 --- a/libs/angular/form/package.json +++ b/libs/angular/form/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-form", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/angular/tools/CHANGELOG.md b/libs/angular/tools/CHANGELOG.md index f7bff05d9..d0563e523 100644 --- a/libs/angular/tools/CHANGELOG.md +++ b/libs/angular/tools/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/angular/tools/package.json b/libs/angular/tools/package.json index a71c32d25..792fc742c 100644 --- a/libs/angular/tools/package.json +++ b/libs/angular/tools/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/angular-tools", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Tools for angular application", "repository": { "type": "git", diff --git a/libs/common/CHANGELOG.md b/libs/common/CHANGELOG.md index 360cc531c..fd97f9af1 100644 --- a/libs/common/CHANGELOG.md +++ b/libs/common/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/common/package.json b/libs/common/package.json index 7cc6a63b5..1d35b36ac 100644 --- a/libs/common/package.json +++ b/libs/common/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/common", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Common module for back and front", "repository": { "type": "git", diff --git a/libs/common/src/lib/validator-transformer/validators/bool-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/bool-filter-validate.ts index 559f8cb42..380589a98 100644 --- a/libs/common/src/lib/validator-transformer/validators/bool-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/bool-filter-validate.ts @@ -1,9 +1,9 @@ import { isBooleanString, isIn } from 'class-validator'; import { isBoolean } from 'lodash'; +import { CustomValidate } from './custom-validate'; import { ArrayFilterProps, BoolFilterProps } from '../../constants'; import { transformStringToArray } from '../../helpers'; -import { CustomValidate } from './custom-validate'; /** * Accept a field string and return a boolean indicating if the field is a boolean string and filter type diff --git a/libs/common/src/lib/validator-transformer/validators/date-time-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/date-time-filter-validate.ts index 9b2073b41..2941c6c0d 100644 --- a/libs/common/src/lib/validator-transformer/validators/date-time-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/date-time-filter-validate.ts @@ -1,8 +1,8 @@ import { isDate, isDateString, isIn } from 'class-validator'; +import { CustomValidate } from './custom-validate'; import { ArrayFilterProps, DateTimeFilterProps } from '../../constants'; import { transformStringToArray } from '../../helpers'; -import { CustomValidate } from './custom-validate'; /** * Accept a field string and return a boolean indicating if the field is an integer string and filter type diff --git a/libs/common/src/lib/validator-transformer/validators/enum-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/enum-filter-validate.ts index 044700932..60f8fa373 100644 --- a/libs/common/src/lib/validator-transformer/validators/enum-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/enum-filter-validate.ts @@ -1,8 +1,8 @@ import { isIn } from 'class-validator'; +import { CustomValidate } from './custom-validate'; import { ArrayFilterProps, EnumFilterProps } from '../../constants'; import { transformStringToArray } from '../../helpers'; -import { CustomValidate } from './custom-validate'; /** * Accept a field string and return a boolean indicating if the field is string and filter type diff --git a/libs/common/src/lib/validator-transformer/validators/json-filter-validate.spec.ts b/libs/common/src/lib/validator-transformer/validators/json-filter-validate.spec.ts index 0818bfea5..5ef0728ae 100644 --- a/libs/common/src/lib/validator-transformer/validators/json-filter-validate.spec.ts +++ b/libs/common/src/lib/validator-transformer/validators/json-filter-validate.spec.ts @@ -2,8 +2,8 @@ /* eslint-disable max-classes-per-file */ import { validate } from 'class-validator'; -import { JsonArray, JsonObject } from '../../interfaces'; import { JsonFilterValidate } from './json-filter-validate'; +import { JsonArray, JsonObject } from '../../interfaces'; describe('JsonFilterValidate decorator', () => { // Class to test the JsonFilterValidate decorator diff --git a/libs/common/src/lib/validator-transformer/validators/json-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/json-filter-validate.ts index 012f3a16b..92bf7e852 100644 --- a/libs/common/src/lib/validator-transformer/validators/json-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/json-filter-validate.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { isIn, isObject } from 'class-validator'; -import { JsonFilterProps } from '../../constants'; import { CustomValidate } from './custom-validate'; +import { JsonFilterProps } from '../../constants'; /** * Accept a field string and return a boolean indicating if the field is an object string with filter type diff --git a/libs/common/src/lib/validator-transformer/validators/number-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/number-filter-validate.ts index 60076cf62..e0a53e4c9 100644 --- a/libs/common/src/lib/validator-transformer/validators/number-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/number-filter-validate.ts @@ -1,8 +1,8 @@ import { isIn, isNumber, isNumberString } from 'class-validator'; +import { CustomValidate } from './custom-validate'; import { ArrayFilterProps, NumberFilterProps } from '../../constants'; import { transformStringToArray } from '../../helpers'; -import { CustomValidate } from './custom-validate'; /** * Accept a field string and return a boolean indicating if the field is a boolean string and filter type diff --git a/libs/common/src/lib/validator-transformer/validators/string-filter-validate.ts b/libs/common/src/lib/validator-transformer/validators/string-filter-validate.ts index 064a31001..44ec852f1 100644 --- a/libs/common/src/lib/validator-transformer/validators/string-filter-validate.ts +++ b/libs/common/src/lib/validator-transformer/validators/string-filter-validate.ts @@ -1,8 +1,8 @@ import { isIn, isString } from 'class-validator'; +import { CustomValidate } from './custom-validate'; import { ArrayFilterProps, StringFilterProps } from '../../constants'; import { transformStringToArray } from '../../helpers'; -import { CustomValidate } from './custom-validate'; /** * Accept a field string and return a boolean indicating if the field is string and filter type diff --git a/libs/config/client/CHANGELOG.md b/libs/config/client/CHANGELOG.md index 2419e060f..d2fcb6d11 100644 --- a/libs/config/client/CHANGELOG.md +++ b/libs/config/client/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/config/client/package.json b/libs/config/client/package.json index 478b1785a..dee6ef24b 100644 --- a/libs/config/client/package.json +++ b/libs/config/client/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/client-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion.git" diff --git a/libs/config/commit/CHANGELOG.md b/libs/config/commit/CHANGELOG.md index 0a932a9e6..4123daf59 100644 --- a/libs/config/commit/CHANGELOG.md +++ b/libs/config/commit/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/config/commit/package.json b/libs/config/commit/package.json index 81c30cb92..eee78fb0f 100644 --- a/libs/config/commit/package.json +++ b/libs/config/commit/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/commit-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion.git" diff --git a/libs/config/eslint/CHANGELOG.md b/libs/config/eslint/CHANGELOG.md index 0d6841e9a..776e22e7b 100644 --- a/libs/config/eslint/CHANGELOG.md +++ b/libs/config/eslint/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/config/eslint/package.json b/libs/config/eslint/package.json index 2dfcb0249..b4cd8faac 100644 --- a/libs/config/eslint/package.json +++ b/libs/config/eslint/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/eslint-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion.git" diff --git a/libs/config/hapify/CHANGELOG.md b/libs/config/hapify/CHANGELOG.md index 052376298..c08c232ca 100644 --- a/libs/config/hapify/CHANGELOG.md +++ b/libs/config/hapify/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/config/hapify/package.json b/libs/config/hapify/package.json index a455978c7..6acc43483 100644 --- a/libs/config/hapify/package.json +++ b/libs/config/hapify/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion.git" diff --git a/libs/config/prettier/CHANGELOG.md b/libs/config/prettier/CHANGELOG.md index b983b7878..acec90aa4 100644 --- a/libs/config/prettier/CHANGELOG.md +++ b/libs/config/prettier/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/config/prettier/package.json b/libs/config/prettier/package.json index 067948462..765609e62 100644 --- a/libs/config/prettier/package.json +++ b/libs/config/prettier/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/prettier-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion.git" diff --git a/libs/generated/angular-rext-client/CHANGELOG.md b/libs/generated/angular-rext-client/CHANGELOG.md index 957dc0ebe..0a6907253 100644 --- a/libs/generated/angular-rext-client/CHANGELOG.md +++ b/libs/generated/angular-rext-client/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/angular-rext-client/package.json b/libs/generated/angular-rext-client/package.json index 48909da05..600cb7fbf 100644 --- a/libs/generated/angular-rext-client/package.json +++ b/libs/generated/angular-rext-client/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-angular-rext-client", - "version": "2.0.13", + "version": "2.1.0-next.1", "dependencies": { "tslib": "^2.3.1" }, diff --git a/libs/generated/casl/CHANGELOG.md b/libs/generated/casl/CHANGELOG.md index 1c72d883f..fe735f253 100644 --- a/libs/generated/casl/CHANGELOG.md +++ b/libs/generated/casl/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/casl/package.json b/libs/generated/casl/package.json index 7d70f3f69..2eda9c4d4 100644 --- a/libs/generated/casl/package.json +++ b/libs/generated/casl/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-casl", - "version": "2.0.13", + "version": "2.1.0-next.1", "dependencies": { "tslib": "^2.3.1" }, diff --git a/libs/generated/dbml/CHANGELOG.md b/libs/generated/dbml/CHANGELOG.md index f13664c50..e9b799a11 100644 --- a/libs/generated/dbml/CHANGELOG.md +++ b/libs/generated/dbml/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/dbml/package.json b/libs/generated/dbml/package.json index 8a0ff4f07..e6b91e91e 100644 --- a/libs/generated/dbml/package.json +++ b/libs/generated/dbml/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/generated-dbml", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/libs/generated/models/CHANGELOG.md b/libs/generated/models/CHANGELOG.md index f13664c50..e9b799a11 100644 --- a/libs/generated/models/CHANGELOG.md +++ b/libs/generated/models/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/models/package.json b/libs/generated/models/package.json index 47aa8111b..3441688e8 100644 --- a/libs/generated/models/package.json +++ b/libs/generated/models/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/generated-models", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/libs/generated/nestjs-graphql/CHANGELOG.md b/libs/generated/nestjs-graphql/CHANGELOG.md index 1d0eada1c..95133946a 100644 --- a/libs/generated/nestjs-graphql/CHANGELOG.md +++ b/libs/generated/nestjs-graphql/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/nestjs-graphql/package.json b/libs/generated/nestjs-graphql/package.json index 7c26008f3..3ed552c21 100644 --- a/libs/generated/nestjs-graphql/package.json +++ b/libs/generated/nestjs-graphql/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/generated-nestjs-graphql", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/libs/generated/nestjs-models-common/CHANGELOG.md b/libs/generated/nestjs-models-common/CHANGELOG.md index 85b23c759..6686a0d0b 100644 --- a/libs/generated/nestjs-models-common/CHANGELOG.md +++ b/libs/generated/nestjs-models-common/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/nestjs-models-common/package.json b/libs/generated/nestjs-models-common/package.json index 90c18a0dd..8c4c0971d 100644 --- a/libs/generated/nestjs-models-common/package.json +++ b/libs/generated/nestjs-models-common/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-nestjs-models-common", - "version": "2.0.13", + "version": "2.1.0-next.1", "exports": { ".": { "import": "./src/index.js" diff --git a/libs/generated/nestjs-models-rest/CHANGELOG.md b/libs/generated/nestjs-models-rest/CHANGELOG.md index a2986eb8d..47f5c1a89 100644 --- a/libs/generated/nestjs-models-rest/CHANGELOG.md +++ b/libs/generated/nestjs-models-rest/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/nestjs-models-rest/package.json b/libs/generated/nestjs-models-rest/package.json index d4e4dcaca..d443f3369 100644 --- a/libs/generated/nestjs-models-rest/package.json +++ b/libs/generated/nestjs-models-rest/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-nestjs-models-rest", - "version": "2.0.13", + "version": "2.1.0-next.1", "exports": { ".": { "import": "./src/index.js" diff --git a/libs/generated/nestjs-models/CHANGELOG.md b/libs/generated/nestjs-models/CHANGELOG.md index f13664c50..e9b799a11 100644 --- a/libs/generated/nestjs-models/CHANGELOG.md +++ b/libs/generated/nestjs-models/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/nestjs-models/package.json b/libs/generated/nestjs-models/package.json index 88f4ebd3e..2d3a18e46 100644 --- a/libs/generated/nestjs-models/package.json +++ b/libs/generated/nestjs-models/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-nestjs-models", - "version": "2.0.13", + "version": "2.1.0-next.1", "exports": { ".": "./dist/index.js", "./mock": "./dist/mock.js" diff --git a/libs/generated/prisma/CHANGELOG.md b/libs/generated/prisma/CHANGELOG.md index 97fb09bf4..a1a6f9daa 100644 --- a/libs/generated/prisma/CHANGELOG.md +++ b/libs/generated/prisma/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/prisma/package.json b/libs/generated/prisma/package.json index 9edc7578d..22ea58e27 100644 --- a/libs/generated/prisma/package.json +++ b/libs/generated/prisma/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/generated-prisma", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/libs/generated/react-admin/CHANGELOG.md b/libs/generated/react-admin/CHANGELOG.md index 707fc7b9c..bceb1e95e 100644 --- a/libs/generated/react-admin/CHANGELOG.md +++ b/libs/generated/react-admin/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/react-admin/package.json b/libs/generated/react-admin/package.json index eae514029..21335dfad 100644 --- a/libs/generated/react-admin/package.json +++ b/libs/generated/react-admin/package.json @@ -1,4 +1,4 @@ { "name": "@trxn/generated-react-admin", - "version": "2.0.13" + "version": "2.1.0-next.1" } diff --git a/libs/generated/rest-dtos/CHANGELOG.md b/libs/generated/rest-dtos/CHANGELOG.md index 957dc0ebe..0a6907253 100644 --- a/libs/generated/rest-dtos/CHANGELOG.md +++ b/libs/generated/rest-dtos/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/rest-dtos/package.json b/libs/generated/rest-dtos/package.json index 81de24829..e8dbc16f3 100644 --- a/libs/generated/rest-dtos/package.json +++ b/libs/generated/rest-dtos/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-rest-dtos", - "version": "2.0.13", + "version": "2.1.0-next.1", "dependencies": { "tslib": "^2.3.1" }, diff --git a/libs/generated/rext-client/CHANGELOG.md b/libs/generated/rext-client/CHANGELOG.md index 957dc0ebe..0a6907253 100644 --- a/libs/generated/rext-client/CHANGELOG.md +++ b/libs/generated/rext-client/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/generated/rext-client/package.json b/libs/generated/rext-client/package.json index a4c016c9c..2cdff52b8 100644 --- a/libs/generated/rext-client/package.json +++ b/libs/generated/rext-client/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/generated-rext-client", - "version": "2.0.13", + "version": "2.1.0-next.1", "dependencies": { "tslib": "^2.3.1" }, diff --git a/libs/hapify/generate-config/CHANGELOG.md b/libs/hapify/generate-config/CHANGELOG.md index 48c11a0e4..e14effba2 100644 --- a/libs/hapify/generate-config/CHANGELOG.md +++ b/libs/hapify/generate-config/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/generate-config/package.json b/libs/hapify/generate-config/package.json index b98ca8cee..69cbda97a 100644 --- a/libs/hapify/generate-config/package.json +++ b/libs/hapify/generate-config/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-generate-config", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Generate hapify config", "repository": { "type": "git", diff --git a/libs/hapify/hapify-common/CHANGELOG.md b/libs/hapify/hapify-common/CHANGELOG.md index fdb98851d..d1d9ac9d0 100644 --- a/libs/hapify/hapify-common/CHANGELOG.md +++ b/libs/hapify/hapify-common/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/hapify-common/package.json b/libs/hapify/hapify-common/package.json index 3c7dcadf5..a53ca40a7 100644 --- a/libs/hapify/hapify-common/package.json +++ b/libs/hapify/hapify-common/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-common", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify common helpers", "repository": { "type": "git", diff --git a/libs/hapify/templates/angular-rext-client/CHANGELOG.md b/libs/hapify/templates/angular-rext-client/CHANGELOG.md index a785a7b16..5c1c9c365 100644 --- a/libs/hapify/templates/angular-rext-client/CHANGELOG.md +++ b/libs/hapify/templates/angular-rext-client/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/angular-rext-client/package.json b/libs/hapify/templates/angular-rext-client/package.json index 32c8e1dc9..c2245e412 100644 --- a/libs/hapify/templates/angular-rext-client/package.json +++ b/libs/hapify/templates/angular-rext-client/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-angular-rext-client", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Template to generate an angular rest client with hapify", "repository": { "type": "git", diff --git a/libs/hapify/templates/casl/CHANGELOG.md b/libs/hapify/templates/casl/CHANGELOG.md index f6c0b9c52..b5870937e 100644 --- a/libs/hapify/templates/casl/CHANGELOG.md +++ b/libs/hapify/templates/casl/CHANGELOG.md @@ -2,6 +2,40 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/casl/hapify/generated/casl/src/config/get-prisma-user-query.ts.hpf b/libs/hapify/templates/casl/hapify/generated/casl/src/config/get-prisma-user-query.ts.hpf index b517e1ec1..4bfaacf2b 100644 --- a/libs/hapify/templates/casl/hapify/generated/casl/src/config/get-prisma-user-query.ts.hpf +++ b/libs/hapify/templates/casl/hapify/generated/casl/src/config/get-prisma-user-query.ts.hpf @@ -1,30 +1,39 @@ -import { Prisma <<=getModelListToImport()>>} from '@prisma/client'; +import { Prisma } from '@prisma/client'; +/** + * User select to retrieve all information for the user ownerships +*/ +export const UserSelectOwnershipIds = Prisma.validator()({ + select: <<=getSelectPrismaUserQueryFromHapify()>>, +}); + /** * User export type that the userService.findUnique method will return * by the getSelectPrismaUserQuery function */ -export type UserWithIds = <<=getUserFindUniqueReturnTypeFromHapify()>>; - +export type UserWithOwnershipIds = Prisma.UserGetPayload< + typeof UserSelectOwnershipIds +>; /** * Get the select configuration for the prisma user query to be able * to construct the user with the correct ids */ export function getSelectPrismaUserQuery(): Prisma.UserSelect { - return <<=getSelectPrismaUserQueryFromHapify()>>; + return UserSelectOwnershipIds.select; } + <<< function getSelectPrismaUserQueryFromHapify() { - const info = getOwnershipInformationsFromHapify(); + const info = getOwnershipInformationFromHapify(); return JSON.stringify(info.select, null, 2); } function getUserFindUniqueReturnTypeFromHapify() { - const info = getOwnershipInformationsFromHapify(); + const info = getOwnershipInformationFromHapify(); return JSON.stringify(info.types, null, 2) .replaceAll('"', '') @@ -35,13 +44,13 @@ export function getSelectPrismaUserQuery(): Prisma.UserSelect { } function getModelListToImport() { - const info = getOwnershipInformationsFromHapify(); + const info = getOwnershipInformationFromHapify(); return info.modelListToImport.length === 0 ? '' : `, ${info.modelListToImport.join(', ')} `; } - function getOwnershipInformationsFromHapify() { + function getOwnershipInformationFromHapify() { const models = root; if (!models) return JSON.stringify({}, null, 2); diff --git a/libs/hapify/templates/casl/hapify/generated/casl/src/config/role-permission.config.ts.hpf b/libs/hapify/templates/casl/hapify/generated/casl/src/config/role-permission.config.ts.hpf index 145097006..9d132e576 100644 --- a/libs/hapify/templates/casl/hapify/generated/casl/src/config/role-permission.config.ts.hpf +++ b/libs/hapify/templates/casl/hapify/generated/casl/src/config/role-permission.config.ts.hpf @@ -1,18 +1,22 @@ +import { AbilityBuilder } from '@casl/ability'; import { UserRoles } from '@prisma/client'; import { getConcatValueByPath } from '@trxn/common'; -import { DefinePermissions } from '@trxn/nestjs-casl'; +import { DefinePermissions, DefinePublicPermissions, RolePermissions } from '@trxn/nestjs-casl'; import { AppAbility } from '../interfaces'; +import { UserWithOwnershipIds } from './get-prisma-user-query'; -export const guestRolePermissions: DefinePermissions = ({ can }) => { +export const publicRolePermissions: DefinePublicPermissions> = ({ can }) => { <> <> can('<<=access.action>>', '<>'); <> <> }; + +export const guestRolePermissions: DefinePermissions, UserWithOwnershipIds> = publicRolePermissions; -export const userRolePermissions: DefinePermissions = ({ can }, user) => { +export const userRolePermissions: DefinePermissions, UserWithOwnershipIds> = ({ can }, user) => { <> // Configure permissions for <> from hapify models <> @@ -31,13 +35,14 @@ export const userRolePermissions: DefinePermissions = ({ can }, user <> }; -export const adminRolePermissions: DefinePermissions = ({ can }) => { +export const adminRolePermissions: DefinePermissions, UserWithOwnershipIds> = ({ can }) => { can('manage', 'all'); }; -export const rolePermissions: Record< +export const rolePermissions: RolePermissions< UserRoles, - DefinePermissions + AbilityBuilder, + UserWithOwnershipIds > = { guest: guestRolePermissions, user: userRolePermissions, diff --git a/libs/hapify/templates/casl/package.json b/libs/hapify/templates/casl/package.json index ded19a111..33bc92cea 100644 --- a/libs/hapify/templates/casl/package.json +++ b/libs/hapify/templates/casl/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-casl", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for casl class validators and types", "repository": { "type": "git", diff --git a/libs/hapify/templates/dbml/CHANGELOG.md b/libs/hapify/templates/dbml/CHANGELOG.md index 3999a1fe9..5c836a8bc 100644 --- a/libs/hapify/templates/dbml/CHANGELOG.md +++ b/libs/hapify/templates/dbml/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/dbml/package.json b/libs/hapify/templates/dbml/package.json index 1ccfc7ae6..77258098a 100644 --- a/libs/hapify/templates/dbml/package.json +++ b/libs/hapify/templates/dbml/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-dbml", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Generate DBML schema", "repository": { "type": "git", diff --git a/libs/hapify/templates/models/CHANGELOG.md b/libs/hapify/templates/models/CHANGELOG.md index 9fc12394a..56fcda84e 100644 --- a/libs/hapify/templates/models/CHANGELOG.md +++ b/libs/hapify/templates/models/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/models/package.json b/libs/hapify/templates/models/package.json index 6703a8d4e..d72868122 100644 --- a/libs/hapify/templates/models/package.json +++ b/libs/hapify/templates/models/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-models", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for models class validators and types", "repository": { "type": "git", diff --git a/libs/hapify/templates/nestjs-graphql/CHANGELOG.md b/libs/hapify/templates/nestjs-graphql/CHANGELOG.md index 20d0fe5eb..58ed12d07 100644 --- a/libs/hapify/templates/nestjs-graphql/CHANGELOG.md +++ b/libs/hapify/templates/nestjs-graphql/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/nestjs-graphql/package.json b/libs/hapify/templates/nestjs-graphql/package.json index 01962c2fa..fbb53d1b0 100644 --- a/libs/hapify/templates/nestjs-graphql/package.json +++ b/libs/hapify/templates/nestjs-graphql/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-nestjs-graphql", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for nestjs models", "repository": { "type": "git", diff --git a/libs/hapify/templates/nestjs-models-common/CHANGELOG.md b/libs/hapify/templates/nestjs-models-common/CHANGELOG.md index e4788eae7..c65f01ffd 100644 --- a/libs/hapify/templates/nestjs-models-common/CHANGELOG.md +++ b/libs/hapify/templates/nestjs-models-common/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/nestjs-models-common/package.json b/libs/hapify/templates/nestjs-models-common/package.json index 9ea5708b9..799b259c3 100644 --- a/libs/hapify/templates/nestjs-models-common/package.json +++ b/libs/hapify/templates/nestjs-models-common/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-nestjs-models-common", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for nestjs models common features", "repository": { "type": "git", diff --git a/libs/hapify/templates/nestjs-models-rest/CHANGELOG.md b/libs/hapify/templates/nestjs-models-rest/CHANGELOG.md index dfdcc97ed..c3aaa43bc 100644 --- a/libs/hapify/templates/nestjs-models-rest/CHANGELOG.md +++ b/libs/hapify/templates/nestjs-models-rest/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/nestjs-models-rest/package.json b/libs/hapify/templates/nestjs-models-rest/package.json index b9fe1c1c9..3f35b7462 100644 --- a/libs/hapify/templates/nestjs-models-rest/package.json +++ b/libs/hapify/templates/nestjs-models-rest/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-nestjs-models-rest", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/hapify/templates/nestjs-models/CHANGELOG.md b/libs/hapify/templates/nestjs-models/CHANGELOG.md index f0a9a6009..cc86a8a8b 100644 --- a/libs/hapify/templates/nestjs-models/CHANGELOG.md +++ b/libs/hapify/templates/nestjs-models/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/nestjs-models/package.json b/libs/hapify/templates/nestjs-models/package.json index 07af90829..7a8cb962a 100644 --- a/libs/hapify/templates/nestjs-models/package.json +++ b/libs/hapify/templates/nestjs-models/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-nestjs-models", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for nestjs models", "repository": { "type": "git", diff --git a/libs/hapify/templates/prisma/CHANGELOG.md b/libs/hapify/templates/prisma/CHANGELOG.md index 7c20bce48..9126d9750 100644 --- a/libs/hapify/templates/prisma/CHANGELOG.md +++ b/libs/hapify/templates/prisma/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/prisma/package.json b/libs/hapify/templates/prisma/package.json index 6c3a469e8..a97205f26 100644 --- a/libs/hapify/templates/prisma/package.json +++ b/libs/hapify/templates/prisma/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-prisma", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Generate prisma hapify config", "repository": { "type": "git", diff --git a/libs/hapify/templates/react-admin/CHANGELOG.md b/libs/hapify/templates/react-admin/CHANGELOG.md index 4c32325ae..a1da59a86 100644 --- a/libs/hapify/templates/react-admin/CHANGELOG.md +++ b/libs/hapify/templates/react-admin/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/react-admin/package.json b/libs/hapify/templates/react-admin/package.json index ad01a3e69..404eb3f9d 100644 --- a/libs/hapify/templates/react-admin/package.json +++ b/libs/hapify/templates/react-admin/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-react-admin", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Template to generate a react admin configuration", "repository": { "type": "git", diff --git a/libs/hapify/templates/rest-dtos/CHANGELOG.md b/libs/hapify/templates/rest-dtos/CHANGELOG.md index 1bc98e7d5..4af1dac24 100644 --- a/libs/hapify/templates/rest-dtos/CHANGELOG.md +++ b/libs/hapify/templates/rest-dtos/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/rest-dtos/package.json b/libs/hapify/templates/rest-dtos/package.json index 90109cbe8..67c31b78c 100644 --- a/libs/hapify/templates/rest-dtos/package.json +++ b/libs/hapify/templates/rest-dtos/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-rest-dtos", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Hapify templates for models rest dtos", "repository": { "type": "git", diff --git a/libs/hapify/templates/rext-client/CHANGELOG.md b/libs/hapify/templates/rext-client/CHANGELOG.md index 0ba13ac8d..b1b1dcc74 100644 --- a/libs/hapify/templates/rext-client/CHANGELOG.md +++ b/libs/hapify/templates/rext-client/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/templates/rext-client/package.json b/libs/hapify/templates/rext-client/package.json index 3c7c4d85e..a5b0e7018 100644 --- a/libs/hapify/templates/rext-client/package.json +++ b/libs/hapify/templates/rext-client/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-templates-rext-client", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Template to generate a rest client with hapify", "repository": { "type": "git", diff --git a/libs/hapify/update-templates-import-path/CHANGELOG.md b/libs/hapify/update-templates-import-path/CHANGELOG.md index ed991de8b..8d85505f5 100644 --- a/libs/hapify/update-templates-import-path/CHANGELOG.md +++ b/libs/hapify/update-templates-import-path/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/hapify/update-templates-import-path/package.json b/libs/hapify/update-templates-import-path/package.json index 219fa1af6..de77509c5 100644 --- a/libs/hapify/update-templates-import-path/package.json +++ b/libs/hapify/update-templates-import-path/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/hapify-update-templates-import-path", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Update relative path in code generated by hapify", "repository": { "type": "git", diff --git a/libs/nestjs/authentication/CHANGELOG.md b/libs/nestjs/authentication/CHANGELOG.md index da3608d12..49cfe0ea1 100644 --- a/libs/nestjs/authentication/CHANGELOG.md +++ b/libs/nestjs/authentication/CHANGELOG.md @@ -2,6 +2,40 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* resolve conversation and make the api start without settings env ([87d4465](https://github.com/tractr/traxion/commit/87d446509dd3c182c92a9d269dfbe24a826899ec)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/authentication/README.md b/libs/nestjs/authentication/README.md index 4be41a140..979495b63 100644 --- a/libs/nestjs/authentication/README.md +++ b/libs/nestjs/authentication/README.md @@ -1,42 +1,65 @@ -# nestjs-authentication +# Authentication Module + +The nestjs-authentication module is that will handle your authentication. It will +by give you access to some standard guard to use jwt and login based strategy +authentication. Under the hood this module use jwt and passport to authenticate +the connections. ## Installation -To install this librairy you have to install it first via npm, yarn or pnpm and -install the required peerdependency `@trxn/nestjs-database` +You can install the nestjs-authentication module using npm: ```bash -npm i --save @trxn/nestjs-authentication @trxn/nestjs-database` -``` +npm install --save @trxn/nestjs-authentication +```` -After that you need to register the module into your main application. -You'll need a UserService class provider register in your app (you can user the -USER_SERVICE token generate by `hapify-templates-nestjs-models-common`). +## Getting Started -> app.module.ts +In your workspace create you own AuthenticationModule that will configure the AuthenticationModule. ```typescript import { Module } from '@nestjs/common'; import { AuthenticationModule } from '@trxn/nestjs-authentication'; -import { DatabaseModule } from '@trxn/nestjs-database'; +import { UserModule } from './user.module'; @Module({ - imports: [DatabaseModule.register(), AuthenticationModule.register({ - userService: 'USER_SERVICE', + imports: [AuthenticationModule.register({ + imports: [UserModule] })], - controllers: [], - providers: [{ provide: 'USER_SERVICE', useClass: MyUserService }], }) export class AppModule {} ``` -You can override some options inside the register function. +The UserModule here is the UserModule provided by `@trxn/nestjs-user` and that expose +a UserService. You can use your own UserService class by providing it directly in the options: + +```typescript +import { Module } from '@nestjs/common'; + +import { AuthenticationModule } from '@trxn/nestjs-authentication'; +import { UserModule } from './user.module'; + +@Module({ + imports: [AuthenticationModule.register({ + UserService: MyUserServiceClass + })], +}) +export class AppModule {} +``` + +The UserService property respect the nestjs Provider type. ## Configuration -Futhermore you need to tell to nestjs to authenticate all your route. To do that -you need to register the global auth guard from nestjs-authentication: +After the first configuration your routes are not yet protected. Authentication Module +give access to you to some guard class that you can use across your project. One of +the best method to authenticate your application is to force the authentication to +all the routes of your application and whitelist only the route that you need to be +public. To do so AuthenticationModule give you access a guard and a decorator `@Public` +to mark the route as public. + +Here an example to authenticate all your routes: ```typescript import { @@ -45,7 +68,11 @@ import { } from '@trxn/nestjs-authentication'; @Module({ - imports: [DatabaseModule.register(), AuthenticationModule.register()], + imports: [ + AuthenticationModule.register( + //... provide a UserService class + ), + ], controllers: [], providers: [ { @@ -57,8 +84,39 @@ import { export class AppModule {} ``` -In the future more global auth guard will be added to the authentication -package. +## CustomUserSelect + +The AuthenticationModule is responsible to hydrate you user when a request hit your api. +Some time you don't want only the user but you want to join some data attached to it. +This module let you configured a object that will be used in junction with the `UserService`` +provided to select the information to use to fetch the user. + +```ts +@Module({ + imports: [ + AuthenticationModule.register( + //... the UserService configuration + + customSelect: { + id: true, + roles: true, + profile: { + name: true, + address: true, + // ... + } + } + ), + ], + controllers: [], + providers: [ + { + provide: APP_GUARD, + useClass: JwtGlobalAuthGuard, + }, + ], +}) +export cla ## Cookie authentication @@ -66,7 +124,7 @@ You need if you want to use the authentication from cookie to add the cookie parser package to your app module. You can look at the [nestjs documentation](https://docs.nestjs.com/techniques/cookies#cookies). **You must provide one or more secret to the cookie-parser package**, -`nestjs-authentication use only signedCookie in production mode. +`nestjs-authentication` use only signedCookie in production mode. ```typescript import * as cookieParser from 'cookie-parser'; @@ -74,11 +132,33 @@ import * as cookieParser from 'cookie-parser'; app.use(cookieParser('myScret')); ``` -## Bcrypt online generator +## Encryption + +By default AuthenticationModule use Bcrypt to parse and read the password. +If you need to use something else you can provide to the AuthenticationModule your own +`EncryptionService` that need to implement a `compare` and a `hash` method. + +```ts +@Module({ + imports: [ + AuthenticationModule.register( + //... provide a UserService class + EncryptionService: EncryptionService + ), + ], + controllers: [], + providers: [ + { + provide: APP_GUARD, + useClass: JwtGlobalAuthGuard, + }, + ], +}) +export class AppModule {} +``` -To be able to test you can use these [bcrypt online generator](https://www.browserling.com/tools/bcrypt) to crypt your password. +You can look at the BcryptModule to found some example. -## Running unit tests +## Bcrypt online generator -Run `nx test nestjs-authentication` to execute the unit tests via -[Jest](https://jestjs.io). +To be able to test you can use these [bcrypt online generator](https://www.browserling.com/tools/bcrypt) to crypt your passwords. diff --git a/libs/nestjs/authentication/package.json b/libs/nestjs/authentication/package.json index 621706557..fa7da00a7 100644 --- a/libs/nestjs/authentication/package.json +++ b/libs/nestjs/authentication/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-authentication", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/authentication/src/authentication.module-definition.ts b/libs/nestjs/authentication/src/authentication.module-definition.ts index 661fd66fe..e65964871 100644 --- a/libs/nestjs/authentication/src/authentication.module-definition.ts +++ b/libs/nestjs/authentication/src/authentication.module-definition.ts @@ -1,10 +1,49 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; +import { ENCRYPTION_SERVICE } from './constants'; import { AuthenticationModuleOptions } from './interfaces'; +import { EncryptionService } from '@trxn/nestjs-bcrypt'; +import { + addImportsAndProvidersExtra, + addProviderWithInjectionTokenExtra, + ImportsExtra, + ProvidersExtra, + ProviderWithInjectionToken, +} from '@trxn/nestjs-core'; +import { USER_SERVICE, UserService } from '@trxn/nestjs-user'; + export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, ASYNC_OPTIONS_TYPE, OPTIONS_TYPE, -} = new ConfigurableModuleBuilder().build(); +} = new ConfigurableModuleBuilder() + .setExtras< + ImportsExtra & + ProvidersExtra & { + UserService?: ProviderWithInjectionToken< + typeof USER_SERVICE, + UserService + >; + EncryptionService?: ProviderWithInjectionToken< + typeof ENCRYPTION_SERVICE, + EncryptionService + >; + } + >( + { imports: [], providers: [] }, + addImportsAndProvidersExtra( + (definition, { UserService: User, EncryptionService: Encryption }) => + addProviderWithInjectionTokenExtra( + addProviderWithInjectionTokenExtra( + definition, + ENCRYPTION_SERVICE, + Encryption, + ), + USER_SERVICE, + User, + ), + ), + ) + .build(); diff --git a/libs/nestjs/authentication/src/authentication.module.spec.ts b/libs/nestjs/authentication/src/authentication.module.spec.ts index 22c8b2f68..af39e86a4 100644 --- a/libs/nestjs/authentication/src/authentication.module.spec.ts +++ b/libs/nestjs/authentication/src/authentication.module.spec.ts @@ -1,27 +1,28 @@ -import { INestApplication } from '@nestjs/common'; +import { INestApplication, Type } from '@nestjs/common'; import { APP_GUARD } from '@nestjs/core'; import { Test, TestingModule } from '@nestjs/testing'; -import { Prisma } from '@prisma/client'; import { mockDeep, MockProxy } from 'jest-mock-extended'; import * as jwt from 'jsonwebtoken'; import * as request from 'supertest'; -import { AuthenticationEndpointMockController } from '../mocks'; import { AuthenticationModule } from './authentication.module'; import { JwtGlobalAuthGuard } from './guards'; import { AuthenticationService } from './services'; import { JwtStrategy, LocalStrategy } from './strategies'; +import { AuthenticationEndpointMockController } from '../mocks'; + +import { UserService } from '@trxn/nestjs-user'; describe('Authentication Module', () => { let app: INestApplication; - let mockUserService: MockProxy>; + let mockUserService: MockProxy>; it('should load the module when using register', async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep>(); const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [ AuthenticationModule.register({ - userService: mockUserService, + providers: [{ provide: UserService, useValue: mockUserService }], jwtModuleOptions: { secret: 'integration-tests', }, @@ -42,14 +43,16 @@ describe('Authentication Module', () => { }); it('should load the module when using registerAsync', async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep>(); const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [ - AuthenticationModule.register({ - userService: mockUserService, - jwtModuleOptions: { - secret: 'integration-tests', - }, + AuthenticationModule.registerAsync({ + providers: [{ provide: UserService, useValue: mockUserService }], + useFactory: () => ({ + jwtModuleOptions: { + secret: 'integration-tests', + }, + }), }), ], providers: [], @@ -68,13 +71,13 @@ describe('Authentication Module', () => { describe('Authentication module when using jwt global guard', () => { beforeEach(async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep>(); const moduleFixture: TestingModule = await Test.createTestingModule({ controllers: [AuthenticationEndpointMockController], imports: [ AuthenticationModule.register({ - userService: mockUserService, + providers: [{ provide: UserService, useValue: mockUserService }], jwtModuleOptions: { secret: 'integration-tests', }, @@ -119,12 +122,12 @@ describe('Authentication Module', () => { describe('Authentication Module without global guards', () => { beforeEach(async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep>(); const moduleFixture: TestingModule = await Test.createTestingModule({ controllers: [AuthenticationEndpointMockController], imports: [ AuthenticationModule.register({ - userService: mockUserService, + providers: [{ provide: UserService, useValue: mockUserService }], jwtModuleOptions: { secret: 'integration-tests', }, diff --git a/libs/nestjs/authentication/src/authentication.module.ts b/libs/nestjs/authentication/src/authentication.module.ts index 8c2c8ce45..ead2988cb 100644 --- a/libs/nestjs/authentication/src/authentication.module.ts +++ b/libs/nestjs/authentication/src/authentication.module.ts @@ -17,7 +17,6 @@ import { CookieOptionsService, HashService, StrategyOptionsService, - UserAuthenticationService, } from './services'; import { JwtOptionsService } from './services/jwt-options.service'; import { JwtStrategy, LocalStrategy } from './strategies'; @@ -28,7 +27,7 @@ import { LoggerModule } from '@trxn/nestjs-core'; @Module({}) export class AuthenticationModule extends ConfigurableModuleClass { private static createModule(module: DynamicModule): DynamicModule { - // When https://github.com/nestjs/jwt/pull/1065 is merged, this can be simplified to: + // FIXME: When https://github.com/nestjs/jwt/pull/1065 is merged, this can be simplified to: // Should remove this moduleOptions variables const moduleOptions = { ...module, @@ -44,6 +43,10 @@ export class AuthenticationModule extends ConfigurableModuleClass { BcryptModule.register({}), LoggerModule, JwtModule.registerAsync({ + // FIXME: When https://github.com/nestjs/jwt/pull/1065 is merged, this can be simplified to: + // useFactory: (passwordModuleOptions: PasswordModuleOptions) => + // passwordModuleOptions?.jwtModuleOptions || {}, + // provideInjectionTokensFrom: module.providers, imports: [moduleOptions], useFactory: (jwtOptionsService: JwtOptionsService) => jwtOptionsService.jwtModuleOptions, @@ -74,7 +77,6 @@ export class AuthenticationModule extends ConfigurableModuleClass { LocalStrategy, JwtStrategy, HashService, - UserAuthenticationService, { provide: APP_FILTER, useClass: UnauthorizedExceptionFilter, diff --git a/libs/nestjs/authentication/src/constants/authentication.constants.ts b/libs/nestjs/authentication/src/constants/authentication.constants.ts index 08e58fe0e..56b31f677 100644 --- a/libs/nestjs/authentication/src/constants/authentication.constants.ts +++ b/libs/nestjs/authentication/src/constants/authentication.constants.ts @@ -1,11 +1,11 @@ -export const AUTHENTICATION_DEFAULT_COOKIE_NAME = 'authCookie'; +export const DEFAULT_COOKIE_NAME = 'authCookie'; /** * Default cookie TTL (24h) */ -export const AUTHENTICATION_DEFAULT_COOKIE_TTL = 1000 * 60 * 60 * 24; -export const AUTHENTICATION_DEFAULT_AUTH_TOKEN = 'authToken'; -export const AUTHENTICATION_DEFAULT_QUERY_PARAM_NAME = 'authToken'; +export const DEFAULT_COOKIE_TTL = 1000 * 60 * 60 * 24; +export const DEFAULT_AUTH_TOKEN = 'authToken'; +export const DEFAULT_URL_QUERY_PARAM_NAME = 'authToken'; export const DEFAULT_ID_FIELD = 'id'; export const DEFAULT_LOGIN_FIELD = 'email'; diff --git a/libs/nestjs/authentication/src/constants/encryption.constants.ts b/libs/nestjs/authentication/src/constants/encryption.constants.ts new file mode 100644 index 000000000..41fc48c11 --- /dev/null +++ b/libs/nestjs/authentication/src/constants/encryption.constants.ts @@ -0,0 +1 @@ +export const ENCRYPTION_SERVICE = 'ENCRYPTION_SERVICE' as const; diff --git a/libs/nestjs/authentication/src/constants/index.ts b/libs/nestjs/authentication/src/constants/index.ts index 552a1b73a..cca2bec57 100644 --- a/libs/nestjs/authentication/src/constants/index.ts +++ b/libs/nestjs/authentication/src/constants/index.ts @@ -1 +1,3 @@ export * from './authentication.constants'; +export * from './encryption.constants'; +export * from './local-strategy.constants'; diff --git a/libs/nestjs/authentication/src/constants/local-strategy.constants.ts b/libs/nestjs/authentication/src/constants/local-strategy.constants.ts new file mode 100644 index 000000000..c095293c7 --- /dev/null +++ b/libs/nestjs/authentication/src/constants/local-strategy.constants.ts @@ -0,0 +1,3 @@ +export const DEFAULT_LOCAL_USERNAME_FIELD = 'email'; +export const DEFAULT_LOCAL_PASSWORD_FIELD = 'password'; +export const DEFAULT_LOCAL_PASS_REQ_TO_CALLBACK = true; diff --git a/libs/nestjs/authentication/src/controllers/login.controller.spec.ts b/libs/nestjs/authentication/src/controllers/login.controller.spec.ts index 4e1438dbb..e1ab0490c 100644 --- a/libs/nestjs/authentication/src/controllers/login.controller.spec.ts +++ b/libs/nestjs/authentication/src/controllers/login.controller.spec.ts @@ -5,26 +5,27 @@ import { mockDeep, MockProxy } from 'jest-mock-extended'; import * as jwt from 'jsonwebtoken'; import * as request from 'supertest'; +import { LoginController } from './login.controller'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; import { AuthenticationService, CookieOptionsService, StrategyOptionsService, - UserAuthenticationService, } from '../services'; import { JwtOptionsService } from '../services/jwt-options.service'; import { JwtStrategy, LocalStrategy } from '../strategies'; -import { LoginController } from './login.controller'; + +import { UserService } from '@trxn/nestjs-user'; describe('Login Controller', () => { let app: INestApplication; - let mockUserAuthenticationService: MockProxy; + let mockUserService: MockProxy; let mockAuthenticationService: MockProxy; let mockUser: User; beforeAll(async () => { mockAuthenticationService = mockDeep(); - mockUserAuthenticationService = mockDeep(); + mockUserService = mockDeep(); mockUser = { id: '1', @@ -36,8 +37,8 @@ describe('Login Controller', () => { controllers: [LoginController], providers: [ { - provide: UserAuthenticationService, - useValue: mockUserAuthenticationService, + provide: UserService, + useValue: mockUserService, }, { provide: AuthenticationService, @@ -99,7 +100,7 @@ describe('Login Controller', () => { describe('GET /me', () => { it('/me get the user information back and use the jwt auth strategy', async () => { const jwtToken = jwt.sign({ sub: '1' }, 'login-controller-secret'); - mockUserAuthenticationService.getUserFromId.mockResolvedValue(mockUser); + mockUserService.findUserById.mockResolvedValue(mockUser); const response = await request(app.getHttpServer()) .get('/me') @@ -108,9 +109,7 @@ describe('Login Controller', () => { expect(response.body).toEqual(mockUser); // eslint-disable-next-line @typescript-eslint/unbound-method - expect(mockUserAuthenticationService.getUserFromId).toHaveBeenCalledWith( - '1', - ); + expect(mockUserService.findUserById).toHaveBeenCalledTimes(2); }); }); diff --git a/libs/nestjs/authentication/src/controllers/login.controller.ts b/libs/nestjs/authentication/src/controllers/login.controller.ts index bb3d417ba..4e4b508d9 100644 --- a/libs/nestjs/authentication/src/controllers/login.controller.ts +++ b/libs/nestjs/authentication/src/controllers/login.controller.ts @@ -9,34 +9,30 @@ import { UseGuards, } from '@nestjs/common'; import { ApiBody } from '@nestjs/swagger'; -import { User } from '@prisma/client'; import { Request, Response } from 'express'; import { AccessTokenDto } from '../dtos'; import { LoginPostBodyDto } from '../dtos/login-form.dto'; import { JwtAuthGuard, LocalAuthGuard, PublicGuard } from '../guards'; -import { - AuthenticationService, - CookieOptionsService, - UserAuthenticationService, -} from '../services'; +import { AuthenticationService, CookieOptionsService } from '../services'; import { CurrentUser } from '@trxn/nestjs-core'; +import { MinimalUser, User, UserService } from '@trxn/nestjs-user'; @Controller() export class LoginController { constructor( private readonly cookieOptionsService: CookieOptionsService, - private readonly userAuthenticationService: UserAuthenticationService, private readonly authenticationService: AuthenticationService, + private readonly userService: UserService, ) {} @UseGuards(LocalAuthGuard) @Post('login') @ApiBody({ type: LoginPostBodyDto }) @HttpCode(200) - async login( - @Req() req: Request & { secret?: string; user: User }, + async login( + @Req() req: Request & { secret?: string; user: U }, @Res({ passthrough: true }) res: Response, ): Promise { const token = await this.authenticationService.login(req.user); @@ -62,18 +58,17 @@ export class LoginController { @Get('me') @UseGuards(JwtAuthGuard) - async me( - @Req() req: Request & { user: User }, - @CurrentUser() currentUserInfo: User, - ): Promise { - const user = await this.userAuthenticationService.getUserFromId( - currentUserInfo.id, + async me( + @CurrentUser() currentUser: U, + ): Promise { + const user = await this.userService.findUserById( + this.userService.getIdFromUser(currentUser), ); if (!user) { throw new BadRequestException(); } - return user as User; + return user; } } diff --git a/libs/nestjs/authentication/src/interfaces/authentication-module-options.interface.ts b/libs/nestjs/authentication/src/interfaces/authentication-module-options.interface.ts index 5d775a9a6..e455ce80b 100644 --- a/libs/nestjs/authentication/src/interfaces/authentication-module-options.interface.ts +++ b/libs/nestjs/authentication/src/interfaces/authentication-module-options.interface.ts @@ -1,11 +1,10 @@ import { JwtModuleOptions } from '@nestjs/jwt'; import { IAuthModuleOptions as PassportModuleOptions } from '@nestjs/passport'; -import { Prisma, User } from '@prisma/client'; import { CookieOptions } from 'express'; import { StrategyOptions as JwtStrategyOptions } from 'passport-jwt'; import { IStrategyOptionsWithRequest as LocalStrategyOptions } from 'passport-local'; -import { EncryptionService } from '@trxn/nestjs-bcrypt'; +import { MinimalUser, User } from '@trxn/nestjs-user'; export type UserInfo = { id: string | number; @@ -17,35 +16,16 @@ export type UserInfo = { * The public interface of the AuthenticationOptions. */ export interface AuthenticationModuleOptions { - /** - * Options to configure the user that will be manipulated by the authentication module. - */ - user?: { - fields?: { - id?: string; - email?: string; - password?: string; - login?: string; - }; - - customSelect?: Prisma.UserSelect; - }; - - /** - * Options to configure the user service. - */ - userService: Prisma.UserDelegate; - - /** - * Options to hash the password to be stored in the database. - */ - encryptionService?: EncryptionService; + customSelect?: Record; /** * Options to configure the information that will be stored inside the JWT * token. */ - getUserJWT?: (user: User) => Record; + transformJwtPayload?: ( + payload: Record, + user: U, + ) => Record; /** * Options to configure the jwt module (these options are used directly by the jwt module). diff --git a/libs/nestjs/authentication/src/services/authentication.service.spec.ts b/libs/nestjs/authentication/src/services/authentication.service.spec.ts index 8a4aa8e0e..802dc17a3 100644 --- a/libs/nestjs/authentication/src/services/authentication.service.spec.ts +++ b/libs/nestjs/authentication/src/services/authentication.service.spec.ts @@ -5,23 +5,24 @@ import { Test, TestingModule } from '@nestjs/testing'; import { User } from '@prisma/client'; import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; -import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; -import { AuthenticationModuleOptions } from '../interfaces'; import { AuthenticationService } from './authentication.service'; import { HashService } from './hash.service'; -import { UserAuthenticationService } from './user-authentication.service'; +import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; +import { AuthenticationModuleOptions } from '../interfaces'; + +import { UserService } from '@trxn/nestjs-user'; describe('AuthService', () => { let authService: AuthenticationService; let mockJwtService: MockProxy; - let mockUserAuthenticationService: MockProxy; + let mockUserService: MockProxy; let mockAuthenticationModuleOptions: MockProxy; let mockHashService: MockProxy; beforeEach(async () => { mockJwtService = mockDeep(); - mockUserAuthenticationService = mockDeep(); + mockUserService = mockDeep(); mockHashService = mockDeep(); mockAuthenticationModuleOptions = mockDeep() as MockProxy; @@ -34,8 +35,8 @@ describe('AuthService', () => { useValue: mockAuthenticationModuleOptions, }, { - provide: UserAuthenticationService, - useValue: mockUserAuthenticationService, + provide: UserService, + useValue: mockUserService, }, { provide: JwtService, useValue: mockJwtService }, { provide: HashService, useValue: mockHashService }, @@ -47,7 +48,7 @@ describe('AuthService', () => { afterEach(() => { mockReset(mockJwtService); - mockReset(mockUserAuthenticationService); + mockReset(mockUserService); mockReset(mockHashService); }); @@ -62,12 +63,8 @@ describe('AuthService', () => { email: 'login', password: 'password', } as User; - mockUserAuthenticationService.getUserFromLogin.mockResolvedValueOnce( - user, - ); - mockUserAuthenticationService.getPasswordFromUser.mockResolvedValueOnce( - 'hash', - ); + mockUserService.findUserByLogin.mockResolvedValueOnce(user); + mockUserService.getUserPassword.mockResolvedValueOnce('hash'); mockHashService.compare.mockResolvedValueOnce(true); @@ -82,39 +79,31 @@ describe('AuthService', () => { email: 'login', password: 'password', } as User; - mockUserAuthenticationService.getUserFromLogin.mockResolvedValueOnce( - user, - ); - mockUserAuthenticationService.getPasswordFromUser.mockResolvedValueOnce( - 'hash', - ); + mockUserService.findUserByLogin.mockResolvedValueOnce(user); + mockUserService.getUserPassword.mockResolvedValueOnce('hash'); mockHashService.compare.mockResolvedValueOnce(false); let result = await authService.validateUser('login', 'password'); expect(result).toBe(null); - mockUserAuthenticationService.getUserFromLogin.mockResolvedValueOnce( - user, - ); - mockUserAuthenticationService.getPasswordFromUser.mockResolvedValueOnce( - null, - ); + mockUserService.findUserByLogin.mockResolvedValueOnce(user); + mockUserService.getPasswordFromUser.mockReturnValueOnce(null); result = await authService.validateUser('login', 'password'); expect(result).toBe(null); - mockUserAuthenticationService.getUserFromLogin.mockResolvedValueOnce( - null, - ); + mockUserService.findUserByLogin.mockResolvedValueOnce(null); result = await authService.validateUser('login', 'password'); expect(result).toBe(null); }); }); - describe('createUserJWT', () => { - it('should create a User JWT with the getUserJWT from the config', async () => { - const spyGetUserJWT = jest.fn().mockReturnValue({ id: 'test' }); - mockAuthenticationModuleOptions.getUserJWT = spyGetUserJWT; + describe('createAccessToken', () => { + it('should create a User JWT with the transformJwtPayload from the config', async () => { + const transformJwtPayload = jest + .fn() + .mockImplementation((payload) => ({ ...payload, id: 'test' })); + mockAuthenticationModuleOptions.transformJwtPayload = transformJwtPayload; const user = { id: '1', @@ -122,7 +111,7 @@ describe('AuthService', () => { password: 'password', } as User; mockJwtService.sign.mockReturnValue('jwt'); - const compare = await authService.createUserJWT(user); + const compare = await authService.createAccessToken(user); expect(mockJwtService.sign).toHaveBeenCalledTimes(1); expect(mockJwtService.sign).toHaveBeenCalledWith({ @@ -130,21 +119,21 @@ describe('AuthService', () => { id: 'test', }); - expect(spyGetUserJWT).toHaveBeenCalledTimes(1); - expect(spyGetUserJWT).toHaveBeenCalledWith(user); + expect(transformJwtPayload).toHaveBeenCalledTimes(1); + expect(transformJwtPayload).toHaveBeenCalledWith({ sub: '1' }, user); expect(compare).toEqual('jwt'); }); it('should create a User JWT', async () => { - mockAuthenticationModuleOptions.getUserJWT = undefined; + mockAuthenticationModuleOptions.transformJwtPayload = undefined; const user = { id: '1', email: 'login', password: 'password', } as User; mockJwtService.sign.mockReturnValue('jwt'); - const compare = await authService.createUserJWT(user); + const compare = await authService.createAccessToken(user); expect(mockJwtService.sign).toHaveBeenCalledTimes(1); expect(mockJwtService.sign).toHaveBeenCalledWith({ sub: user.id }); @@ -160,11 +149,11 @@ describe('AuthService', () => { email: 'login', password: 'password', } as User; - const { createUserJWT } = authService; + const { createAccessToken } = authService; const mockCreateUserJWT = jest.fn().mockReturnValue('jwt'); - authService.createUserJWT = mockCreateUserJWT; + authService.createAccessToken = mockCreateUserJWT; const loggedIn = await authService.login(user); - authService.createUserJWT = createUserJWT; + authService.createAccessToken = createAccessToken; expect(mockCreateUserJWT).toHaveBeenCalledTimes(1); expect(mockCreateUserJWT).toHaveBeenCalledWith(user); diff --git a/libs/nestjs/authentication/src/services/authentication.service.ts b/libs/nestjs/authentication/src/services/authentication.service.ts index 3e96a6cca..d8a70e420 100644 --- a/libs/nestjs/authentication/src/services/authentication.service.ts +++ b/libs/nestjs/authentication/src/services/authentication.service.ts @@ -1,29 +1,34 @@ import { Inject, Injectable } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; -import { User } from '@prisma/client'; +import { HashService } from './hash.service'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; import { AccessTokenDto } from '../dtos'; import { AuthenticationModuleOptions } from '../interfaces'; -import { HashService } from './hash.service'; -import { UserAuthenticationService } from './user-authentication.service'; + +import { MinimalUser, User, UserService } from '@trxn/nestjs-user'; @Injectable() export class AuthenticationService { constructor( @Inject(MODULE_OPTIONS_TOKEN) private readonly authenticationOptions: AuthenticationModuleOptions, - private readonly userAuthenticationService: UserAuthenticationService, + private readonly userService: UserService, private readonly jwtService: JwtService, private readonly hashService: HashService, ) {} - async validateUser(login: string, password: string): Promise { - const user = await this.userAuthenticationService.getUserFromLogin(login); + async validateUser( + login: string, + password: string, + ): Promise { + const user = await this.userService.findUserByLogin(login); if (!user) return null; - const passwordHash = - await this.userAuthenticationService.getPasswordFromUser(user); + const passwordHash = await this.userService.getUserPassword( + this.userService.getIdFromUser(user), + ); + if (!passwordHash) return null; const isValid = await this.hashService.compare(password, passwordHash); @@ -32,18 +37,17 @@ export class AuthenticationService { return user; } - async createUserJWT(user: User): Promise { - return this.jwtService.sign({ - sub: user.id, - ...(this.authenticationOptions.getUserJWT - ? this.authenticationOptions.getUserJWT(user) - : {}), - }); + async createAccessToken( + user: U, + ): Promise { + const { transformJwtPayload = (payload) => payload } = + this.authenticationOptions; + return this.jwtService.sign(transformJwtPayload({ sub: user.id }, user)); } - async login(user: User): Promise { + async login(user: U): Promise { return { - accessToken: await this.createUserJWT(user), + accessToken: await this.createAccessToken(user), }; } } diff --git a/libs/nestjs/authentication/src/services/cookie-options.service.ts b/libs/nestjs/authentication/src/services/cookie-options.service.ts index 46d90a9fd..a51ea6e00 100644 --- a/libs/nestjs/authentication/src/services/cookie-options.service.ts +++ b/libs/nestjs/authentication/src/services/cookie-options.service.ts @@ -2,8 +2,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; import { - AUTHENTICATION_DEFAULT_COOKIE_NAME, - AUTHENTICATION_DEFAULT_QUERY_PARAM_NAME, + DEFAULT_COOKIE_NAME, + DEFAULT_URL_QUERY_PARAM_NAME, } from '../constants'; import { AuthenticationModuleOptions } from '../interfaces'; @@ -18,15 +18,14 @@ export class CookieOptionsService { get cookieName() { return ( - this.authenticationOptions.cookies?.cookieName || - AUTHENTICATION_DEFAULT_COOKIE_NAME + this.authenticationOptions.cookies?.cookieName || DEFAULT_COOKIE_NAME ); } get queryParamName() { return ( - this.authenticationOptions.cookies?.cookieName || - AUTHENTICATION_DEFAULT_QUERY_PARAM_NAME + this.authenticationOptions.cookies?.queryParamName || + DEFAULT_URL_QUERY_PARAM_NAME ); } diff --git a/libs/nestjs/authentication/src/services/hash.service.spec.ts b/libs/nestjs/authentication/src/services/hash.service.spec.ts index c428fb507..58407c1b5 100644 --- a/libs/nestjs/authentication/src/services/hash.service.spec.ts +++ b/libs/nestjs/authentication/src/services/hash.service.spec.ts @@ -2,9 +2,10 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; +import { HashService } from './hash.service'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; +import { ENCRYPTION_SERVICE } from '../constants'; import { AuthenticationModuleOptions } from '../interfaces'; -import { HashService } from './hash.service'; import { BcryptService } from '@trxn/nestjs-bcrypt'; @@ -12,12 +13,14 @@ describe('HashService', () => { let hashService: HashService; let mockAuthenticationModuleOptions: MockProxy; let mockBcryptService: MockProxy; + let mockEncryptionService: MockProxy; beforeEach(async () => { mockAuthenticationModuleOptions = mockDeep( {}, ) as MockProxy; mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); const module: TestingModule = await Test.createTestingModule({ providers: [ @@ -27,6 +30,10 @@ describe('HashService', () => { useValue: mockAuthenticationModuleOptions, }, { provide: BcryptService, useValue: mockBcryptService }, + { + provide: ENCRYPTION_SERVICE, + useValue: mockEncryptionService, + }, ], }).compile(); @@ -38,38 +45,75 @@ describe('HashService', () => { mockReset(mockBcryptService); }); - it('should be defined', () => { - expect(hashService).toBeDefined(); - }); + describe('use internal bcrypt provider', () => { + beforeEach(async () => { + mockAuthenticationModuleOptions = mockDeep( + {}, + ) as MockProxy; + mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); - describe('compare', () => { - it('should use the default BcryptService if no config is provided', async () => { - mockAuthenticationModuleOptions.encryptionService = undefined; - await hashService.compare('test', 'hash'); - expect(mockBcryptService.compare).toHaveBeenCalledWith('test', 'hash'); - }); - it('should use the EncryptionService if a config has been used', async () => { - const encryptionService = mockDeep(); - mockAuthenticationModuleOptions.encryptionService = encryptionService; + const module: TestingModule = await Test.createTestingModule({ + providers: [ + HashService, + { + provide: MODULE_OPTIONS_TOKEN, + useValue: mockAuthenticationModuleOptions, + }, + { provide: BcryptService, useValue: mockBcryptService }, + ], + }).compile(); + hashService = module.get(HashService); + }); + it('should use the default BcryptService.compare', async () => { await hashService.compare('test', 'hash'); - expect(mockBcryptService.compare).toHaveBeenCalledTimes(0); - expect(encryptionService.compare).toHaveBeenCalledWith('test', 'hash'); + expect(mockBcryptService.compare).toHaveBeenCalledWith('test', 'hash'); + expect(mockEncryptionService.compare).not.toHaveBeenCalled(); }); - }); - describe('hash', () => { - it('should use the default BcryptService if no config is provided', async () => { - mockAuthenticationModuleOptions.encryptionService = undefined; + it('should use the default BcryptService.hash', async () => { await hashService.hash('test'); expect(mockBcryptService.hash).toHaveBeenCalledWith('test'); + expect(mockEncryptionService.hash).not.toHaveBeenCalled(); }); - it('should use the EncryptionService if a config has been used', async () => { - const encryptionService = mockDeep(); - mockAuthenticationModuleOptions.encryptionService = encryptionService; + }); + describe('use external encryption provider', () => { + beforeEach(async () => { + mockAuthenticationModuleOptions = mockDeep( + {}, + ) as MockProxy; + mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); + const module: TestingModule = await Test.createTestingModule({ + providers: [ + HashService, + { + provide: MODULE_OPTIONS_TOKEN, + useValue: mockAuthenticationModuleOptions, + }, + { provide: BcryptService, useValue: mockBcryptService }, + { + provide: ENCRYPTION_SERVICE, + useValue: mockEncryptionService, + }, + ], + }).compile(); + + hashService = module.get(HashService); + }); + it('should use the EncryptionService.compare', async () => { + await hashService.compare('test', 'hash'); + expect(mockBcryptService.compare).not.toHaveBeenCalled(); + expect(mockEncryptionService.compare).toHaveBeenCalledWith( + 'test', + 'hash', + ); + }); + it('should use the EncryptionService.hash', async () => { await hashService.hash('test'); - expect(mockBcryptService.hash).toHaveBeenCalledTimes(0); - expect(encryptionService.hash).toHaveBeenCalledWith('test'); + expect(mockBcryptService.hash).not.toHaveBeenCalled(); + expect(mockEncryptionService.hash).toHaveBeenCalledWith('test'); }); }); }); diff --git a/libs/nestjs/authentication/src/services/hash.service.ts b/libs/nestjs/authentication/src/services/hash.service.ts index fa26b1bb1..b32a0dd65 100644 --- a/libs/nestjs/authentication/src/services/hash.service.ts +++ b/libs/nestjs/authentication/src/services/hash.service.ts @@ -1,22 +1,19 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Inject, Injectable, Optional } from '@nestjs/common'; -import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; -import { AuthenticationModuleOptions } from '../interfaces'; +import { ENCRYPTION_SERVICE } from '../constants'; import { BcryptService, EncryptionService } from '@trxn/nestjs-bcrypt'; @Injectable() export class HashService implements EncryptionService { constructor( - @Inject(MODULE_OPTIONS_TOKEN) - private readonly authenticationModuleOptions: AuthenticationModuleOptions, private readonly bcryptService: BcryptService, - ) {} - get encryptionService(): EncryptionService { - return ( - this.authenticationModuleOptions.encryptionService || this.bcryptService - ); + @Optional() + @Inject(ENCRYPTION_SERVICE) + private readonly encryptionService: EncryptionService, + ) { + this.encryptionService = this.encryptionService || this.bcryptService; } async hash(value: string): Promise { diff --git a/libs/nestjs/authentication/src/services/index.ts b/libs/nestjs/authentication/src/services/index.ts index 3d693780f..8e55874e7 100644 --- a/libs/nestjs/authentication/src/services/index.ts +++ b/libs/nestjs/authentication/src/services/index.ts @@ -2,4 +2,3 @@ export * from './authentication.service'; export * from './cookie-options.service'; export * from './hash.service'; export * from './strategy-options.service'; -export * from './user-authentication.service'; diff --git a/libs/nestjs/authentication/src/services/strategy-options.service.ts b/libs/nestjs/authentication/src/services/strategy-options.service.ts index 62b5fab67..5c1a783c2 100644 --- a/libs/nestjs/authentication/src/services/strategy-options.service.ts +++ b/libs/nestjs/authentication/src/services/strategy-options.service.ts @@ -7,14 +7,17 @@ import { } from 'passport-jwt'; import { IStrategyOptionsWithRequest as LocalStrategyOptions } from 'passport-local'; +import { JwtOptionsService } from './jwt-options.service'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; import { - AUTHENTICATION_DEFAULT_COOKIE_NAME, - AUTHENTICATION_DEFAULT_QUERY_PARAM_NAME, + DEFAULT_COOKIE_NAME, + DEFAULT_LOCAL_PASS_REQ_TO_CALLBACK, + DEFAULT_LOCAL_PASSWORD_FIELD, + DEFAULT_LOCAL_USERNAME_FIELD, + DEFAULT_URL_QUERY_PARAM_NAME, } from '../constants'; import { fromHttpOnlySignedAndSecureCookies } from '../extractors'; import { AuthenticationModuleOptions } from '../interfaces'; -import { JwtOptionsService } from './jwt-options.service'; @Injectable() export class StrategyOptionsService { @@ -24,24 +27,12 @@ export class StrategyOptionsService { private readonly jwtOptionsService: JwtOptionsService, ) {} - private get fields() { - return { - id: 'id', - login: 'email', - password: 'password', - ...(this.authenticationOptions.user?.fields || {}), - }; - } - get localStrategyOptions(): LocalStrategyOptions { - const { login, password } = this.fields; - const strategyOptions = this.authenticationOptions.strategy?.local || {}; - return { - passReqToCallback: true, - ...strategyOptions, - usernameField: login, - passwordField: password, + passReqToCallback: DEFAULT_LOCAL_PASS_REQ_TO_CALLBACK, + usernameField: DEFAULT_LOCAL_USERNAME_FIELD, + passwordField: DEFAULT_LOCAL_PASSWORD_FIELD, + ...this.authenticationOptions.strategy?.local, }; } @@ -55,11 +46,9 @@ export class StrategyOptionsService { ), ignoreExpiration: false, jwtFromRequest: ExtractJwt.fromExtractors([ - fromHttpOnlySignedAndSecureCookies(AUTHENTICATION_DEFAULT_COOKIE_NAME), + fromHttpOnlySignedAndSecureCookies(DEFAULT_COOKIE_NAME), ExtractJwt.fromAuthHeaderAsBearerToken(), - ExtractJwt.fromUrlQueryParameter( - AUTHENTICATION_DEFAULT_QUERY_PARAM_NAME, - ), + ExtractJwt.fromUrlQueryParameter(DEFAULT_URL_QUERY_PARAM_NAME), ]), ...passportJwtStrategyOptions, }; diff --git a/libs/nestjs/authentication/src/services/user-authentication.service.ts b/libs/nestjs/authentication/src/services/user-authentication.service.ts deleted file mode 100644 index 1be66d648..000000000 --- a/libs/nestjs/authentication/src/services/user-authentication.service.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Inject, Injectable, Logger } from '@nestjs/common'; -import { Prisma, User } from '@prisma/client'; - -import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; -import { AuthenticationModuleOptions } from '../interfaces'; - -import { LoggerService } from '@trxn/nestjs-core'; - -@Injectable() -export class UserAuthenticationService { - constructor( - @Inject(MODULE_OPTIONS_TOKEN) - private readonly passwordConfig: AuthenticationModuleOptions, - @Inject(Logger) private readonly logger: LoggerService, - ) { - logger.setContext(UserAuthenticationService.name); - } - - private get userService() { - if (!this.passwordConfig.userService) - throw new Error('User service not configured'); - - return this.passwordConfig.userService; - } - - private get fields() { - return { - id: 'id', - login: 'email', - password: 'password', - ...(this.passwordConfig.user?.fields || {}), - }; - } - - async getUserFromLogin(login: string): Promise { - this.logger.debug(`Getting user from login ${login}`); - const user = await this.userService.findUnique({ - where: { - [this.fields.login]: login, - }, - }); - - return user; - } - - async getPasswordFromUser(user: User): Promise { - this.logger.debug(`Getting user from id ${user.id}`); - const password = (await this.userService.findUnique({ - where: { - [this.fields.id]: user.id, - }, - select: { - [this.fields.password]: true, - }, - })) as { - password: string | null; - } | null; - - return password ? password[this.fields.password as 'password'] : null; - } - - async getUserFromId( - id: string | number, - select?: T, - ) { - this.logger.debug(`Getting user from id ${id}`); - const user = await this.userService.findUnique<{ - where: Prisma.UserWhereUniqueInput; - select: T | undefined; - }>({ - where: { - [this.fields.id]: id, - }, - select, - }); - - return user; - } -} diff --git a/libs/nestjs/authentication/src/strategies/jwt.strategy.ts b/libs/nestjs/authentication/src/strategies/jwt.strategy.ts index 2ee1c87ba..ebcb01271 100644 --- a/libs/nestjs/authentication/src/strategies/jwt.strategy.ts +++ b/libs/nestjs/authentication/src/strategies/jwt.strategy.ts @@ -5,23 +5,27 @@ import { Strategy } from 'passport-jwt'; import { MODULE_OPTIONS_TOKEN } from '../authentication.module-definition'; import { JwtTokenPayload } from '../dtos'; import { AuthenticationModuleOptions } from '../interfaces'; -import { StrategyOptionsService, UserAuthenticationService } from '../services'; +import { StrategyOptionsService } from '../services'; + +import { UserService } from '@trxn/nestjs-user'; @Injectable() export class JwtStrategy extends PassportStrategy(Strategy) { constructor( - private readonly userAuthenticationService: UserAuthenticationService, @Inject(MODULE_OPTIONS_TOKEN) private readonly authenticationOptions: AuthenticationModuleOptions, + protected readonly strategyOptionsService: StrategyOptionsService, + + private readonly userService: UserService, ) { super(strategyOptionsService.jwtStrategyOptions); } async validate(payload: JwtTokenPayload) { - const user = await this.userAuthenticationService.getUserFromId( + const user = await this.userService.findUserById( payload.sub, - this.authenticationOptions.user?.customSelect, + this.authenticationOptions.customSelect, ); if (!user) { diff --git a/libs/nestjs/bcrypt/CHANGELOG.md b/libs/nestjs/bcrypt/CHANGELOG.md index 5e0d31f7f..524001b7e 100644 --- a/libs/nestjs/bcrypt/CHANGELOG.md +++ b/libs/nestjs/bcrypt/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([7db4aaf](https://github.com/tractr/traxion/commit/7db4aaf835f96c33f9d0be4e2bff503c925fc138)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/bcrypt/package.json b/libs/nestjs/bcrypt/package.json index ed8ce2889..6d6aefdca 100644 --- a/libs/nestjs/bcrypt/package.json +++ b/libs/nestjs/bcrypt/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-bcrypt", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/bcrypt/src/services/hash.service.spec.ts b/libs/nestjs/bcrypt/src/services/hash.service.spec.ts index cd8e5d82e..5ebdaeffd 100644 --- a/libs/nestjs/bcrypt/src/services/hash.service.spec.ts +++ b/libs/nestjs/bcrypt/src/services/hash.service.spec.ts @@ -3,9 +3,9 @@ import { Test, TestingModule } from '@nestjs/testing'; import * as bcrypt from 'bcrypt'; import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; +import { BcryptService } from './bcrypt.service'; import { MODULE_OPTIONS_TOKEN } from '../bcrypt.module-definition'; import { BcryptModuleOptions } from '../interfaces'; -import { BcryptService } from './bcrypt.service'; describe('BcryptService', () => { let bcryptService: BcryptService; diff --git a/libs/nestjs/casl/CHANGELOG.md b/libs/nestjs/casl/CHANGELOG.md index efc158595..2b94d3a23 100644 --- a/libs/nestjs/casl/CHANGELOG.md +++ b/libs/nestjs/casl/CHANGELOG.md @@ -2,6 +2,40 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* resolve conversation and make the api start without settings env ([87d4465](https://github.com/tractr/traxion/commit/87d446509dd3c182c92a9d269dfbe24a826899ec)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/casl/mocks/casl-exception-endpoint-mock.controller.ts b/libs/nestjs/casl/mocks/casl-exception-endpoint-mock.controller.ts index 1b4b53cc0..b0ec539e7 100644 --- a/libs/nestjs/casl/mocks/casl-exception-endpoint-mock.controller.ts +++ b/libs/nestjs/casl/mocks/casl-exception-endpoint-mock.controller.ts @@ -1,10 +1,10 @@ /* istanbul ignore file */ -import { Ability, ForbiddenError } from '@casl/ability'; +import { AbilityBuilder, ForbiddenError, PureAbility } from '@casl/ability'; +import { createPrismaAbility, PrismaQuery, Subjects } from '@casl/prisma'; import { Controller, Get } from '@nestjs/common'; import { Public } from '@trxn/nestjs-core'; - -type Abilities = ['read', 'User']; +import { User } from '@trxn/nestjs-user'; @Controller() export class CaslExceptionEndpointMockController { @@ -15,7 +15,17 @@ export class CaslExceptionEndpointMockController { @Public() @Get('/casl-forbidden-error') caslForbiddenError() { - const ability = new Ability(); + type AppAbility = PureAbility< + [ + string, + Subjects<{ + User: User; + }>, + ], + PrismaQuery + >; + const builder = new AbilityBuilder(createPrismaAbility); + const ability = builder.build(); ForbiddenError.from(ability).throwUnlessCan('read', 'User'); } diff --git a/libs/nestjs/casl/mocks/policy-handler-class.mock.ts b/libs/nestjs/casl/mocks/policy-handler-class.mock.ts index dc854109c..cdcc254f7 100644 --- a/libs/nestjs/casl/mocks/policy-handler-class.mock.ts +++ b/libs/nestjs/casl/mocks/policy-handler-class.mock.ts @@ -1,16 +1,14 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; -import { CaslOptions } from '../src'; -import { CASL_MODULE_OPTIONS } from '../src/casl.constant'; import { AppAbility } from './role-permission.mock'; +import { CaslAbilityFactoryService } from '../src'; import { PolicyHandler } from '@trxn/common'; @Injectable() export class PolicyHandlerClass implements PolicyHandler { constructor( - @Inject(CASL_MODULE_OPTIONS) - private readonly caslOptions: CaslOptions, + private readonly caslAbilityFactoryService: CaslAbilityFactoryService, ) {} handle() { diff --git a/libs/nestjs/casl/mocks/role-permission.mock.ts b/libs/nestjs/casl/mocks/role-permission.mock.ts index 1a9f217bb..3625329ed 100644 --- a/libs/nestjs/casl/mocks/role-permission.mock.ts +++ b/libs/nestjs/casl/mocks/role-permission.mock.ts @@ -1,8 +1,13 @@ /* istanbul ignore file */ -import { Subjects as CaslPrismaSubjects, PrismaAbility } from '@casl/prisma'; +import { AbilityBuilder, PureAbility } from '@casl/ability'; +import { Subjects as CaslPrismaSubjects, PrismaQuery } from '@casl/prisma'; import { Prisma, UserRoles } from '@prisma/client'; -import { DefinePermissions } from '../src'; +import { + DefinePermissions, + DefinePublicPermissions, + RolePermissions, +} from '../src/interfaces'; export type Roles = 'admin' | 'user' | 'guest'; @@ -27,14 +32,14 @@ export const Actions = { MANAGE: 'manage', } as const; -export type Actions = typeof Actions[keyof typeof Actions]; +export type Actions = (typeof Actions)[keyof typeof Actions]; -export type AppAbility = PrismaAbility<[Actions, 'all' | Subjects]>; -export const AppAbility = PrismaAbility; +export type AppAbility = PureAbility<[string, 'all' | Subjects], PrismaQuery>; -export const rolePermissions: Record< +export const rolePermissions: RolePermissions< UserRoles, - DefinePermissions + AbilityBuilder, + User > = { // eslint-disable-next-line @typescript-eslint/no-empty-function guest({ can }) { @@ -49,3 +54,9 @@ export const rolePermissions: Record< // eslint-disable-next-line @typescript-eslint/no-empty-function custom() {}, }; + +export const publicPermissions: DefinePublicPermissions< + AbilityBuilder +> = ({ can }) => { + can('read', 'Tag'); +}; diff --git a/libs/nestjs/casl/package.json b/libs/nestjs/casl/package.json index fe4fa25dc..8376271d7 100644 --- a/libs/nestjs/casl/package.json +++ b/libs/nestjs/casl/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-casl", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/casl/src/casl.constant.ts b/libs/nestjs/casl/src/casl.constant.ts deleted file mode 100644 index 092c7e403..000000000 --- a/libs/nestjs/casl/src/casl.constant.ts +++ /dev/null @@ -1 +0,0 @@ -export const CASL_MODULE_OPTIONS = 'CASL_MODULE_OPTIONS'; diff --git a/libs/nestjs/casl/src/casl.module-definition.ts b/libs/nestjs/casl/src/casl.module-definition.ts new file mode 100644 index 000000000..2102304b0 --- /dev/null +++ b/libs/nestjs/casl/src/casl.module-definition.ts @@ -0,0 +1,17 @@ +import { ConfigurableModuleBuilder } from '@nestjs/common'; + +import { UntypedCaslModuleOptions } from './interfaces'; + +export const { + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + ASYNC_OPTIONS_TYPE, + OPTIONS_TYPE, +} = new ConfigurableModuleBuilder().build(); + +export type ExtractExtraModuleDefinitionOptions = + T extends UntypedCaslModuleOptions & Partial ? U : never; + +export type ExtraModuleDefinitionOptions = ExtractExtraModuleDefinitionOptions< + typeof OPTIONS_TYPE +>; diff --git a/libs/nestjs/casl/src/casl.module.spec.ts b/libs/nestjs/casl/src/casl.module.spec.ts index 72bfb1c5c..653bdfb3f 100644 --- a/libs/nestjs/casl/src/casl.module.spec.ts +++ b/libs/nestjs/casl/src/casl.module.spec.ts @@ -4,15 +4,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy } from 'jest-mock-extended'; import * as request from 'supertest'; -import { CaslEndPointMock } from '../mocks/casl-endpoint-mock.controller'; -import { mockAuthenticationGuard } from '../mocks/mock-authentication-guard'; -import { rolePermissions } from '../mocks/role-permission.mock'; -import { CASL_MODULE_OPTIONS } from './casl.constant'; import { CaslModule } from './casl.module'; +import { MODULE_OPTIONS_TOKEN } from './casl.module-definition'; import { PoliciesGuard } from './guards'; -import { CaslOptions } from './interfaces'; +import { UntypedCaslModuleOptions } from './interfaces'; +import { CaslEndPointMock } from '../mocks/casl-endpoint-mock.controller'; +import { mockAuthenticationGuard } from '../mocks/mock-authentication-guard'; +import { + publicPermissions, + rolePermissions, +} from '../mocks/role-permission.mock'; -import { UserAuthenticationService } from '@trxn/nestjs-authentication'; import { LoggerModule } from '@trxn/nestjs-core'; describe('Authentication Module', () => { @@ -21,7 +23,6 @@ describe('Authentication Module', () => { getUser: () => Record | null; isPublic: () => boolean; }>; - const mockAuthenticationUserService = mockDeep(); beforeAll(async () => { mockUser = mockDeep<{ @@ -42,15 +43,13 @@ describe('Authentication Module', () => { provide: APP_GUARD, useClass: PoliciesGuard, }, - { - provide: UserAuthenticationService, - useValue: mockAuthenticationUserService, - }, ], imports: [ LoggerModule, CaslModule.register({ rolePermissions, + getRoles: (user) => user.roles, + publicPermissions, }), ], }).compile(); @@ -86,7 +85,8 @@ describe('Authentication Module', () => { roles: ['guest'], }); await request(app.getHttpServer()).get('/read-user').expect(403); - + }); + it('/read-user no-user', async () => { mockUser.getUser.mockReturnValue(null); mockUser.isPublic.mockReturnValueOnce(true); @@ -112,7 +112,8 @@ describe('Authentication Module', () => { roles: ['guest'], }); await request(app.getHttpServer()).get('/read-admin').expect(403); - + }); + it('/read-admin no-user', async () => { mockUser.getUser.mockReturnValue(null); mockUser.isPublic.mockReturnValueOnce(true); @@ -138,7 +139,8 @@ describe('Authentication Module', () => { roles: ['guest'], }); await request(app.getHttpServer()).get('/read-guest').expect(200); - + }); + it('/read-guest no-user', async () => { mockUser.getUser.mockReturnValue(null); mockUser.isPublic.mockReturnValueOnce(true); @@ -199,23 +201,21 @@ describe('Authentication Module', () => { provide: APP_GUARD, useClass: PoliciesGuard, }, - { - provide: UserAuthenticationService, - useValue: mockAuthenticationUserService, - }, ], imports: [ LoggerModule, CaslModule.registerAsync({ useFactory: () => ({ rolePermissions, + getRoles: (user) => user.roles, + publicPermissions, }), }), ], }).compile(); const caslModuleOptions = - moduleFixture.get(CASL_MODULE_OPTIONS); + moduleFixture.get(MODULE_OPTIONS_TOKEN); expect(caslModuleOptions.rolePermissions).toEqual(rolePermissions); }); diff --git a/libs/nestjs/casl/src/casl.module.ts b/libs/nestjs/casl/src/casl.module.ts index aad1d8ab7..3157f6c1b 100644 --- a/libs/nestjs/casl/src/casl.module.ts +++ b/libs/nestjs/casl/src/casl.module.ts @@ -1,12 +1,20 @@ -import { AnyAbility } from '@casl/ability'; -import { DynamicModule, Module } from '@nestjs/common'; +import { AbilityBuilder, AnyAbility } from '@casl/ability'; +import { + ConfigurableModuleAsyncOptions, + DynamicModule, + Module, +} from '@nestjs/common'; -import { CASL_MODULE_OPTIONS } from './casl.constant'; -import { CaslOptions } from './interfaces'; +import { + ASYNC_OPTIONS_TYPE, + ConfigurableModuleClass, + ExtraModuleDefinitionOptions, + OPTIONS_TYPE, +} from './casl.module-definition'; +import { CaslModuleOptions } from './interfaces'; import { CaslAbilityFactoryService } from './services/casl.service'; import { AuthenticationModule } from '@trxn/nestjs-authentication'; -import { AsyncOptions, ModuleOptionsFactory } from '@trxn/nestjs-core'; @Module({ imports: [AuthenticationModule], @@ -14,18 +22,26 @@ import { AsyncOptions, ModuleOptionsFactory } from '@trxn/nestjs-core'; providers: [CaslAbilityFactoryService], exports: [CaslAbilityFactoryService], }) -export class CaslModule extends ModuleOptionsFactory( - CASL_MODULE_OPTIONS, -) { - static register( - options: CaslOptions, +export class CaslModule extends ConfigurableModuleClass { + static register< + R extends string, + U extends Record, + B extends AbilityBuilder, + >( + options: CaslModuleOptions & ExtraModuleDefinitionOptions, ): DynamicModule { - return super.register(options as CaslOptions); + return super.register(options as unknown as typeof OPTIONS_TYPE); } - static registerAsync( - options: AsyncOptions>, + static registerAsync< + R extends string, + U extends Record, + B extends AbilityBuilder, + >( + options: ConfigurableModuleAsyncOptions< + CaslModuleOptions & ExtraModuleDefinitionOptions + >, ): DynamicModule { - return super.registerAsync(options as AsyncOptions); + return super.registerAsync(options as typeof ASYNC_OPTIONS_TYPE); } } diff --git a/libs/nestjs/casl/src/configs/casl.config.ts b/libs/nestjs/casl/src/configs/casl.config.ts deleted file mode 100644 index aefbd22f4..000000000 --- a/libs/nestjs/casl/src/configs/casl.config.ts +++ /dev/null @@ -1 +0,0 @@ -export const CASL_OPTIONS = {}; diff --git a/libs/nestjs/casl/src/configs/index.ts b/libs/nestjs/casl/src/configs/index.ts deleted file mode 100644 index 698ae49f9..000000000 --- a/libs/nestjs/casl/src/configs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './casl.config'; diff --git a/libs/nestjs/casl/src/guards/policies-guard.ts b/libs/nestjs/casl/src/guards/policies-guard.ts index 3e9c7f94a..73862cfcd 100644 --- a/libs/nestjs/casl/src/guards/policies-guard.ts +++ b/libs/nestjs/casl/src/guards/policies-guard.ts @@ -5,12 +5,12 @@ import { Injectable, } from '@nestjs/common'; import { ModuleRef, Reflector } from '@nestjs/core'; -import type { User } from '@prisma/client'; import { CaslAbilityFactoryService } from '../services'; import { isClass, PolicyHandlerType } from '@trxn/common'; import { getRequestFromContext, POLICIES_KEY } from '@trxn/nestjs-core'; +import { MinimalUser, User } from '@trxn/nestjs-user'; @Injectable() export class PoliciesGuard implements CanActivate { @@ -20,7 +20,9 @@ export class PoliciesGuard implements CanActivate { private caslAbilityFactory: CaslAbilityFactoryService, ) {} - async canActivate(context: ExecutionContext): Promise { + async canActivate( + context: ExecutionContext, + ): Promise { const policyHandlers = this.reflector.get[]>( POLICIES_KEY, @@ -37,10 +39,14 @@ export class PoliciesGuard implements CanActivate { // Get user from the request object. // User should have been fetched and hydrated by the authentication layer - const { user }: { user?: User } = req; - - if (user && (!user.roles || !Array.isArray(user.roles))) { - throw new ForbiddenException(); + const { user }: { user?: U } = req; + + if (user) { + try { + this.caslAbilityFactory.getRoles(user); + } catch { + throw new ForbiddenException(); + } } const ability = this.caslAbilityFactory.createForUser(user); diff --git a/libs/nestjs/casl/src/index.ts b/libs/nestjs/casl/src/index.ts index 329e85f94..fad654c1d 100644 --- a/libs/nestjs/casl/src/index.ts +++ b/libs/nestjs/casl/src/index.ts @@ -1,4 +1,3 @@ -export * from './configs'; export * from './guards'; export * from './interceptors'; export * from './interfaces'; diff --git a/libs/nestjs/casl/src/interceptors/casl-exception.interceptor.spec.ts b/libs/nestjs/casl/src/interceptors/casl-exception.interceptor.spec.ts index 05cbcc03f..5c1f8a3f7 100644 --- a/libs/nestjs/casl/src/interceptors/casl-exception.interceptor.spec.ts +++ b/libs/nestjs/casl/src/interceptors/casl-exception.interceptor.spec.ts @@ -3,8 +3,8 @@ import { APP_INTERCEPTOR } from '@nestjs/core'; import { Test, TestingModule } from '@nestjs/testing'; import * as request from 'supertest'; -import { CaslExceptionEndpointMockController } from '../../mocks/casl-exception-endpoint-mock.controller'; import { CaslExceptionInterceptor } from './casl-exception.interceptor'; +import { CaslExceptionEndpointMockController } from '../../mocks/casl-exception-endpoint-mock.controller'; describe('Casl exception error', () => { let app: INestApplication; diff --git a/libs/nestjs/casl/src/interfaces/casl.interface.ts b/libs/nestjs/casl/src/interfaces/casl.interface.ts index ab5661efc..9dcf29662 100644 --- a/libs/nestjs/casl/src/interfaces/casl.interface.ts +++ b/libs/nestjs/casl/src/interfaces/casl.interface.ts @@ -1,16 +1,33 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { AbilityBuilder, AnyAbility } from '@casl/ability'; -import { PrismaAbility as CaslPrismaAbilities } from '@casl/prisma'; -import { Prisma, User, UserRoles } from '@prisma/client'; -export interface CaslOptions { - rolePermissions: Record>; -} - -export type PrismaAbility = CaslPrismaAbilities< - [string, 'all' | Prisma.ModelName] ->; +export type DefinePermissions, U> = ( + ability: B, + user: U, +) => void; -export type DefinePermissions = ( - ability: AbilityBuilder, - user?: User, +export type DefinePublicPermissions> = ( + ability: B, ) => void; + +export type RolePermissions< + R extends string, + B extends AbilityBuilder, + U extends Record, +> = Record>; + +export type CaslModuleOptions< + R extends string, + U extends Record, + B extends AbilityBuilder, +> = { + rolePermissions: Record>; + getRoles: (user: U) => R[]; + publicPermissions?: DefinePublicPermissions; +}; + +export type UntypedCaslModuleOptions = CaslModuleOptions< + string, + Record, + AbilityBuilder +>; diff --git a/libs/nestjs/casl/src/services/casl.service.spec.ts b/libs/nestjs/casl/src/services/casl.service.spec.ts index 26cf26df9..204ccdf9b 100644 --- a/libs/nestjs/casl/src/services/casl.service.spec.ts +++ b/libs/nestjs/casl/src/services/casl.service.spec.ts @@ -1,26 +1,46 @@ -import { PrismaAbility } from '@casl/prisma'; +import { AbilityBuilder, AnyAbility } from '@casl/ability'; import { UnauthorizedException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import type { User } from '@prisma/client'; import { mockDeep, MockProxy } from 'jest-mock-extended'; -import { AppAbility, rolePermissions } from '../../mocks/role-permission.mock'; -import { CASL_MODULE_OPTIONS } from '../casl.constant'; -import { CaslOptions } from '../interfaces'; import { CaslAbilityFactoryService } from './casl.service'; +import { + publicPermissions, + rolePermissions, +} from '../../mocks/role-permission.mock'; +import { MODULE_OPTIONS_TOKEN } from '../casl.module-definition'; +import { + DefinePublicPermissions, + RolePermissions, + UntypedCaslModuleOptions, +} from '../interfaces'; describe('CaslService', () => { let caslAbilityFactoryService: CaslAbilityFactoryService; - let mockCaslOptions: MockProxy>; + let mockCaslOptions: MockProxy; beforeEach(async () => { - mockCaslOptions = mockDeep>(); + mockCaslOptions = mockDeep( + { + funcPropSupport: true, + }, + { + rolePermissions: mockDeep( + rolePermissions, + ) as unknown as RolePermissions< + string, + AbilityBuilder, + Record + >, + getRoles: (user) => user.roles as string[], + }, + ); const moduleFixture: TestingModule = await Test.createTestingModule({ providers: [ CaslAbilityFactoryService, { - provide: CASL_MODULE_OPTIONS, + provide: MODULE_OPTIONS_TOKEN, useValue: mockCaslOptions, }, ], @@ -37,56 +57,52 @@ describe('CaslService', () => { describe('createForUser', () => { it('should create a abitily from a rolePermission configuration', async () => { - mockCaslOptions.rolePermissions = mockDeep(rolePermissions); - const userAdmin = { id: 'admin', roles: ['admin'], - } as User; + }; const abilities = caslAbilityFactoryService.createForUser(userAdmin); expect(abilities).toBeDefined(); - expect(abilities).toBeInstanceOf(PrismaAbility); }); - it('should throw an error if no user is passed and no guest permissions is defined', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { guest, ...permissionsWithoutGuest } = rolePermissions; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - mockCaslOptions.rolePermissions = permissionsWithoutGuest as any; - - expect(() => caslAbilityFactoryService.createForUser(undefined)).toThrow( + it('should throw an error if no user is passed and no publicPermissions are defined', async () => { + mockCaslOptions.publicPermissions = undefined; + expect(() => caslAbilityFactoryService.createForUser()).toThrow( UnauthorizedException, ); }); + it('should not throw an error if no user is passed and but a publicPermissions is used', async () => { + mockCaslOptions.publicPermissions = + publicPermissions as unknown as DefinePublicPermissions< + AbilityBuilder + >; + + const abilities = caslAbilityFactoryService.createForUser(); + expect(abilities).toBeDefined(); + }); + it('should configure no access if a role does not exists', async () => { - mockCaslOptions.rolePermissions = mockDeep(rolePermissions); + mockCaslOptions.rolePermissions = mockDeep( + rolePermissions, + ) as unknown as RolePermissions< + string, + AbilityBuilder, + Record + >; const userWithAWrongRole = { id: 'admin', roles: ['not-exists'], - } as unknown as User; + }; const abilities = caslAbilityFactoryService.createForUser(userWithAWrongRole); expect(abilities).toBeDefined(); - expect(abilities).toBeInstanceOf(PrismaAbility); expect(abilities.cannot('manage', 'all')).toEqual(true); }); - - it('should default to the guest role if no user is provided', async () => { - mockCaslOptions.rolePermissions = mockDeep(rolePermissions); - - const abilities = caslAbilityFactoryService.createForUser(); - - expect(abilities).toBeDefined(); - expect(abilities).toBeInstanceOf(PrismaAbility); - expect(abilities.can('read', 'Tag')).toEqual(true); - expect(abilities.cannot('read', 'User')).toEqual(true); - }); }); }); diff --git a/libs/nestjs/casl/src/services/casl.service.ts b/libs/nestjs/casl/src/services/casl.service.ts index 6f1e7eeb4..a1e6ba2ad 100644 --- a/libs/nestjs/casl/src/services/casl.service.ts +++ b/libs/nestjs/casl/src/services/casl.service.ts @@ -1,27 +1,34 @@ -import { AbilityBuilder, Subject } from '@casl/ability'; -import { PrismaAbility } from '@casl/prisma'; +import { AbilityBuilder } from '@casl/ability'; +import { createPrismaAbility } from '@casl/prisma'; import { Inject, Injectable, UnauthorizedException } from '@nestjs/common'; -import type { Prisma, User } from '@prisma/client'; -import { CASL_MODULE_OPTIONS } from '../casl.constant'; -import { CaslOptions } from '../interfaces'; +import { MODULE_OPTIONS_TOKEN } from '../casl.module-definition'; +import { UntypedCaslModuleOptions } from '../interfaces'; + +import { User } from '@trxn/nestjs-user'; @Injectable() export class CaslAbilityFactoryService { constructor( - @Inject(CASL_MODULE_OPTIONS) - private readonly caslOptions: CaslOptions, + @Inject(MODULE_OPTIONS_TOKEN) + private readonly caslOptions: UntypedCaslModuleOptions, ) {} - createForUser(user?: User): PrismaAbility<[string, 'all' | Subject]> { - const builder = new AbilityBuilder< - PrismaAbility<[string, 'all' | Prisma.ModelName]> - >(PrismaAbility); + getRoles(user: Record) { + const roles = this.caslOptions.getRoles(user); + if (!Array.isArray(roles)) { + throw new Error('getRoles must return an array of roles'); + } + return roles; + } + + createForUser(user?: U) { + const builder = new AbilityBuilder(createPrismaAbility); - const { rolePermissions } = this.caslOptions; + const { rolePermissions, publicPermissions } = this.caslOptions; - if (!user && rolePermissions.guest) { - rolePermissions.guest(builder, user); + if (!user && publicPermissions) { + publicPermissions(builder); return builder.build(); } @@ -29,14 +36,18 @@ export class CaslAbilityFactoryService { throw new UnauthorizedException(); } - user.roles.forEach((role) => { - if (!rolePermissions[role]) return; - rolePermissions[role](builder, user); - }); + const roles = this.getRoles(user); + + let hasSomeRole = false; + for (const role of roles) { + if (rolePermissions[role]) { + hasSomeRole = true; + rolePermissions[role](builder, user); + } + } - if ( - user.roles.some((role) => typeof rolePermissions[role] === 'undefined') - ) { + // If the user has no role, they cannot do anything. + if (!hasSomeRole) { builder.cannot('manage', 'all'); } diff --git a/libs/nestjs/core/CHANGELOG.md b/libs/nestjs/core/CHANGELOG.md index 2f63d0e52..e24374fda 100644 --- a/libs/nestjs/core/CHANGELOG.md +++ b/libs/nestjs/core/CHANGELOG.md @@ -2,6 +2,40 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/core/mocks/prisma-exception-endpoint-mock.controller.ts b/libs/nestjs/core/mocks/prisma-exception-endpoint-mock.controller.ts index 33cea6c32..b11aba97e 100644 --- a/libs/nestjs/core/mocks/prisma-exception-endpoint-mock.controller.ts +++ b/libs/nestjs/core/mocks/prisma-exception-endpoint-mock.controller.ts @@ -1,15 +1,12 @@ import { Controller, Get } from '@nestjs/common'; import { Prisma } from '@prisma/client'; -import { Public } from '../src/decorators/public.decorator'; - @Controller() export class PrismaExceptionEndpointMockController { private readonly ERROR_MESSAGE = 'This is an example error message'; private readonly ERROR_CLIENT_VERSION = '1.0.0'; - @Public() @Get('/known-request-error-not-found') knownRequestErrorNotFound(): Prisma.PrismaClientKnownRequestError { throw new Prisma.PrismaClientKnownRequestError(this.ERROR_MESSAGE, { @@ -18,7 +15,6 @@ export class PrismaExceptionEndpointMockController { }); } - @Public() @Get('/known-request-error-conflict') knownRequestErrorConflict(): Prisma.PrismaClientKnownRequestError { throw new Prisma.PrismaClientKnownRequestError(this.ERROR_MESSAGE, { @@ -27,7 +23,6 @@ export class PrismaExceptionEndpointMockController { }); } - @Public() @Get('/initialization-error-not-found') initializationErrorNotFound(): Prisma.PrismaClientInitializationError { throw new Prisma.PrismaClientInitializationError( @@ -37,13 +32,11 @@ export class PrismaExceptionEndpointMockController { ); } - @Public() @Get('/client-validation-error') clientValidationError(): Prisma.PrismaClientValidationError { throw new Prisma.PrismaClientValidationError(this.ERROR_MESSAGE); } - @Public() @Get('/initialization-error-conflict') initializationErrorConflict(): Prisma.PrismaClientInitializationError { throw new Prisma.PrismaClientInitializationError( @@ -53,7 +46,6 @@ export class PrismaExceptionEndpointMockController { ); } - @Public() @Get('/unknown-request-error') unknownRequestError(): Prisma.PrismaClientUnknownRequestError { throw new Prisma.PrismaClientUnknownRequestError(this.ERROR_MESSAGE, { @@ -61,7 +53,6 @@ export class PrismaExceptionEndpointMockController { }); } - @Public() @Get('/client-rust-panic-error') clientRustPanicError(): Prisma.PrismaClientRustPanicError { throw new Prisma.PrismaClientRustPanicError( @@ -70,7 +61,6 @@ export class PrismaExceptionEndpointMockController { ); } - @Public() @Get('/default-error') defaultError(): Error { throw new Error(this.ERROR_MESSAGE); diff --git a/libs/nestjs/core/package.json b/libs/nestjs/core/package.json index 944c19294..b58dda98d 100644 --- a/libs/nestjs/core/package.json +++ b/libs/nestjs/core/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-core", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Core module for nestjs backend", "repository": { "type": "git", diff --git a/libs/nestjs/core/src/helpers/index.ts b/libs/nestjs/core/src/helpers/index.ts index 90bc560ff..37eeada9e 100644 --- a/libs/nestjs/core/src/helpers/index.ts +++ b/libs/nestjs/core/src/helpers/index.ts @@ -2,6 +2,7 @@ export * from './context.helper'; export * from './format-entity-ids'; export * from './format-filter-type'; export * from './format-sort'; +export * from './set-extras.helper'; export * from './is-development.helper'; export * from './is-production.helper'; export * from './module-options.helper'; diff --git a/libs/nestjs/core/src/helpers/module-options.helper.ts b/libs/nestjs/core/src/helpers/module-options.helper.ts index 5e0d95d51..1531d06f4 100644 --- a/libs/nestjs/core/src/helpers/module-options.helper.ts +++ b/libs/nestjs/core/src/helpers/module-options.helper.ts @@ -68,6 +68,8 @@ export type AsyncOptions< /** * The ModuleOptionsHelper that need to be extends to get access * to the register registerAsync forRoot and forRootAsync + * + * @deprecated Use the ConfigurableModuleBuilder from nestjs instead */ export function ModuleOptionsFactory< InternalOptions, diff --git a/libs/nestjs/core/src/helpers/set-extras.helper.ts b/libs/nestjs/core/src/helpers/set-extras.helper.ts new file mode 100644 index 000000000..b14065d78 --- /dev/null +++ b/libs/nestjs/core/src/helpers/set-extras.helper.ts @@ -0,0 +1,94 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { + DynamicModule, + ForwardReference, + InjectionToken, + Provider, + Type, +} from '@nestjs/common'; + +import type { ProviderWithInjectionToken } from '../interfaces'; + +export type ImportsExtra = { + imports: Array< + Type | DynamicModule | Promise | ForwardReference + >; +}; + +export type ProvidersExtra = { + providers?: Provider[] | undefined; +}; + +export function addImportsExtra( + transformDefinition: ( + definition: DynamicModule, + extras: Omit, + ) => DynamicModule, +) { + return (definition: DynamicModule, { imports, ...extras }: E) => + transformDefinition( + { + ...definition, + imports: [...(definition.imports || []), ...(imports || [])], + }, + extras, + ); +} + +export function addProvidersExtra( + transformDefinition: ( + definition: DynamicModule, + extras: Omit, + ) => DynamicModule, +) { + return (definition: DynamicModule, { providers, ...extras }: E) => + transformDefinition( + { + ...definition, + providers: [...(definition.providers || []), ...(providers || [])], + }, + extras, + ); +} + +export function addImportsAndProvidersExtra< + E extends ImportsExtra & ProvidersExtra, +>( + transformDefinition: ( + definition: DynamicModule, + extras: Omit, + ) => DynamicModule, +) { + return (definition: DynamicModule, { imports, providers, ...extras }: E) => + transformDefinition( + { + ...definition, + imports: [...(definition.imports || []), ...(imports || [])], + providers: [...(definition.providers || []), ...(providers || [])], + }, + extras, + ); +} + +export function addProviderWithInjectionTokenExtra( + definition: DynamicModule, + token: I, + providerWithToken?: ProviderWithInjectionToken, +) { + if (!providerWithToken) { + return definition; + } + + let provider: Provider = providerWithToken; + if (!('provide' in provider)) { + provider = { + provide: token, + useClass: provider, + }; + } + + return { + ...definition, + providers: [...(definition.providers || []), provider], + }; +} diff --git a/libs/nestjs/core/src/index.ts b/libs/nestjs/core/src/index.ts index 8ed8145bc..eaf882c50 100644 --- a/libs/nestjs/core/src/index.ts +++ b/libs/nestjs/core/src/index.ts @@ -1,6 +1,7 @@ export * from './decorators'; export * from './helpers'; export * from './interceptors'; +export * from './interfaces'; export * from './pipes'; export * from './services'; export * from './logger.module'; diff --git a/libs/nestjs/core/src/interceptors/prisma-exception.interceptor.spec.ts b/libs/nestjs/core/src/interceptors/prisma-exception.interceptor.spec.ts index 64e77f512..4273b9f8d 100644 --- a/libs/nestjs/core/src/interceptors/prisma-exception.interceptor.spec.ts +++ b/libs/nestjs/core/src/interceptors/prisma-exception.interceptor.spec.ts @@ -3,13 +3,13 @@ import { APP_INTERCEPTOR } from '@nestjs/core'; import { Test, TestingModule } from '@nestjs/testing'; import * as request from 'supertest'; -import { PrismaExceptionEndpointMockController } from '../../mocks/prisma-exception-endpoint-mock.controller'; import { PrismaExceptionInterceptor } from './prisma-exception.interceptor'; +import { PrismaExceptionEndpointMockController } from '../../mocks/prisma-exception-endpoint-mock.controller'; describe('Prisma exception error', () => { let app: INestApplication; - beforeEach(async () => { + beforeAll(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ controllers: [PrismaExceptionEndpointMockController], providers: [ @@ -25,7 +25,7 @@ describe('Prisma exception error', () => { await app.init(); }); - afterEach(async () => { + afterAll(async () => { if (app) await app.close(); }); diff --git a/libs/nestjs/core/src/interfaces/index.ts b/libs/nestjs/core/src/interfaces/index.ts new file mode 100644 index 000000000..7a0ef4849 --- /dev/null +++ b/libs/nestjs/core/src/interfaces/index.ts @@ -0,0 +1 @@ +export * from './set-extras-providers.interfaces'; diff --git a/libs/nestjs/core/src/interfaces/set-extras-providers.interfaces.ts b/libs/nestjs/core/src/interfaces/set-extras-providers.interfaces.ts new file mode 100644 index 000000000..22fea8094 --- /dev/null +++ b/libs/nestjs/core/src/interfaces/set-extras-providers.interfaces.ts @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { + ClassProvider, + ExistingProvider, + FactoryProvider, + InjectionToken, + Type, + ValueProvider, +} from '@nestjs/common'; + +export type ClassProviderWithInjectionToken< + I = InjectionToken, + T = any, +> = ClassProvider & { provide: I }; +export type ValueProviderWithInjectionToken< + I = InjectionToken, + T = any, +> = ValueProvider & { provide: I }; +export type FactoryProviderWithInjectionToken< + I = InjectionToken, + T = any, +> = FactoryProvider & { provide: I }; +export type ExistingProviderWithInjectionToken< + I = InjectionToken, + T = any, +> = ExistingProvider & { provide: I }; + +export type ProviderWithInjectionToken = + | Type + | ClassProviderWithInjectionToken + | ValueProviderWithInjectionToken + | FactoryProviderWithInjectionToken + | ExistingProviderWithInjectionToken; diff --git a/libs/nestjs/core/src/services/logger.service.spec.ts b/libs/nestjs/core/src/services/logger.service.spec.ts index b0117cb21..685319a27 100644 --- a/libs/nestjs/core/src/services/logger.service.spec.ts +++ b/libs/nestjs/core/src/services/logger.service.spec.ts @@ -3,6 +3,10 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LoggerService } from './logger.service'; +const noop = () => { + // nothing +}; + describe('loggerService', () => { let loggerService: LoggerService; let verbose: jest.SpyInstance; @@ -12,11 +16,11 @@ describe('loggerService', () => { let error: jest.SpyInstance; beforeEach(async () => { - verbose = jest.spyOn(Logger.prototype, 'verbose'); - debug = jest.spyOn(Logger.prototype, 'debug'); - log = jest.spyOn(Logger.prototype, 'log'); - warn = jest.spyOn(Logger.prototype, 'warn'); - error = jest.spyOn(Logger.prototype, 'error'); + verbose = jest.spyOn(Logger.prototype, 'verbose').mockImplementation(noop); + debug = jest.spyOn(Logger.prototype, 'debug').mockImplementation(noop); + log = jest.spyOn(Logger.prototype, 'log').mockImplementation(noop); + warn = jest.spyOn(Logger.prototype, 'warn').mockImplementation(noop); + error = jest.spyOn(Logger.prototype, 'error').mockImplementation(noop); const module: TestingModule = await Test.createTestingModule({ providers: [LoggerService], diff --git a/libs/nestjs/database/CHANGELOG.md b/libs/nestjs/database/CHANGELOG.md index 7a8b85ce7..ac761f676 100644 --- a/libs/nestjs/database/CHANGELOG.md +++ b/libs/nestjs/database/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/database/package.json b/libs/nestjs/database/package.json index cc116623a..675d24d4b 100644 --- a/libs/nestjs/database/package.json +++ b/libs/nestjs/database/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-database", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Database module for nestjs backend", "repository": { "type": "git", diff --git a/libs/nestjs/database/src/services/database.service.ts b/libs/nestjs/database/src/services/database.service.ts index ebe4a5cec..7c6e83203 100644 --- a/libs/nestjs/database/src/services/database.service.ts +++ b/libs/nestjs/database/src/services/database.service.ts @@ -8,9 +8,9 @@ import { } from '@nestjs/common'; import { Prisma, PrismaClient } from '@prisma/client'; -import { PRISMA_MODULE_OPTIONS } from '../constants'; import { MysqlService } from './mysql.service'; import { PostgresqlService } from './postgresql.service'; +import { PRISMA_MODULE_OPTIONS } from '../constants'; export type PrismaClientOptions = Omit< Prisma.PrismaClientOptions, diff --git a/libs/nestjs/file-storage/CHANGELOG.md b/libs/nestjs/file-storage/CHANGELOG.md index a5a35b30c..1684efb3e 100644 --- a/libs/nestjs/file-storage/CHANGELOG.md +++ b/libs/nestjs/file-storage/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/file-storage/package.json b/libs/nestjs/file-storage/package.json index 1faf9b3fc..bb64b6169 100644 --- a/libs/nestjs/file-storage/package.json +++ b/libs/nestjs/file-storage/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-file-storage", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/file-storage/src/lib/controllers/file-storage.controller.spec.ts b/libs/nestjs/file-storage/src/lib/controllers/file-storage.controller.spec.ts index 5492d0b98..1fa6185f8 100644 --- a/libs/nestjs/file-storage/src/lib/controllers/file-storage.controller.spec.ts +++ b/libs/nestjs/file-storage/src/lib/controllers/file-storage.controller.spec.ts @@ -3,9 +3,9 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; +import { FileStorageController } from './file-storage.controller'; import { GetPresignedDownloadUrlQueryDto } from '../dtos'; import { FileStorageService } from '../services'; -import { FileStorageController } from './file-storage.controller'; describe('FileStorageController', () => { let mockFileStorageService: MockProxy; diff --git a/libs/nestjs/file-storage/src/lib/dtos/file-storage-configuration-private.dto.ts b/libs/nestjs/file-storage/src/lib/dtos/file-storage-configuration-private.dto.ts index 060591785..959a11593 100644 --- a/libs/nestjs/file-storage/src/lib/dtos/file-storage-configuration-private.dto.ts +++ b/libs/nestjs/file-storage/src/lib/dtos/file-storage-configuration-private.dto.ts @@ -9,9 +9,9 @@ import { } from 'class-validator'; import { ClientOptions as MinioClientOptions, Region } from 'minio'; -import { AwsRegions } from '../constants'; import { PresignedDownloadConfigurationDto } from './presigned-download-configuration.dto'; import { PresignedUploadConfigurationDto } from './presigned-upload-configuration'; +import { AwsRegions } from '../constants'; import { getDefaults } from '@trxn/common'; diff --git a/libs/nestjs/graphql/CHANGELOG.md b/libs/nestjs/graphql/CHANGELOG.md index add563699..846e7eca6 100644 --- a/libs/nestjs/graphql/CHANGELOG.md +++ b/libs/nestjs/graphql/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/graphql/package.json b/libs/nestjs/graphql/package.json index 4fec1fe15..0d546a728 100644 --- a/libs/nestjs/graphql/package.json +++ b/libs/nestjs/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-graphql", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Nestjs graphql helper", "repository": { "type": "git", diff --git a/libs/nestjs/mailer/CHANGELOG.md b/libs/nestjs/mailer/CHANGELOG.md index 98e7ce967..1da2438a7 100644 --- a/libs/nestjs/mailer/CHANGELOG.md +++ b/libs/nestjs/mailer/CHANGELOG.md @@ -2,6 +2,41 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) +* update mailer to use mailjet v6 ([7db4aaf](https://github.com/tractr/traxion/commit/7db4aaf835f96c33f9d0be4e2bff503c925fc138)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/mailer/README.md b/libs/nestjs/mailer/README.md index 3331ca0f7..f4929ea3f 100644 --- a/libs/nestjs/mailer/README.md +++ b/libs/nestjs/mailer/README.md @@ -1,8 +1,117 @@ -# nestjs-mailer +# MailerModule -This library was generated with [Nx](https://nx.dev). +This module provides a MailerService that can be used to send emails. -## Running unit tests +## Installation -Run `nx test nestjs-mailer` to execute the unit tests via -[Jest](https://jestjs.io). +```bash +npm i --save @trxn/nestjs-mailer @trxn/nestjs-mailjet +``` + +## Quick Start + +First configure the mailjet module, the documentation can be found [here](https://www.traxion.dev/docs/how-to/mailer/use-mailjet). + +Then, import the MailerModule in your root application module: + +```ts +import { Module } from '@nestjs/common'; +import { MailjetModule as Mailjet } from '@trxn/nestjs-mailjet'; +import { MailerModule } from '@trxn/nestjs-mailer'; + +@Module({ + imports: [ + Mailjet.register({ + apiKey: 'YOUR_MAILER_API_KEY', + }), + ], +}) +export class MailjetModule {} + +@Module({ + imports: [ + MailerModule.register({ + imports: [MailjetModule], + production: process.env.NODE_ENV === 'production', + }), + ], +}) +export class MailerModule {} + +@Module({ + imports: [ + MailerModule, + ], +}) +export class AppModule {} +``` + +In the example above and in order to use the mailerModule in an efficient way you must separate your declaration into multiple submodules. The MailjetModule expose internally a `MAILER_CLIENT` provider that is directly used inside the `MailerModule`. You can use the `MailjetModule` or another module of you choice to be able to send email with `MailerModule`. The other traxion module that use the emails providers will inject a `MailerService` that comme from the `MailerModule`. + +Then to use the MailerService to send an email, inject it into your service or controller: + +```ts +import { Controller, Get, Inject } from '@nestjs/common'; +import { MailerService } from '@trxn/nestjs-mailer'; + +@Controller() +export class AppController { + constructor( + @Inject(MailerService) private readonly mailerService: MailerService, + ) {} + + @Get() + async sendEmail(): Promise { + const email = { + from: 'YOUR_EMAIL_ADDRESS', + to: 'RECIPIENT_EMAIL_ADDRESS', + subject: 'Test email', + text: 'This is a test email', + }; + await this.mailerService.send(email); + } +} +``` + +In the example above, the MailerService is injected into the AppController and used to send an email with a from address, to address, subject, and text content. + +## MailerModule Options + +The register() and registerAsync() methods accept an options object of type MailerModuleOptions. + +| Property | Type | Description | +| --- | --- | --- | +| `production` | `boolean` | (optional) Default to `false`, tell the module to really send the email when set to true | + +## MailerService Methods + +The MailjetService provides a single method for sending email: + +### send + +```ts +send(params: SendEmailParams): Promise +```` + +Sends an email using the Mailjet API. + +| Property | Type | Description | +| --- | --- | --- | +| `params` | `SendEmailParams` | The email parameters. | + +The SendEmailParams interface has the following properties: + +```ts +interface SendEmailParams { + from: string; + to: string | string[]; + subject?: string; + html?: string; + text?: string; + context?: Record; +} +``` + +## Conclusion + +The nestjs-mailer module provides a simple and convenient way to allow you to shadow your email provider behind a contractual interface. The other module from traxion will use the `MailerModule` and his `MailerService` to send email when needed. diff --git a/libs/nestjs/mailer/package.json b/libs/nestjs/mailer/package.json index e2fa5a040..7bf0e42a4 100644 --- a/libs/nestjs/mailer/package.json +++ b/libs/nestjs/mailer/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-mailer", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/mailer/src/constants/index.ts b/libs/nestjs/mailer/src/constants/index.ts new file mode 100644 index 000000000..6b12a0dfd --- /dev/null +++ b/libs/nestjs/mailer/src/constants/index.ts @@ -0,0 +1 @@ +export * from './mailer.constants'; diff --git a/libs/nestjs/mailer/src/constants/mailer.constants.ts b/libs/nestjs/mailer/src/constants/mailer.constants.ts new file mode 100644 index 000000000..864ce45b9 --- /dev/null +++ b/libs/nestjs/mailer/src/constants/mailer.constants.ts @@ -0,0 +1 @@ +export const MAILER_CLIENT = 'MAILER_CLIENT' as const; diff --git a/libs/nestjs/mailer/src/index.ts b/libs/nestjs/mailer/src/index.ts index 9c55c09ed..b6fa6db4c 100644 --- a/libs/nestjs/mailer/src/index.ts +++ b/libs/nestjs/mailer/src/index.ts @@ -1,4 +1,4 @@ -export * from './lib/configs'; -export * from './lib/interfaces'; -export * from './lib/services'; -export * from './lib/mailer.module'; +export * from './constants'; +export * from './interfaces'; +export * from './services'; +export * from './mailer.module'; diff --git a/libs/nestjs/mailer/src/interfaces/index.ts b/libs/nestjs/mailer/src/interfaces/index.ts new file mode 100644 index 000000000..ef82ca40a --- /dev/null +++ b/libs/nestjs/mailer/src/interfaces/index.ts @@ -0,0 +1,2 @@ +export * from './mailer-client.interface'; +export * from './mailer-module-options.interface'; diff --git a/libs/nestjs/mailer/src/interfaces/mailer-client.interface.ts b/libs/nestjs/mailer/src/interfaces/mailer-client.interface.ts new file mode 100644 index 000000000..9c0a8b3f9 --- /dev/null +++ b/libs/nestjs/mailer/src/interfaces/mailer-client.interface.ts @@ -0,0 +1,12 @@ +export interface SendEmailParams { + from: string; + to: string | string[]; + subject?: string; + context?: Record; + text?: string; + html?: string; +} + +export interface MailerClient { + send(params: SendEmailParams): Promise; +} diff --git a/libs/nestjs/mailer/src/interfaces/mailer-module-options.interface.ts b/libs/nestjs/mailer/src/interfaces/mailer-module-options.interface.ts new file mode 100644 index 000000000..9c231e701 --- /dev/null +++ b/libs/nestjs/mailer/src/interfaces/mailer-module-options.interface.ts @@ -0,0 +1,3 @@ +export interface MailerModuleOptions { + production?: boolean; +} diff --git a/libs/nestjs/mailer/src/lib/cli/index.ts b/libs/nestjs/mailer/src/lib/cli/index.ts deleted file mode 100644 index 96eae1a78..000000000 --- a/libs/nestjs/mailer/src/lib/cli/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './mailer.cli'; diff --git a/libs/nestjs/mailer/src/lib/cli/mailer.cli.ts b/libs/nestjs/mailer/src/lib/cli/mailer.cli.ts deleted file mode 100644 index e43cd6dfb..000000000 --- a/libs/nestjs/mailer/src/lib/cli/mailer.cli.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Command, Console } from 'nestjs-console'; -import * as mailjet from 'node-mailjet'; - -import { MailerService } from '../services'; - -@Console({ - command: 'mailer', -}) -export class MailerCliService { - constructor(private readonly mailerService: MailerService) {} - - @Command({ - command: 'send ', - description: 'Send a mail to recipient', - }) - public async send(email: string): Promise { - const params: mailjet.Email.SendParams = this.getSendEmailParams(email); - try { - const response = await this.mailerService.send(params); - console.info(response); - } catch (e) { - console.warn(e); - } - } - - private getSendEmailParams(email: string): mailjet.Email.SendParams { - return { - Messages: [ - { - From: { - Email: 'dt@trxn.net', - Name: 'Tractr', - }, - To: [ - { - Email: email, - Name: 'Jean Claude', - }, - ], - Subject: 'This is an email to test Node Mailer Module', - TextPart: - 'Dear Jean Claude, welcome to Mailjet! May the delivery force be with you!', - HTMLPart: - '

Dear Jean Claude, welcome to Mailjet!


May the delivery force be with you!', - }, - ], - }; - } -} diff --git a/libs/nestjs/mailer/src/lib/configs/index.ts b/libs/nestjs/mailer/src/lib/configs/index.ts deleted file mode 100644 index 573ba2276..000000000 --- a/libs/nestjs/mailer/src/lib/configs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './mailer.config'; diff --git a/libs/nestjs/mailer/src/lib/constants/index.ts b/libs/nestjs/mailer/src/lib/constants/index.ts deleted file mode 100644 index 7f177f34b..000000000 --- a/libs/nestjs/mailer/src/lib/constants/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './mailer.constants'; -export * from './reset-password-send-email.constant'; diff --git a/libs/nestjs/mailer/src/lib/constants/mailer.constants.ts b/libs/nestjs/mailer/src/lib/constants/mailer.constants.ts deleted file mode 100644 index 2cca35759..000000000 --- a/libs/nestjs/mailer/src/lib/constants/mailer.constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const MAILER_MODULE_OPTIONS = 'MAILER_MODULE_OPTIONS'; diff --git a/libs/nestjs/mailer/src/lib/helpers/are-we-testing.ts b/libs/nestjs/mailer/src/lib/helpers/are-we-testing.ts deleted file mode 100644 index 1f8f3c546..000000000 --- a/libs/nestjs/mailer/src/lib/helpers/are-we-testing.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function areWeTestingWithJest() { - return process.env.JEST_WORKER_ID !== undefined; -} diff --git a/libs/nestjs/mailer/src/lib/helpers/index.ts b/libs/nestjs/mailer/src/lib/helpers/index.ts deleted file mode 100644 index 5dadbe5a7..000000000 --- a/libs/nestjs/mailer/src/lib/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './are-we-testing'; diff --git a/libs/nestjs/mailer/src/lib/interfaces/index.ts b/libs/nestjs/mailer/src/lib/interfaces/index.ts deleted file mode 100644 index 1f3cd7ea4..000000000 --- a/libs/nestjs/mailer/src/lib/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './mailer.interface'; diff --git a/libs/nestjs/mailer/src/lib/interfaces/mailer.interface.ts b/libs/nestjs/mailer/src/lib/interfaces/mailer.interface.ts deleted file mode 100644 index af2ffaa38..000000000 --- a/libs/nestjs/mailer/src/lib/interfaces/mailer.interface.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type MailerOptions = { - publicApiKey: string; - privateApiKey: string; -}; - -export type MailerPublicOptions = MailerOptions; diff --git a/libs/nestjs/mailer/src/lib/mailer.module.ts b/libs/nestjs/mailer/src/lib/mailer.module.ts deleted file mode 100644 index 38beb72b3..000000000 --- a/libs/nestjs/mailer/src/lib/mailer.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { HttpModule } from '@nestjs/axios'; -import { Module } from '@nestjs/common'; - -import { MailerCliService } from './cli'; -import { MAILER_MODULE_OPTIONS } from './constants'; -import { MailerOptions, MailerPublicOptions } from './interfaces'; -import { MailerService } from './services'; -import { ResetPasswordSendEmailService } from './services/reset-password-send-email.service'; - -import { ModuleOptionsFactory } from '@trxn/nestjs-core'; - -@Module({ - imports: [HttpModule], - providers: [MailerService, MailerCliService, ResetPasswordSendEmailService], - exports: [MailerService, ResetPasswordSendEmailService], -}) -export class MailerModule extends ModuleOptionsFactory< - MailerOptions, - MailerPublicOptions ->(MAILER_MODULE_OPTIONS) {} diff --git a/libs/nestjs/mailer/src/lib/services/index.ts b/libs/nestjs/mailer/src/lib/services/index.ts deleted file mode 100644 index 786ee7aa5..000000000 --- a/libs/nestjs/mailer/src/lib/services/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './mailer.service'; -export * from './reset-password-send-email.service'; diff --git a/libs/nestjs/mailer/src/lib/services/mailer.service.ts b/libs/nestjs/mailer/src/lib/services/mailer.service.ts deleted file mode 100644 index 48521ee34..000000000 --- a/libs/nestjs/mailer/src/lib/services/mailer.service.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Inject, Injectable } from '@nestjs/common'; -import * as mailjet from 'node-mailjet'; - -import { MAILJET_API_VERSION } from '../configs'; -import { MAILER_MODULE_OPTIONS } from '../constants'; -import { areWeTestingWithJest } from '../helpers'; -import { MailerOptions } from '../interfaces'; - -import { isProduction } from '@trxn/nestjs-core'; - -@Injectable() -export class MailerService { - mailjetClient!: mailjet.Email.Client; - - constructor( - @Inject(MAILER_MODULE_OPTIONS) - private readonly mailerOptions: MailerOptions, - ) { - this.connectToMailjetApi(); - } - - public async send( - params: mailjet.Email.SendParams, - ): Promise { - if (areWeTestingWithJest()) return null; - - return this.mailjetClient - .post('send', { version: MAILJET_API_VERSION }) - .request({ - SandboxMode: !isProduction(), - ...params, - }); - } - - private connectToMailjetApi(): void { - this.mailjetClient = mailjet.connect( - this.mailerOptions.publicApiKey, - this.mailerOptions.privateApiKey, - ); - } -} diff --git a/libs/nestjs/mailer/src/lib/services/reset-password-send-email.service.ts b/libs/nestjs/mailer/src/lib/services/reset-password-send-email.service.ts deleted file mode 100644 index b7b2a2fbd..000000000 --- a/libs/nestjs/mailer/src/lib/services/reset-password-send-email.service.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import * as mailjet from 'node-mailjet'; - -import { DEFAULT_RESET_HTML, DEFAULT_UPDATED_HTML } from '../constants'; -import { MailerService } from './mailer.service'; - -@Injectable() -export class ResetPasswordSendEmailService { - constructor(private readonly mailerService: MailerService) {} - - sendRequestResetPasswordEmailFactory({ - from, - templateId, - subject, - variables, - }: { - from: string; - templateId?: number; - subject?: string; - variables?: Record; - }): ( - link: string, - resetCode: string, - user: Record, - ) => Promise | void { - return async ( - link: string, - resetCode: string, - user: Record, - ) => { - if (!from) { - throw new Error( - 'send request reset password email: from option is required', - ); - } - - const message: mailjet.Email.SendParamsMessage = { - From: { - Email: from, - }, - To: [{ Email: user.email as string }], - TemplateLanguage: true, - Subject: subject, - ...(templateId - ? { TemplateID: templateId } - : { HTMLPart: DEFAULT_RESET_HTML }), - Variables: { - link, - email: user.email, - ...(variables ?? {}), - }, - }; - - await this.mailerService.send({ - Messages: [message], - }); - }; - } - - sendUpdatedPasswordEmailFactory({ - from, - templateId, - subject, - variables, - }: { - from: string; - templateId?: number; - subject?: string; - variables?: Record; - }): (user: Record) => Promise | void { - return async (user: Record) => { - if (!from) { - throw new Error( - 'send request reset password email: from option is required', - ); - } - - const message: mailjet.Email.SendParamsMessage = { - From: { - Email: from, - }, - To: [{ Email: user.email as string }], - TemplateLanguage: true, - Subject: subject, - ...(templateId - ? { TemplateID: templateId } - : { HTMLPart: DEFAULT_UPDATED_HTML }), - Variables: { - email: user.email, - ...(variables ?? {}), - }, - }; - - await this.mailerService.send({ - Messages: [message], - }); - }; - } -} diff --git a/libs/nestjs/mailer/src/mailer.module-definition.ts b/libs/nestjs/mailer/src/mailer.module-definition.ts new file mode 100644 index 000000000..4b099d5fd --- /dev/null +++ b/libs/nestjs/mailer/src/mailer.module-definition.ts @@ -0,0 +1,34 @@ +import { ConfigurableModuleBuilder } from '@nestjs/common'; + +import { MAILER_CLIENT } from './constants'; +import { MailerClient, MailerModuleOptions } from './interfaces'; + +import { + addImportsAndProvidersExtra, + addProviderWithInjectionTokenExtra, + ImportsExtra, + ProvidersExtra, + ProviderWithInjectionToken, +} from '@trxn/nestjs-core'; + +export const { + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + ASYNC_OPTIONS_TYPE, + OPTIONS_TYPE, +} = new ConfigurableModuleBuilder() + .setExtras< + ImportsExtra & + ProvidersExtra & { + MailerClient?: ProviderWithInjectionToken< + typeof MAILER_CLIENT, + MailerClient + >; + } + >( + { imports: [], providers: [] }, + addImportsAndProvidersExtra((definition, { MailerClient: Client }) => + addProviderWithInjectionTokenExtra(definition, MAILER_CLIENT, Client), + ), + ) + .build(); diff --git a/libs/nestjs/mailer/src/mailer.module.ts b/libs/nestjs/mailer/src/mailer.module.ts new file mode 100644 index 000000000..049421566 --- /dev/null +++ b/libs/nestjs/mailer/src/mailer.module.ts @@ -0,0 +1,13 @@ +import { Module } from '@nestjs/common'; + +import { ConfigurableModuleClass } from './mailer.module-definition'; +import { MailerService } from './services'; + +import { LoggerModule } from '@trxn/nestjs-core'; + +@Module({ + imports: [LoggerModule], + providers: [MailerService], + exports: [MailerService], +}) +export class MailerModule extends ConfigurableModuleClass {} diff --git a/libs/nestjs/mailer/src/services/index.ts b/libs/nestjs/mailer/src/services/index.ts new file mode 100644 index 000000000..13137e36f --- /dev/null +++ b/libs/nestjs/mailer/src/services/index.ts @@ -0,0 +1 @@ +export * from './mailer.service'; diff --git a/libs/nestjs/mailer/src/services/mailer.service.ts b/libs/nestjs/mailer/src/services/mailer.service.ts new file mode 100644 index 000000000..fd7d6a4a5 --- /dev/null +++ b/libs/nestjs/mailer/src/services/mailer.service.ts @@ -0,0 +1,40 @@ +import { Inject, Injectable, Logger } from '@nestjs/common'; + +import { MAILER_CLIENT } from '../constants'; +import { + MailerClient, + MailerModuleOptions, + SendEmailParams, +} from '../interfaces'; +import { MODULE_OPTIONS_TOKEN } from '../mailer.module-definition'; + +import { LoggerService } from '@trxn/nestjs-core'; + +@Injectable() +export class MailerService { + constructor( + @Inject(MODULE_OPTIONS_TOKEN) + private readonly mailerOptions: MailerModuleOptions, + + @Inject(MAILER_CLIENT) + private readonly mailerClient: MailerClient, + + @Inject(Logger) + private readonly logger: LoggerService, + ) { + this.logger.setContext(MailerService.name); + } + + public async send(params: SendEmailParams): Promise { + this.logger.debug('Sending email: ', params); + + if (!this.mailerOptions.production) { + this.logger.debug( + 'Server is in development mode, email has not been send via the MailerClient', + ); + return null; + } + + return this.mailerClient.send(params); + } +} diff --git a/libs/nestjs/mailjet/.babelrc b/libs/nestjs/mailjet/.babelrc new file mode 100644 index 000000000..e24a5465f --- /dev/null +++ b/libs/nestjs/mailjet/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/web/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/nestjs/mailjet/.eslintrc.json b/libs/nestjs/mailjet/.eslintrc.json new file mode 100644 index 000000000..3456be9b9 --- /dev/null +++ b/libs/nestjs/mailjet/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/nestjs/mailjet/CHANGELOG.md b/libs/nestjs/mailjet/CHANGELOG.md new file mode 100644 index 000000000..4e491c6f0 --- /dev/null +++ b/libs/nestjs/mailjet/CHANGELOG.md @@ -0,0 +1,91 @@ +# Changelog + +This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). + +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + +### Bug Fixes + +* update MAILER_CLIENT providers ([7dbf6e3](https://github.com/tractr/traxion/commit/7dbf6e33654718e1d47b98165b67dea7d5063ac8)) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + +### Bug Fixes + +* remove [@tractr](https://github.com/tractr) and replace it by [@trxn](https://github.com/trxn) ([129058f](https://github.com/tractr/traxion/commit/129058fee9f88c34ac4f124f9d1d54470939a0e7)) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + +### Bug Fixes + +* update MAILER_CLIENT providers ([7dbf6e3](https://github.com/tractr/traxion/commit/7dbf6e33654718e1d47b98165b67dea7d5063ac8)) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + +### Bug Fixes + +* remove [@tractr](https://github.com/tractr) and replace it by [@trxn](https://github.com/trxn) ([129058f](https://github.com/tractr/traxion/commit/129058fee9f88c34ac4f124f9d1d54470939a0e7)) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) diff --git a/libs/nestjs/mailjet/README.md b/libs/nestjs/mailjet/README.md new file mode 100644 index 000000000..c6aff845e --- /dev/null +++ b/libs/nestjs/mailjet/README.md @@ -0,0 +1,143 @@ +# Mailjet Module + +The nestjs-mailjet module provides a simple wrapper for the Mailjet API, +allowing NestJS applications to easily send transactional emails using the +Mailjet email delivery service. + +## Installation + +You can install the nestjs-mailjet module using npm: + +```bash +npm install --save @trxn/nestjs-mailjet +```` + +## Getting Started + +To use the nestjs-mailjet module, you first need to import it into your NestJS +application. You can do this by adding the MailjetModule to your app's imports array: + +```ts +import { MailjetModule } from '@trxn/nestjs-mailjet'; + +@Module({ + imports: [ + MailjetModule.forRoot({ + apiKey: 'your_api_key', + apiSecret: 'your_api_secret', + }), + ], +}) +export class AppModule {} +``` + +The forRoot method takes an options object with the following properties: + +- `apiKey`: The Mailjet API key. +- `apiSecret`: The Mailjet API secret. +- `sandboxMode` (optional): A boolean value indicating whether to enable sandbox mode. Default is `false`. + +This module options extends the mailjet `ClientParams` options. You can find more [here](https://www.npmjs.com/package/node-mailjet). + +## Injecting the MailjetService + +Once the MailjetModule is imported, you can inject the MailjetService into your controllers or services: + +```ts +import { Injectable } from '@nestjs/common'; +import { MailjetService } from '@trxn/nestjs-mailjet'; + +@Injectable() +export class EmailsService { + constructor(private readonly mailjetService: MailjetService) {} + + async sendEmail(data: any) { + const { from, to, subject, html, text } = data; + + await this.mailjetService.send({ + from, + to, + subject, + html, + text, + }); + } +} +``` + +The MailjetModule expose the same service with an alias token: 'MAILER_CLIENT' from the `@trxn/nestjs-mailer` package. So you can import this service like this too: + +```ts +import { Injectable } from '@nestjs/common'; +import { MAILER_CLIENT } from '@trxn/nestjs-mailer'; +import { MailjetService } from '@trxn/nestjs-mailjet'; + +@Injectable() +export class EmailsService { + constructor(@Inject(MAILER_CLIENT) private readonly mailjetService: MailjetService) {} + + async sendEmail(data: any) { + const { from, to, subject, html, text } = data; + + await this.mailjetService.send({ + from, + to, + subject, + html, + text, + }); + } +} +``` + +## Using Templates + +You can also use email templates with the MailjetService by passing a templateId and context: + +```ts +await this.mailjetService.send({ + from, + to, + subject, + context: { + templateId: 12345, + name: 'John Doe', + orderNumber: 12345, + }, +}); +``` + +## API + +The MailjetService provides a single method for sending email: + +### send + +```ts +send(params: SendEmailParams): Promise +```` + +Sends an email using the Mailjet API. + +| Property | Type | Description | +| --- | --- | --- | +| `params` | `SendEmailParams` | The email parameters. | + +The SendEmailParams interface has the following properties: + +```ts +interface SendEmailParams { + from: string; + to: string | string[]; + subject?: string; + html?: string; + text?: string; + context?: Record & { + templateId?: number; + }; +} +``` + +## Conclusion + +The nestjs-mailjet module provides a simple and convenient way to send transactional emails via the Mailjet API in a NestJS application. By using this module, you can easily integrate email sending functionality into your app and focus on building other important features. diff --git a/libs/nestjs/mailjet/jest.config.ts b/libs/nestjs/mailjet/jest.config.ts new file mode 100644 index 000000000..88cfb78a4 --- /dev/null +++ b/libs/nestjs/mailjet/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'nestjs-mailjet', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../../coverage/libs/nestjs/mailjet', +}; diff --git a/libs/nestjs/mailjet/package.json b/libs/nestjs/mailjet/package.json new file mode 100644 index 000000000..b8934c22e --- /dev/null +++ b/libs/nestjs/mailjet/package.json @@ -0,0 +1,13 @@ +{ + "name": "@trxn/nestjs-mailjet", + "version": "2.1.0-next.1", + "repository": { + "type": "git", + "url": "https://github.com/tractr/traxion" + }, + "type": "commonjs", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + } +} diff --git a/libs/nestjs/mailjet/project.json b/libs/nestjs/mailjet/project.json new file mode 100644 index 000000000..30b262426 --- /dev/null +++ b/libs/nestjs/mailjet/project.json @@ -0,0 +1,47 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "nestjs-mailjet", + "projectType": "library", + "sourceRoot": "libs/nestjs/mailjet/src", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "options": { + "assets": ["libs/nestjs/mailjet/*.md"], + "main": "libs/nestjs/mailjet/src/index.ts", + "outputPath": "dist/libs/nestjs/mailjet", + "packageJson": "libs/nestjs/mailjet/package.json", + "tsConfig": "libs/nestjs/mailjet/tsconfig.lib.json" + }, + "outputs": ["{options.outputPath}"] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/nestjs/mailjet/**/*.ts"] + }, + "outputs": ["{options.outputFile}"] + }, + "publish": { + "executor": "ngx-deploy-npm:deploy", + "options": { + "access": "public" + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/nestjs/mailjet/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["coverage/libs/nestjs/mailjet"] + }, + "update-peer-dependencies": { + "executor": "./dist/libs/schematics:update-peer-dependencies", + "options": { + "packageJsonPath": "{workspaceRoot}/dist/libs/nestjs/mailjet/package.json" + } + } + } +} diff --git a/libs/nestjs/mailjet/src/configs/index.ts b/libs/nestjs/mailjet/src/configs/index.ts new file mode 100644 index 000000000..da717aabd --- /dev/null +++ b/libs/nestjs/mailjet/src/configs/index.ts @@ -0,0 +1 @@ +export * from './mailjet.config'; diff --git a/libs/nestjs/mailer/src/lib/configs/mailer.config.ts b/libs/nestjs/mailjet/src/configs/mailjet.config.ts similarity index 100% rename from libs/nestjs/mailer/src/lib/configs/mailer.config.ts rename to libs/nestjs/mailjet/src/configs/mailjet.config.ts diff --git a/libs/nestjs/mailjet/src/index.ts b/libs/nestjs/mailjet/src/index.ts new file mode 100644 index 000000000..1efd5e4aa --- /dev/null +++ b/libs/nestjs/mailjet/src/index.ts @@ -0,0 +1,5 @@ +export * from './configs'; +export * from './interfaces'; +export * from './services'; +export * from './mailjet.module-definition'; +export * from './mailjet.module'; diff --git a/libs/nestjs/mailjet/src/interfaces/index.ts b/libs/nestjs/mailjet/src/interfaces/index.ts new file mode 100644 index 000000000..40f349fc4 --- /dev/null +++ b/libs/nestjs/mailjet/src/interfaces/index.ts @@ -0,0 +1 @@ +export * from './mailjet.interface'; diff --git a/libs/nestjs/mailjet/src/interfaces/mailjet.interface.ts b/libs/nestjs/mailjet/src/interfaces/mailjet.interface.ts new file mode 100644 index 000000000..8f23bba6f --- /dev/null +++ b/libs/nestjs/mailjet/src/interfaces/mailjet.interface.ts @@ -0,0 +1,5 @@ +import { ClientParams } from 'node-mailjet/declarations/client/Client'; + +export type MailjetModuleOptions = ClientParams & { + sandboxMode?: boolean; +}; diff --git a/libs/nestjs/mailjet/src/mailjet.module-definition.ts b/libs/nestjs/mailjet/src/mailjet.module-definition.ts new file mode 100644 index 000000000..5dbb700e6 --- /dev/null +++ b/libs/nestjs/mailjet/src/mailjet.module-definition.ts @@ -0,0 +1,10 @@ +import { ConfigurableModuleBuilder } from '@nestjs/common'; + +import { MailjetModuleOptions } from './interfaces'; + +export const { + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + ASYNC_OPTIONS_TYPE, + OPTIONS_TYPE, +} = new ConfigurableModuleBuilder().build(); diff --git a/libs/nestjs/mailjet/src/mailjet.module.ts b/libs/nestjs/mailjet/src/mailjet.module.ts new file mode 100644 index 000000000..a8f1462d4 --- /dev/null +++ b/libs/nestjs/mailjet/src/mailjet.module.ts @@ -0,0 +1,16 @@ +import { Module } from '@nestjs/common'; + +import { ConfigurableModuleClass } from './mailjet.module-definition'; +import { MailjetClient, MailjetService } from './services'; + +import { MAILER_CLIENT } from '@trxn/nestjs-mailer'; + +@Module({ + providers: [ + MailjetClient, + MailjetService, + { provide: MAILER_CLIENT, useExisting: MailjetService }, + ], + exports: [MailjetClient, MailjetService, MAILER_CLIENT], +}) +export class MailjetModule extends ConfigurableModuleClass {} diff --git a/libs/nestjs/mailjet/src/services/index.ts b/libs/nestjs/mailjet/src/services/index.ts new file mode 100644 index 000000000..69389282e --- /dev/null +++ b/libs/nestjs/mailjet/src/services/index.ts @@ -0,0 +1,2 @@ +export * from './mailjet-client.service'; +export * from './mailjet.service'; diff --git a/libs/nestjs/mailjet/src/services/mailjet-client.service.ts b/libs/nestjs/mailjet/src/services/mailjet-client.service.ts new file mode 100644 index 000000000..c68bc460a --- /dev/null +++ b/libs/nestjs/mailjet/src/services/mailjet-client.service.ts @@ -0,0 +1,19 @@ +import { Inject, Injectable } from '@nestjs/common'; +import { Client, Request } from 'node-mailjet'; +import { RequestConstructorConfig } from 'node-mailjet/declarations/request/Request'; + +import { MailjetModuleOptions } from '../interfaces'; +import { MODULE_OPTIONS_TOKEN } from '../mailjet.module-definition'; + +@Injectable() +export class MailjetClient extends Client { + sandboxMode: boolean; + + constructor( + @Inject(MODULE_OPTIONS_TOKEN) + mailerOptions: MailjetModuleOptions, + ) { + super(mailerOptions); + this.sandboxMode = mailerOptions.sandboxMode ?? false; + } +} diff --git a/libs/nestjs/mailjet/src/services/mailjet.service.ts b/libs/nestjs/mailjet/src/services/mailjet.service.ts new file mode 100644 index 000000000..035b04ccf --- /dev/null +++ b/libs/nestjs/mailjet/src/services/mailjet.service.ts @@ -0,0 +1,45 @@ +import { Injectable } from '@nestjs/common'; +import { SendEmailV3_1 as SendEmailMailjet } from 'node-mailjet'; + +import { MailjetClient } from './mailjet-client.service'; +import { MAILJET_API_VERSION } from '../configs'; + +import { MailerClient, SendEmailParams } from '@trxn/nestjs-mailer'; + +@Injectable() +export class MailjetService implements MailerClient { + constructor(protected mailjetClient: MailjetClient) {} + + public async send({ + from, + to, + context = {}, + html, + subject, + text, + }: SendEmailParams) { + const { templateId, ...variables } = context; + + const message: SendEmailMailjet.Message = { + From: { + Email: from, + }, + To: (Array.isArray(to) ? to : [to]).map((email) => ({ Email: email })), + TemplateLanguage: true, + Subject: subject, + ...(templateId + ? { TemplateID: templateId as number } + : { HTMLPart: html, TextPart: text }), + Variables: variables, + }; + + const data: SendEmailMailjet.Body = { + Messages: [message], + SandboxMode: this.mailjetClient.sandboxMode, + }; + + return this.mailjetClient + .post('send', { version: MAILJET_API_VERSION }) + .request(data); + } +} diff --git a/libs/nestjs/mailjet/tsconfig.json b/libs/nestjs/mailjet/tsconfig.json new file mode 100644 index 000000000..a3ee1b600 --- /dev/null +++ b/libs/nestjs/mailjet/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs" + }, + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/nestjs/mailjet/tsconfig.lib.json b/libs/nestjs/mailjet/tsconfig.lib.json new file mode 100644 index 000000000..d4c178082 --- /dev/null +++ b/libs/nestjs/mailjet/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "outDir": "../../../dist/out-tsc", + "target": "es6", + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "extends": "./tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/libs/nestjs/mailjet/tsconfig.spec.json b/libs/nestjs/mailjet/tsconfig.spec.json new file mode 100644 index 000000000..2239fc199 --- /dev/null +++ b/libs/nestjs/mailjet/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "types": ["jest", "node"] + }, + "extends": "./tsconfig.json", + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/nestjs/password/CHANGELOG.md b/libs/nestjs/password/CHANGELOG.md index 975d21609..b9ca92d8a 100644 --- a/libs/nestjs/password/CHANGELOG.md +++ b/libs/nestjs/password/CHANGELOG.md @@ -2,6 +2,40 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* update mailer to use mailjet v6 ([2a4a060](https://github.com/tractr/traxion/commit/2a4a0607963235cbb859e8ff99794829f7eaaf58)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/password/package.json b/libs/nestjs/password/package.json index 6d1acb780..b4ac79c1e 100644 --- a/libs/nestjs/password/package.json +++ b/libs/nestjs/password/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-password", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/password/src/constants/index.ts b/libs/nestjs/password/src/constants/index.ts index 626defce4..3bc138cf7 100644 --- a/libs/nestjs/password/src/constants/index.ts +++ b/libs/nestjs/password/src/constants/index.ts @@ -1 +1 @@ -export * from './reset-password.constant'; +export * from './password.contant'; diff --git a/libs/nestjs/password/src/constants/password.contant.ts b/libs/nestjs/password/src/constants/password.contant.ts new file mode 100644 index 000000000..868350479 --- /dev/null +++ b/libs/nestjs/password/src/constants/password.contant.ts @@ -0,0 +1 @@ +export const ENCRYPTION_SERVICE = 'ENCRYPTION_SERVICE'; diff --git a/libs/nestjs/password/src/constants/reset-password.constant.ts b/libs/nestjs/password/src/constants/reset-password.constant.ts deleted file mode 100644 index 9741d2011..000000000 --- a/libs/nestjs/password/src/constants/reset-password.constant.ts +++ /dev/null @@ -1 +0,0 @@ -export const DEFAULT_RESET_PASSWORD_LINK = `/password/reset/{{id}}/{{code}}`; diff --git a/libs/nestjs/password/src/controllers/index.ts b/libs/nestjs/password/src/controllers/index.ts index 040e4442e..94964fd83 100644 --- a/libs/nestjs/password/src/controllers/index.ts +++ b/libs/nestjs/password/src/controllers/index.ts @@ -1,2 +1 @@ -export * from './reset-password.controller'; export * from './password.controller'; diff --git a/libs/nestjs/password/src/controllers/password.controller.spec.ts b/libs/nestjs/password/src/controllers/password.controller.spec.ts index 7f0a02a59..5f12a6457 100644 --- a/libs/nestjs/password/src/controllers/password.controller.spec.ts +++ b/libs/nestjs/password/src/controllers/password.controller.spec.ts @@ -10,8 +10,8 @@ import { User } from '@prisma/client'; import { mockDeep, MockProxy } from 'jest-mock-extended'; import * as request from 'supertest'; -import { PasswordService } from '../services'; import { PasswordController } from './password.controller'; +import { PasswordService } from '../services'; describe('Password Controller', () => { let app: INestApplication; diff --git a/libs/nestjs/password/src/dtos/index.ts b/libs/nestjs/password/src/dtos/index.ts index 48e4257de..5709e5387 100644 --- a/libs/nestjs/password/src/dtos/index.ts +++ b/libs/nestjs/password/src/dtos/index.ts @@ -1,3 +1 @@ -export * from './password-reset-requested.dto'; -export * from './password-reset.dto'; export * from './password-update.dto'; diff --git a/libs/nestjs/password/src/errors/index.ts b/libs/nestjs/password/src/errors/index.ts index a0b8e39c1..d9c97d12f 100644 --- a/libs/nestjs/password/src/errors/index.ts +++ b/libs/nestjs/password/src/errors/index.ts @@ -1,2 +1 @@ export * from './bad-password.error'; -export * from './bad-reset-code.error'; diff --git a/libs/nestjs/password/src/index.ts b/libs/nestjs/password/src/index.ts index 77354e68c..dc69acaeb 100644 --- a/libs/nestjs/password/src/index.ts +++ b/libs/nestjs/password/src/index.ts @@ -1,4 +1,7 @@ +export * from './constants'; +export * from './controllers'; export * from './dtos'; +export * from './interfaces'; +export * from './services'; export * from './password.module'; export * from './password.module-definition'; -export * from './controllers'; diff --git a/libs/nestjs/password/src/interfaces/password-module-options.interface.ts b/libs/nestjs/password/src/interfaces/password-module-options.interface.ts index f60351f4a..f2777b02d 100644 --- a/libs/nestjs/password/src/interfaces/password-module-options.interface.ts +++ b/libs/nestjs/password/src/interfaces/password-module-options.interface.ts @@ -1,49 +1,5 @@ import { JwtModuleOptions } from '@nestjs/jwt'; -import { Prisma } from '@prisma/client'; - -import { EncryptionService } from '@trxn/nestjs-bcrypt'; - -export type UserInfo = { id: string | number; email: string; password: string }; - -export type ResetPasswordLinkFactory = - | (( - request: Record, - resetCode: string, - user: Record, - ) => Promise | string) - | string; - -export type ResetPasswordSendRequestEmail = ( - link: string, - resetCode: string, - user: Record, -) => Promise | void; - -export type ResetPasswordSendRequestUpdated = ( - user: Record, -) => Promise | void; export class PasswordModuleOptions { - resetPasswordExpiresIn?: string | number | undefined; - - resetPasswordLinkFactory?: ResetPasswordLinkFactory; - - resetPasswordSendEmail?: { - request?: ResetPasswordSendRequestEmail; - updated?: ResetPasswordSendRequestUpdated; - }; - - user?: { - fields?: { - id: string; - email: string; - password: string; - }; - }; - - userService!: Prisma.UserDelegate; - jwtModuleOptions?: JwtModuleOptions; - - encryptionService?: EncryptionService; } diff --git a/libs/nestjs/password/src/password.module-definition.ts b/libs/nestjs/password/src/password.module-definition.ts index d0d481af2..93f5a07bc 100644 --- a/libs/nestjs/password/src/password.module-definition.ts +++ b/libs/nestjs/password/src/password.module-definition.ts @@ -2,9 +2,33 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; import { PasswordModuleOptions } from './interfaces'; +import { + addImportsAndProvidersExtra, + addProviderWithInjectionTokenExtra, + ImportsExtra, + ProvidersExtra, + ProviderWithInjectionToken, +} from '@trxn/nestjs-core'; +import { USER_SERVICE, UserService } from '@trxn/nestjs-user'; + export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, ASYNC_OPTIONS_TYPE, OPTIONS_TYPE, -} = new ConfigurableModuleBuilder().build(); +} = new ConfigurableModuleBuilder() + .setExtras< + ImportsExtra & + ProvidersExtra & { + UserService?: ProviderWithInjectionToken< + typeof USER_SERVICE, + UserService + >; + } + >( + { imports: [], providers: [] }, + addImportsAndProvidersExtra((definition, { UserService: User }) => + addProviderWithInjectionTokenExtra(definition, USER_SERVICE, User), + ), + ) + .build(); diff --git a/libs/nestjs/password/src/password.module.spec.ts b/libs/nestjs/password/src/password.module.spec.ts index 3bb9fda0a..310c0e922 100644 --- a/libs/nestjs/password/src/password.module.spec.ts +++ b/libs/nestjs/password/src/password.module.spec.ts @@ -4,19 +4,20 @@ import { Prisma } from '@prisma/client'; import { mockDeep, MockProxy } from 'jest-mock-extended'; import { PasswordModule } from './password.module'; -import { PasswordService, ResetPasswordService } from './services'; +import { PasswordService } from './services'; + +import { UserService } from '@trxn/nestjs-user'; describe('Password Module ', () => { let app: INestApplication; - let mockUserService: MockProxy>; + let mockUserService: MockProxy; it('should load the module when using register', async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep(); const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [ PasswordModule.register({ - resetPasswordLinkFactory: () => 'resetPasswordLinkFactory', - userService: mockUserService, + providers: [{ provide: UserService, useValue: mockUserService }], }), ], providers: [], @@ -27,19 +28,15 @@ describe('Password Module ', () => { const passwordService = app.get(PasswordService); expect(passwordService).toBeInstanceOf(PasswordService); - const resetPasswordService = app.get(ResetPasswordService); - expect(resetPasswordService).toBeInstanceOf(ResetPasswordService); }); it('should load the module when using registerAsync', async () => { - mockUserService = mockDeep>(); + mockUserService = mockDeep(); const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [ PasswordModule.registerAsync({ - useFactory: () => ({ - resetPasswordLinkFactory: () => 'resetPasswordLinkFactory', - userService: mockUserService, - }), + providers: [{ provide: UserService, useValue: mockUserService }], + useFactory: () => ({}), }), ], providers: [], @@ -50,7 +47,5 @@ describe('Password Module ', () => { const passwordService = app.get(PasswordService); expect(passwordService).toBeInstanceOf(PasswordService); - const resetPasswordService = app.get(ResetPasswordService); - expect(resetPasswordService).toBeInstanceOf(ResetPasswordService); }); }); diff --git a/libs/nestjs/password/src/password.module.ts b/libs/nestjs/password/src/password.module.ts index 87a514d4c..3a5b22169 100644 --- a/libs/nestjs/password/src/password.module.ts +++ b/libs/nestjs/password/src/password.module.ts @@ -8,25 +8,15 @@ import { MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, } from './password.module-definition'; -import { - HashService, - PasswordService, - ResetPasswordService, - UserPasswordService, -} from './services'; +import { HashService, PasswordService } from './services'; import { BcryptModule } from '@trxn/nestjs-bcrypt'; import { LoggerModule } from '@trxn/nestjs-core'; @Module({ imports: [LoggerModule, BcryptModule.register({})], - providers: [ - PasswordService, - ResetPasswordService, - UserPasswordService, - HashService, - ], - exports: [PasswordService, ResetPasswordService], + providers: [PasswordService, HashService], + exports: [PasswordService, HashService], }) export class PasswordModule extends ConfigurableModuleClass { static createModule(module: DynamicModule): DynamicModule { @@ -58,12 +48,12 @@ export class PasswordModule extends ConfigurableModuleClass { } static register(options: typeof OPTIONS_TYPE): DynamicModule { - const authenticationOptionsModule = super.register(options); - return this.createModule(authenticationOptionsModule); + const passwordOptionsModule = super.register(options); + return this.createModule(passwordOptionsModule); } static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule { - const authenticationOptionsModule = super.registerAsync(options); - return this.createModule(authenticationOptionsModule); + const passwordOptionsModule = super.registerAsync(options); + return this.createModule(passwordOptionsModule); } } diff --git a/libs/nestjs/password/src/services/hash.service.spec.ts b/libs/nestjs/password/src/services/hash.service.spec.ts index bb5b02fc3..b77af4bd6 100644 --- a/libs/nestjs/password/src/services/hash.service.spec.ts +++ b/libs/nestjs/password/src/services/hash.service.spec.ts @@ -2,9 +2,10 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; +import { HashService } from './hash.service'; +import { ENCRYPTION_SERVICE } from '../constants'; import { PasswordModuleOptions } from '../interfaces'; import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; -import { HashService } from './hash.service'; import { BcryptService } from '@trxn/nestjs-bcrypt'; @@ -12,16 +13,27 @@ describe('HashService', () => { let hashService: HashService; let mockPasswordModuleOptions: MockProxy; let mockBcryptService: MockProxy; + let mockEncryptionService: MockProxy; beforeEach(async () => { - mockPasswordModuleOptions = mockDeep({}); + mockPasswordModuleOptions = mockDeep( + {}, + ) as MockProxy; mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); const module: TestingModule = await Test.createTestingModule({ providers: [ HashService, - { provide: MODULE_OPTIONS_TOKEN, useValue: mockPasswordModuleOptions }, + { + provide: MODULE_OPTIONS_TOKEN, + useValue: mockPasswordModuleOptions, + }, { provide: BcryptService, useValue: mockBcryptService }, + { + provide: ENCRYPTION_SERVICE, + useValue: mockEncryptionService, + }, ], }).compile(); @@ -33,38 +45,71 @@ describe('HashService', () => { mockReset(mockBcryptService); }); - it('should be defined', () => { - expect(hashService).toBeDefined(); - }); + describe('use internal bcrypt provider', () => { + beforeEach(async () => { + mockPasswordModuleOptions = mockDeep({}); + mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); - describe('compare', () => { - it('should use the default BcryptService if no config is provided', async () => { - mockPasswordModuleOptions.encryptionService = undefined; - await hashService.compare('test', 'hash'); - expect(mockBcryptService.compare).toHaveBeenCalledWith('test', 'hash'); - }); - it('should use the EncryptionService if a config has been used', async () => { - const encryptionService = mockDeep(); - mockPasswordModuleOptions.encryptionService = encryptionService; + const module: TestingModule = await Test.createTestingModule({ + providers: [ + HashService, + { + provide: MODULE_OPTIONS_TOKEN, + useValue: mockPasswordModuleOptions, + }, + { provide: BcryptService, useValue: mockBcryptService }, + ], + }).compile(); + hashService = module.get(HashService); + }); + it('should use the default BcryptService.compare', async () => { await hashService.compare('test', 'hash'); - expect(mockBcryptService.compare).toHaveBeenCalledTimes(0); - expect(encryptionService.compare).toHaveBeenCalledWith('test', 'hash'); + expect(mockBcryptService.compare).toHaveBeenCalledWith('test', 'hash'); + expect(mockEncryptionService.compare).not.toHaveBeenCalled(); }); - }); - describe('hash', () => { - it('should use the default BcryptService if no config is provided', async () => { - mockPasswordModuleOptions.encryptionService = undefined; + it('should use the default BcryptService.hash', async () => { await hashService.hash('test'); expect(mockBcryptService.hash).toHaveBeenCalledWith('test'); + expect(mockEncryptionService.hash).not.toHaveBeenCalled(); }); - it('should use the EncryptionService if a config has been used', async () => { - const encryptionService = mockDeep(); - mockPasswordModuleOptions.encryptionService = encryptionService; + }); + describe('use external encryption provider', () => { + beforeEach(async () => { + mockPasswordModuleOptions = mockDeep({}); + mockBcryptService = mockDeep(); + mockEncryptionService = mockDeep(); + + const module: TestingModule = await Test.createTestingModule({ + providers: [ + HashService, + { + provide: MODULE_OPTIONS_TOKEN, + useValue: mockPasswordModuleOptions, + }, + { provide: BcryptService, useValue: mockBcryptService }, + { + provide: ENCRYPTION_SERVICE, + useValue: mockEncryptionService, + }, + ], + }).compile(); + hashService = module.get(HashService); + }); + it('should use the EncryptionService.compare', async () => { + await hashService.compare('test', 'hash'); + expect(mockBcryptService.compare).not.toHaveBeenCalled(); + expect(mockEncryptionService.compare).toHaveBeenCalledWith( + 'test', + 'hash', + ); + }); + it('should use the EncryptionService.hash', async () => { await hashService.hash('test'); - expect(mockBcryptService.hash).toHaveBeenCalledTimes(0); - expect(encryptionService.hash).toHaveBeenCalledWith('test'); + expect(mockBcryptService.hash).not.toHaveBeenCalled(); + expect(mockEncryptionService.hash).toHaveBeenCalledWith('test'); }); }); }); diff --git a/libs/nestjs/password/src/services/hash.service.ts b/libs/nestjs/password/src/services/hash.service.ts index de8582243..b32a0dd65 100644 --- a/libs/nestjs/password/src/services/hash.service.ts +++ b/libs/nestjs/password/src/services/hash.service.ts @@ -1,20 +1,19 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Inject, Injectable, Optional } from '@nestjs/common'; -import { PasswordModuleOptions } from '../interfaces'; -import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; +import { ENCRYPTION_SERVICE } from '../constants'; import { BcryptService, EncryptionService } from '@trxn/nestjs-bcrypt'; @Injectable() export class HashService implements EncryptionService { constructor( - @Inject(MODULE_OPTIONS_TOKEN) - private readonly passwordModuleOptions: PasswordModuleOptions, private readonly bcryptService: BcryptService, - ) {} - get encryptionService(): EncryptionService { - return this.passwordModuleOptions.encryptionService || this.bcryptService; + @Optional() + @Inject(ENCRYPTION_SERVICE) + private readonly encryptionService: EncryptionService, + ) { + this.encryptionService = this.encryptionService || this.bcryptService; } async hash(value: string): Promise { diff --git a/libs/nestjs/password/src/services/index.ts b/libs/nestjs/password/src/services/index.ts index f8182d8ff..7848e7859 100644 --- a/libs/nestjs/password/src/services/index.ts +++ b/libs/nestjs/password/src/services/index.ts @@ -1,4 +1,2 @@ export * from './hash.service'; export * from './password.service'; -export * from './reset-password.service'; -export * from './user-password.service'; diff --git a/libs/nestjs/password/src/services/password.service.spec.ts b/libs/nestjs/password/src/services/password.service.spec.ts index f5912cd79..04f154e64 100644 --- a/libs/nestjs/password/src/services/password.service.spec.ts +++ b/libs/nestjs/password/src/services/password.service.spec.ts @@ -1,26 +1,26 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy } from 'jest-mock-extended'; -import { BadPasswordError } from '../errors'; import { HashService } from './hash.service'; import { PasswordService } from './password.service'; -import { UserPasswordService } from './user-password.service'; +import { BadPasswordError } from '../errors'; import { UserNotFoundError } from '@trxn/nestjs-authentication'; +import { UserService } from '@trxn/nestjs-user'; describe('PasswordService', () => { let passwordService: PasswordService; - let mockUserPasswordService: MockProxy; + let mockUserService: MockProxy; let mockHashService: MockProxy; beforeEach(async () => { - mockUserPasswordService = mockDeep(); + mockUserService = mockDeep(); mockHashService = mockDeep(); const module: TestingModule = await Test.createTestingModule({ providers: [ PasswordService, - { provide: UserPasswordService, useValue: mockUserPasswordService }, + { provide: UserService, useValue: mockUserService }, { provide: HashService, useValue: mockHashService }, ], }).compile(); @@ -34,7 +34,7 @@ describe('PasswordService', () => { describe('updatePassword', () => { it('should update the password', async () => { - mockUserPasswordService.getUserFromId.mockResolvedValue({ + mockUserService.findUserById.mockResolvedValue({ id: '1', password: 'old', email: 'email', @@ -44,14 +44,11 @@ describe('PasswordService', () => { await passwordService.updatePassword('1', 'old', 'new'); // eslint-disable-next-line @typescript-eslint/unbound-method - expect(mockUserPasswordService.updateUserPassword).toHaveBeenCalledWith( - '1', - 'new', - ); + expect(mockUserService.updatePassword).toHaveBeenCalledWith('1', 'new'); }); it('should throw if the user has not been found', async () => { - mockUserPasswordService.getUserFromId.mockResolvedValue(null); + mockUserService.findUserById.mockResolvedValue(null); await expect(async () => passwordService.updatePassword('1', 'old', 'new'), @@ -59,7 +56,7 @@ describe('PasswordService', () => { }); it('should throw if the old password is not right', async () => { - mockUserPasswordService.getUserFromId.mockResolvedValue({ + mockUserService.findUserById.mockResolvedValue({ id: '1', password: 'password', email: 'email', diff --git a/libs/nestjs/password/src/services/password.service.ts b/libs/nestjs/password/src/services/password.service.ts index 694a973b8..fbe7742f7 100644 --- a/libs/nestjs/password/src/services/password.service.ts +++ b/libs/nestjs/password/src/services/password.service.ts @@ -1,24 +1,24 @@ import { Injectable } from '@nestjs/common'; -import { BadPasswordError } from '../errors'; import { HashService } from './hash.service'; -import { UserPasswordService } from './user-password.service'; +import { BadPasswordError } from '../errors'; import { UserNotFoundError } from '@trxn/nestjs-authentication'; +import { UserId, UserService } from '@trxn/nestjs-user'; @Injectable() export class PasswordService { constructor( - private readonly userPasswordService: UserPasswordService, + private readonly userService: UserService, private readonly hashService: HashService, ) {} async updatePassword( - userId: string, + userId: UserId, oldPassword: string, newPassword: string, ) { - const user = await this.userPasswordService.getUserFromId(userId); + const user = await this.userService.findUserById(userId); if (!user) { throw new UserNotFoundError(); @@ -32,6 +32,6 @@ export class PasswordService { throw new BadPasswordError(); } - await this.userPasswordService.updateUserPassword(userId, newPassword); + await this.userService.updatePassword(userId, newPassword); } } diff --git a/libs/nestjs/password/src/services/reset-password.service.ts b/libs/nestjs/password/src/services/reset-password.service.ts deleted file mode 100644 index 251e23c8d..000000000 --- a/libs/nestjs/password/src/services/reset-password.service.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { Inject, Injectable } from '@nestjs/common'; -import { REQUEST } from '@nestjs/core'; -import { JwtService } from '@nestjs/jwt'; -import { User } from '@prisma/client'; - -import { DEFAULT_RESET_PASSWORD_LINK } from '../constants'; -import { BadResetCodeError } from '../errors'; -import { PasswordModuleOptions, UserInfo } from '../interfaces'; -import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; -import { UserPasswordService } from './user-password.service'; - -import { UserNotFoundError } from '@trxn/nestjs-authentication'; - -@Injectable() -export class ResetPasswordService { - constructor( - @Inject(REQUEST) private request: Record, - @Inject(MODULE_OPTIONS_TOKEN) - private readonly passwordConfig: PasswordModuleOptions, - private readonly jwtService: JwtService, - private readonly userPasswordService: UserPasswordService, - ) {} - - /** - * Send a reset code to the user's email - * @param user User The user to send the reset code to (id email and password are required) - */ - async requestResetPassword( - login: string, - ): Promise<{ link: string; resetCode: string }> { - const user = await this.userPasswordService.getUserFromLogin(login); - - if (!user) { - throw new UserNotFoundError(); - } - - // We first generate the reset code and get a JWT Token - const resetCode = this.createResetCode(user); - - const resetPasswordLink = - this.passwordConfig.resetPasswordLinkFactory || - DEFAULT_RESET_PASSWORD_LINK; - - const link = await Promise.resolve( - typeof resetPasswordLink === 'string' - ? resetPasswordLink - .replace('{{id}}', `${user.id}`) - .replace('{{code}}', resetCode) - : resetPasswordLink( - this.request, - resetCode, - this.userPasswordService.getUserFromUserInfo(user), - ), - ); - - if (this.passwordConfig.resetPasswordSendEmail?.request) { - // We call the method to send the email and wait for the response - await Promise.resolve( - this.passwordConfig.resetPasswordSendEmail.request( - link, - resetCode, - this.userPasswordService.getUserFromUserInfo(user), - ), - ); - } - - return { link, resetCode }; - } - - getUserSecret({ id, email, password }: UserInfo) { - return `${id}-${password}-${email}`; - } - - createResetCode({ id, email, password }: UserInfo): string { - return this.jwtService.sign( - { sub: id }, - { - expiresIn: this.passwordConfig.resetPasswordExpiresIn || '24h', - secret: this.getUserSecret({ id, email, password }), - }, - ); - } - - verifyResetCode( - { id, email, password }: UserInfo, - resetCode: string, - ): Promise<{ sub: User['id'] }> { - return this.jwtService.verifyAsync(resetCode, { - secret: this.getUserSecret({ id, email, password }), - }); - } - - async reset( - userId: string | number, - resetCode: string, - resetPassword: string, - ): Promise { - const user = await this.userPasswordService.getUserFromId(userId); - - if (!user) { - throw new UserNotFoundError(); - } - - try { - const payload = await this.verifyResetCode(user, resetCode); - if (payload.sub !== user.id) throw new Error(); - } catch { - throw new BadResetCodeError(); - } - - await this.userPasswordService.updateUserPassword(userId, resetPassword); - - if (this.passwordConfig.resetPasswordSendEmail?.updated) { - // We call the method to send the email and wait for the response - await Promise.resolve( - this.passwordConfig.resetPasswordSendEmail.updated( - this.userPasswordService.getUserFromUserInfo(user), - ), - ); - } - } -} diff --git a/libs/nestjs/password/src/services/user-password.service.spec.ts b/libs/nestjs/password/src/services/user-password.service.spec.ts deleted file mode 100644 index 664532b32..000000000 --- a/libs/nestjs/password/src/services/user-password.service.spec.ts +++ /dev/null @@ -1,272 +0,0 @@ -/* eslint-disable @typescript-eslint/unbound-method */ - -import { Test, TestingModule } from '@nestjs/testing'; -import { Prisma, User } from '@prisma/client'; -import { mockDeep, MockProxy, mockReset } from 'jest-mock-extended'; - -import { PasswordModuleOptions } from '../interfaces'; -import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; -import { UserPasswordService } from './user-password.service'; - -import { LoggerModule } from '@trxn/nestjs-core'; - -describe('UserPasswordService', () => { - let userPasswordService: UserPasswordService; - let mockPasswordModuleOptions: MockProxy; - let mockUserService: MockProxy>; - - beforeEach(async () => { - mockUserService = mockDeep>(); - mockPasswordModuleOptions = mockDeep({ - userService: mockUserService, - }); - - const module: TestingModule = await Test.createTestingModule({ - imports: [LoggerModule], - providers: [ - UserPasswordService, - { - provide: MODULE_OPTIONS_TOKEN, - useValue: mockPasswordModuleOptions, - }, - ], - }).compile(); - - userPasswordService = module.get(UserPasswordService); - }); - - afterEach(() => { - mockReset(mockPasswordModuleOptions); - mockReset(mockUserService); - }); - - it('should be defined', () => { - expect(userPasswordService).toBeDefined(); - }); - - it('should get the fields from the configuration', async () => { - mockPasswordModuleOptions.user = undefined; - - let res = userPasswordService.getUserFromUserInfo({ - id: 'id', - email: 'email', - password: 'password', - }); - - expect(res).toEqual({ - id: 'id', - email: 'email', - password: 'password', - }); - - mockPasswordModuleOptions.user = {}; - - res = userPasswordService.getUserFromUserInfo({ - id: 'id', - email: 'email', - password: 'password', - }); - - expect(res).toEqual({ - id: 'id', - email: 'email', - password: 'password', - }); - }); - - describe('getUserFromUserInfo', () => { - it('should get the user from the user info', async () => { - const { id, email, password } = { - id: 'id', - email: 'email', - password: 'password', - }; - - mockPasswordModuleOptions.user = { - fields: { - id: 'idField', - email: 'emailField', - password: 'passwordField', - }, - }; - - const result = userPasswordService.getUserFromUserInfo({ - id, - email, - password, - }); - expect(result).toEqual({ - idField: id, - emailField: email, - passwordField: password, - }); - }); - }); - describe('getUserFromId', () => { - it('should return a user with the default options', async () => { - mockUserService.findUnique.mockResolvedValue({ - id: '1', - email: 'email', - password: 'password', - otherField: 'otherField', - } as unknown as User); - - const res = await userPasswordService.getUserFromId('1'); - - expect(res).toEqual({ - id: '1', - email: 'email', - password: 'password', - }); - - expect(mockUserService.findUnique).toHaveBeenCalledWith({ - where: { id: '1' }, - select: { id: true, email: true, password: true }, - }); - }); - - it('should return a user using the options set during the module configuration', async () => { - mockPasswordModuleOptions.user = { - fields: { - id: 'idField', - email: 'loginField', - password: 'passwordField', - }, - }; - - mockUserService.findUnique.mockResolvedValue({ - idField: '1', - loginField: 'email', - passwordField: 'password', - otherField: 'otherField', - } as unknown as User); - - const res = await userPasswordService.getUserFromId('1'); - - expect(res).toEqual({ - id: '1', - email: 'email', - password: 'password', - }); - - expect(mockUserService.findUnique).toHaveBeenCalledWith({ - where: { idField: '1' }, - select: { idField: true, loginField: true, passwordField: true }, - }); - }); - - it('should return null if the user is not found from findUnique', async () => { - mockUserService.findUnique.mockResolvedValue(null); - const res = await userPasswordService.getUserFromId('1'); - - expect(res).toBeNull(); - }); - - it('should return null if findUnique does not return all the information needed', async () => { - mockUserService.findUnique.mockResolvedValue({ - id: 'id ', - } as unknown as User); - const res = await userPasswordService.getUserFromId('1'); - - expect(res).toBeNull(); - }); - }); - - describe('getUserFromLogin', () => { - it('should return a user with the default options', async () => { - mockUserService.findUnique.mockResolvedValue({ - id: '1', - email: 'email', - password: 'password', - otherField: 'otherField', - } as unknown as User); - - const res = await userPasswordService.getUserFromLogin('email'); - - expect(res).toEqual({ - id: '1', - email: 'email', - password: 'password', - }); - - expect(mockUserService.findUnique).toHaveBeenCalledWith({ - where: { email: 'email' }, - select: { id: true, email: true, password: true }, - }); - }); - - it('should return a user using the options set during the module configuration', async () => { - mockPasswordModuleOptions.user = { - fields: { - id: 'idField', - email: 'loginField', - password: 'passwordField', - }, - }; - - mockUserService.findUnique.mockResolvedValue({ - idField: '1', - loginField: 'email', - passwordField: 'password', - otherField: 'otherField', - } as unknown as User); - - const res = await userPasswordService.getUserFromLogin('email'); - - expect(res).toEqual({ - id: '1', - email: 'email', - password: 'password', - }); - - expect(mockUserService.findUnique).toHaveBeenCalledWith({ - where: { loginField: 'email' }, - select: { idField: true, loginField: true, passwordField: true }, - }); - }); - - it('should return null if the user is not found from findUnique', async () => { - mockUserService.findUnique.mockResolvedValue(null); - const res = await userPasswordService.getUserFromLogin('email'); - - expect(res).toBeNull(); - }); - - it('should return null if findUnique does not return all the information needed', async () => { - mockUserService.findUnique.mockResolvedValue({ - id: 'id ', - } as unknown as User); - const res = await userPasswordService.getUserFromLogin('email'); - - expect(res).toBeNull(); - }); - }); - - describe('updateUserPassword', () => { - it('should return a user with the default options', async () => { - await userPasswordService.updateUserPassword('1', 'new'); - - expect(mockUserService.update).toHaveBeenCalledWith({ - where: { id: '1' }, - data: { password: 'new' }, - }); - }); - - it('should return a user using the options set during the module configuration', async () => { - mockPasswordModuleOptions.user = { - fields: { - id: 'idField', - email: 'loginField', - password: 'passwordField', - }, - }; - - await userPasswordService.updateUserPassword('1', 'new'); - - expect(mockUserService.update).toHaveBeenCalledWith({ - where: { idField: '1' }, - data: { passwordField: 'new' }, - }); - }); - }); -}); diff --git a/libs/nestjs/password/src/services/user-password.service.ts b/libs/nestjs/password/src/services/user-password.service.ts deleted file mode 100644 index 7182a10e2..000000000 --- a/libs/nestjs/password/src/services/user-password.service.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { Inject, Injectable, Logger } from '@nestjs/common'; - -import { PasswordModuleOptions, UserInfo } from '../interfaces'; -import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; - -import { LoggerService } from '@trxn/nestjs-core'; - -@Injectable() -export class UserPasswordService { - constructor( - @Inject(MODULE_OPTIONS_TOKEN) - private readonly passwordConfig: PasswordModuleOptions, - @Inject(Logger) private readonly logger: LoggerService, - ) { - logger.setContext(UserPasswordService.name); - } - - private get userService() { - return this.passwordConfig.userService; - } - - private get fields() { - return { - id: 'id', - email: 'email', - password: 'password', - ...(this.passwordConfig.user?.fields || {}), - }; - } - - getUserFromUserInfo(user: UserInfo) { - return { - [this.fields.id]: user.id, - [this.fields.email]: user.email, - [this.fields.password]: user.password, - }; - } - - checkUserInfo(user: UserInfo | null): UserInfo | null { - if (!user) { - this.logger.debug(`User not found`); - return null; - } - - const { id, email, password } = { - id: user[this.fields.id as 'id'], - email: user[this.fields.email as 'email'], - password: user[this.fields.password as 'password'], - }; - - if (!id || !password || !email) { - this.logger.debug(`id, password or email information not found`, user); - return null; - } - - return { id, email, password }; - } - - async getUserFromLogin(login: string): Promise { - this.logger.debug(`Getting user from login ${login}`); - const user = (await this.userService.findUnique({ - where: { - [this.fields.email]: login, - }, - select: { - [this.fields.id]: true, - [this.fields.email]: true, - [this.fields.password]: true, - }, - })) as UserInfo | null; - - return this.checkUserInfo(user); - } - - async getUserFromId(userId: string | number): Promise { - this.logger.debug(`Getting user from id ${userId}`); - const user = (await this.userService.findUnique({ - where: { - [this.fields.id]: userId, - }, - select: { - [this.fields.id]: true, - [this.fields.email]: true, - [this.fields.password]: true, - }, - })) as UserInfo | null; - - return this.checkUserInfo(user); - } - - updateUserPassword(userId: string | number, newPassword: string) { - this.logger.debug(`Updating user password for id ${userId}`); - return this.userService.update({ - where: { - [this.fields.id]: userId, - }, - data: { - [this.fields.password]: newPassword, - }, - }); - } -} diff --git a/libs/nestjs/request-timestamp/CHANGELOG.md b/libs/nestjs/request-timestamp/CHANGELOG.md index 6294d5622..f5ab7619f 100644 --- a/libs/nestjs/request-timestamp/CHANGELOG.md +++ b/libs/nestjs/request-timestamp/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/request-timestamp/package.json b/libs/nestjs/request-timestamp/package.json index 2803c9da8..c9ee6fcfb 100644 --- a/libs/nestjs/request-timestamp/package.json +++ b/libs/nestjs/request-timestamp/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-request-timestamp", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/reset-password/.babelrc b/libs/nestjs/reset-password/.babelrc new file mode 100644 index 000000000..b63f0528f --- /dev/null +++ b/libs/nestjs/reset-password/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/js/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/nestjs/reset-password/.eslintrc.json b/libs/nestjs/reset-password/.eslintrc.json new file mode 100644 index 000000000..3456be9b9 --- /dev/null +++ b/libs/nestjs/reset-password/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/nestjs/reset-password/CHANGELOG.md b/libs/nestjs/reset-password/CHANGELOG.md new file mode 100644 index 000000000..21de4d95e --- /dev/null +++ b/libs/nestjs/reset-password/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog + +This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). + +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* resolve conversation and make the api start without settings env ([87d4465](https://github.com/tractr/traxion/commit/87d446509dd3c182c92a9d269dfbe24a826899ec)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Bug Fixes + +* resolve conversation and make the api start without settings env ([87d4465](https://github.com/tractr/traxion/commit/87d446509dd3c182c92a9d269dfbe24a826899ec)) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) diff --git a/libs/nestjs/reset-password/README.md b/libs/nestjs/reset-password/README.md new file mode 100644 index 000000000..9b704b047 --- /dev/null +++ b/libs/nestjs/reset-password/README.md @@ -0,0 +1,12 @@ +# nestjs-reset-password + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build nestjs-reset-password` to build the library. + +## Running unit tests + +Run `nx test nestjs-reset-password` to execute the unit tests via +[Jest](https://jestjs.io). diff --git a/libs/nestjs/reset-password/jest.config.ts b/libs/nestjs/reset-password/jest.config.ts new file mode 100644 index 000000000..dced5e778 --- /dev/null +++ b/libs/nestjs/reset-password/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'nestjs-reset-password', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../../coverage/libs/nestjs/reset-password', +}; diff --git a/libs/nestjs/reset-password/package.json b/libs/nestjs/reset-password/package.json new file mode 100644 index 000000000..508d3541e --- /dev/null +++ b/libs/nestjs/reset-password/package.json @@ -0,0 +1,13 @@ +{ + "name": "@trxn/nestjs-reset-password", + "version": "2.1.0-next.1", + "repository": { + "type": "git", + "url": "https://github.com/tractr/traxion" + }, + "type": "commonjs", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + } +} diff --git a/libs/nestjs/reset-password/project.json b/libs/nestjs/reset-password/project.json new file mode 100644 index 000000000..d544bc13d --- /dev/null +++ b/libs/nestjs/reset-password/project.json @@ -0,0 +1,53 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "nestjs-reset-password", + "projectType": "library", + "sourceRoot": "libs/nestjs/reset-password/src", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "options": { + "assets": ["libs/nestjs/reset-password/*.md"], + "main": "libs/nestjs/reset-password/src/index.ts", + "outputPath": "dist/libs/nestjs/reset-password", + "packageJson": "libs/nestjs/reset-password/package.json", + "tsConfig": "libs/nestjs/reset-password/tsconfig.lib.json" + }, + "outputs": ["{options.outputPath}"] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/nestjs/reset-password/**/*.ts"] + }, + "outputs": ["{options.outputFile}"] + }, + "publish": { + "executor": "ngx-deploy-npm:deploy", + "options": { + "access": "public" + } + }, + "test": { + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + }, + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/nestjs/reset-password/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"] + }, + "update-peer-dependencies": { + "executor": "./dist/libs/schematics:update-peer-dependencies", + "options": { + "packageJsonPath": "{workspaceRoot}/dist/libs/nestjs/reset-password/package.json" + } + } + } +} diff --git a/libs/nestjs/reset-password/src/constants/index.ts b/libs/nestjs/reset-password/src/constants/index.ts new file mode 100644 index 000000000..626defce4 --- /dev/null +++ b/libs/nestjs/reset-password/src/constants/index.ts @@ -0,0 +1 @@ +export * from './reset-password.constant'; diff --git a/libs/nestjs/mailer/src/lib/constants/reset-password-send-email.constant.ts b/libs/nestjs/reset-password/src/constants/reset-password.constant.ts similarity index 81% rename from libs/nestjs/mailer/src/lib/constants/reset-password-send-email.constant.ts rename to libs/nestjs/reset-password/src/constants/reset-password.constant.ts index 2a8ee8de0..ccf1bcf9f 100644 --- a/libs/nestjs/mailer/src/lib/constants/reset-password-send-email.constant.ts +++ b/libs/nestjs/reset-password/src/constants/reset-password.constant.ts @@ -1,4 +1,6 @@ -export const DEFAULT_RESET_HTML = ` +export const DEFAULT_RESET_PASSWORD_LINK = `/password/reset/{{id}}/{{code}}`; + +export const DEFAULT_RESET_PASSWORD_REQUEST_EMAIL_HTML = ` @@ -15,7 +17,7 @@ export const DEFAULT_RESET_HTML = ` `; -export const DEFAULT_UPDATED_HTML = ` +export const DEFAULT_RESET_PASSWORD_SUCCEED_EMAIL_HTML = ` diff --git a/libs/nestjs/reset-password/src/controllers/index.ts b/libs/nestjs/reset-password/src/controllers/index.ts new file mode 100644 index 000000000..019ebf075 --- /dev/null +++ b/libs/nestjs/reset-password/src/controllers/index.ts @@ -0,0 +1 @@ +export * from './reset-password.controller'; diff --git a/libs/nestjs/password/src/controllers/reset-password.controller.spec.ts b/libs/nestjs/reset-password/src/controllers/reset-password.controller.spec.ts similarity index 97% rename from libs/nestjs/password/src/controllers/reset-password.controller.spec.ts rename to libs/nestjs/reset-password/src/controllers/reset-password.controller.spec.ts index e3be84923..2fb215212 100644 --- a/libs/nestjs/password/src/controllers/reset-password.controller.spec.ts +++ b/libs/nestjs/reset-password/src/controllers/reset-password.controller.spec.ts @@ -3,9 +3,9 @@ import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy } from 'jest-mock-extended'; import * as request from 'supertest'; +import { ResetPasswordController } from './reset-password.controller'; import { BadResetCodeError } from '../errors'; import { ResetPasswordService } from '../services'; -import { ResetPasswordController } from './reset-password.controller'; import { UserNotFoundError } from '@trxn/nestjs-authentication'; @@ -46,11 +46,11 @@ describe('ResetPassword Controller', () => { await request(app.getHttpServer()) .post('/password/reset') .send({ - login: 'login', + id: '1', }) .expect(204); - expect(spyRequestUpdatePassword).toHaveBeenCalledWith('login'); + expect(spyRequestUpdatePassword).toHaveBeenCalledWith('1'); }); it('should swallow the error if a user is not found', async () => { diff --git a/libs/nestjs/password/src/controllers/reset-password.controller.ts b/libs/nestjs/reset-password/src/controllers/reset-password.controller.ts similarity index 90% rename from libs/nestjs/password/src/controllers/reset-password.controller.ts rename to libs/nestjs/reset-password/src/controllers/reset-password.controller.ts index 3753ae889..800dd024b 100644 --- a/libs/nestjs/password/src/controllers/reset-password.controller.ts +++ b/libs/nestjs/reset-password/src/controllers/reset-password.controller.ts @@ -22,10 +22,10 @@ export class ResetPasswordController { @Post() @HttpCode(204) async resetRequested( - @Body() { login }: PasswordResetRequestedDto, + @Body() { id }: PasswordResetRequestedDto, ): Promise { try { - await this.resetPasswordService.requestResetPassword(login); + await this.resetPasswordService.requestResetPassword(id); } catch (e) { // We should never send information about a user not found if (e instanceof UserNotFoundError) return; diff --git a/libs/nestjs/reset-password/src/dtos/index.ts b/libs/nestjs/reset-password/src/dtos/index.ts new file mode 100644 index 000000000..20e0864ee --- /dev/null +++ b/libs/nestjs/reset-password/src/dtos/index.ts @@ -0,0 +1,2 @@ +export * from './password-reset-requested.dto'; +export * from './password-reset.dto'; diff --git a/libs/nestjs/password/src/dtos/password-reset-requested.dto.ts b/libs/nestjs/reset-password/src/dtos/password-reset-requested.dto.ts similarity index 80% rename from libs/nestjs/password/src/dtos/password-reset-requested.dto.ts rename to libs/nestjs/reset-password/src/dtos/password-reset-requested.dto.ts index cef9b4fc9..e952d655c 100644 --- a/libs/nestjs/password/src/dtos/password-reset-requested.dto.ts +++ b/libs/nestjs/reset-password/src/dtos/password-reset-requested.dto.ts @@ -2,5 +2,5 @@ import { IsString } from 'class-validator'; export class PasswordResetRequestedDto { @IsString() - login!: string; + id!: number | string; } diff --git a/libs/nestjs/password/src/dtos/password-reset.dto.ts b/libs/nestjs/reset-password/src/dtos/password-reset.dto.ts similarity index 87% rename from libs/nestjs/password/src/dtos/password-reset.dto.ts rename to libs/nestjs/reset-password/src/dtos/password-reset.dto.ts index 24b4d744c..cd918bf7f 100644 --- a/libs/nestjs/password/src/dtos/password-reset.dto.ts +++ b/libs/nestjs/reset-password/src/dtos/password-reset.dto.ts @@ -2,7 +2,7 @@ import { IsString } from 'class-validator'; export class PasswordResetDto { @IsString() - id!: string; + id!: string | number; @IsString() code!: string; diff --git a/libs/nestjs/password/src/errors/bad-reset-code.error.spec.ts b/libs/nestjs/reset-password/src/errors/bad-reset-code.error.spec.ts similarity index 100% rename from libs/nestjs/password/src/errors/bad-reset-code.error.spec.ts rename to libs/nestjs/reset-password/src/errors/bad-reset-code.error.spec.ts diff --git a/libs/nestjs/password/src/errors/bad-reset-code.error.ts b/libs/nestjs/reset-password/src/errors/bad-reset-code.error.ts similarity index 100% rename from libs/nestjs/password/src/errors/bad-reset-code.error.ts rename to libs/nestjs/reset-password/src/errors/bad-reset-code.error.ts diff --git a/libs/nestjs/reset-password/src/errors/index.ts b/libs/nestjs/reset-password/src/errors/index.ts new file mode 100644 index 000000000..a6f77bd24 --- /dev/null +++ b/libs/nestjs/reset-password/src/errors/index.ts @@ -0,0 +1 @@ +export * from './bad-reset-code.error'; diff --git a/libs/nestjs/reset-password/src/index.ts b/libs/nestjs/reset-password/src/index.ts new file mode 100644 index 000000000..261fdc334 --- /dev/null +++ b/libs/nestjs/reset-password/src/index.ts @@ -0,0 +1,8 @@ +export * from './constants'; +export * from './controllers'; +export * from './dtos'; +export * from './errors'; +export * from './interfaces'; +export * from './services'; +export * from './reset-password.module'; +export * from './reset-password.module-definition'; diff --git a/libs/nestjs/reset-password/src/interfaces/index.ts b/libs/nestjs/reset-password/src/interfaces/index.ts new file mode 100644 index 000000000..998bed155 --- /dev/null +++ b/libs/nestjs/reset-password/src/interfaces/index.ts @@ -0,0 +1 @@ +export * from './reset-password-module-options.interface'; diff --git a/libs/nestjs/reset-password/src/interfaces/reset-password-module-options.interface.ts b/libs/nestjs/reset-password/src/interfaces/reset-password-module-options.interface.ts new file mode 100644 index 000000000..aa4185052 --- /dev/null +++ b/libs/nestjs/reset-password/src/interfaces/reset-password-module-options.interface.ts @@ -0,0 +1,58 @@ +import { JwtModuleOptions } from '@nestjs/jwt'; + +import { SendEmailParams } from '@trxn/nestjs-mailer'; +import { MinimalUser } from '@trxn/nestjs-user'; + +export type LinkFactory = + | (( + request: Record, + resetCode: string, + user: U, + ) => Promise | string) + | string; + +export type UserSecretFactory = ( + request: Record, + user: U, +) => Promise | string; + +export type RequestPasswordEmailParams = { + from: string; + to: string; + subject: string; + context: Record & { + email: string; + link: string; + resetCode: string; + }; + html: string; +}; + +export type UpdatePasswordSuccessEmailParams = { + from: string; + to: string; + subject: string; + context: Record & { + email: string; + }; + html: string; +}; + +export interface ResetPasswordModuleOptions { + expiresIn?: string | number | undefined; + + linkFactory?: LinkFactory; + userSecretFactory?: UserSecretFactory; + + from: string; + + requestPasswordEmailParams?: ( + defaultEmailParams: RequestPasswordEmailParams, + ) => SendEmailParams; + + updatePasswordSuccessEmailParams?: ( + defaultEmailParams: UpdatePasswordSuccessEmailParams, + ) => SendEmailParams; + + jwtModuleOptions?: JwtModuleOptions; +} diff --git a/libs/nestjs/reset-password/src/reset-password.module-definition.ts b/libs/nestjs/reset-password/src/reset-password.module-definition.ts new file mode 100644 index 000000000..47c026364 --- /dev/null +++ b/libs/nestjs/reset-password/src/reset-password.module-definition.ts @@ -0,0 +1,44 @@ +import { ConfigurableModuleBuilder } from '@nestjs/common'; + +import { ResetPasswordModuleOptions } from './interfaces'; + +import { + addImportsAndProvidersExtra, + addProviderWithInjectionTokenExtra, + ImportsExtra, + ProvidersExtra, + ProviderWithInjectionToken, +} from '@trxn/nestjs-core'; +import { MailerService } from '@trxn/nestjs-mailer'; +import { USER_SERVICE, UserService } from '@trxn/nestjs-user'; + +export const { + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + ASYNC_OPTIONS_TYPE, + OPTIONS_TYPE, +} = new ConfigurableModuleBuilder() + .setExtras< + ImportsExtra & + ProvidersExtra & { + MailerService?: ProviderWithInjectionToken< + typeof MailerService, + MailerService + >; + UserService?: ProviderWithInjectionToken< + typeof USER_SERVICE, + UserService + >; + } + >( + { imports: [], providers: [] }, + addImportsAndProvidersExtra( + (definition, { UserService: User, MailerService: Mailer }) => + addProviderWithInjectionTokenExtra( + addProviderWithInjectionTokenExtra(definition, USER_SERVICE, User), + MailerService, + Mailer, + ), + ), + ) + .build(); diff --git a/libs/nestjs/reset-password/src/reset-password.module.spec.ts b/libs/nestjs/reset-password/src/reset-password.module.spec.ts new file mode 100644 index 000000000..cfa07fd11 --- /dev/null +++ b/libs/nestjs/reset-password/src/reset-password.module.spec.ts @@ -0,0 +1,78 @@ +import { INestApplication } from '@nestjs/common'; +import { Test, TestingModule } from '@nestjs/testing'; +import { mockDeep, MockProxy } from 'jest-mock-extended'; + +import { ResetPasswordModule } from './reset-password.module'; +import { ResetPasswordService } from './services'; + +import { MailerService } from '@trxn/nestjs-mailer'; +import { UserService } from '@trxn/nestjs-user'; + +describe('Password Module ', () => { + let app: INestApplication; + let mockUserService: MockProxy; + let mockMailerService: MockProxy; + + it('should load the module when using register', async () => { + mockUserService = mockDeep(); + mockMailerService = mockDeep(); + + const moduleFixture: TestingModule = await Test.createTestingModule({ + imports: [ + ResetPasswordModule.register({ + from: 'test', + providers: [ + { provide: UserService, useValue: mockUserService }, + { provide: MailerService, useValue: mockMailerService }, + ], + }), + ], + providers: [], + }).compile(); + + app = moduleFixture.createNestApplication(); + await app.init(); + + const resetPasswordService = app.get(ResetPasswordService); + expect(resetPasswordService).toBeInstanceOf(ResetPasswordService); + }); + + it('should load the module when using registerAsync', async () => { + mockUserService = mockDeep(); + mockMailerService = mockDeep(); + + const moduleFixture: TestingModule = await Test.createTestingModule({ + imports: [ + ResetPasswordModule.registerAsync({ + providers: [ + { provide: UserService, useValue: mockUserService }, + { provide: MailerService, useValue: mockMailerService }, + ], + useFactory: () => ({ + from: 'test', + }), + }), + ], + providers: [], + }).compile(); + + app = moduleFixture.createNestApplication(); + await app.init(); + + const resetPasswordService = app.get(ResetPasswordService); + expect(resetPasswordService).toBeInstanceOf(ResetPasswordService); + }); + + it('should throw an error if you do not provide MailerService or UserService', async () => { + await expect( + Test.createTestingModule({ + imports: [ + ResetPasswordModule.register({ + from: 'test', + }), + ], + providers: [], + }).compile(), + ).rejects.toThrowError(); + }); +}); diff --git a/libs/nestjs/reset-password/src/reset-password.module.ts b/libs/nestjs/reset-password/src/reset-password.module.ts new file mode 100644 index 000000000..9581d70b2 --- /dev/null +++ b/libs/nestjs/reset-password/src/reset-password.module.ts @@ -0,0 +1,59 @@ +import { DynamicModule, Module } from '@nestjs/common'; +import { JwtModule } from '@nestjs/jwt'; + +import { ResetPasswordModuleOptions } from './interfaces'; +import { + ASYNC_OPTIONS_TYPE, + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + OPTIONS_TYPE, +} from './reset-password.module-definition'; +import { ResetPasswordService } from './services'; + +import { BcryptModule } from '@trxn/nestjs-bcrypt'; +import { LoggerModule } from '@trxn/nestjs-core'; + +@Module({ + imports: [LoggerModule, BcryptModule.register({})], + providers: [ResetPasswordService], + exports: [ResetPasswordService], +}) +export class ResetPasswordModule extends ConfigurableModuleClass { + static createModule(module: DynamicModule): DynamicModule { + // FIXME: When https://github.com/nestjs/jwt/pull/1065 is merged, this can be simplified to: + // Should remove this moduleOptions variables + const moduleOptions = { + ...module, + module: ConfigurableModuleClass, + exports: module.providers, + }; + + return { + ...module, + imports: [ + ...(module.imports || []), + JwtModule.registerAsync({ + // FIXME: When https://github.com/nestjs/jwt/pull/1065 is merged, this can be simplified to: + // useFactory: (passwordModuleOptions: PasswordModuleOptions) => + // passwordModuleOptions?.jwtModuleOptions || {}, + // provideInjectionTokensFrom: module.providers, + inject: [MODULE_OPTIONS_TOKEN], + imports: [moduleOptions], + useFactory: (passwordModuleOptions: ResetPasswordModuleOptions) => + passwordModuleOptions?.jwtModuleOptions || {}, + }), + ], + exports: [...(module.exports || []), JwtModule], + }; + } + + static register(options: typeof OPTIONS_TYPE): DynamicModule { + const resetPasswordOptionsModule = super.register(options); + return this.createModule(resetPasswordOptionsModule); + } + + static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule { + const resetPasswordOptionsModule = super.registerAsync(options); + return this.createModule(resetPasswordOptionsModule); + } +} diff --git a/libs/nestjs/reset-password/src/services/index.ts b/libs/nestjs/reset-password/src/services/index.ts new file mode 100644 index 000000000..95da999f5 --- /dev/null +++ b/libs/nestjs/reset-password/src/services/index.ts @@ -0,0 +1 @@ +export * from './reset-password.service'; diff --git a/libs/nestjs/password/src/services/reset-password.service.spec.ts b/libs/nestjs/reset-password/src/services/reset-password.service.spec.ts similarity index 59% rename from libs/nestjs/password/src/services/reset-password.service.spec.ts rename to libs/nestjs/reset-password/src/services/reset-password.service.spec.ts index e92e95acf..b83ba998e 100644 --- a/libs/nestjs/password/src/services/reset-password.service.spec.ts +++ b/libs/nestjs/reset-password/src/services/reset-password.service.spec.ts @@ -1,32 +1,46 @@ +/* eslint-disable @typescript-eslint/unbound-method */ +import { INestApplication } from '@nestjs/common'; import { REQUEST } from '@nestjs/core'; import { JwtService } from '@nestjs/jwt'; import { Test, TestingModule } from '@nestjs/testing'; import { mockDeep, MockProxy } from 'jest-mock-extended'; -import { BadResetCodeError } from '../errors'; -import { PasswordModuleOptions } from '../interfaces'; -import { MODULE_OPTIONS_TOKEN } from '../password.module-definition'; import { ResetPasswordService } from './reset-password.service'; -import { UserPasswordService } from './user-password.service'; +import { BadResetCodeError } from '../errors'; +import { ResetPasswordModuleOptions } from '../interfaces'; +import { MODULE_OPTIONS_TOKEN } from '../reset-password.module-definition'; import { UserNotFoundError } from '@trxn/nestjs-authentication'; +import { MailerService } from '@trxn/nestjs-mailer'; +import { MinimalUser, UserService } from '@trxn/nestjs-user'; describe('ResetPasswordService', () => { + let app: INestApplication; let resetPasswordService: ResetPasswordService; - let mockUserPasswordService: MockProxy; - let mockPasswordModuleOptions: MockProxy; + let mockUserService: MockProxy; + let mockMailerService: MockProxy; + let mockPasswordModuleOptions: MockProxy; let mockJwtService: MockProxy; const mockReq = { headers: {}, hostname: 'localhost' }; beforeEach(async () => { - mockUserPasswordService = mockDeep(); + mockUserService = mockDeep(); mockJwtService = mockDeep(); - mockPasswordModuleOptions = mockDeep({}); + mockPasswordModuleOptions = mockDeep( + { + funcPropSupport: true, + }, + { + from: 'from', + }, + ); + mockMailerService = mockDeep(); const module: TestingModule = await Test.createTestingModule({ providers: [ ResetPasswordService, - { provide: UserPasswordService, useValue: mockUserPasswordService }, + { provide: UserService, useValue: mockUserService }, + { provide: MailerService, useValue: mockMailerService }, { provide: JwtService, useValue: mockJwtService }, { provide: MODULE_OPTIONS_TOKEN, @@ -40,21 +54,26 @@ describe('ResetPasswordService', () => { resetPasswordService = module.get(ResetPasswordService); + + app = module.createNestApplication(); + await app.init(); }); it('should be defined', () => { expect(resetPasswordService).toBeDefined(); }); - describe('getUserSecret', () => { + describe('userSecretFactory', () => { it('should generate a user secret', async () => { - const { id, email, password } = { + const { id, email, password }: MinimalUser = { id: 'id', email: 'email', password: 'password', }; - const userSecret = resetPasswordService.getUserSecret({ + const request = app.get>(REQUEST); + + const userSecret = await resetPasswordService.userSecretFactory(request, { id, email, password, @@ -67,7 +86,7 @@ describe('ResetPasswordService', () => { describe('verifyResetCode', () => { it('should verify with jwtService that a code is good', async () => { - const { id, email, password } = { + const { id, email, password }: MinimalUser = { id: 'id', email: 'email', password: 'password', @@ -76,60 +95,35 @@ describe('ResetPasswordService', () => { mockJwtService.verifyAsync.mockResolvedValue({ sub: id }); await resetPasswordService.verifyResetCode( - { id, email, password }, + `${id}-${password}-${email}`, 'code', ); // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockJwtService.verifyAsync).toHaveBeenCalledWith('code', { - secret: resetPasswordService.getUserSecret({ id, email, password }), + secret: `${id}-${password}-${email}`, }); }); }); - describe('createResetCode', () => { + describe('resetCodeFactory', () => { it('should update the password with the default config value', async () => { - const { id, email, password } = { - id: 'id', - email: 'email', - password: 'password', - }; - - mockPasswordModuleOptions.resetPasswordExpiresIn = undefined; + mockPasswordModuleOptions.expiresIn = undefined; mockJwtService.sign.mockReturnValue('code'); - resetPasswordService.createResetCode({ id, email, password }); + resetPasswordService.resetCodeFactory('id', 'secret'); - // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockJwtService.sign).toHaveBeenCalledWith( - { - sub: 'id', - }, - { - secret: resetPasswordService.getUserSecret({ id, email, password }), - expiresIn: '24h', - }, + { sub: 'id' }, + { secret: 'secret', expiresIn: '24h' }, ); }); it('should update the password', async () => { - const { id, email, password } = { - id: 'id', - email: 'email', - password: 'password', - }; - - mockPasswordModuleOptions.resetPasswordExpiresIn = '1d'; mockJwtService.sign.mockReturnValue('code'); - resetPasswordService.createResetCode({ id, email, password }); + resetPasswordService.resetCodeFactory('id', 'secret', '1d'); - // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockJwtService.sign).toHaveBeenCalledWith( - { - sub: 'id', - }, - { - secret: resetPasswordService.getUserSecret({ id, email, password }), - expiresIn: '1d', - }, + { sub: 'id' }, + { secret: 'secret', expiresIn: '1d' }, ); }); }); @@ -141,27 +135,24 @@ describe('ResetPasswordService', () => { email: 'email', password: 'password', }; - const mockSendRequestEmail = jest.fn(); mockJwtService.sign.mockReturnValue('code'); - mockUserPasswordService.getUserFromLogin.mockResolvedValue({ - id, - email, - password, - }); - mockUserPasswordService.getUserFromUserInfo.mockReturnValue({ + mockUserService.findUserById.mockResolvedValue({ id, email, password, }); const mockResetPasswordLinkFactory = jest.fn().mockResolvedValue('link'); - mockPasswordModuleOptions.resetPasswordLinkFactory = - mockResetPasswordLinkFactory; - mockPasswordModuleOptions.resetPasswordSendEmail = { - request: mockSendRequestEmail, - }; + mockPasswordModuleOptions.linkFactory = mockResetPasswordLinkFactory; + mockPasswordModuleOptions.requestPasswordEmailParams = (params) => ({ + ...params, + context: { + ...params.context, + templateId: 'request-password', + }, + }); - await resetPasswordService.requestResetPassword('email'); + await resetPasswordService.requestResetPassword('1'); expect(mockResetPasswordLinkFactory).toHaveBeenCalledWith( mockReq, @@ -169,15 +160,22 @@ describe('ResetPasswordService', () => { { id, email, password }, ); - expect(mockSendRequestEmail).toHaveBeenCalledWith('link', 'code', { - id, - email, - password, + expect(mockMailerService.send).toHaveBeenCalledWith({ + from: 'from', + to: email, + subject: 'Reset your password', + context: { + email: 'email', + link: 'link', + resetCode: 'code', + templateId: 'request-password', + }, + html: expect.any(String), }); }); it('should throw if the user has not been found', async () => { - mockUserPasswordService.getUserFromId.mockResolvedValue(null); + mockUserService.findUserById.mockResolvedValue(null); await expect(async () => resetPasswordService.requestResetPassword('1'), @@ -193,18 +191,24 @@ describe('ResetPasswordService', () => { password: 'password', }; - const mockSendUpdatedEmail = jest.fn(); - mockJwtService.verifyAsync.mockResolvedValue({ sub: id }); - mockPasswordModuleOptions.resetPasswordSendEmail = { - updated: mockSendUpdatedEmail, - }; - mockUserPasswordService.getUserFromId.mockResolvedValue({ + mockPasswordModuleOptions.updatePasswordSuccessEmailParams = ( + params, + ) => ({ + ...params, + context: { + ...params.context, + templateId: 'templateId', + }, + }); + + mockUserService.getIdFromUser.mockReturnValue(id); + mockUserService.findUserById.mockResolvedValueOnce({ id, email, password, }); - mockUserPasswordService.getUserFromUserInfo.mockReturnValue({ + mockUserService.update.mockResolvedValueOnce({ id, email, password, @@ -212,29 +216,34 @@ describe('ResetPasswordService', () => { await resetPasswordService.reset('id', 'code', 'newPassword'); - expect(mockSendUpdatedEmail).toHaveBeenCalledWith({ - id, - email, - password, + expect(mockMailerService.send).toHaveBeenCalledWith({ + from: 'from', + to: email, + subject: 'Password updated', + context: { + email: 'email', + templateId: 'templateId', + }, + html: expect.any(String), }); }); it('should throw if the user has not been found', async () => { - mockUserPasswordService.getUserFromId.mockResolvedValue(null); + mockUserService.findUserById.mockResolvedValue(null); await expect(async () => resetPasswordService.reset('id', 'code', 'newPassword'), ).rejects.toEqual(new UserNotFoundError('User not found')); }); - it('should throw if the user has not been found', async () => { + it('should throw if the reset code is not correct', async () => { const { id, email, password } = { id: '1', email: 'email', password: 'password', }; - mockUserPasswordService.getUserFromId.mockResolvedValue({ + mockUserService.findUserById.mockResolvedValue({ id, email, password, diff --git a/libs/nestjs/reset-password/src/services/reset-password.service.ts b/libs/nestjs/reset-password/src/services/reset-password.service.ts new file mode 100644 index 000000000..76d40b55f --- /dev/null +++ b/libs/nestjs/reset-password/src/services/reset-password.service.ts @@ -0,0 +1,150 @@ +import { Inject, Injectable } from '@nestjs/common'; +import { REQUEST } from '@nestjs/core'; +import { JwtService } from '@nestjs/jwt'; +import { User } from '@prisma/client'; + +import { + DEFAULT_RESET_PASSWORD_LINK, + DEFAULT_RESET_PASSWORD_REQUEST_EMAIL_HTML, + DEFAULT_RESET_PASSWORD_SUCCEED_EMAIL_HTML, +} from '../constants'; +import { BadResetCodeError } from '../errors'; +import { ResetPasswordModuleOptions } from '../interfaces'; +import { MODULE_OPTIONS_TOKEN } from '../reset-password.module-definition'; + +import { UserNotFoundError } from '@trxn/nestjs-authentication'; +import { MailerService, SendEmailParams } from '@trxn/nestjs-mailer'; +import { MinimalUser, UserId, UserService } from '@trxn/nestjs-user'; + +@Injectable() +export class ResetPasswordService { + constructor( + @Inject(REQUEST) private request: Record, + @Inject(MODULE_OPTIONS_TOKEN) + private readonly resetPasswordModuleOptions: ResetPasswordModuleOptions, + private readonly jwtService: JwtService, + private readonly mailerService: MailerService, + private readonly userService: UserService, + ) {} + + /** + * Send a reset code to the user's email + * @param user User The user to send the reset code to (id email and password are required) + */ + async requestResetPassword(id: UserId): Promise { + const user = await this.userService.findUserById(id); + + if (!user) { + throw new UserNotFoundError(); + } + + const { + from, + expiresIn, + requestPasswordEmailParams = (params: SendEmailParams) => params, + linkFactory = DEFAULT_RESET_PASSWORD_LINK, + userSecretFactory = this.userSecretFactory.bind(this), + } = this.resetPasswordModuleOptions; + + const userId = this.userService.getIdFromUser(user); + + const resetCode = this.resetCodeFactory( + userId, + await userSecretFactory(this.request, user), + expiresIn, + ); + + const link = await Promise.resolve( + typeof linkFactory === 'string' + ? linkFactory + .replace('{{id}}', `${userId}`) + .replace('{{code}}', resetCode) + : linkFactory(this.request, resetCode, user), + ); + + await this.mailerService.send( + requestPasswordEmailParams({ + from, + to: user.email, + subject: 'Reset your password', + context: { + email: user.email, + link, + resetCode, + }, + html: DEFAULT_RESET_PASSWORD_REQUEST_EMAIL_HTML, + }), + ); + } + + async reset( + userId: UserId, + resetCode: string, + resetPassword: string, + ): Promise { + const user = await this.userService.findUserById(userId); + + if (!user) { + throw new UserNotFoundError(); + } + + const { + from, + updatePasswordSuccessEmailParams = (params: SendEmailParams) => params, + userSecretFactory = this.userSecretFactory.bind(this), + } = this.resetPasswordModuleOptions; + + try { + const payload = await this.verifyResetCode( + await userSecretFactory(this.request, user), + resetCode, + ); + + if (!payload.sub || payload.sub !== this.userService.getIdFromUser(user)) + throw new Error(); + } catch { + throw new BadResetCodeError(); + } + + await this.userService.updatePassword(userId, resetPassword); + + await this.mailerService.send( + updatePasswordSuccessEmailParams({ + from, + to: user.email, + subject: 'Password updated', + context: { + email: user.email, + }, + html: DEFAULT_RESET_PASSWORD_SUCCEED_EMAIL_HTML, + }), + ); + } + + async userSecretFactory( + request: Record, + { id, email, password }: MinimalUser, + ) { + return `${id}-${password}-${email}`; + } + + resetCodeFactory( + id: UserId, + secret: string, + expiresIn?: string | number, + ): string { + return this.jwtService.sign( + { sub: id }, + { expiresIn: expiresIn || '24h', secret }, + ); + } + + verifyResetCode( + secret: string, + resetCode: string, + ): Promise<{ sub: User['id'] }> { + return this.jwtService.verifyAsync(resetCode, { + secret, + }); + } +} diff --git a/libs/nestjs/reset-password/tsconfig.json b/libs/nestjs/reset-password/tsconfig.json new file mode 100644 index 000000000..a3ee1b600 --- /dev/null +++ b/libs/nestjs/reset-password/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs" + }, + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/nestjs/reset-password/tsconfig.lib.json b/libs/nestjs/reset-password/tsconfig.lib.json new file mode 100644 index 000000000..ee746f31b --- /dev/null +++ b/libs/nestjs/reset-password/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "outDir": "../../../dist/out-tsc", + "target": "es6", + "types": ["node"] + }, + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"] +} diff --git a/libs/nestjs/reset-password/tsconfig.spec.json b/libs/nestjs/reset-password/tsconfig.spec.json new file mode 100644 index 000000000..817250600 --- /dev/null +++ b/libs/nestjs/reset-password/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "types": ["jest", "node"] + }, + "extends": "./tsconfig.json", + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/libs/nestjs/sentry/CHANGELOG.md b/libs/nestjs/sentry/CHANGELOG.md index ba550ed2b..46f9577c8 100644 --- a/libs/nestjs/sentry/CHANGELOG.md +++ b/libs/nestjs/sentry/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/sentry/package.json b/libs/nestjs/sentry/package.json index 7e88a50a1..c58d88d26 100644 --- a/libs/nestjs/sentry/package.json +++ b/libs/nestjs/sentry/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-sentry", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/nestjs/sentry/src/lib/services/sentry-per-request-logger.service.ts b/libs/nestjs/sentry/src/lib/services/sentry-per-request-logger.service.ts index 46b47cb0d..055d14402 100644 --- a/libs/nestjs/sentry/src/lib/services/sentry-per-request-logger.service.ts +++ b/libs/nestjs/sentry/src/lib/services/sentry-per-request-logger.service.ts @@ -4,9 +4,9 @@ import { Scope as SentryScope, Severity, withScope } from '@sentry/node'; import { Extras } from '@sentry/types'; import { Request } from 'express'; +import { SentryLogger } from './sentry-logger.service'; import { SENTRY_MODULE_OPTIONS } from '../constants'; import { Breadcrumb, BreadcrumbType, SentryModuleOptions } from '../interfaces'; -import { SentryLogger } from './sentry-logger.service'; /** * This service will create a scope before sending the log/error and push all request's logs as breadcrumbs diff --git a/libs/nestjs/testing/CHANGELOG.md b/libs/nestjs/testing/CHANGELOG.md index 87a643e0b..6f65660d1 100644 --- a/libs/nestjs/testing/CHANGELOG.md +++ b/libs/nestjs/testing/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/testing/package.json b/libs/nestjs/testing/package.json index 0f80d5074..44efe67e0 100644 --- a/libs/nestjs/testing/package.json +++ b/libs/nestjs/testing/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-testing", - "version": "2.0.13", + "version": "2.1.0-next.1", "description": "Core module for nestjs backend", "repository": { "type": "git", diff --git a/libs/nestjs/user/.babelrc b/libs/nestjs/user/.babelrc new file mode 100644 index 000000000..b63f0528f --- /dev/null +++ b/libs/nestjs/user/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/js/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/nestjs/user/.eslintrc.json b/libs/nestjs/user/.eslintrc.json new file mode 100644 index 000000000..3456be9b9 --- /dev/null +++ b/libs/nestjs/user/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/nestjs/user/CHANGELOG.md b/libs/nestjs/user/CHANGELOG.md new file mode 100644 index 000000000..d1395545f --- /dev/null +++ b/libs/nestjs/user/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog + +This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). + +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + +### Bug Fixes + +* add casl public permissions and MAILER_CLIENT token ([46f4b06](https://github.com/tractr/traxion/commit/46f4b06da9d46a79c36bde365cd817b46031e24f)) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) diff --git a/libs/nestjs/user/README.md b/libs/nestjs/user/README.md new file mode 100644 index 000000000..206fac9a0 --- /dev/null +++ b/libs/nestjs/user/README.md @@ -0,0 +1,103 @@ +# User Module + +The nestjs-user module is a wrapper module around the UserService that will be used +in another `@trxn/nestjs-` user based packages. This module ask you to provide a +UserService that need to implement an interface to be used to fetch and update a user + +## Installation + +You can install the nestjs-user module using npm: + +```bash +npm install --save @trxn/nestjs-user +```` + +## Getting Started + +In your workspace create you own UserModule that will import, configure and export +your own UserModule: + +```ts +import { Module } from '@nestjs/common'; +import { UserModule as TraxionUserModule } from '@trxn/nestjs-user'; + +@Module({ + imports: [ + TraxionUserModule.register({ + UserService: { + provide: USER_SERVICE, + useClass: UserService, // Provide a class that implement UserService interface + } + }), + ], + exports: [TraxionUserModule], +}) +export class UserModule {} +``` + +The interface to respect is the following one: + +```ts +export type User = { + [key: string]: unknown; +}; + +export type MinimalUser = User & { + id: UserId; + email: string; + password: string; +}; + +export interface UserOrmService { + findUnique(params: { + where: { + id?: UserId; + [key: string]: unknown; + }; + select?: { + [key: string]: unknown; + }; + }): Promise; + + update(params: { + where: { + id?: UserId; + [key: string]: unknown; + }; + data?: { + [key: string]: unknown; + }; + }): Promise; +} +``` + +The `UserService` module options respect the `Provider` type from `@nestjs/common` so you can use `useFactory`, `useFactory` or `useExisting`. + +For the last one to use `useExisting` you can use the `imports` or `providers` module options to add to the `TraxionUserModule` the existing provider. If the imports module export a `USER_SERVICE` token you are not required to use the `UserService` module option. Let's take an exemple: + +```ts +@Module({ + providers: { + provide: USER_SERVICE, + useClass: MyOwnUserOrmService, // Implement UserOrmService interface + }, + exports: [USER_SERVICE], +}) +export class ModelsModule {} + +@Module({ + imports: [ + TraxionUserModule.register({ + imports: [ModelsModule], // Import your module with the USER_SERVICE token exported + + // You can also import your provider directly: + providers: [{ + provide: USER_SERVICE, + useClass: MyOwnUserOrmService, // Implement UserOrmService interface + }] + }), + ], + exports: [TraxionUserModule], +}) +export class UserModule {} +``` diff --git a/libs/nestjs/user/jest.config.ts b/libs/nestjs/user/jest.config.ts new file mode 100644 index 000000000..b2db087bc --- /dev/null +++ b/libs/nestjs/user/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'nestjs-user', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../../coverage/libs/nestjs/user', +}; diff --git a/libs/nestjs/user/package.json b/libs/nestjs/user/package.json new file mode 100644 index 000000000..c69206fdd --- /dev/null +++ b/libs/nestjs/user/package.json @@ -0,0 +1,13 @@ +{ + "name": "@trxn/nestjs-user", + "version": "2.1.0-next.1", + "repository": { + "type": "git", + "url": "https://github.com/tractr/traxion" + }, + "type": "commonjs", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + } +} diff --git a/libs/nestjs/user/project.json b/libs/nestjs/user/project.json new file mode 100644 index 000000000..8318bcfd5 --- /dev/null +++ b/libs/nestjs/user/project.json @@ -0,0 +1,53 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "nestjs-user", + "projectType": "library", + "sourceRoot": "libs/nestjs/user/src", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "options": { + "assets": ["libs/nestjs/user/*.md"], + "main": "libs/nestjs/user/src/index.ts", + "outputPath": "dist/libs/nestjs/user", + "packageJson": "libs/nestjs/user/package.json", + "tsConfig": "libs/nestjs/user/tsconfig.lib.json" + }, + "outputs": ["{options.outputPath}"] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/nestjs/user/**/*.ts"] + }, + "outputs": ["{options.outputFile}"] + }, + "publish": { + "executor": "ngx-deploy-npm:deploy", + "options": { + "access": "public" + } + }, + "test": { + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + }, + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/nestjs/user/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"] + }, + "update-peer-dependencies": { + "executor": "./dist/libs/schematics:update-peer-dependencies", + "options": { + "packageJsonPath": "{workspaceRoot}/dist/libs/nestjs/user/package.json" + } + } + } +} diff --git a/libs/nestjs/user/src/constants/index.ts b/libs/nestjs/user/src/constants/index.ts new file mode 100644 index 000000000..1ea0d402d --- /dev/null +++ b/libs/nestjs/user/src/constants/index.ts @@ -0,0 +1 @@ +export * from './user.constants'; diff --git a/libs/nestjs/user/src/constants/user.constants.ts b/libs/nestjs/user/src/constants/user.constants.ts new file mode 100644 index 000000000..38e9f7321 --- /dev/null +++ b/libs/nestjs/user/src/constants/user.constants.ts @@ -0,0 +1 @@ +export const USER_SERVICE = 'USER_SERVICE'; diff --git a/libs/nestjs/user/src/index.ts b/libs/nestjs/user/src/index.ts new file mode 100644 index 000000000..62d997bba --- /dev/null +++ b/libs/nestjs/user/src/index.ts @@ -0,0 +1,4 @@ +export * from './constants'; +export * from './interfaces'; +export * from './services'; +export * from './user.module'; diff --git a/libs/nestjs/user/src/interfaces/index.ts b/libs/nestjs/user/src/interfaces/index.ts new file mode 100644 index 000000000..aa418cd32 --- /dev/null +++ b/libs/nestjs/user/src/interfaces/index.ts @@ -0,0 +1,2 @@ +export * from './user-module-options.interface'; +export * from './minimal-user.interface'; diff --git a/libs/nestjs/user/src/interfaces/minimal-user.interface.ts b/libs/nestjs/user/src/interfaces/minimal-user.interface.ts new file mode 100644 index 000000000..036d59407 --- /dev/null +++ b/libs/nestjs/user/src/interfaces/minimal-user.interface.ts @@ -0,0 +1,33 @@ +export type UserId = string | number; + +export type User = { + [key: string]: unknown; +}; + +export type MinimalUser = User & { + id: UserId; + email: string; + password: string; +}; + +export interface UserOrmService { + findUnique(params: { + where: { + id?: UserId; + [key: string]: unknown; + }; + select?: { + [key: string]: unknown; + }; + }): Promise; + + update(params: { + where: { + id?: UserId; + [key: string]: unknown; + }; + data?: { + [key: string]: unknown; + }; + }): Promise; +} diff --git a/libs/nestjs/user/src/interfaces/user-module-options.interface.ts b/libs/nestjs/user/src/interfaces/user-module-options.interface.ts new file mode 100644 index 000000000..5632abd8e --- /dev/null +++ b/libs/nestjs/user/src/interfaces/user-module-options.interface.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface UserModuleOptions {} diff --git a/libs/nestjs/user/src/services/index.ts b/libs/nestjs/user/src/services/index.ts new file mode 100644 index 000000000..e17ee5c7a --- /dev/null +++ b/libs/nestjs/user/src/services/index.ts @@ -0,0 +1 @@ +export * from './user.service'; diff --git a/libs/nestjs/user/src/services/user.service.ts b/libs/nestjs/user/src/services/user.service.ts new file mode 100644 index 000000000..fc5a1899e --- /dev/null +++ b/libs/nestjs/user/src/services/user.service.ts @@ -0,0 +1,92 @@ +import { Inject, Injectable, Optional } from '@nestjs/common'; + +import { USER_SERVICE } from '../constants'; +import { MinimalUser, User, UserId, UserOrmService } from '../interfaces'; + +@Injectable() +export class UserService { + constructor( + @Optional() + @Inject(USER_SERVICE) + protected readonly userOrmService: UserOrmService, + ) { + if (!userOrmService) + throw new Error( + 'User orm service not found. Please add a USER_SERVICE or a UserService provider to the UserModule', + ); + } + + getIdFromUser(user: U): UserId { + return user.id as UserId; + } + + getPasswordFromUser(user: U): string | null { + return user.password as string; + } + + getLoginFromUser(user: U): string { + return user.email as string; + } + + async findUserById( + id: UserId, + select?: Record, + ) { + return this.userOrmService.findUnique({ + where: { + id, + }, + select, + }); + } + + async findUserByLogin( + login: string, + select?: Record, + ) { + return this.userOrmService.findUnique({ + where: { + email: login, + }, + select, + }); + } + + async getUserPassword( + id: UserId, + ): Promise { + const userFound = await this.userOrmService.findUnique({ + where: { + id, + }, + select: { + password: true, + }, + }); + + return userFound ? this.getPasswordFromUser(userFound) : null; + } + + async updatePassword( + id: UserId, + password: string, + ) { + return this.userOrmService.update({ + where: { + id, + }, + data: { + password, + }, + }); + } + + async update(id: UserId, user: Partial) { + return this.userOrmService.update({ + where: { + id, + }, + data: user, + }); + } +} diff --git a/libs/nestjs/user/src/user.module-definition.ts b/libs/nestjs/user/src/user.module-definition.ts new file mode 100644 index 000000000..6b512f9a4 --- /dev/null +++ b/libs/nestjs/user/src/user.module-definition.ts @@ -0,0 +1,34 @@ +import { ConfigurableModuleBuilder } from '@nestjs/common'; + +import { USER_SERVICE } from './constants'; +import { UserModuleOptions, UserOrmService } from './interfaces'; + +import { + addImportsAndProvidersExtra, + addProviderWithInjectionTokenExtra, + ImportsExtra, + ProvidersExtra, + ProviderWithInjectionToken, +} from '@trxn/nestjs-core'; + +export const { + ConfigurableModuleClass, + MODULE_OPTIONS_TOKEN, + ASYNC_OPTIONS_TYPE, + OPTIONS_TYPE, +} = new ConfigurableModuleBuilder() + .setExtras< + ImportsExtra & + ProvidersExtra & { + UserService?: ProviderWithInjectionToken< + typeof USER_SERVICE, + UserOrmService + >; + } + >( + { imports: [], providers: [] }, + addImportsAndProvidersExtra((definition, { UserService }) => + addProviderWithInjectionTokenExtra(definition, USER_SERVICE, UserService), + ), + ) + .build(); diff --git a/libs/nestjs/user/src/user.module.ts b/libs/nestjs/user/src/user.module.ts new file mode 100644 index 000000000..b186a8b56 --- /dev/null +++ b/libs/nestjs/user/src/user.module.ts @@ -0,0 +1,13 @@ +import { Module } from '@nestjs/common'; + +import { UserService } from './services'; +import { ConfigurableModuleClass } from './user.module-definition'; + +import { LoggerModule } from '@trxn/nestjs-core'; + +@Module({ + imports: [LoggerModule], + providers: [UserService], + exports: [UserService], +}) +export class UserModule extends ConfigurableModuleClass {} diff --git a/libs/nestjs/user/tsconfig.json b/libs/nestjs/user/tsconfig.json new file mode 100644 index 000000000..a3ee1b600 --- /dev/null +++ b/libs/nestjs/user/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs" + }, + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/nestjs/user/tsconfig.lib.json b/libs/nestjs/user/tsconfig.lib.json new file mode 100644 index 000000000..ee746f31b --- /dev/null +++ b/libs/nestjs/user/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "outDir": "../../../dist/out-tsc", + "target": "es6", + "types": ["node"] + }, + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"] +} diff --git a/libs/nestjs/user/tsconfig.spec.json b/libs/nestjs/user/tsconfig.spec.json new file mode 100644 index 000000000..817250600 --- /dev/null +++ b/libs/nestjs/user/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "types": ["jest", "node"] + }, + "extends": "./tsconfig.json", + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/libs/nestjs/winston/CHANGELOG.md b/libs/nestjs/winston/CHANGELOG.md index 13c10c8b5..cfbc30d6f 100644 --- a/libs/nestjs/winston/CHANGELOG.md +++ b/libs/nestjs/winston/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/nestjs/winston/package.json b/libs/nestjs/winston/package.json index d451b401f..8faa39cb0 100644 --- a/libs/nestjs/winston/package.json +++ b/libs/nestjs/winston/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/nestjs-winston", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/schematics/CHANGELOG.md b/libs/schematics/CHANGELOG.md index e7fa9e372..cc3f1ecb1 100644 --- a/libs/schematics/CHANGELOG.md +++ b/libs/schematics/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/schematics/package.json b/libs/schematics/package.json index c71dd4f69..b9319649a 100644 --- a/libs/schematics/package.json +++ b/libs/schematics/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/schematics", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/schematics/src/generators/admin-app/generator.ts b/libs/schematics/src/generators/admin-app/generator.ts index e8558ce72..496cb2900 100644 --- a/libs/schematics/src/generators/admin-app/generator.ts +++ b/libs/schematics/src/generators/admin-app/generator.ts @@ -12,13 +12,13 @@ import { import { Linter } from '@nrwl/linter'; import { applicationGenerator as reactApplicationGenerator } from '@nrwl/react'; +import { addFiles, cleanApplication, normalizeOptions } from './helpers'; +import { AdminAppGeneratorSchemaWithExtra } from './schema'; import { addPackageToPackageJson, installPackagesTask, PackageType, } from '../../helpers'; -import { addFiles, cleanApplication, normalizeOptions } from './helpers'; -import { AdminAppGeneratorSchemaWithExtra } from './schema'; /** * Generate an application to host a react-admin application diff --git a/libs/schematics/src/generators/admin-app/helpers/normalize-options.helper.spec.ts b/libs/schematics/src/generators/admin-app/helpers/normalize-options.helper.spec.ts index 4ffa8916b..a45607e66 100644 --- a/libs/schematics/src/generators/admin-app/helpers/normalize-options.helper.spec.ts +++ b/libs/schematics/src/generators/admin-app/helpers/normalize-options.helper.spec.ts @@ -1,11 +1,11 @@ import { getWorkspaceLayout, Tree } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; +import { NormalizedSchema, normalizeOptions } from './normalize-options.helper'; import { AdminAppGeneratorSchema, AdminAppGeneratorSchemaWithExtra, } from '../schema'; -import { NormalizedSchema, normalizeOptions } from './normalize-options.helper'; describe('normalizeOptions', () => { let tree: Tree; diff --git a/libs/schematics/src/generators/eslint-config/generator.spec.ts b/libs/schematics/src/generators/eslint-config/generator.spec.ts index 7bfbe02c9..b4dce57dd 100644 --- a/libs/schematics/src/generators/eslint-config/generator.spec.ts +++ b/libs/schematics/src/generators/eslint-config/generator.spec.ts @@ -2,8 +2,8 @@ import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import fetch, { Response } from 'node-fetch'; -import * as localPackageJson from '../../../package.json'; import generator, { packagesToAdd } from './generator'; +import * as localPackageJson from '../../../package.json'; jest.mock('node-fetch'); diff --git a/libs/schematics/src/generators/eslint-config/generator.ts b/libs/schematics/src/generators/eslint-config/generator.ts index c76070586..5a67f1e4e 100644 --- a/libs/schematics/src/generators/eslint-config/generator.ts +++ b/libs/schematics/src/generators/eslint-config/generator.ts @@ -8,13 +8,13 @@ import { } from '@nrwl/devkit'; import { Linter, lintInitGenerator } from '@nrwl/linter'; +import { EslintGeneratorSchema } from './schema'; import * as packageJson from '../../../package.json'; import { addPackageToPackageJson, installPackagesTask, PackageDefinition, } from '../../helpers'; -import { EslintGeneratorSchema } from './schema'; export const packagesToAdd: PackageDefinition[] = [ { diff --git a/libs/schematics/src/generators/hapify-library/generator.spec.ts b/libs/schematics/src/generators/hapify-library/generator.spec.ts index d42fabaa6..b2b54d49b 100644 --- a/libs/schematics/src/generators/hapify-library/generator.spec.ts +++ b/libs/schematics/src/generators/hapify-library/generator.spec.ts @@ -10,12 +10,12 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import * as nestjs from '@nrwl/nest'; import fetch, { Response } from 'node-fetch'; -import * as hapifyTargetGenerator from '../target-generate/generator'; import generator from './generator'; import { HapifyLibraryGeneratorOptions, HapifyLibraryGeneratorOptionsWithExtra, } from './schema'; +import * as hapifyTargetGenerator from '../target-generate/generator'; jest.mock('@nrwl/angular/generators', () => ({ __esModule: true, diff --git a/libs/schematics/src/generators/hapify-library/generator.ts b/libs/schematics/src/generators/hapify-library/generator.ts index 4bce977f0..a6165b357 100644 --- a/libs/schematics/src/generators/hapify-library/generator.ts +++ b/libs/schematics/src/generators/hapify-library/generator.ts @@ -1,13 +1,5 @@ import { formatFiles, Tree } from '@nrwl/devkit'; -import * as packageJson from '../../../package.json'; -import { - addPackageToPackageJson, - getLogger, - installPackagesTask, -} from '../../helpers'; -import { DEFAULT_LIBRARY_USE_CONTEXT } from '../../schematics.constants'; -import addGenerateTarget from '../target-generate/generator'; import { addFiles, addGitIgnoreEntry, @@ -20,6 +12,14 @@ import { } from './helpers'; import { addBabelRc } from './helpers/add-babelrc.helper'; import { HapifyLibraryGeneratorOptionsWithExtra } from './schema'; +import * as packageJson from '../../../package.json'; +import { + addPackageToPackageJson, + getLogger, + installPackagesTask, +} from '../../helpers'; +import { DEFAULT_LIBRARY_USE_CONTEXT } from '../../schematics.constants'; +import addGenerateTarget from '../target-generate/generator'; export default async function hapifyLibraryGenerator( tree: Tree, diff --git a/libs/schematics/src/generators/hapify-library/helpers/clean-angular-library.helper.ts b/libs/schematics/src/generators/hapify-library/helpers/clean-angular-library.helper.ts index 0b02da8d1..30f4eecf8 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/clean-angular-library.helper.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/clean-angular-library.helper.ts @@ -2,8 +2,8 @@ import { join } from 'path'; import { Tree } from '@nrwl/devkit'; -import { NormalizedOptions } from '../schema'; import { createSrcIndexTs } from './create-src-index.helper'; +import { NormalizedOptions } from '../schema'; export function cleanAngularLibrary(tree: Tree, options: NormalizedOptions) { const { projectRoot } = options; diff --git a/libs/schematics/src/generators/hapify-library/helpers/clean-nest-library.helper.ts b/libs/schematics/src/generators/hapify-library/helpers/clean-nest-library.helper.ts index 7f0752cb4..a5052a579 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/clean-nest-library.helper.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/clean-nest-library.helper.ts @@ -2,10 +2,10 @@ import { join } from 'path'; import { Tree, updateJson } from '@nrwl/devkit'; +import { createSrcIndexTs } from './create-src-index.helper'; import { readTargetConfiguration } from '../../../helpers/read-target-configuration'; import { updateTargetConfiguration } from '../../../helpers/update-target-configuration'; import { NormalizedOptions } from '../schema'; -import { createSrcIndexTs } from './create-src-index.helper'; export function cleanNestLibrary(tree: Tree, options: NormalizedOptions) { const { projectName, projectRoot, secondaryEntrypoints } = options; diff --git a/libs/schematics/src/generators/hapify-library/helpers/clean-react-library.helper.ts b/libs/schematics/src/generators/hapify-library/helpers/clean-react-library.helper.ts index d39d74a4b..b55ae95f5 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/clean-react-library.helper.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/clean-react-library.helper.ts @@ -7,9 +7,9 @@ import { updateProjectConfiguration, } from '@nrwl/devkit'; +import { createSrcIndexTs } from './create-src-index.helper'; import { addPackageToPackageJson, PackageType } from '../../../helpers'; import { NormalizedOptions } from '../schema'; -import { createSrcIndexTs } from './create-src-index.helper'; export async function cleanReactLibrary( tree: Tree, diff --git a/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helper.ts b/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helper.ts index 6677afed5..9cdf21492 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helper.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helper.ts @@ -1,8 +1,8 @@ import { librarySecondaryEntryPointGenerator } from '@nrwl/angular/generators'; import { Tree, updateJson } from '@nrwl/devkit'; -import { NormalizedOptions } from '../schema'; import { createSrcIndexTs } from './create-src-index.helper'; +import { NormalizedOptions } from '../schema'; export async function createSecondaryEntrypoints( tree: Tree, diff --git a/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helpers.spec.ts b/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helpers.spec.ts index 68070c4ae..4171ef3c6 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helpers.spec.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/create-secondary-entrypoints.helpers.spec.ts @@ -4,8 +4,8 @@ import { readJson, Tree } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import { libraryGenerator as nestLibraryGenerator } from '@nrwl/nest'; -import { NormalizedOptions } from '../schema'; import { createSecondaryEntrypoints } from './create-secondary-entrypoints.helper'; +import { NormalizedOptions } from '../schema'; jest.mock('@nrwl/angular/generators', () => ({ __esModule: true, diff --git a/libs/schematics/src/generators/hapify-library/helpers/generate-library.helper.ts b/libs/schematics/src/generators/hapify-library/helpers/generate-library.helper.ts index 3e62a6fcf..65891a61a 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/generate-library.helper.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/generate-library.helper.ts @@ -7,10 +7,10 @@ import { libraryGenerator as reactLibraryGenerator } from '@nrwl/react'; // We need to import this file to get the @schematics/angular package as a // dependency of the schematics package import '@schematics/angular/application/index'; -import { NormalizedOptions } from '../schema'; import { cleanAngularLibrary } from './clean-angular-library.helper'; import { cleanNestLibrary } from './clean-nest-library.helper'; import { cleanReactLibrary } from './clean-react-library.helper'; +import { NormalizedOptions } from '../schema'; export async function generateLibrary(tree: Tree, options: NormalizedOptions) { // Default values for library generator options diff --git a/libs/schematics/src/generators/hapify-library/helpers/normalize-options.helper.spec.ts b/libs/schematics/src/generators/hapify-library/helpers/normalize-options.helper.spec.ts index 1f4bd576c..f93ba807b 100644 --- a/libs/schematics/src/generators/hapify-library/helpers/normalize-options.helper.spec.ts +++ b/libs/schematics/src/generators/hapify-library/helpers/normalize-options.helper.spec.ts @@ -1,11 +1,11 @@ import { Tree, updateWorkspaceConfiguration } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; +import { normalizeOptions } from './normalize-options.helper'; import { HapifyLibraryGeneratorOptions, HapifyLibraryGeneratorOptionsWithExtra, } from '../schema'; -import { normalizeOptions } from './normalize-options.helper'; describe('normalizeOptions', () => { let appTree: Tree; diff --git a/libs/schematics/src/generators/init-workspace/generator.ts b/libs/schematics/src/generators/init-workspace/generator.ts index c8b8b9ec1..ef6a50d04 100644 --- a/libs/schematics/src/generators/init-workspace/generator.ts +++ b/libs/schematics/src/generators/init-workspace/generator.ts @@ -1,10 +1,10 @@ import { addDependenciesToPackageJson, Tree, updateJson } from '@nrwl/devkit'; import { pick } from 'lodash'; -import { PACKAGES_VERSIONS } from '../../../packages-versions.constant'; -import { installPackagesTask } from '../../helpers'; import { addFiles } from './helpers'; import { InitWorkspaceGeneratorSchema } from './schema'; +import { PACKAGES_VERSIONS } from '../../../packages-versions.constant'; +import { installPackagesTask } from '../../helpers'; export default async function initWorkspaceGenerator( tree: Tree, diff --git a/libs/schematics/src/generators/npm-publish/generator.ts b/libs/schematics/src/generators/npm-publish/generator.ts index 35d2d3c00..a0b1ac150 100644 --- a/libs/schematics/src/generators/npm-publish/generator.ts +++ b/libs/schematics/src/generators/npm-publish/generator.ts @@ -7,8 +7,8 @@ import { updateProjectConfiguration, } from '@nrwl/devkit'; -import { addPackageToPackageJson, installPackagesTask } from '../../helpers'; import { NpmPublishGeneratorSchema } from './schema'; +import { addPackageToPackageJson, installPackagesTask } from '../../helpers'; export const SEMVER_PACKAGE_NAME = 'ngx-deploy-npm'; export const DEFAULT_REGISTRY_URL = 'https://registry.npmjs.org'; diff --git a/libs/schematics/src/generators/prettier-config/generator.spec.ts b/libs/schematics/src/generators/prettier-config/generator.spec.ts index edc6b5d7d..0eeeb7cdf 100644 --- a/libs/schematics/src/generators/prettier-config/generator.spec.ts +++ b/libs/schematics/src/generators/prettier-config/generator.spec.ts @@ -5,9 +5,9 @@ import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import fetch, { Response } from 'node-fetch'; +import generator, { packagesToAdd } from './generator'; import * as localPackageJson from '../../../package.json'; import { npmRun } from '../../helpers/npm-run'; -import generator, { packagesToAdd } from './generator'; jest.mock('../../helpers/npm-run'); jest.mock('node-fetch'); diff --git a/libs/schematics/src/generators/prettier-config/generator.ts b/libs/schematics/src/generators/prettier-config/generator.ts index ac220cd6c..e23a53180 100644 --- a/libs/schematics/src/generators/prettier-config/generator.ts +++ b/libs/schematics/src/generators/prettier-config/generator.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import { formatFiles, generateFiles, Tree } from '@nrwl/devkit'; +import { PrettierGeneratorSchema } from './schema'; import * as packageJson from '../../../package.json'; import { addPackageToPackageJson, @@ -9,7 +10,6 @@ import { npmRun, PackageDefinition, } from '../../helpers'; -import { PrettierGeneratorSchema } from './schema'; export const packagesToAdd: PackageDefinition[] = [ { diff --git a/libs/schematics/src/generators/prisma-library/generator.ts b/libs/schematics/src/generators/prisma-library/generator.ts index 2cac63b2f..56138eebb 100644 --- a/libs/schematics/src/generators/prisma-library/generator.ts +++ b/libs/schematics/src/generators/prisma-library/generator.ts @@ -9,6 +9,9 @@ import { updateProjectConfiguration, } from '@nrwl/devkit'; +import { NX_TOOLS_NX_PRISMA_PACKAGE } from './constants/nx-tools-prisma-package'; +import { getTargetsToAdd } from './helpers/project-targets'; +import { PrismaLibraryGeneratorSchema } from './schema'; import * as packageJson from '../../../package.json'; import { addPackageToPackageJson, @@ -18,9 +21,6 @@ import { PackageType, } from '../../helpers'; import hapifyLibraryGenerator from '../hapify-library/generator'; -import { NX_TOOLS_NX_PRISMA_PACKAGE } from './constants/nx-tools-prisma-package'; -import { getTargetsToAdd } from './helpers/project-targets'; -import { PrismaLibraryGeneratorSchema } from './schema'; export interface NormalizedOptions { name: string; diff --git a/libs/schematics/src/generators/release/generator.ts b/libs/schematics/src/generators/release/generator.ts index 9cf632f74..40fd96403 100644 --- a/libs/schematics/src/generators/release/generator.ts +++ b/libs/schematics/src/generators/release/generator.ts @@ -7,8 +7,8 @@ import { updateProjectConfiguration, } from '@nrwl/devkit'; -import { addPackageToPackageJson, installPackagesTask } from '../../helpers'; import { ReleaseGeneratorSchema } from './schema'; +import { addPackageToPackageJson, installPackagesTask } from '../../helpers'; export const SEMVER_PACKAGE_NAME = '@jscutlery/semver'; diff --git a/libs/schematics/src/generators/target-generate/generator.spec.ts b/libs/schematics/src/generators/target-generate/generator.spec.ts index 3b1c844f2..c5a523d9e 100644 --- a/libs/schematics/src/generators/target-generate/generator.spec.ts +++ b/libs/schematics/src/generators/target-generate/generator.spec.ts @@ -7,12 +7,12 @@ import { import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import { readJSON } from 'fs-extra'; -import { PackageDefinition } from '../../helpers'; import generator, { SCHEMATICS_PACKAGE_JSON_PATH, SCHEMATICS_TRAXION_PACKAGE_NAME, } from './generator'; import { TargetGenerateGeneratorSchema } from './schema'; +import { PackageDefinition } from '../../helpers'; describe('target-generate generator', () => { let appTree: Tree; diff --git a/libs/schematics/src/generators/target-generate/generator.ts b/libs/schematics/src/generators/target-generate/generator.ts index 6d96ee2cb..6ef2f3153 100644 --- a/libs/schematics/src/generators/target-generate/generator.ts +++ b/libs/schematics/src/generators/target-generate/generator.ts @@ -7,13 +7,13 @@ import { } from '@nrwl/devkit'; import { readJSON } from 'fs-extra'; +import { TargetGenerateGeneratorSchema } from './schema'; import { addPackageToPackageJson, installPackagesTask, PackageDefinition, Packages, } from '../../helpers'; -import { TargetGenerateGeneratorSchema } from './schema'; export const SCHEMATICS_TRAXION_PACKAGE_NAME = '@trxn/schematics'; diff --git a/libs/schematics/src/generators/traxion-workspace/generator.ts b/libs/schematics/src/generators/traxion-workspace/generator.ts index 29005ed19..8b0166d00 100644 --- a/libs/schematics/src/generators/traxion-workspace/generator.ts +++ b/libs/schematics/src/generators/traxion-workspace/generator.ts @@ -1,10 +1,5 @@ import { formatFiles, Tree } from '@nrwl/devkit'; -import { getLogger, installPackagesTask } from '../../helpers'; -import eslintGenerator from '../eslint-config/generator'; -import generateWorkflow from '../github-workflows/generator'; -import initWorkspaceGenerator from '../init-workspace/generator'; -import prettierGenerator from '../prettier-config/generator'; import { createAdminApplication, createAngularApplication, @@ -13,6 +8,11 @@ import { normalizeOptions, } from './helpers'; import { TraxionWorkspaceGeneratorSchema } from './schema'; +import { getLogger, installPackagesTask } from '../../helpers'; +import eslintGenerator from '../eslint-config/generator'; +import generateWorkflow from '../github-workflows/generator'; +import initWorkspaceGenerator from '../init-workspace/generator'; +import prettierGenerator from '../prettier-config/generator'; export default async function traxionWorkspaceGenerator( tree: Tree, diff --git a/libs/terraform/aws-stack/CHANGELOG.md b/libs/terraform/aws-stack/CHANGELOG.md index 329e77b7d..2b80cfed3 100644 --- a/libs/terraform/aws-stack/CHANGELOG.md +++ b/libs/terraform/aws-stack/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/aws-stack/package.json b/libs/terraform/aws-stack/package.json index e3bbedfbc..b4e726b1a 100644 --- a/libs/terraform/aws-stack/package.json +++ b/libs/terraform/aws-stack/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-aws-stack", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/aws/CHANGELOG.md b/libs/terraform/component/aws/CHANGELOG.md index 100244074..e7edcc3ca 100644 --- a/libs/terraform/component/aws/CHANGELOG.md +++ b/libs/terraform/component/aws/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/aws/package.json b/libs/terraform/component/aws/package.json index d214f46b3..3c10fc47f 100644 --- a/libs/terraform/component/aws/package.json +++ b/libs/terraform/component/aws/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-aws", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/deployment-trigger/CHANGELOG.md b/libs/terraform/component/deployment-trigger/CHANGELOG.md index 35922f8fd..a647390af 100644 --- a/libs/terraform/component/deployment-trigger/CHANGELOG.md +++ b/libs/terraform/component/deployment-trigger/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/deployment-trigger/package.json b/libs/terraform/component/deployment-trigger/package.json index ac1c62994..89f2f4be0 100644 --- a/libs/terraform/component/deployment-trigger/package.json +++ b/libs/terraform/component/deployment-trigger/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-deployment-trigger", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/deployment/CHANGELOG.md b/libs/terraform/component/deployment/CHANGELOG.md index da1000b2e..c951437d6 100644 --- a/libs/terraform/component/deployment/CHANGELOG.md +++ b/libs/terraform/component/deployment/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/deployment/package.json b/libs/terraform/component/deployment/package.json index dd517ce95..e58376e6e 100644 --- a/libs/terraform/component/deployment/package.json +++ b/libs/terraform/component/deployment/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-deployment", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/deployment/src/lib/interfaces/deployment.interface.ts b/libs/terraform/component/deployment/src/lib/interfaces/deployment.interface.ts index 69533ac22..394443fe8 100644 --- a/libs/terraform/component/deployment/src/lib/interfaces/deployment.interface.ts +++ b/libs/terraform/component/deployment/src/lib/interfaces/deployment.interface.ts @@ -1,10 +1,10 @@ import { ecs } from '@cdktf/provider-aws'; +import { DeploymentTrigger } from './deployment-pipeline.interface'; import { DeploymentBuildComponent } from '../deployment-build.component'; import { DeploymentPipelineComponent } from '../deployment-pipeline.component'; import { DeploymentRoleComponent } from '../deployment-role.component'; import { DeploymentStoreComponent } from '../deployment-store.component'; -import { DeploymentTrigger } from './deployment-pipeline.interface'; import { DeploymentTriggerComponent } from '@trxn/terraform-component-deployment-trigger'; diff --git a/libs/terraform/component/entrypoint/CHANGELOG.md b/libs/terraform/component/entrypoint/CHANGELOG.md index cf68fc32f..c3a2c45fb 100644 --- a/libs/terraform/component/entrypoint/CHANGELOG.md +++ b/libs/terraform/component/entrypoint/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/entrypoint/package.json b/libs/terraform/component/entrypoint/package.json index 57b433ba5..bb53532cb 100644 --- a/libs/terraform/component/entrypoint/package.json +++ b/libs/terraform/component/entrypoint/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-entrypoint", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/file-storage/CHANGELOG.md b/libs/terraform/component/file-storage/CHANGELOG.md index 3e3744d2c..b88db0df8 100644 --- a/libs/terraform/component/file-storage/CHANGELOG.md +++ b/libs/terraform/component/file-storage/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/file-storage/package.json b/libs/terraform/component/file-storage/package.json index 2c1f54989..d14d06845 100644 --- a/libs/terraform/component/file-storage/package.json +++ b/libs/terraform/component/file-storage/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-file-storage", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/logs/CHANGELOG.md b/libs/terraform/component/logs/CHANGELOG.md index 2039a9c5b..51966fed5 100644 --- a/libs/terraform/component/logs/CHANGELOG.md +++ b/libs/terraform/component/logs/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/logs/package.json b/libs/terraform/component/logs/package.json index 11844a064..4af56c0c4 100644 --- a/libs/terraform/component/logs/package.json +++ b/libs/terraform/component/logs/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-logs", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/private-dns/CHANGELOG.md b/libs/terraform/component/private-dns/CHANGELOG.md index 2a686a55e..fbb7b0a44 100644 --- a/libs/terraform/component/private-dns/CHANGELOG.md +++ b/libs/terraform/component/private-dns/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/private-dns/package.json b/libs/terraform/component/private-dns/package.json index e7de1f806..2b1299e0b 100644 --- a/libs/terraform/component/private-dns/package.json +++ b/libs/terraform/component/private-dns/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-private-dns", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/s3-user/CHANGELOG.md b/libs/terraform/component/s3-user/CHANGELOG.md index 833c32242..1e3ffc90e 100644 --- a/libs/terraform/component/s3-user/CHANGELOG.md +++ b/libs/terraform/component/s3-user/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/s3-user/package.json b/libs/terraform/component/s3-user/package.json index c7b6e0470..c97de544e 100644 --- a/libs/terraform/component/s3-user/package.json +++ b/libs/terraform/component/s3-user/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-s3-user", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/s3/CHANGELOG.md b/libs/terraform/component/s3/CHANGELOG.md index 38f684c0b..eb4ca71b6 100644 --- a/libs/terraform/component/s3/CHANGELOG.md +++ b/libs/terraform/component/s3/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/s3/package.json b/libs/terraform/component/s3/package.json index e404ec6b3..c852afefa 100644 --- a/libs/terraform/component/s3/package.json +++ b/libs/terraform/component/s3/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-s3", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/secrets/CHANGELOG.md b/libs/terraform/component/secrets/CHANGELOG.md index 1ed747cb6..988c66f55 100644 --- a/libs/terraform/component/secrets/CHANGELOG.md +++ b/libs/terraform/component/secrets/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/secrets/package.json b/libs/terraform/component/secrets/package.json index 7cac453b2..da876a0d6 100644 --- a/libs/terraform/component/secrets/package.json +++ b/libs/terraform/component/secrets/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-secrets", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/component/volume/CHANGELOG.md b/libs/terraform/component/volume/CHANGELOG.md index 7ec86d06c..ea820eef2 100644 --- a/libs/terraform/component/volume/CHANGELOG.md +++ b/libs/terraform/component/volume/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/component/volume/package.json b/libs/terraform/component/volume/package.json index 951e7aa9f..a443e5431 100644 --- a/libs/terraform/component/volume/package.json +++ b/libs/terraform/component/volume/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-component-volume", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/group/network/CHANGELOG.md b/libs/terraform/group/network/CHANGELOG.md index b826c1c43..6faab8953 100644 --- a/libs/terraform/group/network/CHANGELOG.md +++ b/libs/terraform/group/network/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/group/network/package.json b/libs/terraform/group/network/package.json index a871dc453..07c086fee 100644 --- a/libs/terraform/group/network/package.json +++ b/libs/terraform/group/network/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-group-network", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/group/network/src/lib/components/base.component.ts b/libs/terraform/group/network/src/lib/components/base.component.ts index 75e20b897..9b23b4534 100644 --- a/libs/terraform/group/network/src/lib/components/base.component.ts +++ b/libs/terraform/group/network/src/lib/components/base.component.ts @@ -1,7 +1,7 @@ import { vpc as awsVpc } from '@cdktf/provider-aws'; -import { BaseComponentArtifacts, BaseComponentConfig } from '../interfaces'; import { InternetRoutesComponent } from './internet-routes.component'; +import { BaseComponentArtifacts, BaseComponentConfig } from '../interfaces'; import { AwsComponent } from '@trxn/terraform-component-aws'; diff --git a/libs/terraform/group/network/src/lib/components/private.component.ts b/libs/terraform/group/network/src/lib/components/private.component.ts index 334042a21..005c14bc0 100644 --- a/libs/terraform/group/network/src/lib/components/private.component.ts +++ b/libs/terraform/group/network/src/lib/components/private.component.ts @@ -1,12 +1,12 @@ import { vpc } from '@cdktf/provider-aws'; +import { EgressRoutesComponent } from './egress-routes.component'; +import { InternetRoutesComponent } from './internet-routes.component'; +import { NatGatewayComponent } from './nat-gateway.component'; import { PrivateComponentArtifacts, PrivateComponentConfig, } from '../interfaces'; -import { EgressRoutesComponent } from './egress-routes.component'; -import { InternetRoutesComponent } from './internet-routes.component'; -import { NatGatewayComponent } from './nat-gateway.component'; import { AwsComponent } from '@trxn/terraform-component-aws'; diff --git a/libs/terraform/group/pool/CHANGELOG.md b/libs/terraform/group/pool/CHANGELOG.md index 7786f6723..65cc9c3a7 100644 --- a/libs/terraform/group/pool/CHANGELOG.md +++ b/libs/terraform/group/pool/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/group/pool/package.json b/libs/terraform/group/pool/package.json index f4c60d745..413ff3b21 100644 --- a/libs/terraform/group/pool/package.json +++ b/libs/terraform/group/pool/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-group-pool", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/group/registry/CHANGELOG.md b/libs/terraform/group/registry/CHANGELOG.md index f3ee239a3..6dad7a9c6 100644 --- a/libs/terraform/group/registry/CHANGELOG.md +++ b/libs/terraform/group/registry/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/group/registry/package.json b/libs/terraform/group/registry/package.json index f0aa0244b..78b1c373b 100644 --- a/libs/terraform/group/registry/package.json +++ b/libs/terraform/group/registry/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-group-registry", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/group/zone/CHANGELOG.md b/libs/terraform/group/zone/CHANGELOG.md index 3582a95b3..c605b1c43 100644 --- a/libs/terraform/group/zone/CHANGELOG.md +++ b/libs/terraform/group/zone/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/group/zone/package.json b/libs/terraform/group/zone/package.json index e1aef5e8d..85e529e83 100644 --- a/libs/terraform/group/zone/package.json +++ b/libs/terraform/group/zone/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-group-zone", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/admin/CHANGELOG.md b/libs/terraform/service/admin/CHANGELOG.md index e64da041e..4ca080291 100644 --- a/libs/terraform/service/admin/CHANGELOG.md +++ b/libs/terraform/service/admin/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/admin/package.json b/libs/terraform/service/admin/package.json index 639a8dfab..4dbc9b897 100644 --- a/libs/terraform/service/admin/package.json +++ b/libs/terraform/service/admin/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-admin", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/api/CHANGELOG.md b/libs/terraform/service/api/CHANGELOG.md index e7a05e09b..7b84e8346 100644 --- a/libs/terraform/service/api/CHANGELOG.md +++ b/libs/terraform/service/api/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/api/package.json b/libs/terraform/service/api/package.json index 9071c29bf..0d3612a89 100644 --- a/libs/terraform/service/api/package.json +++ b/libs/terraform/service/api/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-api", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/ecs/CHANGELOG.md b/libs/terraform/service/ecs/CHANGELOG.md index 2b84d1d90..dc7005c3f 100644 --- a/libs/terraform/service/ecs/CHANGELOG.md +++ b/libs/terraform/service/ecs/CHANGELOG.md @@ -2,6 +2,35 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + +## [2.0.11-next.3](https://github.com/tractr/traxion/compare/v2.0.11-next.2...v2.0.11-next.3) (2023-02-22) + + + +## [2.0.11-next.2](https://github.com/tractr/traxion/compare/v2.0.11-next.1...v2.0.11-next.2) (2023-02-22) + + + +## [2.0.11-next.1](https://github.com/tractr/traxion/compare/v2.0.11-next.0...v2.0.11-next.1) (2023-02-22) + + + +## [2.0.11-next.0](https://github.com/tractr/traxion/compare/v2.0.10...v2.0.11-next.0) (2023-02-22) + + +### Features + +* clean authentication modules ([99b7db6](https://github.com/tractr/traxion/commit/99b7db69cc4f885ac885d147043003448895d66d)) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/ecs/package.json b/libs/terraform/service/ecs/package.json index f21b566ea..047e93e3e 100644 --- a/libs/terraform/service/ecs/package.json +++ b/libs/terraform/service/ecs/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-ecs", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/ecs/src/lib/containers/backend-container.ts b/libs/terraform/service/ecs/src/lib/containers/backend-container.ts index 5efbc1173..3296dc314 100644 --- a/libs/terraform/service/ecs/src/lib/containers/backend-container.ts +++ b/libs/terraform/service/ecs/src/lib/containers/backend-container.ts @@ -1,5 +1,5 @@ -import { ContainerConfig, ContainerDefinition } from '../interfaces'; import { Container } from './container'; +import { ContainerConfig, ContainerDefinition } from '../interfaces'; /** * This container is meant to be used by another one, as its backend diff --git a/libs/terraform/service/ecs/src/lib/containers/http-container.ts b/libs/terraform/service/ecs/src/lib/containers/http-container.ts index 9106bb6be..90a22147e 100644 --- a/libs/terraform/service/ecs/src/lib/containers/http-container.ts +++ b/libs/terraform/service/ecs/src/lib/containers/http-container.ts @@ -1,10 +1,10 @@ import { kebab } from 'case'; +import { BackendContainer } from './backend-container'; import { HttpContainerConfig, HttpContainerPathPrefixConfig, } from '../interfaces'; -import { BackendContainer } from './backend-container'; /** * This container is meant to be used by another one, as its backend diff --git a/libs/terraform/service/ecs/src/lib/services/backend-service.component.ts b/libs/terraform/service/ecs/src/lib/services/backend-service.component.ts index efbe9b08e..ba86e6651 100644 --- a/libs/terraform/service/ecs/src/lib/services/backend-service.component.ts +++ b/libs/terraform/service/ecs/src/lib/services/backend-service.component.ts @@ -1,11 +1,11 @@ import { vpc } from '@cdktf/provider-aws'; +import { ServiceComponent } from './service.component'; import { BackendServiceComponentConfig, ServiceComponentArtifacts, ServiceComponentDefaultConfig, } from '../interfaces'; -import { ServiceComponent } from './service.component'; /** * This service is meant to be used by another one, as its backend diff --git a/libs/terraform/service/logstash/CHANGELOG.md b/libs/terraform/service/logstash/CHANGELOG.md index 1a4d5e87d..33aa9ac6d 100644 --- a/libs/terraform/service/logstash/CHANGELOG.md +++ b/libs/terraform/service/logstash/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/logstash/package.json b/libs/terraform/service/logstash/package.json index 0ed28a19d..79421f4ea 100644 --- a/libs/terraform/service/logstash/package.json +++ b/libs/terraform/service/logstash/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-logstash", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/postgres/CHANGELOG.md b/libs/terraform/service/postgres/CHANGELOG.md index 6b73ea6b5..ae5979713 100644 --- a/libs/terraform/service/postgres/CHANGELOG.md +++ b/libs/terraform/service/postgres/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/postgres/package.json b/libs/terraform/service/postgres/package.json index 95b096c85..065311df3 100644 --- a/libs/terraform/service/postgres/package.json +++ b/libs/terraform/service/postgres/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-postgres", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/pwa/CHANGELOG.md b/libs/terraform/service/pwa/CHANGELOG.md index 4d8334499..9402da3c6 100644 --- a/libs/terraform/service/pwa/CHANGELOG.md +++ b/libs/terraform/service/pwa/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/pwa/package.json b/libs/terraform/service/pwa/package.json index d0b2e52ec..f6e57357c 100644 --- a/libs/terraform/service/pwa/package.json +++ b/libs/terraform/service/pwa/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-pwa", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/libs/terraform/service/reverse-proxy/CHANGELOG.md b/libs/terraform/service/reverse-proxy/CHANGELOG.md index 0ab5ece64..11a103f87 100644 --- a/libs/terraform/service/reverse-proxy/CHANGELOG.md +++ b/libs/terraform/service/reverse-proxy/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24) diff --git a/libs/terraform/service/reverse-proxy/package.json b/libs/terraform/service/reverse-proxy/package.json index a1f742e3d..a82ccfa5b 100644 --- a/libs/terraform/service/reverse-proxy/package.json +++ b/libs/terraform/service/reverse-proxy/package.json @@ -1,6 +1,6 @@ { "name": "@trxn/terraform-service-reverse-proxy", - "version": "2.0.13", + "version": "2.1.0-next.1", "repository": { "type": "git", "url": "https://github.com/tractr/traxion" diff --git a/package-lock.json b/package-lock.json index b26c50640..628d74955 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,9 +46,6 @@ "@sentry/node": "^7.36.0", "@sentry/types": "^7.36.0", "@tailwindcss/forms": "0.5.3", - "@types/faker": "^5.5.9", - "@types/glob": "^8.0.1", - "@types/node-mailjet": "^3.3.9", "apollo-server-core": "^3.10.1", "apollo-server-express": "^3.10.1", "apollo-server-plugin-base": "^3.6.2", @@ -87,7 +84,7 @@ "nestjs-console": "^8.0.0", "ng-zorro-antd": "^15.0.3", "node-fetch": "^2.6.9", - "node-mailjet": "^3.4.1", + "node-mailjet": "^6.0.2", "passport": "^0.6.0", "passport-jwt": "^4.0.1", "passport-local": "^1.0.0", @@ -163,6 +160,7 @@ "@types/express": "4.17.17", "@types/faker": "^5.5.9", "@types/fs-extra": "^11.0.1", + "@types/glob": "^8.0.1", "@types/jest": "28.1.8", "@types/jsonwebtoken": "^9.0.1", "@types/lodash": "^4.14.191", @@ -172,7 +170,6 @@ "@types/morgan": "^1.9.4", "@types/node": "18.13.0", "@types/node-fetch": "^2.6.2", - "@types/node-mailjet": "^3.3.9", "@types/passport-jwt": "^3.0.8", "@types/passport-local": "^1.0.35", "@types/pg": "^8.6.6", @@ -10537,14 +10534,6 @@ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", "dev": true }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "engines": { - "node": ">= 6" - } - }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -10812,6 +10801,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.0.1.tgz", "integrity": "sha512-8bVUjXZvJacUFkJXHdyZ9iH1Eaj5V7I8c4NdH5sQJsdXkqT4CA5Dhb4yb4VE/3asyx4L9ayZr1NIhTsWHczmMw==", + "dev": true, "dependencies": { "@types/minimatch": "^5.1.2", "@types/node": "*" @@ -10820,7 +10810,8 @@ "node_modules/@types/glob/node_modules/@types/minimatch": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==" + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true }, "node_modules/@types/graceful-fs": { "version": "4.1.5", @@ -11033,12 +11024,6 @@ "form-data": "^3.0.0" } }, - "node_modules/@types/node-mailjet": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/@types/node-mailjet/-/node-mailjet-3.3.9.tgz", - "integrity": "sha512-OSwpRjw0DPNCfRQTCcYOAT42uCcbOmAufZjHbqRW+MDsO3QOBTYajwT8J0JlRdgMdBrMEcEkIqLCbc0OSfSiRQ==", - "dev": true - }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -12893,17 +12878,6 @@ "node": ">=0.8" } }, - "node_modules/ast-types": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", - "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", - "dependencies": { - "tslib": "^2.0.1" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ast-types-flow": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", @@ -17246,14 +17220,6 @@ "node": ">=0.10" } }, - "node_modules/data-uri-to-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", - "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", - "engines": { - "node": ">= 6" - } - }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -17445,7 +17411,8 @@ "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "devOptional": true }, "node_modules/deepmerge": { "version": "4.3.0", @@ -17519,105 +17486,6 @@ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", "integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==" }, - "node_modules/degenerator": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.2.tgz", - "integrity": "sha512-c0mef3SNQo56t6urUU6tdQAs+ThoD0o9B9MJ8HEt7NQcGEILCRFqQb7ZbP9JAv+QF1Ky5plydhMR/IrqWDm+TQ==", - "dependencies": { - "ast-types": "^0.13.2", - "escodegen": "^1.8.1", - "esprima": "^4.0.0", - "vm2": "^3.9.8" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/degenerator/node_modules/escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=4.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/degenerator/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/degenerator/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/degenerator/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/degenerator/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/degenerator/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/degenerator/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/del": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/del/-/del-6.1.1.tgz", @@ -19858,7 +19726,8 @@ "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "devOptional": true }, "node_modules/fast-safe-stringify": { "version": "2.1.1", @@ -20042,14 +19911,6 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, - "node_modules/file-uri-to-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz", - "integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==", - "engines": { - "node": ">= 6" - } - }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -20605,39 +20466,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/ftp": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", - "integrity": "sha512-faFVML1aBx2UoDStmLwv2Wptt4vw5x03xxX172nhA5Y5HBshW5JweqQ2W4xL4dezQTG8inJsuYcpPHHU3X5OTQ==", - "dependencies": { - "readable-stream": "1.1.x", - "xregexp": "2.0.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/ftp/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" - }, - "node_modules/ftp/node_modules/readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/ftp/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -20866,51 +20694,6 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, - "node_modules/get-uri": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz", - "integrity": "sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg==", - "dependencies": { - "@tootallnate/once": "1", - "data-uri-to-buffer": "3", - "debug": "4", - "file-uri-to-path": "2", - "fs-extra": "^8.1.0", - "ftp": "^0.3.10" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/get-uri/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/get-uri/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/get-uri/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/getos": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", @@ -21601,19 +21384,6 @@ "node": ">=8.0.0" } }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/http-proxy-middleware": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", @@ -22110,24 +21880,6 @@ "is-ci": "bin.js" } }, - "node_modules/ink/node_modules/react-reconciler": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.26.2.tgz", - "integrity": "sha512-nK6kgY28HwrMNwDnMui3dvm3rCFjZrcGiuwLc5COUipBK5hWHLOxMJhSnSomirqWwjPBJKV1QcbkI0VJr7Gl1Q==", - "dev": true, - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "react": "^17.0.2" - } - }, "node_modules/ink/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -22251,7 +22003,8 @@ "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true }, "node_modules/ipaddr.js": { "version": "2.0.1", @@ -27297,14 +27050,6 @@ "node": ">= 12" } }, - "node_modules/netmask": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", - "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/new-github-issue-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/new-github-issue-url/-/new-github-issue-url-0.2.1.tgz", @@ -27795,14 +27540,39 @@ "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, "node_modules/node-mailjet": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-3.4.1.tgz", - "integrity": "sha512-m+msgBJYgwFbIZBIPOnsGOtBt9xP03UqmkmuEcgTcLlr/U1GUJQrVI7cDFRgujybb9Cl1wl4thIGyM3wt6X+zQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-6.0.2.tgz", + "integrity": "sha512-aLSWqzVVB7fSfEE9yFsWQ3mPOcGtKJYmQTcL6an+Y8ITLjF8RdvopXvENgSjLLfFNAaIJ0PhLgECxutbmR84wA==", "dependencies": { + "axios": "^0.27.2", "json-bigint": "^1.0.0", - "qs": "^6.5.0", - "superagent": "^7.1.1", - "superagent-proxy": "^3.0.0" + "url-join": "^4.0.0" + }, + "engines": { + "node": ">= 12.0.0", + "npm": ">= 6.9.0" + } + }, + "node_modules/node-mailjet/node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/node-mailjet/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, "node_modules/node-polyglot": { @@ -28718,56 +28488,6 @@ "node": ">=6" } }, - "node_modules/pac-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz", - "integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==", - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4", - "get-uri": "3", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "5", - "pac-resolver": "^5.0.0", - "raw-body": "^2.2.0", - "socks-proxy-agent": "5" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/pac-proxy-agent/node_modules/socks-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz", - "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==", - "dependencies": { - "agent-base": "^6.0.2", - "debug": "4", - "socks": "^2.3.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pac-resolver": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.1.tgz", - "integrity": "sha512-cy7u00ko2KVgBAjuhevqpPeHIkCIqPe1v24cydhWjmeuzaBfmUWFCZJ1iAh5TuVzVZoUzXIW7K8sMYOZ84uZ9Q==", - "dependencies": { - "degenerator": "^3.0.2", - "ip": "^1.1.5", - "netmask": "^2.0.2" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/pac-resolver/node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" - }, "node_modules/packet-reader": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", @@ -31059,54 +30779,11 @@ "node": ">= 0.10" } }, - "node_modules/proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz", - "integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==", - "dependencies": { - "agent-base": "^6.0.0", - "debug": "4", - "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^5.0.0", - "lru-cache": "^5.1.1", - "pac-proxy-agent": "^5.0.0", - "proxy-from-env": "^1.0.0", - "socks-proxy-agent": "^5.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/proxy-agent/node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/proxy-agent/node_modules/socks-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz", - "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==", - "dependencies": { - "agent-base": "^6.0.2", - "debug": "4", - "socks": "^2.3.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/proxy-agent/node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, "node_modules/proxy-from-env": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==" + "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", + "devOptional": true }, "node_modules/prr": { "version": "1.0.1", @@ -31454,9 +31131,9 @@ } }, "node_modules/react-devtools-core": { - "version": "4.27.1", - "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.1.tgz", - "integrity": "sha512-qXhcxxDWiFmFAOq48jts9YQYe1+wVoUXzJTlY4jbaATzyio6dd6CUGu3dXBhREeVgpZ+y4kg6vFJzIOZh6vY2w==", + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.2.tgz", + "integrity": "sha512-8SzmIkpO87alD7Xr6gWIEa1jHkMjawOZ+6egjazlnjB4UUcbnzGDf/vBJ4BzGuWWEM+pzrxuzsPpcMqlQkYK2g==", "dev": true, "peer": true, "dependencies": { @@ -31560,6 +31237,24 @@ } } }, + "node_modules/react-reconciler": { + "version": "0.26.2", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.26.2.tgz", + "integrity": "sha512-nK6kgY28HwrMNwDnMui3dvm3rCFjZrcGiuwLc5COUipBK5hWHLOxMJhSnSomirqWwjPBJKV1QcbkI0VJr7Gl1Q==", + "dev": true, + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "scheduler": "^0.20.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "react": "^17.0.2" + } + }, "node_modules/react-refresh": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", @@ -33151,9 +32846,9 @@ } }, "node_modules/shell-quote": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", - "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz", + "integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==", "dev": true, "peer": true, "funding": { @@ -33236,6 +32931,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -33263,6 +32959,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", + "dev": true, "dependencies": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -34238,79 +33935,6 @@ "node": ">=0.10.0" } }, - "node_modules/superagent": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-7.1.5.tgz", - "integrity": "sha512-HQYyGuDRFGmZ6GNC4hq2f37KnsY9Lr0/R1marNZTgMweVDQLTLJJ6DGQ9Tj/xVVs5HEnop9EMmTbywb5P30aqw==", - "dependencies": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.3", - "debug": "^4.3.4", - "fast-safe-stringify": "^2.1.1", - "form-data": "^4.0.0", - "formidable": "^2.0.1", - "methods": "^1.1.2", - "mime": "^2.5.0", - "qs": "^6.10.3", - "readable-stream": "^3.6.0", - "semver": "^7.3.7" - }, - "engines": { - "node": ">=6.4.0 <13 || >=14" - } - }, - "node_modules/superagent-proxy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-3.0.0.tgz", - "integrity": "sha512-wAlRInOeDFyd9pyonrkJspdRAxdLrcsZ6aSnS+8+nu4x1aXbz6FWSTT9M6Ibze+eG60szlL7JA8wEIV7bPWuyQ==", - "dependencies": { - "debug": "^4.3.2", - "proxy-agent": "^5.0.0" - }, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "superagent": ">= 0.15.4 || 1 || 2 || 3" - } - }, - "node_modules/superagent/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/superagent/node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/superagent/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/supertest": { "version": "6.3.3", "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.3.3.tgz", @@ -35324,9 +34948,9 @@ } }, "node_modules/type-fest": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.3.tgz", - "integrity": "sha512-V2+og4j/rWReWvaFrse3s9g2xvUv/K9Azm/xo6CjIuq7oeGqsoimC7+9/A3tfvNcbQf8RPSVj/HV81fB4DJrjA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.6.0.tgz", + "integrity": "sha512-RqTRtKTzvPpNdDUp1dVkKQRunlPITk4mXeqFlAZoJsS+fLRn8AdPK0TcQDumGayhU7fjlBfiBjsq3pe3rIfXZQ==", "dev": true, "optional": true, "peer": true, @@ -35768,6 +35392,7 @@ "version": "3.9.10", "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.10.tgz", "integrity": "sha512-AuECTSvwu2OHLAZYhG716YzwodKCIJxB6u1zG7PgSQwIgAlEaoXH52bxdcvT8GkGjnYK7r7yWDW0m0sOsPuBjQ==", + "dev": true, "dependencies": { "acorn": "^8.7.0", "acorn-walk": "^8.2.0" @@ -35783,6 +35408,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -36471,6 +36097,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -36615,14 +36242,6 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, - "node_modules/xregexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", - "integrity": "sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==", - "engines": { - "node": "*" - } - }, "node_modules/xss": { "version": "1.0.14", "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", @@ -44163,11 +43782,6 @@ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", "dev": true }, - "@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" - }, "@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -44434,6 +44048,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.0.1.tgz", "integrity": "sha512-8bVUjXZvJacUFkJXHdyZ9iH1Eaj5V7I8c4NdH5sQJsdXkqT4CA5Dhb4yb4VE/3asyx4L9ayZr1NIhTsWHczmMw==", + "dev": true, "requires": { "@types/minimatch": "^5.1.2", "@types/node": "*" @@ -44442,7 +44057,8 @@ "@types/minimatch": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==" + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true } } }, @@ -44650,12 +44266,6 @@ "form-data": "^3.0.0" } }, - "@types/node-mailjet": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/@types/node-mailjet/-/node-mailjet-3.3.9.tgz", - "integrity": "sha512-OSwpRjw0DPNCfRQTCcYOAT42uCcbOmAufZjHbqRW+MDsO3QOBTYajwT8J0JlRdgMdBrMEcEkIqLCbc0OSfSiRQ==", - "dev": true - }, "@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -46130,14 +45740,6 @@ "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "devOptional": true }, - "ast-types": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", - "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", - "requires": { - "tslib": "^2.0.1" - } - }, "ast-types-flow": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", @@ -49437,11 +49039,6 @@ "assert-plus": "^1.0.0" } }, - "data-uri-to-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", - "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==" - }, "data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -49587,7 +49184,8 @@ "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "devOptional": true }, "deepmerge": { "version": "4.3.0", @@ -49642,77 +49240,6 @@ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", "integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==" }, - "degenerator": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.2.tgz", - "integrity": "sha512-c0mef3SNQo56t6urUU6tdQAs+ThoD0o9B9MJ8HEt7NQcGEILCRFqQb7ZbP9JAv+QF1Ky5plydhMR/IrqWDm+TQ==", - "requires": { - "ast-types": "^0.13.2", - "escodegen": "^1.8.1", - "esprima": "^4.0.0", - "vm2": "^3.9.8" - }, - "dependencies": { - "escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "optional": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "requires": { - "prelude-ls": "~1.1.2" - } - } - } - }, "del": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/del/-/del-6.1.1.tgz", @@ -51459,7 +50986,8 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "devOptional": true }, "fast-safe-stringify": { "version": "2.1.1", @@ -51590,11 +51118,6 @@ "token-types": "^5.0.0-alpha.2" } }, - "file-uri-to-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz", - "integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==" - }, "filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -52004,38 +51527,6 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "optional": true }, - "ftp": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", - "integrity": "sha512-faFVML1aBx2UoDStmLwv2Wptt4vw5x03xxX172nhA5Y5HBshW5JweqQ2W4xL4dezQTG8inJsuYcpPHHU3X5OTQ==", - "requires": { - "readable-stream": "1.1.x", - "xregexp": "2.0.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" - } - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -52211,44 +51702,6 @@ "integrity": "sha512-YCcF28IqSay3fqpIu5y3Krg/utCBHBeoflkZyHj/QcqI2nrLPC3ZegS9CmIo+hJb8K7aiGsuUl7PwWVjNG2HQQ==", "dev": true }, - "get-uri": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz", - "integrity": "sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg==", - "requires": { - "@tootallnate/once": "1", - "data-uri-to-buffer": "3", - "debug": "4", - "file-uri-to-path": "2", - "fs-extra": "^8.1.0", - "ftp": "^0.3.10" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - } - } - }, "getos": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", @@ -52783,16 +52236,6 @@ "requires-port": "^1.0.0" } }, - "http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } - }, "http-proxy-middleware": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", @@ -53141,18 +52584,6 @@ "ci-info": "^2.0.0" } }, - "react-reconciler": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.26.2.tgz", - "integrity": "sha512-nK6kgY28HwrMNwDnMui3dvm3rCFjZrcGiuwLc5COUipBK5hWHLOxMJhSnSomirqWwjPBJKV1QcbkI0VJr7Gl1Q==", - "dev": true, - "peer": true, - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - } - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -53256,7 +52687,8 @@ "ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true }, "ipaddr.js": { "version": "2.0.1", @@ -57111,11 +56543,6 @@ } } }, - "netmask": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", - "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==" - }, "new-github-issue-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/new-github-issue-url/-/new-github-issue-url-0.2.1.tgz", @@ -57454,14 +56881,34 @@ "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, "node-mailjet": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-3.4.1.tgz", - "integrity": "sha512-m+msgBJYgwFbIZBIPOnsGOtBt9xP03UqmkmuEcgTcLlr/U1GUJQrVI7cDFRgujybb9Cl1wl4thIGyM3wt6X+zQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-6.0.2.tgz", + "integrity": "sha512-aLSWqzVVB7fSfEE9yFsWQ3mPOcGtKJYmQTcL6an+Y8ITLjF8RdvopXvENgSjLLfFNAaIJ0PhLgECxutbmR84wA==", "requires": { + "axios": "^0.27.2", "json-bigint": "^1.0.0", - "qs": "^6.5.0", - "superagent": "^7.1.1", - "superagent-proxy": "^3.0.0" + "url-join": "^4.0.0" + }, + "dependencies": { + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } } }, "node-polyglot": { @@ -58139,51 +57586,6 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, - "pac-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz", - "integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==", - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4", - "get-uri": "3", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "5", - "pac-resolver": "^5.0.0", - "raw-body": "^2.2.0", - "socks-proxy-agent": "5" - }, - "dependencies": { - "socks-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz", - "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==", - "requires": { - "agent-base": "^6.0.2", - "debug": "4", - "socks": "^2.3.3" - } - } - } - }, - "pac-resolver": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.1.tgz", - "integrity": "sha512-cy7u00ko2KVgBAjuhevqpPeHIkCIqPe1v24cydhWjmeuzaBfmUWFCZJ1iAh5TuVzVZoUzXIW7K8sMYOZ84uZ9Q==", - "requires": { - "degenerator": "^3.0.2", - "ip": "^1.1.5", - "netmask": "^2.0.2" - }, - "dependencies": { - "ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" - } - } - }, "packet-reader": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", @@ -59691,50 +59093,11 @@ } } }, - "proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz", - "integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==", - "requires": { - "agent-base": "^6.0.0", - "debug": "4", - "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^5.0.0", - "lru-cache": "^5.1.1", - "pac-proxy-agent": "^5.0.0", - "proxy-from-env": "^1.0.0", - "socks-proxy-agent": "^5.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "requires": { - "yallist": "^3.0.2" - } - }, - "socks-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz", - "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==", - "requires": { - "agent-base": "^6.0.2", - "debug": "4", - "socks": "^2.3.3" - } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - } - } - }, "proxy-from-env": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==" + "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", + "devOptional": true }, "prr": { "version": "1.0.1", @@ -60002,9 +59365,9 @@ } }, "react-devtools-core": { - "version": "4.27.1", - "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.1.tgz", - "integrity": "sha512-qXhcxxDWiFmFAOq48jts9YQYe1+wVoUXzJTlY4jbaATzyio6dd6CUGu3dXBhREeVgpZ+y4kg6vFJzIOZh6vY2w==", + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.2.tgz", + "integrity": "sha512-8SzmIkpO87alD7Xr6gWIEa1jHkMjawOZ+6egjazlnjB4UUcbnzGDf/vBJ4BzGuWWEM+pzrxuzsPpcMqlQkYK2g==", "dev": true, "peer": true, "requires": { @@ -60070,6 +59433,18 @@ "match-sorter": "^6.0.2" } }, + "react-reconciler": { + "version": "0.26.2", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.26.2.tgz", + "integrity": "sha512-nK6kgY28HwrMNwDnMui3dvm3rCFjZrcGiuwLc5COUipBK5hWHLOxMJhSnSomirqWwjPBJKV1QcbkI0VJr7Gl1Q==", + "dev": true, + "peer": true, + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "scheduler": "^0.20.2" + } + }, "react-refresh": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz", @@ -61320,9 +60695,9 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "shell-quote": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", - "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz", + "integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==", "dev": true, "peer": true }, @@ -61390,7 +60765,8 @@ "smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true }, "sockjs": { "version": "0.3.24", @@ -61413,6 +60789,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", + "dev": true, "requires": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -62158,60 +61535,6 @@ } } }, - "superagent": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-7.1.5.tgz", - "integrity": "sha512-HQYyGuDRFGmZ6GNC4hq2f37KnsY9Lr0/R1marNZTgMweVDQLTLJJ6DGQ9Tj/xVVs5HEnop9EMmTbywb5P30aqw==", - "requires": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.3", - "debug": "^4.3.4", - "fast-safe-stringify": "^2.1.1", - "form-data": "^4.0.0", - "formidable": "^2.0.1", - "methods": "^1.1.2", - "mime": "^2.5.0", - "qs": "^6.10.3", - "readable-stream": "^3.6.0", - "semver": "^7.3.7" - }, - "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "superagent-proxy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-3.0.0.tgz", - "integrity": "sha512-wAlRInOeDFyd9pyonrkJspdRAxdLrcsZ6aSnS+8+nu4x1aXbz6FWSTT9M6Ibze+eG60szlL7JA8wEIV7bPWuyQ==", - "requires": { - "debug": "^4.3.2", - "proxy-agent": "^5.0.0" - } - }, "supertest": { "version": "6.3.3", "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.3.3.tgz", @@ -62948,9 +62271,9 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, "type-fest": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.3.tgz", - "integrity": "sha512-V2+og4j/rWReWvaFrse3s9g2xvUv/K9Azm/xo6CjIuq7oeGqsoimC7+9/A3tfvNcbQf8RPSVj/HV81fB4DJrjA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.6.0.tgz", + "integrity": "sha512-RqTRtKTzvPpNdDUp1dVkKQRunlPITk4mXeqFlAZoJsS+fLRn8AdPK0TcQDumGayhU7fjlBfiBjsq3pe3rIfXZQ==", "dev": true, "optional": true, "peer": true @@ -63270,6 +62593,7 @@ "version": "3.9.10", "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.10.tgz", "integrity": "sha512-AuECTSvwu2OHLAZYhG716YzwodKCIJxB6u1zG7PgSQwIgAlEaoXH52bxdcvT8GkGjnYK7r7yWDW0m0sOsPuBjQ==", + "dev": true, "requires": { "acorn": "^8.7.0", "acorn-walk": "^8.2.0" @@ -63278,7 +62602,8 @@ "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true } } }, @@ -63793,7 +63118,8 @@ "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "devOptional": true }, "wordwrap": { "version": "1.0.0", @@ -63898,11 +63224,6 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, - "xregexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", - "integrity": "sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==" - }, "xss": { "version": "1.0.14", "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", diff --git a/package.json b/package.json index 02bef6965..06d38aa81 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "generate": "npx nx run-many --target generate --all", "postinstall": "(is-ci || husky install) && ngcc --properties es2020 browser module main", "lint": "nx workspace-lint && nx run-many --all --target=lint --parallel", + "lint:fix": "nx workspace-lint && nx run-many --all --target=lint --parallel --fix", "test": " nx run-many --all --target=test", "ts-node": "npx ts-node -r tsconfig-paths/register --project apps/api/tsconfig.json" }, @@ -55,9 +56,6 @@ "@sentry/node": "^7.36.0", "@sentry/types": "^7.36.0", "@tailwindcss/forms": "0.5.3", - "@types/faker": "^5.5.9", - "@types/glob": "^8.0.1", - "@types/node-mailjet": "^3.3.9", "apollo-server-core": "^3.10.1", "apollo-server-express": "^3.10.1", "apollo-server-plugin-base": "^3.6.2", @@ -96,7 +94,7 @@ "nestjs-console": "^8.0.0", "ng-zorro-antd": "^15.0.3", "node-fetch": "^2.6.9", - "node-mailjet": "^3.4.1", + "node-mailjet": "^6.0.2", "passport": "^0.6.0", "passport-jwt": "^4.0.1", "passport-local": "^1.0.0", @@ -172,6 +170,7 @@ "@types/express": "4.17.17", "@types/faker": "^5.5.9", "@types/fs-extra": "^11.0.1", + "@types/glob": "^8.0.1", "@types/jest": "28.1.8", "@types/jsonwebtoken": "^9.0.1", "@types/lodash": "^4.14.191", @@ -181,7 +180,6 @@ "@types/morgan": "^1.9.4", "@types/node": "18.13.0", "@types/node-fetch": "^2.6.2", - "@types/node-mailjet": "^3.3.9", "@types/passport-jwt": "^3.0.8", "@types/passport-local": "^1.0.35", "@types/pg": "^8.6.6", diff --git a/tools/scripts/publish.mjs b/tools/scripts/publish.mjs new file mode 100644 index 000000000..46e32113f --- /dev/null +++ b/tools/scripts/publish.mjs @@ -0,0 +1,63 @@ +/** + * This is a minimal script to publish your package to "npm". + * This is meant to be used as-is or customize as you see fit. + * + * This script is executed on "dist/path/to/library" as "cwd" by default. + * + * You might need to authenticate with NPM before running this script. + */ + +import { readCachedProjectGraph } from '@nrwl/devkit'; +import { execSync } from 'child_process'; +import { readFileSync, writeFileSync } from 'fs'; +import chalk from 'chalk'; + +function invariant(condition, message) { + if (!condition) { + console.error(chalk.bold.red(message)); + process.exit(1); + } +} + +// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag} +// Default "tag" to "next" so we won't publish the "latest" tag by accident. +const [, , name, version, tag = 'next'] = process.argv; + +// A simple SemVer validation to validate the version +const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/; +invariant( + version && validVersion.test(version), + `No version provided or version did not match Semantic Versioning, expected: #.#.#-tag.# or #.#.#, got ${version}.`, +); + +const graph = readCachedProjectGraph(); +const project = graph.nodes[name]; + +invariant( + project, + `Could not find project "${name}" in the workspace. Is the project.json configured correctly?`, +); + +const outputPath = project.data?.targets?.build?.options?.outputPath; +invariant( + outputPath, + `Could not find "build.options.outputPath" of project "${name}". Is project.json configured correctly?`, +); + +process.chdir(outputPath); + +// Updating the version in "package.json" before publishing +try { + const json = JSON.parse(readFileSync(`package.json`).toString()); + json.version = version; + writeFileSync(`package.json`, JSON.stringify(json, null, 2)); +} catch (e) { + console.error( + chalk.bold.red( + `Error reading package.json file from library build output.`, + ), + ); +} + +// Execute "npm publish" to publish +execSync(`npm publish --access public --tag ${tag}`); diff --git a/tsconfig.base.json b/tsconfig.base.json index cf7d1df85..303a120e1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -88,12 +88,17 @@ "@trxn/nestjs-file-storage": ["libs/nestjs/file-storage/src/index.ts"], "@trxn/nestjs-graphql": ["libs/nestjs/graphql/src/index.ts"], "@trxn/nestjs-mailer": ["libs/nestjs/mailer/src/index.ts"], + "@trxn/nestjs-mailjet": ["libs/nestjs/mailjet/src/index.ts"], "@trxn/nestjs-password": ["libs/nestjs/password/src/index.ts"], "@trxn/nestjs-request-timestamp": [ "libs/nestjs/request-timestamp/src/index.ts" ], + "@trxn/nestjs-reset-password": [ + "libs/nestjs/reset-password/src/index.ts" + ], "@trxn/nestjs-sentry": ["libs/nestjs/sentry/src/index.ts"], "@trxn/nestjs-testing": ["libs/nestjs/testing/src/index.ts"], + "@trxn/nestjs-user": ["libs/nestjs/user/src/index.ts"], "@trxn/nestjs-winston": ["libs/nestjs/winston/src/index.ts"], "@trxn/prettier-config": ["libs/config/prettier/src/index.ts"], "@trxn/schematics": ["libs/schematics/src/index.ts"], diff --git a/workspace.json b/workspace.json index 85e1b4594..8beb7d371 100644 --- a/workspace.json +++ b/workspace.json @@ -51,10 +51,13 @@ "nestjs-file-storage": "libs/nestjs/file-storage", "nestjs-graphql": "libs/nestjs/graphql", "nestjs-mailer": "libs/nestjs/mailer", + "nestjs-mailjet": "libs/nestjs/mailjet", "nestjs-password": "libs/nestjs/password", "nestjs-request-timestamp": "libs/nestjs/request-timestamp", + "nestjs-reset-password": "libs/nestjs/reset-password", "nestjs-sentry": "libs/nestjs/sentry", "nestjs-testing": "libs/nestjs/testing", + "nestjs-user": "libs/nestjs/user", "nestjs-winston": "libs/nestjs/winston", "prettier-config": "libs/config/prettier", "pwa": "apps/pwa", diff --git a/workspace/CHANGELOG.md b/workspace/CHANGELOG.md index b7e2ca15d..6f85bc175 100644 --- a/workspace/CHANGELOG.md +++ b/workspace/CHANGELOG.md @@ -2,6 +2,14 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +# [2.1.0-next.1](https://github.com/tractr/traxion/compare/v2.1.0-next.0...v2.1.0-next.1) (2023-02-27) + + + +# [2.1.0-next.0](https://github.com/tractr/traxion/compare/v2.0.13...v2.1.0-next.0) (2023-02-27) + + + ## [2.0.13](https://github.com/tractr/traxion/compare/v2.0.12...v2.0.13) (2023-02-24)