From a46d9416ad752160fe92354aaf28219a08810273 Mon Sep 17 00:00:00 2001 From: sbriat Date: Tue, 17 Oct 2023 11:27:52 +0200 Subject: [PATCH 1/2] update configuration module --- package-lock.json | 96 +++++++++---------- package.json | 6 +- src/app.constants.ts | 11 +++ src/app.module.ts | 28 ++++-- src/main.ts | 3 +- .../ad/infrastructure/ad.repository.ts | 3 +- 6 files changed, 86 insertions(+), 61 deletions(-) diff --git a/package-lock.json b/package-lock.json index b900d62..8430a2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@grpc/grpc-js": "^1.9.5", "@grpc/proto-loader": "^0.7.10", - "@mobicoop/configuration-module": "^2.0.0", + "@mobicoop/configuration-module": "^3.0.0", "@mobicoop/ddd-library": "^2.0.0", "@mobicoop/health-module": "^2.3.1", "@mobicoop/message-broker-module": "^2.1.1", @@ -43,8 +43,8 @@ "@types/node": "20.8.6", "@types/supertest": "^2.0.14", "@types/uuid": "^9.0.5", - "@typescript-eslint/eslint-plugin": "^6.7.5", - "@typescript-eslint/parser": "^6.7.5", + "@typescript-eslint/eslint-plugin": "^6.8.0", + "@typescript-eslint/parser": "^6.8.0", "dotenv-cli": "^7.3.0", "eslint": "^8.51.0", "eslint-config-prettier": "^9.0.0", @@ -1567,9 +1567,9 @@ } }, "node_modules/@mobicoop/configuration-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@mobicoop/configuration-module/-/configuration-module-2.0.0.tgz", - "integrity": "sha512-Dncb+jrU5x7nDlpoEw9IvYYRI2pNW0iadG//vh04mmgaRJS84LmWKZSvMT/LQ2fZtafqHTHlNga78bN5Be2/Pg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@mobicoop/configuration-module/-/configuration-module-3.0.0.tgz", + "integrity": "sha512-oYRpOBRQbrM8SQGsKrXaf3qbKDZwUGrPkvZAcVIT6zQydjbgLv8ev89gKfyZb3ouLfvtFdVQUmkP9GkFz4+xRg==", "dependencies": { "@golevelup/nestjs-rabbitmq": "^4.0.0", "@nestjs/cqrs": "^10.2.6", @@ -2724,16 +2724,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz", - "integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.8.0.tgz", + "integrity": "sha512-GosF4238Tkes2SHPQ1i8f6rMtG6zlKwMEB0abqSJ3Npvos+doIlc/ATG+vX1G9coDF3Ex78zM3heXHLyWEwLUw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/type-utils": "6.7.5", - "@typescript-eslint/utils": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/scope-manager": "6.8.0", + "@typescript-eslint/type-utils": "6.8.0", + "@typescript-eslint/utils": "6.8.0", + "@typescript-eslint/visitor-keys": "6.8.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -2759,15 +2759,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz", - "integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.8.0.tgz", + "integrity": "sha512-5tNs6Bw0j6BdWuP8Fx+VH4G9fEPDxnVI7yH1IAPkQH5RUtvKwRoqdecAPdQXv4rSOADAaz1LFBZvZG7VbXivSg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/typescript-estree": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/scope-manager": "6.8.0", + "@typescript-eslint/types": "6.8.0", + "@typescript-eslint/typescript-estree": "6.8.0", + "@typescript-eslint/visitor-keys": "6.8.0", "debug": "^4.3.4" }, "engines": { @@ -2787,13 +2787,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz", - "integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.8.0.tgz", + "integrity": "sha512-xe0HNBVwCph7rak+ZHcFD6A+q50SMsFwcmfdjs9Kz4qDh5hWhaPhFjRs/SODEhroBI5Ruyvyz9LfwUJ624O40g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5" + "@typescript-eslint/types": "6.8.0", + "@typescript-eslint/visitor-keys": "6.8.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2804,13 +2804,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz", - "integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.8.0.tgz", + "integrity": "sha512-RYOJdlkTJIXW7GSldUIHqc/Hkto8E+fZN96dMIFhuTJcQwdRoGN2rEWA8U6oXbLo0qufH7NPElUb+MceHtz54g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.7.5", - "@typescript-eslint/utils": "6.7.5", + "@typescript-eslint/typescript-estree": "6.8.0", + "@typescript-eslint/utils": "6.8.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2831,9 +2831,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz", - "integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.8.0.tgz", + "integrity": "sha512-p5qOxSum7W3k+llc7owEStXlGmSl8FcGvhYt8Vjy7FqEnmkCVlM3P57XQEGj58oqaBWDQXbJDZxwUWMS/EAPNQ==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2844,13 +2844,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz", - "integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.8.0.tgz", + "integrity": "sha512-ISgV0lQ8XgW+mvv5My/+iTUdRmGspducmQcDw5JxznasXNnZn3SKNrTRuMsEXv+V/O+Lw9AGcQCfVaOPCAk/Zg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/types": "6.8.0", + "@typescript-eslint/visitor-keys": "6.8.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2871,17 +2871,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz", - "integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.8.0.tgz", + "integrity": "sha512-dKs1itdE2qFG4jr0dlYLQVppqTE+Itt7GmIf/vX6CSvsW+3ov8PbWauVKyyfNngokhIO9sKZeRGCUo1+N7U98Q==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/scope-manager": "6.8.0", + "@typescript-eslint/types": "6.8.0", + "@typescript-eslint/typescript-estree": "6.8.0", "semver": "^7.5.4" }, "engines": { @@ -2896,12 +2896,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz", - "integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.8.0.tgz", + "integrity": "sha512-oqAnbA7c+pgOhW2OhGvxm0t1BULX5peQI/rLsNDpGM78EebV3C9IGbX5HNZabuZ6UQrYveCLjKo8Iy/lLlBkkg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/types": "6.8.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/package.json b/package.json index e5ee031..2db9346 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@grpc/grpc-js": "^1.9.5", "@grpc/proto-loader": "^0.7.10", "@songkeys/nestjs-redis": "^10.0.0", - "@mobicoop/configuration-module": "^2.0.0", + "@mobicoop/configuration-module": "^3.0.0", "@mobicoop/ddd-library": "^2.0.0", "@mobicoop/health-module": "^2.3.1", "@mobicoop/message-broker-module": "^2.1.1", @@ -64,8 +64,8 @@ "@types/node": "20.8.6", "@types/supertest": "^2.0.14", "@types/uuid": "^9.0.5", - "@typescript-eslint/eslint-plugin": "^6.7.5", - "@typescript-eslint/parser": "^6.7.5", + "@typescript-eslint/eslint-plugin": "^6.8.0", + "@typescript-eslint/parser": "^6.8.0", "dotenv-cli": "^7.3.0", "eslint": "^8.51.0", "eslint-config-prettier": "^9.0.0", diff --git a/src/app.constants.ts b/src/app.constants.ts index 76bbc49..9db7ad6 100644 --- a/src/app.constants.ts +++ b/src/app.constants.ts @@ -1,2 +1,13 @@ +// service export const SERVICE_NAME = 'ad'; + +// configuration +export const SERVICE_CONFIGURATION_SET_QUEUE = 'ad-configuration-set'; +export const SERVICE_CONFIGURATION_DELETE_QUEUE = 'ad-configuration-delete'; +export const SERVICE_CONFIGURATION_PROPAGATE_QUEUE = + 'ad-configuration-propagate'; + +// health +export const HEALTH_SERVICE_NAME = 'health'; +export const HEALTH_AD_REPOSITORY = 'AdRepository'; export const HEALTH_CRITICAL_LOGGING_KEY = 'logging.ad.health.crit'; diff --git a/src/app.module.ts b/src/app.module.ts index f39ade0..755fa2e 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -13,7 +13,14 @@ import { AD_REPOSITORY } from '@modules/ad/ad.di-tokens'; import { MESSAGE_PUBLISHER } from '@modules/messager/messager.di-tokens'; import { HealthModuleOptions } from '@mobicoop/health-module/dist/core/domain/types/health.types'; import { MessagePublisherPort } from '@mobicoop/ddd-library'; -import { HEALTH_CRITICAL_LOGGING_KEY, SERVICE_NAME } from './app.constants'; +import { + HEALTH_AD_REPOSITORY, + HEALTH_CRITICAL_LOGGING_KEY, + SERVICE_CONFIGURATION_DELETE_QUEUE, + SERVICE_CONFIGURATION_PROPAGATE_QUEUE, + SERVICE_CONFIGURATION_SET_QUEUE, + SERVICE_NAME, +} from './app.constants'; @Module({ imports: [ @@ -31,18 +38,23 @@ import { HEALTH_CRITICAL_LOGGING_KEY, SERVICE_NAME } from './app.constants'; ) as string, messageBroker: { uri: configService.get('MESSAGE_BROKER_URI') as string, - exchange: configService.get( - 'MESSAGE_BROKER_EXCHANGE', - ) as string, + exchange: { + name: configService.get( + 'MESSAGE_BROKER_EXCHANGE', + ) as string, + durable: configService.get( + 'MESSAGE_BROKER_EXCHANGE_DURABILITY', + ) as boolean, + }, }, redis: { host: configService.get('REDIS_HOST') as string, password: configService.get('REDIS_PASSWORD'), port: configService.get('REDIS_PORT') as number, }, - setConfigurationBrokerQueue: 'ad-configuration-create-update', - deleteConfigurationQueue: 'ad-configuration-delete', - propagateConfigurationQueue: 'ad-configuration-propagate', + setConfigurationQueue: SERVICE_CONFIGURATION_SET_QUEUE, + deleteConfigurationQueue: SERVICE_CONFIGURATION_DELETE_QUEUE, + propagateConfigurationQueue: SERVICE_CONFIGURATION_PROPAGATE_QUEUE, }), }), HealthModule.forRootAsync({ @@ -56,7 +68,7 @@ import { HEALTH_CRITICAL_LOGGING_KEY, SERVICE_NAME } from './app.constants'; criticalLoggingKey: HEALTH_CRITICAL_LOGGING_KEY, checkRepositories: [ { - name: 'AdRepository', + name: HEALTH_AD_REPOSITORY, repository: adRepository, }, ], diff --git a/src/main.ts b/src/main.ts index f34b2c1..892b16c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,6 +2,7 @@ import { NestFactory } from '@nestjs/core'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { join } from 'path'; import { AppModule } from './app.module'; +import { HEALTH_SERVICE_NAME, SERVICE_NAME } from './app.constants'; async function bootstrap() { const app = await NestFactory.create(AppModule); @@ -11,7 +12,7 @@ async function bootstrap() { app.connectMicroservice({ transport: Transport.GRPC, options: { - package: ['ad', 'health'], + package: [SERVICE_NAME, HEALTH_SERVICE_NAME], protoPath: [ join(__dirname, 'modules/ad/interface/grpc-controllers/ad.proto'), join(__dirname, 'health.proto'), diff --git a/src/modules/ad/infrastructure/ad.repository.ts b/src/modules/ad/infrastructure/ad.repository.ts index ec2de6d..583b39f 100644 --- a/src/modules/ad/infrastructure/ad.repository.ts +++ b/src/modules/ad/infrastructure/ad.repository.ts @@ -10,6 +10,7 @@ import { } from '@mobicoop/ddd-library'; import { PrismaService } from './prisma.service'; import { AD_MESSAGE_PUBLISHER } from '../ad.di-tokens'; +import { SERVICE_NAME } from '@src/app.constants'; export type AdBaseModel = { uuid: string; @@ -86,7 +87,7 @@ export class AdRepository eventEmitter, new LoggerBase({ logger: new Logger(AdRepository.name), - domain: 'ad', + domain: SERVICE_NAME, messagePublisher, }), ); From 018705b77065ada05d71bab003eb6f0bbc5115b2 Mon Sep 17 00:00:00 2001 From: sbriat Date: Tue, 17 Oct 2023 11:27:59 +0200 Subject: [PATCH 2/2] 2.2.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8430a2b..54fca6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mobicoop/ad", - "version": "2.2.0", + "version": "2.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mobicoop/ad", - "version": "2.2.0", + "version": "2.2.1", "license": "AGPL", "dependencies": { "@grpc/grpc-js": "^1.9.5", diff --git a/package.json b/package.json index 2db9346..7e4bc55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mobicoop/ad", - "version": "2.2.0", + "version": "2.2.1", "description": "Mobicoop V3 Ad", "author": "sbriat", "private": true,