@newrelic/browser-agent 1.320.1-rc.1 → 1.320.1-rc.2
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/cjs/common/config/runtime.js +2 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/dom/selector-path.js +1 -1
- package/dist/cjs/common/session/session-entity.js +1 -1
- package/dist/cjs/common/v2/constants.js +21 -0
- package/dist/cjs/common/v2/utils.js +25 -23
- package/dist/cjs/common/wrap/wrap-events.js +4 -3
- package/dist/cjs/common/wrap/wrap-fetch.js +2 -2
- package/dist/cjs/common/wrap/wrap-function.js +1 -1
- package/dist/cjs/common/wrap/wrap-history.js +3 -2
- package/dist/cjs/common/wrap/wrap-xhr.js +2 -2
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/generic_events/aggregate/index.js +1 -1
- package/dist/cjs/features/generic_events/instrument/index.js +1 -1
- package/dist/cjs/features/jserrors/aggregate/index.js +5 -5
- package/dist/cjs/features/logging/instrument/index.js +1 -1
- package/dist/cjs/features/session_trace/instrument/index.js +3 -3
- package/dist/cjs/features/soft_navigations/instrument/index.js +2 -2
- package/dist/cjs/loaders/api/register.js +8 -8
- package/dist/cjs/loaders/configure/configure.js +14 -0
- package/dist/esm/common/config/runtime.js +2 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/dom/selector-path.js +1 -1
- package/dist/esm/common/session/session-entity.js +1 -1
- package/dist/esm/common/v2/constants.js +15 -0
- package/dist/esm/common/v2/utils.js +24 -22
- package/dist/esm/common/wrap/wrap-events.js +4 -3
- package/dist/esm/common/wrap/wrap-fetch.js +2 -2
- package/dist/esm/common/wrap/wrap-function.js +1 -1
- package/dist/esm/common/wrap/wrap-history.js +3 -2
- package/dist/esm/common/wrap/wrap-xhr.js +2 -2
- package/dist/esm/features/ajax/aggregate/index.js +2 -2
- package/dist/esm/features/generic_events/aggregate/index.js +1 -1
- package/dist/esm/features/generic_events/instrument/index.js +1 -1
- package/dist/esm/features/jserrors/aggregate/index.js +6 -6
- package/dist/esm/features/logging/instrument/index.js +1 -1
- package/dist/esm/features/session_trace/instrument/index.js +3 -3
- package/dist/esm/features/soft_navigations/instrument/index.js +2 -2
- package/dist/esm/loaders/api/register.js +1 -1
- package/dist/esm/loaders/configure/configure.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/runtime.d.ts.map +1 -1
- package/dist/types/common/v2/constants.d.ts +9 -0
- package/dist/types/common/v2/constants.d.ts.map +1 -0
- package/dist/types/common/v2/utils.d.ts +36 -11
- package/dist/types/common/v2/utils.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-events.d.ts +2 -1
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-history.d.ts +2 -1
- package/dist/types/common/wrap/wrap-history.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/config/runtime.js +2 -0
- package/src/common/dom/selector-path.js +1 -1
- package/src/common/session/session-entity.js +1 -1
- package/src/common/v2/constants.js +15 -0
- package/src/common/v2/utils.js +23 -21
- package/src/common/wrap/wrap-events.js +4 -3
- package/src/common/wrap/wrap-fetch.js +2 -2
- package/src/common/wrap/wrap-function.js +1 -1
- package/src/common/wrap/wrap-history.js +3 -2
- package/src/common/wrap/wrap-xhr.js +2 -2
- package/src/features/ajax/aggregate/index.js +2 -2
- package/src/features/generic_events/aggregate/index.js +1 -1
- package/src/features/generic_events/instrument/index.js +1 -1
- package/src/features/jserrors/aggregate/index.js +6 -6
- package/src/features/logging/instrument/index.js +1 -1
- package/src/features/session_trace/instrument/index.js +3 -3
- package/src/features/soft_navigations/instrument/index.js +2 -2
- package/src/loaders/api/register.js +1 -1
- package/src/loaders/configure/configure.js +12 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -23,16 +23,17 @@ const flag = "nr@wrapped:".concat(contextId);
|
|
|
23
23
|
* `document` (if in a browser scope). Adds custom events in context of a new emitter scoped only to these methods.
|
|
24
24
|
* @param {Object} sharedEE - The shared event emitter on which a new scoped
|
|
25
25
|
* event emitter will be based.
|
|
26
|
+
* @param {*} [agentRef] - The agent reference, used to attribute wrapped calls to the correct v2 target.
|
|
26
27
|
* @returns {Object} Scoped event emitter with a debug ID of `events`.
|
|
27
28
|
*/
|
|
28
|
-
export function wrapEvents(sharedEE) {
|
|
29
|
+
export function wrapEvents(sharedEE, agentRef) {
|
|
29
30
|
var ee = scopedEE(sharedEE);
|
|
30
31
|
|
|
31
32
|
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
32
33
|
// then we increment the count to track # of feats using this at runtime.
|
|
33
34
|
if (wrapped[ee.debugId]++) return ee;
|
|
34
35
|
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap events
|
|
35
|
-
var wrapFn = wfn(ee, true);
|
|
36
|
+
var wrapFn = wfn(ee, true, agentRef);
|
|
36
37
|
|
|
37
38
|
// Guard against instrumenting environments w/o necessary features
|
|
38
39
|
if ('getPrototypeOf' in Object) {
|
|
@@ -44,8 +44,8 @@ export function wrapFetch(sharedEE, agentRef) {
|
|
|
44
44
|
wrapPromiseMethod(globalScope, 'fetch', prefix);
|
|
45
45
|
ee.on(prefix + 'end', function (err, res, targets) {
|
|
46
46
|
var ctx = this;
|
|
47
|
-
//
|
|
48
|
-
ctx.targets = targets || [
|
|
47
|
+
// default target reports to container
|
|
48
|
+
ctx.targets = targets || [agentRef.runtime.v2Target];
|
|
49
49
|
if (res) {
|
|
50
50
|
var size = res.headers.get('content-length');
|
|
51
51
|
if (size !== null) {
|
|
@@ -82,7 +82,7 @@ export function createWrapperWithEmitter(emitter, always, agentRef) {
|
|
|
82
82
|
|
|
83
83
|
// certain wrappers can inform the function wrapper to evaluate the stack of the executed wrapped function to find targets of the execution
|
|
84
84
|
// (e.g. wrap-logger can inform this method to find try to find the MFE source of a console.log)
|
|
85
|
-
targets = evaluateStack ? findTargetsFromStackTrace(agentRef) : [
|
|
85
|
+
targets = evaluateStack ? findTargetsFromStackTrace(agentRef) : [agentRef?.runtime?.v2Target]; // default target always maps to the container agent
|
|
86
86
|
|
|
87
87
|
if (typeof getContext === 'function') {
|
|
88
88
|
ctx = getContext(args, originalThis);
|
|
@@ -17,9 +17,10 @@ const HISTORY_FNS = ['pushState', 'replaceState'];
|
|
|
17
17
|
* Wraps the `pushState` and `replaceState` methods of `window.history` and returns a corresponding event emitter
|
|
18
18
|
* scoped to the history object.
|
|
19
19
|
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
20
|
+
* @param {*} [agentRef] - The agent reference, used to attribute wrapped calls to the correct v2 target.
|
|
20
21
|
* @returns {Object} Scoped event emitter with a debug ID of `history`.
|
|
21
22
|
*/
|
|
22
|
-
export function wrapHistory(sharedEE) {
|
|
23
|
+
export function wrapHistory(sharedEE, agentRef) {
|
|
23
24
|
const ee = scopedEE(sharedEE);
|
|
24
25
|
|
|
25
26
|
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
@@ -28,7 +29,7 @@ export function wrapHistory(sharedEE) {
|
|
|
28
29
|
if (!isBrowserScope || wrapped[ee.debugId]++) return ee;
|
|
29
30
|
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap history
|
|
30
31
|
|
|
31
|
-
var wrapFn = wfn(ee);
|
|
32
|
+
var wrapFn = wfn(ee, undefined, agentRef);
|
|
32
33
|
/*
|
|
33
34
|
* For objects that will be instantiated more than once, we wrap the object's prototype methods. The history object
|
|
34
35
|
* is instantiated only once, so we can wrap its methods directly--and we must wrap the history methods directly as
|
|
@@ -35,8 +35,8 @@ export function wrapXhr(sharedEE, agentRef) {
|
|
|
35
35
|
if (wrapped[ee.debugId]++) return ee;
|
|
36
36
|
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap XHR
|
|
37
37
|
|
|
38
|
-
wrapEvents(baseEE); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us
|
|
39
|
-
var wrapFn = wfn(ee);
|
|
38
|
+
wrapEvents(baseEE, agentRef); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us
|
|
39
|
+
var wrapFn = wfn(ee, undefined, agentRef);
|
|
40
40
|
var OrigXHR = globalScope.XMLHttpRequest;
|
|
41
41
|
var MutationObserver = globalScope.MutationObserver;
|
|
42
42
|
var Promise = globalScope.Promise;
|
|
@@ -14,7 +14,7 @@ import { gosNREUMOriginals } from '../../../common/window/nreum';
|
|
|
14
14
|
import { hasGQLErrors, parseGQL } from './gql';
|
|
15
15
|
import { canCapturePayload, isLikelyHumanReadable, parseQueryString, createStringAdders } from '../../../common/payloads/payloads';
|
|
16
16
|
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
17
|
-
import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate } from '../../../common/v2/utils';
|
|
17
|
+
import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate, isMfeTarget } from '../../../common/v2/utils';
|
|
18
18
|
import { EVENT_TYPES } from '../../../common/constants/events';
|
|
19
19
|
import { generateUuid } from '../../../common/ids/unique-id';
|
|
20
20
|
export class Aggregate extends AggregateBase {
|
|
@@ -119,7 +119,7 @@ export class Aggregate extends AggregateBase {
|
|
|
119
119
|
if (event.gql) this.reportSupportabilityMetric('Ajax/Events/GraphQL/Bytes-Added', stringify(event.gql).length);
|
|
120
120
|
|
|
121
121
|
/** make a copy of the event for the MFE target if it exists */
|
|
122
|
-
if (target) {
|
|
122
|
+
if (isMfeTarget(target)) {
|
|
123
123
|
this.events.add({
|
|
124
124
|
...event,
|
|
125
125
|
targetAttributes: getVersion2Attributes(target, this)
|
|
@@ -255,7 +255,7 @@ export class Aggregate extends AggregateBase {
|
|
|
255
255
|
this.addEvent(event, target);
|
|
256
256
|
}, this.featureName, this.ee);
|
|
257
257
|
if (agentRef.init.feature_flags.includes('websockets') || agentRef.init.web_sockets?.enabled) {
|
|
258
|
-
registerHandler('ws-complete', (nrData, targets = [
|
|
258
|
+
registerHandler('ws-complete', (nrData, targets = [agentRef.runtime.v2Target]) => {
|
|
259
259
|
targets.forEach(target => {
|
|
260
260
|
const event = {
|
|
261
261
|
...nrData,
|
|
@@ -58,7 +58,7 @@ export class Instrument extends InstrumentBase {
|
|
|
58
58
|
if (isBrowserScope) {
|
|
59
59
|
wrapFetch(this.ee, agentRef);
|
|
60
60
|
wrapXhr(this.ee, agentRef);
|
|
61
|
-
historyEE = wrapHistory(this.ee);
|
|
61
|
+
historyEE = wrapHistory(this.ee, agentRef);
|
|
62
62
|
if (agentRef.init.user_actions.enabled) {
|
|
63
63
|
OBSERVED_EVENTS.forEach(eventType => windowAddEventListener(eventType, evt => handle('ua', [evt], undefined, this.featureName, this.ee), true));
|
|
64
64
|
OBSERVED_WINDOW_EVENTS.forEach(eventType => {
|
|
@@ -17,7 +17,7 @@ import { AggregateBase } from '../../utils/aggregate-base';
|
|
|
17
17
|
import { now } from '../../../common/timing/now';
|
|
18
18
|
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
19
19
|
import { evaluateInternalError } from './internal-errors';
|
|
20
|
-
import { getRegisteredTargetsFromFilename, getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate } from '../../../common/v2/utils';
|
|
20
|
+
import { getRegisteredTargetsFromFilename, getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate, isMfeTarget } from '../../../common/v2/utils';
|
|
21
21
|
import { buildCauseString } from './cause-string';
|
|
22
22
|
import { ShortCircuit } from '../../../common/util/short-circuit';
|
|
23
23
|
import { EVENT_TYPES } from '../../../common/constants/events';
|
|
@@ -205,7 +205,7 @@ export class Aggregate extends AggregateBase {
|
|
|
205
205
|
if (targets.length) break;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
if (!targets.length) targets.push(
|
|
208
|
+
if (!targets.length) targets.push(this.agentRef.runtime.v2Target);
|
|
209
209
|
}
|
|
210
210
|
return targets;
|
|
211
211
|
}
|
|
@@ -249,7 +249,7 @@ export class Aggregate extends AggregateBase {
|
|
|
249
249
|
if (filterOutput?.group) params.errorGroup = filterOutput.group;
|
|
250
250
|
|
|
251
251
|
// Should only decorate "hasReplay" for the container agent, so check if the target matches the config
|
|
252
|
-
if (hasReplay && !target) params.hasReplay = hasReplay;
|
|
252
|
+
if (hasReplay && !isMfeTarget(target)) params.hasReplay = hasReplay;
|
|
253
253
|
/**
|
|
254
254
|
* The bucketHash is different from the params.stackHash because the params.stackHash is based on the canonicalized
|
|
255
255
|
* stack trace and is used downstream in NR1 to attempt to group the same errors across different browsers. However,
|
|
@@ -284,13 +284,13 @@ export class Aggregate extends AggregateBase {
|
|
|
284
284
|
|
|
285
285
|
// Trace sends the error in its payload, and both trace & replay simply listens for any error to occur.
|
|
286
286
|
const jsErrorEvent = [type, bucketHash, params, newMetrics, customAttributes];
|
|
287
|
-
if (!target) handle('trace-jserror', jsErrorEvent, undefined, FEATURE_NAMES.sessionTrace, this.ee);
|
|
287
|
+
if (!isMfeTarget(target)) handle('trace-jserror', jsErrorEvent, undefined, FEATURE_NAMES.sessionTrace, this.ee);
|
|
288
288
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
289
289
|
if (this.blocked) return;
|
|
290
290
|
if (err.__newrelic?.socketId) {
|
|
291
291
|
customAttributes.socketId = err.__newrelic.socketId;
|
|
292
292
|
}
|
|
293
|
-
if (!target) {
|
|
293
|
+
if (!isMfeTarget(target)) {
|
|
294
294
|
const softNavInUse = Boolean(this.agentRef.features?.[FEATURE_NAMES.softNav]);
|
|
295
295
|
if (softNavInUse) {
|
|
296
296
|
// pass the error to soft nav for evaluation - it will return it via 'returnJserror' when interaction is resolved
|
|
@@ -301,7 +301,7 @@ export class Aggregate extends AggregateBase {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
// always add directly if scoped to a sub-entity, the other pathways above will be deterministic if the main agent should procede
|
|
304
|
-
if (target) this.#storeJserrorForHarvest(jsErrorEvent, {}, target);
|
|
304
|
+
if (isMfeTarget(target)) this.#storeJserrorForHarvest(jsErrorEvent, {}, target);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
/**
|
|
@@ -30,7 +30,7 @@ export class Instrument extends InstrumentBase {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
/** emitted by wrap-logger function */
|
|
33
|
-
this.ee.on('wrap-logger-end', function handleLog([message], _, __, targets = []) {
|
|
33
|
+
this.ee.on('wrap-logger-end', function handleLog([message], _, __, targets = [agentRef.runtime.v2Target]) {
|
|
34
34
|
const {
|
|
35
35
|
level,
|
|
36
36
|
customAttributes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { handle } from '../../../common/event-emitter/handle';
|
|
@@ -36,8 +36,8 @@ export class Instrument extends InstrumentBase {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
const thisInstrumentEE = this.ee;
|
|
39
|
-
wrapHistory(thisInstrumentEE);
|
|
40
|
-
this.eventsEE = wrapEvents(thisInstrumentEE);
|
|
39
|
+
wrapHistory(thisInstrumentEE, agentRef);
|
|
40
|
+
this.eventsEE = wrapEvents(thisInstrumentEE, agentRef);
|
|
41
41
|
this.eventsEE.on(FN_START, function (args, target) {
|
|
42
42
|
this.bstStart = now();
|
|
43
43
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { gosNREUMOriginals } from '../../../common/window/nreum';
|
|
@@ -29,7 +29,7 @@ export class Instrument extends InstrumentBase {
|
|
|
29
29
|
setupInteractionAPI(agentRef);
|
|
30
30
|
if (!isBrowserScope || !gosNREUMOriginals().o.MO) return; // soft navigations is not supported outside web env or browsers without the mutation observer API
|
|
31
31
|
|
|
32
|
-
const historyEE = wrapHistory(this.ee);
|
|
32
|
+
const historyEE = wrapHistory(this.ee, agentRef);
|
|
33
33
|
try {
|
|
34
34
|
this.removeOnAbort = new AbortController();
|
|
35
35
|
} catch (e) {}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { handle } from '../../common/event-emitter/handle';
|
|
6
6
|
import { warn } from '../../common/util/console';
|
|
7
|
-
import { V2_TYPES } from '../../common/v2/
|
|
7
|
+
import { V2_TYPES } from '../../common/v2/constants';
|
|
8
8
|
import { FEATURE_NAMES } from '../features/features';
|
|
9
9
|
import { now } from '../../common/timing/now';
|
|
10
10
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';
|
|
@@ -7,6 +7,7 @@ import { gosCDN } from '../../common/window/nreum';
|
|
|
7
7
|
import { mergeInfo } from '../../common/config/info';
|
|
8
8
|
import { mergeInit } from '../../common/config/init';
|
|
9
9
|
import { mergeRuntime } from '../../common/config/runtime';
|
|
10
|
+
import { V2_TYPES } from '../../common/v2/constants';
|
|
10
11
|
import { isWorkerScope, globalScope } from '../../common/constants/runtime';
|
|
11
12
|
import { redefinePublicPath } from './public-path';
|
|
12
13
|
import { ee } from '../../common/event-emitter/contextual-ee';
|
|
@@ -46,6 +47,19 @@ export function configure(agent, opts = {}, loaderType, forceDrain) {
|
|
|
46
47
|
agent.info = mergeInfo(info);
|
|
47
48
|
const updatedInit = agent.init;
|
|
48
49
|
agent.runtime ??= mergeRuntime(runtime);
|
|
50
|
+
agent.runtime.v2Target ??= {
|
|
51
|
+
type: V2_TYPES.BA,
|
|
52
|
+
instance: agent.agentIdentifier,
|
|
53
|
+
get id() {
|
|
54
|
+
return agent.runtime.appMetadata?.agents?.[0]?.entityGuid;
|
|
55
|
+
},
|
|
56
|
+
get attributes() {
|
|
57
|
+
return {
|
|
58
|
+
'entity.guid': this.id,
|
|
59
|
+
appId: agent.info.applicationID
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
49
63
|
|
|
50
64
|
// Apply proxy settings whenever configure is called (supports late {init} setting)
|
|
51
65
|
if (updatedInit.proxy.assets) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init-types.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/events.js","../src/common/constants/iframe-constants.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/add-url.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/extract-url.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/event-origin.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/util/webdriver-detection.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/load-time.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/cause-string.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/harvest-metadata.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/aggregate_v2/index.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/aggregate/trace/utils.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/interfaces/registered-iframe-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.js","../src/loaders/configure/configure.js","../src/loaders/configure/iframe-message-handler.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init-types.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/events.js","../src/common/constants/iframe-constants.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/add-url.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/extract-url.js","../src/common/url/location.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/event-origin.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/util/webdriver-detection.js","../src/common/v2/constants.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/load-time.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/cause-string.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/harvest-metadata.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/aggregate_v2/index.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/aggregate/trace/utils.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/interfaces/registered-iframe-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.js","../src/loaders/configure/configure.js","../src/loaders/configure/iframe-message-handler.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.9.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AAgEO,gDAON"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/constants.js"],"names":[],"mappings":";;;uBAMU,MAAM"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} V2Target
|
|
3
|
+
* @property {'BA'} type always V2_TYPES.BA -- identifies this as the container (main) agent, not a registered MFE
|
|
4
|
+
* @property {string} instance the container agent's agentIdentifier
|
|
5
|
+
* @property {string} [id] the container agent's entity guid, once known (getter, resolved asynchronously)
|
|
6
|
+
* @property {{[key:string]: any}} attributes the V2 payload attributes for the container agent (getter)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Determines if a given target represents a registered MFE (as opposed to the container agent).
|
|
10
|
+
* @param {*} target the target to check
|
|
11
|
+
* @returns {boolean} true if the target is a registered MFE target
|
|
12
|
+
*/
|
|
13
|
+
export function isMfeTarget(target: any): boolean;
|
|
1
14
|
/**
|
|
2
15
|
* Returns a single registered entity associated with a given iframe interface ID. Returns undefined if no entity is found.
|
|
3
16
|
* @param {string} iframeInterfaceId
|
|
@@ -69,24 +82,36 @@ export function shouldDuplicate(target: import("../../interfaces/registered-enti
|
|
|
69
82
|
/**
|
|
70
83
|
* Finds the registered targets from the stack trace for a given agent reference.
|
|
71
84
|
* @param {*} agentRef The agent reference to use for finding targets.
|
|
72
|
-
* @returns {Array} An array of targets found from the stack trace. If no targets are found or allowed, returns an array
|
|
85
|
+
* @returns {Array} An array of targets found from the stack trace. If no targets are found or allowed, returns an array containing the container target.
|
|
73
86
|
*/
|
|
74
87
|
export function findTargetsFromStackTrace(agentRef: any): any[];
|
|
75
88
|
/**
|
|
76
89
|
* Removes duplicate targets from an array, keyed by `target.instance`. This guards against the same canonical
|
|
77
90
|
* target re-entering the array via multiple matched stack-frame URLs (e.g. a recursive call whose stack contains the
|
|
78
|
-
* same file at multiple depths).
|
|
79
|
-
* naturally collapse to a single entry too, which is the desired behavior.
|
|
91
|
+
* same file at multiple depths). Multiple container-target entries (whose `instance` is the container agent's stable
|
|
92
|
+
* `agentIdentifier`) naturally collapse to a single entry too, which is the desired behavior.
|
|
80
93
|
* @param {Array} targets
|
|
81
94
|
* @returns {Array} deduped list of targets, preserving relative order of first occurrence
|
|
82
95
|
*/
|
|
83
96
|
export function dedupeTargetsByInstance(targets: any[]): any[];
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
export type V2Target = {
|
|
98
|
+
/**
|
|
99
|
+
* always V2_TYPES.BA -- identifies this as the container (main) agent, not a registered MFE
|
|
100
|
+
*/
|
|
101
|
+
type: "BA";
|
|
102
|
+
/**
|
|
103
|
+
* the container agent's agentIdentifier
|
|
104
|
+
*/
|
|
105
|
+
instance: string;
|
|
106
|
+
/**
|
|
107
|
+
* the container agent's entity guid, once known (getter, resolved asynchronously)
|
|
108
|
+
*/
|
|
109
|
+
id?: string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* the V2 payload attributes for the container agent (getter)
|
|
112
|
+
*/
|
|
113
|
+
attributes: {
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
92
117
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AAEH;;;;GAIG;AACH,oCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;GAKG;AACH,0EAJW,MAAM,YACN,GAAC,GACC,OAAO,sCAAsC,EAAE,WAAW,GAAC,SAAS,CAMhF;AAED;;;;;GAKG;AACH,+CAJW,MAAM,GAAC,MAAM,YACb,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAMpF;AAED;;;;;;;;;;;;GAYG;AACH,2DAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAOpF;AAED;;;;;;;;;;;;GAYG;AACH,wEA6BC;AAED;;;;;;;GAOG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,yDAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,wCAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,OAAO,CAInB;AAED;;;;GAIG;AACH,oDAHW,GAAC,SAqBX;AAED;;;;;;;GAOG;AACH,+DAUC;;;;;UA1La,IAAI;;;;cACJ,MAAM;;;;;;;;gBAEN;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC"}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* `document` (if in a browser scope). Adds custom events in context of a new emitter scoped only to these methods.
|
|
4
4
|
* @param {Object} sharedEE - The shared event emitter on which a new scoped
|
|
5
5
|
* event emitter will be based.
|
|
6
|
+
* @param {*} [agentRef] - The agent reference, used to attribute wrapped calls to the correct v2 target.
|
|
6
7
|
* @returns {Object} Scoped event emitter with a debug ID of `events`.
|
|
7
8
|
*/
|
|
8
|
-
export function wrapEvents(sharedEE: Object): Object;
|
|
9
|
+
export function wrapEvents(sharedEE: Object, agentRef?: any): Object;
|
|
9
10
|
/**
|
|
10
11
|
* Returns an event emitter scoped specifically for the `events` context. This scoping is a remnant from when all the
|
|
11
12
|
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-events.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-events.js"],"names":[],"mappings":"AAqBA
|
|
1
|
+
{"version":3,"file":"wrap-events.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-events.js"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,qCALW,MAAM,aAEN,GAAC,GACC,MAAM,CA0DlB;AAeD;;;;;;GAMG;AACH,mCAJW,MAAM,GAEJ,MAAM,CAIlB"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Wraps the `pushState` and `replaceState` methods of `window.history` and returns a corresponding event emitter
|
|
3
3
|
* scoped to the history object.
|
|
4
4
|
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
5
|
+
* @param {*} [agentRef] - The agent reference, used to attribute wrapped calls to the correct v2 target.
|
|
5
6
|
* @returns {Object} Scoped event emitter with a debug ID of `history`.
|
|
6
7
|
*/
|
|
7
|
-
export function wrapHistory(sharedEE: Object): Object;
|
|
8
|
+
export function wrapHistory(sharedEE: Object, agentRef?: any): Object;
|
|
8
9
|
/**
|
|
9
10
|
* Returns an event emitter scoped specifically for the `history` context. This scoping is a remnant from when all the
|
|
10
11
|
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-history.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-history.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"wrap-history.d.ts","sourceRoot":"","sources":["../../../../src/common/wrap/wrap-history.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,sCAJW,MAAM,aACN,GAAC,GACC,MAAM,CAoBlB;AAED;;;;;;GAMG;AACH,mCAJW,MAAM,GAEJ,MAAM,CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/instrument/index.js"],"names":[],"mappings":"AAmBA;IACE,2BAAiC;IACjC,2BA+CC;IAhCC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/instrument/index.js"],"names":[],"mappings":"AAmBA;IACE,2BAAiC;IACjC,2BA+CC;IAhCC,6BAAsD;CAiCzD;AAED,6CAAsC;+BAhEP,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,oGAyFC"}
|
package/package.json
CHANGED
|
@@ -43,6 +43,8 @@ const RuntimeModel = {
|
|
|
43
43
|
drainRegistry: new Map(),
|
|
44
44
|
connector: undefined,
|
|
45
45
|
harvester: undefined,
|
|
46
|
+
/** eagerly-created in configure() -- the v2 target representing the container (main) agent, see common/v2/utils#V2Target */
|
|
47
|
+
v2Target: undefined,
|
|
46
48
|
isolatedBacklog: false,
|
|
47
49
|
isRecording: false, // true when actively recording, false when paused or stopped
|
|
48
50
|
loaderType: undefined,
|
|
@@ -18,7 +18,7 @@ import { getRegisteredTargetsFromId } from '../v2/utils'
|
|
|
18
18
|
*/
|
|
19
19
|
export const analyzeElemPath = (elem, targetFields = [], agentRef) => {
|
|
20
20
|
const targets = []
|
|
21
|
-
const result = { path: undefined, nearestFields: {}, get targets () { return targets.length ? targets : [
|
|
21
|
+
const result = { path: undefined, nearestFields: {}, get targets () { return targets.length ? targets : [agentRef.runtime.v2Target] }, hasButton: false, hasLink: false }
|
|
22
22
|
if (!elem) return result
|
|
23
23
|
if (elem === window) { result.path = 'window'; return result }
|
|
24
24
|
if (elem === document) { result.path = 'document'; return result }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @enum {string}
|
|
8
|
+
* @readonly
|
|
9
|
+
*/
|
|
10
|
+
export const V2_TYPES = {
|
|
11
|
+
/** Micro Frontend */
|
|
12
|
+
MFE: 'MFE',
|
|
13
|
+
/** Browser Application */
|
|
14
|
+
BA: 'BA'
|
|
15
|
+
}
|
package/src/common/v2/utils.js
CHANGED
|
@@ -4,16 +4,23 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { extractUrlsFromStack, getDeepStackTrace } from './script-tracker'
|
|
7
|
+
import { V2_TYPES } from './constants'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
10
|
+
* @typedef {Object} V2Target
|
|
11
|
+
* @property {'BA'} type always V2_TYPES.BA -- identifies this as the container (main) agent, not a registered MFE
|
|
12
|
+
* @property {string} instance the container agent's agentIdentifier
|
|
13
|
+
* @property {string} [id] the container agent's entity guid, once known (getter, resolved asynchronously)
|
|
14
|
+
* @property {{[key:string]: any}} attributes the V2 payload attributes for the container agent (getter)
|
|
11
15
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Determines if a given target represents a registered MFE (as opposed to the container agent).
|
|
19
|
+
* @param {*} target the target to check
|
|
20
|
+
* @returns {boolean} true if the target is a registered MFE target
|
|
21
|
+
*/
|
|
22
|
+
export function isMfeTarget (target) {
|
|
23
|
+
return target?.type === V2_TYPES.MFE
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -114,14 +121,8 @@ export function dedupeRegisteredEntitiesByAsset (entities) {
|
|
|
114
121
|
*/
|
|
115
122
|
export function getVersion2Attributes (target, aggregateInstance) {
|
|
116
123
|
if (!supportsV2(aggregateInstance)) return {}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (!target) {
|
|
120
|
-
return {
|
|
121
|
-
'entity.guid': containerAgentEntityGuid,
|
|
122
|
-
appId: aggregateInstance.agentRef.info.applicationID
|
|
123
|
-
}
|
|
124
|
-
}
|
|
124
|
+
/** if the target isn't a registered MFE, but we are in v2 mode, this means the data belongs to the container agent */
|
|
125
|
+
if (!isMfeTarget(target)) return aggregateInstance.agentRef.runtime.v2Target.attributes
|
|
125
126
|
/** otherwise, the data belongs to the target (MFE) and should be attributed as such */
|
|
126
127
|
return target.attributes
|
|
127
128
|
}
|
|
@@ -147,16 +148,17 @@ export function getVersion2DuplicationAttributes (target, aggregateInstance) {
|
|
|
147
148
|
* @returns {boolean} returns true if the event should be duplicated for the target, false otherwise
|
|
148
149
|
*/
|
|
149
150
|
export function shouldDuplicate (target, aggregateInstance) {
|
|
150
|
-
return
|
|
151
|
+
return isMfeTarget(target) && !!supportsV2(aggregateInstance) && aggregateInstance.agentRef.init.api.register.duplicate_data_to_container
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
155
|
* Finds the registered targets from the stack trace for a given agent reference.
|
|
155
156
|
* @param {*} agentRef The agent reference to use for finding targets.
|
|
156
|
-
* @returns {Array} An array of targets found from the stack trace. If no targets are found or allowed, returns an array
|
|
157
|
+
* @returns {Array} An array of targets found from the stack trace. If no targets are found or allowed, returns an array containing the container target.
|
|
157
158
|
*/
|
|
158
159
|
export function findTargetsFromStackTrace (agentRef) {
|
|
159
|
-
if (!
|
|
160
|
+
if (!agentRef?.runtime) return []
|
|
161
|
+
if (!isValid(true, agentRef) || !agentRef.runtime.registeredEntities?.length) return [agentRef.runtime.v2Target]
|
|
160
162
|
|
|
161
163
|
const targets = []
|
|
162
164
|
try {
|
|
@@ -170,15 +172,15 @@ export function findTargetsFromStackTrace (agentRef) {
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
const deduped = dedupeTargetsByInstance(targets)
|
|
173
|
-
if (!deduped.length) deduped.push(
|
|
175
|
+
if (!deduped.length) deduped.push(agentRef.runtime.v2Target) // if we can't find any targets from the stack trace, the container agent is the target
|
|
174
176
|
return deduped
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
/**
|
|
178
180
|
* Removes duplicate targets from an array, keyed by `target.instance`. This guards against the same canonical
|
|
179
181
|
* target re-entering the array via multiple matched stack-frame URLs (e.g. a recursive call whose stack contains the
|
|
180
|
-
* same file at multiple depths).
|
|
181
|
-
* naturally collapse to a single entry too, which is the desired behavior.
|
|
182
|
+
* same file at multiple depths). Multiple container-target entries (whose `instance` is the container agent's stable
|
|
183
|
+
* `agentIdentifier`) naturally collapse to a single entry too, which is the desired behavior.
|
|
182
184
|
* @param {Array} targets
|
|
183
185
|
* @returns {Array} deduped list of targets, preserving relative order of first occurrence
|
|
184
186
|
*/
|