@lad-tech/nsc-toolkit 1.22.5 → 1.23.0

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## [1.22.5](https://github.com/lad-tech/nsc-toolkit/compare/v1.22.4...v1.22.5) (2024-09-08)
1
+ # [1.23.0](https://github.com/lad-tech/nsc-toolkit/compare/v1.22.6...v1.23.0) (2024-10-07)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * Error for create same consumer ([#124](https://github.com/lad-tech/nsc-toolkit/issues/124)) ([8664809](https://github.com/lad-tech/nsc-toolkit/commit/8664809486f0d59c4a04a62cb0690f09d9cf9d97))
6
+ * empty message check in batch watch ([#127](https://github.com/lad-tech/nsc-toolkit/issues/127)) ([35a927a](https://github.com/lad-tech/nsc-toolkit/commit/35a927a2265607619158af30f0ececc42cff22e0))
package/dist/Client.js CHANGED
@@ -56,7 +56,8 @@ class Client extends Root_1.Root {
56
56
  message.nak = event.nak.bind(event);
57
57
  batch.push(message);
58
58
  }
59
- listener.emit(eventName, batch);
59
+ if (batch.length > 0)
60
+ listener.emit(eventName, batch);
60
61
  }
61
62
  }
62
63
  getListener(serviceNameFrom, options) {
package/dist/Service.js CHANGED
@@ -393,13 +393,13 @@ class Service extends Root_1.Root {
393
393
  this.subscriptions.push(subscription);
394
394
  for await (const message of subscription) {
395
395
  const { payload, baggage } = (0, nats_1.JSONCodec)().decode(message.data);
396
- try {
397
- const result = await this.handled(payload, Method, baggage);
396
+ this.handled(payload, Method, baggage)
397
+ .then(result => {
398
398
  message.respond(this.buildMessage(result));
399
- }
400
- catch (error) {
399
+ })
400
+ .catch(error => {
401
401
  message.respond(this.buildMessage({ error: error.message }));
402
- }
402
+ });
403
403
  }
404
404
  });
405
405
  if (this.httpMethods.size > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lad-tech/nsc-toolkit",
3
- "version": "1.22.5",
3
+ "version": "1.23.0",
4
4
  "description": "Toolkit for create microservices around NATS",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",