@logbrew/sdk 0.1.23 → 0.1.24

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.
Files changed (2) hide show
  1. package/core.cjs +5 -0
  2. package/package.json +1 -1
package/core.cjs CHANGED
@@ -859,12 +859,17 @@ class LogBrewClient {
859
859
  #nextBatch(maxEvents) {
860
860
  let bodyBytes = this.batchPrefixBytes + this.batchSuffixBytes;
861
861
  let eventsCount = 0;
862
+ const eventIds = new Set();
862
863
  for (let index = 0; index < maxEvents; index += 1) {
864
+ if (eventIds.has(this.events[index].id)) {
865
+ break;
866
+ }
863
867
  const separatorBytes = eventsCount === 0 ? 0 : 1;
864
868
  const nextBodyBytes = bodyBytes + separatorBytes + this.serializedEventBytes[index];
865
869
  if (nextBodyBytes > this.maxBatchBytes) {
866
870
  break;
867
871
  }
872
+ eventIds.add(this.events[index].id);
868
873
  bodyBytes = nextBodyBytes;
869
874
  eventsCount += 1;
870
875
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logbrew/sdk",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Public LogBrew JavaScript SDK for building, validating, and flushing event batches.",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",