@utk09/ui-observability 0.3.0 → 0.4.1

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 (40) hide show
  1. package/CHANGELOG.md +66 -23
  2. package/README.md +86 -86
  3. package/dist/bus/bus.d.ts +9 -0
  4. package/dist/bus/links.d.ts +5 -4
  5. package/dist/capture/types.d.ts +14 -0
  6. package/dist/capture/web-vitals.d.ts +5 -2
  7. package/dist/constants-DVbpJ1tv.js +74 -0
  8. package/dist/constants-DVbpJ1tv.js.map +1 -0
  9. package/dist/constants-tQpoTzkY.cjs +2 -0
  10. package/dist/constants-tQpoTzkY.cjs.map +1 -0
  11. package/dist/constants.d.ts +18 -1
  12. package/dist/core/logger.d.ts +7 -5
  13. package/dist/core/pipeline.d.ts +10 -1
  14. package/dist/core/record.d.ts +11 -2
  15. package/dist/core/runtime.d.ts +12 -0
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +675 -540
  19. package/dist/index.js.map +1 -1
  20. package/dist/{indexeddb-storage-bibcl7ZS.js → indexeddb-storage-B6uqejZb.js} +32 -11
  21. package/dist/indexeddb-storage-B6uqejZb.js.map +1 -0
  22. package/dist/indexeddb-storage-CgT1GLYj.cjs +2 -0
  23. package/dist/indexeddb-storage-CgT1GLYj.cjs.map +1 -0
  24. package/dist/storage/idb-driver.d.ts +9 -1
  25. package/dist/storage/indexeddb-storage.d.ts +5 -0
  26. package/dist/storage/local-storage.d.ts +14 -0
  27. package/dist/transport/exit-flush.d.ts +11 -1
  28. package/dist/transport/retry-engine.d.ts +28 -3
  29. package/dist/utils/console.d.ts +4 -1
  30. package/dist/utils/deadline.d.ts +7 -0
  31. package/dist/utils/identity.d.ts +17 -6
  32. package/dist/utils/sanitize.d.ts +2 -0
  33. package/package.json +5 -5
  34. package/dist/constants-BmO0GRWM.cjs +0 -2
  35. package/dist/constants-BmO0GRWM.cjs.map +0 -1
  36. package/dist/constants-CQr0wwbQ.js +0 -69
  37. package/dist/constants-CQr0wwbQ.js.map +0 -1
  38. package/dist/indexeddb-storage-DeEh8Ag-.cjs +0 -2
  39. package/dist/indexeddb-storage-DeEh8Ag-.cjs.map +0 -1
  40. package/dist/indexeddb-storage-bibcl7ZS.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-DVbpJ1tv.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.4.1\";\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/**\n * ECS `log.level` names that differ from the lowercased severity text. ECS spells\n * the warning level in full; every other level matches once lowercased.\n * @see {@link SERIALIZER_NAME_ECS}\n */\nexport const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>> = { WARN: \"warning\" };\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/**\n * Max ERROR and FATAL records admitted to the pipeline per storm window.\n * A backstop against a render loop, not a shaper: ERROR and FATAL bypass sampling,\n * and a direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\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 = [\n \"redact\",\n \"onDiagnostic\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n] 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 * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]> = {\n sampling: [],\n bus: [],\n capture: [\"webVitalsLoader\"],\n};\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: \"omit\",\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 fullUrls: 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 * Max time one storage call may take before it is treated as failed, in milliseconds.\n * A call that does not settle holds a dispatch slot or the drain flag.\n */\nexport const STORAGE_DEADLINE_MS = 10_000;\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 maxNodes: 10_000,\n maxRecordBytes: 32_768,\n};\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ var ee=/OpenFin/i,te=/\bwv\b/,e=/\b(iPhone|iPad|iPod)\b/,t=/\bMacintosh\b/,n=/\bMobile\b/,r={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17,FATAL:21},i=r,a=`log.type`,o=`log.seq`,s=`app.namespace`,c=`page.url`,l=`url.full`,u=`journey.id`,d=`journey.name`,f=`journey.parent_id`,p=`uiobs.sanitize_failed`,m=`uiobs.attributes_dropped`,h=`uiobs.attributes_bytes`,g=`service.name`,_=`service.version`,v=`deployment.environment`,y=`telemetry.sdk.name`,b=`telemetry.sdk.version`,x=`telemetry.sdk.language`,S=`host.platform`,C=`session.id`,w=`tab.id`,T=`context.id`,E=`browser.user_agent`,D=`openfin.uuid`,O=`openfin.name`,k=`@utk09/ui-observability`,A=`0.4.1`,j=`webjs`,M=`otlp`,N={WARN:`warning`},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`,ne=`batches`,$=`createdAt`,re=`indexeddb`,ie=`localstorage`,ae=`memory`,oe=`none`,se=`ui-observability.drain`,ce=`ui-observability.emergency`,le=`ui-observability.journey`,ue=2e3,de=`uiObsJourney`,fe=/\+/g,pe=/\//g,me=/=+$/,he=/-/g,ge=/_/g,_e=3e5,ve=`traceparent`,ye=2166136261,be=16777619,xe=4294967295,Se=`metric`,Ce=`ui-observability/1`,we=`ui-observability.runtime`,Te=1e4,Ee=`color:#888`,De=1e3,Oe=6e4,ke=`uiobs.capture`,Ae=`uiobs.storage`,je=`count`,Me=`unknown-service`,Ne=[`redact`,`onDiagnostic`,`headers`,`serializer`,`otelLoader`],Pe=[`sampling`,`bus`,`capture`],Fe={sampling:[],bus:[],capture:[`webVitalsLoader`]},Ie={endpoint:``,serviceName:``,serviceVersion:``,environment:``,enabled:!0,minLevel:`INFO`,compression:`gzip`,credentials:`omit`,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,fullUrls:!1,ignoreUrls:[],propagateTraceHeaderTo:[]},console:null},Le=`DEBUG`,Re=2e3,ze=1e4,Be=15e3,Ve=1024,He=`UiObservability`,Ue={maxBatches:500,maxAgeMs:864e5,maxAttempts:5},We=1e4,Ge=2e3,Ke=6e4,qe=3e4,Je=18e5,Ye=`__uiobs_journey`,Xe=`ui_observability_control`,Ze=1500,Qe=5e3,$e={maxBodyChars:4096,maxAttributeChars:8192,maxAttributeCount:128,maxStackChars:8192,maxDepth:6,maxArrayLength:100,maxNodes:1e4,maxRecordBytes:32768};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return`ui-observability.session`}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return 1e3}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return 6e4}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return 18e5}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return 56319}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return 55296}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return`[ui-observability]`}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"dn",{enumerable:!0,get:function(){return`AppleWebKit`}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return`ui-observability.tab`}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"ln",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"un",{enumerable:!0,get:function(){return 2048}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return`Safari/`}});
2
+ //# sourceMappingURL=constants-tQpoTzkY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-tQpoTzkY.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.4.1\";\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/**\n * ECS `log.level` names that differ from the lowercased severity text. ECS spells\n * the warning level in full; every other level matches once lowercased.\n * @see {@link SERIALIZER_NAME_ECS}\n */\nexport const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>> = { WARN: \"warning\" };\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/**\n * Max ERROR and FATAL records admitted to the pipeline per storm window.\n * A backstop against a render loop, not a shaper: ERROR and FATAL bypass sampling,\n * and a direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\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 = [\n \"redact\",\n \"onDiagnostic\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n] 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 * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]> = {\n sampling: [],\n bus: [],\n capture: [\"webVitalsLoader\"],\n};\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: \"omit\",\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 fullUrls: 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 * Max time one storage call may take before it is treated as failed, in milliseconds.\n * A call that does not settle holds a dispatch slot or the drain flag.\n */\nexport const STORAGE_DEADLINE_MS = 10_000;\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 maxNodes: 10_000,\n maxRecordBytes: 32_768,\n};\n"],"mappings":"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"}
@@ -138,7 +138,7 @@ export declare const TELEMETRY_SDK_NAME = "@utk09/ui-observability";
138
138
  * Value of `telemetry.sdk.version`. A literal, not read from package.json. Bump by hand alongside package.json.
139
139
  * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}
140
140
  */
141
- export declare const TELEMETRY_SDK_VERSION = "0.3.0";
141
+ export declare const TELEMETRY_SDK_VERSION = "0.4.1";
142
142
  /**
143
143
  * Value of `telemetry.sdk.language`.
144
144
  * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}
@@ -148,6 +148,12 @@ export declare const TELEMETRY_SDK_LANGUAGE = "webjs";
148
148
  export declare const SERIALIZER_NAME_OTLP = "otlp";
149
149
  /** ECS serializer name. */
150
150
  export declare const SERIALIZER_NAME_ECS = "ecs";
151
+ /**
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.
154
+ * @see {@link SERIALIZER_NAME_ECS}
155
+ */
156
+ export declare const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>>;
151
157
  /** Content type for an OTLP/JSON body. */
152
158
  export declare const CONTENT_TYPE_JSON = "application/json";
153
159
  /** Content type for newline-delimited JSON. */
@@ -360,6 +366,11 @@ export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic"
360
366
  * @see {@link ResolvedConfig}
361
367
  */
362
368
  export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "capture"];
369
+ /**
370
+ * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.
371
+ * @see {@link UNDEFAULTED_CONFIG_KEYS}
372
+ */
373
+ export declare const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]>;
363
374
  /**
364
375
  * Default runtime config, before a consumer's `configure()` call.
365
376
  * Excludes `serializer`; `resolveConfig` supplies its default to avoid a circular import.
@@ -387,6 +398,11 @@ export declare const COMPRESSION_THRESHOLD_BYTES = 1024;
387
398
  export declare const STORAGE_DB_NAME = "UiObservability";
388
399
  /** Capacity and retention thresholds every storage adapter enforces. */
389
400
  export declare const STORAGE_LIMITS: StorageLimits;
401
+ /**
402
+ * Max time one storage call may take before it is treated as failed, in milliseconds.
403
+ * A call that does not settle holds a dispatch slot or the drain flag.
404
+ */
405
+ export declare const STORAGE_DEADLINE_MS = 10000;
390
406
  /** First backoff step, in milliseconds. Each attempt doubles it. */
391
407
  export declare const RETRY_BASE_DELAY_MS = 2000;
392
408
  /** Backoff ceiling, in milliseconds. */
@@ -419,5 +435,6 @@ export declare const RECORD_LIMITS: {
419
435
  maxStackChars: number;
420
436
  maxDepth: number;
421
437
  maxArrayLength: number;
438
+ maxNodes: number;
422
439
  maxRecordBytes: number;
423
440
  };
@@ -48,16 +48,18 @@ export declare class OneLogger {
48
48
  */
49
49
  warn: (message: string, payload?: Record<string, unknown>) => void;
50
50
  /**
51
- * Logs an error record with attached breadcrumb history.
51
+ * Logs an error record with attached breadcrumb history. A plain object in the
52
+ * error slot with no payload given is read as the payload.
52
53
  * @param message Error description.
53
- * @param error Caught error instance or reason.
54
+ * @param error Caught error instance, reason, or payload.
54
55
  * @param payload Optional contextual attributes.
55
56
  */
56
57
  error: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
57
58
  /**
58
- * Logs a fatal unrecoverable error record.
59
+ * Logs a fatal unrecoverable error record. A plain object in the error slot
60
+ * with no payload given is read as the payload.
59
61
  * @param message Error description.
60
- * @param error Caught error instance or reason.
62
+ * @param error Caught error instance, reason, or payload.
61
63
  * @param payload Optional contextual attributes.
62
64
  */
63
65
  fatal: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
@@ -110,7 +112,7 @@ export declare class OneLogger {
110
112
  * Builds, logs to console, and emits an error record with attached breadcrumbs.
111
113
  * @param level Severity level ("ERROR" or "FATAL").
112
114
  * @param message Error description.
113
- * @param error Caught error instance or reason.
115
+ * @param error Caught error instance, reason, or payload.
114
116
  * @param payload Optional contextual attributes.
115
117
  */
116
118
  private writeError;
@@ -105,7 +105,16 @@ export declare class LogPipeline {
105
105
  */
106
106
  private dispatch;
107
107
  /**
108
- * Persists an undelivered batch to storage and triggers retry engine.
108
+ * Persists a batch the transport refused, letting the retry engine split a 413
109
+ * and drop what the server will never accept.
110
+ * @param batch Batch to persist, with its attempt already counted.
111
+ * @param error Failure thrown by the transport.
112
+ */
113
+ private storeFailed;
114
+ /**
115
+ * Persists an undelivered batch to storage and triggers retry engine. Bounded:
116
+ * a storage call that does not settle holds this dispatch slot. Two of them
117
+ * stop the pipeline.
109
118
  * @param batch Batch to persist.
110
119
  */
111
120
  private store;
@@ -36,6 +36,15 @@ export interface RecordLimits extends SanitizeLimits {
36
36
  /** Max total attribute bytes per record. */
37
37
  maxRecordBytes: number;
38
38
  }
39
+ /** Reason a record was not built. */
40
+ export type DropReason = "level" | "sampling" | "redact";
41
+ /** Outcome of one build call. */
42
+ export interface BuildResult {
43
+ /** Completed record, or null when it was dropped. */
44
+ record: LogRecord | null;
45
+ /** Why it was dropped. Absent when a record was built. */
46
+ dropped?: DropReason;
47
+ }
39
48
  /** Input parameters for constructing a single log record. */
40
49
  export interface BuildInput {
41
50
  /** Severity level of the log entry. */
@@ -71,9 +80,9 @@ export declare class RecordBuilder {
71
80
  /**
72
81
  * Builds a structured LogRecord from input attributes, applying sanitization and size budgeting.
73
82
  * @param input Logger call input parameters.
74
- * @returns Completed LogRecord or null if dropped by severity or redaction.
83
+ * @returns The record, or null with the reason it was dropped.
75
84
  */
76
- build(input: BuildInput): LogRecord | null;
85
+ build(input: BuildInput): BuildResult;
77
86
  /**
78
87
  * Computes or returns cached resource metadata for this runtime context.
79
88
  * @returns Resource attributes record.
@@ -23,6 +23,8 @@ export declare class ObservabilityRuntime {
23
23
  readonly platform: PlatformMetadata;
24
24
  /** Identity context containing session, tab, and context identifiers. */
25
25
  readonly identity: Identity;
26
+ /** Throttled writer of the session's last-seen timestamp. */
27
+ private readonly sessionTouch;
26
28
  /** Store for ambient application context attributes. */
27
29
  readonly context: ContextStore;
28
30
  /** Ring buffer holding contextual user breadcrumbs. */
@@ -41,6 +43,8 @@ export declare class ObservabilityRuntime {
41
43
  readonly bus: Bus;
42
44
  /** Persistent storage adapter for offline batches (sender role only). */
43
45
  private storage?;
46
+ /** Storage strategy the adapter was built from, set once the build starts. */
47
+ private storageBuiltAs?;
44
48
  /** HTTP transport instance for live log delivery (sender role only). */
45
49
  private transport?;
46
50
  /** Background retry engine for redelivering failed batches (sender role only). */
@@ -51,6 +55,8 @@ export declare class ObservabilityRuntime {
51
55
  private exitFlush?;
52
56
  /** Active auto-capture instrumentation modules. */
53
57
  private readonly captures;
58
+ /** Capture work that a rebuild of the capture modules must not repeat. */
59
+ private readonly captureOnce;
54
60
  /** Queue buffering records created before bus role resolution. */
55
61
  private bootBuffer;
56
62
  /** Batch buffer staging records for microtask forwarding. */
@@ -89,6 +95,12 @@ export declare class ObservabilityRuntime {
89
95
  * @param input Partial configuration to merge.
90
96
  */
91
97
  private reconfigure;
98
+ /**
99
+ * Restores the storage strategy the adapter was built from. Every other key is read
100
+ * live, but the adapter is built once: swapping it strands the batches already
101
+ * persisted under the old one, which is worse than refusing the change.
102
+ */
103
+ private keepBuiltStorage;
92
104
  /** Initializes asynchronous subsystems and flushes the boot buffer. */
93
105
  private init;
94
106
  /** Initializes storage, transport, pipeline, and unload listeners for sender role. */