@volontariapp/database 3.4.3 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +69 -0
  3. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - README bump
8
+
9
+ - Updated dependencies []:
10
+ - @volontariapp/bridge@1.0.5
11
+ - @volontariapp/config@3.2.1
12
+ - @volontariapp/errors@0.6.1
13
+ - @volontariapp/logger@0.2.6
14
+ - @volontariapp/messaging@2.10.1
15
+ - @volontariapp/shared@0.8.1
16
+
3
17
  ## 3.4.3
4
18
 
5
19
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @volontariapp/database
2
+
3
+ ## Overview
4
+ Le package `database` centralise toute la configuration, les adaptateurs et les utilitaires liés à la persistance relationnelle de données.
5
+ L'infrastructure globale de Volontariapp reposant sur **TypeORM** (et PostgreSQL en production), ce package évite la duplication des configurations de pooling, de logging SQL, et des helpers de migration dans chaque microservice.
6
+
7
+ ## Architecture d'Accès aux Données
8
+
9
+ ```mermaid
10
+ classDiagram
11
+ direction TB
12
+
13
+ class Microservice {
14
+ +Repository()
15
+ }
16
+
17
+ class DatabasePackage {
18
+ <<@volontariapp/database>>
19
+ +TypeOrmFactory
20
+ +TransactionManager
21
+ +BaseEntity
22
+ }
23
+
24
+ class Driver {
25
+ <<TypeORM>>
26
+ Connection Pool
27
+ }
28
+
29
+ class PG {
30
+ <<PostgreSQL>>
31
+ }
32
+
33
+ Microservice --> DatabasePackage : Importe la configuration
34
+ DatabasePackage --> Driver : Standardise les options (SSL, Pool)
35
+ Driver --> PG : Exécute requêtes TCP
36
+ ```
37
+
38
+ ## Key Features
39
+ - **Factories TypeORM Standardisées** : Configurations communes prêtes à l'emploi (logging unifié, SSL configs, Pool size dynamique).
40
+ - **Utilitaires de Transaction** : Helpers pour propager le contexte transactionnel (EntityManager) de manière propre.
41
+ - **Entities de Base** : Classes abstraites contenant les champs génériques (ex: `createdAt`, `updatedAt`, `id`).
42
+
43
+ ## Exemple d'Utilisation
44
+
45
+ ### Utilisation de la Configuration Commune
46
+
47
+ Au lieu de recoder les spécificités de connexion PostgreSQL dans chaque microservice, on utilise la Factory partagée :
48
+
49
+ ```typescript
50
+ import { createTypeOrmOptions } from '@volontariapp/database';
51
+ import { TypeOrmModule } from '@nestjs/typeorm';
52
+
53
+ @Module({
54
+ imports: [
55
+ TypeOrmModule.forRootAsync({
56
+ useFactory: (configService: ConfigService) => {
57
+ // Applique les standards de Volontariapp (SSL, Pool, Naming Strategy)
58
+ return createTypeOrmOptions({
59
+ url: configService.get('DATABASE_URL'),
60
+ entities: [__dirname + '/**/*.entity{.ts,.js}'],
61
+ migrationsRun: true, // Auto-migration au boot
62
+ });
63
+ },
64
+ inject: [ConfigService],
65
+ }),
66
+ ],
67
+ })
68
+ export class AppModule {}
69
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/database",
3
- "version": "3.4.3",
3
+ "version": "3.4.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -40,12 +40,12 @@
40
40
  "db:down": "docker-compose -f ../../docker-compose.test.yml down"
41
41
  },
42
42
  "dependencies": {
43
- "@volontariapp/bridge": "1.0.4",
44
- "@volontariapp/config": "3.2.0",
45
- "@volontariapp/errors": "0.6.0",
46
- "@volontariapp/logger": "0.2.5",
47
- "@volontariapp/messaging": "2.10.0",
48
- "@volontariapp/shared": "0.8.0",
43
+ "@volontariapp/bridge": "1.0.5",
44
+ "@volontariapp/config": "3.2.1",
45
+ "@volontariapp/errors": "0.6.1",
46
+ "@volontariapp/logger": "0.2.6",
47
+ "@volontariapp/messaging": "2.10.1",
48
+ "@volontariapp/shared": "0.8.1",
49
49
  "class-transformer": "^0.5.1",
50
50
  "class-validator": "^0.14.1",
51
51
  "pg": "^8.20.0",
@@ -56,7 +56,7 @@
56
56
  "@types/jest": "^30.0.0",
57
57
  "@types/node": "^22.10.7",
58
58
  "@types/pg": "^8",
59
- "@volontariapp/testing": "1.0.1",
59
+ "@volontariapp/testing": "1.0.2",
60
60
  "bullmq": "^5.76.5",
61
61
  "ioredis": "^5.10.1",
62
62
  "jest": "^30.3.0",