kafka-crab-js 1.0.3 → 1.0.5

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/README.md CHANGED
@@ -38,6 +38,8 @@ A lightweight, flexible, and reliable Kafka client for JavaScript/TypeScript. It
38
38
  npm install kafka-crab-js
39
39
  # or
40
40
  yarn add kafka-crab-js
41
+ # or
42
+ pnpm add kafka-crab-js
41
43
  ```
42
44
 
43
45
  ## Quick Start
@@ -317,9 +319,9 @@ You can find some examples on the [example](https://github.com/mthssdrbrg/kafka-
317
319
  | `securityProtocol` | `SecurityProtocol` || Security protocol to use (PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL) |
318
320
  | `logLevel` | `string` | `info` | Client id to use for the connection |
319
321
  | `brokerAddressFamily` | `string` | `"v4"` | Address family to use for the connection (v4, v6) |
320
- | `configuration` | `Map<string, string>` | `{}` | Additional configuration options for the client. See [librdkafka](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md) |
322
+ | `configuration` | `Map<string, string>` | `{}` | Additional configuration options for the client. See [librdkafka](https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html) |
321
323
 
322
- You can see the available options here: [librdkafka](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md).
324
+ You can see the available options here: [librdkafka](https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html).
323
325
 
324
326
 
325
327
 
package/js-binding.d.ts CHANGED
@@ -92,8 +92,9 @@ export declare class KafkaConsumer {
92
92
  pause(): void
93
93
  resume(): void
94
94
  unsubscribe(): void
95
+ shutdownConsumer(): Promise<void>
95
96
  seek(topic: string, partition: number, offsetModel: OffsetModel, timeout?: number | undefined | null): void
96
- recv(): Promise<Message>
97
+ recv(): Promise<Message | null>
97
98
  commit(topic: string, partition: number, offset: number, commit: CommitMode): void
98
99
  }
99
100
  export declare class KafkaClientConfig {
package/kafka-client.js CHANGED
@@ -13,7 +13,7 @@ class KafkaClient {
13
13
  */
14
14
  constructor(kafkaConfiguration) {
15
15
  this.kafkaConfiguration = kafkaConfiguration;
16
- this.kafkaClientConfig = new js_binding_js_1.KafkaClientConfig(kafkaConfiguration);
16
+ this.kafkaClientConfig = new js_binding_js_1.KafkaClientConfig(this.kafkaConfiguration);
17
17
  }
18
18
  /**
19
19
  * Creates a KafkaProducer instance
@@ -1,5 +1,6 @@
1
1
  import { Readable } from 'stream';
2
- import { KafkaConsumer, TopicPartitionConfig } from './js-binding';
2
+ import { CommitMode } from './js-binding';
3
+ import { KafkaConsumer, OffsetModel, TopicPartitionConfig } from './js-binding';
3
4
  /**
4
5
  * KafkaStreamReadable class
5
6
  * @extends Readable
@@ -14,6 +15,8 @@ export declare class KafkaStreamReadable extends Readable {
14
15
  * Subscribes to topics
15
16
  */
16
17
  subscribe(topics: string | Array<TopicPartitionConfig>): Promise<void>;
18
+ seek(topic: string, partition: number, offsetModel: OffsetModel, timeout?: number | undefined): void;
19
+ commit(topic: string, partition: number, offset: number, commit: CommitMode): void;
17
20
  /**
18
21
  * Unsubscribe from topics
19
22
  */
@@ -27,6 +27,12 @@ class KafkaStreamReadable extends stream_1.Readable {
27
27
  }
28
28
  await this.kafkaConsumer.subscribe(topics);
29
29
  }
30
+ seek(topic, partition, offsetModel, timeout) {
31
+ this.kafkaConsumer.seek(topic, partition, offsetModel, timeout);
32
+ }
33
+ commit(topic, partition, offset, commit) {
34
+ this.kafkaConsumer.commit(topic, partition, offset, commit);
35
+ }
30
36
  /**
31
37
  * Unsubscribe from topics
32
38
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kafka-crab-js",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "module": "commonjs",
@@ -40,13 +40,13 @@
40
40
  "url": "https://github.com/inaiat/kafka-crab-js.git"
41
41
  },
42
42
  "devDependencies": {
43
- "@faker-js/faker": "9.2.0",
43
+ "@faker-js/faker": "9.3.0",
44
44
  "@napi-rs/cli": "^2.18.4",
45
- "@types/node": "22.9.0",
45
+ "@types/node": "22.10.1",
46
46
  "ava": "6.2.0",
47
- "dprint": "^0.47.5",
48
- "nanoid": "5.0.8",
49
- "typescript": "5.6.3",
47
+ "dprint": "^0.48.0",
48
+ "nanoid": "5.0.9",
49
+ "typescript": "5.7.2",
50
50
  "copyfiles": "^2.4.1",
51
51
  "@types/copyfiles": "^2.4.4",
52
52
  "rimraf": "^6.0.1"
@@ -65,10 +65,10 @@
65
65
  "version": "napi version",
66
66
  "fmt": "dprint fmt"
67
67
  },
68
- "packageManager": "pnpm@9.14.2",
68
+ "packageManager": "pnpm@9.15.2",
69
69
  "optionalDependencies": {
70
- "kafka-crab-js-darwin-arm64": "1.0.3",
71
- "kafka-crab-js-darwin-x64": "1.0.3",
72
- "kafka-crab-js-linux-x64-gnu": "1.0.3"
70
+ "kafka-crab-js-darwin-arm64": "1.0.5",
71
+ "kafka-crab-js-darwin-x64": "1.0.5",
72
+ "kafka-crab-js-linux-x64-gnu": "1.0.5"
73
73
  }
74
74
  }