@kwirthmagnify/kwirth-provider-kafka 0.1.11 → 0.1.12

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/back.js +15 -0
  2. package/package.json +1 -1
package/back.js CHANGED
@@ -18613,6 +18613,21 @@ var KafkaProvider = class {
18613
18613
  this.connections = /* @__PURE__ */ new Map();
18614
18614
  // accumulated data store, same shape as BusinessProvider: space -> type -> messages[]
18615
18615
  this.data = /* @__PURE__ */ new Map();
18616
+ /*
18617
+ Cuantos consumidores tiene AHORA (IProvider.getStats, opcional desde kwirth-common-back 0.5.50).
18618
+
18619
+ Aqui no vale sumar los de cada conexion: un mismo suscriptor puede estar en varias a la vez —es
18620
+ justo lo que permite este provider— y la suma lo contaria dos veces. Se cuentan UNICOS.
18621
+
18622
+ Sigue siendo barato: recorre conexiones, no mensajes, y de esas hay un puñado.
18623
+ */
18624
+ this.getStats = () => {
18625
+ const unicos = /* @__PURE__ */ new Set();
18626
+ for (const entry of this.connections.values()) {
18627
+ for (const s of entry.subscribers.keys()) unicos.add(s);
18628
+ }
18629
+ return { subscribers: unicos.size };
18630
+ };
18616
18631
  // ── IProvider ──────────────────────────────────────────────────────────────
18617
18632
  this.addSubscriber = async (subscriber, providerConfig) => {
18618
18633
  if (!providerConfig?.connections?.length) return;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "id": "kafka",
5
5
  "name": "@kwirthmagnify/kwirth-provider-kafka",
6
6
  "displayName": "Kafka Provider",
7
- "version": "0.1.11",
7
+ "version": "0.1.12",
8
8
  "description": "Kafka provider plugin for Kwirth — subscribes to Kafka topics and dispatches events grouped by spaces",
9
9
  "requiresRestart": false,
10
10
  "requiresExtension": []