@validors/sdk 0.1.14 → 0.1.15

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/README.md +7 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -110,8 +110,8 @@ All options are passed as a `ValidorsOptions` object to any of the middleware fa
110
110
  |-----------------|------------|-----------------------------------|-------------------------------------------------------------------------------|
111
111
  | `apiKey` | `string` | **required** | Your project API key from the Validors dashboard. |
112
112
  | `ingestUrl` | `string` | `https://validors.app/api/ingest` | Override the ingest endpoint (useful for self-hosting or local development). |
113
- | `flushInterval` | `number` | `5000` | Milliseconds between automatic queue flushes. |
114
- | `batchSize` | `number` | `50` | Number of queued events that triggers an immediate flush. |
113
+ | `flushInterval` | `number` | `5000` | Milliseconds between automatic queue flushes. (Express / Fastify / Hono only) |
114
+ | `batchSize` | `number` | `50` | Number of queued events that triggers an immediate flush. (Express / Fastify / Hono only) |
115
115
  | `debug` | `boolean` | `false` | Log debug output to `console` — useful during integration. |
116
116
  | `ignoreRoutes` | `string[]` | `[]` | Routes to exclude from tracking (exact match or prefix). E.g. `['/health']`. |
117
117
  | `environment` | `string` | `process.env.NODE_ENV` | Tag events with an environment label (`production`, `staging`, etc.). |
@@ -190,7 +190,7 @@ Then open your [Validors dashboard](https://validors.com) — data should appear
190
190
 
191
191
  ## Graceful Shutdown
192
192
 
193
- The SDK registers `beforeExit` and `SIGTERM` handlers automatically to flush pending events before the process exits. If you manage your own shutdown lifecycle, call `shutdown()` explicitly:
193
+ On Node.js runtimes, the SDK registers `beforeExit` and `SIGTERM` handlers automatically to flush pending events before the process exits. If you manage your own shutdown lifecycle, call `shutdown()` explicitly:
194
194
 
195
195
  ```ts
196
196
  import { shutdown } from '@validors/sdk';
@@ -221,10 +221,12 @@ If you're stuck, visit [validors.com](https://validors.com) for documentation an
221
221
 
222
222
  ## How it works
223
223
 
224
- Events are collected in an in-memory queue and flushed to the Validors ingest API in batches. This keeps overhead minimal — a single `Date.now()` call per request plus a periodic background HTTP request.
224
+ **Express / Fastify / Hono** — events are collected in an in-memory queue and flushed to the Validors ingest API in batches. A single `Date.now()` call per request is the only overhead during normal operation, with a periodic background HTTP flush.
225
+
226
+ **Next.js (App Router)** — each request flushes immediately and synchronously before the handler returns. This guarantees delivery on all runtimes including serverless (Vercel Node.js) and edge, where the process can be killed as soon as the response is sent.
225
227
 
226
228
  - Network errors during flush are silently swallowed — your app is never impacted.
227
- - The flush timer uses `timer.unref()` so it never prevents the Node process from exiting.
229
+ - The flush timer uses `timer.unref()` so it never prevents the Node.js process from exiting.
228
230
 
229
231
  ---
230
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@validors/sdk",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Backend API monitoring SDK for Validors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",