kafka-ts 1.0.2 → 1.0.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.
@@ -48,7 +48,7 @@ class Consumer extends events_1.default {
48
48
  minBytes: options.minBytes ?? 1,
49
49
  maxBytes: options.maxBytes ?? 1_048_576,
50
50
  partitionMaxBytes: options.partitionMaxBytes ?? 1_048_576,
51
- isolationLevel: options.isolationLevel ?? 0 /* IsolationLevel.READ_UNCOMMITTED */,
51
+ isolationLevel: options.isolationLevel ?? 1 /* IsolationLevel.READ_COMMITTED */,
52
52
  allowTopicAutoCreation: options.allowTopicAutoCreation ?? false,
53
53
  fromBeginning: options.fromBeginning ?? false,
54
54
  fromTimestamp: options.fromTimestamp ?? (options.fromBeginning ? -2n : -1n),
@@ -186,7 +186,13 @@ class Consumer extends events_1.default {
186
186
  return;
187
187
  }
188
188
  await retrier(() => options.onBatch(messages));
189
- messages.forEach(({ topic, partition, offset }) => this.offsetManager.resolve(topic, partition, offset + 1n));
189
+ response.responses.forEach(({ topicId, partitions }) => {
190
+ partitions.forEach(({ partitionIndex, records }) => {
191
+ records.forEach(({ baseOffset, lastOffsetDelta }) => {
192
+ this.offsetManager.resolve(this.metadata.getTopicNameById(topicId), partitionIndex, baseOffset + BigInt(lastOffsetDelta) + 1n);
193
+ });
194
+ });
195
+ });
190
196
  await this.consumerGroup?.offsetCommit(topicPartitions);
191
197
  this.offsetManager.flush(topicPartitions);
192
198
  }
@@ -207,7 +213,7 @@ class Consumer extends events_1.default {
207
213
  currentLeaderEpoch: -1,
208
214
  fetchOffset: this.offsetManager.getCurrentOffset(topic, partition),
209
215
  lastFetchedEpoch: -1,
210
- logStartOffset: 0n,
216
+ logStartOffset: -1n,
211
217
  partitionMaxBytes,
212
218
  })),
213
219
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kafka-ts",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "author": "Priit Käärd",
6
6
  "license": "MIT",