@2060.io/vs-agent-nestjs-client 1.3.0 → 1.3.1-dev.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 (2) hide show
  1. package/README.md +57 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -109,6 +109,63 @@ Configures stats management. The following properties are available:
109
109
  - `imports` (optional).
110
110
  - `statOptions` (optional).
111
111
 
112
+ ##### Example of Using the `StatEventModule`
113
+
114
+ This example demonstrates how to configure and use the `StatEventModule` to send and process statistics using a JMS broker:
115
+
116
+ - **AppModule**
117
+ ```typescript
118
+ import { Module } from '@nestjs/common';
119
+ import { StatEventModule } from '@2060.io/vs-agent-nestjs-client';
120
+
121
+ EventsModule.register({
122
+ modules: {
123
+ ...
124
+ stats: true,
125
+ },
126
+ options: {
127
+ statOptions: {
128
+ host: 'jms-broker.example.com',
129
+ port: 61616,
130
+ queue: 'stats-queue', // The queue must be unique
131
+ username: 'admin',
132
+ password: 'password123',
133
+ reconnectLimit: 5,
134
+ threads: 10,
135
+ delay: 1000,
136
+ },
137
+ eventHandler: CoreService,
138
+ url: 'http://localhost',
139
+ imports: [],
140
+ },
141
+ })
142
+ ```
143
+
144
+ - **STAT_KPI**
145
+ ```typescript
146
+ export enum STAT_KPI {
147
+ USER_CONNECTED,
148
+ }
149
+ ```
150
+
151
+ - **StatProducerService**
152
+ After configuring the `StatEventModule`, you can inject the `StatProducerService` into your services to send statistics to the configured JMS broker:
153
+
154
+ ```typescript
155
+ import { STAT_KPI } from './common'
156
+ import { StatEnum, StatProducerService } from '@2060.io/vs-agent-nestjs-client'
157
+
158
+ export class CoreService implements EventHandler, OnModuleInit {
159
+ constructor(
160
+ @InjectRepository(SessionEntity)
161
+ private readonly statProducer: StatProducerService,
162
+ ) {}
163
+
164
+ await this.statProducer.spool(STAT_KPI.USER_CONNECTED, 'uuid', [new StatEnum(0, 'string')])
165
+ }
166
+ ```
167
+
168
+
112
169
  #### `ModulesConfig`
113
170
  This interface defines the configuration for enabling or disabling modules:
114
171
  - `messages` (optional): Whether to enable the message handling module. Defaults to false.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2060.io/vs-agent-nestjs-client",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-dev.2",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "types": "build/index",
@@ -22,8 +22,8 @@
22
22
  "rhea": "^3.0.3",
23
23
  "rxjs": "^7.8.1",
24
24
  "typeorm": "^0.3.20",
25
- "@2060.io/vs-agent-client": "1.3.0",
26
- "@2060.io/vs-agent-model": "1.3.0"
25
+ "@2060.io/vs-agent-client": "1.3.1-dev.2",
26
+ "@2060.io/vs-agent-model": "1.3.1-dev.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@2060.io/credo-ts-didcomm-receipts": "0.0.7",