@lad-tech/nsc-toolkit 1.22.1 → 1.22.3

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.1](https://github.com/lad-tech/nsc-toolkit/compare/v1.22.0...v1.22.1) (2024-08-15)
1
+ ## [1.22.3](https://github.com/lad-tech/nsc-toolkit/compare/v1.22.2...v1.22.3) (2024-08-19)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * Add required version nats driver and update nats driver ([#115](https://github.com/lad-tech/nsc-toolkit/issues/115)) ([1815d3a](https://github.com/lad-tech/nsc-toolkit/commit/1815d3a77d354aa8c0b97fe33503365f638b9641))
6
+ * Fix consumer filter erasing ([#119](https://github.com/lad-tech/nsc-toolkit/issues/119)) ([17c7823](https://github.com/lad-tech/nsc-toolkit/commit/17c782364dc7d2b50883e406b234f55a397a0700))
@@ -105,7 +105,7 @@ class StreamManager extends Root_1.Root {
105
105
  throw new Error(`Error creating consumer ${consumerName}. Stream for subject ${subject} not found`);
106
106
  }
107
107
  if ((0, types_1.isConsumerOptsBuilder)(options)) {
108
- await this.jsm.consumers.add(streamName, options.config);
108
+ await this.jsm.consumers.add(streamName, { ...options.config, filter_subject: subject });
109
109
  }
110
110
  return isPullConsumer
111
111
  ? new StreamFetcher_1.StreamFetcher(this.broker.jetstream(), streamName, consumerName, {
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsumerApiBlank = void 0;
4
+ class ConsumerApiBlank {
5
+ info(stream, consumer) {
6
+ throw new Error('Method not implemented.');
7
+ }
8
+ add(stream, cfg) {
9
+ return Promise.resolve({});
10
+ }
11
+ update(stream, durable, cfg) {
12
+ throw new Error('Method not implemented.');
13
+ }
14
+ delete(stream, consumer) {
15
+ throw new Error('Method not implemented.');
16
+ }
17
+ list(stream) {
18
+ throw new Error('Method not implemented.');
19
+ }
20
+ pause(stream, name, until) {
21
+ throw new Error('Method not implemented.');
22
+ }
23
+ resume(stream, name) {
24
+ throw new Error('Method not implemented.');
25
+ }
26
+ }
27
+ exports.ConsumerApiBlank = ConsumerApiBlank;
28
+ //# sourceMappingURL=ConsumerApi.js.map
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jetStreamManagerBlank = exports.JetStreamManagerBlank = void 0;
4
4
  const StreamApi_1 = require("./StreamApi");
5
+ const ConsumerApi_1 = require("./ConsumerApi");
5
6
  class JetStreamManagerBlank {
6
7
  constructor() {
8
+ this.consumers = new ConsumerApi_1.ConsumerApiBlank();
7
9
  this.streams = new StreamApi_1.StreamApiBlank();
8
10
  }
9
11
  getOptions() {
@@ -39,7 +39,7 @@ class StreamApiBlank {
39
39
  throw new Error('Method getMessage not implemented.');
40
40
  }
41
41
  find(subject) {
42
- throw new Error('Method find not implemented.');
42
+ return Promise.resolve('Ok');
43
43
  }
44
44
  }
45
45
  exports.StreamApiBlank = StreamApiBlank;
@@ -0,0 +1,16 @@
1
+ import { ConsumerAPI, ConsumerConfig, ConsumerInfo, ConsumerUpdateConfig, Lister } from 'nats';
2
+ export declare class ConsumerApiBlank implements ConsumerAPI {
3
+ info(stream: string, consumer: string): Promise<ConsumerInfo>;
4
+ add(stream: string, cfg: Partial<ConsumerConfig>): Promise<ConsumerInfo>;
5
+ update(stream: string, durable: string, cfg: Partial<ConsumerUpdateConfig>): Promise<ConsumerInfo>;
6
+ delete(stream: string, consumer: string): Promise<boolean>;
7
+ list(stream: string): Lister<ConsumerInfo>;
8
+ pause(stream: string, name: string, until?: Date | undefined): Promise<{
9
+ paused: boolean;
10
+ pause_until?: string | undefined;
11
+ }>;
12
+ resume(stream: string, name: string): Promise<{
13
+ paused: boolean;
14
+ pause_until?: string | undefined;
15
+ }>;
16
+ }
@@ -1,9 +1,10 @@
1
- import { Advisory, ConsumerAPI, JetStreamAccountStats, JetStreamClient, JetStreamManager, JetStreamOptions } from 'nats';
1
+ import { Advisory, JetStreamAccountStats, JetStreamClient, JetStreamManager, JetStreamOptions } from 'nats';
2
2
  import { StreamApiBlank } from './StreamApi';
3
+ import { ConsumerApiBlank } from './ConsumerApi';
3
4
  export declare class JetStreamManagerBlank implements JetStreamManager {
4
5
  getOptions(): JetStreamOptions;
5
6
  jetstream(): JetStreamClient;
6
- consumers: ConsumerAPI;
7
+ consumers: ConsumerApiBlank;
7
8
  streams: StreamApiBlank;
8
9
  getAccountInfo(): Promise<JetStreamAccountStats>;
9
10
  advisories(): AsyncIterable<Advisory>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lad-tech/nsc-toolkit",
3
- "version": "1.22.1",
3
+ "version": "1.22.3",
4
4
  "description": "Toolkit for create microservices around NATS",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",