@volontariapp/messaging 2.10.1 → 2.10.2

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 +9 -0
  2. package/README.md +26 -26
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - README bump
8
+
9
+ - Updated dependencies []:
10
+ - @volontariapp/contracts@4.3.3
11
+
3
12
  ## 2.10.1
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -1,53 +1,53 @@
1
1
  # @volontariapp/messaging
2
2
 
3
- Universal messaging contracts and architecture for Volontariapp.
3
+ Contrats de messagerie universels et architecture asynchrone pour Volontariapp.
4
4
 
5
- ## 🏗 LOB (Local Outbox) Architecture
5
+ ## Architecture LOB (Local Outbox)
6
6
 
7
- The **LOB (Local Outbox)** pattern is used to ensure reliable message delivery between microservices while maintaining database consistency. It follows the **Change Data Capture (CDC)** approach.
7
+ Le pattern **LOB (Local Outbox)** est utilisé pour garantir la livraison fiable des messages entre les microservices tout en préservant la cohérence de la base de données. Il suit l'approche **Change Data Capture (CDC)**.
8
8
 
9
- ### 🔄 Data Flow
9
+ ### Flux de Données
10
10
 
11
- 1. **Database Change**: A transaction modifies data in a microservice's database (e.g., `ms-event`).
12
- 2. **SQL Trigger**: A native database trigger captures the change and inserts a record into the `event_queue` table.
13
- 3. **Outbox Table**: The `event_queue` (or `jobs_outbox`) table stores the event with its payload (`before`/`after`) and status (`PENDING`).
14
- 4. **Dispatcher**: A background worker polls the outbox table, sends the message to the broker (RabbitMQ/Kafka), and marks the record as `COMPLETED`.
11
+ 1. **Modification en Base** : Une transaction modifie des données dans la base de données d'un microservice (ex: `ms-event`).
12
+ 2. **Trigger SQL** : Un trigger natif en base capture le changement et insère un enregistrement dans la table `event_queue`.
13
+ 3. **Table Outbox** : La table `event_queue` (ou `jobs_outbox`) stocke l'événement avec sa charge utile (payload `before`/`after`) et son statut (`PENDING`).
14
+ 4. **Dispatcher** : Un worker en arrière-plan (Outbox Runner) scrute la table outbox, envoie le message au broker (Redis Streams/BullMQ), et marque l'enregistrement comme `COMPLETED`.
15
15
 
16
- ### Package Structure
16
+ ### Structure du Package
17
17
 
18
- This package centralizes all message definitions to ensure type safety across the monorepo.
18
+ Ce package centralise toutes les définitions de messages pour garantir la sécurité du typage à travers le monorepo.
19
19
 
20
- * **`events/`**: Definitions for domain events triggered by database changes.
21
- * **`jobs/`**: Definitions for asynchronous jobs (e.g., sending emails).
22
- * **`EventRegistry`**: A central TypeScript registry mapping event types to their respective payloads.
20
+ * **`events/`** : Définitions des événements métiers déclenchés par des changements en base de données.
21
+ * **`jobs/`** : Définitions des tâches asynchrones (ex: envoi d'emails).
22
+ * **`EventRegistry`** : Un registre TypeScript centralisé qui mappe les types d'événements à leurs charges utiles respectives.
23
23
 
24
- ## 🛠 Usage
24
+ ## Utilisation
25
25
 
26
- ### Event Structure
26
+ ### Structure d'un Événement
27
27
 
28
- All domain events follow a standard `EventChangedPayload` structure:
28
+ Tous les événements métiers suivent une structure standard `EventChangedPayload` :
29
29
 
30
30
  ```typescript
31
31
  export interface EventChangedPayload<T> {
32
- before: T | null; // State before the change (null on INSERT)
33
- after: T | null; // State after the change (null on DELETE)
32
+ before: T | null; // État avant le changement (null pour un INSERT)
33
+ after: T | null; // État après le changement (null pour un DELETE)
34
34
  }
35
35
  ```
36
36
 
37
- ### Type Safety
37
+ ### Sécurité du Typage (Type Safety)
38
38
 
39
- Use the `EventRegistry` to get strict typing when consuming events:
39
+ Utilisez l'`EventRegistry` pour obtenir un typage strict lors de la consommation des événements :
40
40
 
41
41
  ```typescript
42
42
  import { EventMessagingType, type EventRegistry } from '@volontariapp/messaging';
43
43
 
44
44
  type RequirementEvent = EventRegistry[EventMessagingType.REQUIREMENT_CHANGED];
45
- // RequirementEvent now has the correct payload structure (before/after ITagPayload)
45
+ // RequirementEvent possède désormais la bonne structure de payload (before/after ITagPayload)
46
46
  ```
47
47
 
48
- ## Adding a New Event
48
+ ## Ajouter un Nouvel Événement
49
49
 
50
- 1. Define the payload interface in `src/events/[domain]/payloads.ts`.
51
- 2. Add the event type to the `EventMessagingType` enum.
52
- 3. Register the mapping in the `EventRegistry` interface in `src/events/index.ts`.
53
- 4. Implement the SQL trigger in the corresponding microservice to populate the outbox.
50
+ 1. Définissez l'interface du payload dans `src/events/[domain]/payloads.ts`.
51
+ 2. Ajoutez le type d'événement à l'énumération `EventMessagingType`.
52
+ 3. Enregistrez le mapping dans l'interface `EventRegistry` dans `src/events/index.ts`.
53
+ 4. Implémentez le trigger SQL dans le microservice correspondant pour alimenter l'outbox.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/messaging",
3
- "version": "2.10.1",
3
+ "version": "2.10.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -33,11 +33,11 @@
33
33
  "test": "echo \"No tests yet\""
34
34
  },
35
35
  "devDependencies": {
36
- "@volontariapp/testing": "1.0.2",
36
+ "@volontariapp/testing": "1.0.3",
37
37
  "typescript": "5.7.3"
38
38
  },
39
39
  "dependencies": {
40
- "@volontariapp/contracts": "4.3.2",
40
+ "@volontariapp/contracts": "4.3.3",
41
41
  "@volontariapp/shared": "0.8.1"
42
42
  }
43
43
  }