@eventra_dev/eventra-sdk 2.0.8 → 2.0.9

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
@@ -93,7 +93,7 @@ Eventra SDK adapts automatically:
93
93
  | ----------- | -------------------------------------- |
94
94
  | Browser | batching + persistence + retry |
95
95
  | Node.js | batching + retry |
96
- | Serverless | immediate flush + retry |
96
+ | Serverless (AWS Lambda only) | immediate flush + retry |
97
97
  | Edge | batching + retry |
98
98
  | Anything else (e.g. Cloudflare Workers) | not distinctly detected — falls back to the same batching + retry path as Node.js |
99
99
 
@@ -188,8 +188,8 @@ tracker.track("error.occurred", {
188
188
  - NestJS services
189
189
  - Express APIs
190
190
  - Edge runtimes
191
- - Serverless (AWS / Vercel)
192
- - Bun / Deno
191
+ - Serverless (AWS Lambda is auto-detected and flushes immediately; on Vercel and other platforms call `await tracker.flush()` yourself, as in the example below)
192
+ - Bun / Deno (not tested)
193
193
 
194
194
  ---
195
195
 
@@ -269,7 +269,7 @@ export default async function handler(req, res) {
269
269
  }
270
270
  ```
271
271
 
272
- - immediate flush
272
+ - AWS Lambda is detected automatically and flushes right away; on Vercel and other platforms the SDK batches on a timer, so always `await tracker.flush()` before the response ends
273
273
  - retry
274
274
  - optimized for short-lived environments
275
275
 
@@ -287,7 +287,7 @@ const tracker = new Eventra({
287
287
  retryBaseDelayMs: 300,
288
288
  maxPayloadBytes: 60000,
289
289
  onEventsDropped: (count) => {
290
- console.warn(`Dropped ${count} event(s) — queue full`);
290
+ console.warn(`Dropped ${count} event(s)`);
291
291
  },
292
292
  onDeliveryFailed: ({ status, events }) => {
293
293
  console.error(`Ingest rejected batch (${status})`, events.length);
@@ -323,7 +323,7 @@ const tracker = new Eventra({
323
323
  | fetchImpl | Custom `fetch` (Node without native fetch, tests) |
324
324
  | autoFlushOnExit | Flush on process exit (Node / serverless, default: `true`) |
325
325
  | disableTimer | Disable periodic flush timer |
326
- | onEventsDropped | Callback when queue is full |
326
+ | onEventsDropped | Called with a count when events are dropped (queue full, an invalid event, or a single event above `maxPayloadBytes`) |
327
327
  | onDeliveryFailed | Callback on permanent ingest errors (4xx except 429) |
328
328
  | multiTabMode | `"independent"` (default) or `"leader"` (browser only) |
329
329
  | exitOnSignal | Node only. On `SIGINT`/`SIGTERM` the SDK flushes and does nothing else (default `false`); `true` re-raises the signal after the flush when no other listener exists. See [Shutdown](#shutdown) |
@@ -439,7 +439,7 @@ Eventra SDK includes:
439
439
  - `track()` validation — name length, userId truncation, properties depth/size, idempotency keys
440
440
  - Batching — auto-flush at `maxBatchSize`, periodic flush via timer, queue overflow drop
441
441
  - Retry & backoff — 429, 5xx, network errors, no-retry on 4xx, fetch timeout/abort
442
- - Circuit breaker — opens after 5 consecutive failures, cools down, resets on success
442
+ - Circuit breaker - opens after 5 consecutive failed batches (each one after its retries), cools down, resets on success
443
443
  - Payload guards — multi-batch splitting, oversize event dropped via `onDeliveryFailed(413)`
444
444
  - Shutdown & destroy - flush ordering, timer teardown, idempotent shutdown, the `shutdownTimeoutMs` budget, signal handling (flush only by default, `exitOnSignal`)
445
445
  - Persisted queue - coalesced writes, 14-day maximum age, delivered-key filtering, cross-tab merge
@@ -455,7 +455,7 @@ pnpm --filter @eventra_dev/eventra-sdk test
455
455
  pnpm --filter @eventra_dev/eventra-sdk test:coverage
456
456
  ```
457
457
 
458
- > **Node version note:** the SDK itself supports Node 18+ (see `engines`), but `vitest@4` depends on `node:util`'s `styleText`, which requires Node **≥ 20.12** — running the test suite on an older Node 20.x patch (or Node 18) fails to start. CI runs the matrix on Node 20 and 22; locally, use the version pinned in the repo's `.nvmrc`.
458
+ > **Node version note:** the SDK itself supports Node 18+ (see `engines`), but `vitest@4` depends on `node:util`'s `styleText`, which requires Node **≥ 20.12** - running the test suite on an older Node 20.x patch (or Node 18) fails to start. CI runs the matrix on Node 20 and 22; locally, use Node 20.19 or newer (20.x or 22.x).
459
459
 
460
460
  ---
461
461
 
@@ -493,7 +493,7 @@ Limits enforced by the SDK at `track()` time:
493
493
  | Property nesting depth | ≤ 8 |
494
494
  | Batch payload | ≤ `maxPayloadBytes` (default 60,000) |
495
495
  | Fetch timeout | 5,000 ms |
496
- | Circuit breaker | opens after 5 consecutive failures, cools down 5,000 ms, doubling after each failed probe up to 60,000 ms |
496
+ | Circuit breaker | opens after 5 consecutive failed batches (each one after its retries), cools down 5,000 ms, doubling after each failed probe up to 60,000 ms |
497
497
 
498
498
  ---
499
499
 
package/dist/index.cjs CHANGED
@@ -193,7 +193,7 @@ var Diagnostics = class {
193
193
  // src/client.ts
194
194
  var SDK_NAME = "@eventra_dev/eventra-sdk";
195
195
  var DEFAULT_ENDPOINT = "https://api.eventra.dev/api/v1/ingest/batch";
196
- var SDK_VERSION = "2.0.8";
196
+ var SDK_VERSION = "2.0.9";
197
197
  var LEADER_KEY = "__eventra_leader__";
198
198
  var LEADER_TTL_MS = 4e3;
199
199
  var QUEUE_KEY = "__eventra_q__";
package/dist/index.mjs CHANGED
@@ -167,7 +167,7 @@ var Diagnostics = class {
167
167
  // src/client.ts
168
168
  var SDK_NAME = "@eventra_dev/eventra-sdk";
169
169
  var DEFAULT_ENDPOINT = "https://api.eventra.dev/api/v1/ingest/batch";
170
- var SDK_VERSION = "2.0.8";
170
+ var SDK_VERSION = "2.0.9";
171
171
  var LEADER_KEY = "__eventra_leader__";
172
172
  var LEADER_TTL_MS = 4e3;
173
173
  var QUEUE_KEY = "__eventra_q__";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/eventra-sdk",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Production-grade analytics SDK for feature usage and product behavior — batching, retries, circuit breaker, runtime-aware (browser, Node, Edge, serverless).",
5
5
  "private": false,
6
6
  "publishConfig": {