@absolutejs/beacon 0.7.0-beta.15 → 0.7.0-beta.16
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/CHANGELOG.md +6 -0
- package/README.md +52 -0
- package/changelog.json +13 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/outbox.d.ts +42 -0
- package/package.json +1 -1
package/dist/outbox.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Durable, bounded delivery for JSON telemetry. Call enqueue only with redacted data.
|
|
2
|
+
* Server must deduplicate by id and acknowledge that id after committing storage.
|
|
3
|
+
* Browser persistence is best effort: unavailable/quota-exhausted storage is reported.
|
|
4
|
+
*/
|
|
5
|
+
export type OutboxRecord = {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: number;
|
|
8
|
+
body: string;
|
|
9
|
+
bytes: number;
|
|
10
|
+
};
|
|
11
|
+
export interface OutboxStore {
|
|
12
|
+
list(): Promise<OutboxRecord[]>;
|
|
13
|
+
put(record: OutboxRecord): Promise<void>;
|
|
14
|
+
remove(id: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createIndexedDBOutboxStore(name?: string): OutboxStore;
|
|
17
|
+
export declare function createMemoryOutboxStore(): OutboxStore;
|
|
18
|
+
export declare function createOutbox(options: {
|
|
19
|
+
store: OutboxStore;
|
|
20
|
+
send: (record: OutboxRecord, signal: AbortSignal) => Promise<string>;
|
|
21
|
+
now?: () => number;
|
|
22
|
+
random?: () => number;
|
|
23
|
+
maxItems?: number;
|
|
24
|
+
maxBytes?: number;
|
|
25
|
+
maxRecordBytes?: number;
|
|
26
|
+
maxAgeMs?: number;
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
}): {
|
|
29
|
+
stats: () => {
|
|
30
|
+
nextAttempt: number;
|
|
31
|
+
pending: number;
|
|
32
|
+
bytes: number;
|
|
33
|
+
dropped: number;
|
|
34
|
+
expired: number;
|
|
35
|
+
storageErrors: number;
|
|
36
|
+
failedAttempts: number;
|
|
37
|
+
acknowledged: number;
|
|
38
|
+
persistMs: number;
|
|
39
|
+
};
|
|
40
|
+
enqueue(value: unknown, id?: string): Promise<string>;
|
|
41
|
+
flush(): Promise<void>;
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/beacon",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.16",
|
|
4
4
|
"description": "Tiny, zero-dependency browser SDK for the AbsoluteJS observability stack. Captures uncaught errors + unhandled rejections, breadcrumbs (console/click/fetch/history), batches, and POSTs an envelope to @absolutejs/errors/ingest via sendBeacon/keepalive. ~2-5KB gz, no Effect in the browser; end-to-end type-safe via the shared erased envelope contract.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|