kafka-ts 0.0.5 → 0.0.6-beta.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/README.md CHANGED
@@ -25,7 +25,7 @@ export const kafka = createKafkaClient({
25
25
 
26
26
  ```typescript
27
27
  const consumer = await kafka.startConsumer({
28
- groupId: 'my-consumer-group'.
28
+ groupId: 'my-consumer-group',
29
29
  topics: ['my-topic'],
30
30
  onMessage: (message) => {
31
31
  console.log(message);
@@ -20,5 +20,5 @@ export declare class Producer {
20
20
  close(): Promise<void>;
21
21
  private ensureConnected;
22
22
  private initProducerId;
23
- private nextSequence;
23
+ private getBaseSequence;
24
24
  }
@@ -61,7 +61,7 @@ class Producer {
61
61
  maxTimestamp = timestamp;
62
62
  }
63
63
  });
64
- const baseSequence = this.nextSequence(topic, partitionIndex, messages.length);
64
+ const baseSequence = this.getBaseSequence(topic, partitionIndex, messages.length);
65
65
  return {
66
66
  index: partitionIndex,
67
67
  baseOffset: 0n,
@@ -116,10 +116,12 @@ class Producer {
116
116
  throw error;
117
117
  }
118
118
  }
119
- nextSequence(topic, partition, messagesCount) {
119
+ getBaseSequence(topic, partition, messagesCount) {
120
120
  this.sequences[topic] ??= {};
121
121
  this.sequences[topic][partition] ??= 0;
122
- return (this.sequences[topic][partition] += messagesCount || 1);
122
+ const baseSequence = this.sequences[topic][partition];
123
+ this.sequences[topic][partition] += messagesCount;
124
+ return baseSequence;
123
125
  }
124
126
  }
125
127
  exports.Producer = Producer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kafka-ts",
3
- "version": "0.0.5",
3
+ "version": "0.0.6-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "author": "Priit Käärd",
6
6
  "license": "MIT",