@lad-tech/nsc-toolkit 1.26.1 → 1.26.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## [1.26.1](https://github.com/lad-tech/nsc-toolkit/compare/v1.26.0...v1.26.1) (2025-01-17)
1
+ ## [1.26.2](https://github.com/lad-tech/nsc-toolkit/compare/v1.26.1...v1.26.2) (2025-01-22)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * Remove inbox from config old consumer ([#140](https://github.com/lad-tech/nsc-toolkit/issues/140)) ([69ddd98](https://github.com/lad-tech/nsc-toolkit/commit/69ddd980ebd7258991542946a1252b11d424199a))
6
+ * rollup pull consumer ([#142](https://github.com/lad-tech/nsc-toolkit/issues/142)) ([974dcb8](https://github.com/lad-tech/nsc-toolkit/commit/974dcb8a2fd748b3a835c6b3fb67ffb32490b963))
package/dist/Client.js CHANGED
@@ -24,6 +24,9 @@ class Client extends Root_1.Root {
24
24
  }
25
25
  async startWatch(subscription, listener, eventName) {
26
26
  for await (const event of subscription) {
27
+ if (!event) {
28
+ continue;
29
+ }
27
30
  let data;
28
31
  try {
29
32
  data = (0, nats_1.JSONCodec)().decode(event.data);
package/dist/Service.js CHANGED
@@ -38,6 +38,7 @@ class Service extends Root_1.Root {
38
38
  * Roll-up only same subject message in the stream
39
39
  */
40
40
  this.ROLLUP_STRATEGY = 'sub';
41
+ this.BASE_EVENT_SUFFIX = 'base';
41
42
  this.serviceName = options.name;
42
43
  this.logger.setLocation(this.serviceName);
43
44
  if (options.events) {
@@ -65,6 +66,9 @@ class Service extends Root_1.Root {
65
66
  settings.headers.append(this.ROLLUP_HEADER, this.ROLLUP_STRATEGY);
66
67
  subject.push(rollupId);
67
68
  }
69
+ else {
70
+ subject.push(this.BASE_EVENT_SUFFIX);
71
+ }
68
72
  this.broker.publish(subject.join('.'), this.buildMessage(params), settings);
69
73
  });
70
74
  return result;
@@ -7,21 +7,16 @@ class StreamSingleMsgFetcher {
7
7
  this.done = false;
8
8
  }
9
9
  [Symbol.asyncIterator]() {
10
- const done = {
11
- value: this.msg,
12
- done: true,
13
- };
14
10
  return {
15
11
  next: async () => {
16
12
  const msg = await this.consumer.next();
17
13
  if (msg) {
18
- this.msg = msg;
19
14
  return {
20
- value: this.msg,
15
+ value: msg,
21
16
  done: this.done,
22
17
  };
23
18
  }
24
- return done;
19
+ return { done: false };
25
20
  },
26
21
  };
27
22
  }
@@ -24,6 +24,7 @@ export declare class Service<E extends Emitter = Emitter> extends Root {
24
24
  * Roll-up only same subject message in the stream
25
25
  */
26
26
  private readonly ROLLUP_STRATEGY;
27
+ private readonly BASE_EVENT_SUFFIX;
27
28
  constructor(options: ServiceOptions<E>);
28
29
  /**
29
30
  * Create global Tracer
@@ -1,13 +1,15 @@
1
- import { Consumer, JsMsg } from 'nats';
1
+ import { Consumer } from 'nats';
2
2
  export declare class StreamSingleMsgFetcher {
3
3
  private consumer;
4
4
  private done;
5
- private msg;
6
5
  constructor(consumer: Consumer);
7
6
  [Symbol.asyncIterator](): {
8
7
  next: () => Promise<{
9
- value: JsMsg;
8
+ value: import("nats").JsMsg;
10
9
  done: boolean;
10
+ } | {
11
+ done: boolean;
12
+ value?: undefined;
11
13
  }>;
12
14
  };
13
15
  unsubscribe(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lad-tech/nsc-toolkit",
3
- "version": "1.26.1",
3
+ "version": "1.26.2",
4
4
  "description": "Toolkit for create microservices around NATS",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",