@newrelic/browser-agent 1.233.0 → 1.234.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/cjs/cdn/experimental.js +27 -0
- package/dist/cjs/common/config/state/init.js +1 -1
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +10 -10
- package/dist/cjs/common/harvest/harvest-scheduler.js +18 -3
- package/dist/cjs/common/harvest/harvest-scheduler.test.js +39 -0
- package/dist/cjs/common/harvest/harvest.js +14 -34
- package/dist/cjs/common/harvest/harvest.test.js +224 -0
- package/dist/cjs/common/url/encode.js +2 -2
- package/dist/cjs/common/util/console.test.js +30 -0
- package/dist/cjs/common/util/get-or-set.js +8 -1
- package/dist/cjs/common/util/get-or-set.test.js +47 -0
- package/dist/cjs/common/util/stringify.test.js +48 -0
- package/dist/cjs/common/util/submit-data.js +15 -15
- package/dist/cjs/common/util/submit-data.test.js +221 -0
- package/dist/cjs/common/util/traverse.js +19 -27
- package/dist/cjs/common/util/traverse.test.js +44 -0
- package/dist/cjs/features/metrics/aggregate/endpoint-map.js +14 -0
- package/dist/cjs/features/metrics/aggregate/index.js +3 -2
- package/dist/cjs/features/metrics/instrument/index.js +0 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +58 -44
- package/dist/cjs/features/session_replay/aggregate/index.js +10 -7
- package/dist/cjs/loaders/configure/configure.js +0 -1
- package/dist/esm/cdn/experimental.js +24 -0
- package/dist/esm/common/config/state/init.js +1 -1
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/event-emitter/contextual-ee.test.js +10 -10
- package/dist/esm/common/harvest/harvest-scheduler.js +18 -3
- package/dist/esm/common/harvest/harvest-scheduler.test.js +37 -0
- package/dist/esm/common/harvest/harvest.js +14 -34
- package/dist/esm/common/harvest/harvest.test.js +222 -0
- package/dist/esm/common/url/encode.js +2 -2
- package/dist/esm/common/util/console.test.js +28 -0
- package/dist/esm/common/util/get-or-set.js +8 -1
- package/dist/esm/common/util/get-or-set.test.js +45 -0
- package/dist/esm/common/util/stringify.test.js +46 -0
- package/dist/esm/common/util/submit-data.js +15 -15
- package/dist/esm/common/util/submit-data.test.js +219 -0
- package/dist/esm/common/util/traverse.js +19 -27
- package/dist/esm/common/util/traverse.test.js +42 -0
- package/dist/esm/features/metrics/aggregate/endpoint-map.js +7 -0
- package/dist/esm/features/metrics/aggregate/index.js +3 -2
- package/dist/esm/features/metrics/instrument/index.js +0 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +58 -44
- package/dist/esm/features/session_replay/aggregate/index.js +10 -7
- package/dist/esm/loaders/configure/configure.js +0 -1
- package/dist/types/cdn/experimental.d.ts +2 -0
- package/dist/types/cdn/experimental.d.ts.map +1 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/context/shared-context.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts +26 -3
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +2 -2
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/timer/timer.d.ts.map +1 -1
- package/dist/types/common/util/get-or-set.d.ts +9 -1
- package/dist/types/common/util/get-or-set.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts +14 -10
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/util/traverse.d.ts +10 -1
- package/dist/types/common/util/traverse.d.ts.map +1 -1
- package/dist/types/common/window/nreum.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts +8 -0
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +4 -0
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/package.json +8 -3
- package/src/cdn/experimental.js +36 -0
- package/src/common/config/state/init.js +1 -2
- package/src/common/context/shared-context.js +0 -1
- package/src/common/event-emitter/contextual-ee.test.js +10 -10
- package/src/common/harvest/harvest-scheduler.js +18 -3
- package/src/common/harvest/harvest-scheduler.test.js +25 -0
- package/src/common/harvest/harvest.js +15 -20
- package/src/common/harvest/harvest.test.js +169 -0
- package/src/common/session/session-entity.test.js +0 -1
- package/src/common/timer/timer.js +0 -1
- package/src/common/url/encode.js +2 -2
- package/src/common/util/console.test.js +34 -0
- package/src/common/util/get-or-set.js +8 -1
- package/src/common/util/get-or-set.test.js +58 -0
- package/src/common/util/stringify.test.js +49 -0
- package/src/common/util/submit-data.js +15 -16
- package/src/common/util/submit-data.test.js +218 -0
- package/src/common/util/traverse.js +18 -27
- package/src/common/util/traverse.test.js +50 -0
- package/src/common/window/nreum.js +0 -1
- package/src/features/metrics/aggregate/endpoint-map.js +7 -0
- package/src/features/metrics/aggregate/index.js +3 -2
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +0 -1
- package/src/features/metrics/instrument/index.js +0 -2
- package/src/features/page_view_event/aggregate/index.js +48 -51
- package/src/features/page_view_event/instrument/index.js +0 -1
- package/src/features/session_replay/aggregate/index.js +12 -7
- package/src/features/utils/handler-cache.js +0 -1
- package/src/loaders/configure/configure.js +0 -1
- package/dist/cjs/common/util/s-hash.js +0 -19
- package/dist/cjs/features/metrics/instrument/workers-helper.js +0 -124
- package/dist/esm/common/util/s-hash.js +0 -13
- package/dist/esm/features/metrics/instrument/workers-helper.js +0 -119
- package/dist/types/common/util/s-hash.d.ts +0 -2
- package/dist/types/common/util/s-hash.d.ts.map +0 -1
- package/dist/types/features/metrics/instrument/workers-helper.d.ts +0 -7
- package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +0 -1
- package/src/common/util/s-hash.js +0 -14
- package/src/features/metrics/instrument/workers-helper.js +0 -113
|
@@ -2,20 +2,18 @@ import { handle } from '../../../common/event-emitter/handle';
|
|
|
2
2
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
3
3
|
import { isiOS } from '../../../common/browser-version/ios-version';
|
|
4
4
|
import { onTTFB } from 'web-vitals';
|
|
5
|
-
import { mapOwn } from '../../../common/util/map-own';
|
|
6
|
-
import { param, fromArray } from '../../../common/url/encode';
|
|
7
5
|
import { addPT, addPN } from '../../../common/timing/nav-timing';
|
|
8
6
|
import { stringify } from '../../../common/util/stringify';
|
|
9
7
|
import { paintMetrics } from '../../../common/metrics/paint-metrics';
|
|
10
|
-
import { submitData } from '../../../common/util/submit-data';
|
|
11
8
|
import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
|
|
12
|
-
import {
|
|
9
|
+
import { Harvest } from '../../../common/harvest/harvest';
|
|
13
10
|
import * as CONSTANTS from '../constants';
|
|
14
11
|
import { getActivatedFeaturesFlags } from './initialized-features';
|
|
15
12
|
import { globalScope, isBrowserScope } from '../../../common/util/global-scope';
|
|
16
13
|
import { drain } from '../../../common/drain/drain';
|
|
14
|
+
import { activateFeatures } from '../../../common/util/feature-flags';
|
|
15
|
+
import { warn } from '../../../common/util/console';
|
|
17
16
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
18
|
-
const jsonp = 'NREUM.setToken';
|
|
19
17
|
export class Aggregate extends AggregateBase {
|
|
20
18
|
static featureName = CONSTANTS.FEATURE_NAME;
|
|
21
19
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -54,6 +52,8 @@ export class Aggregate extends AggregateBase {
|
|
|
54
52
|
}
|
|
55
53
|
sendRum() {
|
|
56
54
|
const info = getInfo(this.agentIdentifier);
|
|
55
|
+
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
56
|
+
const harvester = new Harvest(this);
|
|
57
57
|
if (!info.beacon) return;
|
|
58
58
|
if (info.queueTime) this.aggregator.store('measures', 'qt', {
|
|
59
59
|
value: info.queueTime
|
|
@@ -61,7 +61,6 @@ export class Aggregate extends AggregateBase {
|
|
|
61
61
|
if (info.applicationTime) this.aggregator.store('measures', 'ap', {
|
|
62
62
|
value: info.applicationTime
|
|
63
63
|
});
|
|
64
|
-
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
65
64
|
|
|
66
65
|
// These 3 values should've been recorded after load and before this func runs. They are part of the minimum required for PageView events to be created.
|
|
67
66
|
// Following PR #428, which demands that all agents send RUM call, these need to be sent even outside of the main window context where PerformanceTiming
|
|
@@ -75,22 +74,27 @@ export class Aggregate extends AggregateBase {
|
|
|
75
74
|
this.aggregator.store('measures', 'dc', {
|
|
76
75
|
value: isBrowserScope ? agentRuntime[CONSTANTS.FBTDC] : 0
|
|
77
76
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
const queryParameters = {
|
|
78
|
+
tt: info.ttGuid,
|
|
79
|
+
us: info.user,
|
|
80
|
+
ac: info.account,
|
|
81
|
+
pr: info.product,
|
|
82
|
+
af: getActivatedFeaturesFlags(this.agentIdentifier).join(','),
|
|
83
|
+
...Object.entries(this.aggregator.get('measures') || {}).reduce((aggregator, _ref2) => {
|
|
84
|
+
let [metricName, measure] = _ref2;
|
|
85
|
+
aggregator[metricName] = measure.params?.value;
|
|
86
|
+
return aggregator;
|
|
87
|
+
}, {}),
|
|
88
|
+
xx: info.extra,
|
|
89
|
+
ua: info.userAttributes,
|
|
90
|
+
at: info.atts
|
|
91
|
+
};
|
|
92
|
+
let body;
|
|
93
|
+
if (typeof info.jsAttributes === 'object' && Object.keys(info.jsAttributes).length > 0) {
|
|
94
|
+
body = {
|
|
95
|
+
ja: info.jsAttributes
|
|
96
|
+
};
|
|
97
|
+
}
|
|
94
98
|
if (globalScope.performance) {
|
|
95
99
|
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
96
100
|
// Navigation Timing level 2 API that replaced PerformanceTiming & PerformanceNavigation
|
|
@@ -99,14 +103,14 @@ export class Aggregate extends AggregateBase {
|
|
|
99
103
|
timing: addPT(agentRuntime.offset, navTimingEntry, {}),
|
|
100
104
|
navigation: addPN(navTimingEntry, {})
|
|
101
105
|
};
|
|
102
|
-
|
|
106
|
+
queryParameters.perf = stringify(perf);
|
|
103
107
|
} else if (typeof PerformanceTiming !== 'undefined') {
|
|
104
108
|
// Safari pre-15 did not support level 2 timing
|
|
105
109
|
const perf = {
|
|
106
110
|
timing: addPT(agentRuntime.offset, globalScope.performance.timing, {}, true),
|
|
107
111
|
navigation: addPN(globalScope.performance.navigation, {})
|
|
108
112
|
};
|
|
109
|
-
|
|
113
|
+
queryParameters.perf = stringify(perf);
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
116
|
try {
|
|
@@ -115,31 +119,41 @@ export class Aggregate extends AggregateBase {
|
|
|
115
119
|
entries.forEach(function (entry) {
|
|
116
120
|
if (!entry.startTime || entry.startTime <= 0) return;
|
|
117
121
|
if (entry.name === 'first-paint') {
|
|
118
|
-
|
|
122
|
+
queryParameters.fp = String(Math.floor(entry.startTime));
|
|
119
123
|
} else if (entry.name === 'first-contentful-paint') {
|
|
120
|
-
|
|
124
|
+
queryParameters.fcp = String(Math.floor(entry.startTime));
|
|
121
125
|
}
|
|
122
126
|
paintMetrics[entry.name] = Math.floor(entry.startTime); // this is consumed by Spa module
|
|
123
127
|
});
|
|
124
128
|
} catch (e) {}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
harvester.send({
|
|
130
|
+
endpoint: 'rum',
|
|
131
|
+
payload: {
|
|
132
|
+
qs: queryParameters,
|
|
133
|
+
body
|
|
134
|
+
},
|
|
135
|
+
opts: {
|
|
136
|
+
needResponse: true,
|
|
137
|
+
sendEmptyBody: true
|
|
138
|
+
},
|
|
139
|
+
cbFinished: _ref3 => {
|
|
140
|
+
let {
|
|
141
|
+
status,
|
|
142
|
+
responseText
|
|
143
|
+
} = _ref3;
|
|
144
|
+
if (status >= 400) {
|
|
145
|
+
// Adding retry logic for the rum call will be a separate change
|
|
146
|
+
this.ee.abort();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
activateFeatures(JSON.parse(responseText), this.agentIdentifier);
|
|
151
|
+
drain(this.agentIdentifier, this.featureName);
|
|
152
|
+
} catch (err) {
|
|
153
|
+
this.ee.abort();
|
|
154
|
+
warn('RUM call failed. Agent shutting down.');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
140
157
|
});
|
|
141
|
-
// Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
|
|
142
|
-
// ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
|
|
143
|
-
if (!isValidJsonp) drain(this.agentIdentifier, CONSTANTS.FEATURE_NAME);
|
|
144
158
|
}
|
|
145
159
|
}
|
|
@@ -90,11 +90,7 @@ export class Aggregate extends AggregateBase {
|
|
|
90
90
|
onFinished: this.onHarvestFinished.bind(this),
|
|
91
91
|
retryDelay: this.harvestTimeSeconds,
|
|
92
92
|
getPayload: this.prepareHarvest.bind(this),
|
|
93
|
-
|
|
94
|
-
includeBaseParams: false,
|
|
95
|
-
customUrl: 'https://vortex-alb.stg-single-tooth.cell.us.nr-data.net/blob',
|
|
96
|
-
raw: true,
|
|
97
|
-
gzip: true
|
|
93
|
+
raw: true
|
|
98
94
|
}, this);
|
|
99
95
|
|
|
100
96
|
// Wait for an error to be reported. This currently is wrapped around the "Error" feature. This is a feature-feature dependency.
|
|
@@ -154,7 +150,7 @@ export class Aggregate extends AggregateBase {
|
|
|
154
150
|
if (fullSample) this.mode = MODE.FULL; // full mode has precedence over error mode
|
|
155
151
|
else if (errorSample) this.mode = MODE.ERROR;
|
|
156
152
|
// If neither are selected, then don't record (early return)
|
|
157
|
-
return;
|
|
153
|
+
else return;
|
|
158
154
|
}
|
|
159
155
|
|
|
160
156
|
// FULL mode records AND reports from the beginning, while ERROR mode only records (but does not report).
|
|
@@ -164,6 +160,11 @@ export class Aggregate extends AggregateBase {
|
|
|
164
160
|
// We only report (harvest) in FULL mode
|
|
165
161
|
this.scheduler.startTimer(this.harvestTimeSeconds);
|
|
166
162
|
}
|
|
163
|
+
|
|
164
|
+
// If an error was noticed before the mode could be set (like in the early lifecycle of the page), immediately set to FULL mode
|
|
165
|
+
if (this.mode === MODE.ERROR && this.errorNoticed) {
|
|
166
|
+
this.mode = MODE.FULL;
|
|
167
|
+
}
|
|
167
168
|
// We record in FULL or ERROR mode
|
|
168
169
|
|
|
169
170
|
recorder = (await import( /* webpackChunkName: "recorder" */'rrweb')).record;
|
|
@@ -196,7 +197,9 @@ export class Aggregate extends AggregateBase {
|
|
|
196
197
|
const info = getInfo(this.agentIdentifier);
|
|
197
198
|
return {
|
|
198
199
|
qs: {
|
|
199
|
-
protocol_version: '0'
|
|
200
|
+
protocol_version: '0',
|
|
201
|
+
content_encoding: 'gzip',
|
|
202
|
+
browser_monitoring_key: info.licenseKey
|
|
200
203
|
},
|
|
201
204
|
body: {
|
|
202
205
|
type: 'SessionReplay',
|
|
@@ -36,6 +36,5 @@ export function configure(agentIdentifier) {
|
|
|
36
36
|
gosNREUMInitializedAgents(agentIdentifier, api, 'api');
|
|
37
37
|
gosNREUMInitializedAgents(agentIdentifier, exposed, 'exposed');
|
|
38
38
|
addToNREUM('activatedFeatures', activatedFeatures);
|
|
39
|
-
addToNREUM('setToken', flags => activateFeatures(flags, agentIdentifier));
|
|
40
39
|
return api;
|
|
41
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../../../src/cdn/experimental.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAoEA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAOA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
|
|
@@ -2,9 +2,32 @@
|
|
|
2
2
|
* Periodically invokes harvest calls and handles retries
|
|
3
3
|
*/
|
|
4
4
|
export class HarvestScheduler extends SharedContext {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Create a HarvestScheduler
|
|
7
|
+
* @param {string} endpoint - The base BAM endpoint name -- ex. 'events'
|
|
8
|
+
* @param {object} opts - The options used to configure the HarvestScheduler
|
|
9
|
+
* @param {Function} opts.onFinished - The callback to be fired when a harvest has finished
|
|
10
|
+
* @param {Function} opts.getPayload - A callback which can be triggered to return a payload for harvesting
|
|
11
|
+
* @param {number} opts.retryDelay - The number of seconds to wait before retrying after a network failure
|
|
12
|
+
* @param {boolean} opts.raw - Use a prefabricated payload shape as the harvest payload without the need for formatting
|
|
13
|
+
* @param {string} opts.customUrl - A custom url that falls outside of the shape of the standard BAM harvester url pattern. Will use directly instead of concatenating various pieces
|
|
14
|
+
* @param {*} parent - The parent object, whose state can be passed into SharedContext
|
|
15
|
+
*/
|
|
16
|
+
constructor(endpoint: string, opts: {
|
|
17
|
+
onFinished: Function;
|
|
18
|
+
getPayload: Function;
|
|
19
|
+
retryDelay: number;
|
|
20
|
+
raw: boolean;
|
|
21
|
+
customUrl: string;
|
|
22
|
+
}, parent: any);
|
|
23
|
+
endpoint: string;
|
|
24
|
+
opts: {
|
|
25
|
+
onFinished: Function;
|
|
26
|
+
getPayload: Function;
|
|
27
|
+
retryDelay: number;
|
|
28
|
+
raw: boolean;
|
|
29
|
+
customUrl: string;
|
|
30
|
+
};
|
|
8
31
|
started: boolean;
|
|
9
32
|
timeoutHandle: NodeJS.Timeout | null;
|
|
10
33
|
aborted: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM;QAES,UAAU;QACV,UAAU;QACZ,UAAU,EAAvB,MAAM;QACQ,GAAG,EAAjB,OAAO;QACM,SAAS,EAAtB,MAAM;oBAkBlB;IAbC,iBAAwB;IACxB;;;oBARW,MAAM;aACN,OAAO;mBACP,MAAM;MAMK;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAShD,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA0DC;IAED,gDAiBC;CACF;8BArJ6B,2BAA2B;wBAChB,WAAW"}
|
|
@@ -37,14 +37,14 @@ export class Harvest extends SharedContext {
|
|
|
37
37
|
* @param {NetworkSendSpec} spec Specification for sending data
|
|
38
38
|
*/
|
|
39
39
|
obfuscateAndSend(spec: NetworkSendSpec): any;
|
|
40
|
-
_send({ endpoint, payload, opts, submitMethod, cbFinished, customUrl,
|
|
40
|
+
_send({ endpoint, payload, opts, submitMethod, cbFinished, customUrl, raw, includeBaseParams }: {
|
|
41
41
|
endpoint: any;
|
|
42
42
|
payload?: {} | undefined;
|
|
43
43
|
opts?: {} | undefined;
|
|
44
44
|
submitMethod: any;
|
|
45
45
|
cbFinished: any;
|
|
46
46
|
customUrl: any;
|
|
47
|
-
|
|
47
|
+
raw: any;
|
|
48
48
|
includeBaseParams?: boolean | undefined;
|
|
49
49
|
}): any;
|
|
50
50
|
baseQueryString(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAkOA;;;;;;;;;;;;;;;;;EAmBC;AA9MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;OAIG;IACH,YAFW,eAAe,OAYzB;IAED;;;OAGG;IACH,WAFW,eAAe,OAazB;IAED;;;OAGG;IACH,uBAFW,eAAe,OAMzB;IAED;;;;;;;;;YAiFC;IAGD,0BAmBC;IAED;;;MAaC;IAED,mCAGC;IAED,uBAIC;CACF;8BA3MY,MAAM;8BALW,2BAA2B;2BAF9B,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../../../src/common/timer/timer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../../../src/common/timer/timer.js"],"names":[],"mappings":"AAAA;IACE,gCAQC;IALC,WAAuB;IACvB,eAAmB;IACnB,uBAAgC;IAEhC,sBAAwC;IAG1C,yCAGC;IAED,cAGC;IAED,YAGC;IAED,mBAEC;CACF"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Always returns the current value of obj[prop], even if it has to set it first. Sets properties as non-enumerable if possible.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} obj - The object to get or set the property on.
|
|
5
|
+
* @param {string} prop - The name of the property.
|
|
6
|
+
* @param {Function} getVal - A function that returns the value to be set if the property does not exist.
|
|
7
|
+
* @returns {*} The value of the property in the object.
|
|
8
|
+
*/
|
|
9
|
+
export function getOrSet(obj: Object, prop: string, getVal: Function): any;
|
|
2
10
|
//# sourceMappingURL=get-or-set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-or-set.d.ts","sourceRoot":"","sources":["../../../../src/common/util/get-or-set.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-or-set.d.ts","sourceRoot":"","sources":["../../../../src/common/util/get-or-set.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,8BALW,MAAM,QACN,MAAM,yBA6BhB"}
|
|
@@ -11,17 +11,24 @@ export namespace submitData {
|
|
|
11
11
|
url: string;
|
|
12
12
|
jsonp: string;
|
|
13
13
|
}): XMLHttpRequest;
|
|
14
|
+
/**
|
|
15
|
+
* Performs an asynchronous GET request using XMLHttpRequest.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} args - An object containing a `url` property.
|
|
18
|
+
* @param {string} args.url - The URL to send the GET request to.
|
|
19
|
+
* @returns {XMLHttpRequest} - An XMLHttpRequest object.
|
|
20
|
+
*/
|
|
14
21
|
function xhrGet({ url }: {
|
|
15
|
-
url:
|
|
22
|
+
url: string;
|
|
16
23
|
}): XMLHttpRequest;
|
|
17
24
|
/**
|
|
18
25
|
* Send via XHR
|
|
19
|
-
* @param {Object} args - The args
|
|
20
|
-
* @param {string} args.url - The URL to send to
|
|
21
|
-
* @param {string=} args.body - The Stringified body
|
|
22
|
-
* @param {boolean=} args.sync - Run XHR
|
|
23
|
-
* @param {string=} [args.method=POST] - The XHR method to use
|
|
24
|
-
* @param {{key: string, value: string}[]} [args.headers] - The headers to attach
|
|
26
|
+
* @param {Object} args - The args.
|
|
27
|
+
* @param {string} args.url - The URL to send to.
|
|
28
|
+
* @param {string=} args.body - The Stringified body. Default null to prevent IE11 from breaking.
|
|
29
|
+
* @param {boolean=} args.sync - Run XHR synchronously.
|
|
30
|
+
* @param {string=} [args.method=POST] - The XHR method to use.
|
|
31
|
+
* @param {{key: string, value: string}[]} [args.headers] - The headers to attach.
|
|
25
32
|
* @returns {XMLHttpRequest}
|
|
26
33
|
*/
|
|
27
34
|
function xhr({ url, body, sync, method, headers }: {
|
|
@@ -34,9 +41,6 @@ export namespace submitData {
|
|
|
34
41
|
value: string;
|
|
35
42
|
}[] | undefined;
|
|
36
43
|
}): XMLHttpRequest;
|
|
37
|
-
/**
|
|
38
|
-
* Unused at the moment -- DEPRECATED
|
|
39
|
-
*/
|
|
40
44
|
/**
|
|
41
45
|
* Send by appending an <img> element to the page. Do NOT call this function outside of a guaranteed web window environment.
|
|
42
46
|
* @param {Object} args - The args
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-data.d.ts","sourceRoot":"","sources":["../../../../src/common/util/submit-data.js"],"names":[],"mappings":";IAOA;;;;;;;OAOG;IACH;;;uBAsBC;IAED;;uBAEC;IAED;;;;;;;;;OASG;IACH;;;;;;;;;uBAiBC;IAED
|
|
1
|
+
{"version":3,"file":"submit-data.d.ts","sourceRoot":"","sources":["../../../../src/common/util/submit-data.js"],"names":[],"mappings":";IAOA;;;;;;;OAOG;IACH;;;uBAsBC;IAED;;;;;;OAMG;IACH;;uBAEC;IAED;;;;;;;;;OASG;IACH;;;;;;;;;uBAiBC;IAED;;;;;OAKG;IACH;;yBAIC;IAED;;;;;;OAMG;IACH;;;gBAYC"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Applies a function to properties of a specified type in an object, recursively.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} obj - The object to apply the function to.
|
|
5
|
+
* @param {Function} fn - The function to apply to matching properties.
|
|
6
|
+
* @param {string} [type='string'] - The type of properties to apply the function to.
|
|
7
|
+
* @param {Array<string>} [ignoreKeys=[]] - The keys of properties to ignore and not modify.
|
|
8
|
+
* @returns {Object} - The object with function recursively applied.
|
|
9
|
+
*/
|
|
10
|
+
export function applyFnToProps(obj: Object, fn: Function, type?: string | undefined, ignoreKeys?: string[] | undefined): Object;
|
|
2
11
|
//# sourceMappingURL=traverse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../../../src/common/util/traverse.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../../../src/common/util/traverse.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,oCANW,MAAM,+EAIJ,MAAM,CAclB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nreum.d.ts","sourceRoot":"","sources":["../../../../src/common/window/nreum.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nreum.d.ts","sourceRoot":"","sources":["../../../../src/common/window/nreum.js"],"names":[],"mappings":"AAQA,gCAMC;AAED,oCAWC;AAED,4CASC;AAED,oCASC;AAED,yCAgBC;AAED,+EAqBC;AAED,uDAGC;AAED,yCAGC;AAED,8BAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-map.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/endpoint-map.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,qBA+BC;IAED,0BAQC;IAED,eAoDC;IA5CG,mCAAyB;CA6C9B;8BA5I6B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill-detection.es5.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/polyfill-detection.es5.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"polyfill-detection.es5.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/polyfill-detection.es5.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gCAFa,MAAM,EAAE,CAIpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/instrument/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/instrument/index.js"],"names":[],"mappings":"AAKA;IACE,2BAAiC;IACjC,mEAGC;CACF;+BAX8B,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAA2C;IAC3C,mDA2BC;IAvBG,iCAAwB;IAyB5B,8BAEC;IAED,gBAyFC;CACF;8BA/H6B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"AASA;IACE,2BAA2C;IAC3C,mEAmBC;CACF;+BA7B8B,6BAA6B"}
|
|
@@ -37,6 +37,8 @@ export class Aggregate extends AggregateBase {
|
|
|
37
37
|
prepareHarvest(options: any): {
|
|
38
38
|
qs: {
|
|
39
39
|
protocol_version: string;
|
|
40
|
+
content_encoding: string;
|
|
41
|
+
browser_monitoring_key: any;
|
|
40
42
|
};
|
|
41
43
|
body: {
|
|
42
44
|
type: string;
|
|
@@ -56,6 +58,8 @@ export class Aggregate extends AggregateBase {
|
|
|
56
58
|
getHarvestContents(): {
|
|
57
59
|
qs: {
|
|
58
60
|
protocol_version: string;
|
|
61
|
+
content_encoding: string;
|
|
62
|
+
browser_monitoring_key: any;
|
|
59
63
|
};
|
|
60
64
|
body: {
|
|
61
65
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAsBA,4CAA4C;AAiB5C;IACE,2BAAiC;IACjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAsBA,4CAA4C;AAiB5C;IACE,2BAAiC;IACjC,mDAmFC;IAhFC,iHAAiH;IACjH,cAAgB;IAChB,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,uDAAuD;IACvD,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAIpB,gGAAgG;IAChG,sBAAyB;IACzB;;;MAGE;IACF,qBAAwB;IACxB,+HAA+H;IAC/H,kBAAqB;IAErB,qGAAqG;IACrG,+BAA+B;IAE/B,uIAAuI;IACvI,0BAAyE;IAiBzE,4BAKQ;IAiCV;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CA8ChB;IAED;;;;;;;;;;;;;;;;;;;;oBAaC;IAED;;;;;;;;;;;;;;;;;;;;MAwBC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAMC;IAED,qDAAqD;IACrD,uBAoBC;IAED,yHAAyH;IACzH,yCA0BC;IAED,0HAA0H;IAC1H,yBAIC;IAED,gCAAgC;IAChC,0CAGC;IAED,yDAAyD;IACzD,cAKC;IAED;;;SAGK;IACL,uCAEC;CACF;8BA3S6B,4BAA4B;iCALzB,2CAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler-cache.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/handler-cache.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler-cache.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/handler-cache.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IA6BE;;;;SAIK;IACL,2BAFe,IAAI,CAMlB;IAED;;;;;;;SAOK;IACL,iBAFa,OAAO,QAOnB;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;EA2BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/browser-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.234.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
|
|
6
6
|
"description": "Tests for the New Relic JavaScript agent",
|
|
@@ -126,7 +126,8 @@
|
|
|
126
126
|
"npm:build:esm": "npx babel --env-name npm-esm --out-dir dist/esm --out-file-extension .js ./src",
|
|
127
127
|
"npm:build:cjs": "npx babel --env-name npm-cjs --out-dir dist/cjs --out-file-extension .js ./src",
|
|
128
128
|
"npm:build:types": "npx tsc -b",
|
|
129
|
-
"npm:pack": "mkdir -p temp && export PKG_NAME=$(npm pack --pack-destination temp) && echo ./temp/$PKG_NAME"
|
|
129
|
+
"npm:pack": "mkdir -p temp && export PKG_NAME=$(npm pack --pack-destination temp) && echo ./temp/$PKG_NAME",
|
|
130
|
+
"watch:browser-tests": "jung -r ./src -F '.*\\.test\\.js' --run -- npm run build:browser-tests"
|
|
130
131
|
},
|
|
131
132
|
"config": {
|
|
132
133
|
"unsafe-perm": true
|
|
@@ -146,6 +147,11 @@
|
|
|
146
147
|
"@babel/cli": "^7.20.7",
|
|
147
148
|
"@babel/core": "^7.20.12",
|
|
148
149
|
"@babel/eslint-parser": "^7.19.1",
|
|
150
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
151
|
+
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
|
|
152
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
153
|
+
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
154
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
149
155
|
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
|
150
156
|
"@babel/preset-env": "^7.20.2",
|
|
151
157
|
"@babel/register": "^7.21.0",
|
|
@@ -206,7 +212,6 @@
|
|
|
206
212
|
"preprocessify": "0.0.6",
|
|
207
213
|
"process": "^0.11.10",
|
|
208
214
|
"request": "2.74.0",
|
|
209
|
-
"sauce-connect-launcher": "^1.2.4",
|
|
210
215
|
"saucelabs": "^7.2.1",
|
|
211
216
|
"semver": "^5.3.0",
|
|
212
217
|
"serialize-anything": "^1.2.3",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @file Creates an "EXPERIMENTAL" agent loader bundle composed of the core agent and all available feature modules, including experimental features.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This loader is ONLY used for internal testing. The code contained within is likely under development and dormant. It will not download to instrumented pages or record any data.
|
|
9
|
+
* It is not production ready, and is not intended to be imported or implemented in any build of the browser agent
|
|
10
|
+
*/
|
|
11
|
+
import { Agent } from '../loaders/agent'
|
|
12
|
+
|
|
13
|
+
import { Instrument as InstrumentPageViewEvent } from '../features/page_view_event/instrument'
|
|
14
|
+
import { Instrument as InstrumentPageViewTiming } from '../features/page_view_timing/instrument'
|
|
15
|
+
import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
|
|
16
|
+
import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
|
|
17
|
+
import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
|
|
18
|
+
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
|
|
19
|
+
import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument'
|
|
20
|
+
import { Instrument as InstrumentSpa } from '../features/spa/instrument'
|
|
21
|
+
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
|
|
22
|
+
|
|
23
|
+
new Agent({
|
|
24
|
+
features: [
|
|
25
|
+
InstrumentXhr,
|
|
26
|
+
InstrumentPageViewEvent,
|
|
27
|
+
InstrumentPageViewTiming,
|
|
28
|
+
InstrumentSessionTrace,
|
|
29
|
+
InstrumentSessionReplay,
|
|
30
|
+
InstrumentMetrics,
|
|
31
|
+
InstrumentPageAction,
|
|
32
|
+
InstrumentErrors,
|
|
33
|
+
InstrumentSpa
|
|
34
|
+
],
|
|
35
|
+
loaderType: 'experimental'
|
|
36
|
+
})
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../../session/constants'
|
|
3
2
|
import { gosNREUMInitializedAgents } from '../../window/nreum'
|
|
4
3
|
import { getModeledObject } from './configurable'
|
|
@@ -34,7 +33,7 @@ const model = () => {
|
|
|
34
33
|
session_trace: { enabled: true, harvestTimeSeconds: 10 },
|
|
35
34
|
session_replay: {
|
|
36
35
|
// feature settings
|
|
37
|
-
enabled:
|
|
36
|
+
enabled: false,
|
|
38
37
|
harvestTimeSeconds: 60,
|
|
39
38
|
sampleRate: 0.1,
|
|
40
39
|
errorSampleRate: 0.1,
|