Merge branch 'upgradePackages' into 'main'

Upgrade packages

See merge request v3/service/auth!62
This commit is contained in:
Sylvain Briat 2024-01-16 16:35:00 +00:00
commit 754cc002c4
7 changed files with 950 additions and 991 deletions

1817
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@mobicoop/auth", "name": "@mobicoop/auth",
"version": "0.8.1", "version": "0.8.2",
"description": "Mobicoop V3 Auth Service", "description": "Mobicoop V3 Auth Service",
"author": "sbriat", "author": "sbriat",
"private": true, "private": true,
@ -30,58 +30,57 @@
"migrate:deploy": "npx prisma migrate deploy" "migrate:deploy": "npx prisma migrate deploy"
}, },
"dependencies": { "dependencies": {
"@golevelup/nestjs-rabbitmq": "^4.0.0", "@golevelup/nestjs-rabbitmq": "^4.1.0",
"@grpc/grpc-js": "^1.9.9", "@grpc/grpc-js": "^1.9.13",
"@grpc/proto-loader": "^0.7.10", "@grpc/proto-loader": "^0.7.10",
"@mobicoop/configuration-module": "^7.2.1", "@mobicoop/configuration-module": "^8.0.0",
"@mobicoop/ddd-library": "^2.1.1", "@mobicoop/ddd-library": "^2.4.3",
"@mobicoop/health-module": "^2.3.1", "@mobicoop/health-module": "^2.3.2",
"@mobicoop/message-broker-module": "^2.1.1", "@mobicoop/message-broker-module": "^2.1.2",
"@nestjs/axios": "^3.0.1", "@nestjs/axios": "^3.0.1",
"@nestjs/common": "^10.2.8", "@nestjs/common": "^10.3.0",
"@nestjs/config": "^3.1.1", "@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.8", "@nestjs/core": "^10.3.0",
"@nestjs/cqrs": "^10.2.6", "@nestjs/cqrs": "^10.2.6",
"@nestjs/event-emitter": "^2.0.2", "@nestjs/event-emitter": "^2.0.3",
"@nestjs/microservices": "^10.2.8", "@nestjs/microservices": "^10.3.0",
"@nestjs/platform-express": "^10.2.8", "@nestjs/platform-express": "^10.3.0",
"@nestjs/terminus": "^10.1.1", "@nestjs/terminus": "^10.2.0",
"@prisma/client": "^5.5.2", "@prisma/client": "^5.8.1",
"argon2": "^0.31.2", "argon2": "^0.31.2",
"axios": "^1.6.0", "axios": "^1.6.5",
"bcrypt": "5.1.0", "bcrypt": "5.1.0",
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.14.0", "class-validator": "^0.14.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"rxjs": "^7.8.1" "rxjs": "^7.8.1"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^10.2.1", "@nestjs/cli": "^10.3.0",
"@nestjs/schematics": "^10.0.3", "@nestjs/schematics": "^10.1.0",
"@nestjs/testing": "^10.2.8", "@nestjs/testing": "^10.3.0",
"@types/bcrypt": "^5.0.1", "@types/bcrypt": "^5.0.2",
"@types/express": "^4.17.20", "@types/express": "^4.17.21",
"@types/jest": "29.5.7", "@types/jest": "29.5.11",
"@types/node": "^20.8.10", "@types/node": "^20.11.4",
"@types/supertest": "^2.0.15", "@types/supertest": "^6.0.2",
"@types/uuid": "^9.0.6", "@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.9.1", "@typescript-eslint/parser": "^6.19.0",
"dotenv-cli": "^7.3.0", "dotenv-cli": "^7.3.0",
"eslint": "^8.52.0", "eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.1.3",
"jest": "29.7.0", "jest": "29.7.0",
"prettier": "^3.0.3", "prettier": "^3.2.2",
"prisma": "^5.5.2", "prisma": "^5.8.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"supertest": "^6.3.3", "supertest": "^6.3.4",
"ts-jest": "29.1.1", "ts-jest": "29.1.1",
"ts-loader": "^9.5.0", "ts-loader": "^9.5.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typescript": "^5.2.2", "typescript": "^5.3.3",
"uuid": "^9.0.1" "uuid": "^9.0.1"
}, },
"jest": { "jest": {

View File

@ -1,7 +1,4 @@
import { import { KeyType, Type } from '@mobicoop/configuration-module';
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { IsStrongPasswordOptions } from 'class-validator'; import { IsStrongPasswordOptions } from 'class-validator';
export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = { export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = {
@ -13,9 +10,9 @@ export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = {
}; };
export const AUTH_CONFIG_ENCRYPTION_ALGORITHM = 'encryptionAlgorithm'; export const AUTH_CONFIG_ENCRYPTION_ALGORITHM = 'encryptionAlgorithm';
export const AuthConfig: ConfigurationDomainGet[] = [ export const AuthKeyTypes: KeyType[] = [
{ {
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM, key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
type: ConfigurationType.STRING, type: Type.STRING,
}, },
]; ];

View File

@ -17,13 +17,13 @@ import {
UsernameAlreadyExistsException, UsernameAlreadyExistsException,
} from '@modules/authentication/core/domain/authentication.errors'; } from '@modules/authentication/core/domain/authentication.errors';
import { import {
ConfigurationDomain,
Configurator, Configurator,
Domain,
GetConfigurationRepositoryPort, GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module'; } from '@mobicoop/configuration-module';
import { import {
AUTH_CONFIG_ENCRYPTION_ALGORITHM, AUTH_CONFIG_ENCRYPTION_ALGORITHM,
AuthConfig, AuthKeyTypes,
} from '@modules/authentication/authentication.constants'; } from '@modules/authentication/authentication.constants';
import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types'; import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types';
import { PasswordEncrypter } from '@modules/authentication/infrastructure/password-encrypter'; import { PasswordEncrypter } from '@modules/authentication/infrastructure/password-encrypter';
@ -40,10 +40,7 @@ export class CreateAuthenticationService implements ICommandHandler {
async execute(command: CreateAuthenticationCommand): Promise<AggregateID> { async execute(command: CreateAuthenticationCommand): Promise<AggregateID> {
const authConfigurator: Configurator = const authConfigurator: Configurator =
await this.configurationRepository.mget( await this.configurationRepository.mget(Domain.AUTH, AuthKeyTypes);
ConfigurationDomain.AUTH,
AuthConfig,
);
const passwordEncrypter: PasswordEncrypterPort = new PasswordEncrypter( const passwordEncrypter: PasswordEncrypterPort = new PasswordEncrypter(
authConfigurator.get<EncryptionAlgorithm>( authConfigurator.get<EncryptionAlgorithm>(
AUTH_CONFIG_ENCRYPTION_ALGORITHM, AUTH_CONFIG_ENCRYPTION_ALGORITHM,

View File

@ -9,13 +9,13 @@ import { UpdatePasswordCommand } from './update-password.command';
import { AuthenticationRepositoryPort } from '../../ports/authentication.repository.port'; import { AuthenticationRepositoryPort } from '../../ports/authentication.repository.port';
import { AuthenticationEntity } from '@modules/authentication/core/domain/authentication.entity'; import { AuthenticationEntity } from '@modules/authentication/core/domain/authentication.entity';
import { import {
ConfigurationDomain, Domain,
Configurator, Configurator,
GetConfigurationRepositoryPort, GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module'; } from '@mobicoop/configuration-module';
import { import {
AUTH_CONFIG_ENCRYPTION_ALGORITHM, AUTH_CONFIG_ENCRYPTION_ALGORITHM,
AuthConfig, AuthKeyTypes,
} from '@modules/authentication/authentication.constants'; } from '@modules/authentication/authentication.constants';
import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types'; import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types';
import { PasswordEncrypterPort } from '../../ports/password-encrypter.port'; import { PasswordEncrypterPort } from '../../ports/password-encrypter.port';
@ -32,10 +32,7 @@ export class UpdatePasswordService implements ICommandHandler {
async execute(command: UpdatePasswordCommand): Promise<AggregateID> { async execute(command: UpdatePasswordCommand): Promise<AggregateID> {
const authConfigurator: Configurator = const authConfigurator: Configurator =
await this.configurationRepository.mget( await this.configurationRepository.mget(Domain.AUTH, AuthKeyTypes);
ConfigurationDomain.AUTH,
AuthConfig,
);
const encryptionAlgorithm: EncryptionAlgorithm = const encryptionAlgorithm: EncryptionAlgorithm =
authConfigurator.get<EncryptionAlgorithm>( authConfigurator.get<EncryptionAlgorithm>(
AUTH_CONFIG_ENCRYPTION_ALGORITHM, AUTH_CONFIG_ENCRYPTION_ALGORITHM,

View File

@ -1,8 +1,8 @@
import { import {
ConfigurationDomain, Domain,
ConfigurationDomainGet,
Configurator, Configurator,
GetConfigurationRepositoryPort, GetConfigurationRepositoryPort,
KeyType,
} from '@mobicoop/configuration-module'; } from '@mobicoop/configuration-module';
import { import {
AggregateID, AggregateID,
@ -58,12 +58,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(), get: jest.fn(),
mget: jest.fn().mockImplementation( mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => { (domain: Domain, keyTypes: KeyType[]) => {
switch (domain) { switch (domain) {
case ConfigurationDomain.AUTH: case Domain.AUTH:
return new Configurator(ConfigurationDomain.AUTH, [ return new Configurator(Domain.AUTH, [
{ {
domain: ConfigurationDomain.AUTH, domain: Domain.AUTH,
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM, key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
value: 'BCRYPT', value: 'BCRYPT',
}, },

View File

@ -9,10 +9,10 @@ import { UpdatePasswordRequestDto } from '@modules/authentication/interface/grpc
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { UpdatePasswordCommand } from '@modules/authentication/core/application/commands/update-password/update-password.command'; import { UpdatePasswordCommand } from '@modules/authentication/core/application/commands/update-password/update-password.command';
import { import {
ConfigurationDomain, Domain,
ConfigurationDomainGet,
Configurator, Configurator,
GetConfigurationRepositoryPort, GetConfigurationRepositoryPort,
KeyType,
} from '@mobicoop/configuration-module'; } from '@mobicoop/configuration-module';
import { AUTH_CONFIG_ENCRYPTION_ALGORITHM } from '@modules/authentication/authentication.constants'; import { AUTH_CONFIG_ENCRYPTION_ALGORITHM } from '@modules/authentication/authentication.constants';
@ -38,12 +38,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(), get: jest.fn(),
mget: jest.fn().mockImplementation( mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => { (domain: Domain, keyTypes: KeyType[]) => {
switch (domain) { switch (domain) {
case ConfigurationDomain.AUTH: case Domain.AUTH:
return new Configurator(ConfigurationDomain.AUTH, [ return new Configurator(Domain.AUTH, [
{ {
domain: ConfigurationDomain.AUTH, domain: Domain.AUTH,
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM, key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
value: 'BCRYPT', value: 'BCRYPT',
}, },