@utk09/ui-observability 0.5.0 → 0.6.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +77 -60
  3. package/dist/bus/bus.d.ts +10 -10
  4. package/dist/bus/links.d.ts +1 -1
  5. package/dist/{bus-D3OO0OcL.js → bus-BTMuVkDk.js} +19 -19
  6. package/dist/bus-BTMuVkDk.js.map +1 -0
  7. package/dist/bus-ChIXDAWD.cjs +2 -0
  8. package/dist/bus-ChIXDAWD.cjs.map +1 -0
  9. package/dist/capture/network.d.ts +2 -2
  10. package/dist/capture/types.d.ts +10 -10
  11. package/dist/capture/web-vitals.d.ts +3 -3
  12. package/dist/{constants-B6kdsCzF.js → constants-0-YchbAL.js} +2 -2
  13. package/dist/constants-0-YchbAL.js.map +1 -0
  14. package/dist/{constants-DZH04585.cjs → constants-TUFcy95w.cjs} +2 -2
  15. package/dist/constants-TUFcy95w.cjs.map +1 -0
  16. package/dist/constants.d.ts +53 -40
  17. package/dist/core/breadcrumbs.d.ts +14 -14
  18. package/dist/core/config.d.ts +5 -4
  19. package/dist/core/context.d.ts +2 -2
  20. package/dist/core/diagnostics.d.ts +10 -9
  21. package/dist/core/journey.d.ts +23 -20
  22. package/dist/core/logger.d.ts +7 -7
  23. package/dist/core/pipeline.d.ts +34 -29
  24. package/dist/core/record.d.ts +6 -6
  25. package/dist/core/runtime.d.ts +20 -18
  26. package/dist/core/sampling.d.ts +15 -16
  27. package/dist/core/sender.d.ts +1 -1
  28. package/dist/{errors-DPju_xSI.cjs → errors-DRXBRqvm.cjs} +2 -2
  29. package/dist/errors-DRXBRqvm.cjs.map +1 -0
  30. package/dist/{errors-Dme9tz-6.js → errors-Dwm2SzBa.js} +4 -4
  31. package/dist/errors-Dwm2SzBa.js.map +1 -0
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +6 -5
  35. package/dist/index.js +61 -61
  36. package/dist/index.js.map +1 -1
  37. package/dist/indexeddb-storage-B5dwq4hW.cjs +2 -0
  38. package/dist/indexeddb-storage-B5dwq4hW.cjs.map +1 -0
  39. package/dist/{indexeddb-storage-nxs_rxGx.js → indexeddb-storage-DjY4Ml6t.js} +16 -16
  40. package/dist/indexeddb-storage-DjY4Ml6t.js.map +1 -0
  41. package/dist/{interactions-DP0-rIPJ.cjs → interactions-DVom6eYn.cjs} +2 -2
  42. package/dist/interactions-DVom6eYn.cjs.map +1 -0
  43. package/dist/{interactions-C1romMpE.js → interactions-DZmLu7l2.js} +2 -2
  44. package/dist/interactions-DZmLu7l2.js.map +1 -0
  45. package/dist/models/batch.d.ts +12 -9
  46. package/dist/models/bus.d.ts +12 -13
  47. package/dist/models/config.d.ts +58 -41
  48. package/dist/models/log-record.d.ts +12 -10
  49. package/dist/models/serializer.d.ts +3 -2
  50. package/dist/models/storage.d.ts +2 -2
  51. package/dist/{network-au-Tqt1n.js → network-C4d2uw2Z.js} +4 -4
  52. package/dist/network-C4d2uw2Z.js.map +1 -0
  53. package/dist/network-CuqWadNn.cjs +2 -0
  54. package/dist/network-CuqWadNn.cjs.map +1 -0
  55. package/dist/platform-CXio0W2n.cjs +2 -0
  56. package/dist/platform-CXio0W2n.cjs.map +1 -0
  57. package/dist/{platform-DMYo3AX3.js → platform-CY8S3hUs.js} +8 -8
  58. package/dist/platform-CY8S3hUs.js.map +1 -0
  59. package/dist/sampling-CEthcmEX.cjs +2 -0
  60. package/dist/sampling-CEthcmEX.cjs.map +1 -0
  61. package/dist/{sampling-ByI5H44E.js → sampling-CJsI_24L.js} +21 -18
  62. package/dist/sampling-CJsI_24L.js.map +1 -0
  63. package/dist/sender-ByFAkXVd.cjs +3 -0
  64. package/dist/sender-ByFAkXVd.cjs.map +1 -0
  65. package/dist/{sender-R7lOpyNc.js → sender-dpvR_bHM.js} +60 -60
  66. package/dist/sender-dpvR_bHM.js.map +1 -0
  67. package/dist/storage/emergency-queue.d.ts +2 -2
  68. package/dist/storage/factory.d.ts +2 -1
  69. package/dist/storage/idb-driver.d.ts +19 -19
  70. package/dist/storage/indexeddb-storage.d.ts +18 -17
  71. package/dist/storage/keys.d.ts +1 -1
  72. package/dist/storage/local-storage.d.ts +19 -18
  73. package/dist/storage/memory-storage.d.ts +12 -11
  74. package/dist/transport/compression.d.ts +2 -2
  75. package/dist/transport/errors.d.ts +8 -7
  76. package/dist/transport/exit-flush.d.ts +27 -24
  77. package/dist/transport/http-transport.d.ts +18 -11
  78. package/dist/transport/retry-engine.d.ts +33 -28
  79. package/dist/transport/serializers/ecs.d.ts +1 -1
  80. package/dist/transport/serializers/otlp.d.ts +1 -1
  81. package/dist/unref-16maCyKA.js.map +1 -1
  82. package/dist/unref-CU9Nyz_9.cjs.map +1 -1
  83. package/dist/utils/identity.d.ts +6 -5
  84. package/dist/utils/lock.d.ts +4 -4
  85. package/dist/utils/platform.d.ts +5 -3
  86. package/dist/utils/sanitize.d.ts +5 -2
  87. package/dist/utils/sequence.d.ts +2 -2
  88. package/dist/utils/tracing.d.ts +8 -7
  89. package/dist/web-vitals-B2FYsEAU.cjs +2 -0
  90. package/dist/web-vitals-B2FYsEAU.cjs.map +1 -0
  91. package/dist/{web-vitals-DwWdLBq6.js → web-vitals-DHZ0yA_H.js} +4 -4
  92. package/dist/web-vitals-DHZ0yA_H.js.map +1 -0
  93. package/package.json +1 -1
  94. package/dist/bus-D3OO0OcL.js.map +0 -1
  95. package/dist/bus-OdRJVUzr.cjs +0 -2
  96. package/dist/bus-OdRJVUzr.cjs.map +0 -1
  97. package/dist/constants-B6kdsCzF.js.map +0 -1
  98. package/dist/constants-DZH04585.cjs.map +0 -1
  99. package/dist/errors-DPju_xSI.cjs.map +0 -1
  100. package/dist/errors-Dme9tz-6.js.map +0 -1
  101. package/dist/indexeddb-storage-lGdoHGHy.cjs +0 -2
  102. package/dist/indexeddb-storage-lGdoHGHy.cjs.map +0 -1
  103. package/dist/indexeddb-storage-nxs_rxGx.js.map +0 -1
  104. package/dist/interactions-C1romMpE.js.map +0 -1
  105. package/dist/interactions-DP0-rIPJ.cjs.map +0 -1
  106. package/dist/network-DDVIJSHd.cjs +0 -2
  107. package/dist/network-DDVIJSHd.cjs.map +0 -1
  108. package/dist/network-au-Tqt1n.js.map +0 -1
  109. package/dist/platform-DMYo3AX3.js.map +0 -1
  110. package/dist/platform-g99Kn755.cjs +0 -2
  111. package/dist/platform-g99Kn755.cjs.map +0 -1
  112. package/dist/sampling-ByI5H44E.js.map +0 -1
  113. package/dist/sampling-Dui-Fp3u.cjs +0 -2
  114. package/dist/sampling-Dui-Fp3u.cjs.map +0 -1
  115. package/dist/sender-R7lOpyNc.js.map +0 -1
  116. package/dist/sender-vLcbQhiB.cjs +0 -3
  117. package/dist/sender-vLcbQhiB.cjs.map +0 -1
  118. package/dist/web-vitals-DM2nvcMJ.cjs +0 -2
  119. package/dist/web-vitals-DM2nvcMJ.cjs.map +0 -1
  120. package/dist/web-vitals-DwWdLBq6.js.map +0 -1
@@ -3,7 +3,10 @@ import type { LogLevel, LogType } from "./models/log-record";
3
3
  import type { StorageLimits } from "./models/storage";
4
4
  /** Prefix on console messages this library writes. */
5
5
  export declare const LIBRARY_LOG_PREFIX = "[ui-observability]";
6
- /** Throttle window per diagnostic code, in milliseconds. Limits how often an error loop can spam the handler. */
6
+ /**
7
+ * Throttle window for each diagnostic code, in milliseconds. It limits how often an error
8
+ * loop calls the handler.
9
+ */
7
10
  export declare const DIAGNOSTIC_THROTTLE_MS = 1000;
8
11
  /** `localStorage` key for the session id and its last-seen time. */
9
12
  export declare const SESSION_ID_KEY = "ui-observability.session";
@@ -54,7 +57,7 @@ export declare const BYTES_PER_QUOTED_STRING = 2;
54
57
  /** Byte cost of one key's punctuation: quotes, colon, comma. */
55
58
  export declare const BYTES_PER_KEY_OVERHEAD = 4;
56
59
  /**
57
- * Log level to OpenTelemetry severity number.
60
+ * Maps each log level to its OpenTelemetry severity number.
58
61
  * @see {@link LEVEL_ORDER}
59
62
  */
60
63
  export declare const SEVERITY_NUMBER: Record<LogLevel, number>;
@@ -65,14 +68,15 @@ export declare const SEVERITY_NUMBER: Record<LogLevel, number>;
65
68
  export declare const LEVEL_ORDER: Record<LogLevel, number>;
66
69
  /** Record kind attribute key. */
67
70
  export declare const ATTR_LOG_TYPE = "log.type";
68
- /** Record sequence number within its context, from zero. */
71
+ /** Record sequence number in its context. It starts at 1. */
69
72
  export declare const ATTR_LOG_SEQ = "log.seq";
70
73
  /** Logger namespace attribute key. */
71
74
  export declare const ATTR_APP_NAMESPACE = "app.namespace";
72
75
  /** Document URL when the record was built. */
73
76
  export declare const ATTR_PAGE_URL = "page.url";
74
77
  /**
75
- * HTTP request URL attribute key, set by network capture. Don't reuse `ATTR_PAGE_URL`; it would overwrite the request's target.
78
+ * HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.
79
+ * The page URL overwrites the request target under that key.
76
80
  * @see {@link ATTR_PAGE_URL}
77
81
  */
78
82
  export declare const ATTR_URL_FULL = "url.full";
@@ -85,7 +89,7 @@ export declare const ATTR_JOURNEY_PARENT_ID = "journey.parent_id";
85
89
  /** Marks a record whose attributes failed to sanitize. */
86
90
  export declare const ATTR_SANITIZE_FAILED = "uiobs.sanitize_failed";
87
91
  /**
88
- * Marks a record whose attributes were dropped for exceeding the byte budget.
92
+ * Marks a record when the library drops its attributes because they exceed the byte budget.
89
93
  * @see {@link ATTR_ATTRIBUTES_BYTES}
90
94
  */
91
95
  export declare const ATTR_ATTRIBUTES_DROPPED = "uiobs.attributes_dropped";
@@ -135,10 +139,11 @@ export declare const RESOURCE_OPENFIN_NAME = "openfin.name";
135
139
  */
136
140
  export declare const TELEMETRY_SDK_NAME = "@utk09/ui-observability";
137
141
  /**
138
- * Value of `telemetry.sdk.version`. A literal, not read from package.json. Bump by hand alongside package.json.
142
+ * Value of `telemetry.sdk.version`. The code does not read it from package.json.
143
+ * Change it by hand when you change the version in package.json.
139
144
  * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}
140
145
  */
141
- export declare const TELEMETRY_SDK_VERSION = "0.5.0";
146
+ export declare const TELEMETRY_SDK_VERSION = "0.6.0";
142
147
  /**
143
148
  * Value of `telemetry.sdk.language`.
144
149
  * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}
@@ -149,8 +154,8 @@ export declare const SERIALIZER_NAME_OTLP = "otlp";
149
154
  /** ECS serializer name. */
150
155
  export declare const SERIALIZER_NAME_ECS = "ecs";
151
156
  /**
152
- * ECS `log.level` names that differ from the lowercased severity text. ECS spells
153
- * the warning level in full; every other level matches once lowercased.
157
+ * ECS `log.level` names that differ from the lowercase severity text. ECS spells
158
+ * the warning level in full. All other levels match in lowercase.
154
159
  * @see {@link SERIALIZER_NAME_ECS}
155
160
  */
156
161
  export declare const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>>;
@@ -184,9 +189,9 @@ export declare const ENCODING_GZIP = "gzip";
184
189
  export declare const HTTP_UNAUTHORIZED = 401;
185
190
  /** 403, valid credentials but access denied. */
186
191
  export declare const HTTP_FORBIDDEN = 403;
187
- /** 408, the server closed the connection after a timeout. Retryable. */
192
+ /** 408, the server closed the connection after a timeout. The transport can retry. */
188
193
  export declare const HTTP_REQUEST_TIMEOUT = 408;
189
- /** 413, payload too large; batch must be split. */
194
+ /** 413, payload too large. The transport must split the batch. */
190
195
  export declare const HTTP_PAYLOAD_TOO_LARGE = 413;
191
196
  /** 429, backpressure. */
192
197
  export declare const HTTP_TOO_MANY_REQUESTS = 429;
@@ -198,7 +203,7 @@ export declare const HTTP_SERVICE_UNAVAILABLE = 503;
198
203
  export declare const MILLIS_PER_SECOND = 1000;
199
204
  /** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */
200
205
  export declare const BEACON_LIMIT_BYTES = 60000;
201
- /** Content type for an exit payload. CORS-safelisted, avoids a preflight. */
206
+ /** Content type for an exit payload. It is CORS-safelisted and does not cause a preflight. */
202
207
  export declare const CONTENT_TYPE_TEXT_PLAIN = "text/plain;charset=UTF-8";
203
208
  /**
204
209
  * Batch id query param name, for the exit path.
@@ -207,28 +212,28 @@ export declare const CONTENT_TYPE_TEXT_PLAIN = "text/plain;charset=UTF-8";
207
212
  export declare const QUERY_PARAM_BATCH_ID = "uiobs_batch_id";
208
213
  /** Exit reason query param name, for logs only. */
209
214
  export declare const QUERY_PARAM_EXIT_REASON = "uiobs_exit";
210
- /** localStorage key prefix for a parked batch. */
215
+ /** localStorage key prefix for a stored batch. */
211
216
  export declare const BATCH_STORAGE_KEY_PREFIX = "ui-observability.batch.";
212
217
  /** Zero-padded digit width for the creation time in a batch key. */
213
218
  export declare const BATCH_KEY_TIME_WIDTH = 14;
214
- /** localStorage key prefix for a batch parked by exit flush. */
219
+ /** localStorage key prefix for a batch that exit flush stores. */
215
220
  export declare const EMERGENCY_STORAGE_KEY_PREFIX = "ui-observability.emergency.";
216
221
  /** Max exit batches held at once. */
217
222
  export declare const EMERGENCY_MAX_ENTRIES = 20;
218
223
  /** Key used to test whether localStorage accepts writes. */
219
224
  export declare const STORAGE_PROBE_KEY = "ui-observability.probe";
220
- /** Fraction of the store evicted on a quota error (1 in N). */
225
+ /** Fraction of the store to evict on a quota error (1 in N). */
221
226
  export declare const QUOTA_EVICTION_DIVISOR = 4;
222
227
  /** DOMException name for a full store. */
223
228
  export declare const QUOTA_EXCEEDED_ERROR = "QuotaExceededError";
224
229
  /**
225
- * Native IndexedDB version. It starts at 11 because Dexie, which this replaced,
226
- * opened the same database at ten times its own declared version. Anything below
227
- * 11 makes open() fail with VersionError for an existing installation and every
228
- * batch already stored there is stranded.
230
+ * Native IndexedDB version. It starts at 11. Dexie, the previous adapter, opened the
231
+ * same database at ten times its declared version. A version below 11 makes open()
232
+ * fail with VersionError for an existing installation. Then no code can read the
233
+ * batches in that database.
229
234
  */
230
235
  export declare const INDEXEDDB_SCHEMA_VERSION = 11;
231
- /** IndexedDB object store holding batches. Named by Dexie before it was removed. */
236
+ /** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */
232
237
  export declare const INDEXEDDB_STORE_NAME = "batches";
233
238
  /** Index on the batch store that orders reads by creation time. */
234
239
  export declare const INDEXEDDB_CREATED_AT_INDEX = "createdAt";
@@ -260,13 +265,14 @@ export declare const JOURNEY_STORAGE_KEY = "ui-observability.journey";
260
265
  */
261
266
  export declare const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;
262
267
  /**
263
- * Max whole-token length, in characters. A tripwire, not validation.
268
+ * Max whole-token length, in characters. It rejects an oversized token. It does not
269
+ * validate the token content.
264
270
  * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}
265
271
  */
266
272
  export declare const JOURNEY_TOKEN_MAX_CHARS = 256;
267
273
  /**
268
- * How long to wait for `fin.me.getOptions()` before giving up on a seeded journey,
269
- * in milliseconds.
274
+ * Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the
275
+ * runtime continues without a seeded journey.
270
276
  * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}
271
277
  */
272
278
  export declare const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;
@@ -311,7 +317,7 @@ export declare const FNV_PRIME = 16777619;
311
317
  export declare const UINT32_MAX = 4294967295;
312
318
  /** Record kind routed to the metric stream. */
313
319
  export declare const LOG_TYPE_METRIC: LogType;
314
- /** Protocol identifier for bus envelopes. Mismatched versions are dropped. */
320
+ /** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */
315
321
  export declare const BUS_PROTOCOL = "ui-observability/1";
316
322
  /** Global window property key used to locate a same-origin runtime instance. */
317
323
  export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
@@ -322,9 +328,9 @@ export declare const ERROR_STORM_MAX_PER_WINDOW = 20;
322
328
  /** Error rate-limiting window duration in milliseconds. */
323
329
  export declare const ERROR_STORM_WINDOW_MS = 10000;
324
330
  /**
325
- * Max ERROR and FATAL records admitted to the pipeline per storm window.
326
- * A backstop against a render loop, not a shaper: ERROR and FATAL bypass sampling,
327
- * and a direct logger.error call has no other limit.
331
+ * Max ERROR and FATAL records that the pipeline admits in each storm window.
332
+ * It is a safety limit for a render loop. It does not shape normal traffic.
333
+ * ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.
328
334
  */
329
335
  export declare const ERROR_CEILING_MAX_PER_WINDOW = 500;
330
336
  /** Maximum distinct error signatures tracked for deduplication before LRU eviction. */
@@ -374,25 +380,29 @@ export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "capture"];
374
380
  */
375
381
  export declare const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]>;
376
382
  /**
377
- * Default runtime config, before a consumer's `configure()` call.
378
- * Excludes `serializer`; `resolveConfig` supplies its default to avoid a circular import.
383
+ * Default runtime config before the consumer calls `configure()`. It excludes `serializer`.
384
+ * `resolveConfig` supplies that default to prevent a circular import.
379
385
  * @see {@link ResolvedConfig}
380
386
  * @see {@link UNDEFAULTED_CONFIG_KEYS}
381
387
  */
382
388
  export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, "serializer">;
383
389
  /** Console mirroring level used when a consumer passes `console: true`. */
384
390
  export declare const CONSOLE_DEFAULT_LEVEL: LogLevel;
385
- /** Max time a partial log batch waits before it is sent, in milliseconds. */
391
+ /** Max time a partial log batch waits before the pipeline sends it, in milliseconds. */
386
392
  export declare const LOG_FLUSH_INTERVAL_MS = 2000;
387
- /** Max records per log batch before it is sent early. */
393
+ /** Max records per log batch. At this count, the pipeline sends the batch early. */
388
394
  export declare const LOG_BATCH_SIZE = 100;
389
- /** Max time a partial metric batch waits before it is sent, in milliseconds. Metrics batch harder than logs: higher volume, nothing waits on them. */
395
+ /**
396
+ * Max time a partial metric batch waits before the pipeline sends it, in milliseconds.
397
+ * Metric batches wait longer than log batches. Metrics have a higher volume, and no
398
+ * caller waits for them.
399
+ */
390
400
  export declare const METRIC_FLUSH_INTERVAL_MS = 10000;
391
- /** Max records per metric batch before it is sent early. */
401
+ /** Max records per metric batch. At this count, the pipeline sends the batch early. */
392
402
  export declare const METRIC_BATCH_SIZE = 500;
393
403
  /** Max concurrent ingest requests, across both streams. */
394
404
  export declare const MAX_CONCURRENT_REQUESTS = 2;
395
- /** Max time one ingest request may take before it is aborted and retried, in milliseconds. */
405
+ /** Max time for one ingest request, in milliseconds. Then the transport aborts and retries it. */
396
406
  export declare const REQUEST_TIMEOUT_MS = 15000;
397
407
  /** Min payload size to compress, in bytes. */
398
408
  export declare const COMPRESSION_THRESHOLD_BYTES = 1024;
@@ -401,8 +411,8 @@ export declare const STORAGE_DB_NAME = "UiObservability";
401
411
  /** Capacity and retention thresholds every storage adapter enforces. */
402
412
  export declare const STORAGE_LIMITS: StorageLimits;
403
413
  /**
404
- * Max time one storage call may take before it is treated as failed, in milliseconds.
405
- * A call that does not settle holds a dispatch slot or the drain flag.
414
+ * Max time for one storage call, in milliseconds. Then the library treats the call as failed.
415
+ * A call that does not settle keeps a dispatch slot or the drain flag.
406
416
  */
407
417
  export declare const STORAGE_DEADLINE_MS = 10000;
408
418
  /** First backoff step, in milliseconds. Each attempt doubles it. */
@@ -411,7 +421,7 @@ export declare const RETRY_BASE_DELAY_MS = 2000;
411
421
  export declare const RETRY_MAX_DELAY_MS = 60000;
412
422
  /** How often to check for stored work when nothing has failed recently, in milliseconds. */
413
423
  export declare const RETRY_IDLE_DELAY_MS = 30000;
414
- /** Max time a journey stays open before it is treated as abandoned, in milliseconds. */
424
+ /** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */
415
425
  export declare const JOURNEY_MAX_AGE_MS: number;
416
426
  /** Whether closing the owning context ends the journey for everyone. */
417
427
  export declare const JOURNEY_END_ON_OWNER_CLOSE = false;
@@ -423,13 +433,16 @@ export declare const BUS_CHANNEL_NAME = "ui_observability_control";
423
433
  export declare const BUS_HANDSHAKE_TIMEOUT_MS = 1500;
424
434
  /** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */
425
435
  export declare const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;
426
- /** Max records a context buffers before its bus role is determined. */
436
+ /** Max records a context buffers before it knows its bus role. */
427
437
  export declare const BUS_MAX_BOOT_BUFFER_RECORDS = 500;
428
438
  /** Breadcrumbs kept as context for the next error. */
429
439
  export declare const MAX_BREADCRUMBS = 50;
430
- /** Window within which identical errors are counted but not re-sent, in milliseconds. */
440
+ /**
441
+ * Time window in which the library counts identical errors but does not send them again,
442
+ * in milliseconds.
443
+ */
431
444
  export declare const ERROR_DEDUPE_MS = 5000;
432
- /** Size caps applied to every record, enforced after sanitize and after redact. */
445
+ /** Size caps for every record. The library applies them after sanitize and after redact. */
433
446
  export declare const RECORD_LIMITS: {
434
447
  maxBodyChars: number;
435
448
  maxAttributeChars: number;
@@ -1,43 +1,43 @@
1
- /** Category classification for breadcrumb events. */
1
+ /** Category of a breadcrumb event. */
2
2
  export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console";
3
- /** Lightweight event summary recorded prior to errors. */
3
+ /** Short summary of one event that the buffer keeps for an error record. */
4
4
  export interface Breadcrumb {
5
5
  /** Timestamp in epoch milliseconds. */
6
6
  t: number;
7
- /** Event category classification. */
7
+ /** Category of the event. */
8
8
  category: BreadcrumbCategory;
9
- /** Human-readable event description. */
9
+ /** Description of the event for a person to read. */
10
10
  message: string;
11
11
  /** Optional contextual metadata. */
12
12
  data?: Record<string, unknown>;
13
13
  }
14
- /** Bounded circular ring buffer storing recent breadcrumb events in chronological order. */
14
+ /** Ring buffer of fixed size. It keeps recent breadcrumbs in time order. */
15
15
  export declare class BreadcrumbBuffer {
16
- /** Internal storage array for the ring buffer. */
16
+ /** Storage array of the ring buffer. */
17
17
  private buffer;
18
18
  /** Next write index in the circular buffer. */
19
19
  private pointer;
20
20
  /**
21
- * Indicates whether the buffer has wrapped around its capacity. The pointer alone
22
- * cannot separate an unwritten ring from one wrapped exactly to the start.
21
+ * It is true after the pointer wraps past the capacity. The pointer alone cannot
22
+ * tell an empty ring from a ring that wrapped back to index 0.
23
23
  */
24
24
  private filled;
25
- /** Maximum number of breadcrumbs retained in memory. */
25
+ /** Maximum number of breadcrumbs that the buffer keeps. */
26
26
  private readonly capacity;
27
27
  /**
28
- * @param capacity Maximum breadcrumb capacity, clamped to minimum allowed size.
28
+ * @param capacity Maximum number of breadcrumbs. A smaller value changes to the minimum size.
29
29
  */
30
30
  constructor(capacity: number);
31
31
  /**
32
- * Appends a breadcrumb, overwriting the oldest entry when capacity is reached.
33
- * @param crumb Breadcrumb event to append.
32
+ * Adds a breadcrumb. When the buffer is full, the new breadcrumb replaces the oldest one.
33
+ * @param crumb Breadcrumb to add.
34
34
  */
35
35
  push(crumb: Breadcrumb): void;
36
36
  /**
37
37
  * Returns all stored breadcrumbs ordered from oldest to newest.
38
- * @returns Chronological list of breadcrumbs.
38
+ * @returns List of breadcrumbs in time order.
39
39
  */
40
40
  snapshot(): Breadcrumb[];
41
- /** Clears all stored breadcrumbs and resets buffer state. */
41
+ /** Removes all breadcrumbs and resets the buffer. */
42
42
  clear(): void;
43
43
  }
@@ -5,12 +5,13 @@ import type { Diagnostics } from "./diagnostics";
5
5
  * @param input Partial consumer configuration options.
6
6
  * @param diagnostics Diagnostics reporter.
7
7
  * @param previous Active configuration instance for incremental reconfigurations.
8
- * @returns Fully populated and validated configuration object.
8
+ * @returns Complete, validated configuration object.
9
9
  */
10
10
  export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig): ResolvedConfig;
11
11
  /**
12
- * Mutates an existing configuration object in place to propagate updates to referenced sections.
13
- * @param target Active configuration object to mutate.
14
- * @param next Source configuration object containing updated values.
12
+ * Changes the active configuration object in place. Subsystems that hold a section
13
+ * reference see the update.
14
+ * @param target Active configuration object to change.
15
+ * @param next Configuration object with the new values.
15
16
  */
16
17
  export declare function applyResolvedConfig(target: ResolvedConfig, next: ResolvedConfig): void;
@@ -27,8 +27,8 @@ export declare class ContextStore {
27
27
  /** Clears all attributes from the ambient context store. */
28
28
  clear(): void;
29
29
  /**
30
- * Returns a snapshot copy of all ambient context attributes. A copy: a merge
31
- * target or sanitizer must not mutate the store.
30
+ * Returns a copy of all ambient context attributes. The copy prevents a merge
31
+ * target or a sanitizer from changing the store.
32
32
  * @returns Plain object containing stored key-value pairs.
33
33
  */
34
34
  getAll(): Record<string, unknown>;
@@ -1,10 +1,10 @@
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_ceiling" | "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";
2
+ export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "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" | "platform.api_blocked" | "handler.threw";
3
3
  /** Diagnostic event payload dispatched to consumer handlers. */
4
4
  export interface DiagnosticEvent {
5
5
  /** Diagnostic fault code. */
6
6
  code: DiagnosticCode;
7
- /** Human-readable description. */
7
+ /** Description for a person to read. */
8
8
  message: string;
9
9
  /** Structured context metadata. */
10
10
  detail?: Record<string, unknown>;
@@ -12,12 +12,12 @@ export interface DiagnosticEvent {
12
12
  cause?: unknown;
13
13
  /** Event timestamp in epoch milliseconds. */
14
14
  at: number;
15
- /** Cumulative count of this code since startup, including rate-limited occurrences. */
15
+ /** Total count of this code since startup. It includes rate-limited occurrences. */
16
16
  count: number;
17
17
  }
18
18
  /** Consumer callback for receiving rate-limited diagnostic events. */
19
19
  export type DiagnosticHandler = (event: DiagnosticEvent) => void;
20
- /** Internal error reporting channel with rate-limited dispatch and unthrottled counters. */
20
+ /** Reports internal errors. It limits the dispatch rate but counts every event. */
21
21
  export declare class Diagnostics {
22
22
  private handler?;
23
23
  private readonly throttleMs;
@@ -36,14 +36,15 @@ export declare class Diagnostics {
36
36
  */
37
37
  setHandler(handler?: DiagnosticHandler): void;
38
38
  /**
39
- * Increments the occurrence count for a code without triggering handler emission.
39
+ * Increments the count for a code. It does not call the handler.
40
40
  * @param code Diagnostic code to increment.
41
41
  * @param by Increment delta.
42
- * @returns Updated cumulative total for the code.
42
+ * @returns New total for the code.
43
43
  */
44
44
  count(code: DiagnosticCode, by?: number): number;
45
45
  /**
46
- * Increments counter and dispatches event if outside the throttling window. Never throws.
46
+ * Increments the counter for the code. It sends the event to the handler when the
47
+ * throttle window has passed. It never throws.
47
48
  * @param code Diagnostic code.
48
49
  * @param message Event description.
49
50
  * @param detail Optional structured metadata.
@@ -53,7 +54,7 @@ export declare class Diagnostics {
53
54
  /**
54
55
  * Executes a synchronous function and reports any thrown error to diagnostics.
55
56
  * @param code Diagnostic code to report on throw.
56
- * @param message Error description.
57
+ * @param message ASD-STE100 sentence that states the failure. The handler gets it as the event message.
57
58
  * @param fn Function to execute.
58
59
  * @returns Function return value, or undefined on throw.
59
60
  */
@@ -61,7 +62,7 @@ export declare class Diagnostics {
61
62
  /**
62
63
  * Executes an asynchronous function and reports any rejected promise to diagnostics.
63
64
  * @param code Diagnostic code to report on rejection.
64
- * @param message Error description.
65
+ * @param message ASD-STE100 sentence that states the failure. The handler gets it as the event message.
65
66
  * @param fn Async function to execute.
66
67
  * @returns Promise resolving to the return value, or undefined on rejection.
67
68
  */
@@ -1,8 +1,8 @@
1
1
  import { type IdentityStores } from "../utils/identity";
2
2
  import type { Diagnostics } from "./diagnostics";
3
- /** Lifetime rules for a journey (one user task spanning several contexts). */
3
+ /** Lifetime rules for a journey. A journey is one user task across several contexts. */
4
4
  export interface JourneyOptions {
5
- /** Max time a journey stays open before it is treated as abandoned, in milliseconds. */
5
+ /** Maximum open time of a journey, in milliseconds. After this time, the engine ends it. */
6
6
  maxAgeMs: number;
7
7
  /** Whether closing the owning context ends the journey for everyone. */
8
8
  endOnOwnerClose: boolean;
@@ -15,13 +15,13 @@ export declare const JOURNEY_OPTIONS: JourneyOptions;
15
15
  export interface Journey {
16
16
  /** Unique journey correlation identifier. */
17
17
  id: string;
18
- /** Human-readable journey workflow name. */
18
+ /** Journey workflow name for a person to read. */
19
19
  name: string;
20
20
  /** Journey start timestamp in epoch milliseconds. */
21
21
  startedAt: number;
22
- /** Optional parent journey identifier when branched from an earlier workflow. */
22
+ /** Optional parent journey ID when the journey branches from an earlier journey. */
23
23
  parentId?: string;
24
- /** Context identifier of the document that initiated the journey. */
24
+ /** Context identifier of the document that started the journey. */
25
25
  ownerContextId: string;
26
26
  }
27
27
  /** Manages journey lifecycle, cross-window adoption, storage synchronization, and expiration. */
@@ -46,12 +46,13 @@ export declare class JourneyEngine {
46
46
  /** Returns the active journey instance or null. */
47
47
  current(): Journey | null;
48
48
  /**
49
- * Discovers and adopts initial journey from URL query parameters, sessionStorage, or OpenFin customData.
49
+ * Finds and adopts the initial journey. It checks the URL query, then sessionStorage,
50
+ * then OpenFin customData.
50
51
  * @returns Promise resolving when journey initialization completes.
51
52
  */
52
53
  bootstrap(): Promise<void>;
53
54
  /**
54
- * Initiates a new journey, replacing any active journey and notifying connected peers.
55
+ * Starts a new journey. It replaces the active journey and tells connected peers.
55
56
  * @param name Human-readable workflow name.
56
57
  * @param opts Optional parent linkage and pre-assigned identifier.
57
58
  * @returns Started Journey instance.
@@ -60,18 +61,20 @@ export declare class JourneyEngine {
60
61
  parent?: boolean;
61
62
  id?: string;
62
63
  }): Journey;
63
- /** Terminates the active journey and broadcasts the change. */
64
+ /** Ends the active journey and broadcasts the change. */
64
65
  end(): void;
65
66
  /**
66
- * Applies journey updates received from external bus peers without echoing
67
- * broadcasts. Echoing makes two windows ping the change back and forth. A journey
68
- * matching the one in force is ignored, so an echo cannot restart the timer.
67
+ * Applies a journey update from a bus peer. It does not broadcast the update again.
68
+ * An echo makes two windows send the change back and forth without end.
69
+ * It ignores a journey with the same ID as the active journey. Thus an echo cannot
70
+ * restart the timer.
69
71
  * @param journey Updated Journey instance or null.
70
72
  */
71
73
  applyRemote(journey: Journey | null): void;
72
74
  /**
73
75
  * Serializes the active journey into a compact token for URL or intent transfer.
74
- * @returns Base64url token string or undefined if no journey is active or size cap is exceeded.
76
+ * @returns Base64url token, or undefined when no journey is active or the token exceeds
77
+ * the size limit.
75
78
  */
76
79
  getToken(): string | undefined;
77
80
  /**
@@ -83,7 +86,7 @@ export declare class JourneyEngine {
83
86
  */
84
87
  adopt(token: string, source: string, broadcast?: boolean): boolean;
85
88
  /**
86
- * Ends the journey if the terminated context matches the journey owner and endOnOwnerClose is enabled.
89
+ * Ends the journey when endOnOwnerClose is on and the closed context owns the journey.
87
90
  * @param ownerContextId Context identifier of the closed window.
88
91
  */
89
92
  ownerClosed(ownerContextId: string): void;
@@ -92,13 +95,13 @@ export declare class JourneyEngine {
92
95
  /**
93
96
  * Resumes a persisted journey from raw sessionStorage data.
94
97
  * @param raw Serialized JSON string from storage.
95
- * @returns True if journey was successfully restored.
98
+ * @returns True if the engine restored the journey.
96
99
  */
97
100
  private restore;
98
101
  /**
99
- * Decodes a base64url token into a validated Journey object. Tokens come from URLs
100
- * anyone can edit. Every step throws on non-token input, so the failure is
101
- * reported, not raised.
102
+ * Decodes a base64url token into a validated Journey object. Anyone can edit the URL
103
+ * that holds a token. Each step throws on bad input. The guard reports the failure
104
+ * and does not throw it.
102
105
  * @param token Encoded token string.
103
106
  * @returns Decoded Journey instance or null on decode error.
104
107
  */
@@ -118,9 +121,9 @@ export declare class JourneyEngine {
118
121
  */
119
122
  private readUrlToken;
120
123
  /**
121
- * Reads the journey token from OpenFin window creation customData. Bounded by
122
- * OPENFIN_OPTIONS_TIMEOUT_MS: a deadline reached here reports openfin.unavailable
123
- * and yields no token, which is the same outcome as a window created without one.
124
+ * Reads the journey token from the customData of the OpenFin window options.
125
+ * OPENFIN_OPTIONS_TIMEOUT_MS limits the wait. At the deadline, it reports
126
+ * openfin.unavailable and returns no token. A window without a token gives the same result.
124
127
  * @returns Promise resolving to token string or null.
125
128
  */
126
129
  private readOpenFinToken;
@@ -49,23 +49,23 @@ export declare class OneLogger {
49
49
  */
50
50
  warn: (message: string, payload?: Record<string, unknown>) => void;
51
51
  /**
52
- * Logs an error record with attached breadcrumb history. A plain object in the
53
- * error slot with no payload given is read as the payload.
52
+ * Logs an error record with the breadcrumb history. If payload is absent, a plain
53
+ * object in the error slot becomes the payload.
54
54
  * @param message Error description.
55
55
  * @param error Caught error instance, reason, or payload.
56
56
  * @param payload Optional contextual attributes.
57
57
  */
58
58
  error: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
59
59
  /**
60
- * Logs a fatal unrecoverable error record. A plain object in the error slot
61
- * with no payload given is read as the payload.
60
+ * Logs a fatal error record. If payload is absent, a plain object in the error slot
61
+ * becomes the payload.
62
62
  * @param message Error description.
63
63
  * @param error Caught error instance, reason, or payload.
64
64
  * @param payload Optional contextual attributes.
65
65
  */
66
66
  fatal: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
67
67
  /**
68
- * Logs a discrete user interaction action.
68
+ * Logs one user action.
69
69
  * @param name Action identifier.
70
70
  * @param payload Optional action attributes.
71
71
  */
@@ -102,7 +102,7 @@ export declare class OneLogger {
102
102
  */
103
103
  timeAsync: <T>(label: string, fn: () => Promise<T>, attributes?: Record<string, unknown>) => Promise<T>;
104
104
  /**
105
- * Builds, logs to console, and emits a standard log record.
105
+ * Builds and emits a standard log record. It also prints the record to the console.
106
106
  * @param level Severity level.
107
107
  * @param type Record classification.
108
108
  * @param body Primary message.
@@ -110,7 +110,7 @@ export declare class OneLogger {
110
110
  */
111
111
  private write;
112
112
  /**
113
- * Builds, logs to console, and emits an error record with attached breadcrumbs.
113
+ * Builds and emits an error record with breadcrumbs. It also prints the record to the console.
114
114
  * @param level Severity level ("ERROR" or "FATAL").
115
115
  * @param message Error description.
116
116
  * @param error Caught error instance, reason, or payload.