@sazabi/browser 0.2.0-dev.g083f85c
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/LICENSE +202 -0
- package/README.md +148 -0
- package/dist/attributes.d.ts +8 -0
- package/dist/chunk-rfm4nnme.js +5 -0
- package/dist/chunk-rfm4nnme.js.map +13 -0
- package/dist/console.d.ts +17 -0
- package/dist/element-name.d.ts +22 -0
- package/dist/errors.d.ts +8 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +22 -0
- package/dist/input-capture.d.ts +22 -0
- package/dist/intake-url.d.ts +38 -0
- package/dist/interactions.d.ts +12 -0
- package/dist/navigation.d.ts +24 -0
- package/dist/network-event-format.d.ts +5 -0
- package/dist/network.d.ts +38 -0
- package/dist/patch-marker.d.ts +4 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +4 -0
- package/dist/register.js.map +10 -0
- package/dist/resource-observer.d.ts +22 -0
- package/dist/session.d.ts +23 -0
- package/dist/trace-context.d.ts +31 -0
- package/dist/transport.d.ts +56 -0
- package/dist/types.d.ts +107 -0
- package/dist/version.d.ts +2 -0
- package/package.json +35 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export type AttributeValue = string | number | boolean;
|
|
2
|
+
export type EventAttributes = Record<string, AttributeValue | undefined>;
|
|
3
|
+
export type EventSeverity = "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
4
|
+
export type WebEventType = "navigation" | "click" | "rage_click" | "dead_click" | "input" | "network" | "error" | "custom" | "log";
|
|
5
|
+
/** An SDK-internal semantic event, before OTLP encoding. */
|
|
6
|
+
export interface WebEvent {
|
|
7
|
+
type: WebEventType;
|
|
8
|
+
body: string;
|
|
9
|
+
severity: EventSeverity;
|
|
10
|
+
timeUnixMs: number;
|
|
11
|
+
/** Set on network events when trace context was injected into the request. */
|
|
12
|
+
traceId?: string;
|
|
13
|
+
spanId?: string;
|
|
14
|
+
attributes: EventAttributes;
|
|
15
|
+
}
|
|
16
|
+
export interface InputCaptureConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Emit one `input` event per field-interaction episode (never keystrokes,
|
|
19
|
+
* never values — see the privacy invariants in input-capture.ts).
|
|
20
|
+
* Default true.
|
|
21
|
+
*/
|
|
22
|
+
capture?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type ConsoleCaptureLevel = "error" | "warn" | "info" | "debug";
|
|
25
|
+
export interface ConsoleCaptureConfig {
|
|
26
|
+
/** Mirror console output into the event stream. Default true. */
|
|
27
|
+
capture?: boolean;
|
|
28
|
+
/** Console levels to mirror. Default ["error", "warn"]. */
|
|
29
|
+
levels?: ConsoleCaptureLevel[];
|
|
30
|
+
}
|
|
31
|
+
export interface NetworkCaptureConfig {
|
|
32
|
+
/** Emit network events for fetch/XHR. Default true. */
|
|
33
|
+
capture?: boolean;
|
|
34
|
+
/** Inject W3C `traceparent` into allowlisted requests. Default true. */
|
|
35
|
+
propagateTraceContext?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Patch-independent fallback capture via PerformanceObserver resource
|
|
38
|
+
* timing: requests that bypass the fetch/XHR patches (clients that
|
|
39
|
+
* captured the natives before the SDK) still produce degraded network
|
|
40
|
+
* events plus a once-per-origin instrumentation-gap diagnostic.
|
|
41
|
+
* Default true.
|
|
42
|
+
*/
|
|
43
|
+
resourceFallback?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Response headers probed (in order) for a platform request id to attach
|
|
46
|
+
* as `web.network.request_id` — an exact join key against platform logs
|
|
47
|
+
* (CDN/edge/PaaS) without any backend change. Cross-origin reads require
|
|
48
|
+
* the header in `Access-Control-Expose-Headers`.
|
|
49
|
+
*/
|
|
50
|
+
requestIdHeaders?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* URL patterns eligible for `traceparent` injection. Strings match by
|
|
53
|
+
* substring, RegExps by test. Default: same-origin requests only —
|
|
54
|
+
* cross-origin injection requires the target to allowlist the header in
|
|
55
|
+
* CORS, so it is opt-in.
|
|
56
|
+
*/
|
|
57
|
+
allowlist?: (string | RegExp)[];
|
|
58
|
+
/**
|
|
59
|
+
* Set the sampled flag (`-01`) on SDK-minted trace roots. Default false
|
|
60
|
+
* (`-00`): the sampled bit steers customers' ParentBased backend samplers,
|
|
61
|
+
* and forcing 100% backend trace sampling is not this SDK's call to make.
|
|
62
|
+
* The logs-side trace_id join works regardless of this flag.
|
|
63
|
+
*/
|
|
64
|
+
sampledFlag?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface BrowserSdkConfig {
|
|
67
|
+
/**
|
|
68
|
+
* The project's intake URL, exactly as the log source issues it — e.g.
|
|
69
|
+
* `https://<key>.us-west-2.intake.sazabi.com`. The credential is embedded in
|
|
70
|
+
* the hostname, so this is normally the only endpoint config needed; `/v1/logs`
|
|
71
|
+
* may be included or omitted.
|
|
72
|
+
*/
|
|
73
|
+
intakeUrl?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Public ingest key (`sazabi_public_...`). Optional: derived from `intakeUrl`
|
|
76
|
+
* when that URL is a keyed intake host. Set it only for a proxy or custom
|
|
77
|
+
* endpoint whose hostname carries no key.
|
|
78
|
+
*/
|
|
79
|
+
publicKey?: string;
|
|
80
|
+
/** @deprecated Use `intakeUrl`. Accepted as an alias. */
|
|
81
|
+
intakeHost?: string;
|
|
82
|
+
/** Logical service name for the frontend app. */
|
|
83
|
+
serviceName: string;
|
|
84
|
+
/** Service version (e.g. git SHA). */
|
|
85
|
+
serviceVersion?: string;
|
|
86
|
+
/** Deployment environment (e.g. "production"). */
|
|
87
|
+
environment?: string;
|
|
88
|
+
network?: NetworkCaptureConfig;
|
|
89
|
+
console?: ConsoleCaptureConfig;
|
|
90
|
+
input?: InputCaptureConfig;
|
|
91
|
+
/**
|
|
92
|
+
* Consent gate: capture holds until this resolves true. When it resolves
|
|
93
|
+
* false the SDK stays dormant. Richer semantics (revocation, per-plane
|
|
94
|
+
* grants) are deliberately deferred; only the API shape is stable.
|
|
95
|
+
*/
|
|
96
|
+
consent?: () => boolean | Promise<boolean>;
|
|
97
|
+
/** Batch flush cadence in ms. Default 5000. */
|
|
98
|
+
flushIntervalMs?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Soft cap per OTLP request body in bytes. Default 57344 (56 KiB), leaving
|
|
101
|
+
* headroom under the ~64 KiB fetch-keepalive budget that unload flushes
|
|
102
|
+
* must fit inside.
|
|
103
|
+
*/
|
|
104
|
+
maxBatchBytes?: number;
|
|
105
|
+
/** Max buffered events before the oldest are dropped. Default 500. */
|
|
106
|
+
maxQueuedEvents?: number;
|
|
107
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sazabi/browser",
|
|
3
|
+
"description": "Sazabi browser observability SDK — semantic event stream capture with W3C trace context propagation",
|
|
4
|
+
"version": "0.2.0-dev.g083f85c",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./register": {
|
|
14
|
+
"types": "./dist/register.d.ts",
|
|
15
|
+
"default": "./dist/register.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./dist/register.js"
|
|
24
|
+
],
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"homepage": "https://github.com/sazabi/browser",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/sazabi/browser.git"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org"
|
|
34
|
+
}
|
|
35
|
+
}
|