@hexmon_tech/audit-sink-http
v2.0.0
Published
HTTP sink for batching audit events to a remote endpoint.
Maintainers
Readme
@hexmon_tech/audit-sink-http
Edge-friendly HTTP sink that POSTs audit event batches to a remote endpoint.
Install
pnpm add @hexmon_tech/audit-sink-http
npm install @hexmon_tech/audit-sink-httpCompatibility
- Node.js >= 18 or any runtime that provides
fetch - Works well in Edge, Deno, or Cloudflare Workers when paired with the core
Usage
import { createHttpAuditSink } from '@hexmon_tech/audit-sink-http';
const sink = createHttpAuditSink({
endpoint: 'https://audit.example.com/batch',
headers: { Authorization: 'Bearer token' },
timeoutMs: 5000,
});Behavior
- Uses
fetchto POST{ events: AuditEvent[] }to the endpoint. - 5xx, 408, 429, and timeouts are classified as
TRANSIENTfailures. - 4xx (except 429) are classified as
PERMANENTfailures. - Idempotency is expected to be enforced by the server using
eventId.
