@flareapp/core 2.10.0 → 2.12.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/dist/index.cjs +101 -114
- package/dist/index.d.cts +81 -49
- package/dist/index.d.mts +81 -49
- package/dist/index.mjs +96 -113
- package/dist/{urlAttributes-CYsfTfi9.d.mts → urlAttributes-CU2Yr37w.d.cts} +24 -9
- package/dist/{urlAttributes-B37JykP3.cjs → urlAttributes-D0eXRrGm.cjs} +35 -24
- package/dist/{urlAttributes-DeDN7qtu.mjs → urlAttributes-ggdpIKSS.mjs} +24 -25
- package/dist/{urlAttributes-DW_i-YQ3.d.cts → urlAttributes-rWoVW31H.d.mts} +24 -9
- package/dist/util/index.cjs +3 -1
- package/dist/util/index.d.cts +2 -2
- package/dist/util/index.d.mts +2 -2
- package/dist/util/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/framework.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Framework names the Flare backend
|
|
4
|
-
* `flare.framework.name` and (lowercased) as `context.custom.framework`.
|
|
3
|
+
* Framework names the Flare backend recognizes. Wire format: these values never change, since they
|
|
4
|
+
* ship as `flare.framework.name` and (lowercased) as `context.custom.framework`.
|
|
5
5
|
*
|
|
6
|
-
* `Js` and `Node` are the base SDKs
|
|
7
|
-
* own name. `NodeElectron` is
|
|
6
|
+
* `Js` and `Node` are fallback claims from the base SDKs, overwritten when a framework package sets
|
|
7
|
+
* its own name. `NodeElectron` is the Electron main process; renderers report their own name.
|
|
8
8
|
*/
|
|
9
9
|
declare const FrameworkName: {
|
|
10
10
|
readonly Js: "js";
|
|
@@ -20,7 +20,7 @@ type FrameworkName = (typeof FrameworkName)[keyof typeof FrameworkName];
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/spanTypes.d.ts
|
|
22
22
|
/**
|
|
23
|
-
* Span types the Flare backend
|
|
23
|
+
* Span types the Flare backend recognizes. Wire format, so the values never change: they ship as the
|
|
24
24
|
* `flare.span_type` attribute and the backend groups performance data by them.
|
|
25
25
|
*
|
|
26
26
|
* These are the browser client's set. They live in core because core's `SpanOptions.spanType` needs
|
|
@@ -37,6 +37,10 @@ declare const BrowserSpanType: {
|
|
|
37
37
|
type BrowserSpanType = (typeof BrowserSpanType)[keyof typeof BrowserSpanType];
|
|
38
38
|
/** Any other value stays legal, so a host SDK can stamp its own without a core release. */
|
|
39
39
|
type SpanTypeName = BrowserSpanType | (string & {});
|
|
40
|
+
/**
|
|
41
|
+
* Span event types on an error report. Kept apart from `BrowserSpanType`: these are points in time,
|
|
42
|
+
* not spans with a duration. That is also why a route change is not called `browser_navigation`.
|
|
43
|
+
*/
|
|
40
44
|
declare const BrowserSpanEventType: {
|
|
41
45
|
readonly Click: "browser_click";
|
|
42
46
|
readonly Input: "browser_input";
|
|
@@ -363,6 +367,9 @@ declare function createIdentityTagger(config: {
|
|
|
363
367
|
tagFramework(flare: SdkTaggable, frameworkVersion?: string): void;
|
|
364
368
|
};
|
|
365
369
|
//#endregion
|
|
370
|
+
//#region src/util/evictLruIfNew.d.ts
|
|
371
|
+
declare function evictLruIfNew<V>(map: Map<string, V>, key: string, cap: number): void;
|
|
372
|
+
//#endregion
|
|
366
373
|
//#region src/util/extractCode.d.ts
|
|
367
374
|
declare function extractCode(error: Error): string | undefined;
|
|
368
375
|
//#endregion
|
|
@@ -384,6 +391,10 @@ declare function timelineEvents(glows: Glow[], breadcrumbs: SpanEvent[]): SpanEv
|
|
|
384
391
|
declare function now(): number;
|
|
385
392
|
//#endregion
|
|
386
393
|
//#region src/util/redactUrl.d.ts
|
|
394
|
+
/**
|
|
395
|
+
* Matched against query-string keys, cookie names, and (in framework SDKs) prop/route-param keys. Values for
|
|
396
|
+
* matching keys are replaced with [redacted] before sending so credentials/PII don't leak in error reports.
|
|
397
|
+
*/
|
|
387
398
|
declare const DEFAULT_URL_DENYLIST: RegExp;
|
|
388
399
|
declare function resolveDenylist(custom?: RegExp, replaceDefault?: boolean, defaultDenylist?: RegExp): RegExp;
|
|
389
400
|
/**
|
|
@@ -411,9 +422,9 @@ type RejectionReporter = {
|
|
|
411
422
|
declare function describeRejectionReason(reason: unknown): string;
|
|
412
423
|
/**
|
|
413
424
|
* Routes by whether `reason` carries a stack: stack-bearing reasons go to `reportSilently`, stackless
|
|
414
|
-
* ones to `reportUnhandledRejection`.
|
|
415
|
-
*
|
|
416
|
-
*
|
|
425
|
+
* ones to `reportUnhandledRejection`. The `.catch` stops a transport failure from surfacing as a second
|
|
426
|
+
* unhandled rejection. `reportSilently` is assumed async and left unwrapped, so a synchronous throw there
|
|
427
|
+
* still propagates.
|
|
417
428
|
*/
|
|
418
429
|
declare function routeRejection(reporter: RejectionReporter, reason: unknown): void;
|
|
419
430
|
//#endregion
|
|
@@ -437,6 +448,10 @@ type SafeCloneOptions = {
|
|
|
437
448
|
*/
|
|
438
449
|
declare function safeClone(value: unknown, options: SafeCloneOptions): unknown;
|
|
439
450
|
//#endregion
|
|
451
|
+
//#region src/util/setDefined.d.ts
|
|
452
|
+
/** Assign the value only when it is neither undefined nor null. */
|
|
453
|
+
declare function setDefined(target: Attributes, key: string, value: AttributeValue | undefined): void;
|
|
454
|
+
//#endregion
|
|
440
455
|
//#region src/util/statelessRegExp.d.ts
|
|
441
456
|
/**
|
|
442
457
|
* A `/g` or `/y` regex carries `lastIndex` between `test()` calls, so every other call misses. Returns
|
|
@@ -463,4 +478,4 @@ declare const MAX_URL_LENGTH = 2048;
|
|
|
463
478
|
*/
|
|
464
479
|
declare function urlAttributes(url: string, denylist?: RegExp): Attributes;
|
|
465
480
|
//#endregion
|
|
466
|
-
export {
|
|
481
|
+
export { StackFrame as $, AttributeValue as A, LogsEnvelope as B, createIdentityTagger as C, assertKey as D, createComponentMatcher as E, EntryPointHandler as F, Report as G, OtelLogRecord as H, EntryPointType as I, Span as J, SamplingContext as K, Framework as L, BufferedLog as M, BufferedSpan as N, assert as O, Config as P, SpanStatusCode as Q, Glow as R, SdkTaggable as S, ProfileComponentsOption as T, OtelSpan as U, MessageLevel as V, OverriddenGrouping as W, SpanOptions as X, SpanEvent as Y, SpanStatus as Z, timelineEvents as _, setDefined as a, SpanTypeName as at, extractCode as b, RejectionReporter as c, DEFAULT_URL_DENYLIST as d, TracesEnvelope as et, redactObjectValues as f, now as g, safeDecode as h, withoutStatefulFlags as i, BrowserSpanType as it, Attributes as j, AnyValue as k, describeRejectionReason as l, resolveDenylist as m, urlAttributes as n, User as nt, SafeCloneOptions as o, FrameworkName as ot, redactUrlQuery as p, SdkInfo as q, toCustomContext as r, BrowserSpanEventType as rt, safeClone as s, MAX_URL_LENGTH as t, TracesSampler as tt, routeRejection as u, glowsToEvents as v, convertToError as w, evictLruIfNew as x, flatJsonStringify as y, KeyValue as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/env/index.ts
|
|
3
|
-
const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.
|
|
3
|
+
const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
|
|
4
4
|
const KEY = typeof FLARE_JS_KEY === "undefined" ? "" : FLARE_JS_KEY;
|
|
5
5
|
const SOURCEMAP_VERSION = typeof FLARE_SOURCEMAP_VERSION === "undefined" ? "" : FLARE_SOURCEMAP_VERSION;
|
|
6
6
|
|
|
@@ -87,6 +87,14 @@ function createIdentityTagger(config) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/util/evictLruIfNew.ts
|
|
92
|
+
function evictLruIfNew(map, key, cap) {
|
|
93
|
+
if (map.has(key) || map.size < cap) return;
|
|
94
|
+
const lru = map.keys().next().value;
|
|
95
|
+
if (lru !== void 0) map.delete(lru);
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
//#endregion
|
|
91
99
|
//#region src/util/extractCode.ts
|
|
92
100
|
const MAX_CODE_LENGTH = 64;
|
|
@@ -98,28 +106,16 @@ function extractCode(error) {
|
|
|
98
106
|
|
|
99
107
|
//#endregion
|
|
100
108
|
//#region src/util/traversalBudget.ts
|
|
101
|
-
/**
|
|
102
|
-
* Cycle detection only tracks the ancestor path, so a value holding the same child under two keys is not
|
|
103
|
-
* a cycle but still costs 2^depth to walk. Host data (glows, addContext, span attributes) reaches that
|
|
104
|
-
* shape through any object graph shared by reference.
|
|
105
|
-
*
|
|
106
|
-
* The node cap only bounds that walk if EVERY visited node is charged, primitive leaves included. It used
|
|
107
|
-
* to charge containers only, so 15 shared objects over an array of 1000 strings walked ~17M uncharged
|
|
108
|
-
* strings before the cap fired: 1.2s and 1GB. Callers must spend before their leaf branches return, not
|
|
109
|
-
* after. We do not memoize instead: a value shared under two keys is not a cycle and must not read as one.
|
|
110
|
-
*/
|
|
111
109
|
const MAX_TRAVERSAL_DEPTH = 24;
|
|
112
110
|
const MAX_TRAVERSAL_NODES = 5e4;
|
|
113
111
|
function createTraversalBudget(nodes = MAX_TRAVERSAL_NODES) {
|
|
114
112
|
return { remaining: nodes };
|
|
115
113
|
}
|
|
116
|
-
/** Consumes one node. False once the budget is spent: stop descending. */
|
|
117
114
|
function spendNode(budget) {
|
|
118
115
|
if (budget.remaining <= 0) return false;
|
|
119
116
|
budget.remaining--;
|
|
120
117
|
return true;
|
|
121
118
|
}
|
|
122
|
-
/** Marks where a walk stopped, so a truncated payload does not read as a complete one. */
|
|
123
119
|
const TRUNCATED = "[truncated: too large]";
|
|
124
120
|
|
|
125
121
|
//#endregion
|
|
@@ -182,10 +178,6 @@ function truncate(value, max) {
|
|
|
182
178
|
if (value.length <= max) return value;
|
|
183
179
|
return `${value.slice(0, max)}…[truncated ${value.length - max} chars]`;
|
|
184
180
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Literal object / null prototypes only. Class instances may have side-effecting getters or
|
|
187
|
-
* non-enumerable internals we should not traverse, so they are left to the caller's mode policy.
|
|
188
|
-
*/
|
|
189
181
|
function isPlainObject(value) {
|
|
190
182
|
if (value === null || typeof value !== "object") return false;
|
|
191
183
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -235,6 +227,10 @@ function now() {
|
|
|
235
227
|
|
|
236
228
|
//#endregion
|
|
237
229
|
//#region src/util/redactUrl.ts
|
|
230
|
+
/**
|
|
231
|
+
* Matched against query-string keys, cookie names, and (in framework SDKs) prop/route-param keys. Values for
|
|
232
|
+
* matching keys are replaced with [redacted] before sending so credentials/PII don't leak in error reports.
|
|
233
|
+
*/
|
|
238
234
|
const DEFAULT_URL_DENYLIST = /password|passwd|pwd|token|secret|authorization|\bauth\b|bearer|oauth|credentials?|cookie|api[-_]?key|private[-_]?key|session|csrf|xsrf|\bpin\b|\bssn\b|card[-_]?number|\bcvv\b/i;
|
|
239
235
|
function resolveDenylist(custom, replaceDefault = false, defaultDenylist = DEFAULT_URL_DENYLIST) {
|
|
240
236
|
if (!custom) return defaultDenylist;
|
|
@@ -284,10 +280,6 @@ function redactObjectValues(obj, denylist = DEFAULT_URL_DENYLIST) {
|
|
|
284
280
|
for (const key of Object.keys(obj)) result[key] = denylist.test(key) ? "[redacted]" : obj[key];
|
|
285
281
|
return result;
|
|
286
282
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Removes userinfo (`user:pass@`) from an absolute URL's authority only. A path or query can legally
|
|
289
|
-
* contain `@`, so only the authority (after `scheme://`, up to the first `/`, `?`, `#`) is inspected.
|
|
290
|
-
*/
|
|
291
283
|
function stripUserinfo(url) {
|
|
292
284
|
const schemeMatch = /^[a-z][a-z0-9+.-]*:\/\//i.exec(url);
|
|
293
285
|
if (!schemeMatch) return url;
|
|
@@ -333,9 +325,9 @@ function hasStack(reason) {
|
|
|
333
325
|
}
|
|
334
326
|
/**
|
|
335
327
|
* Routes by whether `reason` carries a stack: stack-bearing reasons go to `reportSilently`, stackless
|
|
336
|
-
* ones to `reportUnhandledRejection`.
|
|
337
|
-
*
|
|
338
|
-
*
|
|
328
|
+
* ones to `reportUnhandledRejection`. The `.catch` stops a transport failure from surfacing as a second
|
|
329
|
+
* unhandled rejection. `reportSilently` is assumed async and left unwrapped, so a synchronous throw there
|
|
330
|
+
* still propagates.
|
|
339
331
|
*/
|
|
340
332
|
function routeRejection(reporter, reason) {
|
|
341
333
|
if (reason instanceof Error) {
|
|
@@ -351,6 +343,13 @@ function routeRejection(reporter, reason) {
|
|
|
351
343
|
Promise.resolve(reporter.reportUnhandledRejection(describeRejectionReason(reason))).catch(() => {});
|
|
352
344
|
}
|
|
353
345
|
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/util/setDefined.ts
|
|
348
|
+
/** Assign the value only when it is neither undefined nor null. */
|
|
349
|
+
function setDefined(target, key, value) {
|
|
350
|
+
if (value !== void 0 && value !== null) target[key] = value;
|
|
351
|
+
}
|
|
352
|
+
|
|
354
353
|
//#endregion
|
|
355
354
|
//#region src/util/toCustomContext.ts
|
|
356
355
|
/** Wraps a framework payload as the `context.custom` attribute a report expects. */
|
|
@@ -474,6 +473,12 @@ Object.defineProperty(exports, 'describeRejectionReason', {
|
|
|
474
473
|
return describeRejectionReason;
|
|
475
474
|
}
|
|
476
475
|
});
|
|
476
|
+
Object.defineProperty(exports, 'evictLruIfNew', {
|
|
477
|
+
enumerable: true,
|
|
478
|
+
get: function () {
|
|
479
|
+
return evictLruIfNew;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
477
482
|
Object.defineProperty(exports, 'extractCode', {
|
|
478
483
|
enumerable: true,
|
|
479
484
|
get: function () {
|
|
@@ -534,6 +539,12 @@ Object.defineProperty(exports, 'safeDecode', {
|
|
|
534
539
|
return safeDecode;
|
|
535
540
|
}
|
|
536
541
|
});
|
|
542
|
+
Object.defineProperty(exports, 'setDefined', {
|
|
543
|
+
enumerable: true,
|
|
544
|
+
get: function () {
|
|
545
|
+
return setDefined;
|
|
546
|
+
}
|
|
547
|
+
});
|
|
537
548
|
Object.defineProperty(exports, 'spendNode', {
|
|
538
549
|
enumerable: true,
|
|
539
550
|
get: function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/env/index.ts
|
|
2
|
-
const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.
|
|
2
|
+
const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.12.0" : "?";
|
|
3
3
|
const KEY = typeof FLARE_JS_KEY === "undefined" ? "" : FLARE_JS_KEY;
|
|
4
4
|
const SOURCEMAP_VERSION = typeof FLARE_SOURCEMAP_VERSION === "undefined" ? "" : FLARE_SOURCEMAP_VERSION;
|
|
5
5
|
|
|
@@ -86,6 +86,14 @@ function createIdentityTagger(config) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/util/evictLruIfNew.ts
|
|
91
|
+
function evictLruIfNew(map, key, cap) {
|
|
92
|
+
if (map.has(key) || map.size < cap) return;
|
|
93
|
+
const lru = map.keys().next().value;
|
|
94
|
+
if (lru !== void 0) map.delete(lru);
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
//#endregion
|
|
90
98
|
//#region src/util/extractCode.ts
|
|
91
99
|
const MAX_CODE_LENGTH = 64;
|
|
@@ -97,28 +105,16 @@ function extractCode(error) {
|
|
|
97
105
|
|
|
98
106
|
//#endregion
|
|
99
107
|
//#region src/util/traversalBudget.ts
|
|
100
|
-
/**
|
|
101
|
-
* Cycle detection only tracks the ancestor path, so a value holding the same child under two keys is not
|
|
102
|
-
* a cycle but still costs 2^depth to walk. Host data (glows, addContext, span attributes) reaches that
|
|
103
|
-
* shape through any object graph shared by reference.
|
|
104
|
-
*
|
|
105
|
-
* The node cap only bounds that walk if EVERY visited node is charged, primitive leaves included. It used
|
|
106
|
-
* to charge containers only, so 15 shared objects over an array of 1000 strings walked ~17M uncharged
|
|
107
|
-
* strings before the cap fired: 1.2s and 1GB. Callers must spend before their leaf branches return, not
|
|
108
|
-
* after. We do not memoize instead: a value shared under two keys is not a cycle and must not read as one.
|
|
109
|
-
*/
|
|
110
108
|
const MAX_TRAVERSAL_DEPTH = 24;
|
|
111
109
|
const MAX_TRAVERSAL_NODES = 5e4;
|
|
112
110
|
function createTraversalBudget(nodes = MAX_TRAVERSAL_NODES) {
|
|
113
111
|
return { remaining: nodes };
|
|
114
112
|
}
|
|
115
|
-
/** Consumes one node. False once the budget is spent: stop descending. */
|
|
116
113
|
function spendNode(budget) {
|
|
117
114
|
if (budget.remaining <= 0) return false;
|
|
118
115
|
budget.remaining--;
|
|
119
116
|
return true;
|
|
120
117
|
}
|
|
121
|
-
/** Marks where a walk stopped, so a truncated payload does not read as a complete one. */
|
|
122
118
|
const TRUNCATED = "[truncated: too large]";
|
|
123
119
|
|
|
124
120
|
//#endregion
|
|
@@ -181,10 +177,6 @@ function truncate(value, max) {
|
|
|
181
177
|
if (value.length <= max) return value;
|
|
182
178
|
return `${value.slice(0, max)}…[truncated ${value.length - max} chars]`;
|
|
183
179
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Literal object / null prototypes only. Class instances may have side-effecting getters or
|
|
186
|
-
* non-enumerable internals we should not traverse, so they are left to the caller's mode policy.
|
|
187
|
-
*/
|
|
188
180
|
function isPlainObject(value) {
|
|
189
181
|
if (value === null || typeof value !== "object") return false;
|
|
190
182
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -234,6 +226,10 @@ function now() {
|
|
|
234
226
|
|
|
235
227
|
//#endregion
|
|
236
228
|
//#region src/util/redactUrl.ts
|
|
229
|
+
/**
|
|
230
|
+
* Matched against query-string keys, cookie names, and (in framework SDKs) prop/route-param keys. Values for
|
|
231
|
+
* matching keys are replaced with [redacted] before sending so credentials/PII don't leak in error reports.
|
|
232
|
+
*/
|
|
237
233
|
const DEFAULT_URL_DENYLIST = /password|passwd|pwd|token|secret|authorization|\bauth\b|bearer|oauth|credentials?|cookie|api[-_]?key|private[-_]?key|session|csrf|xsrf|\bpin\b|\bssn\b|card[-_]?number|\bcvv\b/i;
|
|
238
234
|
function resolveDenylist(custom, replaceDefault = false, defaultDenylist = DEFAULT_URL_DENYLIST) {
|
|
239
235
|
if (!custom) return defaultDenylist;
|
|
@@ -283,10 +279,6 @@ function redactObjectValues(obj, denylist = DEFAULT_URL_DENYLIST) {
|
|
|
283
279
|
for (const key of Object.keys(obj)) result[key] = denylist.test(key) ? "[redacted]" : obj[key];
|
|
284
280
|
return result;
|
|
285
281
|
}
|
|
286
|
-
/**
|
|
287
|
-
* Removes userinfo (`user:pass@`) from an absolute URL's authority only. A path or query can legally
|
|
288
|
-
* contain `@`, so only the authority (after `scheme://`, up to the first `/`, `?`, `#`) is inspected.
|
|
289
|
-
*/
|
|
290
282
|
function stripUserinfo(url) {
|
|
291
283
|
const schemeMatch = /^[a-z][a-z0-9+.-]*:\/\//i.exec(url);
|
|
292
284
|
if (!schemeMatch) return url;
|
|
@@ -332,9 +324,9 @@ function hasStack(reason) {
|
|
|
332
324
|
}
|
|
333
325
|
/**
|
|
334
326
|
* Routes by whether `reason` carries a stack: stack-bearing reasons go to `reportSilently`, stackless
|
|
335
|
-
* ones to `reportUnhandledRejection`.
|
|
336
|
-
*
|
|
337
|
-
*
|
|
327
|
+
* ones to `reportUnhandledRejection`. The `.catch` stops a transport failure from surfacing as a second
|
|
328
|
+
* unhandled rejection. `reportSilently` is assumed async and left unwrapped, so a synchronous throw there
|
|
329
|
+
* still propagates.
|
|
338
330
|
*/
|
|
339
331
|
function routeRejection(reporter, reason) {
|
|
340
332
|
if (reason instanceof Error) {
|
|
@@ -350,6 +342,13 @@ function routeRejection(reporter, reason) {
|
|
|
350
342
|
Promise.resolve(reporter.reportUnhandledRejection(describeRejectionReason(reason))).catch(() => {});
|
|
351
343
|
}
|
|
352
344
|
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/util/setDefined.ts
|
|
347
|
+
/** Assign the value only when it is neither undefined nor null. */
|
|
348
|
+
function setDefined(target, key, value) {
|
|
349
|
+
if (value !== void 0 && value !== null) target[key] = value;
|
|
350
|
+
}
|
|
351
|
+
|
|
353
352
|
//#endregion
|
|
354
353
|
//#region src/util/toCustomContext.ts
|
|
355
354
|
/** Wraps a framework payload as the `context.custom` attribute a report expects. */
|
|
@@ -389,4 +388,4 @@ function urlAttributes(url, denylist = DEFAULT_URL_DENYLIST) {
|
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
//#endregion
|
|
392
|
-
export {
|
|
391
|
+
export { KEY as A, createIdentityTagger as C, assertKey as D, withoutStatefulFlags as E, assert as O, evictLruIfNew as S, createComponentMatcher as T, MAX_TRAVERSAL_DEPTH as _, describeRejectionReason as a, spendNode as b, redactObjectValues as c, safeDecode as d, now as f, safeClone as g, flatJsonStringify as h, setDefined as i, SOURCEMAP_VERSION as j, CLIENT_VERSION as k, redactUrlQuery as l, glowsToEvents as m, urlAttributes as n, routeRejection as o, timelineEvents as p, toCustomContext as r, DEFAULT_URL_DENYLIST as s, MAX_URL_LENGTH as t, resolveDenylist as u, TRUNCATED as v, convertToError as w, extractCode as x, createTraversalBudget as y };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/framework.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Framework names the Flare backend
|
|
4
|
-
* `flare.framework.name` and (lowercased) as `context.custom.framework`.
|
|
3
|
+
* Framework names the Flare backend recognizes. Wire format: these values never change, since they
|
|
4
|
+
* ship as `flare.framework.name` and (lowercased) as `context.custom.framework`.
|
|
5
5
|
*
|
|
6
|
-
* `Js` and `Node` are the base SDKs
|
|
7
|
-
* own name. `NodeElectron` is
|
|
6
|
+
* `Js` and `Node` are fallback claims from the base SDKs, overwritten when a framework package sets
|
|
7
|
+
* its own name. `NodeElectron` is the Electron main process; renderers report their own name.
|
|
8
8
|
*/
|
|
9
9
|
declare const FrameworkName: {
|
|
10
10
|
readonly Js: "js";
|
|
@@ -20,7 +20,7 @@ type FrameworkName = (typeof FrameworkName)[keyof typeof FrameworkName];
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/spanTypes.d.ts
|
|
22
22
|
/**
|
|
23
|
-
* Span types the Flare backend
|
|
23
|
+
* Span types the Flare backend recognizes. Wire format, so the values never change: they ship as the
|
|
24
24
|
* `flare.span_type` attribute and the backend groups performance data by them.
|
|
25
25
|
*
|
|
26
26
|
* These are the browser client's set. They live in core because core's `SpanOptions.spanType` needs
|
|
@@ -37,6 +37,10 @@ declare const BrowserSpanType: {
|
|
|
37
37
|
type BrowserSpanType = (typeof BrowserSpanType)[keyof typeof BrowserSpanType];
|
|
38
38
|
/** Any other value stays legal, so a host SDK can stamp its own without a core release. */
|
|
39
39
|
type SpanTypeName = BrowserSpanType | (string & {});
|
|
40
|
+
/**
|
|
41
|
+
* Span event types on an error report. Kept apart from `BrowserSpanType`: these are points in time,
|
|
42
|
+
* not spans with a duration. That is also why a route change is not called `browser_navigation`.
|
|
43
|
+
*/
|
|
40
44
|
declare const BrowserSpanEventType: {
|
|
41
45
|
readonly Click: "browser_click";
|
|
42
46
|
readonly Input: "browser_input";
|
|
@@ -363,6 +367,9 @@ declare function createIdentityTagger(config: {
|
|
|
363
367
|
tagFramework(flare: SdkTaggable, frameworkVersion?: string): void;
|
|
364
368
|
};
|
|
365
369
|
//#endregion
|
|
370
|
+
//#region src/util/evictLruIfNew.d.ts
|
|
371
|
+
declare function evictLruIfNew<V>(map: Map<string, V>, key: string, cap: number): void;
|
|
372
|
+
//#endregion
|
|
366
373
|
//#region src/util/extractCode.d.ts
|
|
367
374
|
declare function extractCode(error: Error): string | undefined;
|
|
368
375
|
//#endregion
|
|
@@ -384,6 +391,10 @@ declare function timelineEvents(glows: Glow[], breadcrumbs: SpanEvent[]): SpanEv
|
|
|
384
391
|
declare function now(): number;
|
|
385
392
|
//#endregion
|
|
386
393
|
//#region src/util/redactUrl.d.ts
|
|
394
|
+
/**
|
|
395
|
+
* Matched against query-string keys, cookie names, and (in framework SDKs) prop/route-param keys. Values for
|
|
396
|
+
* matching keys are replaced with [redacted] before sending so credentials/PII don't leak in error reports.
|
|
397
|
+
*/
|
|
387
398
|
declare const DEFAULT_URL_DENYLIST: RegExp;
|
|
388
399
|
declare function resolveDenylist(custom?: RegExp, replaceDefault?: boolean, defaultDenylist?: RegExp): RegExp;
|
|
389
400
|
/**
|
|
@@ -411,9 +422,9 @@ type RejectionReporter = {
|
|
|
411
422
|
declare function describeRejectionReason(reason: unknown): string;
|
|
412
423
|
/**
|
|
413
424
|
* Routes by whether `reason` carries a stack: stack-bearing reasons go to `reportSilently`, stackless
|
|
414
|
-
* ones to `reportUnhandledRejection`.
|
|
415
|
-
*
|
|
416
|
-
*
|
|
425
|
+
* ones to `reportUnhandledRejection`. The `.catch` stops a transport failure from surfacing as a second
|
|
426
|
+
* unhandled rejection. `reportSilently` is assumed async and left unwrapped, so a synchronous throw there
|
|
427
|
+
* still propagates.
|
|
417
428
|
*/
|
|
418
429
|
declare function routeRejection(reporter: RejectionReporter, reason: unknown): void;
|
|
419
430
|
//#endregion
|
|
@@ -437,6 +448,10 @@ type SafeCloneOptions = {
|
|
|
437
448
|
*/
|
|
438
449
|
declare function safeClone(value: unknown, options: SafeCloneOptions): unknown;
|
|
439
450
|
//#endregion
|
|
451
|
+
//#region src/util/setDefined.d.ts
|
|
452
|
+
/** Assign the value only when it is neither undefined nor null. */
|
|
453
|
+
declare function setDefined(target: Attributes, key: string, value: AttributeValue | undefined): void;
|
|
454
|
+
//#endregion
|
|
440
455
|
//#region src/util/statelessRegExp.d.ts
|
|
441
456
|
/**
|
|
442
457
|
* A `/g` or `/y` regex carries `lastIndex` between `test()` calls, so every other call misses. Returns
|
|
@@ -463,4 +478,4 @@ declare const MAX_URL_LENGTH = 2048;
|
|
|
463
478
|
*/
|
|
464
479
|
declare function urlAttributes(url: string, denylist?: RegExp): Attributes;
|
|
465
480
|
//#endregion
|
|
466
|
-
export {
|
|
481
|
+
export { StackFrame as $, AttributeValue as A, LogsEnvelope as B, createIdentityTagger as C, assertKey as D, createComponentMatcher as E, EntryPointHandler as F, Report as G, OtelLogRecord as H, EntryPointType as I, Span as J, SamplingContext as K, Framework as L, BufferedLog as M, BufferedSpan as N, assert as O, Config as P, SpanStatusCode as Q, Glow as R, SdkTaggable as S, ProfileComponentsOption as T, OtelSpan as U, MessageLevel as V, OverriddenGrouping as W, SpanOptions as X, SpanEvent as Y, SpanStatus as Z, timelineEvents as _, setDefined as a, SpanTypeName as at, extractCode as b, RejectionReporter as c, DEFAULT_URL_DENYLIST as d, TracesEnvelope as et, redactObjectValues as f, now as g, safeDecode as h, withoutStatefulFlags as i, BrowserSpanType as it, Attributes as j, AnyValue as k, describeRejectionReason as l, resolveDenylist as m, urlAttributes as n, User as nt, SafeCloneOptions as o, FrameworkName as ot, redactUrlQuery as p, SdkInfo as q, toCustomContext as r, BrowserSpanEventType as rt, safeClone as s, MAX_URL_LENGTH as t, TracesSampler as tt, routeRejection as u, glowsToEvents as v, convertToError as w, evictLruIfNew as x, flatJsonStringify as y, KeyValue as z };
|
package/dist/util/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_urlAttributes = require('../urlAttributes-
|
|
2
|
+
const require_urlAttributes = require('../urlAttributes-D0eXRrGm.cjs');
|
|
3
3
|
|
|
4
4
|
exports.DEFAULT_URL_DENYLIST = require_urlAttributes.DEFAULT_URL_DENYLIST;
|
|
5
5
|
exports.MAX_URL_LENGTH = require_urlAttributes.MAX_URL_LENGTH;
|
|
@@ -9,6 +9,7 @@ exports.convertToError = require_urlAttributes.convertToError;
|
|
|
9
9
|
exports.createComponentMatcher = require_urlAttributes.createComponentMatcher;
|
|
10
10
|
exports.createIdentityTagger = require_urlAttributes.createIdentityTagger;
|
|
11
11
|
exports.describeRejectionReason = require_urlAttributes.describeRejectionReason;
|
|
12
|
+
exports.evictLruIfNew = require_urlAttributes.evictLruIfNew;
|
|
12
13
|
exports.extractCode = require_urlAttributes.extractCode;
|
|
13
14
|
exports.flatJsonStringify = require_urlAttributes.flatJsonStringify;
|
|
14
15
|
exports.glowsToEvents = require_urlAttributes.glowsToEvents;
|
|
@@ -19,6 +20,7 @@ exports.resolveDenylist = require_urlAttributes.resolveDenylist;
|
|
|
19
20
|
exports.routeRejection = require_urlAttributes.routeRejection;
|
|
20
21
|
exports.safeClone = require_urlAttributes.safeClone;
|
|
21
22
|
exports.safeDecode = require_urlAttributes.safeDecode;
|
|
23
|
+
exports.setDefined = require_urlAttributes.setDefined;
|
|
22
24
|
exports.timelineEvents = require_urlAttributes.timelineEvents;
|
|
23
25
|
exports.toCustomContext = require_urlAttributes.toCustomContext;
|
|
24
26
|
exports.urlAttributes = require_urlAttributes.urlAttributes;
|
package/dist/util/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|
|
1
|
+
import { C as createIdentityTagger, D as assertKey, E as createComponentMatcher, O as assert, S as SdkTaggable, T as ProfileComponentsOption, _ as timelineEvents, a as setDefined, b as extractCode, c as RejectionReporter, d as DEFAULT_URL_DENYLIST, f as redactObjectValues, g as now, h as safeDecode, i as withoutStatefulFlags, l as describeRejectionReason, m as resolveDenylist, n as urlAttributes, o as SafeCloneOptions, p as redactUrlQuery, r as toCustomContext, s as safeClone, t as MAX_URL_LENGTH, u as routeRejection, v as glowsToEvents, w as convertToError, x as evictLruIfNew, y as flatJsonStringify } from "../urlAttributes-CU2Yr37w.cjs";
|
|
2
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, evictLruIfNew, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, setDefined, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|
package/dist/util/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|
|
1
|
+
import { C as createIdentityTagger, D as assertKey, E as createComponentMatcher, O as assert, S as SdkTaggable, T as ProfileComponentsOption, _ as timelineEvents, a as setDefined, b as extractCode, c as RejectionReporter, d as DEFAULT_URL_DENYLIST, f as redactObjectValues, g as now, h as safeDecode, i as withoutStatefulFlags, l as describeRejectionReason, m as resolveDenylist, n as urlAttributes, o as SafeCloneOptions, p as redactUrlQuery, r as toCustomContext, s as safeClone, t as MAX_URL_LENGTH, u as routeRejection, v as glowsToEvents, w as convertToError, x as evictLruIfNew, y as flatJsonStringify } from "../urlAttributes-rWoVW31H.mjs";
|
|
2
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, evictLruIfNew, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, setDefined, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|
package/dist/util/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as createIdentityTagger, D as assertKey, E as withoutStatefulFlags, O as assert, S as evictLruIfNew, T as createComponentMatcher, a as describeRejectionReason, c as redactObjectValues, d as safeDecode, f as now, g as safeClone, h as flatJsonStringify, i as setDefined, l as redactUrlQuery, m as glowsToEvents, n as urlAttributes, o as routeRejection, p as timelineEvents, r as toCustomContext, s as DEFAULT_URL_DENYLIST, t as MAX_URL_LENGTH, u as resolveDenylist, w as convertToError, x as extractCode } from "../urlAttributes-ggdpIKSS.mjs";
|
|
2
2
|
|
|
3
|
-
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|
|
3
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, evictLruIfNew, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, setDefined, timelineEvents, toCustomContext, urlAttributes, withoutStatefulFlags };
|