@utk09/ui-observability 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +108 -33
  3. package/dist/{batch-D5qvsMQ_.cjs → batch-C4oF6XZT.cjs} +2 -2
  4. package/dist/{batch-D5qvsMQ_.cjs.map → batch-C4oF6XZT.cjs.map} +1 -1
  5. package/dist/{batch-DDgxg16_.js → batch-D-4xl7op.js} +4 -4
  6. package/dist/{batch-DDgxg16_.js.map → batch-D-4xl7op.js.map} +1 -1
  7. package/dist/{bus-C6RwKzPW.js → bus-Cyvq-Ngx.js} +5 -5
  8. package/dist/{bus-C6RwKzPW.js.map → bus-Cyvq-Ngx.js.map} +1 -1
  9. package/dist/{bus-WPVDFw2y.cjs → bus-rOhVuRee.cjs} +2 -2
  10. package/dist/{bus-WPVDFw2y.cjs.map → bus-rOhVuRee.cjs.map} +1 -1
  11. package/dist/capture/network.d.ts +1 -0
  12. package/dist/capture/types.d.ts +3 -0
  13. package/dist/capture/web-socket.d.ts +40 -0
  14. package/dist/{console-Dv5GfaNn.js → console-BT7mcgU6.js} +3 -3
  15. package/dist/{console-Dv5GfaNn.js.map → console-BT7mcgU6.js.map} +1 -1
  16. package/dist/{console-BSusX_M-.cjs → console-Boqa7new.cjs} +2 -2
  17. package/dist/{console-BSusX_M-.cjs.map → console-Boqa7new.cjs.map} +1 -1
  18. package/dist/constants-BgRS6MB0.cjs +2 -0
  19. package/dist/constants-BgRS6MB0.cjs.map +1 -0
  20. package/dist/constants-L_d5YvvQ.js +160 -0
  21. package/dist/constants-L_d5YvvQ.js.map +1 -0
  22. package/dist/constants.d.ts +34 -2
  23. package/dist/core/breadcrumbs.d.ts +3 -1
  24. package/dist/core/diagnostics.d.ts +1 -1
  25. package/dist/core/journey.d.ts +7 -0
  26. package/dist/core/meter.d.ts +19 -1
  27. package/dist/core/pipeline.d.ts +12 -4
  28. package/dist/core/record.d.ts +40 -8
  29. package/dist/core/remote-sampling.d.ts +7 -3
  30. package/dist/core/runtime.d.ts +62 -3
  31. package/dist/core/sampling.d.ts +32 -1
  32. package/dist/core/sender.d.ts +8 -0
  33. package/dist/core/spans.d.ts +34 -0
  34. package/dist/{errors-DCZWcHkd.js → errors-BDI96zKc.js} +6 -6
  35. package/dist/errors-BDI96zKc.js.map +1 -0
  36. package/dist/errors-_xEsCVXn.cjs +3 -0
  37. package/dist/errors-_xEsCVXn.cjs.map +1 -0
  38. package/dist/identity-Bwku7zzN.cjs +2 -0
  39. package/dist/identity-Bwku7zzN.cjs.map +1 -0
  40. package/dist/{identity-Di-QXGCC.js → identity-Dtv917nz.js} +33 -23
  41. package/dist/identity-Dtv917nz.js.map +1 -0
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.ts +23 -1
  45. package/dist/index.js +803 -524
  46. package/dist/index.js.map +1 -1
  47. package/dist/{indexeddb-storage-DX18p39D.cjs → indexeddb-storage-Cvavrf-y.cjs} +2 -2
  48. package/dist/{indexeddb-storage-DX18p39D.cjs.map → indexeddb-storage-Cvavrf-y.cjs.map} +1 -1
  49. package/dist/{indexeddb-storage-T9YIYVYC.js → indexeddb-storage-HgkQUTyS.js} +26 -26
  50. package/dist/{indexeddb-storage-T9YIYVYC.js.map → indexeddb-storage-HgkQUTyS.js.map} +1 -1
  51. package/dist/{interactions-_hfOerfC.cjs → interactions-Bhe1ft8P.cjs} +2 -2
  52. package/dist/interactions-Bhe1ft8P.cjs.map +1 -0
  53. package/dist/{interactions-BLH_tX87.js → interactions-Ck01cEij.js} +3 -3
  54. package/dist/interactions-Ck01cEij.js.map +1 -0
  55. package/dist/journey-Co9OlzrW.cjs +2 -0
  56. package/dist/journey-Co9OlzrW.cjs.map +1 -0
  57. package/dist/{journey-yALMEWF7.js → journey-DRK0A8u_.js} +37 -34
  58. package/dist/journey-DRK0A8u_.js.map +1 -0
  59. package/dist/{library-request-CQD4HUiP.js → library-request-ChCar5F8.js} +3 -3
  60. package/dist/{library-request-CQD4HUiP.js.map → library-request-ChCar5F8.js.map} +1 -1
  61. package/dist/{library-request-BcAxuwsf.cjs → library-request-gMFOCNcn.cjs} +2 -2
  62. package/dist/{library-request-BcAxuwsf.cjs.map → library-request-gMFOCNcn.cjs.map} +1 -1
  63. package/dist/log-record-cwFiLyPY.js +17 -0
  64. package/dist/log-record-cwFiLyPY.js.map +1 -0
  65. package/dist/log-record-jX9eWUP8.cjs +2 -0
  66. package/dist/log-record-jX9eWUP8.cjs.map +1 -0
  67. package/dist/{long-frames-D4Bm3Zkz.cjs → long-frames-Bky6nZDF.cjs} +2 -2
  68. package/dist/long-frames-Bky6nZDF.cjs.map +1 -0
  69. package/dist/{long-frames-DD_Um9_4.js → long-frames-DDumopji.js} +4 -4
  70. package/dist/long-frames-DDumopji.js.map +1 -0
  71. package/dist/models/config.d.ts +56 -5
  72. package/dist/models/log-record.d.ts +1 -1
  73. package/dist/models/plugin.d.ts +47 -0
  74. package/dist/models/stats.d.ts +11 -0
  75. package/dist/{network--GoE7_Or.js → network-BsBZ6_-Q.js} +43 -29
  76. package/dist/network-BsBZ6_-Q.js.map +1 -0
  77. package/dist/network-_4csBGBM.cjs +2 -0
  78. package/dist/network-_4csBGBM.cjs.map +1 -0
  79. package/dist/{platform-GaM6h7XM.js → platform-4yYjMD-B.js} +11 -6
  80. package/dist/platform-4yYjMD-B.js.map +1 -0
  81. package/dist/{platform-kIL5AZB7.cjs → platform-o7r1ocOu.cjs} +2 -2
  82. package/dist/platform-o7r1ocOu.cjs.map +1 -0
  83. package/dist/remote-rules-1KqfVBIu.js +91 -0
  84. package/dist/remote-rules-1KqfVBIu.js.map +1 -0
  85. package/dist/remote-rules-BHgEGlYi.cjs +2 -0
  86. package/dist/remote-rules-BHgEGlYi.cjs.map +1 -0
  87. package/dist/sampling-C4my-ma0.cjs +2 -0
  88. package/dist/sampling-C4my-ma0.cjs.map +1 -0
  89. package/dist/sampling-nYIWP_vP.js +86 -0
  90. package/dist/sampling-nYIWP_vP.js.map +1 -0
  91. package/dist/{sanitize-DP0xDPrt.js → sanitize-BiUKCUG6.js} +2 -2
  92. package/dist/{sanitize-DP0xDPrt.js.map → sanitize-BiUKCUG6.js.map} +1 -1
  93. package/dist/{sanitize--_e4oOPX.cjs → sanitize-BxuPSXOk.cjs} +2 -2
  94. package/dist/{sanitize--_e4oOPX.cjs.map → sanitize-BxuPSXOk.cjs.map} +1 -1
  95. package/dist/sender-6vrT9fFL.cjs +3 -0
  96. package/dist/sender-6vrT9fFL.cjs.map +1 -0
  97. package/dist/{sender-BUBWLn5i.js → sender-DFQMF39P.js} +382 -275
  98. package/dist/sender-DFQMF39P.js.map +1 -0
  99. package/dist/{storm-DhHGHhOc.cjs → storm-6YYbXzT_.cjs} +2 -2
  100. package/dist/{storm-DhHGHhOc.cjs.map → storm-6YYbXzT_.cjs.map} +1 -1
  101. package/dist/{storm-OD5J6Ylm.js → storm-CfO0Sam2.js} +2 -2
  102. package/dist/{storm-OD5J6Ylm.js.map → storm-CfO0Sam2.js.map} +1 -1
  103. package/dist/transport/exit-flush.d.ts +6 -0
  104. package/dist/transport/http-transport.d.ts +2 -1
  105. package/dist/transport/serializers/otlp-traces.d.ts +3 -0
  106. package/dist/transport/serializers/select.d.ts +8 -5
  107. package/dist/transport/status-transport.d.ts +7 -0
  108. package/dist/types-BR9t_w28.js +8 -0
  109. package/dist/types-BR9t_w28.js.map +1 -0
  110. package/dist/types-C7WNpnG1.cjs +2 -0
  111. package/dist/types-C7WNpnG1.cjs.map +1 -0
  112. package/dist/utils/identity.d.ts +11 -0
  113. package/dist/utils/platform.d.ts +8 -0
  114. package/dist/utils/tracing.d.ts +82 -4
  115. package/dist/web-socket-Ar4cZxmd.js +102 -0
  116. package/dist/web-socket-Ar4cZxmd.js.map +1 -0
  117. package/dist/web-socket-BwJdwSHl.cjs +2 -0
  118. package/dist/web-socket-BwJdwSHl.cjs.map +1 -0
  119. package/package.json +1 -1
  120. package/dist/constants-Cb92egPS.cjs +0 -2
  121. package/dist/constants-Cb92egPS.cjs.map +0 -1
  122. package/dist/constants-DhH6VI5a.js +0 -144
  123. package/dist/constants-DhH6VI5a.js.map +0 -1
  124. package/dist/deadline-CUrH0Hd8.cjs +0 -2
  125. package/dist/deadline-CUrH0Hd8.cjs.map +0 -1
  126. package/dist/deadline-DeqXEliN.js +0 -31
  127. package/dist/deadline-DeqXEliN.js.map +0 -1
  128. package/dist/errors-DCZWcHkd.js.map +0 -1
  129. package/dist/errors-ERu-su8m.cjs +0 -3
  130. package/dist/errors-ERu-su8m.cjs.map +0 -1
  131. package/dist/identity-C1WLItSl.cjs +0 -2
  132. package/dist/identity-C1WLItSl.cjs.map +0 -1
  133. package/dist/identity-Di-QXGCC.js.map +0 -1
  134. package/dist/interactions-BLH_tX87.js.map +0 -1
  135. package/dist/interactions-_hfOerfC.cjs.map +0 -1
  136. package/dist/journey-BRUj0hqD.cjs +0 -2
  137. package/dist/journey-BRUj0hqD.cjs.map +0 -1
  138. package/dist/journey-yALMEWF7.js.map +0 -1
  139. package/dist/long-frames-D4Bm3Zkz.cjs.map +0 -1
  140. package/dist/long-frames-DD_Um9_4.js.map +0 -1
  141. package/dist/network--GoE7_Or.js.map +0 -1
  142. package/dist/network-DcuS2H1P.cjs +0 -2
  143. package/dist/network-DcuS2H1P.cjs.map +0 -1
  144. package/dist/platform-GaM6h7XM.js.map +0 -1
  145. package/dist/platform-kIL5AZB7.cjs.map +0 -1
  146. package/dist/remote-rules-6ePq8CrI.js +0 -84
  147. package/dist/remote-rules-6ePq8CrI.js.map +0 -1
  148. package/dist/remote-rules-CI3gbRCL.cjs +0 -2
  149. package/dist/remote-rules-CI3gbRCL.cjs.map +0 -1
  150. package/dist/sampling-C-M8p3FK.cjs +0 -2
  151. package/dist/sampling-C-M8p3FK.cjs.map +0 -1
  152. package/dist/sampling-Ud_WiuU9.js +0 -65
  153. package/dist/sampling-Ud_WiuU9.js.map +0 -1
  154. package/dist/sender-BESHz6my.cjs +0 -3
  155. package/dist/sender-BESHz6my.cjs.map +0 -1
  156. package/dist/sender-BUBWLn5i.js.map +0 -1
@@ -40,6 +40,8 @@ export declare abstract class StatusTransport implements BatchTransport {
40
40
  * metricsEndpoint must not stop the log batches.
41
41
  */
42
42
  private readonly throttledUntil;
43
+ /** Epoch time in milliseconds when the server last accepted a batch, or null. */
44
+ private acceptedAt;
43
45
  /**
44
46
  * @param config Active configuration instance.
45
47
  * @param diagnostics Diagnostics reporter.
@@ -60,6 +62,11 @@ export declare abstract class StatusTransport implements BatchTransport {
60
62
  * @returns Milliseconds remaining in throttle window, or 0 if unthrottled.
61
63
  */
62
64
  throttledForMs(batch: LogBatch): number;
65
+ /**
66
+ * Returns the time when the server last accepted a batch.
67
+ * @returns Epoch time in milliseconds, or null before the first accepted batch.
68
+ */
69
+ lastSendAt(): number | null;
63
70
  /**
64
71
  * Serializes a batch with the configured serializer. A metrics batch gets the OTLP metrics
65
72
  * format. It reports a serializer that throws.
@@ -0,0 +1,8 @@
1
+ //#region src/capture/types.ts
2
+ function e(e, t) {
3
+ return typeof e == "string" && t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
4
+ }
5
+ //#endregion
6
+ export { e as t };
7
+
8
+ //# sourceMappingURL=types-BR9t_w28.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BR9t_w28.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAsHA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
@@ -0,0 +1,2 @@
1
+ function e(e,t){return typeof e==`string`&&t.some(t=>typeof t==`string`?e.includes(t):t.test(e))}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
2
+ //# sourceMappingURL=types-C7WNpnG1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAsHA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF"}
@@ -89,4 +89,15 @@ export declare class SessionTouch {
89
89
  * @param sessionId Active session identifier.
90
90
  */
91
91
  touch(sessionId: string): void;
92
+ /**
93
+ * Writes a new session id to the local store now. The throttle does not apply.
94
+ * @param sessionId New session identifier.
95
+ */
96
+ restart(sessionId: string): void;
97
+ /**
98
+ * Writes the session record and starts a new throttle window.
99
+ * @param sessionId Session identifier.
100
+ * @param now Epoch time in milliseconds.
101
+ */
102
+ private write;
92
103
  }
@@ -34,6 +34,14 @@ export declare function isTopLevel(diagnostics: Diagnostics): boolean;
34
34
  * @returns Current location.href or empty string.
35
35
  */
36
36
  export declare function currentUrl(diagnostics: Diagnostics): string;
37
+ /**
38
+ * Gives the form of a URL that the library records. It always removes the user info, which is a
39
+ * credential. Without fullUrls, it also removes the query and the fragment.
40
+ * @param url Absolute or relative URL.
41
+ * @param fullUrls Value of `capture.fullUrls`.
42
+ * @returns The URL to record.
43
+ */
44
+ export declare function recordedUrl(url: string, fullUrls: boolean): string;
37
45
  /**
38
46
  * Drops the query string and fragment from a URL.
39
47
  * It cuts the string and does not parse a URL. A relative request target has no base URL.
@@ -11,6 +11,54 @@ export interface TraceContext {
11
11
  }
12
12
  /** Cause of a rotation of the ambient trace context. */
13
13
  export type RotateReason = "start" | "interaction" | "navigation" | "explicit" | "maxAge";
14
+ /** Ambient trace that ended. Its root span covers it. */
15
+ export interface EndedTrace {
16
+ /** Trace ID. */
17
+ traceId: string;
18
+ /** Span ID of the root span. */
19
+ spanId: string;
20
+ /** Cause of the start of the trace. */
21
+ reason: RotateReason;
22
+ /** Start time in epoch milliseconds. */
23
+ startedAt: number;
24
+ /** End time in epoch milliseconds. */
25
+ endedAt: number;
26
+ }
27
+ /** Client span that a traceparent header names. */
28
+ export interface ClientSpan {
29
+ /** Trace ID. */
30
+ traceId: string;
31
+ /** Span ID of the client span. */
32
+ spanId: string;
33
+ /** Span ID of the root span of the trace. */
34
+ parentSpanId: string;
35
+ }
36
+ /** Headers of one request, and the client span that they name. */
37
+ export interface RequestTrace {
38
+ /** Header map containing traceparent. */
39
+ headers: Record<string, string>;
40
+ /** Client span of the request. It is undefined when the library records no span for it. */
41
+ span?: ClientSpan;
42
+ }
43
+ /** Span decisions of the runtime. */
44
+ export interface SpanHooks {
45
+ /**
46
+ * Tests if the library records spans.
47
+ * @returns True with a traces endpoint.
48
+ */
49
+ enabled(): boolean;
50
+ /**
51
+ * Tests if sampling keeps the spans of a trace.
52
+ * @param traceId Trace ID.
53
+ * @returns True if the library sends the spans of the trace.
54
+ */
55
+ keeps(traceId: string): boolean;
56
+ /**
57
+ * Receives an ambient trace that ended.
58
+ * @param ended The trace.
59
+ */
60
+ onEnd(ended: EndedTrace): void;
61
+ }
14
62
  /**
15
63
  * Generates a random 32-character hex string in the W3C trace ID format.
16
64
  * Use it to start your own trace. The backend drops an id with the wrong width
@@ -28,6 +76,7 @@ export declare class TraceEngine {
28
76
  private readonly diagnostics;
29
77
  private readonly maxAgeMs;
30
78
  private readonly load?;
79
+ private readonly spans?;
31
80
  /**
32
81
  * Active ambient trace context. The instance keeps this state, not the module. Two
33
82
  * runtimes in one document must not share a trace id.
@@ -40,8 +89,9 @@ export declare class TraceEngine {
40
89
  * @param maxAgeMs Maximum lifetime of an un-rotated ambient trace in milliseconds.
41
90
  * @param load Loader for the OpenTelemetry API. If it is not set, OTel is off.
42
91
  * Do not import the peer by name. The Vite dev server fails if the peer is not installed.
92
+ * @param spans Span decisions of the runtime. Without them, the library records no span.
43
93
  */
44
- constructor(diagnostics: Diagnostics, maxAgeMs?: number, load?: OtelLoader | undefined);
94
+ constructor(diagnostics: Diagnostics, maxAgeMs?: number, load?: OtelLoader | undefined, spans?: SpanHooks | undefined);
45
95
  /**
46
96
  * Loads the OpenTelemetry API. Until the load completes, records use the ambient trace.
47
97
  * If there is no loader or the load fails, all records use the ambient trace.
@@ -53,21 +103,49 @@ export declare class TraceEngine {
53
103
  * @returns Active TraceContext.
54
104
  */
55
105
  resolve(): TraceContext;
106
+ /**
107
+ * Reads the ambient trace. It rotates a trace that is too old.
108
+ * @returns Ambient TraceContext.
109
+ */
110
+ private ambientContext;
56
111
  /**
57
112
  * Reads the active span of the host if the peer module loaded and a span runs.
58
113
  * @returns Trace context of the active span, or undefined.
59
114
  */
60
115
  private activeSpanContext;
61
116
  /**
62
- * Rotates the ambient trace context to mark the start of a new logical operation.
63
- * @param _reason Event reason triggering the rotation.
117
+ * Rotates the ambient trace context to mark the start of a new logical operation. It ends the
118
+ * root span of the old trace.
119
+ * @param reason Event reason triggering the rotation.
64
120
  * @returns Newly created TraceContext.
65
121
  */
66
- rotate(_reason: RotateReason): TraceContext;
122
+ rotate(reason: RotateReason): TraceContext;
123
+ /**
124
+ * Ends the root span of the ambient trace one time. Later records can still use the trace.
125
+ * The exit flush calls it. A closing document has no later rotation.
126
+ */
127
+ end(): void;
128
+ /**
129
+ * Ends the root span of a trace one time.
130
+ * @param ambient Trace to end.
131
+ */
132
+ private finish;
67
133
  /**
68
134
  * Generates W3C traceparent headers with the registered OpenTelemetry propagators.
69
135
  * Without a traceparent from OpenTelemetry, it uses the ambient trace.
70
136
  * @returns Header map containing traceparent.
71
137
  */
72
138
  headers(): Record<string, string>;
139
+ /**
140
+ * Generates the headers of one request of the network capture. With spans on, the traceparent
141
+ * names a new client span of the ambient trace.
142
+ * @returns The headers, and the client span that the library records.
143
+ */
144
+ request(): RequestTrace;
145
+ /**
146
+ * Generates the trace headers.
147
+ * @param client True to name a new client span in the traceparent.
148
+ * @returns The headers, and the client span that the library records.
149
+ */
150
+ private trace;
73
151
  }
@@ -0,0 +1,102 @@
1
+ import { t as e } from "./library-request-ChCar5F8.js";
2
+ import { t } from "./patch-CCWfuEY7.js";
3
+ import { t as n } from "./storm-CfO0Sam2.js";
4
+ import { t as r } from "./types-BR9t_w28.js";
5
+ //#region src/capture/web-socket.ts
6
+ var i = "ui.websocket.messages";
7
+ function a(e) {
8
+ let t = new URL(e);
9
+ return {
10
+ target: `${t.protocol}//${t.host}${t.pathname}`,
11
+ server: t.hostname
12
+ };
13
+ }
14
+ function o(t, n, r) {
15
+ let i = t.servers.get(n), a = r === "transmit" && e();
16
+ if (!t.active || i === void 0 || a) return;
17
+ let o = {
18
+ "network.io.direction": r,
19
+ "server.address": i
20
+ };
21
+ t.messages.add(1, o);
22
+ }
23
+ var s = class {
24
+ diagnostics;
25
+ config;
26
+ name = "websocket";
27
+ restore;
28
+ state;
29
+ window = {
30
+ start: 0,
31
+ count: 0
32
+ };
33
+ constructor(e, t) {
34
+ this.diagnostics = e, this.config = t;
35
+ }
36
+ install(e) {
37
+ if (this.restore || typeof WebSocket > "u") return;
38
+ let n = {
39
+ active: !0,
40
+ ctx: e,
41
+ messages: e.counter(i),
42
+ servers: /* @__PURE__ */ new WeakMap()
43
+ };
44
+ this.state = n;
45
+ let r = (e) => {
46
+ this.track(e, n);
47
+ };
48
+ this.restore = t(globalThis, "WebSocket", (e) => class extends e {
49
+ static [Symbol.hasInstance](t) {
50
+ return t instanceof e;
51
+ }
52
+ constructor(e, t) {
53
+ super(e, t), r(this);
54
+ }
55
+ send(e) {
56
+ super.send(e), o(n, this, "transmit");
57
+ }
58
+ });
59
+ }
60
+ uninstall() {
61
+ this.state && (this.state.active = !1), this.restore && !this.restore() && this.diagnostics.report("capture.install_failed", "Another script wrapped WebSocket after the library. The library keeps that wrapper."), this.restore = void 0, this.state = void 0;
62
+ }
63
+ track(e, t) {
64
+ t.active && this.diagnostics.guard("capture.record_failed", "The library could not track a WebSocket. The socket works without capture.", () => {
65
+ if (r(e.url, this.config.capture.ignoreUrls)) return;
66
+ let { target: n, server: i } = a(e.url), s = {
67
+ "url.full": n,
68
+ "server.address": i
69
+ }, { logger: c } = t.ctx;
70
+ t.servers.set(e, i);
71
+ let l = (e) => {
72
+ this.allow(t) && e();
73
+ };
74
+ e.addEventListener("open", () => {
75
+ l(() => {
76
+ c.logEvent("websocket.open", s);
77
+ });
78
+ }), e.addEventListener("error", () => {
79
+ l(() => {
80
+ c.warn("websocket.error", s);
81
+ });
82
+ }), e.addEventListener("close", (e) => {
83
+ l(() => {
84
+ c.logEvent("websocket.close", {
85
+ ...s,
86
+ "websocket.close.code": e.code,
87
+ "websocket.close.clean": e.wasClean
88
+ });
89
+ });
90
+ }), e.addEventListener("message", () => {
91
+ o(t, e, "receive");
92
+ });
93
+ });
94
+ }
95
+ allow(e) {
96
+ return e.active && n(this.window, 20, this.diagnostics, "WebSocket events");
97
+ }
98
+ };
99
+ //#endregion
100
+ export { s as WebSocketCapture };
101
+
102
+ //# sourceMappingURL=web-socket-Ar4cZxmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-socket-Ar4cZxmd.js","names":["isLibraryRequest","allowInWindow","matchesAny","MESSAGES_METRIC","socketTarget","parsed","url","count","server","state","socket","own","direction","attributes","WebSocketCapture","diagnostics","config","ctx","track","patch","Original","value","protocols","data","target","lifecycle","write","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of each WebSocket. It counts the messages by direction\n// and server. It never reads the content of a message. It is a capture plugin, and the runtime\n// loads it as a separate chunk.\n\nimport { WEBSOCKET_MAX_PER_WINDOW } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** Data of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper that stays after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** Tools of the plugin. */\n ctx: PluginContext;\n /** Counter of the messages. */\n messages: Counter;\n /** Server host name of each tracked socket. */\n servers: WeakMap<WebSocket, string>;\n}\n\n/**\n * Removes the user info, the query and the fragment from a socket URL. They can hold a token.\n * @param url Absolute URL of the socket.\n * @returns The URL to record and the host name of the server.\n */\nfunction socketTarget(url: string): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n target: `${parsed.protocol}//${parsed.host}${parsed.pathname}`,\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message of a tracked socket.\n * @param state State of the install that made the socket.\n * @param socket Socket of the message.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // A send of the library, for example a custom transport, must not make the next send.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (!state.active || server === undefined || own) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and the message counts of each WebSocket that the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined when the capture is not installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit of the lifecycle records. A reconnect loop must not flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks each socket.\n * @param ctx Tools of the plugin.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket that the app opened before the install.\n * @param value Value to test.\n * @returns True for each native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url URL of the server.\n * @param protocols Sub-protocols of the app.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data Data of the app. The library does not read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops each tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script can wrap the constructor after the library. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record the lifecycle and the received messages of one socket.\n * @param socket New socket of the app.\n * @param state State of the install that made the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // A read here runs inside the constructor call of the app. A throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport can send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n\n const lifecycle = (write: () => void): void => {\n if (this.allow(state)) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Tests if a lifecycle record can go out.\n * @param state State of the install that made the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(this.window, WEBSOCKET_MAX_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t=require("./patch-BX8KrPCT.cjs"),n=require("./storm-6YYbXzT_.cjs"),r=require("./types-C7WNpnG1.cjs");var i=`ui.websocket.messages`;function a(e){let t=new URL(e);return{target:`${t.protocol}//${t.host}${t.pathname}`,server:t.hostname}}function o(t,n,r){let i=t.servers.get(n),a=r===`transmit`&&e.t();if(!t.active||i===void 0||a)return;let o={"network.io.direction":r,"server.address":i};t.messages.add(1,o)}var s=class{diagnostics;config;name=`websocket`;restore;state;window={start:0,count:0};constructor(e,t){this.diagnostics=e,this.config=t}install(e){if(this.restore||typeof WebSocket>`u`)return;let n={active:!0,ctx:e,messages:e.counter(i),servers:new WeakMap};this.state=n;let r=e=>{this.track(e,n)};this.restore=t.t(globalThis,`WebSocket`,e=>class extends e{static[Symbol.hasInstance](t){return t instanceof e}constructor(e,t){super(e,t),r(this)}send(e){super.send(e),o(n,this,`transmit`)}})}uninstall(){this.state&&(this.state.active=!1),this.restore&&!this.restore()&&this.diagnostics.report(`capture.install_failed`,`Another script wrapped WebSocket after the library. The library keeps that wrapper.`),this.restore=void 0,this.state=void 0}track(e,t){t.active&&this.diagnostics.guard(`capture.record_failed`,`The library could not track a WebSocket. The socket works without capture.`,()=>{if(r.t(e.url,this.config.capture.ignoreUrls))return;let{target:n,server:i}=a(e.url),s={"url.full":n,"server.address":i},{logger:c}=t.ctx;t.servers.set(e,i);let l=e=>{this.allow(t)&&e()};e.addEventListener(`open`,()=>{l(()=>{c.logEvent(`websocket.open`,s)})}),e.addEventListener(`error`,()=>{l(()=>{c.warn(`websocket.error`,s)})}),e.addEventListener(`close`,e=>{l(()=>{c.logEvent(`websocket.close`,{...s,"websocket.close.code":e.code,"websocket.close.clean":e.wasClean})})}),e.addEventListener(`message`,()=>{o(t,e,`receive`)})})}allow(e){return e.active&&n.t(this.window,20,this.diagnostics,`WebSocket events`)}};exports.WebSocketCapture=s;
2
+ //# sourceMappingURL=web-socket-BwJdwSHl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-socket-BwJdwSHl.cjs","names":["isLibraryRequest","patch","matchesAny","allowInWindow","require_library_request","require_patch","require_storm","require_types","MESSAGES_METRIC","socketTarget","parsed","url","count","server","state","socket","own","direction","attributes","WebSocketCapture","diagnostics","config","ctx","track","Original","value","protocols","data","target","lifecycle","write","logger","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of each WebSocket. It counts the messages by direction\n// and server. It never reads the content of a message. It is a capture plugin, and the runtime\n// loads it as a separate chunk.\n\nimport { WEBSOCKET_MAX_PER_WINDOW } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** Data of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper that stays after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** Tools of the plugin. */\n ctx: PluginContext;\n /** Counter of the messages. */\n messages: Counter;\n /** Server host name of each tracked socket. */\n servers: WeakMap<WebSocket, string>;\n}\n\n/**\n * Removes the user info, the query and the fragment from a socket URL. They can hold a token.\n * @param url Absolute URL of the socket.\n * @returns The URL to record and the host name of the server.\n */\nfunction socketTarget(url: string): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n target: `${parsed.protocol}//${parsed.host}${parsed.pathname}`,\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message of a tracked socket.\n * @param state State of the install that made the socket.\n * @param socket Socket of the message.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // A send of the library, for example a custom transport, must not make the next send.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (!state.active || server === undefined || own) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and the message counts of each WebSocket that the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined when the capture is not installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit of the lifecycle records. A reconnect loop must not flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks each socket.\n * @param ctx Tools of the plugin.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket that the app opened before the install.\n * @param value Value to test.\n * @returns True for each native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url URL of the server.\n * @param protocols Sub-protocols of the app.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data Data of the app. The library does not read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops each tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script can wrap the constructor after the library. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record the lifecycle and the received messages of one socket.\n * @param socket New socket of the app.\n * @param state State of the install that made the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // A read here runs inside the constructor call of the app. A throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport can send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n\n const lifecycle = (write: () => void): void => {\n if (this.allow(state)) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Tests if a lifecycle record can go out.\n * @param state State of the install that made the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(this.window, WEBSOCKET_MAX_PER_WINDOW, this.diagnostics, \"WebSocket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4
  "description": "UI observability and logging for browser, OpenFin and webview applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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 propagateTraceHeaderTo: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n};\n"],"mappings":"AAcA,IAuCaA,GAAqB,WAGrBC,GAA6B,SAG7BC,GAAwB,yBAGxBC,GAAuB,gBAGvBC,GAAoB,aAqDpBC,EAA4C,CACvD,MAAO,EACP,MAAO,EACP,KAAM,EACN,KAAM,GACN,MAAO,GACP,MAAO,EACT,EAMaC,EAAwCD,EAUxCE,EAAgB,WAGhBC,EAAe,UAGfC,EAAqB,gBAGrBC,EAAgB,WAOhBC,EAAgB,WAGhBC,EAAkB,aAGlBC,EAAoB,eAGpBC,EAAyB,oBAGzBC,EAAuB,wBAGvBC,EAAkB,aAGlBC,EAAmB,cAMnBC,EAA0B,2BAM1BC,EAAwB,yBAGxBC,EAAwB,eAGxBC,EAA2B,kBAG3BC,EAAkC,yBAMlCC,EAA8B,qBAM9BC,EAAiC,wBAMjCC,EAAkC,yBAGlCC,EAAyB,gBA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