@utk09/ui-observability 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +119 -60
- package/dist/bus/bus.d.ts +10 -10
- package/dist/bus/links.d.ts +1 -1
- package/dist/bus-DeZzr2bx.cjs +2 -0
- package/dist/bus-DeZzr2bx.cjs.map +1 -0
- package/dist/{bus-D3OO0OcL.js → bus-DfAbg_pg.js} +19 -19
- package/dist/bus-DfAbg_pg.js.map +1 -0
- package/dist/capture/network.d.ts +2 -2
- package/dist/capture/types.d.ts +10 -10
- package/dist/capture/web-vitals.d.ts +3 -3
- package/dist/constants-C8nZQBmQ.js +86 -0
- package/dist/constants-C8nZQBmQ.js.map +1 -0
- package/dist/constants-IBL_jd5R.cjs +2 -0
- package/dist/constants-IBL_jd5R.cjs.map +1 -0
- package/dist/constants.d.ts +56 -43
- package/dist/core/breadcrumbs.d.ts +14 -14
- package/dist/core/config.d.ts +5 -4
- package/dist/core/context.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +10 -9
- package/dist/core/journey.d.ts +23 -20
- package/dist/core/logger.d.ts +7 -7
- package/dist/core/pipeline.d.ts +34 -29
- package/dist/core/record.d.ts +6 -6
- package/dist/core/runtime.d.ts +20 -18
- package/dist/core/sampling.d.ts +15 -16
- package/dist/core/sender.d.ts +1 -1
- package/dist/{errors-Dme9tz-6.js → errors-4MQyjZVj.js} +4 -4
- package/dist/errors-4MQyjZVj.js.map +1 -0
- package/dist/{errors-DPju_xSI.cjs → errors-CUdShXe7.cjs} +2 -2
- package/dist/errors-CUdShXe7.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +136 -115
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-nxs_rxGx.js → indexeddb-storage-0LtUALBg.js} +16 -16
- package/dist/indexeddb-storage-0LtUALBg.js.map +1 -0
- package/dist/indexeddb-storage-CcEJlq2l.cjs +2 -0
- package/dist/indexeddb-storage-CcEJlq2l.cjs.map +1 -0
- package/dist/{interactions-DP0-rIPJ.cjs → interactions-BMNPQ3WH.cjs} +2 -2
- package/dist/interactions-BMNPQ3WH.cjs.map +1 -0
- package/dist/{interactions-C1romMpE.js → interactions-BaCmoGLB.js} +2 -2
- package/dist/interactions-BaCmoGLB.js.map +1 -0
- package/dist/models/batch.d.ts +12 -9
- package/dist/models/bus.d.ts +12 -13
- package/dist/models/config.d.ts +85 -44
- package/dist/models/log-record.d.ts +12 -10
- package/dist/models/serializer.d.ts +3 -2
- package/dist/models/storage.d.ts +2 -2
- package/dist/network-DBNvxCE3.cjs +2 -0
- package/dist/network-DBNvxCE3.cjs.map +1 -0
- package/dist/{network-au-Tqt1n.js → network-jQ2t8rU4.js} +4 -4
- package/dist/network-jQ2t8rU4.js.map +1 -0
- package/dist/platform-ByQllE_W.cjs +2 -0
- package/dist/platform-ByQllE_W.cjs.map +1 -0
- package/dist/{platform-DMYo3AX3.js → platform-YuByH8A5.js} +8 -8
- package/dist/platform-YuByH8A5.js.map +1 -0
- package/dist/{sampling-ByI5H44E.js → sampling-CbYySsZ1.js} +21 -18
- package/dist/sampling-CbYySsZ1.js.map +1 -0
- package/dist/sampling-Cs50xsZl.cjs +2 -0
- package/dist/sampling-Cs50xsZl.cjs.map +1 -0
- package/dist/{sender-R7lOpyNc.js → sender-BIob8eZz.js} +60 -60
- package/dist/sender-BIob8eZz.js.map +1 -0
- package/dist/sender-iOjzcueM.cjs +3 -0
- package/dist/sender-iOjzcueM.cjs.map +1 -0
- package/dist/storage/emergency-queue.d.ts +2 -2
- package/dist/storage/factory.d.ts +2 -1
- package/dist/storage/idb-driver.d.ts +19 -19
- package/dist/storage/indexeddb-storage.d.ts +18 -17
- package/dist/storage/keys.d.ts +1 -1
- package/dist/storage/local-storage.d.ts +19 -18
- package/dist/storage/memory-storage.d.ts +12 -11
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +8 -7
- package/dist/transport/exit-flush.d.ts +27 -24
- package/dist/transport/http-transport.d.ts +18 -11
- package/dist/transport/retry-engine.d.ts +33 -28
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +1 -1
- package/dist/unref-16maCyKA.js.map +1 -1
- package/dist/unref-CU9Nyz_9.cjs.map +1 -1
- package/dist/utils/console.d.ts +7 -6
- package/dist/utils/identity.d.ts +6 -5
- package/dist/utils/lock.d.ts +4 -4
- package/dist/utils/platform.d.ts +5 -3
- package/dist/utils/sanitize.d.ts +5 -2
- package/dist/utils/sequence.d.ts +2 -2
- package/dist/utils/tracing.d.ts +8 -7
- package/dist/web-vitals-B2FYsEAU.cjs +2 -0
- package/dist/web-vitals-B2FYsEAU.cjs.map +1 -0
- package/dist/{web-vitals-DwWdLBq6.js → web-vitals-DHZ0yA_H.js} +4 -4
- package/dist/web-vitals-DHZ0yA_H.js.map +1 -0
- package/package.json +4 -2
- package/dist/bus-D3OO0OcL.js.map +0 -1
- package/dist/bus-OdRJVUzr.cjs +0 -2
- package/dist/bus-OdRJVUzr.cjs.map +0 -1
- package/dist/constants-B6kdsCzF.js +0 -75
- package/dist/constants-B6kdsCzF.js.map +0 -1
- package/dist/constants-DZH04585.cjs +0 -2
- package/dist/constants-DZH04585.cjs.map +0 -1
- package/dist/errors-DPju_xSI.cjs.map +0 -1
- package/dist/errors-Dme9tz-6.js.map +0 -1
- package/dist/indexeddb-storage-lGdoHGHy.cjs +0 -2
- package/dist/indexeddb-storage-lGdoHGHy.cjs.map +0 -1
- package/dist/indexeddb-storage-nxs_rxGx.js.map +0 -1
- package/dist/interactions-C1romMpE.js.map +0 -1
- package/dist/interactions-DP0-rIPJ.cjs.map +0 -1
- package/dist/network-DDVIJSHd.cjs +0 -2
- package/dist/network-DDVIJSHd.cjs.map +0 -1
- package/dist/network-au-Tqt1n.js.map +0 -1
- package/dist/platform-DMYo3AX3.js.map +0 -1
- package/dist/platform-g99Kn755.cjs +0 -2
- package/dist/platform-g99Kn755.cjs.map +0 -1
- package/dist/sampling-ByI5H44E.js.map +0 -1
- package/dist/sampling-Dui-Fp3u.cjs +0 -2
- package/dist/sampling-Dui-Fp3u.cjs.map +0 -1
- package/dist/sender-R7lOpyNc.js.map +0 -1
- package/dist/sender-vLcbQhiB.cjs +0 -3
- package/dist/sender-vLcbQhiB.cjs.map +0 -1
- package/dist/web-vitals-DM2nvcMJ.cjs +0 -2
- package/dist/web-vitals-DM2nvcMJ.cjs.map +0 -1
- package/dist/web-vitals-DwWdLBq6.js.map +0 -1
package/dist/models/config.d.ts
CHANGED
|
@@ -5,9 +5,16 @@ import type { LogSerializer } from "./serializer";
|
|
|
5
5
|
export type StorageStrategy = "auto" | "indexeddb" | "localstorage" | "memory" | "none";
|
|
6
6
|
/** Selects where the library keeps session, tab and journey ids. "storage" uses browser storage. "memory" writes nothing. */
|
|
7
7
|
export type IdentityStrategy = "storage" | "memory";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* What this context does with its records. `sender` delivers its own records.
|
|
10
|
+
* `forwarder` gives them to another context. `auto` selects a role at startup.
|
|
11
|
+
* `off` turns off the bus. The context then delivers its own records.
|
|
12
|
+
*/
|
|
9
13
|
export type BusMode = "auto" | "sender" | "forwarder" | "off";
|
|
10
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Structural type for the metric shape of the `web-vitals` package. With this type,
|
|
16
|
+
* the library has no hard dependency on the package.
|
|
17
|
+
*/
|
|
11
18
|
export interface WebVitalsMetric {
|
|
12
19
|
/** Measurement value, in the metric's own unit. */
|
|
13
20
|
value: number;
|
|
@@ -67,8 +74,8 @@ export interface OtelSpan {
|
|
|
67
74
|
spanContext(): OtelSpanContext;
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
70
|
-
* The three `@opentelemetry/api` entry points this library uses
|
|
71
|
-
*
|
|
77
|
+
* The three `@opentelemetry/api` entry points that this library uses. The structural
|
|
78
|
+
* types keep the package an optional peer.
|
|
72
79
|
*/
|
|
73
80
|
export interface OtelApi {
|
|
74
81
|
/** Span lookup. */
|
|
@@ -83,7 +90,7 @@ export interface OtelApi {
|
|
|
83
90
|
context: {
|
|
84
91
|
/**
|
|
85
92
|
* Reads the active context.
|
|
86
|
-
* @returns Context
|
|
93
|
+
* @returns Context object that only the propagator reads.
|
|
87
94
|
*/
|
|
88
95
|
active(): unknown;
|
|
89
96
|
};
|
|
@@ -102,7 +109,7 @@ export interface OtelApi {
|
|
|
102
109
|
* @returns A promise resolving to the module.
|
|
103
110
|
*/
|
|
104
111
|
export type OtelLoader = () => Promise<OtelApi>;
|
|
105
|
-
/** Sampling policy
|
|
112
|
+
/** Sampling policy. It controls which records the library keeps. */
|
|
106
113
|
export interface SamplingOptions {
|
|
107
114
|
/**
|
|
108
115
|
* Default fraction of records kept, 0 to 1.
|
|
@@ -110,7 +117,7 @@ export interface SamplingOptions {
|
|
|
110
117
|
*/
|
|
111
118
|
defaultRate: number;
|
|
112
119
|
/**
|
|
113
|
-
*
|
|
120
|
+
* Rate override for each namespace, keyed by `app.namespace`. The most specific prefix applies.
|
|
114
121
|
* @default {}
|
|
115
122
|
*/
|
|
116
123
|
rates: Record<string, number>;
|
|
@@ -120,7 +127,7 @@ export interface SamplingOptions {
|
|
|
120
127
|
*/
|
|
121
128
|
alwaysSampleTypes: string[];
|
|
122
129
|
}
|
|
123
|
-
/** Bus settings
|
|
130
|
+
/** Bus settings. They control how this context finds, trusts, and sends messages to others. */
|
|
124
131
|
export interface BusOptions {
|
|
125
132
|
/**
|
|
126
133
|
* This context's role.
|
|
@@ -128,20 +135,23 @@ export interface BusOptions {
|
|
|
128
135
|
*/
|
|
129
136
|
mode: BusMode;
|
|
130
137
|
/**
|
|
131
|
-
* Origins
|
|
138
|
+
* Origins that can send postMessage records to this document.
|
|
139
|
+
* A document that gets records from a cross-origin iframe must list the iframe origin.
|
|
132
140
|
* @default []
|
|
133
141
|
*/
|
|
134
142
|
trustedOrigins: string[];
|
|
135
143
|
/**
|
|
136
|
-
* Which OpenFin context this is. Only the platform provider answers a
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* provider.
|
|
144
|
+
* Which OpenFin context this is. Only the platform provider answers a handshake.
|
|
145
|
+
* With an incorrect value, each view sends its own records. "auto" treats the
|
|
146
|
+
* window whose name equals its application uuid as the provider.
|
|
140
147
|
* @default "auto"
|
|
141
148
|
*/
|
|
142
149
|
openFinRole: "auto" | "provider" | "client";
|
|
143
150
|
}
|
|
144
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* What the library instruments automatically. By default, only `errors` and `rejections`
|
|
153
|
+
* are on.
|
|
154
|
+
*/
|
|
145
155
|
export interface CaptureOptions {
|
|
146
156
|
/**
|
|
147
157
|
* Log uncaught errors from `window.onerror`.
|
|
@@ -159,7 +169,7 @@ export interface CaptureOptions {
|
|
|
159
169
|
*/
|
|
160
170
|
resourceErrors: boolean;
|
|
161
171
|
/**
|
|
162
|
-
* Wrap `fetch` to log requests. The
|
|
172
|
+
* Wrap `fetch` to log requests. The library never logs requests to the ingest endpoint.
|
|
163
173
|
* @default false
|
|
164
174
|
*/
|
|
165
175
|
fetch: boolean;
|
|
@@ -179,23 +189,24 @@ export interface CaptureOptions {
|
|
|
179
189
|
*/
|
|
180
190
|
navigation: boolean;
|
|
181
191
|
/**
|
|
182
|
-
* Report web vitals as metrics.
|
|
192
|
+
* Report web vitals as metrics. This option requires `webVitalsLoader`.
|
|
183
193
|
* @default false
|
|
184
194
|
*/
|
|
185
195
|
webVitals: boolean;
|
|
186
196
|
/**
|
|
187
197
|
* Keep the query string and fragment on every URL the library records.
|
|
188
|
-
*
|
|
198
|
+
* When off, the library removes them from page URLs, request targets and failed resource URLs.
|
|
189
199
|
* @default false
|
|
190
200
|
*/
|
|
191
201
|
fullUrls: boolean;
|
|
192
202
|
/**
|
|
193
|
-
* URLs
|
|
203
|
+
* URLs that the library does not log. The library always adds the ingest endpoint.
|
|
194
204
|
* @default []
|
|
195
205
|
*/
|
|
196
206
|
ignoreUrls: (string | RegExp)[];
|
|
197
207
|
/**
|
|
198
|
-
* Targets that receive a `traceparent` header. A
|
|
208
|
+
* Targets that receive a `traceparent` header. A pattern that matches all URLs breaks
|
|
209
|
+
* CORS on third-party endpoints.
|
|
199
210
|
* @default []
|
|
200
211
|
*/
|
|
201
212
|
propagateTraceHeaderTo: (string | RegExp)[];
|
|
@@ -207,28 +218,56 @@ export interface CaptureOptions {
|
|
|
207
218
|
}
|
|
208
219
|
/** Serializer option after resolution. A name stays a name. The transport selects the implementation. */
|
|
209
220
|
export type SerializerChoice = "otlp" | "ecs" | LogSerializer;
|
|
210
|
-
/**
|
|
211
|
-
export type
|
|
221
|
+
/** Part of the console prefix that a style applies to: the namespace or one level. */
|
|
222
|
+
export type ConsoleStyleKey = "namespace" | LogLevel;
|
|
223
|
+
/**
|
|
224
|
+
* CSS for each part of the console prefix, for example `"color:#0a7;font-weight:bold"`.
|
|
225
|
+
* A browser applies it with `%c`. Node prints the text without the style.
|
|
226
|
+
*/
|
|
227
|
+
export type ConsoleStyles = Partial<Record<ConsoleStyleKey, string>>;
|
|
228
|
+
/** Object form of the console option. */
|
|
229
|
+
export interface ConsoleOptions {
|
|
230
|
+
/**
|
|
231
|
+
* Lowest level that the console prints. If you do not set it, the level in force stays.
|
|
232
|
+
* If no level is in force, the console prints from DEBUG up.
|
|
233
|
+
*/
|
|
234
|
+
level?: LogLevel;
|
|
235
|
+
/** CSS for the namespace and for each level. A key that you do not set keeps its style. */
|
|
236
|
+
styles?: ConsoleStyles;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Console mirroring. `false` turns it off. `true` prints records at DEBUG and above.
|
|
240
|
+
* A level prints records at that level and above. An object sets the level and the styles.
|
|
241
|
+
*/
|
|
242
|
+
export type ConsoleOption = boolean | LogLevel | ConsoleOptions;
|
|
243
|
+
/** Console settings after resolution. */
|
|
244
|
+
export interface ResolvedConsole {
|
|
245
|
+
/** Lowest level that the console prints, or null when the console is off. */
|
|
246
|
+
level: LogLevel | null;
|
|
247
|
+
/** CSS for the namespace and for each level. */
|
|
248
|
+
styles: Required<ConsoleStyles>;
|
|
249
|
+
}
|
|
212
250
|
/** Options passed to `configure()`. */
|
|
213
251
|
export interface ObservabilityConfig {
|
|
214
252
|
/**
|
|
215
253
|
* Ingest endpoint URL. Set `null` for console-only mode.
|
|
216
|
-
* In console-only mode, the library sends nothing. It writes records to the console
|
|
254
|
+
* In console-only mode, the library sends nothing. It writes records to the console
|
|
255
|
+
* if you set `console`.
|
|
217
256
|
* If the key is missing or `""`, the library reports `config.invalid`.
|
|
218
257
|
*/
|
|
219
258
|
endpoint?: string | null;
|
|
220
259
|
/**
|
|
221
|
-
*
|
|
260
|
+
* The library reports this value as `service.name`.
|
|
222
261
|
* @default ""
|
|
223
262
|
*/
|
|
224
263
|
serviceName?: string;
|
|
225
264
|
/**
|
|
226
|
-
*
|
|
265
|
+
* The library reports this value as `service.version`.
|
|
227
266
|
* @default ""
|
|
228
267
|
*/
|
|
229
268
|
serviceVersion?: string;
|
|
230
269
|
/**
|
|
231
|
-
*
|
|
270
|
+
* The library reports this value as `deployment.environment`.
|
|
232
271
|
* @default ""
|
|
233
272
|
*/
|
|
234
273
|
environment?: string;
|
|
@@ -238,22 +277,24 @@ export interface ObservabilityConfig {
|
|
|
238
277
|
*/
|
|
239
278
|
enabled?: boolean;
|
|
240
279
|
/**
|
|
241
|
-
*
|
|
280
|
+
* Minimum level that the library logs.
|
|
242
281
|
* @default "INFO"
|
|
243
282
|
*/
|
|
244
283
|
minLevel?: LogLevel;
|
|
245
284
|
/**
|
|
246
|
-
* Whether to gzip a payload
|
|
285
|
+
* Whether to gzip a payload that is larger than the compression threshold.
|
|
286
|
+
* Set "none" for an ingest endpoint that rejects gzip.
|
|
247
287
|
* @default "gzip"
|
|
248
288
|
*/
|
|
249
289
|
compression?: "gzip" | "none";
|
|
250
290
|
/**
|
|
251
|
-
*
|
|
291
|
+
* Payload format. Give a name or a custom implementation.
|
|
252
292
|
* @default "otlp"
|
|
253
293
|
*/
|
|
254
294
|
serializer?: SerializerChoice;
|
|
255
295
|
/**
|
|
256
|
-
*
|
|
296
|
+
* The library passes this value to `fetch`. Set "include" for an ingest endpoint that
|
|
297
|
+
* authenticates with cookies.
|
|
257
298
|
* @default "omit"
|
|
258
299
|
*/
|
|
259
300
|
credentials?: RequestCredentials;
|
|
@@ -288,7 +329,7 @@ export interface ObservabilityConfig {
|
|
|
288
329
|
*/
|
|
289
330
|
capture?: Partial<CaptureOptions>;
|
|
290
331
|
/**
|
|
291
|
-
* Console mirroring
|
|
332
|
+
* Console mirroring. The line format is `[namespace][LEVEL] message`.
|
|
292
333
|
* @default false
|
|
293
334
|
*/
|
|
294
335
|
console?: ConsoleOption;
|
|
@@ -299,8 +340,8 @@ export interface ObservabilityConfig {
|
|
|
299
340
|
*/
|
|
300
341
|
otelLoader?: OtelLoader;
|
|
301
342
|
/**
|
|
302
|
-
* Rewrites or drops a record before it
|
|
303
|
-
* @param record The record about to
|
|
343
|
+
* Rewrites or drops a record before the library sends it.
|
|
344
|
+
* @param record The record that the library is about to send.
|
|
304
345
|
* @returns The record to send, or `null` to drop it.
|
|
305
346
|
*/
|
|
306
347
|
redact?: (record: LogRecord) => LogRecord | null;
|
|
@@ -310,23 +351,23 @@ export interface ObservabilityConfig {
|
|
|
310
351
|
*/
|
|
311
352
|
onDiagnostic?: DiagnosticHandler;
|
|
312
353
|
}
|
|
313
|
-
/** Fully resolved
|
|
354
|
+
/** Fully resolved configuration that the runtime holds. */
|
|
314
355
|
export interface ResolvedConfig {
|
|
315
356
|
/** Ingest endpoint URL, or null in console-only mode. */
|
|
316
357
|
endpoint: string | null;
|
|
317
|
-
/**
|
|
358
|
+
/** The library reports this value as `service.name`. */
|
|
318
359
|
serviceName: string;
|
|
319
|
-
/**
|
|
360
|
+
/** The library reports this value as `service.version`. */
|
|
320
361
|
serviceVersion: string;
|
|
321
|
-
/**
|
|
362
|
+
/** The library reports this value as `deployment.environment`. */
|
|
322
363
|
environment: string;
|
|
323
364
|
/** Master switch. False makes every log call a no-op. */
|
|
324
365
|
enabled: boolean;
|
|
325
|
-
/**
|
|
366
|
+
/** Minimum level that the library logs. */
|
|
326
367
|
minLevel: LogLevel;
|
|
327
|
-
/** Whether to gzip a payload
|
|
368
|
+
/** Whether to gzip a payload that is larger than the compression threshold. */
|
|
328
369
|
compression: "gzip" | "none";
|
|
329
|
-
/**
|
|
370
|
+
/** The library passes this value to `fetch`. */
|
|
330
371
|
credentials: RequestCredentials;
|
|
331
372
|
/** Backing store for undelivered records. */
|
|
332
373
|
storage: StorageStrategy;
|
|
@@ -347,17 +388,17 @@ export interface ResolvedConfig {
|
|
|
347
388
|
* @see {@link CaptureOptions}
|
|
348
389
|
*/
|
|
349
390
|
capture: CaptureOptions;
|
|
350
|
-
/**
|
|
351
|
-
console:
|
|
352
|
-
/**
|
|
391
|
+
/** Console level and styles. */
|
|
392
|
+
console: ResolvedConsole;
|
|
393
|
+
/** Payload format name, or a custom implementation. */
|
|
353
394
|
serializer: SerializerChoice;
|
|
354
395
|
/** Extra request headers, or a function returning them. */
|
|
355
396
|
headers?: ObservabilityConfig["headers"];
|
|
356
397
|
/** Supplies the `@opentelemetry/api` module in place of importing it. */
|
|
357
398
|
otelLoader?: OtelLoader;
|
|
358
399
|
/**
|
|
359
|
-
* Rewrites or drops a record before it
|
|
360
|
-
* @param record The record about to
|
|
400
|
+
* Rewrites or drops a record before the library sends it.
|
|
401
|
+
* @param record The record that the library is about to send.
|
|
361
402
|
* @returns The record to send, or `null` to drop it.
|
|
362
403
|
*/
|
|
363
404
|
redact?: ObservabilityConfig["redact"];
|
|
@@ -8,20 +8,23 @@ export type LogLevel = "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL";
|
|
|
8
8
|
export type LogType = "action" | "event" | "metric" | "system";
|
|
9
9
|
/** Metric value type: level, running total, or distribution. */
|
|
10
10
|
export type MetricType = "gauge" | "counter" | "histogram";
|
|
11
|
-
/** Internal record shape
|
|
11
|
+
/** Internal record shape. A serializer converts it to the payload format. */
|
|
12
12
|
export interface LogRecord {
|
|
13
13
|
/**
|
|
14
14
|
* Event time, nanoseconds since epoch, as a decimal string.
|
|
15
15
|
* @see {@link nowUnixNano}
|
|
16
16
|
*/
|
|
17
17
|
timeUnixNano: string;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Time when this library received the event, if it differs from `timeUnixNano`.
|
|
20
|
+
* For example, a forwarded record can have a different time.
|
|
21
|
+
*/
|
|
19
22
|
observedTimeUnixNano?: string;
|
|
20
23
|
/** Distributed trace id. */
|
|
21
24
|
traceId: string;
|
|
22
25
|
/** Span id within the trace. */
|
|
23
26
|
spanId: string;
|
|
24
|
-
/** OpenTelemetry trace flags.
|
|
27
|
+
/** OpenTelemetry trace flags. The library uses only the sampled bit. */
|
|
25
28
|
traceFlags: number;
|
|
26
29
|
/** OpenTelemetry severity number for `severityText`. */
|
|
27
30
|
severityNumber: number;
|
|
@@ -36,18 +39,17 @@ export interface LogRecord {
|
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Returns the current time as a Unix nanosecond timestamp.
|
|
39
|
-
*
|
|
40
|
-
* `Number.MAX_SAFE_INTEGER` and
|
|
41
|
-
* unknown precision
|
|
42
|
+
* The function appends zeros and does not multiply. `Date.now() * 1e6` is larger
|
|
43
|
+
* than `Number.MAX_SAFE_INTEGER` and corrupts digits without an error. The trailing
|
|
44
|
+
* zeros show unknown precision. They are not measured digits.
|
|
42
45
|
* @returns Epoch timestamp in nanoseconds, as a decimal string.
|
|
43
46
|
*/
|
|
44
47
|
export declare function nowUnixNano(): string;
|
|
45
48
|
/**
|
|
46
49
|
* Checks whether a value has the shape `LogRecord` requires.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* passes.
|
|
50
|
+
* Use it to validate records from another realm. A malformed record throws
|
|
51
|
+
* during serialization. The check accepts any string as `severityText`, not only
|
|
52
|
+
* a known level. Thus an unknown level from a newer version passes.
|
|
51
53
|
* @param value The value to check.
|
|
52
54
|
* @returns Whether `value` has the shape `LogRecord` requires.
|
|
53
55
|
*/
|
|
@@ -14,8 +14,9 @@ export interface LogSerializer {
|
|
|
14
14
|
/** Serializer name used in configuration. */
|
|
15
15
|
name: string;
|
|
16
16
|
/**
|
|
17
|
-
* Serializes a batch of records to
|
|
18
|
-
*
|
|
17
|
+
* Serializes a batch of records to payload bytes.
|
|
18
|
+
* The transport calls it one time for each delivery attempt, not one time for each batch.
|
|
19
|
+
* Thus each retry encodes the records again.
|
|
19
20
|
* @param records Batch records, in log order.
|
|
20
21
|
* @returns Serialized batch ready for transport.
|
|
21
22
|
*/
|
package/dist/models/storage.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface StorageAdapter {
|
|
|
15
15
|
*/
|
|
16
16
|
take(limit: number): Promise<LogBatch[]>;
|
|
17
17
|
/**
|
|
18
|
-
* Removes a batch by ID.
|
|
18
|
+
* Removes a batch by ID. A call with an unknown ID resolves without error.
|
|
19
19
|
* @param id Batch identifier.
|
|
20
20
|
*/
|
|
21
21
|
remove(id: string): Promise<void>;
|
|
@@ -52,7 +52,7 @@ export interface PruneResult {
|
|
|
52
52
|
batches: number;
|
|
53
53
|
/** Total records dropped within evicted batches. */
|
|
54
54
|
records: number;
|
|
55
|
-
/** Eviction reason
|
|
55
|
+
/** Eviction reason for the prune. If more than one rule applies, this is the last rule. */
|
|
56
56
|
reason: "expired" | "over_capacity" | "quota";
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./platform-ByQllE_W.cjs");function t(e,t){return t.some(t=>typeof t==`string`?e.includes(t):t.test(e))}function n(){return XMLHttpRequest.prototype}var r=class{ctx;name=`network`;originalFetch=null;originalOpen=null;originalSend=null;constructor(e){this.ctx=e}install(){this.ctx.config.capture.fetch&&this.installFetch(),this.ctx.config.capture.xhr&&this.installXhr()}uninstall(){this.originalFetch&&=(globalThis.fetch=this.originalFetch,null),this.originalOpen&&=(n().open=this.originalOpen,null),this.originalSend&&=(n().send=this.originalSend,null)}ignored(e){return t(e,this.ctx.config.capture.ignoreUrls)}installFetch(){if(typeof globalThis.fetch!=`function`||this.originalFetch)return;let e=globalThis.fetch.bind(globalThis);this.originalFetch=globalThis.fetch;let n=this.ctx,r=e=>this.ignored(e),i=(e,t,n,r,i)=>{this.record(e,t,n,r,i)};globalThis.fetch=async function(a,o){let s=typeof a==`string`?a:a instanceof URL?a.href:a.url,c=(o?.method??(a instanceof Request?a.method:`GET`)).toUpperCase();if(r(s))return e(a,o);let l=a,u=o;if(t(s,n.config.capture.propagateTraceHeaderTo))try{let e=Object.entries(n.tracing.headers());if(a instanceof Request){let t=new Headers(a.headers);for(let[n,r]of e)t.set(n,r);l=new Request(a,{headers:t})}else{let t=new Headers(o?.headers);for(let[n,r]of e)t.set(n,r);u={...o,headers:t}}}catch(e){l=a,u=o,n.diagnostics.report(`capture.header_failed`,`The library could not add the traceparent header. It sends the request unchanged.`,{url:s},e)}let d=performance.now();try{let t=await e(l,u);return i(c,s,t.status,performance.now()-d,void 0),t}catch(e){throw i(c,s,0,performance.now()-d,e),e}}}installXhr(){if(typeof XMLHttpRequest>`u`||this.originalOpen)return;let e=e=>this.ignored(e),t=(e,t,n,r)=>{this.record(e,t,n,r,void 0)},r=n(),i=r.open,a=r.send;this.originalOpen=i,this.originalSend=a,r.open=function(e,t,...n){this.__uiobs={method:e.toUpperCase(),url:String(t),startedAt:0},i.apply(this,[e,t,...n])},r.send=function(...n){let r=this.__uiobs;r&&!e(r.url)&&(r.startedAt=performance.now(),this.addEventListener(`loadend`,()=>{t(r.method,r.url,this.status,performance.now()-r.startedAt)})),a.apply(this,n)}}record(t,n,r,i,a){let o=this.ctx.config.capture.fullUrls?n:e.r(n);this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record ${t} ${o}.`,()=>{let e=Math.round(i);this.ctx.breadcrumbs.push({t:Date.now(),category:`http`,message:`${t} ${o} ${r===0?`failed`:String(r)}`,data:{durationMs:e}});let n={"http.request.method":t,"url.full":o,"http.response.status_code":r,"http.duration_ms":e};r===0?this.ctx.logger.error(`${t} ${o} failed`,a,n):r>=400?this.ctx.logger.warn(`${t} ${o} returned ${String(r)}`,n):this.ctx.logger.debug(`${t} ${o}`,n)})}};exports.NetworkCapture=r;
|
|
2
|
+
//# sourceMappingURL=network-DBNvxCE3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-DBNvxCE3.cjs","names":["stripUrlQuery","require_platform","matchesAny","patterns","pattern","url","xhrMethods","NetworkCapture","ctx","original","ignored","record","method","status","durationMs","error","input","init","fetchInput","fetchInit","injected","headers","key","value","startedAt","response","proto","originalOpen","originalSend","rest","args","meta","target","rounded","attributes"],"sources":["../src/capture/types.ts","../src/capture/network.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 { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\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}\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}\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 * Evaluates whether a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: string, patterns: (string | RegExp)[]): boolean {\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n","// src/capture/network.ts\n//\n// Instruments fetch and XMLHttpRequest to record network request outcomes and timing.\n\nimport { stripUrlQuery } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Signature of the global fetch function. */\ntype FetchFn = typeof fetch;\n\n/** XMLHttpRequest extended with internal telemetry tracking metadata. */\ntype Tracked = XMLHttpRequest & {\n __uiobs?: { method: string; url: string; startedAt: number };\n};\n\n/** Unbound prototype methods intercepted on XMLHttpRequest. */\ninterface XhrMethods {\n open: (this: XMLHttpRequest, ...args: never[]) => void;\n send: (this: XMLHttpRequest, ...args: never[]) => void;\n}\n\n/** Returns the XMLHttpRequest prototype. */\nfunction xhrMethods(): XhrMethods {\n return XMLHttpRequest.prototype;\n}\n\n/** Instruments global fetch and XMLHttpRequest to capture request durations and outcomes. */\nexport class NetworkCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"network\";\n\n /** Original uninstrumented fetch implementation. */\n private originalFetch: FetchFn | null = null;\n\n /** Original uninstrumented XMLHttpRequest.open implementation. */\n private originalOpen: XhrMethods[\"open\"] | null = null;\n\n /** Original uninstrumented XMLHttpRequest.send implementation. */\n private originalSend: XhrMethods[\"send\"] | null = null;\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, breadcrumbs, and tracing.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Instruments configured network transport APIs. */\n install(): void {\n if (this.ctx.config.capture.fetch) {\n this.installFetch();\n }\n if (this.ctx.config.capture.xhr) {\n this.installXhr();\n }\n }\n\n /** Restores native network transport implementations and clears references. */\n uninstall(): void {\n if (this.originalFetch) {\n globalThis.fetch = this.originalFetch;\n this.originalFetch = null;\n }\n if (this.originalOpen) {\n xhrMethods().open = this.originalOpen;\n this.originalOpen = null;\n }\n if (this.originalSend) {\n xhrMethods().send = this.originalSend;\n this.originalSend = null;\n }\n }\n\n /**\n * Evaluates whether a URL matches ignore patterns.\n * @param url Request target URL.\n * @returns True if telemetry must exclude the URL.\n */\n private ignored(url: string): boolean {\n // resolveConfig always adds the endpoint to ignoreUrls. Without it, a failed POST\n // makes a log record. That record causes a new POST, and the loop does not stop.\n return matchesAny(url, this.ctx.config.capture.ignoreUrls);\n }\n\n /** Instruments globalThis.fetch with tracing injection and outcome logging. */\n private installFetch(): void {\n if (typeof globalThis.fetch !== \"function\" || this.originalFetch) {\n return;\n }\n\n const original = globalThis.fetch.bind(globalThis);\n this.originalFetch = globalThis.fetch;\n\n const ctx = this.ctx;\n const ignored = (url: string): boolean => this.ignored(url);\n const record = (\n method: string,\n url: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void => {\n this.record(method, url, status, durationMs, error);\n };\n\n globalThis.fetch = async function instrumentedFetch(input, init) {\n const url = typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n const requested = init?.method ?? (input instanceof Request ? input.method : \"GET\");\n const method = requested.toUpperCase();\n\n if (ignored(url)) {\n return original(input, init);\n }\n\n let fetchInput = input;\n let fetchInit = init;\n\n // Add headers only to allowlisted URLs. A traceparent on a third-party request causes\n // a CORS preflight. The third party does not answer it, and its API stops working.\n if (matchesAny(url, ctx.config.capture.propagateTraceHeaderTo)) {\n try {\n const injected = Object.entries(ctx.tracing.headers());\n\n if (input instanceof Request) {\n // Do not spread a non-empty init with a Request input. That runs the Request\n // constructor on `input` again and reads its body. A body that was read\n // before causes a TypeError.\n const headers = new Headers(input.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n fetchInput = new Request(input, { headers });\n } else {\n const headers = new Headers(init?.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n fetchInit = { ...init, headers };\n }\n } catch (error) {\n // Send the request that the caller gave, without changes. A missing header is\n // better than a failed request.\n fetchInput = input;\n fetchInit = init;\n ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n }\n }\n\n const startedAt = performance.now();\n try {\n const response = await original(fetchInput, fetchInit);\n record(method, url, response.status, performance.now() - startedAt, undefined);\n return response;\n } catch (error) {\n record(method, url, 0, performance.now() - startedAt, error);\n throw error;\n }\n };\n }\n\n /** Instruments XMLHttpRequest open and send prototype methods. */\n private installXhr(): void {\n if (typeof XMLHttpRequest === \"undefined\" || this.originalOpen) {\n return;\n }\n\n const ignored = (url: string): boolean => this.ignored(url);\n const record = (method: string, url: string, status: number, durationMs: number): void => {\n this.record(method, url, status, durationMs, undefined);\n };\n\n const proto = xhrMethods();\n const originalOpen = proto.open;\n const originalSend = proto.send;\n this.originalOpen = originalOpen;\n this.originalSend = originalSend;\n\n proto.open = function (this: Tracked, method: string, url: string | URL, ...rest: never[]) {\n this.__uiobs = {\n method: method.toUpperCase(),\n url: String(url),\n startedAt: 0,\n };\n originalOpen.apply(this, [method, url, ...rest] as never[]);\n };\n\n proto.send = function (this: Tracked, ...args: never[]) {\n const meta = this.__uiobs;\n if (meta && !ignored(meta.url)) {\n meta.startedAt = performance.now();\n this.addEventListener(\"loadend\", () => {\n record(meta.method, meta.url, this.status, performance.now() - meta.startedAt);\n });\n }\n originalSend.apply(this, args);\n };\n }\n\n /**\n * Records request outcome attributes and breadcrumb entry.\n * @param method Uppercase HTTP method.\n * @param target Request target URL. The method removes the query unless fullUrls is set.\n * @param status HTTP response status code, or 0 on failure.\n * @param durationMs Request duration in milliseconds.\n * @param error Caught error instance on failed requests.\n */\n private record(\n method: string,\n target: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void {\n // Remove the query here, not at the call sites. ignoreUrls and propagateTraceHeaderTo\n // match on the full URL. Only the recorded URL loses the query string.\n const url = this.ctx.config.capture.fullUrls ? target : stripUrlQuery(target);\n\n // This code runs inside the fetch call of the caller. An error here must not cause\n // the request of the caller to fail.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${method} ${url}.`,\n () => {\n const rounded = Math.round(durationMs);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `${method} ${url} ${status === 0 ? \"failed\" : String(status)}`,\n data: { durationMs: rounded },\n });\n\n const attributes = {\n \"http.request.method\": method,\n \"url.full\": url,\n \"http.response.status_code\": status,\n \"http.duration_ms\": rounded,\n };\n\n if (status === 0) {\n this.ctx.logger.error(`${method} ${url} failed`, error, attributes);\n return;\n }\n if (status >= 400) {\n this.ctx.logger.warn(`${method} ${url} returned ${String(status)}`, attributes);\n return;\n }\n\n // Log a success at DEBUG. The default minLevel of INFO drops it.\n // Only failures use bandwidth.\n this.ctx.logger.debug(`${method} ${url}`, attributes);\n },\n );\n }\n}\n"],"mappings":"2CA8GA,SAAgBE,EAAW,EAAa,EAAwC,CAC9E,OAAOC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWC,EAAI,SAASD,CAAO,EAAIA,EAAQ,KAAKC,CAAG,CACxE,CACF,CC5FA,SAASC,GAAyB,CAChC,OAAO,eAAe,SACxB,CAGA,IAAaC,EAAb,KAA+C,CAgBhB,IAd7B,KAAgB,UAGhB,cAAwC,KAGxC,aAAkD,KAGlD,aAAkD,KAKlD,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CACV,KAAK,IAAI,OAAO,QAAQ,OAC1B,KAAK,aAAa,EAEhB,KAAK,IAAI,OAAO,QAAQ,KAC1B,KAAK,WAAW,CAEpB,CAGA,WAAkB,CAChB,AAEE,KAAK,iBADL,WAAW,MAAQ,KAAK,cACH,MAEvB,AAEE,KAAK,gBADL,EAAW,CAAC,CAAC,KAAO,KAAK,aACL,MAEtB,AAEE,KAAK,gBADL,EAAW,CAAC,CAAC,KAAO,KAAK,aACL,KAExB,CAOA,QAAgB,EAAsB,CAGpC,OAAON,EAAWG,EAAK,KAAK,IAAI,OAAO,QAAQ,UAAU,CAC3D,CAGA,cAA6B,CAC3B,GAAI,OAAO,WAAW,OAAU,YAAc,KAAK,cACjD,OAGF,IAAMI,EAAW,WAAW,MAAM,KAAK,UAAU,EACjD,KAAK,cAAgB,WAAW,MAEhC,IAAMD,EAAM,KAAK,IACXE,EAAW,GAAyB,KAAK,QAAQ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IAAW,EAAI,SAAW,OAAOA,CAAM,IACpE,KAAM,CAAE,WAAYoB,CAAQ,CAC9B,CAAC,EAED,IAAMC,EAAa,CACjB,sBAAuBtB,EACvB,WAAYP,EACZ,4BAA6BQ,EAC7B,mBAAoBoB,CACtB,EAEIpB,IAAW,EACb,KAAK,IAAI,OAAO,MAAM,GAAGD,EAAO,GAAGP,EAAI,SAAUU,EAAOmB,CAAU,EAGhErB,GAAU,IACZ,KAAK,IAAI,OAAO,KAAK,GAAGD,EAAO,GAAGP,EAAI,YAAY,OAAOQ,CAAM,IAAKqB,CAAU,EAMhF,KAAK,IAAI,OAAO,MAAM,GAAGtB,EAAO,GAAGP,IAAO6B,CAAU,CACtD,CACF,CACF,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "./platform-
|
|
1
|
+
import { r as e } from "./platform-YuByH8A5.js";
|
|
2
2
|
//#region src/capture/types.ts
|
|
3
3
|
function t(e, t) {
|
|
4
4
|
return t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
|
|
@@ -52,7 +52,7 @@ var r = class {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
} catch (e) {
|
|
55
|
-
l = a, u = o, n.diagnostics.report("capture.header_failed", "could not
|
|
55
|
+
l = a, u = o, n.diagnostics.report("capture.header_failed", "The library could not add the traceparent header. It sends the request unchanged.", { url: s }, e);
|
|
56
56
|
}
|
|
57
57
|
let d = performance.now();
|
|
58
58
|
try {
|
|
@@ -87,7 +87,7 @@ var r = class {
|
|
|
87
87
|
}
|
|
88
88
|
record(t, n, r, i, a) {
|
|
89
89
|
let o = this.ctx.config.capture.fullUrls ? n : e(n);
|
|
90
|
-
this.ctx.diagnostics.guard("capture.record_failed", `
|
|
90
|
+
this.ctx.diagnostics.guard("capture.record_failed", `The library could not record ${t} ${o}.`, () => {
|
|
91
91
|
let e = Math.round(i);
|
|
92
92
|
this.ctx.breadcrumbs.push({
|
|
93
93
|
t: Date.now(),
|
|
@@ -108,4 +108,4 @@ var r = class {
|
|
|
108
108
|
//#endregion
|
|
109
109
|
export { r as NetworkCapture };
|
|
110
110
|
|
|
111
|
-
//# sourceMappingURL=network-
|
|
111
|
+
//# sourceMappingURL=network-jQ2t8rU4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-jQ2t8rU4.js","names":["stripUrlQuery","matchesAny","patterns","pattern","url","xhrMethods","NetworkCapture","ctx","original","ignored","record","method","status","durationMs","error","input","init","fetchInput","fetchInit","injected","headers","key","value","startedAt","response","proto","originalOpen","originalSend","rest","args","meta","target","rounded","attributes"],"sources":["../src/capture/types.ts","../src/capture/network.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 { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\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}\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}\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 * Evaluates whether a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: string, patterns: (string | RegExp)[]): boolean {\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n","// src/capture/network.ts\n//\n// Instruments fetch and XMLHttpRequest to record network request outcomes and timing.\n\nimport { stripUrlQuery } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Signature of the global fetch function. */\ntype FetchFn = typeof fetch;\n\n/** XMLHttpRequest extended with internal telemetry tracking metadata. */\ntype Tracked = XMLHttpRequest & {\n __uiobs?: { method: string; url: string; startedAt: number };\n};\n\n/** Unbound prototype methods intercepted on XMLHttpRequest. */\ninterface XhrMethods {\n open: (this: XMLHttpRequest, ...args: never[]) => void;\n send: (this: XMLHttpRequest, ...args: never[]) => void;\n}\n\n/** Returns the XMLHttpRequest prototype. */\nfunction xhrMethods(): XhrMethods {\n return XMLHttpRequest.prototype;\n}\n\n/** Instruments global fetch and XMLHttpRequest to capture request durations and outcomes. */\nexport class NetworkCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"network\";\n\n /** Original uninstrumented fetch implementation. */\n private originalFetch: FetchFn | null = null;\n\n /** Original uninstrumented XMLHttpRequest.open implementation. */\n private originalOpen: XhrMethods[\"open\"] | null = null;\n\n /** Original uninstrumented XMLHttpRequest.send implementation. */\n private originalSend: XhrMethods[\"send\"] | null = null;\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, breadcrumbs, and tracing.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Instruments configured network transport APIs. */\n install(): void {\n if (this.ctx.config.capture.fetch) {\n this.installFetch();\n }\n if (this.ctx.config.capture.xhr) {\n this.installXhr();\n }\n }\n\n /** Restores native network transport implementations and clears references. */\n uninstall(): void {\n if (this.originalFetch) {\n globalThis.fetch = this.originalFetch;\n this.originalFetch = null;\n }\n if (this.originalOpen) {\n xhrMethods().open = this.originalOpen;\n this.originalOpen = null;\n }\n if (this.originalSend) {\n xhrMethods().send = this.originalSend;\n this.originalSend = null;\n }\n }\n\n /**\n * Evaluates whether a URL matches ignore patterns.\n * @param url Request target URL.\n * @returns True if telemetry must exclude the URL.\n */\n private ignored(url: string): boolean {\n // resolveConfig always adds the endpoint to ignoreUrls. Without it, a failed POST\n // makes a log record. That record causes a new POST, and the loop does not stop.\n return matchesAny(url, this.ctx.config.capture.ignoreUrls);\n }\n\n /** Instruments globalThis.fetch with tracing injection and outcome logging. */\n private installFetch(): void {\n if (typeof globalThis.fetch !== \"function\" || this.originalFetch) {\n return;\n }\n\n const original = globalThis.fetch.bind(globalThis);\n this.originalFetch = globalThis.fetch;\n\n const ctx = this.ctx;\n const ignored = (url: string): boolean => this.ignored(url);\n const record = (\n method: string,\n url: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void => {\n this.record(method, url, status, durationMs, error);\n };\n\n globalThis.fetch = async function instrumentedFetch(input, init) {\n const url = typeof input === \"string\" ? input : input instanceof URL ? input.href : input.url;\n const requested = init?.method ?? (input instanceof Request ? input.method : \"GET\");\n const method = requested.toUpperCase();\n\n if (ignored(url)) {\n return original(input, init);\n }\n\n let fetchInput = input;\n let fetchInit = init;\n\n // Add headers only to allowlisted URLs. A traceparent on a third-party request causes\n // a CORS preflight. The third party does not answer it, and its API stops working.\n if (matchesAny(url, ctx.config.capture.propagateTraceHeaderTo)) {\n try {\n const injected = Object.entries(ctx.tracing.headers());\n\n if (input instanceof Request) {\n // Do not spread a non-empty init with a Request input. That runs the Request\n // constructor on `input` again and reads its body. A body that was read\n // before causes a TypeError.\n const headers = new Headers(input.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n fetchInput = new Request(input, { headers });\n } else {\n const headers = new Headers(init?.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n fetchInit = { ...init, headers };\n }\n } catch (error) {\n // Send the request that the caller gave, without changes. A missing header is\n // better than a failed request.\n fetchInput = input;\n fetchInit = init;\n ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n }\n }\n\n const startedAt = performance.now();\n try {\n const response = await original(fetchInput, fetchInit);\n record(method, url, response.status, performance.now() - startedAt, undefined);\n return response;\n } catch (error) {\n record(method, url, 0, performance.now() - startedAt, error);\n throw error;\n }\n };\n }\n\n /** Instruments XMLHttpRequest open and send prototype methods. */\n private installXhr(): void {\n if (typeof XMLHttpRequest === \"undefined\" || this.originalOpen) {\n return;\n }\n\n const ignored = (url: string): boolean => this.ignored(url);\n const record = (method: string, url: string, status: number, durationMs: number): void => {\n this.record(method, url, status, durationMs, undefined);\n };\n\n const proto = xhrMethods();\n const originalOpen = proto.open;\n const originalSend = proto.send;\n this.originalOpen = originalOpen;\n this.originalSend = originalSend;\n\n proto.open = function (this: Tracked, method: string, url: string | URL, ...rest: never[]) {\n this.__uiobs = {\n method: method.toUpperCase(),\n url: String(url),\n startedAt: 0,\n };\n originalOpen.apply(this, [method, url, ...rest] as never[]);\n };\n\n proto.send = function (this: Tracked, ...args: never[]) {\n const meta = this.__uiobs;\n if (meta && !ignored(meta.url)) {\n meta.startedAt = performance.now();\n this.addEventListener(\"loadend\", () => {\n record(meta.method, meta.url, this.status, performance.now() - meta.startedAt);\n });\n }\n originalSend.apply(this, args);\n };\n }\n\n /**\n * Records request outcome attributes and breadcrumb entry.\n * @param method Uppercase HTTP method.\n * @param target Request target URL. The method removes the query unless fullUrls is set.\n * @param status HTTP response status code, or 0 on failure.\n * @param durationMs Request duration in milliseconds.\n * @param error Caught error instance on failed requests.\n */\n private record(\n method: string,\n target: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void {\n // Remove the query here, not at the call sites. ignoreUrls and propagateTraceHeaderTo\n // match on the full URL. Only the recorded URL loses the query string.\n const url = this.ctx.config.capture.fullUrls ? target : stripUrlQuery(target);\n\n // This code runs inside the fetch call of the caller. An error here must not cause\n // the request of the caller to fail.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${method} ${url}.`,\n () => {\n const rounded = Math.round(durationMs);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `${method} ${url} ${status === 0 ? \"failed\" : String(status)}`,\n data: { durationMs: rounded },\n });\n\n const attributes = {\n \"http.request.method\": method,\n \"url.full\": url,\n \"http.response.status_code\": status,\n \"http.duration_ms\": rounded,\n };\n\n if (status === 0) {\n this.ctx.logger.error(`${method} ${url} failed`, error, attributes);\n return;\n }\n if (status >= 400) {\n this.ctx.logger.warn(`${method} ${url} returned ${String(status)}`, attributes);\n return;\n }\n\n // Log a success at DEBUG. The default minLevel of INFO drops it.\n // Only failures use bandwidth.\n this.ctx.logger.debug(`${method} ${url}`, attributes);\n },\n );\n }\n}\n"],"mappings":";;AA8GA,SAAgBC,EAAW,GAAa,GAAwC;CAC9E,OAAOC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWC,EAAI,SAASD,CAAO,IAAIA,EAAQ,KAAKC,CAAG,CACxE;AACF;;;AC5FA,SAASC,IAAyB;CAChC,OAAO,eAAe;AACxB;AAGA,IAAaC,IAAb,MAA+C;CAgBhB;CAd7B,OAAgB;CAGhB,gBAAwC;CAGxC,eAAkD;CAGlD,eAAkD;CAKlD,YAAY,GAAsC;EAArB,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EAId,AAHI,KAAK,IAAI,OAAO,QAAQ,SAC1B,KAAK,aAAa,GAEhB,KAAK,IAAI,OAAO,QAAQ,OAC1B,KAAK,WAAW;CAEpB;CAGA,YAAkB;EAShB,AARA,AAEE,KAAK,mBADL,WAAW,QAAQ,KAAK,eACH,OAEvB,AAEE,KAAK,kBADL,EAAW,CAAC,CAAC,OAAO,KAAK,cACL,OAEtB,AAEE,KAAK,kBADL,EAAW,CAAC,CAAC,OAAO,KAAK,cACL;CAExB;CAOA,QAAgB,GAAsB;EAGpC,OAAON,EAAWG,GAAK,KAAK,IAAI,OAAO,QAAQ,UAAU;CAC3D;CAGA,eAA6B;EAC3B,IAAI,OAAO,WAAW,SAAU,cAAc,KAAK,eACjD;EAGF,IAAMI,IAAW,WAAW,MAAM,KAAK,UAAU;EACjD,KAAK,gBAAgB,WAAW;EAEhC,IAAMD,IAAM,KAAK,KACXE,KAAW,MAAyB,KAAK,QAAQL,CAAG,GACpDM,KACJ,GACA,GACA,GACA,GACA,MACS;GACT,KAAK,OAAOC,GAAQP,GAAKQ,GAAQC,GAAYC,CAAK;EACpD;EAEA,WAAW,QAAQ,eAAiC,GAAO,GAAM;GAC/D,IAAMV,IAAM,O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oBAAoBoB;GACtB;GAEA,AAAIpB,MAAW,IACb,KAAK,IAAI,OAAO,MAAM,GAAGD,EAAO,GAAGP,EAAI,UAAUU,GAAOmB,CAAU,IAGhErB,KAAU,MACZ,KAAK,IAAI,OAAO,KAAK,GAAGD,EAAO,GAAGP,EAAI,YAAY,OAAOQ,CAAM,KAAKqB,CAAU,IAMhF,KAAK,IAAI,OAAO,MAAM,GAAGtB,EAAO,GAAGP,KAAO6B,CAAU;EACtD,CACF;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-IBL_jd5R.cjs");var t=null;function n(e,t){let n=e[t];return n!==void 0&&e instanceof n}function r(r){if(t)return t;let o=globalThis,s=o.navigator?.userAgent??``,c=`browser`,l,u,d=!1,f=o.fin?.me;return n(o,`ServiceWorkerGlobalScope`)?(c=`service_worker`,d=!0):n(o,`SharedWorkerGlobalScope`)?(c=`shared_worker`,d=!0):n(o,`WorkerGlobalScope`)?(c=`web_worker`,d=!0):f===void 0?o.Capacitor!==void 0||o.Ionic!==void 0?c=`ionic`:o.cordova!==void 0||i(s)?c=`mobile_webview`:typeof document>`u`&&typeof process<`u`&&(c=`node`):(c=e.gt.test(s)?`openfin`:`openfin_web`,r.guard(`openfin.unavailable`,`The library could not read fin.me.identity.`,()=>{let e=f.identity;l=e?.uuid,u=e?.name})),t={platform:c,openfinUuid:l,openfinName:u,userAgent:s,isWorker:d,isTopLevelDocument:a(r)},t}function i(t){return e.t.test(t)?!0:(e.et.test(t)||e.ct.test(t)&&e.dt.test(t))&&t.includes(`AppleWebKit`)&&!t.includes(`Safari/`)}function a(e){if(typeof window>`u`)return!1;try{return window.self===window.top}catch{return e.count(`platform.api_blocked`),!1}}function o(e){try{return typeof location<`u`?location.href:``}catch{return e.count(`platform.api_blocked`),``}}function s(e){let t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
2
|
+
//# sourceMappingURL=platform-ByQllE_W.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-ByQllE_W.cjs","names":["OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","require_constants","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","currentUrl","stripUrlQuery","cut","url"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker\n// execution realms. The module caches the result. The result does not change during\n// the life of a realm. A webview is also a browser. Test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** Indicates whether execution occurs inside any worker realm. */\n isWorker: boolean;\n /** Indicates whether this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Evaluates whether globalThis is an instance of a specified global scope constructor.\n * @param g Global scope object.\n * @param name Scope constructor name to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/** Structural interface for OpenFin identity inspection. */\ninterface FinLike {\n me?: { identity?: { uuid?: string; name?: string } };\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = (g.fin as FinLike | undefined)?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Evaluates whether a user agent string represents an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Determines whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. It counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read. That proves a frame. Count it. Do not report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Retrieves the current document URL without caching.\n * @param diagnostics Diagnostics reporter. It counts a blocked read of location.href.\n * @returns Current location.href or empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault. A report on each record is noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/**\n * Drops the query string and fragment from a URL.\n * It cuts the string and does not parse a URL. A relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void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AAW,IACpB,MAAO,GAET,GAAI,CACF,OAAO,OAAO,OAAS,OAAO,GAChC,MAAQ,CAGN,OADAF,EAAY,MAAM,sBAAsB,EACjC,EACT,CACF,CAOA,SAAgBG,EAAW,EAAkC,CAC3D,GAAI,CACF,OAAO,OAAO,SAAa,IAAc,SAAS,KAAO,EAC3D,MAAQ,CAGN,OADAH,EAAY,MAAM,sBAAsB,EACjC,EACT,CACF,CAQA,SAAgBI,EAAc,EAAqB,CACjD,IAAMC,EAAMC,EAAI,OAAO,MAAM,EAE7B,OAAOD,IAAQ,GAAKC,EAAMA,EAAI,MAAM,EAAGD,CAAG,CAC5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ct as e, dt as t, et as n, gt as r, t as i } from "./constants-
|
|
1
|
+
import { ct as e, dt as t, et as n, gt as r, t as i } from "./constants-C8nZQBmQ.js";
|
|
2
2
|
//#region src/utils/platform.ts
|
|
3
3
|
var a = null;
|
|
4
4
|
function o(e, t) {
|
|
@@ -8,7 +8,7 @@ function o(e, t) {
|
|
|
8
8
|
function s(e) {
|
|
9
9
|
if (a) return a;
|
|
10
10
|
let t = globalThis, n = t.navigator?.userAgent ?? "", i = "browser", s, u, d = !1, f = t.fin?.me;
|
|
11
|
-
return o(t, "ServiceWorkerGlobalScope") ? (i = "service_worker", d = !0) : o(t, "SharedWorkerGlobalScope") ? (i = "shared_worker", d = !0) : o(t, "WorkerGlobalScope") ? (i = "web_worker", d = !0) : f === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? i = "ionic" : t.cordova !== void 0 || c(n) ? i = "mobile_webview" : typeof document > "u" && typeof process < "u" && (i = "node") : (i = r.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "
|
|
11
|
+
return o(t, "ServiceWorkerGlobalScope") ? (i = "service_worker", d = !0) : o(t, "SharedWorkerGlobalScope") ? (i = "shared_worker", d = !0) : o(t, "WorkerGlobalScope") ? (i = "web_worker", d = !0) : f === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? i = "ionic" : t.cordova !== void 0 || c(n) ? i = "mobile_webview" : typeof document > "u" && typeof process < "u" && (i = "node") : (i = r.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "The library could not read fin.me.identity.", () => {
|
|
12
12
|
let e = f.identity;
|
|
13
13
|
s = e?.uuid, u = e?.name;
|
|
14
14
|
})), a = {
|
|
@@ -17,25 +17,25 @@ function s(e) {
|
|
|
17
17
|
openfinName: u,
|
|
18
18
|
userAgent: n,
|
|
19
19
|
isWorker: d,
|
|
20
|
-
isTopLevelDocument: l()
|
|
20
|
+
isTopLevelDocument: l(e)
|
|
21
21
|
}, a;
|
|
22
22
|
}
|
|
23
23
|
function c(r) {
|
|
24
24
|
return i.test(r) ? !0 : (n.test(r) || e.test(r) && t.test(r)) && r.includes("AppleWebKit") && !r.includes("Safari/");
|
|
25
25
|
}
|
|
26
|
-
function l() {
|
|
26
|
+
function l(e) {
|
|
27
27
|
if (typeof window > "u") return !1;
|
|
28
28
|
try {
|
|
29
29
|
return window.self === window.top;
|
|
30
30
|
} catch {
|
|
31
|
-
return !1;
|
|
31
|
+
return e.count("platform.api_blocked"), !1;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function u() {
|
|
34
|
+
function u(e) {
|
|
35
35
|
try {
|
|
36
36
|
return typeof location < "u" ? location.href : "";
|
|
37
37
|
} catch {
|
|
38
|
-
return "";
|
|
38
|
+
return e.count("platform.api_blocked"), "";
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function d(e) {
|
|
@@ -45,4 +45,4 @@ function d(e) {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { s as n, d as r, u as t };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=platform-
|
|
48
|
+
//# sourceMappingURL=platform-YuByH8A5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-YuByH8A5.js","names":["MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","IOS_DEVICE_UA_PATTERN","OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","currentUrl","stripUrlQuery","cut","url"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker\n// execution realms. The module caches the result. The result does not change during\n// the life of a realm. A webview is also a browser. Test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** Indicates whether execution occurs inside any worker realm. */\n isWorker: boolean;\n /** Indicates whether this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Evaluates whether globalThis is an instance of a specified global scope constructor.\n * @param g Global scope object.\n * @param name Scope constructor name to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/** Structural interface for OpenFin identity inspection. */\ninterface FinLike {\n me?: { identity?: { uuid?: string; name?: string } };\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = (g.fin as FinLike | undefined)?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Evaluates whether a user agent string represents an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Determines whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. It counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read. That proves a frame. Count it. Do not report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Retrieves the current document URL without caching.\n * @param diagnostics Diagnostics reporter. It counts a blocked read of location.href.\n * @returns Current location.href or empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault. A report on each record is noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/**\n * Drops the query string and fragment from a URL.\n * It cuts the string and does not parse a URL. A relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void {\n cached = null;\n}\n"],"mappings":";;AAiDA,IAAIK,IAAkC;AAWtC,SAASC,EAAc,GAAW,GAAuB;CACvD,IAAMC,IAAQC,EAAEC;CAIhB,OAHIF,MAAU,KAAA,KAGPC,aAAcD;AACvB;AAYA,SAAgBG,EAAe,GAA4C;CACzE,IAAIL,GACF,O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