@utk09/ui-observability 0.1.1 → 0.2.0
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 +66 -0
- package/README.md +29 -32
- package/dist/bus/bus.d.ts +11 -23
- package/dist/constants-DkrpC_xK.cjs +2 -0
- package/dist/constants-DkrpC_xK.cjs.map +1 -0
- package/dist/constants-NJNXpfPi.js +67 -0
- package/dist/constants-NJNXpfPi.js.map +1 -0
- package/dist/constants.d.ts +73 -6
- package/dist/core/breadcrumbs.d.ts +1 -6
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/journey.d.ts +11 -1
- package/dist/core/pipeline.d.ts +39 -18
- package/dist/core/record.d.ts +10 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +496 -481
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CH9NocOC.cjs +2 -0
- package/dist/indexeddb-storage-CH9NocOC.cjs.map +1 -0
- package/dist/indexeddb-storage-DAoHV_oL.js +154 -0
- package/dist/indexeddb-storage-DAoHV_oL.js.map +1 -0
- package/dist/models/config.d.ts +17 -261
- package/dist/storage/idb-driver.d.ts +67 -0
- package/dist/storage/indexeddb-storage.d.ts +1 -1
- package/dist/utils/console.d.ts +5 -8
- package/package.json +6 -6
- package/dist/constants-4eu3x1qw.js +0 -110
- package/dist/constants-4eu3x1qw.js.map +0 -1
- package/dist/constants-Daya7Mc-.cjs +0 -2
- package/dist/constants-Daya7Mc-.cjs.map +0 -1
- package/dist/indexeddb-storage-2PCdF5Ji.js +0 -88
- package/dist/indexeddb-storage-2PCdF5Ji.js.map +0 -1
- package/dist/indexeddb-storage-BhMUPgyG.cjs +0 -2
- package/dist/indexeddb-storage-BhMUPgyG.cjs.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),mand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
|
+
|
|
5
|
+
## [0.2.0] - 2026-09-08
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
- Config was reduced from 63 keys in 9 sections to 31 keys in 3 sections.
|
|
10
|
+
- Removed config keys are now fixed library defaults.
|
|
11
|
+
- Unknown keys are ignored and reported through `onDiagnostic` as `config.invalid` with the message `unknown config key "<key>", ignored. Typo?`.
|
|
12
|
+
- `storage` is now a strategy string instead of an object.
|
|
13
|
+
- `console` is now a boolean or log level instead of an object.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// 0.1.x
|
|
17
|
+
configure({ endpoint, storage: { strategy: "indexeddb", dbName: "app-logs" } });
|
|
18
|
+
configure({ endpoint, console: { enabled: true, level: "DEBUG" } });
|
|
19
|
+
|
|
20
|
+
// 0.2.0
|
|
21
|
+
configure({ endpoint, storage: "indexeddb" });
|
|
22
|
+
configure({ endpoint, console: true });
|
|
23
|
+
configure({ endpoint, console: "WARN" });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Section | Removed keys |
|
|
27
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `streams` | `logs.batchSize`, `logs.flushIntervalMs`, `metrics.batchSize`, `metrics.flushIntervalMs` |
|
|
29
|
+
| `retry` | `baseDelayMs`, `maxDelayMs`, `idleDelayMs` |
|
|
30
|
+
| `journey` | `maxAgeMs`, `endOnOwnerClose`, `urlParam` |
|
|
31
|
+
| `limits` | `maxBodyChars`, `maxAttributeChars`, `maxAttributeCount`, `maxStackChars`, `maxDepth`, `maxArrayLength`, `maxRecordBytes` |
|
|
32
|
+
| `storage` | `dbName`, `maxBatches`, `maxAgeMs`, `maxAttempts` |
|
|
33
|
+
| `bus` | `channelName`, `handshakeTimeoutMs`, `maxHandshakeAttempts`, `maxBootBufferRecords`, `openFinHost`, `orphanPolicy` |
|
|
34
|
+
| `capture` | `maxBreadcrumbs`, `errorDedupeMs` |
|
|
35
|
+
| top level | `maxConcurrentRequests`, `requestTimeoutMs`, `compressionThresholdBytes` |
|
|
36
|
+
|
|
37
|
+
`sampling` is unchanged.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
41
|
+
- `rxjs` replaced with the library's own buffering, batching, queueing, and deferral logic.
|
|
42
|
+
- `dexie` replaced with raw IndexedDB behind `IdbDriver`.
|
|
43
|
+
- Runtime dependency footprint reduced to `@opentelemetry/api`; `web-vitals` remains the optional peer dependency.
|
|
44
|
+
|
|
45
|
+
### Changed - v0.2.0
|
|
46
|
+
|
|
47
|
+
- IndexedDB database version increased to 11. Existing 0.1.x batches remain readable and are retried automatically after upgrade.
|
|
48
|
+
|
|
49
|
+
## [0.1.2] - 2026-08-30
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- `telemetry.sdk.version` was reporting `0.1.0` for records produced by `0.1.1`; the version constant and package version are now kept in sync.
|
|
54
|
+
|
|
55
|
+
## [0.1.1] - 2026-08-30
|
|
56
|
+
|
|
57
|
+
### Changed - v0.1.1
|
|
58
|
+
|
|
59
|
+
- Version bump only.
|
|
60
|
+
|
|
61
|
+
## [0.1.0] - 2026-08-30
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
- Initial release of `@utk09/ui-observability`.
|
|
66
|
+
- Batching, gzip compression, OTLP/JSON and ECS serialization, durable IndexedDB and localStorage storage, retry/backoff delivery, `sendBeacon` exit flush, iframe/worker/OpenFin cross-context bus, and automatic capture of errors, network, interactions, navigation, and web vitals.
|
package/README.md
CHANGED
|
@@ -112,38 +112,29 @@ log.error("pricing call failed", caughtError);
|
|
|
112
112
|
|
|
113
113
|
`endpoint` is the only required property.
|
|
114
114
|
|
|
115
|
-
| Key | Default
|
|
116
|
-
| ---------------------------- |
|
|
117
|
-
| `endpoint` | _required_
|
|
118
|
-
| `serviceName` | `""`
|
|
119
|
-
| `serviceVersion` | `""`
|
|
120
|
-
| `environment` | `""`
|
|
121
|
-
| `enabled` | `true`
|
|
122
|
-
| `minLevel` | `"INFO"`
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `sampling.rates` | `{}` | Per-namespace keep rates, longest matching prefix wins. |
|
|
139
|
-
| `sampling.alwaysSampleTypes` | `["action"]` | Record types kept regardless of rate. |
|
|
140
|
-
| `journey.maxAgeMs` | `1800000` (30m) | Maximum journey duration. |
|
|
141
|
-
| `bus.mode` | `"auto"` | Bus role (`auto`, `sender`, `forwarder`, `off`). |
|
|
142
|
-
| `capture` | See below | Browser auto-instrumentation settings. |
|
|
143
|
-
| `limits.maxRecordBytes` | `32768` (32 KB) | Per-record size ceiling before truncation. |
|
|
144
|
-
| `console.enabled` | `false` | Mirrors formatted records to browser devtools. |
|
|
145
|
-
| `redact(record)` | `undefined` | Hook to mutate or drop (`null`) records before ingest. |
|
|
146
|
-
| `onDiagnostic(event)` | `undefined` | Listener for internal diagnostics and telemetry faults. |
|
|
115
|
+
| Key | Default | Description |
|
|
116
|
+
| ---------------------------- | ------------ | -------------------------------------------------------------------------------- |
|
|
117
|
+
| `endpoint` | _required_ | Target HTTP endpoint URL for log ingestion. |
|
|
118
|
+
| `serviceName` | `""` | Service identifier attached to all records. |
|
|
119
|
+
| `serviceVersion` | `""` | Application version attached to all records. |
|
|
120
|
+
| `environment` | `""` | Deployment environment label (`production`, `staging`). |
|
|
121
|
+
| `enabled` | `true` | Master kill-switch. When `false`, suppresses all logging. |
|
|
122
|
+
| `minLevel` | `"INFO"` | Minimum severity threshold (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`). |
|
|
123
|
+
| `compression` | `"gzip"` | Compression algorithm (`gzip`, `none`). Applies to payloads over 1 KB. |
|
|
124
|
+
| `serializer` | `"otlp"` | Wire format (`otlp`, `ecs`, or custom `LogSerializer`). |
|
|
125
|
+
| `credentials` | `"include"` | Fetch credentials policy. |
|
|
126
|
+
| `headers` | `{}` | Static headers or dynamic header resolver function. |
|
|
127
|
+
| `storage` | `"auto"` | Persistence engine (`auto`, `indexeddb`, `localstorage`, `memory`, `none`). |
|
|
128
|
+
| `sampling.defaultRate` | `1` | Keep rate applied when no namespace rule matches. |
|
|
129
|
+
| `sampling.rates` | `{}` | Per-namespace keep rates, longest matching prefix wins. |
|
|
130
|
+
| `sampling.alwaysSampleTypes` | `["action"]` | Record types kept regardless of rate. |
|
|
131
|
+
| `bus.mode` | `"auto"` | Bus role (`auto`, `sender`, `forwarder`, `off`). |
|
|
132
|
+
| `bus.trustedOrigins` | `[]` | Origins allowed to post records to this document from a cross-origin frame. |
|
|
133
|
+
| `bus.openFinRole` | `"auto"` | OpenFin context role (`auto`, `provider`, `client`). |
|
|
134
|
+
| `capture` | See below | Browser auto-instrumentation settings. |
|
|
135
|
+
| `console` | `false` | Mirrors records to devtools. `true` mirrors from `DEBUG`, or name a level. |
|
|
136
|
+
| `redact(record)` | `undefined` | Hook to mutate or drop (`null`) records before ingest. |
|
|
137
|
+
| `onDiagnostic(event)` | `undefined` | Listener for internal diagnostics and telemetry faults. |
|
|
147
138
|
|
|
148
139
|
### Auto-Capture Options
|
|
149
140
|
|
|
@@ -212,6 +203,12 @@ npm run example:microfrontend # Shell on http://localhost:5191, remotes on 5192
|
|
|
212
203
|
|
|
213
204
|
---
|
|
214
205
|
|
|
206
|
+
## Changelog
|
|
207
|
+
|
|
208
|
+
Released versions and their breaking changes are in [CHANGELOG.md](CHANGELOG.md).
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
215
212
|
## License
|
|
216
213
|
|
|
217
214
|
Apache-2.0. See [LICENSE](LICENSE).
|
package/dist/bus/bus.d.ts
CHANGED
|
@@ -5,6 +5,15 @@ import type { ResolvedConfig } from "../models/config";
|
|
|
5
5
|
import type { LogRecord } from "../models/log-record";
|
|
6
6
|
import type { PlatformMetadata } from "../utils/platform";
|
|
7
7
|
import { type Receive, type WorkerLike } from "./links";
|
|
8
|
+
/** Handshake timing for a forwarder waiting on an owner. */
|
|
9
|
+
export interface HandshakeOptions {
|
|
10
|
+
/** Max time to wait for an owner to answer, in milliseconds. */
|
|
11
|
+
timeoutMs: number;
|
|
12
|
+
/** Attempts allowed before a cross-origin forwarder promotes itself to sender. */
|
|
13
|
+
maxAttempts: number;
|
|
14
|
+
}
|
|
15
|
+
/** Handshake timing in force. Tests build a bus with shorter values. */
|
|
16
|
+
export declare const HANDSHAKE_OPTIONS: HandshakeOptions;
|
|
8
17
|
/** Callbacks for handling records and journey events from connected realms. */
|
|
9
18
|
export interface BusHandlers {
|
|
10
19
|
/** Processes records forwarded from child contexts. */
|
|
@@ -24,6 +33,7 @@ export declare class Bus {
|
|
|
24
33
|
private readonly contextId;
|
|
25
34
|
private readonly tabId;
|
|
26
35
|
private readonly handlers;
|
|
36
|
+
private readonly handshakeOptions;
|
|
27
37
|
/** Current bus role. Defaults to "sender". */
|
|
28
38
|
private role;
|
|
29
39
|
/** Upstream forwarding link, or null when acting as sender. */
|
|
@@ -46,7 +56,7 @@ export declare class Bus {
|
|
|
46
56
|
* @param tabId Tab identifier announced on broadcast channels.
|
|
47
57
|
* @param handlers Callbacks for routed bus events.
|
|
48
58
|
*/
|
|
49
|
-
constructor(config: ResolvedConfig, diagnostics: Diagnostics, platform: PlatformMetadata, contextId: string, tabId: string, handlers: BusHandlers);
|
|
59
|
+
constructor(config: ResolvedConfig, diagnostics: Diagnostics, platform: PlatformMetadata, contextId: string, tabId: string, handlers: BusHandlers, handshakeOptions?: HandshakeOptions);
|
|
50
60
|
/** Returns the resolved bus role. */
|
|
51
61
|
getRole(): BusRole;
|
|
52
62
|
/** Returns whether role resolution has completed. */
|
|
@@ -110,25 +120,3 @@ export declare class Bus {
|
|
|
110
120
|
/** Broadcasts tab claim and queries existing journey state. */
|
|
111
121
|
private announce;
|
|
112
122
|
}
|
|
113
|
-
/** Buffers log records during bus role resolution with FIFO overflow eviction. */
|
|
114
|
-
export declare class BootBuffer {
|
|
115
|
-
private readonly config;
|
|
116
|
-
private readonly diagnostics;
|
|
117
|
-
/** Held records in FIFO order. */
|
|
118
|
-
private records;
|
|
119
|
-
/**
|
|
120
|
-
* @param config Active configuration instance.
|
|
121
|
-
* @param diagnostics Diagnostics reporter.
|
|
122
|
-
*/
|
|
123
|
-
constructor(config: ResolvedConfig, diagnostics: Diagnostics);
|
|
124
|
-
/**
|
|
125
|
-
* Buffers a record, dropping the oldest when capacity is exceeded.
|
|
126
|
-
* @param record Record to buffer.
|
|
127
|
-
*/
|
|
128
|
-
push(record: LogRecord): void;
|
|
129
|
-
/**
|
|
130
|
-
* Drains and returns all buffered records in FIFO order.
|
|
131
|
-
* @returns Buffered log records.
|
|
132
|
-
*/
|
|
133
|
-
release(): LogRecord[];
|
|
134
|
-
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var ee=/OpenFin/i,e=/\bwv\b/,t=/\b(iPhone|iPad|iPod)\b/,n=/\bMacintosh\b/,r=/\bMobile\b/,i={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17,FATAL:21},a=i,o=`log.type`,s=`log.seq`,c=`app.namespace`,l=`page.url`,u=`url.full`,d=`journey.id`,f=`journey.name`,p=`journey.parent_id`,m=`uiobs.sanitize_failed`,h=`uiobs.attributes_dropped`,g=`uiobs.attributes_bytes`,_=`service.name`,v=`service.version`,y=`deployment.environment`,b=`telemetry.sdk.name`,x=`telemetry.sdk.version`,S=`telemetry.sdk.language`,C=`host.platform`,w=`session.id`,T=`tab.id`,E=`context.id`,D=`browser.user_agent`,O=`openfin.uuid`,k=`openfin.name`,A=`@utk09/ui-observability`,j=`0.2.0`,M=`webjs`,N=`otlp`,P=`application/json`,F=`application/x-ndjson`,I=1000000n,L=/^\d+$/,R=`Content-Type`,z=`Content-Encoding`,B=`Retry-After`,V=`X-UiObs-Batch-Id`,H=`X-UiObs-Attempt`,U=`gzip`,W=1e3,G=6e4,K=`text/plain;charset=UTF-8`,q=`uiobs_batch_id`,J=`uiobs_exit`,Y=`ui-observability.batch.`,X=`ui-observability.emergency.`,Z=`ui-observability.probe`,Q=`QuotaExceededError`,te=`batches`,ne=`createdAt`,$=`indexeddb`,re=`localstorage`,ie=`memory`,ae=`none`,oe=`ui-observability.drain`,se=`ui-observability.emergency`,ce=`ui-observability.journey`,le=2e3,ue=`uiObsJourney`,de=/\+/g,fe=/\//g,pe=/=+$/,me=/-/g,he=/_/g,ge=3e5,_e=`traceparent`,ve=2166136261,ye=16777619,be=4294967295,xe=`metric`,Se=`ui-observability/1`,Ce=`ui-observability.runtime`,we=1e4,Te=`color:#888`,Ee=1e3,De=6e4,Oe=`uiobs.capture`,ke=`uiobs.storage`,Ae=`count`,je=`unknown-service`,Me=[`redact`,`onDiagnostic`,`headers`,`serializer`],Ne=[`sampling`,`bus`,`capture`],Pe={endpoint:``,serviceName:``,serviceVersion:``,environment:``,enabled:!0,minLevel:`INFO`,compression:`gzip`,credentials:`include`,storage:`auto`,sampling:{defaultRate:1,rates:{},alwaysSampleTypes:[`action`]},bus:{mode:`auto`,trustedOrigins:[],openFinRole:`auto`},capture:{errors:!0,rejections:!0,resourceErrors:!1,fetch:!1,xhr:!1,interactions:!1,navigation:!1,webVitals:!1,ignoreUrls:[],propagateTraceHeaderTo:[]},console:null},Fe=`DEBUG`,Ie=2e3,Le=1e4,Re=15e3,ze=1024,Be=`UiObservability`,Ve={maxBatches:500,maxAgeMs:864e5,maxAttempts:5},He=2e3,Ue=6e4,We=3e4,Ge=18e5,Ke=`__uiobs_journey`,qe=`ui_observability_control`,Je=1500,Ye=5e3,Xe={maxBodyChars:4096,maxAttributeChars:8192,maxAttributeCount:128,maxStackChars:8192,maxDepth:6,maxArrayLength:100,maxRecordBytes:32768};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return 18e5}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return 6e4}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return 1e3}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return`ui-observability.tab`}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return`Safari/`}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return`ui-observability.session`}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return 55296}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return 56319}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return`AppleWebKit`}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return`[ui-observability]`}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return 2048}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return N}});
|
|
2
|
+
//# sourceMappingURL=constants-DkrpC_xK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-DkrpC_xK.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// All limits, thresholds, timing windows, storage keys, patterns, and\n// defaults used by the library.\n\nimport type { ResolvedConfig } from \"./models/config\";\nimport type { LogLevel, LogType } from \"./models/log-record\";\nimport type { StorageLimits } from \"./models/storage\";\n\n// ----------------------------------\n// Library-wide\n// ----------------------------------\n\n/** Prefix on console messages this library writes. */\nexport const LIBRARY_LOG_PREFIX = \"[ui-observability]\";\n\n// ----------------------------------\n// Diagnostics\n// ----------------------------------\n\n/** Throttle window per diagnostic code, in milliseconds. Limits how often an error loop can spam the handler. */\nexport const DIAGNOSTIC_THROTTLE_MS = 1000;\n\n// ----------------------------------\n// Identity\n// ----------------------------------\n\n/** `localStorage` key for the session id and its last-seen time. */\nexport const SESSION_ID_KEY = \"ui-observability.session\";\n\n/** `sessionStorage` key for the tab id. */\nexport const TAB_ID_KEY = \"ui-observability.tab\";\n\n/** Session idle timeout, in milliseconds. */\nexport const SESSION_IDLE_MS = 30 * 60 * 1000;\n\n/** Min gap between session last-seen writes, in milliseconds. */\nexport const SESSION_TOUCH_MS = 60_000;\n\n/** Random id length, in bytes, used when `crypto.randomUUID` is unavailable. */\nexport const ID_BYTE_LENGTH = 16;\n\n/** Distinct values in one byte (256). */\nexport const BYTE_VALUE_COUNT = 256;\n\n// ----------------------------------\n// Platform detection\n// ----------------------------------\n\n/** Matches OpenFin's user agent. */\nexport const OPENFIN_UA_PATTERN = /OpenFin/i;\n\n/** Matches Android's webview token (`wv`). */\nexport const ANDROID_WEBVIEW_UA_PATTERN = /\\bwv\\b/;\n\n/** Matches iOS hardware: iPhone, iPad, iPod. */\nexport const IOS_DEVICE_UA_PATTERN = /\\b(iPhone|iPad|iPod)\\b/;\n\n/** Matches desktop macOS in a user agent. */\nexport const MACINTOSH_UA_PATTERN = /\\bMacintosh\\b/;\n\n/** Matches the mobile token. */\nexport const MOBILE_UA_PATTERN = /\\bMobile\\b/;\n\n/** WebKit engine token, present in every WebKit browser including webviews. */\nexport const WEBKIT_UA_TOKEN = \"AppleWebKit\";\n\n/** Safari token sent by real iOS browsers, not in-app webviews. */\nexport const SAFARI_UA_TOKEN = \"Safari/\";\n\n// ----------------------------------\n// Sanitizing and size estimation\n// ----------------------------------\n\n/** First UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MIN = 0xd800;\n\n/** Last UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MAX = 0xdbff;\n\n/** Code units below this encode as one UTF-8 byte. */\nexport const UTF8_ONE_BYTE_CEILING = 0x80;\n\n/** Code units below this, and at or above the one-byte ceiling, encode as two UTF-8 bytes. */\nexport const UTF8_TWO_BYTE_CEILING = 0x800;\n\n/** Class names kept in a `describeNode` selector. */\nexport const MAX_NODE_CLASS_NAMES = 3;\n\n/** Byte cost of a null or undefined value. */\nexport const BYTES_PER_NULL = 4;\n\n/** Byte cost of a number (flat estimate). */\nexport const BYTES_PER_NUMBER = 8;\n\n/** Byte cost of a boolean. */\nexport const BYTES_PER_BOOLEAN = 5;\n\n/** Byte cost of an object or array's wrapping braces or brackets. */\nexport const BYTES_PER_CONTAINER = 2;\n\n/** Byte cost of a string's wrapping quotes. */\nexport const BYTES_PER_QUOTED_STRING = 2;\n\n/** Byte cost of one key's punctuation: quotes, colon, comma. */\nexport const BYTES_PER_KEY_OVERHEAD = 4;\n\n// ----------------------------------\n// Record model\n// ----------------------------------\n\n/**\n * Log level to OpenTelemetry severity number.\n * @see {@link LEVEL_ORDER}\n */\nexport const SEVERITY_NUMBER: Record<LogLevel, number> = {\n TRACE: 1,\n DEBUG: 5,\n INFO: 9,\n WARN: 13,\n ERROR: 17,\n FATAL: 21,\n};\n\n/**\n * Alias for `SEVERITY_NUMBER`, used by the level filter.\n * @see {@link SEVERITY_NUMBER}\n */\nexport const LEVEL_ORDER: Record<LogLevel, number> = SEVERITY_NUMBER;\n\n// ----------------------------------\n// Attribute and resource keys\n// ----------------------------------\n//\n// Attribute and resource key names records carry on the wire, following\n// OpenTelemetry conventions. `uiobs.` marks this library's own fields.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number within its context, from zero. */\nexport const ATTR_LOG_SEQ = \"log.seq\";\n\n/** Logger namespace attribute key. */\nexport const ATTR_APP_NAMESPACE = \"app.namespace\";\n\n/** Document URL when the record was built. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key, set by network capture. Don't reuse `ATTR_PAGE_URL`; it would overwrite the request's target.\n * @see {@link ATTR_PAGE_URL}\n */\nexport const ATTR_URL_FULL = \"url.full\";\n\n/** Journey id attribute key. */\nexport const ATTR_JOURNEY_ID = \"journey.id\";\n\n/** Journey name attribute key. */\nexport const ATTR_JOURNEY_NAME = \"journey.name\";\n\n/** Parent journey id, present only on a child journey. */\nexport const ATTR_JOURNEY_PARENT_ID = \"journey.parent_id\";\n\n/** Marks a record whose attributes failed to sanitize. */\nexport const ATTR_SANITIZE_FAILED = \"uiobs.sanitize_failed\";\n\n/**\n * Marks a record whose attributes were dropped for exceeding the byte budget.\n * @see {@link ATTR_ATTRIBUTES_BYTES}\n */\nexport const ATTR_ATTRIBUTES_DROPPED = \"uiobs.attributes_dropped\";\n\n/**\n * Byte size of the dropped attributes.\n * @see {@link ATTR_ATTRIBUTES_DROPPED}\n */\nexport const ATTR_ATTRIBUTES_BYTES = \"uiobs.attributes_bytes\";\n\n/** Application name resource key. */\nexport const RESOURCE_SERVICE_NAME = \"service.name\";\n\n/** Application build version resource key. */\nexport const RESOURCE_SERVICE_VERSION = \"service.version\";\n\n/** Deployment environment resource key. */\nexport const RESOURCE_DEPLOYMENT_ENVIRONMENT = \"deployment.environment\";\n\n/**\n * Producer library name resource key.\n * @see {@link TELEMETRY_SDK_NAME}\n */\nexport const RESOURCE_TELEMETRY_SDK_NAME = \"telemetry.sdk.name\";\n\n/**\n * Producer library version resource key.\n * @see {@link TELEMETRY_SDK_VERSION}\n */\nexport const RESOURCE_TELEMETRY_SDK_VERSION = \"telemetry.sdk.version\";\n\n/**\n * Producer SDK language resource key.\n * @see {@link TELEMETRY_SDK_LANGUAGE}\n */\nexport const RESOURCE_TELEMETRY_SDK_LANGUAGE = \"telemetry.sdk.language\";\n\n/** Host platform resource key: browser, webview, or OpenFin. */\nexport const RESOURCE_HOST_PLATFORM = \"host.platform\";\n\n/** Session id resource key. */\nexport const RESOURCE_SESSION_ID = \"session.id\";\n\n/** Tab id resource key. */\nexport const RESOURCE_TAB_ID = \"tab.id\";\n\n/** Context (realm) id resource key. */\nexport const RESOURCE_CONTEXT_ID = \"context.id\";\n\n/** Raw user agent resource key. */\nexport const RESOURCE_BROWSER_USER_AGENT = \"browser.user_agent\";\n\n/** OpenFin application uuid resource key. */\nexport const RESOURCE_OPENFIN_UUID = \"openfin.uuid\";\n\n/** OpenFin window or view name resource key. */\nexport const RESOURCE_OPENFIN_NAME = \"openfin.name\";\n\n/**\n * Value of `telemetry.sdk.name`.\n * @see {@link RESOURCE_TELEMETRY_SDK_NAME}\n */\nexport const TELEMETRY_SDK_NAME = \"@utk09/ui-observability\";\n\n/**\n * Value of `telemetry.sdk.version`. A literal, not read from package.json. Bump by hand alongside package.json.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = \"0.2.0\";\n\n/**\n * Value of `telemetry.sdk.language`.\n * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}\n */\nexport const TELEMETRY_SDK_LANGUAGE = \"webjs\";\n\n// ----------------------------------\n// Serializers\n// ----------------------------------\n\n/** OTLP/JSON serializer name. */\nexport const SERIALIZER_NAME_OTLP = \"otlp\";\n\n/** ECS serializer name. */\nexport const SERIALIZER_NAME_ECS = \"ecs\";\n\n/** Content type for an OTLP/JSON body. */\nexport const CONTENT_TYPE_JSON = \"application/json\";\n\n/** Content type for newline-delimited JSON. */\nexport const CONTENT_TYPE_NDJSON = \"application/x-ndjson\";\n\n/** Nanoseconds per millisecond. */\nexport const NANOS_PER_MILLI = 1000000n;\n\n/**\n * Matches a nanosecond epoch written as decimal digits, e.g. \"1755543600123000000\".\n * @see {@link NANOS_PER_MILLI}\n */\nexport const NANOS_PATTERN = /^\\d+$/;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Content-Type header name. */\nexport const HEADER_CONTENT_TYPE = \"Content-Type\";\n\n/** Content-Encoding header name. */\nexport const HEADER_CONTENT_ENCODING = \"Content-Encoding\";\n\n/** Retry-After header name. */\nexport const HEADER_RETRY_AFTER = \"Retry-After\";\n\n/**\n * Batch deduplication key header name.\n * @see {@link QUERY_PARAM_BATCH_ID}\n */\nexport const HEADER_BATCH_ID = \"X-UiObs-Batch-Id\";\n\n/** Delivery attempt number header name. */\nexport const HEADER_ATTEMPT = \"X-UiObs-Attempt\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** 401, credentials missing or rejected. */\nexport const HTTP_UNAUTHORIZED = 401;\n\n/** 403, valid credentials but access denied. */\nexport const HTTP_FORBIDDEN = 403;\n\n/** 408, the server closed the connection after a timeout. Retryable. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large; batch must be split. */\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\n/** 429, backpressure. */\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\n/** 500, floor for server-side errors. */\nexport const HTTP_SERVER_ERROR_MIN = 500;\n\n/** 503, temporary unavailability. */\nexport const HTTP_SERVICE_UNAVAILABLE = 503;\n\n/** Milliseconds per second. */\nexport const MILLIS_PER_SECOND = 1000;\n\n// ----------------------------------\n// Exit flush\n// ----------------------------------\n\n/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */\nexport const BEACON_LIMIT_BYTES = 60_000;\n\n/** Content type for an exit payload. CORS-safelisted, avoids a preflight. */\nexport const CONTENT_TYPE_TEXT_PLAIN = \"text/plain;charset=UTF-8\";\n\n/**\n * Batch id query param name, for the exit path.\n * @see {@link HEADER_BATCH_ID}\n */\nexport const QUERY_PARAM_BATCH_ID = \"uiobs_batch_id\";\n\n/** Exit reason query param name, for logs only. */\nexport const QUERY_PARAM_EXIT_REASON = \"uiobs_exit\";\n\n// ----------------------------------\n// Storage\n// ----------------------------------\n\n/** localStorage key prefix for a parked batch. */\nexport const BATCH_STORAGE_KEY_PREFIX = \"ui-observability.batch.\";\n\n/** Zero-padded digit width for the creation time in a batch key. */\nexport const BATCH_KEY_TIME_WIDTH = 14;\n\n/** localStorage key prefix for a batch parked by exit flush. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Max exit batches held at once. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key used to test whether localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store evicted on a quota error (1 in N). */\nexport const QUOTA_EVICTION_DIVISOR = 4;\n\n/** DOMException name for a full store. */\nexport const QUOTA_EXCEEDED_ERROR = \"QuotaExceededError\";\n\n/**\n * Native IndexedDB version. It starts at 11 because Dexie, which this replaced,\n * opened the same database at ten times its own declared version. Anything below\n * 11 makes open() fail with VersionError for an existing installation and every\n * batch already stored there is stranded.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 11;\n\n/** IndexedDB object store holding batches. Named by Dexie before it was removed. */\nexport const INDEXEDDB_STORE_NAME = \"batches\";\n\n/** Index on the batch store that orders reads by creation time. */\nexport const INDEXEDDB_CREATED_AT_INDEX = \"createdAt\";\n\n/** IndexedDB adapter/strategy name. */\nexport const STORAGE_NAME_INDEXEDDB = \"indexeddb\";\n\n/** localStorage adapter/strategy name. */\nexport const STORAGE_NAME_LOCAL = \"localstorage\";\n\n/** In-memory adapter/strategy name. */\nexport const STORAGE_NAME_MEMORY = \"memory\";\n\n/** No-op adapter/strategy name. */\nexport const STORAGE_NAME_NONE = \"none\";\n\n// ----------------------------------\n// Retry\n// ----------------------------------\n\n/**\n * Origin-wide lock name a drain runs under.\n * @see {@link EMERGENCY_LOCK_NAME}\n */\nexport const DRAIN_LOCK_NAME = \"ui-observability.drain\";\n\n/**\n * Lock name startup recovery runs under.\n * @see {@link DRAIN_LOCK_NAME}\n */\nexport const EMERGENCY_LOCK_NAME = \"ui-observability.emergency\";\n\n/** Batches sent per drain tick. */\nexport const BATCHES_PER_DRAIN = 20;\n\n// ----------------------------------\n// Journey\n// ----------------------------------\n\n/** `sessionStorage` key for the current journey. */\nexport const JOURNEY_STORAGE_KEY = \"ui-observability.journey\";\n\n/**\n * Max journey name length in a token, in characters.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;\n\n/**\n * Max whole-token length, in characters. A tripwire, not validation.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * How long to wait for `fin.me.getOptions()` before giving up on a seeded journey,\n * in milliseconds.\n * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}\n */\nexport const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;\n\n/** Key under an OpenFin window's `customData` carrying a seeded journey token. */\nexport const OPENFIN_JOURNEY_CUSTOM_DATA_KEY = \"uiObsJourney\";\n\n/** Matches `+` in standard base64 (`-` in URL-safe). */\nexport const BASE64_PLUS_PATTERN = /\\+/g;\n\n/** Matches `/` in standard base64 (`_` in URL-safe). */\nexport const BASE64_SLASH_PATTERN = /\\//g;\n\n/** Matches trailing `=` padding. */\nexport const BASE64_PADDING_PATTERN = /=+$/;\n\n/** Matches `-` in URL-safe base64 (`+` in standard). */\nexport const BASE64URL_DASH_PATTERN = /-/g;\n\n/** Matches `_` in URL-safe base64 (`/` in standard). */\nexport const BASE64URL_UNDERSCORE_PATTERN = /_/g;\n\n/** Base64 characters per 3-byte group. */\nexport const BASE64_GROUP_CHARS = 4;\n\n// ----------------------------------\n// Tracing\n// ----------------------------------\n\n/** W3C trace id width, in bytes. */\nexport const TRACE_ID_BYTES = 16;\n\n/** W3C span id width, in bytes. */\nexport const SPAN_ID_BYTES = 8;\n\n/** Max ambient trace lifetime with no activity, in milliseconds. */\nexport const TRACE_MAX_AGE_MS = 5 * 60 * 1000;\n\n/** trace-flags value with the sampled bit set. */\nexport const TRACE_FLAGS_SAMPLED = 1;\n\n/** Mask for the one-byte trace-flags field. */\nexport const TRACE_FLAGS_MASK = 0xff;\n\n/**\n * W3C trace context header name\n * @see {@link TRACEPARENT_VERSION}\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n\n/** traceparent header version prefix. */\nexport const TRACEPARENT_VERSION = \"00\";\n\n// ----------------------------------\n// Breadcrumbs\n// ----------------------------------\n\n/** Smallest valid breadcrumb buffer capacity. */\nexport const BREADCRUMB_MIN_CAPACITY = 1;\n\n// ----------------------------------\n// Sampling\n// ----------------------------------\n//\n// FNV-1a hash constants, used to turn a sampling key into a stable 0-1\n// fraction.\n\n/** FNV-1a 32-bit offset basis. */\nexport const FNV_OFFSET_BASIS = 0x811c9dc5;\n\n/** FNV-1a 32-bit prime. */\nexport const FNV_PRIME = 0x01000193;\n\n/** Largest 32-bit unsigned value. */\nexport const UINT32_MAX = 0xffffffff;\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. Mismatched versions are dropped. */\nexport const BUS_PROTOCOL = \"ui-observability/1\";\n\n/** Global window property key used to locate a same-origin runtime instance. */\nexport const RUNTIME_GLOBAL_KEY = \"ui-observability.runtime\";\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Maximum error records captured per throttling window before suppression. */\nexport const ERROR_STORM_MAX_PER_WINDOW = 20;\n\n/** Error rate-limiting window duration in milliseconds. */\nexport const ERROR_STORM_WINDOW_MS = 10_000;\n\n/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */\nexport const MAX_TRACKED_ERROR_SIGNATURES = 200;\n\n/** Maximum character length retained from clicked element text in breadcrumbs. */\nexport const CLICK_TEXT_MAX_CHARS = 50;\n\n/** Maximum character length retained from an aria-label attribute in generated selectors. */\nexport const ARIA_LABEL_MAX_CHARS = 40;\n\n/** Maximum class names included per element in generated CSS selectors. */\nexport const SELECTOR_MAX_CLASSES = 2;\n\n/** CSS styling applied to console prefix labels. */\nexport const CONSOLE_PREFIX_STYLE = \"color:#888\";\n\n/** Scaling factor for rounding duration measurements to three decimal places. */\nexport const DURATION_PRECISION = 1000;\n\n// ----------------------------------\n// Runtime\n// ----------------------------------\n\n/** Minimum duration in milliseconds between storage gap warning reports. */\nexport const GAP_REPORT_THROTTLE_MS = 60_000;\n\n/** Default namespace for telemetry records emitted by auto-capture modules. */\nexport const CAPTURE_NAMESPACE = \"uiobs.capture\";\n\n/** Default namespace for telemetry records emitted by storage subsystems. */\nexport const STORAGE_NAMESPACE = \"uiobs.storage\";\n\n/** Fallback measurement unit applied when none is specified. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n// ----------------------------------\n// Configuration\n// ----------------------------------\n\n/** Default `service.name` when a consumer sets none. */\nexport const UNKNOWN_SERVICE_NAME = \"unknown-service\";\n\n/** Lowest sampling rate (drop everything). */\nexport const SAMPLING_RATE_MIN = 0;\n\n/** Highest sampling rate (keep everything). */\nexport const SAMPLING_RATE_MAX = 1;\n\n/**\n * Fallback for an invalid sampling rate (keep everything).\n * @see {@link SAMPLING_RATE_MAX}\n */\nexport const SAMPLING_RATE_FALLBACK = 1;\n\n/**\n * Config keys with no default, excluded from `DEFAULT_CONFIG`.\n * @see {@link DEFAULT_CONFIG}\n */\nexport const UNDEFAULTED_CONFIG_KEYS = [\"redact\", \"onDiagnostic\", \"headers\", \"serializer\"] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\"sampling\", \"bus\", \"capture\"] as const;\n\n/**\n * Default runtime config, before a consumer's `configure()` call.\n * Excludes `serializer`; `resolveConfig` supplies its default to avoid a circular import.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n compression: \"gzip\",\n credentials: \"include\",\n storage: \"auto\",\n sampling: { defaultRate: 1, rates: {}, alwaysSampleTypes: [\"action\"] },\n bus: { mode: \"auto\", trustedOrigins: [], openFinRole: \"auto\" },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n interactions: false,\n navigation: false,\n webVitals: false,\n ignoreUrls: [],\n propagateTraceHeaderTo: [],\n },\n console: null,\n};\n\n/** Console mirroring level used when a consumer passes `console: true`. */\nexport const CONSOLE_DEFAULT_LEVEL: LogLevel = \"DEBUG\";\n\n// ----------------------------------\n// Batching\n// ----------------------------------\n\n/** Max time a partial log batch waits before it is sent, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch before it is sent early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/** Max time a partial metric batch waits before it is sent, in milliseconds. Metrics batch harder than logs: higher volume, nothing waits on them. */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch before it is sent early. */\nexport const METRIC_BATCH_SIZE = 500;\n\n/** Max concurrent ingest requests, across both streams. */\nexport const MAX_CONCURRENT_REQUESTS = 2;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Max time one ingest request may take before it is aborted and retried, in milliseconds. */\nexport const REQUEST_TIMEOUT_MS = 15_000;\n\n/** Min payload size to compress, in bytes. */\nexport const COMPRESSION_THRESHOLD_BYTES = 1024;\n\n// ----------------------------------\n// Storage retention\n// ----------------------------------\n\n/** IndexedDB database name. */\nexport const STORAGE_DB_NAME = \"UiObservability\";\n\n/** Capacity and retention thresholds every storage adapter enforces. */\nexport const STORAGE_LIMITS: StorageLimits = {\n maxBatches: 500,\n maxAgeMs: 24 * 60 * 60 * 1000,\n maxAttempts: 5,\n};\n\n// ----------------------------------\n// Retry backoff\n// ----------------------------------\n\n/** First backoff step, in milliseconds. Each attempt doubles it. */\nexport const RETRY_BASE_DELAY_MS = 2000;\n\n/** Backoff ceiling, in milliseconds. */\nexport const RETRY_MAX_DELAY_MS = 60_000;\n\n/** How often to check for stored work when nothing has failed recently, in milliseconds. */\nexport const RETRY_IDLE_DELAY_MS = 30_000;\n\n// ----------------------------------\n// Journey lifetime\n// ----------------------------------\n\n/** Max time a journey stays open before it is treated as abandoned, in milliseconds. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** Whether closing the owning context ends the journey for everyone. */\nexport const JOURNEY_END_ON_OWNER_CLOSE = false;\n\n/** Query parameter checked at boot for a seeded journey token. */\nexport const JOURNEY_URL_PARAM = \"__uiobs_journey\";\n\n// ----------------------------------\n// Bus handshake\n// ----------------------------------\n\n/** BroadcastChannel name for the control plane. */\nexport const BUS_CHANNEL_NAME = \"ui_observability_control\";\n\n/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */\nexport const BUS_HANDSHAKE_TIMEOUT_MS = 1500;\n\n/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */\nexport const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;\n\n/** Max records a context buffers before its bus role is determined. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/** Window within which identical errors are counted but not re-sent, in milliseconds. */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps applied to every record, enforced after sanitize and after redact. */\nexport const RECORD_LIMITS = {\n maxBodyChars: 4096,\n maxAttributeChars: 8192,\n maxAttributeCount: 128,\n maxStackChars: 8192,\n maxDepth: 6,\n maxArrayLength: 100,\n maxRecordBytes: 32_768,\n};\n"],"mappings":"AAcA,IAoCa,GAAqB,WAGrB,EAA6B,SAG7B,EAAwB,yBAGxB,EAAuB,gBAGvB,EAAoB,aAqDpB,EAA4C,CACvD,MAAO,EACP,MAAO,EACP,KAAM,EACN,KAAM,GACN,MAAO,GACP,MAAO,EACT,EAMa,EAAwC,EAUxC,EAAgB,WAGhB,EAAe,UAGf,EAAqB,gBAGrB,EAAgB,WAMhB,EAAgB,WAGhB,EAAkB,aAGlB,EAAoB,eAGpB,EAAyB,oBAGzB,EAAuB,wBAMvB,EAA0B,2BAM1B,EAAwB,yBAGxB,EAAwB,eAGxB,EAA2B,kBAG3B,EAAkC,yBAMlC,EAA8B,qBAM9B,EAAiC,wBAMjC,EAAkC,yBAGlC,EAAyB,gBAGzB,EAAsB,aAGtB,EAAkB,SAGlB,EAAsB,aAGtB,EAA8B,qBAG9B,EAAwB,eAGxB,EAAwB,eAMxB,EAAqB,0BAMrB,EAAwB,QAMxB,EAAyB,QAOzB,EAAuB,OAMvB,EAAoB,mBAGpB,EAAsB,uBAGtB,EAAkB,SAMlB,EAAgB,QAOhB,EAAsB,eAGtB,EAA0B,mBAG1B,EAAqB,cAMrB,EAAkB,mBAGlB,EAAiB,kBAGjB,EAAgB,OAwBhB,EAAoB,IAOpB,EAAqB,IAGrB,EAA0B,2BAM1B,EAAuB,iBAGvB,EAA0B,aAO1B,EAA2B,0BAM3B,EAA+B,8BAM/B,EAAoB,yBAMpB,EAAuB,qBAWvB,GAAuB,UAGvB,GAA6B,YAG7B,EAAyB,YAGzB,GAAqB,eAGrB,GAAsB,SAGtB,GAAoB,OAUpB,GAAkB,yBAMlB,GAAsB,6BAUtB,GAAsB,2BAmBtB,GAA6B,IAG7B,GAAkC,eAGlC,GAAsB,MAGtB,GAAuB,MAGvB,GAAyB,MAGzB,GAAyB,KAGzB,GAA+B,KAgB/B,GAAmB,IAYnB,GAAqB,cAoBrB,GAAmB,WAGnB,GAAY,SAGZ,GAAa,WAOb,GAA2B,SAO3B,GAAe,qBAGf,GAAqB,2BAUrB,GAAwB,IAexB,GAAuB,aAGvB,GAAqB,IAOrB,GAAyB,IAGzB,GAAoB,gBAGpB,GAAoB,gBAGpB,GAAsB,QAOtB,GAAuB,kBAkBvB,GAA0B,CAAC,SAAU,eAAgB,UAAW,YAAY,EAM5E,GAAkB,CAAC,WAAY,MAAO,SAAS,EAQ/C,GAAqD,CAChE,SAAU,GACV,YAAa,GACb,eAAgB,GAChB,YAAa,GACb,QAAS,GACT,SAAU,OACV,YAAa,OACb,YAAa,UACb,QAAS,OACT,SAAU,CAAE,YAAa,EAAG,MAAO,CAAC,EAAG,kBAAmB,CAAC,QAAQ,CAAE,EACrE,IAAK,CAAE,KAAM,OAAQ,eAAgB,CAAC,EAAG,YAAa,MAAO,EAC7D,QAAS,CACP,OAAQ,GACR,WAAY,GACZ,eAAgB,GAChB,MAAO,GACP,IAAK,GACL,aAAc,GACd,WAAY,GACZ,UAAW,GACX,WAAY,CAAC,EACb,uBAAwB,CAAC,CAC3B,EACA,QAAS,IACX,EAGa,GAAkC,QAOlC,GAAwB,IAMxB,GAA2B,IAa3B,GAAqB,KAGrB,GAA8B,KAO9B,GAAkB,kBAGlB,GAAgC,CAC3C,WAAY,IACZ,SAAU,MACV,YAAa,CACf,EAOa,GAAsB,IAGtB,GAAqB,IAGrB,GAAsB,IAOtB,GAAqB,KAMrB,GAAoB,kBAOpB,GAAmB,2BAGnB,GAA2B,KAgB3B,GAAkB,IAOlB,GAAgB,CAC3B,aAAc,KACd,kBAAmB,KACnB,kBAAmB,IACnB,cAAe,KACf,SAAU,EACV,eAAgB,IAChB,eAAgB,KAClB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
var ee = "[ui-observability]", te = 1e3, e = "ui-observability.session", t = "ui-observability.tab", n = 18e5, r = 6e4, i = /OpenFin/i, a = /\bwv\b/, o = /\b(iPhone|iPad|iPod)\b/, s = /\bMacintosh\b/, c = /\bMobile\b/, l = "AppleWebKit", u = "Safari/", d = 55296, f = 56319, p = 2048, m = {
|
|
3
|
+
TRACE: 1,
|
|
4
|
+
DEBUG: 5,
|
|
5
|
+
INFO: 9,
|
|
6
|
+
WARN: 13,
|
|
7
|
+
ERROR: 17,
|
|
8
|
+
FATAL: 21
|
|
9
|
+
}, h = m, g = "log.type", _ = "log.seq", v = "app.namespace", y = "page.url", b = "url.full", x = "journey.id", S = "journey.name", C = "journey.parent_id", w = "uiobs.sanitize_failed", T = "uiobs.attributes_dropped", E = "uiobs.attributes_bytes", D = "service.name", O = "service.version", k = "deployment.environment", A = "telemetry.sdk.name", j = "telemetry.sdk.version", M = "telemetry.sdk.language", N = "host.platform", P = "session.id", F = "tab.id", I = "context.id", L = "browser.user_agent", R = "openfin.uuid", z = "openfin.name", B = "@utk09/ui-observability", V = "0.2.0", H = "webjs", U = "otlp", W = "application/json", G = "application/x-ndjson", K = 1000000n, q = /^\d+$/, J = "Content-Type", Y = "Content-Encoding", X = "Retry-After", Z = "X-UiObs-Batch-Id", Q = "X-UiObs-Attempt", ne = "gzip", re = 1e3, ie = 6e4, ae = "text/plain;charset=UTF-8", oe = "uiobs_batch_id", $ = "uiobs_exit", se = "ui-observability.batch.", ce = "ui-observability.emergency.", le = "ui-observability.probe", ue = "QuotaExceededError", de = "batches", fe = "createdAt", pe = "indexeddb", me = "localstorage", he = "memory", ge = "none", _e = "ui-observability.drain", ve = "ui-observability.emergency", ye = "ui-observability.journey", be = 2e3, xe = "uiObsJourney", Se = /\+/g, Ce = /\//g, we = /=+$/, Te = /-/g, Ee = /_/g, De = 3e5, Oe = "traceparent", ke = 2166136261, Ae = 16777619, je = 4294967295, Me = "metric", Ne = "ui-observability/1", Pe = "ui-observability.runtime", Fe = 1e4, Ie = "color:#888", Le = 1e3, Re = 6e4, ze = "uiobs.capture", Be = "uiobs.storage", Ve = "count", He = "unknown-service", Ue = [
|
|
10
|
+
"redact",
|
|
11
|
+
"onDiagnostic",
|
|
12
|
+
"headers",
|
|
13
|
+
"serializer"
|
|
14
|
+
], We = [
|
|
15
|
+
"sampling",
|
|
16
|
+
"bus",
|
|
17
|
+
"capture"
|
|
18
|
+
], Ge = {
|
|
19
|
+
endpoint: "",
|
|
20
|
+
serviceName: "",
|
|
21
|
+
serviceVersion: "",
|
|
22
|
+
environment: "",
|
|
23
|
+
enabled: !0,
|
|
24
|
+
minLevel: "INFO",
|
|
25
|
+
compression: "gzip",
|
|
26
|
+
credentials: "include",
|
|
27
|
+
storage: "auto",
|
|
28
|
+
sampling: {
|
|
29
|
+
defaultRate: 1,
|
|
30
|
+
rates: {},
|
|
31
|
+
alwaysSampleTypes: ["action"]
|
|
32
|
+
},
|
|
33
|
+
bus: {
|
|
34
|
+
mode: "auto",
|
|
35
|
+
trustedOrigins: [],
|
|
36
|
+
openFinRole: "auto"
|
|
37
|
+
},
|
|
38
|
+
capture: {
|
|
39
|
+
errors: !0,
|
|
40
|
+
rejections: !0,
|
|
41
|
+
resourceErrors: !1,
|
|
42
|
+
fetch: !1,
|
|
43
|
+
xhr: !1,
|
|
44
|
+
interactions: !1,
|
|
45
|
+
navigation: !1,
|
|
46
|
+
webVitals: !1,
|
|
47
|
+
ignoreUrls: [],
|
|
48
|
+
propagateTraceHeaderTo: []
|
|
49
|
+
},
|
|
50
|
+
console: null
|
|
51
|
+
}, Ke = "DEBUG", qe = 2e3, Je = 1e4, Ye = 15e3, Xe = 1024, Ze = "UiObservability", Qe = {
|
|
52
|
+
maxBatches: 500,
|
|
53
|
+
maxAgeMs: 864e5,
|
|
54
|
+
maxAttempts: 5
|
|
55
|
+
}, $e = 2e3, et = 6e4, tt = 3e4, nt = 18e5, rt = "__uiobs_journey", it = "ui_observability_control", at = 1500, ot = 5e3, st = {
|
|
56
|
+
maxBodyChars: 4096,
|
|
57
|
+
maxAttributeChars: 8192,
|
|
58
|
+
maxAttributeCount: 128,
|
|
59
|
+
maxStackChars: 8192,
|
|
60
|
+
maxDepth: 6,
|
|
61
|
+
maxArrayLength: 100,
|
|
62
|
+
maxRecordBytes: 32768
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { o as $, H as $t, ae as A, F as At, Fe as B, n as Bt, ze as C, k as Ct, Ie as D, D as Dt, Ke as E, R as Et, Le as F, tt as Ft, Z as G, Qe as Gt, Ae as H, r as Ht, ve as I, et as It, X as J, me as Jt, Y as K, Be as Kt, ce as L, Pe as Lt, Ve as M, A as Mt, te as N, j as Nt, W as O, O as Ot, _e as P, $e as Pt, de as Q, t as Qt, ne as R, u as Rt, Ne as S, I as St, We as T, z as Tt, Re as U, m as Ut, ke as V, e as Vt, Q as W, Ze as Wt, d as X, ge as Xt, f as Y, he as Yt, fe as Z, le as Zt, Ce as _, $ as _t, x as a, Ue as an, qe as at, it as b, Ye as bt, _ as c, l as cn, Je as ct, w as d, q as dt, B as en, nt as et, b as f, K as ft, Se as g, oe as gt, we as h, i as ht, T as i, je as in, ee as it, Ge as j, M as jt, G as k, P as kt, g as l, re as lt, Ee as m, be as mt, v as n, Oe as nn, rt as nt, S as o, He as on, Me as ot, Te as p, xe as pt, J as q, pe as qt, E as r, De as rn, h as rt, C as s, p as sn, s as st, a as t, V as tn, ye as tt, y as u, c as ut, se as v, ue as vt, Xe as w, N as wt, at as x, L as xt, ie as y, st as yt, ot as z, U as zt };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=constants-NJNXpfPi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-NJNXpfPi.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// All limits, thresholds, timing windows, storage keys, patterns, and\n// defaults used by the library.\n\nimport type { ResolvedConfig } from \"./models/config\";\nimport type { LogLevel, LogType } from \"./models/log-record\";\nimport type { StorageLimits } from \"./models/storage\";\n\n// ----------------------------------\n// Library-wide\n// ----------------------------------\n\n/** Prefix on console messages this library writes. */\nexport const LIBRARY_LOG_PREFIX = \"[ui-observability]\";\n\n// ----------------------------------\n// Diagnostics\n// ----------------------------------\n\n/** Throttle window per diagnostic code, in milliseconds. Limits how often an error loop can spam the handler. */\nexport const DIAGNOSTIC_THROTTLE_MS = 1000;\n\n// ----------------------------------\n// Identity\n// ----------------------------------\n\n/** `localStorage` key for the session id and its last-seen time. */\nexport const SESSION_ID_KEY = \"ui-observability.session\";\n\n/** `sessionStorage` key for the tab id. */\nexport const TAB_ID_KEY = \"ui-observability.tab\";\n\n/** Session idle timeout, in milliseconds. */\nexport const SESSION_IDLE_MS = 30 * 60 * 1000;\n\n/** Min gap between session last-seen writes, in milliseconds. */\nexport const SESSION_TOUCH_MS = 60_000;\n\n/** Random id length, in bytes, used when `crypto.randomUUID` is unavailable. */\nexport const ID_BYTE_LENGTH = 16;\n\n/** Distinct values in one byte (256). */\nexport const BYTE_VALUE_COUNT = 256;\n\n// ----------------------------------\n// Platform detection\n// ----------------------------------\n\n/** Matches OpenFin's user agent. */\nexport const OPENFIN_UA_PATTERN = /OpenFin/i;\n\n/** Matches Android's webview token (`wv`). */\nexport const ANDROID_WEBVIEW_UA_PATTERN = /\\bwv\\b/;\n\n/** Matches iOS hardware: iPhone, iPad, iPod. */\nexport const IOS_DEVICE_UA_PATTERN = /\\b(iPhone|iPad|iPod)\\b/;\n\n/** Matches desktop macOS in a user agent. */\nexport const MACINTOSH_UA_PATTERN = /\\bMacintosh\\b/;\n\n/** Matches the mobile token. */\nexport const MOBILE_UA_PATTERN = /\\bMobile\\b/;\n\n/** WebKit engine token, present in every WebKit browser including webviews. */\nexport const WEBKIT_UA_TOKEN = \"AppleWebKit\";\n\n/** Safari token sent by real iOS browsers, not in-app webviews. */\nexport const SAFARI_UA_TOKEN = \"Safari/\";\n\n// ----------------------------------\n// Sanitizing and size estimation\n// ----------------------------------\n\n/** First UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MIN = 0xd800;\n\n/** Last UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MAX = 0xdbff;\n\n/** Code units below this encode as one UTF-8 byte. */\nexport const UTF8_ONE_BYTE_CEILING = 0x80;\n\n/** Code units below this, and at or above the one-byte ceiling, encode as two UTF-8 bytes. */\nexport const UTF8_TWO_BYTE_CEILING = 0x800;\n\n/** Class names kept in a `describeNode` selector. */\nexport const MAX_NODE_CLASS_NAMES = 3;\n\n/** Byte cost of a null or undefined value. */\nexport const BYTES_PER_NULL = 4;\n\n/** Byte cost of a number (flat estimate). */\nexport const BYTES_PER_NUMBER = 8;\n\n/** Byte cost of a boolean. */\nexport const BYTES_PER_BOOLEAN = 5;\n\n/** Byte cost of an object or array's wrapping braces or brackets. */\nexport const BYTES_PER_CONTAINER = 2;\n\n/** Byte cost of a string's wrapping quotes. */\nexport const BYTES_PER_QUOTED_STRING = 2;\n\n/** Byte cost of one key's punctuation: quotes, colon, comma. */\nexport const BYTES_PER_KEY_OVERHEAD = 4;\n\n// ----------------------------------\n// Record model\n// ----------------------------------\n\n/**\n * Log level to OpenTelemetry severity number.\n * @see {@link LEVEL_ORDER}\n */\nexport const SEVERITY_NUMBER: Record<LogLevel, number> = {\n TRACE: 1,\n DEBUG: 5,\n INFO: 9,\n WARN: 13,\n ERROR: 17,\n FATAL: 21,\n};\n\n/**\n * Alias for `SEVERITY_NUMBER`, used by the level filter.\n * @see {@link SEVERITY_NUMBER}\n */\nexport const LEVEL_ORDER: Record<LogLevel, number> = SEVERITY_NUMBER;\n\n// ----------------------------------\n// Attribute and resource keys\n// ----------------------------------\n//\n// Attribute and resource key names records carry on the wire, following\n// OpenTelemetry conventions. `uiobs.` marks this library's own fields.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number within its context, from zero. */\nexport const ATTR_LOG_SEQ = \"log.seq\";\n\n/** Logger namespace attribute key. */\nexport const ATTR_APP_NAMESPACE = \"app.namespace\";\n\n/** Document URL when the record was built. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key, set by network capture. Don't reuse `ATTR_PAGE_URL`; it would overwrite the request's target.\n * @see {@link ATTR_PAGE_URL}\n */\nexport const ATTR_URL_FULL = \"url.full\";\n\n/** Journey id attribute key. */\nexport const ATTR_JOURNEY_ID = \"journey.id\";\n\n/** Journey name attribute key. */\nexport const ATTR_JOURNEY_NAME = \"journey.name\";\n\n/** Parent journey id, present only on a child journey. */\nexport const ATTR_JOURNEY_PARENT_ID = \"journey.parent_id\";\n\n/** Marks a record whose attributes failed to sanitize. */\nexport const ATTR_SANITIZE_FAILED = \"uiobs.sanitize_failed\";\n\n/**\n * Marks a record whose attributes were dropped for exceeding the byte budget.\n * @see {@link ATTR_ATTRIBUTES_BYTES}\n */\nexport const ATTR_ATTRIBUTES_DROPPED = \"uiobs.attributes_dropped\";\n\n/**\n * Byte size of the dropped attributes.\n * @see {@link ATTR_ATTRIBUTES_DROPPED}\n */\nexport const ATTR_ATTRIBUTES_BYTES = \"uiobs.attributes_bytes\";\n\n/** Application name resource key. */\nexport const RESOURCE_SERVICE_NAME = \"service.name\";\n\n/** Application build version resource key. */\nexport const RESOURCE_SERVICE_VERSION = \"service.version\";\n\n/** Deployment environment resource key. */\nexport const RESOURCE_DEPLOYMENT_ENVIRONMENT = \"deployment.environment\";\n\n/**\n * Producer library name resource key.\n * @see {@link TELEMETRY_SDK_NAME}\n */\nexport const RESOURCE_TELEMETRY_SDK_NAME = \"telemetry.sdk.name\";\n\n/**\n * Producer library version resource key.\n * @see {@link TELEMETRY_SDK_VERSION}\n */\nexport const RESOURCE_TELEMETRY_SDK_VERSION = \"telemetry.sdk.version\";\n\n/**\n * Producer SDK language resource key.\n * @see {@link TELEMETRY_SDK_LANGUAGE}\n */\nexport const RESOURCE_TELEMETRY_SDK_LANGUAGE = \"telemetry.sdk.language\";\n\n/** Host platform resource key: browser, webview, or OpenFin. */\nexport const RESOURCE_HOST_PLATFORM = \"host.platform\";\n\n/** Session id resource key. */\nexport const RESOURCE_SESSION_ID = \"session.id\";\n\n/** Tab id resource key. */\nexport const RESOURCE_TAB_ID = \"tab.id\";\n\n/** Context (realm) id resource key. */\nexport const RESOURCE_CONTEXT_ID = \"context.id\";\n\n/** Raw user agent resource key. */\nexport const RESOURCE_BROWSER_USER_AGENT = \"browser.user_agent\";\n\n/** OpenFin application uuid resource key. */\nexport const RESOURCE_OPENFIN_UUID = \"openfin.uuid\";\n\n/** OpenFin window or view name resource key. */\nexport const RESOURCE_OPENFIN_NAME = \"openfin.name\";\n\n/**\n * Value of `telemetry.sdk.name`.\n * @see {@link RESOURCE_TELEMETRY_SDK_NAME}\n */\nexport const TELEMETRY_SDK_NAME = \"@utk09/ui-observability\";\n\n/**\n * Value of `telemetry.sdk.version`. A literal, not read from package.json. Bump by hand alongside package.json.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = \"0.2.0\";\n\n/**\n * Value of `telemetry.sdk.language`.\n * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}\n */\nexport const TELEMETRY_SDK_LANGUAGE = \"webjs\";\n\n// ----------------------------------\n// Serializers\n// ----------------------------------\n\n/** OTLP/JSON serializer name. */\nexport const SERIALIZER_NAME_OTLP = \"otlp\";\n\n/** ECS serializer name. */\nexport const SERIALIZER_NAME_ECS = \"ecs\";\n\n/** Content type for an OTLP/JSON body. */\nexport const CONTENT_TYPE_JSON = \"application/json\";\n\n/** Content type for newline-delimited JSON. */\nexport const CONTENT_TYPE_NDJSON = \"application/x-ndjson\";\n\n/** Nanoseconds per millisecond. */\nexport const NANOS_PER_MILLI = 1000000n;\n\n/**\n * Matches a nanosecond epoch written as decimal digits, e.g. \"1755543600123000000\".\n * @see {@link NANOS_PER_MILLI}\n */\nexport const NANOS_PATTERN = /^\\d+$/;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Content-Type header name. */\nexport const HEADER_CONTENT_TYPE = \"Content-Type\";\n\n/** Content-Encoding header name. */\nexport const HEADER_CONTENT_ENCODING = \"Content-Encoding\";\n\n/** Retry-After header name. */\nexport const HEADER_RETRY_AFTER = \"Retry-After\";\n\n/**\n * Batch deduplication key header name.\n * @see {@link QUERY_PARAM_BATCH_ID}\n */\nexport const HEADER_BATCH_ID = \"X-UiObs-Batch-Id\";\n\n/** Delivery attempt number header name. */\nexport const HEADER_ATTEMPT = \"X-UiObs-Attempt\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** 401, credentials missing or rejected. */\nexport const HTTP_UNAUTHORIZED = 401;\n\n/** 403, valid credentials but access denied. */\nexport const HTTP_FORBIDDEN = 403;\n\n/** 408, the server closed the connection after a timeout. Retryable. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large; batch must be split. */\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\n/** 429, backpressure. */\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\n/** 500, floor for server-side errors. */\nexport const HTTP_SERVER_ERROR_MIN = 500;\n\n/** 503, temporary unavailability. */\nexport const HTTP_SERVICE_UNAVAILABLE = 503;\n\n/** Milliseconds per second. */\nexport const MILLIS_PER_SECOND = 1000;\n\n// ----------------------------------\n// Exit flush\n// ----------------------------------\n\n/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */\nexport const BEACON_LIMIT_BYTES = 60_000;\n\n/** Content type for an exit payload. CORS-safelisted, avoids a preflight. */\nexport const CONTENT_TYPE_TEXT_PLAIN = \"text/plain;charset=UTF-8\";\n\n/**\n * Batch id query param name, for the exit path.\n * @see {@link HEADER_BATCH_ID}\n */\nexport const QUERY_PARAM_BATCH_ID = \"uiobs_batch_id\";\n\n/** Exit reason query param name, for logs only. */\nexport const QUERY_PARAM_EXIT_REASON = \"uiobs_exit\";\n\n// ----------------------------------\n// Storage\n// ----------------------------------\n\n/** localStorage key prefix for a parked batch. */\nexport const BATCH_STORAGE_KEY_PREFIX = \"ui-observability.batch.\";\n\n/** Zero-padded digit width for the creation time in a batch key. */\nexport const BATCH_KEY_TIME_WIDTH = 14;\n\n/** localStorage key prefix for a batch parked by exit flush. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Max exit batches held at once. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key used to test whether localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store evicted on a quota error (1 in N). */\nexport const QUOTA_EVICTION_DIVISOR = 4;\n\n/** DOMException name for a full store. */\nexport const QUOTA_EXCEEDED_ERROR = \"QuotaExceededError\";\n\n/**\n * Native IndexedDB version. It starts at 11 because Dexie, which this replaced,\n * opened the same database at ten times its own declared version. Anything below\n * 11 makes open() fail with VersionError for an existing installation and every\n * batch already stored there is stranded.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 11;\n\n/** IndexedDB object store holding batches. Named by Dexie before it was removed. */\nexport const INDEXEDDB_STORE_NAME = \"batches\";\n\n/** Index on the batch store that orders reads by creation time. */\nexport const INDEXEDDB_CREATED_AT_INDEX = \"createdAt\";\n\n/** IndexedDB adapter/strategy name. */\nexport const STORAGE_NAME_INDEXEDDB = \"indexeddb\";\n\n/** localStorage adapter/strategy name. */\nexport const STORAGE_NAME_LOCAL = \"localstorage\";\n\n/** In-memory adapter/strategy name. */\nexport const STORAGE_NAME_MEMORY = \"memory\";\n\n/** No-op adapter/strategy name. */\nexport const STORAGE_NAME_NONE = \"none\";\n\n// ----------------------------------\n// Retry\n// ----------------------------------\n\n/**\n * Origin-wide lock name a drain runs under.\n * @see {@link EMERGENCY_LOCK_NAME}\n */\nexport const DRAIN_LOCK_NAME = \"ui-observability.drain\";\n\n/**\n * Lock name startup recovery runs under.\n * @see {@link DRAIN_LOCK_NAME}\n */\nexport const EMERGENCY_LOCK_NAME = \"ui-observability.emergency\";\n\n/** Batches sent per drain tick. */\nexport const BATCHES_PER_DRAIN = 20;\n\n// ----------------------------------\n// Journey\n// ----------------------------------\n\n/** `sessionStorage` key for the current journey. */\nexport const JOURNEY_STORAGE_KEY = \"ui-observability.journey\";\n\n/**\n * Max journey name length in a token, in characters.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;\n\n/**\n * Max whole-token length, in characters. A tripwire, not validation.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * How long to wait for `fin.me.getOptions()` before giving up on a seeded journey,\n * in milliseconds.\n * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}\n */\nexport const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;\n\n/** Key under an OpenFin window's `customData` carrying a seeded journey token. */\nexport const OPENFIN_JOURNEY_CUSTOM_DATA_KEY = \"uiObsJourney\";\n\n/** Matches `+` in standard base64 (`-` in URL-safe). */\nexport const BASE64_PLUS_PATTERN = /\\+/g;\n\n/** Matches `/` in standard base64 (`_` in URL-safe). */\nexport const BASE64_SLASH_PATTERN = /\\//g;\n\n/** Matches trailing `=` padding. */\nexport const BASE64_PADDING_PATTERN = /=+$/;\n\n/** Matches `-` in URL-safe base64 (`+` in standard). */\nexport const BASE64URL_DASH_PATTERN = /-/g;\n\n/** Matches `_` in URL-safe base64 (`/` in standard). */\nexport const BASE64URL_UNDERSCORE_PATTERN = /_/g;\n\n/** Base64 characters per 3-byte group. */\nexport const BASE64_GROUP_CHARS = 4;\n\n// ----------------------------------\n// Tracing\n// ----------------------------------\n\n/** W3C trace id width, in bytes. */\nexport const TRACE_ID_BYTES = 16;\n\n/** W3C span id width, in bytes. */\nexport const SPAN_ID_BYTES = 8;\n\n/** Max ambient trace lifetime with no activity, in milliseconds. */\nexport const TRACE_MAX_AGE_MS = 5 * 60 * 1000;\n\n/** trace-flags value with the sampled bit set. */\nexport const TRACE_FLAGS_SAMPLED = 1;\n\n/** Mask for the one-byte trace-flags field. */\nexport const TRACE_FLAGS_MASK = 0xff;\n\n/**\n * W3C trace context header name\n * @see {@link TRACEPARENT_VERSION}\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n\n/** traceparent header version prefix. */\nexport const TRACEPARENT_VERSION = \"00\";\n\n// ----------------------------------\n// Breadcrumbs\n// ----------------------------------\n\n/** Smallest valid breadcrumb buffer capacity. */\nexport const BREADCRUMB_MIN_CAPACITY = 1;\n\n// ----------------------------------\n// Sampling\n// ----------------------------------\n//\n// FNV-1a hash constants, used to turn a sampling key into a stable 0-1\n// fraction.\n\n/** FNV-1a 32-bit offset basis. */\nexport const FNV_OFFSET_BASIS = 0x811c9dc5;\n\n/** FNV-1a 32-bit prime. */\nexport const FNV_PRIME = 0x01000193;\n\n/** Largest 32-bit unsigned value. */\nexport const UINT32_MAX = 0xffffffff;\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. Mismatched versions are dropped. */\nexport const BUS_PROTOCOL = \"ui-observability/1\";\n\n/** Global window property key used to locate a same-origin runtime instance. */\nexport const RUNTIME_GLOBAL_KEY = \"ui-observability.runtime\";\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Maximum error records captured per throttling window before suppression. */\nexport const ERROR_STORM_MAX_PER_WINDOW = 20;\n\n/** Error rate-limiting window duration in milliseconds. */\nexport const ERROR_STORM_WINDOW_MS = 10_000;\n\n/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */\nexport const MAX_TRACKED_ERROR_SIGNATURES = 200;\n\n/** Maximum character length retained from clicked element text in breadcrumbs. */\nexport const CLICK_TEXT_MAX_CHARS = 50;\n\n/** Maximum character length retained from an aria-label attribute in generated selectors. */\nexport const ARIA_LABEL_MAX_CHARS = 40;\n\n/** Maximum class names included per element in generated CSS selectors. */\nexport const SELECTOR_MAX_CLASSES = 2;\n\n/** CSS styling applied to console prefix labels. */\nexport const CONSOLE_PREFIX_STYLE = \"color:#888\";\n\n/** Scaling factor for rounding duration measurements to three decimal places. */\nexport const DURATION_PRECISION = 1000;\n\n// ----------------------------------\n// Runtime\n// ----------------------------------\n\n/** Minimum duration in milliseconds between storage gap warning reports. */\nexport const GAP_REPORT_THROTTLE_MS = 60_000;\n\n/** Default namespace for telemetry records emitted by auto-capture modules. */\nexport const CAPTURE_NAMESPACE = \"uiobs.capture\";\n\n/** Default namespace for telemetry records emitted by storage subsystems. */\nexport const STORAGE_NAMESPACE = \"uiobs.storage\";\n\n/** Fallback measurement unit applied when none is specified. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n// ----------------------------------\n// Configuration\n// ----------------------------------\n\n/** Default `service.name` when a consumer sets none. */\nexport const UNKNOWN_SERVICE_NAME = \"unknown-service\";\n\n/** Lowest sampling rate (drop everything). */\nexport const SAMPLING_RATE_MIN = 0;\n\n/** Highest sampling rate (keep everything). */\nexport const SAMPLING_RATE_MAX = 1;\n\n/**\n * Fallback for an invalid sampling rate (keep everything).\n * @see {@link SAMPLING_RATE_MAX}\n */\nexport const SAMPLING_RATE_FALLBACK = 1;\n\n/**\n * Config keys with no default, excluded from `DEFAULT_CONFIG`.\n * @see {@link DEFAULT_CONFIG}\n */\nexport const UNDEFAULTED_CONFIG_KEYS = [\"redact\", \"onDiagnostic\", \"headers\", \"serializer\"] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\"sampling\", \"bus\", \"capture\"] as const;\n\n/**\n * Default runtime config, before a consumer's `configure()` call.\n * Excludes `serializer`; `resolveConfig` supplies its default to avoid a circular import.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n compression: \"gzip\",\n credentials: \"include\",\n storage: \"auto\",\n sampling: { defaultRate: 1, rates: {}, alwaysSampleTypes: [\"action\"] },\n bus: { mode: \"auto\", trustedOrigins: [], openFinRole: \"auto\" },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n interactions: false,\n navigation: false,\n webVitals: false,\n ignoreUrls: [],\n propagateTraceHeaderTo: [],\n },\n console: null,\n};\n\n/** Console mirroring level used when a consumer passes `console: true`. */\nexport const CONSOLE_DEFAULT_LEVEL: LogLevel = \"DEBUG\";\n\n// ----------------------------------\n// Batching\n// ----------------------------------\n\n/** Max time a partial log batch waits before it is sent, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch before it is sent early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/** Max time a partial metric batch waits before it is sent, in milliseconds. Metrics batch harder than logs: higher volume, nothing waits on them. */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch before it is sent early. */\nexport const METRIC_BATCH_SIZE = 500;\n\n/** Max concurrent ingest requests, across both streams. */\nexport const MAX_CONCURRENT_REQUESTS = 2;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Max time one ingest request may take before it is aborted and retried, in milliseconds. */\nexport const REQUEST_TIMEOUT_MS = 15_000;\n\n/** Min payload size to compress, in bytes. */\nexport const COMPRESSION_THRESHOLD_BYTES = 1024;\n\n// ----------------------------------\n// Storage retention\n// ----------------------------------\n\n/** IndexedDB database name. */\nexport const STORAGE_DB_NAME = \"UiObservability\";\n\n/** Capacity and retention thresholds every storage adapter enforces. */\nexport const STORAGE_LIMITS: StorageLimits = {\n maxBatches: 500,\n maxAgeMs: 24 * 60 * 60 * 1000,\n maxAttempts: 5,\n};\n\n// ----------------------------------\n// Retry backoff\n// ----------------------------------\n\n/** First backoff step, in milliseconds. Each attempt doubles it. */\nexport const RETRY_BASE_DELAY_MS = 2000;\n\n/** Backoff ceiling, in milliseconds. */\nexport const RETRY_MAX_DELAY_MS = 60_000;\n\n/** How often to check for stored work when nothing has failed recently, in milliseconds. */\nexport const RETRY_IDLE_DELAY_MS = 30_000;\n\n// ----------------------------------\n// Journey lifetime\n// ----------------------------------\n\n/** Max time a journey stays open before it is treated as abandoned, in milliseconds. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** Whether closing the owning context ends the journey for everyone. */\nexport const JOURNEY_END_ON_OWNER_CLOSE = false;\n\n/** Query parameter checked at boot for a seeded journey token. */\nexport const JOURNEY_URL_PARAM = \"__uiobs_journey\";\n\n// ----------------------------------\n// Bus handshake\n// ----------------------------------\n\n/** BroadcastChannel name for the control plane. */\nexport const BUS_CHANNEL_NAME = \"ui_observability_control\";\n\n/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */\nexport const BUS_HANDSHAKE_TIMEOUT_MS = 1500;\n\n/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */\nexport const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;\n\n/** Max records a context buffers before its bus role is determined. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/** Window within which identical errors are counted but not re-sent, in milliseconds. */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps applied to every record, enforced after sanitize and after redact. */\nexport const RECORD_LIMITS = {\n maxBodyChars: 4096,\n maxAttributeChars: 8192,\n maxAttributeCount: 128,\n maxStackChars: 8192,\n maxDepth: 6,\n maxArrayLength: 100,\n maxRecordBytes: 32_768,\n};\n"],"mappings":";AAcA,IAAa,KAAqB,sBAOrB,KAAyB,KAOzB,IAAiB,4BAGjB,IAAa,wBAGb,IAAkB,MAGlB,IAAmB,KAanB,IAAqB,YAGrB,IAA6B,UAG7B,IAAwB,0BAGxB,IAAuB,iBAGvB,IAAoB,cAGpB,IAAkB,eAGlB,IAAkB,WAOlB,IAAqB,OAGrB,IAAqB,OAMrB,IAAwB,MA+BxB,IAA4C;CACvD,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;AACT,GAMa,IAAwC,GAUxC,IAAgB,YAGhB,IAAe,WAGf,IAAqB,iBAGrB,IAAgB,YAMhB,IAAgB,YAGhB,IAAkB,cAGlB,IAAoB,gBAGpB,IAAyB,qBAGzB,IAAuB,yBAMvB,IAA0B,4BAM1B,IAAwB,0BAGxB,IAAwB,gBAGxB,IAA2B,mBAG3B,IAAkC,0BAMlC,IAA8B,sBAM9B,IAAiC,yBAMjC,IAAkC,0BAGlC,IAAyB,iBAGzB,IAAsB,cAGtB,IAAkB,UAGlB,IAAsB,cAGtB,IAA8B,sBAG9B,IAAwB,gBAGxB,IAAwB,gBAMxB,IAAqB,2BAMrB,IAAwB,SAMxB,IAAyB,SAOzB,IAAuB,QAMvB,IAAoB,oBAGpB,IAAsB,wBAGtB,IAAkB,UAMlB,IAAgB,SAOhB,IAAsB,gBAGtB,IAA0B,oBAG1B,IAAqB,eAMrB,IAAkB,oBAGlB,IAAiB,mBAGjB,KAAgB,QAwBhB,KAAoB,KAOpB,KAAqB,KAGrB,KAA0B,4BAM1B,KAAuB,kBAGvB,IAA0B,cAO1B,KAA2B,2BAM3B,KAA+B,+BAM/B,KAAoB,0BAMpB,KAAuB,sBAWvB,KAAuB,WAGvB,KAA6B,aAG7B,KAAyB,aAGzB,KAAqB,gBAGrB,KAAsB,UAGtB,KAAoB,QAUpB,KAAkB,0BAMlB,KAAsB,8BAUtB,KAAsB,4BAmBtB,KAA6B,KAG7B,KAAkC,gBAGlC,KAAsB,OAGtB,KAAuB,OAGvB,KAAyB,OAGzB,KAAyB,MAGzB,KAA+B,MAgB/B,KAAmB,KAYnB,KAAqB,eAoBrB,KAAmB,YAGnB,KAAY,UAGZ,KAAa,YAOb,KAA2B,UAO3B,KAAe,sBAGf,KAAqB,4BAUrB,KAAwB,KAexB,KAAuB,cAGvB,KAAqB,KAOrB,KAAyB,KAGzB,KAAoB,iBAGpB,KAAoB,iBAGpB,KAAsB,SAOtB,KAAuB,mBAkBvB,KAA0B;CAAC;CAAU;CAAgB;CAAW;AAAY,GAM5E,KAAkB;CAAC;CAAY;CAAO;AAAS,GAQ/C,KAAqD;CAChE,UAAU;CACV,aAAa;CACb,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,UAAU;CACV,aAAa;CACb,aAAa;CACb,SAAS;CACT,UAAU;EAAE,aAAa;EAAG,OAAO,CAAC;EAAG,mBAAmB,CAAC,QAAQ;CAAE;CACrE,KAAK;EAAE,MAAM;EAAQ,gBAAgB,CAAC;EAAG,aAAa;CAAO;CAC7D,SAAS;EACP,QAAQ;EACR,YAAY;EACZ,gBAAgB;EAChB,OAAO;EACP,KAAK;EACL,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY,CAAC;EACb,wBAAwB,CAAC;CAC3B;CACA,SAAS;AACX,GAGa,KAAkC,SAOlC,KAAwB,KAMxB,KAA2B,KAa3B,KAAqB,MAGrB,KAA8B,MAO9B,KAAkB,mBAGlB,KAAgC;CAC3C,YAAY;CACZ,UAAU;CACV,aAAa;AACf,GAOa,KAAsB,KAGtB,KAAqB,KAGrB,KAAsB,KAOtB,KAAqB,MAMrB,KAAoB,mBAOpB,KAAmB,4BAGnB,KAA2B,MAgB3B,KAAkB,KAOlB,KAAgB;CAC3B,cAAc;CACd,mBAAmB;CACnB,mBAAmB;CACnB,eAAe;CACf,UAAU;CACV,gBAAgB;CAChB,gBAAgB;AAClB"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResolvedConfig } from "./models/config";
|
|
2
2
|
import type { LogLevel, LogType } from "./models/log-record";
|
|
3
|
+
import type { StorageLimits } from "./models/storage";
|
|
3
4
|
/** Prefix on console messages this library writes. */
|
|
4
5
|
export declare const LIBRARY_LOG_PREFIX = "[ui-observability]";
|
|
5
6
|
/** Throttle window per diagnostic code, in milliseconds. Limits how often an error loop can spam the handler. */
|
|
@@ -137,7 +138,7 @@ export declare const TELEMETRY_SDK_NAME = "@utk09/ui-observability";
|
|
|
137
138
|
* Value of `telemetry.sdk.version`. A literal, not read from package.json. Bump by hand alongside package.json.
|
|
138
139
|
* @see {@link RESOURCE_TELEMETRY_SDK_VERSION}
|
|
139
140
|
*/
|
|
140
|
-
export declare const TELEMETRY_SDK_VERSION = "0.
|
|
141
|
+
export declare const TELEMETRY_SDK_VERSION = "0.2.0";
|
|
141
142
|
/**
|
|
142
143
|
* Value of `telemetry.sdk.language`.
|
|
143
144
|
* @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}
|
|
@@ -214,8 +215,17 @@ export declare const STORAGE_PROBE_KEY = "ui-observability.probe";
|
|
|
214
215
|
export declare const QUOTA_EVICTION_DIVISOR = 4;
|
|
215
216
|
/** DOMException name for a full store. */
|
|
216
217
|
export declare const QUOTA_EXCEEDED_ERROR = "QuotaExceededError";
|
|
217
|
-
/**
|
|
218
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Native IndexedDB version. It starts at 11 because Dexie, which this replaced,
|
|
220
|
+
* opened the same database at ten times its own declared version. Anything below
|
|
221
|
+
* 11 makes open() fail with VersionError for an existing installation and every
|
|
222
|
+
* batch already stored there is stranded.
|
|
223
|
+
*/
|
|
224
|
+
export declare const INDEXEDDB_SCHEMA_VERSION = 11;
|
|
225
|
+
/** IndexedDB object store holding batches. Named by Dexie before it was removed. */
|
|
226
|
+
export declare const INDEXEDDB_STORE_NAME = "batches";
|
|
227
|
+
/** Index on the batch store that orders reads by creation time. */
|
|
228
|
+
export declare const INDEXEDDB_CREATED_AT_INDEX = "createdAt";
|
|
219
229
|
/** IndexedDB adapter/strategy name. */
|
|
220
230
|
export declare const STORAGE_NAME_INDEXEDDB = "indexeddb";
|
|
221
231
|
/** localStorage adapter/strategy name. */
|
|
@@ -278,6 +288,11 @@ export declare const TRACE_MAX_AGE_MS: number;
|
|
|
278
288
|
export declare const TRACE_FLAGS_SAMPLED = 1;
|
|
279
289
|
/** Mask for the one-byte trace-flags field. */
|
|
280
290
|
export declare const TRACE_FLAGS_MASK = 255;
|
|
291
|
+
/**
|
|
292
|
+
* W3C trace context header name
|
|
293
|
+
* @see {@link TRACEPARENT_VERSION}
|
|
294
|
+
*/
|
|
295
|
+
export declare const TRACEPARENT_HEADER = "traceparent";
|
|
281
296
|
/** traceparent header version prefix. */
|
|
282
297
|
export declare const TRACEPARENT_VERSION = "00";
|
|
283
298
|
/** Smallest valid breadcrumb buffer capacity. */
|
|
@@ -290,8 +305,6 @@ export declare const FNV_PRIME = 16777619;
|
|
|
290
305
|
export declare const UINT32_MAX = 4294967295;
|
|
291
306
|
/** Record kind routed to the metric stream. */
|
|
292
307
|
export declare const LOG_TYPE_METRIC: LogType;
|
|
293
|
-
/** Batches held per stream buffer before the oldest is dropped. */
|
|
294
|
-
export declare const PENDING_BUFFER_BATCHES = 10;
|
|
295
308
|
/** Protocol identifier for bus envelopes. Mismatched versions are dropped. */
|
|
296
309
|
export declare const BUS_PROTOCOL = "ui-observability/1";
|
|
297
310
|
/** Global window property key used to locate a same-origin runtime instance. */
|
|
@@ -340,7 +353,7 @@ export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic"
|
|
|
340
353
|
* Nested config section keys.
|
|
341
354
|
* @see {@link ResolvedConfig}
|
|
342
355
|
*/
|
|
343
|
-
export declare const CONFIG_SECTIONS: readonly ["
|
|
356
|
+
export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "capture"];
|
|
344
357
|
/**
|
|
345
358
|
* Default runtime config, before a consumer's `configure()` call.
|
|
346
359
|
* Excludes `serializer`; `resolveConfig` supplies its default to avoid a circular import.
|
|
@@ -348,3 +361,57 @@ export declare const CONFIG_SECTIONS: readonly ["streams", "storage", "retry", "
|
|
|
348
361
|
* @see {@link UNDEFAULTED_CONFIG_KEYS}
|
|
349
362
|
*/
|
|
350
363
|
export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, "serializer">;
|
|
364
|
+
/** Console mirroring level used when a consumer passes `console: true`. */
|
|
365
|
+
export declare const CONSOLE_DEFAULT_LEVEL: LogLevel;
|
|
366
|
+
/** Max time a partial log batch waits before it is sent, in milliseconds. */
|
|
367
|
+
export declare const LOG_FLUSH_INTERVAL_MS = 2000;
|
|
368
|
+
/** Max records per log batch before it is sent early. */
|
|
369
|
+
export declare const LOG_BATCH_SIZE = 100;
|
|
370
|
+
/** Max time a partial metric batch waits before it is sent, in milliseconds. Metrics batch harder than logs: higher volume, nothing waits on them. */
|
|
371
|
+
export declare const METRIC_FLUSH_INTERVAL_MS = 10000;
|
|
372
|
+
/** Max records per metric batch before it is sent early. */
|
|
373
|
+
export declare const METRIC_BATCH_SIZE = 500;
|
|
374
|
+
/** Max concurrent ingest requests, across both streams. */
|
|
375
|
+
export declare const MAX_CONCURRENT_REQUESTS = 2;
|
|
376
|
+
/** Max time one ingest request may take before it is aborted and retried, in milliseconds. */
|
|
377
|
+
export declare const REQUEST_TIMEOUT_MS = 15000;
|
|
378
|
+
/** Min payload size to compress, in bytes. */
|
|
379
|
+
export declare const COMPRESSION_THRESHOLD_BYTES = 1024;
|
|
380
|
+
/** IndexedDB database name. */
|
|
381
|
+
export declare const STORAGE_DB_NAME = "UiObservability";
|
|
382
|
+
/** Capacity and retention thresholds every storage adapter enforces. */
|
|
383
|
+
export declare const STORAGE_LIMITS: StorageLimits;
|
|
384
|
+
/** First backoff step, in milliseconds. Each attempt doubles it. */
|
|
385
|
+
export declare const RETRY_BASE_DELAY_MS = 2000;
|
|
386
|
+
/** Backoff ceiling, in milliseconds. */
|
|
387
|
+
export declare const RETRY_MAX_DELAY_MS = 60000;
|
|
388
|
+
/** How often to check for stored work when nothing has failed recently, in milliseconds. */
|
|
389
|
+
export declare const RETRY_IDLE_DELAY_MS = 30000;
|
|
390
|
+
/** Max time a journey stays open before it is treated as abandoned, in milliseconds. */
|
|
391
|
+
export declare const JOURNEY_MAX_AGE_MS: number;
|
|
392
|
+
/** Whether closing the owning context ends the journey for everyone. */
|
|
393
|
+
export declare const JOURNEY_END_ON_OWNER_CLOSE = false;
|
|
394
|
+
/** Query parameter checked at boot for a seeded journey token. */
|
|
395
|
+
export declare const JOURNEY_URL_PARAM = "__uiobs_journey";
|
|
396
|
+
/** BroadcastChannel name for the control plane. */
|
|
397
|
+
export declare const BUS_CHANNEL_NAME = "ui_observability_control";
|
|
398
|
+
/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */
|
|
399
|
+
export declare const BUS_HANDSHAKE_TIMEOUT_MS = 1500;
|
|
400
|
+
/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */
|
|
401
|
+
export declare const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;
|
|
402
|
+
/** Max records a context buffers before its bus role is determined. */
|
|
403
|
+
export declare const BUS_MAX_BOOT_BUFFER_RECORDS = 500;
|
|
404
|
+
/** Breadcrumbs kept as context for the next error. */
|
|
405
|
+
export declare const MAX_BREADCRUMBS = 50;
|
|
406
|
+
/** Window within which identical errors are counted but not re-sent, in milliseconds. */
|
|
407
|
+
export declare const ERROR_DEDUPE_MS = 5000;
|
|
408
|
+
/** Size caps applied to every record, enforced after sanitize and after redact. */
|
|
409
|
+
export declare const RECORD_LIMITS: {
|
|
410
|
+
maxBodyChars: number;
|
|
411
|
+
maxAttributeChars: number;
|
|
412
|
+
maxAttributeCount: number;
|
|
413
|
+
maxStackChars: number;
|
|
414
|
+
maxDepth: number;
|
|
415
|
+
maxArrayLength: number;
|
|
416
|
+
maxRecordBytes: number;
|
|
417
|
+
};
|
|
@@ -23,16 +23,11 @@ export declare class BreadcrumbBuffer {
|
|
|
23
23
|
*/
|
|
24
24
|
private filled;
|
|
25
25
|
/** Maximum number of breadcrumbs retained in memory. */
|
|
26
|
-
private capacity;
|
|
26
|
+
private readonly capacity;
|
|
27
27
|
/**
|
|
28
28
|
* @param capacity Maximum breadcrumb capacity, clamped to minimum allowed size.
|
|
29
29
|
*/
|
|
30
30
|
constructor(capacity: number);
|
|
31
|
-
/**
|
|
32
|
-
* Resizes buffer capacity while preserving the newest breadcrumbs.
|
|
33
|
-
* @param capacity New maximum capacity.
|
|
34
|
-
*/
|
|
35
|
-
resize(capacity: number): void;
|
|
36
31
|
/**
|
|
37
32
|
* Appends a breadcrumb, overwriting the oldest entry when capacity is reached.
|
|
38
33
|
* @param crumb Breadcrumb event to append.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Closed set of diagnostic event codes emitted by library subsystems. */
|
|
2
|
-
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.
|
|
2
|
+
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.record_failed" | "openfin.unavailable" | "handler.threw";
|
|
3
3
|
/** Diagnostic event payload dispatched to consumer handlers. */
|
|
4
4
|
export interface DiagnosticEvent {
|
|
5
5
|
/** Diagnostic fault code. */
|