@utk09/ui-observability 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/batch-D5qvsMQ_.cjs +2 -0
- package/dist/batch-D5qvsMQ_.cjs.map +1 -0
- package/dist/{batch-4xKzzSCj.js → batch-DDgxg16_.js} +7 -4
- package/dist/batch-DDgxg16_.js.map +1 -0
- package/dist/bus/bus.d.ts +0 -4
- package/dist/{bus-DrixwdiX.js → bus-C6RwKzPW.js} +59 -62
- package/dist/bus-C6RwKzPW.js.map +1 -0
- package/dist/bus-WPVDFw2y.cjs +2 -0
- package/dist/bus-WPVDFw2y.cjs.map +1 -0
- package/dist/capture/storm.d.ts +2 -7
- package/dist/{console-ChfuJlf9.cjs → console-BSusX_M-.cjs} +2 -2
- package/dist/{console-ChfuJlf9.cjs.map → console-BSusX_M-.cjs.map} +1 -1
- package/dist/{console-B3vGRW5p.js → console-Dv5GfaNn.js} +3 -3
- package/dist/{console-B3vGRW5p.js.map → console-Dv5GfaNn.js.map} +1 -1
- package/dist/{constants-Be83LICb.cjs → constants-Cb92egPS.cjs} +2 -2
- package/dist/constants-Cb92egPS.cjs.map +1 -0
- package/dist/{constants-CQ_D7jIW.js → constants-DhH6VI5a.js} +2 -2
- package/dist/constants-DhH6VI5a.js.map +1 -0
- package/dist/constants.d.ts +2 -3
- package/dist/core/breadcrumbs.d.ts +1 -3
- package/dist/core/context.d.ts +0 -8
- package/dist/core/diagnostics.d.ts +0 -2
- package/dist/core/sampling.d.ts +1 -3
- package/dist/deadline-CUrH0Hd8.cjs +2 -0
- package/dist/deadline-CUrH0Hd8.cjs.map +1 -0
- package/dist/deadline-DeqXEliN.js +31 -0
- package/dist/deadline-DeqXEliN.js.map +1 -0
- package/dist/{errors-BGs5NOrw.js → errors-DCZWcHkd.js} +4 -4
- package/dist/{errors-BGs5NOrw.js.map → errors-DCZWcHkd.js.map} +1 -1
- package/dist/{errors-BMJm7KZZ.cjs → errors-ERu-su8m.cjs} +3 -3
- package/dist/{errors-BMJm7KZZ.cjs.map → errors-ERu-su8m.cjs.map} +1 -1
- package/dist/fixed-window-BR0bu32Y.cjs +2 -0
- package/dist/fixed-window-BR0bu32Y.cjs.map +1 -0
- package/dist/fixed-window-Re7jIRJH.js +9 -0
- package/dist/fixed-window-Re7jIRJH.js.map +1 -0
- package/dist/{identity-DXyV86o-.cjs → identity-C1WLItSl.cjs} +2 -2
- package/dist/{identity-DXyV86o-.cjs.map → identity-C1WLItSl.cjs.map} +1 -1
- package/dist/{identity-rpEyjvVg.js → identity-Di-QXGCC.js} +2 -2
- package/dist/{identity-rpEyjvVg.js.map → identity-Di-QXGCC.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +224 -236
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-DX18p39D.cjs +2 -0
- package/dist/indexeddb-storage-DX18p39D.cjs.map +1 -0
- package/dist/{indexeddb-storage-Q9fDYlyn.js → indexeddb-storage-T9YIYVYC.js} +39 -50
- package/dist/indexeddb-storage-T9YIYVYC.js.map +1 -0
- package/dist/{interactions-B8zjCjga.js → interactions-BLH_tX87.js} +2 -2
- package/dist/{interactions-B8zjCjga.js.map → interactions-BLH_tX87.js.map} +1 -1
- package/dist/{interactions-BAGRmtrv.cjs → interactions-_hfOerfC.cjs} +2 -2
- package/dist/{interactions-BAGRmtrv.cjs.map → interactions-_hfOerfC.cjs.map} +1 -1
- package/dist/journey-BRUj0hqD.cjs +2 -0
- package/dist/journey-BRUj0hqD.cjs.map +1 -0
- package/dist/{journey-_dQQ1eMP.js → journey-yALMEWF7.js} +26 -25
- package/dist/journey-yALMEWF7.js.map +1 -0
- package/dist/{library-request-BIG3Xpx3.cjs → library-request-BcAxuwsf.cjs} +2 -2
- package/dist/{library-request-BIG3Xpx3.cjs.map → library-request-BcAxuwsf.cjs.map} +1 -1
- package/dist/{library-request-DX6ev9oG.js → library-request-CQD4HUiP.js} +2 -2
- package/dist/{library-request-DX6ev9oG.js.map → library-request-CQD4HUiP.js.map} +1 -1
- package/dist/{long-frames-Cq2LgNnp.cjs → long-frames-D4Bm3Zkz.cjs} +2 -2
- package/dist/{long-frames-Cq2LgNnp.cjs.map → long-frames-D4Bm3Zkz.cjs.map} +1 -1
- package/dist/{long-frames-B0tKuChx.js → long-frames-DD_Um9_4.js} +3 -3
- package/dist/{long-frames-B0tKuChx.js.map → long-frames-DD_Um9_4.js.map} +1 -1
- package/dist/models/batch.d.ts +6 -0
- package/dist/{network-CMnEvGJB.js → network--GoE7_Or.js} +3 -3
- package/dist/{network-CMnEvGJB.js.map → network--GoE7_Or.js.map} +1 -1
- package/dist/{network-C6kJbW6K.cjs → network-DcuS2H1P.cjs} +2 -2
- package/dist/{network-C6kJbW6K.cjs.map → network-DcuS2H1P.cjs.map} +1 -1
- package/dist/openfin-BwEN0uj4.js +8 -0
- package/dist/openfin-BwEN0uj4.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs +2 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -0
- package/dist/{platform-j0uMPwHi.js → platform-GaM6h7XM.js} +25 -21
- package/dist/platform-GaM6h7XM.js.map +1 -0
- package/dist/platform-kIL5AZB7.cjs +2 -0
- package/dist/platform-kIL5AZB7.cjs.map +1 -0
- package/dist/{remote-rules-UggoZqfP.js → remote-rules-6ePq8CrI.js} +19 -21
- package/dist/remote-rules-6ePq8CrI.js.map +1 -0
- package/dist/remote-rules-CI3gbRCL.cjs +2 -0
- package/dist/remote-rules-CI3gbRCL.cjs.map +1 -0
- package/dist/sampling-C-M8p3FK.cjs +2 -0
- package/dist/sampling-C-M8p3FK.cjs.map +1 -0
- package/dist/sampling-Ud_WiuU9.js +65 -0
- package/dist/sampling-Ud_WiuU9.js.map +1 -0
- package/dist/{sanitize-BqzPc4Jg.cjs → sanitize--_e4oOPX.cjs} +2 -2
- package/dist/{sanitize-BqzPc4Jg.cjs.map → sanitize--_e4oOPX.cjs.map} +1 -1
- package/dist/{sanitize-BNwgPj_B.js → sanitize-DP0xDPrt.js} +2 -2
- package/dist/{sanitize-BNwgPj_B.js.map → sanitize-DP0xDPrt.js.map} +1 -1
- package/dist/sender-BESHz6my.cjs +3 -0
- package/dist/sender-BESHz6my.cjs.map +1 -0
- package/dist/{sender--0_VzPbN.js → sender-BUBWLn5i.js} +202 -207
- package/dist/sender-BUBWLn5i.js.map +1 -0
- package/dist/storage/gap.d.ts +20 -0
- package/dist/storage/indexeddb-storage.d.ts +1 -7
- package/dist/storage/keys.d.ts +9 -0
- package/dist/storage/local-storage.d.ts +0 -6
- package/dist/storage/memory-storage.d.ts +1 -1
- package/dist/storm-DhHGHhOc.cjs +2 -0
- package/dist/storm-DhHGHhOc.cjs.map +1 -0
- package/dist/storm-OD5J6Ylm.js +10 -0
- package/dist/storm-OD5J6Ylm.js.map +1 -0
- package/dist/utils/fixed-window.d.ts +15 -0
- package/dist/utils/guards.d.ts +6 -0
- package/dist/utils/openfin.d.ts +48 -0
- package/dist/utils/platform.d.ts +5 -0
- package/package.json +2 -3
- package/dist/batch-4xKzzSCj.js.map +0 -1
- package/dist/batch-cys7e53Q.cjs +0 -2
- package/dist/batch-cys7e53Q.cjs.map +0 -1
- package/dist/bus-B6vzPmQM.cjs +0 -2
- package/dist/bus-B6vzPmQM.cjs.map +0 -1
- package/dist/bus-DrixwdiX.js.map +0 -1
- package/dist/constants-Be83LICb.cjs.map +0 -1
- package/dist/constants-CQ_D7jIW.js.map +0 -1
- package/dist/deadline-5_PecIl5.js +0 -26
- package/dist/deadline-5_PecIl5.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/indexeddb-storage-BXaPVPyG.cjs +0 -2
- package/dist/indexeddb-storage-BXaPVPyG.cjs.map +0 -1
- package/dist/indexeddb-storage-Q9fDYlyn.js.map +0 -1
- package/dist/journey-BGSyy8Es.cjs +0 -2
- package/dist/journey-BGSyy8Es.cjs.map +0 -1
- package/dist/journey-_dQQ1eMP.js.map +0 -1
- package/dist/platform-DNOJjpOm.cjs +0 -2
- package/dist/platform-DNOJjpOm.cjs.map +0 -1
- package/dist/platform-j0uMPwHi.js.map +0 -1
- package/dist/remote-rules-DgoBJxZL.cjs +0 -2
- package/dist/remote-rules-DgoBJxZL.cjs.map +0 -1
- package/dist/remote-rules-UggoZqfP.js.map +0 -1
- package/dist/sampling-BLMD8EGM.js +0 -64
- package/dist/sampling-BLMD8EGM.js.map +0 -1
- package/dist/sampling-MthcVXXU.cjs +0 -2
- package/dist/sampling-MthcVXXU.cjs.map +0 -1
- package/dist/sender--0_VzPbN.js.map +0 -1
- package/dist/sender-SPGMqZjD.cjs +0 -3
- package/dist/sender-SPGMqZjD.cjs.map +0 -1
- package/dist/storm-CTy1dfvs.cjs +0 -2
- package/dist/storm-CTy1dfvs.cjs.map +0 -1
- package/dist/storm-knaj4GUH.js +0 -10
- package/dist/storm-knaj4GUH.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus-WPVDFw2y.cjs","names":["BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","getFin","BUS_HANDSHAKE_TIMEOUT_MS","getFin","BUS_CHANNEL_NAME","parseJourney","parseRemoteRules","REMOTE_SAMPLING_POLL_MS","require_constants","require_deadline","require_openfin","require_journey","require_remote_rules","envelope","message","unwrap","data","wrapper","RUNTIME_KEY","OPAQUE_ORIGIN","untrustedText","origin","what","parentOrigin","ancestors","referrer","createDirectLink","host","target","open","diagnostics","receive","createParentLink","self","trusted","trustedOrigins","reported","onMessage","event","createChildrenLink","sources","source","createBroadcastLink","BC","channel","channelName","createOpenFinLink","iab","appUuid","scoped","topic","raw","createOwnerLink","scope","send","createWorkerLink","worker","HANDSHAKE_OPTIONS","OWNED","Bus","config","platform","contextId","tabId","handlers","handshakeOptions","bus","direct","candidate","attempts","welcomed","attempt","reply","current","link","configured","me","push","settled","finish","timer","resolve","result","from","payload","journey","rules","to","update","upstream","ask"],"sources":["../src/models/bus.ts","../src/bus/links.ts","../src/bus/bus.ts"],"sourcesContent":["// src/models/bus.ts\n//\n// Protocol types, message definitions, and envelope encoding for bus messages between realms.\n\nimport { BUS_PROTOCOL } from \"../constants\";\nimport type { LogRecord } from \"./log-record\";\n\n/** Delivery role. It tells if this context sends its records or forwards them upstream. */\nexport type BusRole = \"sender\" | \"forwarder\";\n\n/**\n * Kind of transport channel. The bus uses it to route incoming and outgoing messages.\n * Without it, `receive` cannot tell the channels apart. Then a same-origin iframe\n * looks like a duplicated tab.\n */\nexport type LinkKind =\n /** Synchronous call into a same-origin parent runtime. */\n | \"direct\"\n /** postMessage to a parent window. */\n | \"parent\"\n /** postMessage to child frames. */\n | \"children\"\n /** BroadcastChannel across same-origin tabs and windows. */\n | \"broadcast\"\n /** OpenFin InterApplicationBus across desktop views and applications. */\n | \"openfin\"\n /** Dedicated worker communication to its owning document. */\n | \"owner\"\n /** Document-side communication to a dedicated worker. */\n | \"worker\";\n\n/** Origin and transport metadata for an incoming bus message. */\nexport interface MessageSource {\n /** Inbound transport channel kind. */\n link: LinkKind;\n /** `event.origin` for `parent` and `children`. Other links use `\"same-origin\"` or `\"openfin\"`. */\n origin: string;\n}\n\n/** Discriminated union of control and telemetry payload messages. */\nexport type BusMessage =\n /** Handshake discovery announcement from a starting forwarder. */\n | { t: \"hello\"; from: string; tabId: string }\n /**\n * Handshake response from an upstream owner. The `to` field holds the address.\n * A welcome on InterApplicationBus goes to every subscriber. Without an address,\n * each waiting view accepts the welcome as its own.\n */\n | { t: \"welcome\"; from: string; to: string; tabId: string }\n /** Telemetry log records forwarded to an upstream sender. */\n | { t: \"records\"; from: string; records: LogRecord[] }\n /**\n * Journey update, or the answer to a journey question. An answer holds the address of the\n * context that asked in `to`. The payload comes from another realm. The receiver parses it.\n */\n | { t: \"journey\"; from: string; to?: string; journey: unknown }\n /** Query requesting active journey state from connected peers. */\n | { t: \"journey?\"; from: string }\n /** Tab identifier claim broadcast to detect collisions across windows. */\n | { t: \"tab\"; from: string; tabId: string }\n /** Request of a forwarder for the remote sampling rules in force. */\n | { t: \"sampling?\"; from: string }\n /**\n * Remote sampling rules in the shape of the header, with the remaining TTL. The `to` field\n * holds the address of the forwarder that asked. The receiver validates `rules` again.\n * Null rules end the copy of the forwarder.\n */\n | { t: \"sampling\"; from: string; to: string; rules: unknown };\n\n/** Transport envelope wrapping bus messages with a protocol version tag. */\nexport interface BusEnvelope {\n /** Protocol version identifier. */\n p: typeof BUS_PROTOCOL;\n /** Encapsulated bus payload. */\n m: BusMessage;\n}\n\n/**\n * Wraps a bus message in a versioned protocol envelope.\n * @param message Message to encapsulate.\n * @returns Envelope ready for transport.\n */\nexport function envelope(message: BusMessage): BusEnvelope {\n return { p: BUS_PROTOCOL, m: message };\n}\n\n/**\n * Validates the protocol tag and unpacks a raw payload into a bus message. A\n * document gets `message` events from all embedded content on the page. This\n * includes analytics tags, video players and extensions. Without the tag check,\n * the bus parses a message from a video player as a log record.\n * @param data Raw payload received over a transport link.\n * @returns Validated message, or null if payload is invalid or unrecognized.\n */\nexport function unwrap(data: unknown): BusMessage | null {\n if (typeof data !== \"object\" || data === null) {\n return null;\n }\n\n // Validates payload structure at runtime without assuming envelope fields exist.\n const wrapper = data as Record<string, unknown>;\n if (wrapper.p !== BUS_PROTOCOL || typeof wrapper.m !== \"object\" || wrapper.m === null) {\n return null;\n }\n\n const message = wrapper.m as Record<string, unknown>;\n if (typeof message.t !== \"string\") {\n return null;\n }\n\n return message as unknown as BusMessage;\n}\n","// src/bus/links.ts\n//\n// Communication link implementations for direct, frame, broadcast, OpenFin, and worker channels.\n\nimport { BUS_TYPE_DETAIL_MAX_CHARS, RUNTIME_GLOBAL_KEY } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport {\n type BusMessage,\n envelope,\n type LinkKind,\n type MessageSource,\n unwrap,\n} from \"../models/bus\";\nimport { getFin } from \"../utils/openfin\";\n\n/** Bidirectional communication channel for bus message transport. */\nexport interface Link {\n /** Channel transport kind. */\n readonly kind: LinkKind;\n\n /**\n * Sends a message over the channel without throwing.\n * @param message Bus message to transmit.\n */\n post(message: BusMessage): void;\n\n /** Releases listeners, subscriptions, or channels held open by the link. */\n close(): void;\n}\n\n/**\n * Callback invoked when a bus message arrives on a link.\n * @param message Received bus message.\n * @param source Origin and link metadata.\n */\nexport type Receive = (message: BusMessage, source: MessageSource) => void;\n\n/** Interface that a same-origin parent runtime exposes on a global symbol. */\nexport interface DirectHost {\n /**\n * Accepts a message directly from a child frame and replies synchronously.\n * @param message Child bus message.\n * @param reply Callback for synchronous response.\n */\n busAccept(message: BusMessage, reply: Receive): void;\n}\n\n/** Message port or dedicated/shared worker interface. */\nexport interface WorkerLike {\n /**\n * Sends a message to the worker or port.\n * @param message Payload to send.\n */\n postMessage(message: unknown): void;\n\n /**\n * Subscribes to incoming message events.\n * @param type Event name (\"message\").\n * @param listener Event handler callback.\n */\n addEventListener(type: \"message\", listener: (event: MessageEvent) => void): void;\n\n /**\n * Unsubscribes from message events.\n * @param type Event name (\"message\").\n * @param listener Event handler to remove.\n */\n removeEventListener(type: \"message\", listener: (event: MessageEvent) => void): void;\n\n /** Starts message delivery on MessagePort instances. */\n start?: () => void;\n}\n\n/** Global symbol used to look up same-origin parent runtime instances. */\nconst RUNTIME_KEY = Symbol.for(RUNTIME_GLOBAL_KEY);\n\n/** Origin of a sandboxed frame without allow-same-origin. */\nconst OPAQUE_ORIGIN = \"null\";\n\n/** Location with the ancestor list that Chromium and WebKit give. */\ninterface LocationWithAncestors {\n origin: string;\n ancestorOrigins?: { length: number; item: (index: number) => string | null };\n}\n\n/**\n * Builds the message for an ignored message from an untrusted origin.\n * @param origin Origin of the sender.\n * @param what What the bus ignored, for example \"a message\".\n * @returns The message. A sandboxed sender gets the fix for its frame.\n */\nfunction untrustedText(origin: string, what: string): string {\n if (origin === OPAQUE_ORIGIN) {\n return `The bus ignored ${what} from a sandboxed frame. The frame has an opaque origin. Set bus.mode: \"sender\" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.`;\n }\n\n return `The bus ignored ${what} from ${origin}. If you own this origin, add it to bus.trustedOrigins.`;\n}\n\n/**\n * Reads the origin of the parent frame. A cross-origin parent does not give its location.\n * @returns The origin, or null when the browser does not give it.\n */\nfunction parentOrigin(): string | null {\n const ancestors = (location as LocationWithAncestors).ancestorOrigins;\n if (ancestors && ancestors.length > 0) {\n return ancestors.item(0);\n }\n\n // Firefox has no ancestorOrigins. The referrer of a frame is the page that loaded it.\n // A Referrer-Policy of no-referrer gives \"\". The caller reports an unknown origin.\n const referrer = document.referrer;\n if (referrer === \"\") {\n return null;\n }\n\n try {\n return new URL(referrer).origin;\n } catch {\n return null;\n }\n}\n\n/**\n * Establishes direct synchronous communication with a same-origin parent runtime.\n * @param receive Callback for parent replies.\n * @param diagnostics Diagnostics reporter.\n * @returns Direct link, or null if parent is inaccessible or lacks a runtime.\n */\nexport function createDirectLink(receive: Receive, diagnostics: Diagnostics): Link | null {\n if (typeof window === \"undefined\" || window.parent === window) {\n return null;\n }\n\n let host: DirectHost | undefined;\n try {\n const parentGlobal = window.parent as unknown as Record<symbol, DirectHost | undefined>;\n host = parentGlobal[RUNTIME_KEY];\n } catch {\n // Cross-origin access throws on read.\n return null;\n }\n if (typeof host?.busAccept !== \"function\") {\n return null;\n }\n\n const target = host;\n let open = true;\n\n return {\n kind: \"direct\",\n post(message) {\n if (!open) {\n return;\n }\n\n // Stops an error in the parent runtime from breaking a logging call in the child.\n diagnostics.guard(\n \"bus.send_failed\",\n \"The direct call into the parent runtime failed.\",\n () => {\n target.busAccept(message, receive);\n },\n );\n },\n close() {\n open = false;\n },\n };\n}\n\n/**\n * Creates a postMessage link to a parent window on a trusted origin. Records hold user data.\n * A page on another origin that frames this app must not get them.\n * @param receive Callback for incoming parent messages.\n * @param trustedOrigins Origins of a parent that can get the records, in addition to this origin.\n * @param diagnostics Diagnostics reporter.\n * @returns Link to the parent window, or null at the top level or with an untrusted parent.\n * With null, this context sends its own records.\n */\nexport function createParentLink(\n receive: Receive,\n trustedOrigins: string[],\n diagnostics: Diagnostics,\n): Link | null {\n if (typeof window === \"undefined\" || window.parent === window) {\n return null;\n }\n\n // A sandboxed frame has an opaque origin. No parent can list it in its own trust list.\n const self = location.origin;\n if (self === OPAQUE_ORIGIN) {\n diagnostics.report(\n \"bus.untrusted_origin\",\n 'This frame is sandboxed without allow-same-origin. It has an opaque origin. No parent can trust it. This context sends its own records. Set bus.mode: \"sender\" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.',\n { origin: self, type: \"parent\" },\n );\n return null;\n }\n\n const trusted = new Set([self, ...trustedOrigins]);\n const target = parentOrigin();\n if (target === null || !trusted.has(target)) {\n diagnostics.report(\n \"bus.untrusted_origin\",\n target === null\n ? \"The origin of the parent frame is unknown. This context sends its own records.\"\n : `The parent frame is on ${target}. This origin is not in bus.trustedOrigins. This context sends its own records.`,\n { origin: target ?? \"\", type: \"parent\" },\n );\n return null;\n }\n\n // Report each untrusted origin one time. A hostile parent can send many messages.\n const reported = new Set<string>();\n\n const onMessage = (event: MessageEvent): void => {\n const message = unwrap(event.data);\n if (!message || event.source !== window.parent) {\n return;\n }\n\n // The parent can navigate to another origin after this frame loads.\n if (!trusted.has(event.origin)) {\n if (!reported.has(event.origin)) {\n reported.add(event.origin);\n // The parent sets message.t. Keep it out of the message text. Cut it in the detail.\n diagnostics.report(\"bus.untrusted_origin\", untrustedText(event.origin, \"a message\"), {\n origin: event.origin,\n type: message.t.slice(0, BUS_TYPE_DETAIL_MAX_CHARS),\n });\n }\n return;\n }\n\n receive(message, { link: \"parent\", origin: event.origin });\n };\n addEventListener(\"message\", onMessage);\n\n return {\n kind: \"parent\",\n post(message) {\n diagnostics.guard(\"bus.send_failed\", \"The postMessage call to the parent failed.\", () => {\n // Target the trusted origin, not \"*\". The browser drops the message if the parent\n // navigated to another origin.\n window.parent.postMessage(envelope(message), target);\n });\n },\n close() {\n removeEventListener(\"message\", onMessage);\n },\n };\n}\n\n/**\n * Creates a link listening to child frames with origin allowlist filtering.\n * @param receive Callback for messages from authorized child frames.\n * @param trustedOrigins Additional origins allowed to communicate.\n * @param diagnostics Diagnostics reporter.\n * @returns Children link, or null in non-window environments.\n */\nexport function createChildrenLink(\n receive: Receive,\n trustedOrigins: string[],\n diagnostics: Diagnostics,\n): Link | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n // A sandboxed page has the opaque origin \"null\". Each sandboxed child also has it.\n const trusted = new Set([location.origin, ...trustedOrigins]);\n trusted.delete(OPAQUE_ORIGIN);\n\n // The map keeps the origin of each source.\n // A child that navigates must not get the ids of its previous origin.\n const sources = new Map<MessageEventSource, string>();\n\n const onMessage = (event: MessageEvent): void => {\n const message = unwrap(event.data);\n if (!message) {\n return;\n }\n if (!trusted.has(event.origin)) {\n diagnostics.report(\"bus.untrusted_origin\", untrustedText(event.origin, \"a message\"), {\n origin: event.origin,\n type: message.t.slice(0, BUS_TYPE_DETAIL_MAX_CHARS),\n });\n return;\n }\n\n if (event.source) {\n sources.set(event.source, event.origin);\n }\n receive(message, { link: \"children\", origin: event.origin });\n };\n addEventListener(\"message\", onMessage);\n\n return {\n kind: \"children\",\n post(message) {\n for (const [source, origin] of sources) {\n const target = source as Window;\n // Evicts closed child windows to prevent memory leaks.\n if (target.closed) {\n sources.delete(source);\n continue;\n }\n diagnostics.guard(\n \"bus.send_failed\",\n \"The postMessage call to a child frame failed.\",\n () => {\n // Targets the last known origin of the child. The browser drops the\n // message if the child navigated to a different origin.\n target.postMessage(envelope(message), origin);\n },\n );\n }\n },\n close() {\n removeEventListener(\"message\", onMessage);\n sources.clear();\n },\n };\n}\n\n/**\n * Creates a same-origin BroadcastChannel link for cross-tab control messages.\n * @param channelName BroadcastChannel identifier.\n * @param receive Callback for incoming cross-tab messages.\n * @param diagnostics Diagnostics reporter.\n * @returns Broadcast link, or null if unsupported.\n */\nexport function createBroadcastLink(\n channelName: string,\n receive: Receive,\n diagnostics: Diagnostics,\n): Link | null {\n const BC = (globalThis as { BroadcastChannel?: typeof BroadcastChannel }).BroadcastChannel;\n if (typeof BC === \"undefined\") {\n return null;\n }\n\n const channel = diagnostics.guard(\n \"bus.send_failed\",\n \"The library could not open the BroadcastChannel.\",\n () => new BC(channelName),\n );\n if (!channel) {\n return null;\n }\n\n channel.onmessage = (event: MessageEvent): void => {\n const message = unwrap(event.data);\n if (message) {\n receive(message, { link: \"broadcast\", origin: \"same-origin\" });\n }\n };\n\n return {\n kind: \"broadcast\",\n post(message) {\n diagnostics.guard(\"bus.send_failed\", \"The BroadcastChannel.postMessage call failed.\", () => {\n channel.postMessage(envelope(message));\n });\n },\n close() {\n diagnostics.guard(\n \"bus.send_failed\",\n \"The library could not close the BroadcastChannel.\",\n () => {\n channel.close();\n },\n );\n },\n };\n}\n\n/**\n * Creates an OpenFin InterApplicationBus link scoped to one application.\n * @param topic InterApplicationBus topic prefix.\n * @param appUuid OpenFin application uuid owning this context.\n * @param receive Callback for received topic messages.\n * @param diagnostics Diagnostics reporter.\n * @returns OpenFin link, or null if InterApplicationBus or the identity is unavailable.\n */\nexport function createOpenFinLink(\n topic: string,\n appUuid: string | undefined,\n receive: Receive,\n diagnostics: Diagnostics,\n): Link | null {\n const iab = getFin()?.InterApplicationBus;\n if (!iab) {\n return null;\n }\n if (!appUuid) {\n // publish() sends to every subscriber on the runtime. Without a uuid scope,\n // this link shares the bus of this app with all other apps.\n diagnostics.report(\n \"openfin.unavailable\",\n \"OpenFin gives no application uuid. The InterApplicationBus link stays closed.\",\n );\n return null;\n }\n\n // The topic and the subscriber identity both contain the uuid. The topic keeps\n // messages of this app from other apps. The identity rejects messages from other apps.\n const scoped = `${topic}.${appUuid}`;\n\n void diagnostics.guardAsync(\n \"bus.send_failed\",\n \"The InterApplicationBus.subscribe call failed.\",\n () =>\n iab.subscribe({ uuid: appUuid }, scoped, (raw) => {\n const message = unwrap(raw);\n if (message) {\n receive(message, { link: \"openfin\", origin: \"openfin\" });\n }\n }),\n );\n\n return {\n kind: \"openfin\",\n post(message) {\n void diagnostics.guardAsync(\n \"bus.send_failed\",\n \"The InterApplicationBus.publish call failed.\",\n () => iab.publish(scoped, envelope(message)),\n );\n },\n close() {\n // OpenFin removes the subscriptions when the context closes.\n },\n };\n}\n\n/**\n * Creates the worker-side link pointing at the document that created this\n * worker. Emits `kind: \"owner\"`.\n * @param receive Callback for incoming messages from the owning document.\n * @param diagnostics Diagnostics reporter.\n * @returns Owner link, or null outside a DedicatedWorkerGlobalScope.\n */\nexport function createOwnerLink(receive: Receive, diagnostics: Diagnostics): Link | null {\n const scope = globalThis as unknown as {\n postMessage?: (message: unknown) => void;\n addEventListener?: (type: string, listener: (event: MessageEvent) => void) => void;\n WorkerGlobalScope?: unknown;\n };\n const send = scope.postMessage;\n if (typeof scope.WorkerGlobalScope === \"undefined\" || !send) {\n return null;\n }\n\n const onMessage = (event: MessageEvent): void => {\n const message = unwrap(event.data);\n if (message) {\n receive(message, { link: \"owner\", origin: \"same-origin\" });\n }\n };\n scope.addEventListener?.(\"message\", onMessage);\n\n return {\n kind: \"owner\",\n post(message) {\n diagnostics.guard(\"bus.send_failed\", \"The postMessage call of the worker failed.\", () => {\n send(envelope(message));\n });\n },\n close() {\n // Worker scope listeners stop when the worker stops.\n },\n };\n}\n\n/**\n * Creates the document-side link pointing at one attached worker or port.\n * Emits `kind: \"worker\"`.\n * @param worker Target worker instance or MessagePort.\n * @param receive Callback for messages from the worker.\n * @param diagnostics Diagnostics reporter.\n * @returns Document-to-worker link.\n */\nexport function createWorkerLink(\n worker: WorkerLike,\n receive: Receive,\n diagnostics: Diagnostics,\n): Link {\n const onMessage = (event: MessageEvent): void => {\n const message = unwrap(event.data);\n if (message) {\n receive(message, { link: \"worker\", origin: \"same-origin\" });\n }\n };\n worker.addEventListener(\"message\", onMessage);\n\n // Starts delivery on a MessagePort. A Worker has no start method.\n worker.start?.();\n\n return {\n kind: \"worker\",\n post(message) {\n diagnostics.guard(\"bus.send_failed\", \"The postMessage call to a worker failed.\", () => {\n worker.postMessage(envelope(message));\n });\n },\n close() {\n worker.removeEventListener(\"message\", onMessage);\n },\n };\n}\n","// src/bus/bus.ts\n//\n// Resolves the bus role and routes messages between realms.\n\nimport {\n BUS_CHANNEL_NAME,\n BUS_HANDSHAKE_TIMEOUT_MS,\n BUS_MAX_HANDSHAKE_ATTEMPTS,\n REMOTE_SAMPLING_POLL_MS,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { type Journey, parseJourney } from \"../core/journey\";\nimport { applyRemote, parseRemoteRules } from \"../core/remote-rules\";\nimport type { RemoteSlot } from \"../core/remote-sampling\";\nimport type { BusMessage, BusRole, LinkKind, MessageSource } from \"../models/bus\";\nimport type { JourneyScope, ResolvedConfig } from \"../models/config\";\nimport type { LogRecord } from \"../models/log-record\";\nimport { getFin } from \"../utils/openfin\";\nimport type { PlatformMetadata } from \"../utils/platform\";\nimport { unrefTimer } from \"../utils/unref\";\nimport {\n createBroadcastLink,\n createChildrenLink,\n createDirectLink,\n createOpenFinLink,\n createOwnerLink,\n createParentLink,\n createWorkerLink,\n type Link,\n type Receive,\n type WorkerLike,\n} from \"./links\";\n\n/** Handshake timing for a forwarder waiting on an owner. */\nexport interface HandshakeOptions {\n /** Maximum time that a forwarder waits for an owner to answer, in milliseconds. */\n timeoutMs: number;\n /** Attempts allowed before a cross-origin forwarder promotes itself to sender. */\n maxAttempts: number;\n}\n\n/** Default handshake timing. Tests build a bus with shorter values. */\nexport const HANDSHAKE_OPTIONS: HandshakeOptions = {\n timeoutMs: BUS_HANDSHAKE_TIMEOUT_MS,\n maxAttempts: BUS_MAX_HANDSHAKE_ATTEMPTS,\n};\n\n/** Callbacks for handling records and journey events from connected realms. */\nexport interface BusHandlers {\n /** Processes records forwarded from child contexts. */\n onRecords: (records: LogRecord[]) => void;\n /** Applies journey updates received from the control bus. */\n onJourney: (journey: Journey | null) => void;\n /** Returns the active journey to a child context that requests it. */\n onJourneyRequest: () => Journey | null;\n /** Runs when two windows use the same tab identifier. */\n onTabConflict: () => void;\n /** Slot of the runtime for the remote sampling rules. The bus reads it and fills it. */\n remote: RemoteSlot;\n}\n\n/** Link types that a sender context may claim ownership over during handshakes. */\nconst OWNED: readonly LinkKind[] = [\"children\", \"direct\", \"worker\"];\n\n/** Journey scope after the bus resolves \"auto\". */\ntype ResolvedScope = Exclude<JourneyScope, \"auto\">;\n\n/** Coordinates cross-realm communication, role resolution, and message dispatch. */\nexport class Bus {\n /** Current bus role. The default is \"sender\". */\n private role: BusRole = \"sender\";\n /** Upstream forwarding link, or null when acting as sender. */\n private upstream: Link | null = null;\n /** Open control plane links. */\n private readonly links: Link[] = [];\n /** Shared OpenFin InterApplicationBus link instance. */\n private openFinLink: Link | null = null;\n /** True if this context is the OpenFin platform provider. */\n private isOpenFinProvider = false;\n /** Timer that asks the upstream owner for the remote sampling rules. */\n private rulesPoll: ReturnType<typeof setInterval> | undefined;\n /** True after destroy(). A handshake that ends later must not start a timer. */\n private destroyed = false;\n /** Context id of the owner that answered the handshake. Null with no handshake. */\n private ownerId: string | null = null;\n /** Active handshake state awaiting welcome response. */\n private awaitingWelcome: {\n link: LinkKind;\n settle: (ok: boolean) => void;\n } | null = null;\n\n /**\n * @param config Active configuration instance.\n * @param diagnostics Diagnostics reporter.\n * @param platform Platform runtime metadata.\n * @param contextId Unique context identifier for loop prevention.\n * @param tabId Tab identifier announced on broadcast channels.\n * @param handlers Callbacks for routed bus events.\n */\n constructor(\n private readonly config: ResolvedConfig,\n private readonly diagnostics: Diagnostics,\n private readonly platform: PlatformMetadata,\n private readonly contextId: string,\n private readonly tabId: string,\n private readonly handlers: BusHandlers,\n private readonly handshakeOptions: HandshakeOptions = HANDSHAKE_OPTIONS,\n ) {}\n\n /** Returns the resolved bus role. */\n getRole(): BusRole {\n return this.role;\n }\n\n /**\n * Resolves bus role and establishes control links.\n * @returns Resolved role.\n */\n async start(): Promise<BusRole> {\n const { bus } = this.config;\n\n if (bus.mode === \"off\") {\n this.role = \"sender\";\n return this.role;\n }\n\n this.isOpenFinProvider = this.resolveOpenFinProvider();\n\n if (bus.mode === \"sender\" || bus.mode === \"forwarder\") {\n this.role = bus.mode;\n this.openControlLinks();\n if (this.role === \"forwarder\") {\n this.upstream = this.candidateUpstream();\n if (!this.upstream) {\n this.diagnostics.report(\n \"bus.no_owner\",\n 'bus.mode is \"forwarder\". No owner exists. The library drops the records of this context.',\n );\n }\n }\n this.announce();\n return this.role;\n }\n\n this.openControlLinks();\n\n // A same-origin parent runtime accepts a direct synchronous link.\n const direct = createDirectLink(this.receive, this.diagnostics);\n if (direct) {\n this.role = \"forwarder\";\n this.upstream = direct;\n this.diagnostics.report(\n \"bus.role_resolved\",\n \"This context attached directly to the runtime of its same-origin parent.\",\n {\n role: \"forwarder\",\n via: \"direct\",\n },\n );\n this.announce();\n return this.role;\n }\n\n const candidate = this.candidateUpstream();\n\n if (!candidate) {\n this.role = \"sender\";\n this.diagnostics.report(\n \"bus.role_resolved\",\n \"No owner exists. This context sends its own records.\",\n {\n role: \"sender\",\n },\n );\n this.announce();\n return this.role;\n }\n\n const attempts = this.orphanPolicy() === \"retry\" ? this.handshakeOptions.maxAttempts : 1;\n\n let welcomed = false;\n for (let attempt = 0; attempt < attempts && !welcomed; attempt++) {\n welcomed = await this.handshake(candidate);\n }\n\n this.role = welcomed ? \"forwarder\" : \"sender\";\n this.upstream = welcomed ? candidate : null;\n if (!welcomed) {\n // OpenFin link remains open for control messages.\n if (candidate !== this.openFinLink) {\n candidate.close();\n }\n this.diagnostics.report(\n \"bus.handshake_timeout\",\n `No owner answered after ${String(attempts)} attempt(s) of ${String(this.handshakeOptions.timeoutMs)} ms. This context becomes the sender.`,\n { via: candidate.kind, crossOrigin: this.isCrossOriginFrame() },\n );\n }\n this.diagnostics.report(\"bus.role_resolved\", `The bus role is ${this.role}.`, {\n role: this.role,\n via: welcomed ? candidate.kind : \"none\",\n });\n\n this.announce();\n return this.role;\n }\n\n /**\n * Forwards records to the upstream owner if configured.\n * @param records Batch of log records to send.\n */\n sendRecords(records: LogRecord[]): void {\n this.upstream?.post({ t: \"records\", from: this.contextId, records });\n }\n\n /**\n * Synchronously processes direct messages from same-origin child contexts.\n * @param message Received bus message.\n * @param reply Direct response callback.\n */\n acceptDirect(message: BusMessage, reply: Receive): void {\n if (message.from === this.contextId) {\n return;\n }\n const source: MessageSource = { link: \"direct\", origin: \"same-origin\" };\n\n if (message.t === \"hello\") {\n if (this.canOwn(\"direct\")) {\n reply(\n {\n t: \"welcome\",\n from: this.contextId,\n to: message.from,\n tabId: this.tabId,\n },\n source,\n );\n }\n return;\n }\n if (message.t === \"journey?\") {\n const current = this.handlers.onJourneyRequest();\n if (current && this.journeyLink(\"direct\")) {\n reply({ t: \"journey\", from: this.contextId, to: message.from, journey: current }, source);\n }\n return;\n }\n // A direct link has no channel from the parent to the child. The parent answers here.\n if (message.t === \"sampling?\") {\n reply(this.rulesAnswer(message.from), source);\n return;\n }\n this.receive(message, source);\n }\n\n /**\n * Connects a worker instance to the bus control plane.\n * @param worker Worker instance.\n */\n attachWorker(worker: WorkerLike): void {\n this.links.push(createWorkerLink(worker, this.receive, this.diagnostics));\n }\n\n /**\n * Sends journey state changes over each link of the journey scope.\n * @param journey Active journey or null if ended.\n */\n broadcastJourney(journey: Journey | null): void {\n this.postJourney({ t: \"journey\", from: this.contextId, journey });\n }\n\n /** Closes all open links and clears internal state. */\n destroy(): void {\n this.destroyed = true;\n clearInterval(this.rulesPoll);\n this.rulesPoll = undefined;\n for (const link of this.allLinks()) {\n link.close();\n }\n this.links.length = 0;\n this.upstream = null;\n this.ownerId = null;\n this.openFinLink = null;\n }\n\n /** Returns all unique active links including upstream. */\n private allLinks(): Link[] {\n if (!this.upstream || this.links.includes(this.upstream)) {\n return this.links;\n }\n return [...this.links, this.upstream];\n }\n\n /** Sends a message only over links of the given kind. */\n private postOver(link: LinkKind, message: BusMessage): void {\n for (const candidate of this.allLinks()) {\n if (candidate.kind === link) {\n candidate.post(message);\n }\n }\n }\n\n /** Sends a journey message over each link of the journey scope. */\n private postJourney(message: BusMessage): void {\n for (const link of this.allLinks()) {\n if (this.journeyLink(link.kind)) {\n link.post(message);\n }\n }\n }\n\n /** Routes incoming messages to registered handlers or upstream targets. */\n private readonly receive = (message: BusMessage, source: MessageSource): void => {\n if (message.from === this.contextId) {\n return;\n }\n\n switch (message.t) {\n case \"hello\":\n if (this.canOwn(source.link)) {\n this.postOver(source.link, {\n t: \"welcome\",\n from: this.contextId,\n to: message.from,\n tabId: this.tabId,\n });\n }\n break;\n\n case \"welcome\":\n if (message.to !== this.contextId) {\n break;\n }\n if (this.awaitingWelcome?.link === source.link) {\n // Keep the owner. Only it can set the journey of this context on a shared link.\n this.ownerId = message.from;\n this.awaitingWelcome.settle(true);\n }\n break;\n\n case \"records\":\n if (this.role === \"sender\") {\n this.handlers.onRecords(message.records);\n } else if (this.upstream && this.canRelay(source.link)) {\n // Relays records upstream in nested frame chains.\n this.upstream.post(message);\n }\n break;\n\n case \"journey\":\n if (this.acceptsJourney(message, source)) {\n this.applyJourney(message.journey);\n }\n break;\n\n case \"journey?\": {\n const current = this.handlers.onJourneyRequest();\n // Address the answer. On a shared link, each other context ignores it.\n if (current && this.journeyLink(source.link)) {\n this.postOver(source.link, {\n t: \"journey\",\n from: this.contextId,\n to: message.from,\n journey: current,\n });\n }\n break;\n }\n\n case \"sampling?\":\n // A forwarder answers only its own children. A sibling on its upstream link asks too.\n // A sibling answer on OpenFin gives N squared messages, and a stale copy can win.\n if (\n this.role === \"forwarder\" ? source.link !== this.upstream?.kind : this.canOwn(source.link)\n ) {\n this.postOver(source.link, this.rulesAnswer(message.from));\n }\n break;\n\n case \"sampling\":\n if (this.acceptsRules(message.to, source)) {\n this.applyRules(message.rules);\n }\n break;\n\n case \"tab\":\n // A collision applies only to two different contexts on the broadcast channel.\n // The id comparison selects one context of the pair.\n // Without it, both contexts report the conflict and rename.\n if (\n source.link === \"broadcast\" &&\n message.tabId === this.tabId &&\n this.contextId > message.from\n ) {\n this.handlers.onTabConflict();\n }\n break;\n }\n };\n\n /**\n * Tells if records from a link can go upstream. Records that go back on\n * their arrival link return to their sender. A direct link is an exception.\n * Each direct link is one call into one parent. Thus two direct links in a\n * chain are different links.\n * @param link Kind of the link the records arrived on.\n * @returns True if the relay is safe.\n */\n private canRelay(link: LinkKind): boolean {\n return link === \"direct\" || link !== this.upstream?.kind;\n }\n\n /** Returns true if this context can be the owner of the given link type. */\n private canOwn(link: LinkKind): boolean {\n if (this.role !== \"sender\") {\n return false;\n }\n if (link === \"openfin\") {\n return this.isOpenFinProvider;\n }\n return OWNED.includes(link);\n }\n\n /** Finds if this context is the OpenFin platform provider. */\n private resolveOpenFinProvider(): boolean {\n const configured = this.config.bus.openFinRole;\n if (configured !== \"auto\") {\n return configured === \"provider\";\n }\n if (this.platform.platform !== \"openfin\" && this.platform.platform !== \"openfin_web\") {\n return false;\n }\n\n const me = getFin()?.me;\n if (!me?.identity || me.isView) {\n return false;\n }\n return Boolean(me.identity.name && me.identity.name === me.identity.uuid);\n }\n\n /** Resolves the handshake orphan policy for the current platform context. */\n private orphanPolicy(): \"promote\" | \"retry\" {\n return this.isCrossOriginFrame() ? \"retry\" : \"promote\";\n }\n\n /** Tests if a cross-origin boundary blocks access to the parent window. */\n private isCrossOriginFrame(): boolean {\n if (typeof window === \"undefined\" || window.parent === window) {\n return false;\n }\n try {\n // A cross-origin parent throws on this read. Lint rejects a bare property read.\n Reflect.get(window.parent, \"location\");\n return false;\n } catch {\n return true;\n }\n }\n\n /** Identifies the candidate upstream link based on platform hierarchy. */\n private candidateUpstream(): Link | null {\n if (this.platform.isWorker) {\n return createOwnerLink(this.receive, this.diagnostics);\n }\n if (!this.platform.isTopLevelDocument) {\n return createParentLink(this.receive, this.config.bus.trustedOrigins, this.diagnostics);\n }\n if (this.platform.platform === \"openfin\" && !this.isOpenFinProvider) {\n return this.ensureOpenFinLink();\n }\n return null;\n }\n\n /** Opens control links supported by the current runtime environment. */\n private openControlLinks(): void {\n const push = (link: Link | null): void => {\n if (link) {\n this.links.push(link);\n }\n };\n\n if (this.platform.isTopLevelDocument) {\n push(createChildrenLink(this.receive, this.config.bus.trustedOrigins, this.diagnostics));\n push(createBroadcastLink(BUS_CHANNEL_NAME, this.receive, this.diagnostics));\n }\n if (this.platform.platform === \"openfin\" || this.platform.platform === \"openfin_web\") {\n push(this.ensureOpenFinLink());\n }\n }\n\n /** Returns the singleton OpenFin InterApplicationBus link. */\n private ensureOpenFinLink(): Link | null {\n this.openFinLink ??= createOpenFinLink(\n BUS_CHANNEL_NAME,\n this.platform.openfinUuid,\n this.receive,\n this.diagnostics,\n );\n return this.openFinLink;\n }\n\n /**\n * Executes a hello/welcome handshake over candidate link.\n * @param candidate Upstream link candidate.\n * @returns True if welcome response arrived before timeout.\n */\n private handshake(candidate: Link): Promise<boolean> {\n return new Promise((resolve) => {\n let settled = false;\n\n const finish = (result: boolean): void => {\n if (settled) {\n return;\n }\n settled = true;\n this.awaitingWelcome = null;\n clearTimeout(timer);\n resolve(result);\n };\n\n this.awaitingWelcome = { link: candidate.kind, settle: finish };\n // finish reads timer, which the code declares after finish. This order is safe.\n // finish can run only after the post below. The timer exists at that time.\n const timer = setTimeout(() => {\n finish(false);\n }, this.handshakeOptions.timeoutMs);\n unrefTimer(timer);\n candidate.post({ t: \"hello\", from: this.contextId, tabId: this.tabId });\n });\n }\n\n /** Broadcasts tab claim and queries existing journey state. */\n private announce(): void {\n this.postOver(\"broadcast\", {\n t: \"tab\",\n from: this.contextId,\n tabId: this.tabId,\n });\n this.postJourney({ t: \"journey?\", from: this.contextId });\n this.pollRules();\n }\n\n /**\n * Resolves the journey scope. \"auto\" gives \"origin\" in OpenFin and \"tab\" in a browser.\n * @returns The scope in force.\n */\n private journeyScope(): ResolvedScope {\n const { scope } = this.config.journey;\n if (scope !== \"auto\") {\n return scope;\n }\n\n const { platform } = this.platform;\n return platform === \"openfin\" || platform === \"openfin_web\" ? \"origin\" : \"tab\";\n }\n\n /**\n * Tests if a link carries journey messages in the scope in force.\n * Only \"origin\" uses the broadcast link. That link reaches each tab of the origin.\n * @param link Link kind.\n * @returns True if the link carries journey messages.\n */\n private journeyLink(link: LinkKind): boolean {\n const scope = this.journeyScope();\n if (scope === \"context\") {\n return false;\n }\n\n return scope === \"origin\" || link !== \"broadcast\";\n }\n\n /**\n * Tests if this context adopts a journey message.\n * @param message Journey message.\n * @param source Link and origin of the message.\n * @returns True for a message on a journey link, to this context, from an accepted sender.\n * In \"tab\" scope, only the owner of a forwarder is an accepted sender.\n */\n private acceptsJourney(\n message: Extract<BusMessage, { t: \"journey\" }>,\n source: MessageSource,\n ): boolean {\n if (!this.journeyLink(source.link)) {\n return false;\n }\n\n if (message.to !== undefined && message.to !== this.contextId) {\n return false;\n }\n\n return this.journeyScope() === \"origin\" || this.fromOwner(message.from, source.link);\n }\n\n /**\n * Tests if a message comes from the upstream owner of this forwarder.\n * @param from Context id of the sender.\n * @param link Link kind of the message.\n * @returns True for the upstream link and, after a handshake, the owner that answered it.\n */\n private fromOwner(from: string, link: LinkKind): boolean {\n if (this.role !== \"forwarder\" || link !== this.upstream?.kind) {\n return false;\n }\n\n return this.ownerId === null || from === this.ownerId;\n }\n\n /**\n * Parses a journey payload from another realm and gives it to the runtime.\n * @param payload Journey, or null when the journey ended.\n */\n private applyJourney(payload: unknown): void {\n if (payload === null) {\n this.handlers.onJourney(null);\n return;\n }\n\n const journey = parseJourney(payload);\n if (journey === null) {\n this.diagnostics.report(\n \"record.dropped_malformed\",\n \"The bus dropped a journey message. Its payload is not a journey.\",\n { type: \"journey\" },\n );\n return;\n }\n\n this.handlers.onJourney(journey);\n }\n\n /**\n * Builds the answer to a sampling question. Null rules end the copy of the forwarder.\n * @param to Context id of the forwarder that asked.\n * @returns The answer.\n */\n private rulesAnswer(to: string): BusMessage {\n const rules = this.handlers.remote.sampling?.wire() ?? null;\n\n return { t: \"sampling\", from: this.contextId, to, rules };\n }\n\n /**\n * Tests if this context accepts sampling rules from a source.\n * @param to Context id that the answer names.\n * @param source Link and origin of the answer.\n * @returns True only for an answer from the upstream owner to this context.\n */\n private acceptsRules(to: string, source: MessageSource): boolean {\n // Accept rules only from the upstream owner. A sibling on a shared link is not trusted.\n if (this.role !== \"forwarder\" || to !== this.contextId || source.link !== this.upstream?.kind) {\n return false;\n }\n\n // A page on another origin can embed this app. It must not lower minLevel and read the records.\n const { origin } = source;\n\n if (\n source.link === \"parent\" &&\n origin !== location.origin &&\n !this.config.bus.trustedOrigins.includes(origin)\n ) {\n this.diagnostics.report(\n \"bus.untrusted_origin\",\n `The bus ignored sampling rules from ${origin}. If you own this origin, add it to bus.trustedOrigins.`,\n { origin, type: \"sampling\" },\n );\n return false;\n }\n\n return true;\n }\n\n /**\n * Applies the rules of an answer. It ignores rules that are not valid.\n * @param raw Rules of the answer, or null when the upstream has none.\n */\n private applyRules(raw: unknown): void {\n if (raw === null) {\n applyRemote(this.handlers.remote, this.config, null);\n return;\n }\n\n const update = parseRemoteRules(raw, this.diagnostics);\n\n if (update) {\n applyRemote(this.handlers.remote, this.config, update);\n }\n }\n\n /**\n * Asks the upstream owner for the remote sampling rules now, then at each poll interval.\n * A direct link cannot push the rules to a child. A poll works on each link kind.\n */\n private pollRules(): void {\n const { upstream } = this;\n\n if (this.destroyed || this.role !== \"forwarder\" || !upstream) {\n return;\n }\n\n // Read the config at each poll. A later configure() can turn remote sampling on or off.\n const ask = (): void => {\n if (this.config.sampling.remote) {\n upstream.post({ t: \"sampling?\", from: this.contextId });\n }\n };\n\n ask();\n this.rulesPoll = setInterval(ask, REMOTE_SAMPLING_POLL_MS);\n unrefTimer(this.rulesPoll);\n }\n}\n"],"mappings":"kMAkFA,SAAgBc,EAAS,EAAkC,CACzD,MAAO,CAAE,EAAGd,EAAAA,EAAc,EAAGe,CAAQ,CACvC,CAUA,SAAgBC,EAAO,EAAkC,CACvD,GAAI,OAAOC,GAAS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,SAAU,CAAC,CAE1D,EAEAC,EAAI,EACJ,KAAK,UAAY,YAAYA,EAAKnF,EAAAA,EAAuB,EACzDE,EAAA,EAAW,KAAK,SAAS,CAC3B,CACF"}
|
package/dist/capture/storm.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
/** Start of the current window, in epoch milliseconds. */
|
|
5
|
-
start: number;
|
|
6
|
-
/** Events counted in the current window. */
|
|
7
|
-
count: number;
|
|
8
|
-
}
|
|
2
|
+
import { type StormWindow } from "../utils/fixed-window";
|
|
3
|
+
export type { StormWindow } from "../utils/fixed-window";
|
|
9
4
|
/**
|
|
10
5
|
* Counts one event in a fixed window. It reports each event over the limit.
|
|
11
6
|
* @param window Window state to change.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./error-like-gGRx2s36.cjs"),t=require("./sanitize
|
|
2
|
-
//# sourceMappingURL=console-
|
|
1
|
+
const e=require("./error-like-gGRx2s36.cjs"),t=require("./sanitize--_e4oOPX.cjs"),n=require("./patch-BX8KrPCT.cjs"),r=require("./storm-DhHGHhOc.cjs");var i=[`error`,`warn`,`info`,`log`],a=[`error`,`warn`];function o(e,n){return(...r)=>{Reflect.apply(e,console,r),!t.a()&&n.record?.(r)}}var s=class{ctx;name=`console`;wrapped=new Map;installed=!1;window={start:0,count:0};constructor(e){this.ctx=e}install(){if(!(this.installed||typeof console>`u`)){this.installed=!0;for(let e of this.readMethods())this.wrap(e)}}uninstall(){if(this.installed){this.installed=!1;for(let[e,{target:t,restore:n}]of this.wrapped)t.record=null,!n()&&this.ctx.diagnostics.report(`capture.install_failed`,`Another script wrapped console.${e} after the library. The library leaves that wrapper in place.`);this.wrapped.clear()}}readMethods(){let e=this.ctx.config.capture.console;return e===!0?a:Array.isArray(e)&&e.every(e=>i.includes(e))?[...new Set(e)]:(this.ctx.diagnostics.report(`config.invalid`,`capture.console must be true, false or a list of "error", "warn", "info" and "log". The console capture is off.`),[])}wrap(e){let r={record:n=>{t.o(()=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a console.${e} call.`,()=>{this.record(e,n)})})}},i=n.t(console,e,e=>o(e,r));this.wrapped.set(e,{target:r,restore:i})}record(n,i){let a=i.findIndex(t=>e.r(t)),o=i.findIndex(e=>typeof e==`string`),s=i[a],c=i[o]??s?.message??`console.${n}`;if(n===`info`||n===`log`){this.ctx.breadcrumbs.push({t:Date.now(),category:`console`,message:t.i(c,200),data:{"console.method":n}});return}let{diagnostics:l,logger:u}=this.ctx;if(!r.t(this.window,20,l,`console records`))return;let d=n===`error`?[o,a]:[o],f=i.filter((e,t)=>!d.includes(t)),p={"console.method":n};f.length>0&&(p[`console.args`]=f),n===`warn`?u.warn(c,p):u.error(c,s,{...p,"error.captured_by":`console.error`})}};exports.ConsoleCapture=s;
|
|
2
|
+
//# sourceMappingURL=console-BSusX_M-.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-
|
|
1
|
+
{"version":3,"file":"console-BSusX_M-.cjs","names":["isLibraryConsole","patch","isErrorLike","truncate","allowInWindow","require_error_like","require_sanitize","require_patch","require_storm","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","value","restore","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls. Third-party code often reports a fault only to the console.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS, ERROR_STORM_MAX_PER_WINDOW } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Methods that the capture accepts. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** Record function of a wrapper. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** Target of a wrapper and the restore function of its patch. */\ninterface Wrapped {\n /** Target of the wrapper. */\n target: Target;\n /** Writes the original back if the method still holds the wrapper. Returns true then. */\n restore: () => boolean;\n}\n\n/**\n * Makes a wrapper that calls the original first, then the target.\n * The wrapper does not close over the capture. A wrapper that stays in place keeps no runtime.\n * @param original Method that was in place before the wrap.\n * @param target Target of the wrapper.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first. Devtools then shows the same text, also when a record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines that the library prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods. It records each call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that is not in this map calls only the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Prevents a second wrap on a wrapped method. */\n private installed = false;\n\n /** Rate limit of this capture. Console noise must not use the allowance of the error capture. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps each selected method. */\n install(): void {\n // Guard against a missing console. Some worker realms do not define it.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores each method that still holds the wrapper of this capture. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // A restore here removes the wrapper of the other script. Leave it. The wrapper of this\n // capture then calls only the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration. It reports a value that is not usable.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const value: unknown = this.ctx.config.capture.console;\n\n if (value === true) {\n return DEFAULT_METHODS;\n }\n\n if (\n Array.isArray(value) &&\n value.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(value as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true, false or a list of \"error\", \"warn\", \"info\" and \"log\". The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope stops a console call in the record path from a second capture.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method. Uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method Console method of the call.\n * @param args Arguments of the call.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing finds an error from another realm. That error fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (!allowInWindow(this.window, ERROR_STORM_MAX_PER_WINDOW, diagnostics, \"console records\")) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error in the arguments.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":"sJAcA,IAAMS,EAA4C,CAAC,QAAS,OAAQ,OAAQ,KAAK,EAG3EC,EAAoD,CAAC,QAAS,MAAM,EA0B1E,SAASC,EAAY,EAAqB,EAA2B,CACnE,OAAQ,GAAGC,IAAS,CAElB,QAAQ,MAAMC,EAAU,QAASD,CAAI,EAGjCZ,GAAAA,EAAiB,GAIrBc,EAAO,SAASF,CAAI,CACtB,CACF,CAGA,IAAaG,EAAb,KAA+C,CAgBhB,IAd7B,KAAgB,UAGhB,QAA2B,IAAI,IAG/B,UAAoB,GAGpB,OAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,EAK5D,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAEd,GAAI,OAAK,WAAa,OAAO,QAAY,KAGzC,MAAK,UAAY,GAEjB,IAAK,IAAMC,KAAU,KAAK,YAAY,EACpC,KAAK,KAAKA,CAAM,CAHD,CAKnB,CAGA,WAAkB,CAChB,GAAK,KAAK,UAGV,MAAK,UAAY,GAEjB,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,GAAM,CAAE,cAAa,UAAW,KAAK,IAErC,GAAI,CAACb,EAAAA,EAAc,KAAK,OAAA,GAAoCqB,EAAa,iBAAiB,EACxF,OAIF,IAAMC,EAAOT,IAAW,QAAU,CAACK,EAAQF,CAAO,EAAI,CAACE,CAAM,EACvDK,EAAOf,EAAK,QAAQ,EAAG,IAAU,CAACc,EAAK,SAASE,CAAK,CAAC,EACtDC,EAAiC,CAAE,iBAAkBZ,CAAO,EAE9DU,EAAK,OAAS,IAChB,EAAM,gBAAkBA,GAGtBV,IAAW,OACba,EAAO,KAAKN,EAASK,CAAK,EAI5BC,EAAO,MAAMN,EAASD,EAAO,CAAE,GAAGM,EAAO,oBAAqB,eAAgB,CAAC,CACjF,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as e } from "./error-like-Ywo5uRHo.js";
|
|
2
|
-
import { a as t, i as n, o as r } from "./sanitize-
|
|
2
|
+
import { a as t, i as n, o as r } from "./sanitize-DP0xDPrt.js";
|
|
3
3
|
import { t as i } from "./patch-CCWfuEY7.js";
|
|
4
|
-
import { t as a } from "./storm-
|
|
4
|
+
import { t as a } from "./storm-OD5J6Ylm.js";
|
|
5
5
|
//#region src/capture/console.ts
|
|
6
6
|
var o = [
|
|
7
7
|
"error",
|
|
@@ -79,4 +79,4 @@ var l = class {
|
|
|
79
79
|
//#endregion
|
|
80
80
|
export { l as ConsoleCapture };
|
|
81
81
|
|
|
82
|
-
//# sourceMappingURL=console-
|
|
82
|
+
//# sourceMappingURL=console-Dv5GfaNn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-
|
|
1
|
+
{"version":3,"file":"console-Dv5GfaNn.js","names":["isErrorLike","isLibraryConsole","truncate","runAsLibraryConsole","patch","allowInWindow","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","value","restore","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls. Third-party code often reports a fault only to the console.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS, ERROR_STORM_MAX_PER_WINDOW } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Methods that the capture accepts. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** Record function of a wrapper. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** Target of a wrapper and the restore function of its patch. */\ninterface Wrapped {\n /** Target of the wrapper. */\n target: Target;\n /** Writes the original back if the method still holds the wrapper. Returns true then. */\n restore: () => boolean;\n}\n\n/**\n * Makes a wrapper that calls the original first, then the target.\n * The wrapper does not close over the capture. A wrapper that stays in place keeps no runtime.\n * @param original Method that was in place before the wrap.\n * @param target Target of the wrapper.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first. Devtools then shows the same text, also when a record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines that the library prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods. It records each call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that is not in this map calls only the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Prevents a second wrap on a wrapped method. */\n private installed = false;\n\n /** Rate limit of this capture. Console noise must not use the allowance of the error capture. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps each selected method. */\n install(): void {\n // Guard against a missing console. Some worker realms do not define it.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores each method that still holds the wrapper of this capture. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // A restore here removes the wrapper of the other script. Leave it. The wrapper of this\n // capture then calls only the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration. It reports a value that is not usable.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const value: unknown = this.ctx.config.capture.console;\n\n if (value === true) {\n return DEFAULT_METHODS;\n }\n\n if (\n Array.isArray(value) &&\n value.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(value as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true, false or a list of \"error\", \"warn\", \"info\" and \"log\". The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope stops a console call in the record path from a second capture.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method. Uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method Console method of the call.\n * @param args Arguments of the call.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing finds an error from another realm. That error fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (!allowInWindow(this.window, ERROR_STORM_MAX_PER_WINDOW, diagnostics, \"console records\")) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error in the arguments.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":";;;;;AAcA,IAAMM,IAA4C;CAAC;CAAS;CAAQ;CAAQ;AAAK,GAG3EC,IAAoD,CAAC,SAAS,MAAM;AA0B1E,SAASC,EAAY,GAAqB,GAA2B;CACnE,QAAQ,GAAGC,MAAS;EAKlB,AAHA,QAAQ,MAAMC,GAAU,SAASD,CAAI,GAGjC,GAAiB,KAIrBE,EAAO,SAASF,CAAI;CACtB;AACF;AAGA,IAAaG,IAAb,MAA+C;CAgBhB;CAd7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C,GAClDC,IAASV,EAAK,WAAW,MAAQ,OAAOS,KAAQ,QAAQ,GACxDE,IAAQX,EAAKQ,IACbI,IAAWZ,EAAKU,MAAkCC,GAAO,WAAW,WAAWN;EAErF,IAAIA,MAAW,UAAUA,MAAW,OAAO;GACzC,KAAK,IAAI,YAAY,KAAK;IACxB,GAAG,KAAK,IAAI;IACZ,UAAU;IACV,SAASZ,EAASmB,GAAA,GAAqC;IACvD,MAAM,EAAE,kBAAkBP,EAAO;GACnC,CAAC;GACD;EACF;EAEA,IAAM,EAAE,gBAAa,cAAW,KAAK;EAErC,IAAI,CAACT,EAAc,KAAK,QAAA,IAAoCiB,GAAa,iBAAiB,GACxF;EAIF,IAAMC,IAAOT,MAAW,UAAU,CAACK,GAAQF,CAAO,IAAI,CAACE,CAAM,GACvDK,IAAOf,EAAK,QAAQ,GAAG,MAAU,CAACc,EAAK,SAASE,CAAK,CAAC,GACtDC,IAAiC,EAAE,kBAAkBZ,EAAO;EAMlE,AAJIU,EAAK,SAAS,MAChB,EAAM,kBAAkBA,IAGtBV,MAAW,SACba,EAAO,KAAKN,GAASK,CAAK,IAI5BC,EAAO,MAAMN,GAASD,GAAO;GAAE,GAAGM;GAAO,qBAAqB;EAAgB,CAAC;CACjF;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ee=/OpenFin/i,te=/\bwv\b/,ne=/\b(iPhone|iPad|iPod)\b/,re=/\bMacintosh\b/,ie=/\bMobile\b/,e={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17,FATAL:21},t=e,n=`log.type`,r=`log.seq`,i=`app.namespace`,a=`page.url`,o=`url.full`,s=`journey.id`,c=`journey.name`,l=`journey.parent_id`,u=`uiobs.sanitize_failed`,d=`error.data`,f=`breadcrumbs`,p=`uiobs.attributes_dropped`,m=`uiobs.attributes_bytes`,h=`service.name`,g=`service.version`,_=`deployment.environment`,v=`telemetry.sdk.name`,y=`telemetry.sdk.version`,b=`telemetry.sdk.language`,x=`host.platform`,S=`session.id`,C=`tab.id`,w=`context.id`,T=`browser.user_agent`,E=`openfin.uuid`,D=`openfin.name`,O=`@utk09/ui-observability`,k=`0.9.2`,A=`webjs`,j=`otlp`,M={WARN:`warning`},N=`application/json`,P=`application/x-ndjson`,F=1000000n,I=/^\d+$/,L=`Content-Type`,R=`Content-Encoding`,z=`Retry-After`,B=`X-UiObs-Batch-Id`,V=`X-UiObs-Attempt`,H=`X-UiObs-Sampling`,U=`gzip`,W=1e3,G=6e4,K=`text/plain;charset=UTF-8`,q=`uiobs_batch_id`,J=`uiobs_exit`,Y=`ui-observability.batch.`,ae=`ui-observability.emergency.`,oe=`ui-observability.probe`,se=`QuotaExceededError`,ce=`batches`,le=`createdAt`,ue=`indexeddb`,de=`localstorage`,fe=`memory`,pe=`none`,X=`ui-observability.drain`,me=`ui-observability.emergency`,he=`ui-observability.journey`,ge=2e3,_e=`uiObsJourney`,ve=/\+/g,ye=/\//g,be=/=+$/,xe=/-/g,Se=/_/g,Ce=3e5,we=`traceparent`,Te=2166136261,Ee=16777619,De=4294967295,Oe=[`action`,`metric`],ke=`metric`,Ae=`action`,je=`ui-observability/1`,Me=`ui-observability.runtime`,Ne=`ui-observability.stopped`,Pe=`ui-observability.request-scope`,Fe=`ui-observability.console-scope`,Ie=`ui-observability.transport-calls`,Le=1e4,Z={namespace:`color:#888`,TRACE:`color:#888;font-weight:bold`,DEBUG:`color:#888;font-weight:bold`,INFO:`color:#1e6fd9;font-weight:bold`,WARN:`color:#c77700;font-weight:bold`,ERROR:`color:#d32f2f;font-weight:bold`,FATAL:`color:#d32f2f;font-weight:bold`},Re=1e3,ze=6e4,Be=`uiobs.capture`,Ve=`uiobs.storage`,He=`count`,Ue=`uiobs.metrics`,We=`otel.metric.overflow`,Ge=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],Ke={start:`metric.start_time_unix_nano`,attributeKeys:`metric.attribute_keys`,count:`metric.count`,sum:`metric.sum`,min:`metric.min`,max:`metric.max`,bounds:`metric.bounds`,buckets:`metric.bucket_counts`},qe=`unknown-service`,Je=4096,Ye=36e5,Xe=3e4,Ze=[`redact`,`onDiagnostic`,`onDrop`,`headers`,`serializer`,`otelLoader`,`transport`,`transportOnExit`],Qe=[`sampling`,`bus`,`journey`,`batching`,`retention`,`limits`,`capture`],$e={sampling:[],bus:[],journey:[],batching:[],retention:[],limits:[],capture:[`webVitalsLoader`]},et=`DEBUG`,tt=2e3,nt=1e4,rt=15e3,it=1024,at=`UiObservability`,ot={maxBatches:500,maxAgeMs:864e5,maxAttempts:5},st=1e4,ct=2e3,lt=6e4,ut=3e4,Q=18e5,dt=`__uiobs_journey`,ft=`ui_observability_control`,pt=1500,mt=2e3,ht=5e3,$={maxBodyChars:4096,maxAttributeChars:8192,maxAttributeCount:128,maxStackChars:8192,maxDepth:6,maxArrayLength:100,maxNodes:1e4,maxRecordBytes:32768},gt={endpoint:``,metricsEndpoint:``,serviceName:``,serviceVersion:``,environment:``,enabled:!0,minLevel:`INFO`,compression:`gzip`,credentials:`omit`,storage:`auto`,identity:`storage`,sampling:{defaultRate:1,rates:{},alwaysSampleTypes:[`action`],remote:!1,remoteMaxRate:1},bus:{mode:`auto`,trustedOrigins:[],openFinRole:`auto`},journey:{scope:`auto`,maxAgeMs:Q},batching:{logFlushIntervalMs:tt,logBatchSize:100,metricFlushIntervalMs:nt,metricBatchSize:500},retention:{mode:`limited`,...ot},limits:{...$},capture:{errors:!0,rejections:!0,resourceErrors:!1,fetch:!1,xhr:!1,httpMetrics:!0,interactions:!1,navigation:!1,webVitals:!1,longFrames:!1,longFrameThresholdMs:100,console:!1,fullUrls:!1,ignoreUrls:[],propagateTraceHeaderTo:[]},console:{level:null,styles:Z}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return`Safari/`}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(exports,"Cn",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return 1e3}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"Sn",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(exports,"Tn",{enumerable:!0,get:function(){return`AppleWebKit`}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"_n",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"bn",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"dn",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"fn",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return`[ui-observability]`}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"gn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"hn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"ln",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"mn",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return`ui-observability.session`}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return 55296}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"pn",{enumerable:!0,get:function(){return`ui-observability.tab`}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return 6e4}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return 18e5}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return 56319}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"un",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"vn",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(exports,"wn",{enumerable:!0,get:function(){return 2048}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"xn",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"yn",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return D}});
|
|
2
|
-
//# sourceMappingURL=constants-
|
|
1
|
+
var ee=/OpenFin/i,te=/\bwv\b/,ne=/\b(iPhone|iPad|iPod)\b/,re=/\bMacintosh\b/,ie=/\bMobile\b/,e={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17,FATAL:21},t=e,n=`log.type`,r=`log.seq`,i=`app.namespace`,a=`page.url`,o=`url.full`,s=`journey.id`,c=`journey.name`,l=`journey.parent_id`,u=`uiobs.sanitize_failed`,d=`error.data`,f=`breadcrumbs`,p=`uiobs.attributes_dropped`,m=`uiobs.attributes_bytes`,h=`service.name`,g=`service.version`,_=`deployment.environment`,v=`telemetry.sdk.name`,y=`telemetry.sdk.version`,b=`telemetry.sdk.language`,x=`host.platform`,S=`session.id`,C=`tab.id`,w=`context.id`,T=`browser.user_agent`,E=`openfin.uuid`,D=`openfin.name`,O=`@utk09/ui-observability`,k=`0.9.3`,A=`webjs`,j=`otlp`,M={WARN:`warning`},N=`application/json`,P=`application/x-ndjson`,F=1000000n,I=/^\d+$/,L=`Content-Type`,R=`Content-Encoding`,z=`Retry-After`,B=`X-UiObs-Batch-Id`,V=`X-UiObs-Attempt`,H=`X-UiObs-Sampling`,U=`gzip`,W=1e3,G=6e4,K=`text/plain;charset=UTF-8`,q=`uiobs_batch_id`,J=`uiobs_exit`,Y=`ui-observability.batch.`,ae=`ui-observability.emergency.`,oe=`ui-observability.probe`,se=`QuotaExceededError`,ce=`batches`,le=`createdAt`,ue=`indexeddb`,de=`localstorage`,fe=`memory`,pe=`none`,X=`ui-observability.drain`,me=`ui-observability.emergency`,he=`ui-observability.journey`,ge=2e3,_e=`uiObsJourney`,ve=/\+/g,ye=/\//g,be=/=+$/,xe=/-/g,Se=/_/g,Ce=3e5,we=`traceparent`,Te=2166136261,Ee=16777619,De=4294967295,Oe=[`action`,`metric`],ke=`metric`,Ae=`action`,je=`ui-observability/1`,Me=`ui-observability.runtime`,Ne=`ui-observability.stopped`,Pe=`ui-observability.request-scope`,Fe=`ui-observability.console-scope`,Ie=`ui-observability.transport-calls`,Le=1e4,Z={namespace:`color:#888`,TRACE:`color:#888;font-weight:bold`,DEBUG:`color:#888;font-weight:bold`,INFO:`color:#1e6fd9;font-weight:bold`,WARN:`color:#c77700;font-weight:bold`,ERROR:`color:#d32f2f;font-weight:bold`,FATAL:`color:#d32f2f;font-weight:bold`},Re=1e3,ze=6e4,Be=`uiobs.capture`,Ve=`uiobs.storage`,He=`count`,Ue=`uiobs.metrics`,We=`otel.metric.overflow`,Ge=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],Ke={start:`metric.start_time_unix_nano`,attributeKeys:`metric.attribute_keys`,count:`metric.count`,sum:`metric.sum`,min:`metric.min`,max:`metric.max`,bounds:`metric.bounds`,buckets:`metric.bucket_counts`},qe=`unknown-service`,Je=4096,Ye=36e5,Xe=3e4,Ze=[`redact`,`onDiagnostic`,`onDrop`,`headers`,`serializer`,`otelLoader`,`transport`,`transportOnExit`],Qe=[`sampling`,`bus`,`journey`,`batching`,`retention`,`limits`,`capture`],$e={sampling:[],bus:[],journey:[],batching:[],retention:[],limits:[],capture:[`webVitalsLoader`]},et=`DEBUG`,tt=2e3,nt=1e4,rt=15e3,it=1024,at=`UiObservability`,ot={maxBatches:500,maxAgeMs:864e5,maxAttempts:5},st=1e4,ct=2e3,lt=6e4,ut=3e4,Q=18e5,dt=`__uiobs_journey`,ft=`ui_observability_control`,pt=1500,mt=2e3,ht=5e3,$={maxBodyChars:4096,maxAttributeChars:8192,maxAttributeCount:128,maxStackChars:8192,maxDepth:6,maxArrayLength:100,maxNodes:1e4,maxRecordBytes:32768},gt={endpoint:``,metricsEndpoint:``,serviceName:``,serviceVersion:``,environment:``,enabled:!0,minLevel:`INFO`,compression:`gzip`,credentials:`omit`,storage:`auto`,identity:`storage`,sampling:{defaultRate:1,rates:{},alwaysSampleTypes:[`action`],remote:!1,remoteMaxRate:1},bus:{mode:`auto`,trustedOrigins:[],openFinRole:`auto`},journey:{scope:`auto`,maxAgeMs:Q},batching:{logFlushIntervalMs:tt,logBatchSize:100,metricFlushIntervalMs:nt,metricBatchSize:500},retention:{mode:`limited`,...ot},limits:{...$},capture:{errors:!0,rejections:!0,resourceErrors:!1,fetch:!1,xhr:!1,httpMetrics:!0,interactions:!1,navigation:!1,webVitals:!1,longFrames:!1,longFrameThresholdMs:100,console:!1,fullUrls:!1,ignoreUrls:[],propagateTraceHeaderTo:[]},console:{level:null,styles:Z}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return`Safari/`}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(exports,"Cn",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return 1e3}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"Sn",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(exports,"Tn",{enumerable:!0,get:function(){return`AppleWebKit`}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"_n",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"bn",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"dn",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"fn",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return`[ui-observability]`}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"gn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"hn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"ln",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"mn",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return`ui-observability.session`}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return 55296}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"pn",{enumerable:!0,get:function(){return`ui-observability.tab`}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return 6e4}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return 18e5}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return 56319}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"un",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"vn",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(exports,"wn",{enumerable:!0,get:function(){return 2048}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"xn",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"yn",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return D}});
|
|
2
|
+
//# sourceMappingURL=constants-Cb92egPS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-Cb92egPS.cjs","names":["OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","SEVERITY_NUMBER","LEVEL_ORDER","ATTR_LOG_TYPE","ATTR_LOG_SEQ","ATTR_APP_NAMESPACE","ATTR_PAGE_URL","ATTR_URL_FULL","ATTR_JOURNEY_ID","ATTR_JOURNEY_NAME","ATTR_JOURNEY_PARENT_ID","ATTR_SANITIZE_FAILED","ATTR_ERROR_DATA","ATTR_BREADCRUMBS","ATTR_ATTRIBUTES_DROPPED","ATTR_ATTRIBUTES_BYTES","RESOURCE_SERVICE_NAME","RESOURCE_SERVICE_VERSION","RESOURCE_DEPLOYMENT_ENVIRONMENT","RESOURCE_TELEMETRY_SDK_NAME","RESOURCE_TELEMETRY_SDK_VERSION","RESOURCE_TELEMETRY_SDK_LANGUAGE","RESOURCE_HOST_PLATFORM","RESOURCE_SESSION_ID","RESOURCE_TAB_ID","RESOURCE_CONTEXT_ID","RESOURCE_BROWSER_USER_AGENT","RESOURCE_OPENFIN_UUID","RESOURCE_OPENFIN_NAME","TELEMETRY_SDK_NAME","TELEMETRY_SDK_VERSION","TELEMETRY_SDK_LANGUAGE","SERIALIZER_NAME_OTLP","ECS_LEVEL_NAMES","CONTENT_TYPE_JSON","CONTENT_TYPE_NDJSON","NANOS_PER_MILLI","NANOS_PATTERN","HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_RETRY_AFTER","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","ENCODING_GZIP","MILLIS_PER_SECOND","BEACON_LIMIT_BYTES","CONTENT_TYPE_TEXT_PLAIN","QUERY_PARAM_BATCH_ID","QUERY_PARAM_EXIT_REASON","BATCH_STORAGE_KEY_PREFIX","EMERGENCY_STORAGE_KEY_PREFIX","STORAGE_PROBE_KEY","QUOTA_EXCEEDED_ERROR","INDEXEDDB_STORE_NAME","INDEXEDDB_CREATED_AT_INDEX","STORAGE_NAME_INDEXEDDB","STORAGE_NAME_LOCAL","STORAGE_NAME_MEMORY","STORAGE_NAME_NONE","DRAIN_LOCK_NAME","EMERGENCY_LOCK_NAME","JOURNEY_STORAGE_KEY","OPENFIN_OPTIONS_TIMEOUT_MS","OPENFIN_JOURNEY_CUSTOM_DATA_KEY","BASE64_PLUS_PATTERN","BASE64_SLASH_PATTERN","BASE64_PADDING_PATTERN","BASE64URL_DASH_PATTERN","BASE64URL_UNDERSCORE_PATTERN","TRACE_MAX_AGE_MS","TRACEPARENT_HEADER","FNV_OFFSET_BASIS","FNV_PRIME","UINT32_MAX","LEVEL_BYPASS_TYPES","LOG_TYPE_METRIC","LOG_TYPE_ACTION","BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","TRANSPORT_CALL_KEY","ERROR_STORM_WINDOW_MS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DEFAULT_METRIC_UNIT","METRIC_NAMESPACE","ATTR_METRIC_OVERFLOW","METRIC_DEFAULT_BOUNDARIES","METRIC_KEYS","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","CONSOLE_DEFAULT_LEVEL","LOG_FLUSH_INTERVAL_MS","METRIC_FLUSH_INTERVAL_MS","REQUEST_TIMEOUT_MS","COMPRESSION_THRESHOLD_BYTES","STORAGE_DB_NAME","STORAGE_LIMITS","STORAGE_DEADLINE_MS","RETRY_BASE_DELAY_MS","RETRY_MAX_DELAY_MS","RETRY_IDLE_DELAY_MS","JOURNEY_MAX_AGE_MS","JOURNEY_URL_PARAM","BUS_CHANNEL_NAME","BUS_HANDSHAKE_TIMEOUT_MS","BUS_MAX_BOOT_BUFFER_ACTIONS","ERROR_DEDUPE_MS","RECORD_LIMITS","DEFAULT_CONFIG"],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// Defines all limits, thresholds, timing windows, storage keys, patterns, and\n// defaults that the library uses.\n\nimport type { ConsoleStyles, 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/**\n * Throttle window for each diagnostic code, in milliseconds. It limits how often an error\n * loop calls the handler.\n */\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 * Maps each log level to its 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 that records carry in the payload. The names\n// follow OpenTelemetry conventions. The `uiobs.` prefix marks the fields of this library.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number in its context. It starts at 1. */\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 library built the record. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.\n * The page URL overwrites the request target under that key.\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/** Own fields of an Error reason, or the whole reason when it is not an Error. */\nexport const ATTR_ERROR_DATA = \"error.data\";\n\n/** Breadcrumb history of an error record. */\nexport const ATTR_BREADCRUMBS = \"breadcrumbs\";\n\n/**\n * Marks a record when the library drops its attributes because they exceed 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`. The build writes the version of package.json here.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = __UIOBS_VERSION__;\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 lowercase severity text. ECS spells\n * the warning level in full. All other levels match in lowercase.\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 in decimal digits, for example \"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/** Response header that carries sampling rules from the ingest server. */\nexport const HEADER_SAMPLING = \"X-UiObs-Sampling\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** Lowest valid HTTP status code. */\nexport const HTTP_STATUS_MIN = 100;\n\n/** Highest valid HTTP status code. */\nexport const HTTP_STATUS_MAX = 599;\n\n/** Lowest HTTP status code that accepts a batch. */\nexport const HTTP_SUCCESS_MIN = 200;\n\n/** Lowest HTTP status code above the success range. */\nexport const HTTP_SUCCESS_END = 300;\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. The transport can retry. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large. The transport must split the batch. */\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. It is CORS-safelisted and does not cause 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 stored 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 that exit flush stores. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Maximum number of exit batches in the emergency queue. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key that the library writes to test if localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store to evict 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. Dexie, the previous adapter, opened the\n * same database at ten times its declared version. A version below 11 makes open()\n * fail with VersionError for an existing installation. Then no code can read the\n * batches in that database.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 11;\n\n/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */\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/** Name of the storage adapter that keeps nothing. */\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. It rejects an oversized token. It does not\n * validate the token content.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the\n * runtime continues without a seeded journey.\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. The sampler uses them to change a sampling key into a\n// stable 0-1 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 * Types that minLevel does not drop. An action is an audit fact and a metric is a measurement.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n/** Record kind of an audit fact. Storage and the hold buffers drop it last. */\nexport const LOG_TYPE_ACTION: LogType = \"action\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */\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/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */\nexport const RUNTIME_STOPPED_KEY = \"ui-observability.stopped\";\n\n/** Global symbol key of the library request scope count. All library copies on a page share it. */\nexport const LIBRARY_REQUEST_KEY = \"ui-observability.request-scope\";\n\n/** Global symbol key of the library console scope count. All library copies on a page share it. */\nexport const LIBRARY_CONSOLE_KEY = \"ui-observability.console-scope\";\n\n/** Global symbol key of the count of custom transport calls that wait for an answer. */\nexport const TRANSPORT_CALL_KEY = \"ui-observability.transport-calls\";\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 that the pipeline admits in each storm window.\n * It is a safety limit for a render loop. It does not shape normal traffic.\n * ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\n\n/** Default minimum duration of a long frame that the library records, in milliseconds. */\nexport const LONG_FRAME_THRESHOLD_MS = 100;\n\n/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */\nexport const LONG_FRAME_MAX_PER_WINDOW = 20;\n\n/** Maximum character length of a console breadcrumb message. */\nexport const CONSOLE_BREADCRUMB_MAX_CHARS = 200;\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/** Default CSS of the console prefix. The colors are readable on light and dark devtools. */\nexport const CONSOLE_DEFAULT_STYLES: Readonly<Required<ConsoleStyles>> = {\n namespace: \"color:#888\",\n TRACE: \"color:#888;font-weight:bold\",\n DEBUG: \"color:#888;font-weight:bold\",\n INFO: \"color:#1e6fd9;font-weight:bold\",\n WARN: \"color:#c77700;font-weight:bold\",\n ERROR: \"color:#d32f2f;font-weight:bold\",\n FATAL: \"color:#d32f2f;font-weight:bold\",\n};\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/** Measurement unit that the library uses when the call gives no unit. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n/** Namespace of the points that the counter and histogram instruments give. */\nexport const METRIC_NAMESPACE = \"uiobs.metrics\";\n\n/** Maximum attribute sets of one instrument in one interval. More sets go to one overflow set. */\nexport const METRIC_MAX_SERIES = 100;\n\n/** Maximum bucket boundaries of one histogram. More boundaries make a large point. */\nexport const METRIC_MAX_BOUNDARIES = 50;\n\n/** Attribute of the overflow set. OpenTelemetry uses the same key. */\nexport const ATTR_METRIC_OVERFLOW = \"otel.metric.overflow\";\n\n/** Default histogram boundaries. They are the OpenTelemetry default boundaries. */\nexport const METRIC_DEFAULT_BOUNDARIES: readonly number[] = [\n 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000,\n];\n\n/**\n * Attribute keys of an aggregated metric point. The OTLP metrics serializer reads them.\n * Sampling keeps each record with a start time. A sample of a sum gives a false sum.\n */\nexport const METRIC_KEYS = {\n start: \"metric.start_time_unix_nano\",\n attributeKeys: \"metric.attribute_keys\",\n count: \"metric.count\",\n sum: \"metric.sum\",\n min: \"metric.min\",\n max: \"metric.max\",\n bounds: \"metric.bounds\",\n buckets: \"metric.bucket_counts\",\n} as const;\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/** Version of the remote sampling rules that the library accepts. */\nexport const REMOTE_SAMPLING_VERSION = 1;\n\n/** Maximum length of the sampling header, in characters. */\nexport const REMOTE_SAMPLING_MAX_CHARS = 4096;\n\n/** Maximum time that remote sampling rules stay in force, in milliseconds. */\nexport const REMOTE_SAMPLING_MAX_TTL_MS = 60 * 60 * 1000;\n\n/** Maximum namespace rates in one set of remote sampling rules. */\nexport const REMOTE_SAMPLING_MAX_RATES = 100;\n\n/** Time between two requests of a forwarder for the remote sampling rules, in milliseconds. */\nexport const REMOTE_SAMPLING_POLL_MS = 30_000;\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 \"onDrop\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n \"transport\",\n \"transportOnExit\",\n] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\n \"sampling\",\n \"bus\",\n \"journey\",\n \"batching\",\n \"retention\",\n \"limits\",\n \"capture\",\n] 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 journey: [],\n batching: [],\n retention: [],\n limits: [],\n capture: [\"webVitalsLoader\"],\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 the pipeline sends it, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch. At this count, the pipeline sends the batch early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/**\n * Max time a partial metric batch waits before the pipeline sends it, in milliseconds.\n * Metric batches wait longer than log batches. Metrics have a higher volume, and no\n * caller waits for them.\n */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch. At this count, the pipeline sends the batch 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 for one ingest request, in milliseconds. Then the transport aborts and retries it. */\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 for one storage call, in milliseconds. Then the library treats the call as failed.\n * A call that does not settle keeps 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, in milliseconds. Then the library treats it as abandoned. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** True if the journey ends for all contexts when the owning context closes. */\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 that are not actions in one hold buffer. A full buffer drops the oldest. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max action records in one hold buffer. Actions have their own cap. A log storm cannot push one out. */\nexport const BUS_MAX_BOOT_BUFFER_ACTIONS = 2000;\n\n/** Max different values in each list of an onDrop summary. */\nexport const DROP_SUMMARY_MAX_ITEMS = 20;\n\n/** Max characters of an untrusted message type in a diagnostic detail. The sender sets the text. */\nexport const BUS_TYPE_DETAIL_MAX_CHARS = 32;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/**\n * Time window in which the library counts identical errors but does not send them again,\n * in milliseconds.\n */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps for every record. The library applies them 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\n// ----------------------------------\n// Config defaults\n// ----------------------------------\n\n/**\n * Default runtime config before the consumer calls `configure()`. It excludes `serializer`.\n * `resolveConfig` supplies that default to prevent a circular import.\n * It comes after the constants that it reads. A const cannot be read before its line.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n metricsEndpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n compression: \"gzip\",\n credentials: \"omit\",\n storage: \"auto\",\n identity: \"storage\",\n sampling: {\n defaultRate: 1,\n rates: {},\n alwaysSampleTypes: [\"action\"],\n remote: false,\n remoteMaxRate: 1,\n },\n bus: { mode: \"auto\", trustedOrigins: [], openFinRole: \"auto\" },\n journey: { scope: \"auto\", maxAgeMs: JOURNEY_MAX_AGE_MS },\n batching: {\n logFlushIntervalMs: LOG_FLUSH_INTERVAL_MS,\n logBatchSize: LOG_BATCH_SIZE,\n metricFlushIntervalMs: METRIC_FLUSH_INTERVAL_MS,\n metricBatchSize: METRIC_BATCH_SIZE,\n },\n retention: { mode: \"limited\", ...STORAGE_LIMITS },\n limits: { ...RECORD_LIMITS },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n httpMetrics: true,\n interactions: false,\n navigation: false,\n webVitals: false,\n longFrames: false,\n longFrameThresholdMs: LONG_FRAME_THRESHOLD_MS,\n console: false,\n fullUrls: false,\n ignoreUrls: [],\n propagateTraceHe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: 21
|
|
9
|
-
}, f = d, p = "log.type", m = "log.seq", h = "app.namespace", g = "page.url", _ = "url.full", v = "journey.id", y = "journey.name", b = "journey.parent_id", x = "uiobs.sanitize_failed", S = "error.data", C = "breadcrumbs", w = "uiobs.attributes_dropped", T = "uiobs.attributes_bytes", E = "service.name", D = "service.version", O = "deployment.environment", k = "telemetry.sdk.name", A = "telemetry.sdk.version", j = "telemetry.sdk.language", M = "host.platform", N = "session.id", P = "tab.id", F = "context.id", I = "browser.user_agent", L = "openfin.uuid", R = "openfin.name", z = "@utk09/ui-observability", B = "0.9.
|
|
9
|
+
}, f = d, p = "log.type", m = "log.seq", h = "app.namespace", g = "page.url", _ = "url.full", v = "journey.id", y = "journey.name", b = "journey.parent_id", x = "uiobs.sanitize_failed", S = "error.data", C = "breadcrumbs", w = "uiobs.attributes_dropped", T = "uiobs.attributes_bytes", E = "service.name", D = "service.version", O = "deployment.environment", k = "telemetry.sdk.name", A = "telemetry.sdk.version", j = "telemetry.sdk.language", M = "host.platform", N = "session.id", P = "tab.id", F = "context.id", I = "browser.user_agent", L = "openfin.uuid", R = "openfin.name", z = "@utk09/ui-observability", B = "0.9.3", V = "webjs", H = "otlp", U = { WARN: "warning" }, W = "application/json", G = "application/x-ndjson", K = 1000000n, q = /^\d+$/, J = "Content-Type", Y = "Content-Encoding", ae = "Retry-After", oe = "X-UiObs-Batch-Id", se = "X-UiObs-Attempt", ce = "X-UiObs-Sampling", le = "gzip", ue = 1e3, de = 6e4, fe = "text/plain;charset=UTF-8", pe = "uiobs_batch_id", me = "uiobs_exit", he = "ui-observability.batch.", ge = "ui-observability.emergency.", _e = "ui-observability.probe", ve = "QuotaExceededError", ye = "batches", be = "createdAt", xe = "indexeddb", Se = "localstorage", Ce = "memory", we = "none", Te = "ui-observability.drain", X = "ui-observability.emergency", Ee = "ui-observability.journey", De = 2e3, Oe = "uiObsJourney", ke = /\+/g, Ae = /\//g, je = /=+$/, Me = /-/g, Ne = /_/g, Pe = 3e5, Fe = "traceparent", Ie = 2166136261, Le = 16777619, Re = 4294967295, ze = ["action", "metric"], Be = "metric", Ve = "action", He = "ui-observability/1", Ue = "ui-observability.runtime", We = "ui-observability.stopped", Ge = "ui-observability.request-scope", Ke = "ui-observability.console-scope", qe = "ui-observability.transport-calls", Je = 1e4, Z = {
|
|
10
10
|
namespace: "color:#888",
|
|
11
11
|
TRACE: "color:#888;font-weight:bold",
|
|
12
12
|
DEBUG: "color:#888;font-weight:bold",
|
|
@@ -141,4 +141,4 @@ var ee = "[ui-observability]", te = 1e3, e = "ui-observability.session", ne = "u
|
|
|
141
141
|
//#endregion
|
|
142
142
|
export { ae as $, s as $t, dt as A, $ as At, U as B, L as Bt, Ct as C, it as Cn, K as Ct, Ze as D, pe as Dt, He as E, t as Et, Dt as F, I as Ft, Je as G, j as Gt, ge as H, D as Ht, $e as I, F as It, Xe as J, yt as Jt, Ie as K, k as Kt, te as L, O as Lt, W as M, ot as Mt, G as N, st as Nt, ht as O, me as Ot, fe as P, mt as Pt, J as Q, We as Qt, Te as R, M as Rt, de as S, ut as Sn, q as St, Tt as T, o as Tn, De as Tt, le as U, N as Ut, X as V, E as Vt, Et as W, P as Wt, oe as X, bt as Xt, se as Y, xt as Yt, Y as Z, Ue as Zt, Ne as _, Fe as _n, nt as _t, C as a, gt as an, r as at, Ae as b, Re as bn, ue as bt, y as c, xe as cn, St as ct, p as d, we as dn, Ke as dt, H as en, ce as et, tt as f, _e as fn, ee as ft, Me as g, B as gn, i as gt, _ as h, z as hn, Be as ht, w as i, d as in, ye as it, Z as j, at as jt, lt as k, ve as kt, b as l, Se as ln, ze as lt, x as m, V as mn, Ve as mt, h as n, e as nn, c as nt, S as o, vt as on, Q as ot, g as p, ne as pn, Ge as pt, Le as q, A as qt, T as r, ie as rn, be as rt, v as s, Qe as sn, Ee as st, n as t, re as tn, l as tt, m as u, Ce as un, f as ut, je as v, Pe as vn, rt as vt, wt as w, u as wn, Oe as wt, he as x, ct as xn, a as xt, ke as y, qe as yn, et as yt, Ye as z, R as zt };
|
|
143
143
|
|
|
144
|
-
//# sourceMappingURL=constants-
|
|
144
|
+
//# sourceMappingURL=constants-DhH6VI5a.js.map
|