@newrelic/browser-agent 1.309.0 → 1.310.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 +14 -0
- package/README.md +0 -2
- package/dist/cjs/common/config/init-types.js +1 -4
- package/dist/cjs/common/config/init.js +1 -5
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/util/browser-stack-matchers.js +15 -0
- package/dist/cjs/common/util/script-tracker.js +184 -0
- package/dist/cjs/common/wrap/wrap-fetch.js +2 -2
- package/dist/cjs/common/wrap/wrap-history.js +2 -2
- package/dist/cjs/common/wrap/wrap-logger.js +2 -2
- package/dist/cjs/common/wrap/wrap-xhr.js +2 -2
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +6 -10
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/interfaces/registered-entity.js +2 -1
- package/dist/cjs/loaders/agent.js +1 -4
- package/dist/cjs/loaders/api/register-api-types.js +20 -8
- package/dist/cjs/loaders/api/register.js +36 -2
- package/dist/cjs/loaders/api-base.js +1 -1
- package/dist/cjs/loaders/features/features.js +6 -9
- package/dist/esm/common/config/init-types.js +1 -4
- package/dist/esm/common/config/init.js +1 -5
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/util/browser-stack-matchers.js +9 -0
- package/dist/esm/common/util/script-tracker.js +179 -0
- package/dist/esm/common/wrap/wrap-fetch.js +2 -2
- package/dist/esm/common/wrap/wrap-history.js +2 -2
- package/dist/esm/common/wrap/wrap-logger.js +2 -2
- package/dist/esm/common/wrap/wrap-xhr.js +2 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +2 -6
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/interfaces/registered-entity.js +2 -1
- package/dist/esm/loaders/agent.js +1 -4
- package/dist/esm/loaders/api/register-api-types.js +22 -8
- package/dist/esm/loaders/api/register.js +36 -2
- package/dist/esm/loaders/api-base.js +1 -1
- package/dist/esm/loaders/features/features.js +6 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/init-types.d.ts +0 -10
- package/dist/types/common/config/init.d.ts.map +1 -1
- package/dist/types/common/util/browser-stack-matchers.d.ts +10 -0
- package/dist/types/common/util/browser-stack-matchers.d.ts.map +1 -0
- package/dist/types/common/util/script-tracker.d.ts +7 -0
- package/dist/types/common/util/script-tracker.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/registered-entity.d.ts +4 -5
- package/dist/types/interfaces/registered-entity.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/register-api-types.d.ts +58 -14
- package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
- package/dist/types/loaders/api/register.d.ts.map +1 -1
- package/dist/types/loaders/api-base.d.ts +4 -5
- package/dist/types/loaders/api-base.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +2 -5
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/package.json +1 -9
- package/src/common/config/init-types.js +1 -4
- package/src/common/config/init.js +1 -2
- package/src/common/util/browser-stack-matchers.js +9 -0
- package/src/common/util/script-tracker.js +171 -0
- package/src/common/wrap/wrap-fetch.js +2 -2
- package/src/common/wrap/wrap-history.js +2 -2
- package/src/common/wrap/wrap-logger.js +2 -2
- package/src/common/wrap/wrap-xhr.js +2 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.js +2 -7
- package/src/features/page_view_event/aggregate/initialized-features.js +1 -2
- package/src/index.js +2 -2
- package/src/interfaces/registered-entity.js +2 -1
- package/src/loaders/agent.js +0 -4
- package/src/loaders/api/register-api-types.js +22 -8
- package/src/loaders/api/register.js +31 -2
- package/src/loaders/api-base.js +1 -1
- package/src/loaders/features/features.js +6 -9
- package/dist/cjs/common/wrap/wrap-jsonp.js +0 -137
- package/dist/cjs/common/wrap/wrap-mutation.js +0 -62
- package/dist/cjs/common/wrap/wrap-promise.js +0 -166
- package/dist/cjs/common/wrap/wrap-timer.js +0 -71
- package/dist/cjs/features/spa/aggregate/index.js +0 -672
- package/dist/cjs/features/spa/aggregate/interaction-node.js +0 -83
- package/dist/cjs/features/spa/aggregate/interaction.js +0 -95
- package/dist/cjs/features/spa/aggregate/serializer.js +0 -150
- package/dist/cjs/features/spa/constants.js +0 -35
- package/dist/cjs/features/spa/index.js +0 -12
- package/dist/cjs/features/spa/instrument/index.js +0 -136
- package/dist/esm/common/wrap/wrap-jsonp.js +0 -130
- package/dist/esm/common/wrap/wrap-mutation.js +0 -55
- package/dist/esm/common/wrap/wrap-promise.js +0 -159
- package/dist/esm/common/wrap/wrap-timer.js +0 -64
- package/dist/esm/features/spa/aggregate/index.js +0 -663
- package/dist/esm/features/spa/aggregate/interaction-node.js +0 -77
- package/dist/esm/features/spa/aggregate/interaction.js +0 -88
- package/dist/esm/features/spa/aggregate/serializer.js +0 -142
- package/dist/esm/features/spa/constants.js +0 -28
- package/dist/esm/features/spa/index.js +0 -5
- package/dist/esm/features/spa/instrument/index.js +0 -129
- package/dist/types/common/wrap/wrap-jsonp.d.ts +0 -16
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +0 -1
- package/dist/types/common/wrap/wrap-mutation.d.ts +0 -16
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +0 -1
- package/dist/types/common/wrap/wrap-promise.d.ts +0 -17
- package/dist/types/common/wrap/wrap-promise.d.ts.map +0 -1
- package/dist/types/common/wrap/wrap-timer.d.ts +0 -17
- package/dist/types/common/wrap/wrap-timer.d.ts.map +0 -1
- package/dist/types/features/spa/aggregate/index.d.ts +0 -24
- package/dist/types/features/spa/aggregate/index.d.ts.map +0 -1
- package/dist/types/features/spa/aggregate/interaction-node.d.ts +0 -15
- package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +0 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts +0 -19
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +0 -1
- package/dist/types/features/spa/aggregate/serializer.d.ts +0 -17
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +0 -1
- package/dist/types/features/spa/constants.d.ts +0 -23
- package/dist/types/features/spa/constants.d.ts.map +0 -1
- package/dist/types/features/spa/index.d.ts +0 -2
- package/dist/types/features/spa/index.d.ts.map +0 -1
- package/dist/types/features/spa/instrument/index.d.ts +0 -12
- package/dist/types/features/spa/instrument/index.d.ts.map +0 -1
- package/src/common/wrap/wrap-jsonp.js +0 -142
- package/src/common/wrap/wrap-mutation.js +0 -58
- package/src/common/wrap/wrap-promise.js +0 -176
- package/src/common/wrap/wrap-timer.js +0 -70
- package/src/features/spa/aggregate/index.js +0 -734
- package/src/features/spa/aggregate/interaction-node.js +0 -85
- package/src/features/spa/aggregate/interaction.js +0 -108
- package/src/features/spa/aggregate/serializer.js +0 -200
- package/src/features/spa/constants.js +0 -39
- package/src/features/spa/index.js +0 -5
- package/src/features/spa/instrument/index.js +0 -134
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.scopedEE = scopedEE;
|
|
7
|
-
exports.wrapTimer = wrapTimer;
|
|
8
|
-
var _contextualEe = require("../event-emitter/contextual-ee");
|
|
9
|
-
var _wrapFunction = require("./wrap-function");
|
|
10
|
-
var _runtime = require("../constants/runtime");
|
|
11
|
-
/**
|
|
12
|
-
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
13
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @file Wraps native timeout and interval methods for instrumentation.
|
|
18
|
-
* This module is used by: jserrors, spa.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const wrapped = {};
|
|
22
|
-
const SET_TIMEOUT = 'setTimeout';
|
|
23
|
-
const SET_INTERVAL = 'setInterval';
|
|
24
|
-
const CLEAR_TIMEOUT = 'clearTimeout';
|
|
25
|
-
const START = '-start';
|
|
26
|
-
const DASH = '-';
|
|
27
|
-
const TIMER_FNS = [SET_TIMEOUT, 'setImmediate', SET_INTERVAL, CLEAR_TIMEOUT, 'clearImmediate'];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Wraps the global `setTimeout`, `setImmediate`, `setInterval`, `clearTimeout`, and `clearImmediate` functions to emit
|
|
31
|
-
* events on start, end, and error, in the context of a new event emitter scoped only to timer functions. Also wraps
|
|
32
|
-
* the callbacks of `setTimeout` and `setInterval`.
|
|
33
|
-
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
34
|
-
* @returns {Object} Scoped event emitter with a debug ID of `timer`.
|
|
35
|
-
*/
|
|
36
|
-
// eslint-disable-next-line
|
|
37
|
-
function wrapTimer(sharedEE) {
|
|
38
|
-
const ee = scopedEE(sharedEE);
|
|
39
|
-
|
|
40
|
-
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
41
|
-
// then we increment the count to track # of feats using this at runtime.
|
|
42
|
-
if (wrapped[ee.debugId]++) return ee;
|
|
43
|
-
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap timer
|
|
44
|
-
|
|
45
|
-
var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
|
|
46
|
-
wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(0, 2), SET_TIMEOUT + DASH);
|
|
47
|
-
wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(2, 3), SET_INTERVAL + DASH);
|
|
48
|
-
wrapFn.inPlace(_runtime.globalScope, TIMER_FNS.slice(3), CLEAR_TIMEOUT + DASH);
|
|
49
|
-
ee.on(SET_INTERVAL + START, interval);
|
|
50
|
-
ee.on(SET_TIMEOUT + START, timer);
|
|
51
|
-
function interval(args, obj, type) {
|
|
52
|
-
args[0] = wrapFn(args[0], 'fn-', null, type);
|
|
53
|
-
}
|
|
54
|
-
function timer(args, obj, type) {
|
|
55
|
-
this.method = type;
|
|
56
|
-
this.timerDuration = isNaN(args[1]) ? 0 : +args[1];
|
|
57
|
-
args[0] = wrapFn(args[0], 'fn-', this, type);
|
|
58
|
-
}
|
|
59
|
-
return ee;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Returns an event emitter scoped specifically for the `timer` context. This scoping is a remnant from when all the
|
|
64
|
-
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
65
|
-
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
66
|
-
* Uses `ee` on the global scope if undefined).
|
|
67
|
-
* @returns {Object} Scoped event emitter with a debug ID of 'timer'.
|
|
68
|
-
*/
|
|
69
|
-
function scopedEE(sharedEE) {
|
|
70
|
-
return (sharedEE || _contextualEe.ee).get('timer');
|
|
71
|
-
}
|