@newrelic/browser-agent 1.299.0-rc.1 → 1.299.0-rc.3

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.
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.299.0-rc.1";
20
+ const VERSION = exports.VERSION = "1.299.0-rc.3";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.299.0-rc.1";
20
+ const VERSION = exports.VERSION = "1.299.0-rc.3";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -300,11 +300,12 @@ function cleanPayload(payload = {}) {
300
300
  // The stuff that gets sent every time.
301
301
  function baseQueryString(agentRef, qs, endpoint, applicationID) {
302
302
  const ref = agentRef.runtime.obfuscator.obfuscateString((0, _cleanUrl.cleanURL)('' + _runtime.globalScope.location));
303
- const hr = agentRef.runtime.session?.state.sessionReplayMode === 1 && endpoint !== _features.JSERRORS;
304
- const ht = agentRef.runtime.session?.state.sessionTraceMode === 1 && ![_features.LOGS, _features.BLOBS].includes(endpoint);
303
+ const session = agentRef.runtime.session;
304
+ const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== _features.JSERRORS;
305
+ const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![_features.LOGS, _features.BLOBS].includes(endpoint);
305
306
  const qps = ['a=' + applicationID, (0, _encode.param)('sa', agentRef.info.sa ? '' + agentRef.info.sa : ''), (0, _encode.param)('v', _env.VERSION), transactionNameParam(), (0, _encode.param)('ct', agentRef.runtime.customTransaction), '&rst=' + (0, _now.now)(), '&ck=0',
306
307
  // ck param DEPRECATED - still expected by backend
307
- '&s=' + (agentRef.runtime.session?.state.value || '0'),
308
+ '&s=' + (session?.state.value || '0'),
308
309
  // the 0 id encaps all untrackable and default traffic
309
310
  (0, _encode.param)('ref', ref), (0, _encode.param)('ptid', agentRef.runtime.ptid ? '' + agentRef.runtime.ptid : '')];
310
311
  if (hr) qps.push((0, _encode.param)('hr', '1', qs));
@@ -97,7 +97,23 @@ class MicroAgent extends _microAgentBase.MicroAgentBase {
97
97
  so as to avoid the race condition of things like session and sharedAggregator not being ready by features that uses them right away. */
98
98
  nonAutoFeatures.forEach(f => {
99
99
  if (enabledFeatures[f] && featureNames.includes(f)) {
100
- (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))("../features/".concat(f, "/aggregate")).then(({
100
+ let lazyImport;
101
+ /** Define these imports with static strings to not break tools like roll-up */
102
+ switch (f) {
103
+ case 'jserrors':
104
+ lazyImport = Promise.resolve().then(() => _interopRequireWildcard(require('../features/jserrors/aggregate')));
105
+ break;
106
+ case 'generic_events':
107
+ lazyImport = Promise.resolve().then(() => _interopRequireWildcard(require('../features/generic_events/aggregate')));
108
+ break;
109
+ case 'metrics':
110
+ lazyImport = Promise.resolve().then(() => _interopRequireWildcard(require('../features/metrics/aggregate')));
111
+ break;
112
+ case 'logging':
113
+ lazyImport = Promise.resolve().then(() => _interopRequireWildcard(require('../features/logging/aggregate')));
114
+ break;
115
+ }
116
+ lazyImport.then(({
101
117
  Aggregate
102
118
  }) => {
103
119
  this.features[f] = new Aggregate(this);
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.299.0-rc.1";
14
+ export const VERSION = "1.299.0-rc.3";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.299.0-rc.1";
14
+ export const VERSION = "1.299.0-rc.3";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -292,11 +292,12 @@ function cleanPayload(payload = {}) {
292
292
  // The stuff that gets sent every time.
293
293
  function baseQueryString(agentRef, qs, endpoint, applicationID) {
294
294
  const ref = agentRef.runtime.obfuscator.obfuscateString(cleanURL('' + globalScope.location));
295
- const hr = agentRef.runtime.session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS;
296
- const ht = agentRef.runtime.session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint);
295
+ const session = agentRef.runtime.session;
296
+ const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS;
297
+ const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint);
297
298
  const qps = ['a=' + applicationID, param('sa', agentRef.info.sa ? '' + agentRef.info.sa : ''), param('v', VERSION), transactionNameParam(), param('ct', agentRef.runtime.customTransaction), '&rst=' + now(), '&ck=0',
298
299
  // ck param DEPRECATED - still expected by backend
299
- '&s=' + (agentRef.runtime.session?.state.value || '0'),
300
+ '&s=' + (session?.state.value || '0'),
300
301
  // the 0 id encaps all untrackable and default traffic
301
302
  param('ref', ref), param('ptid', agentRef.runtime.ptid ? '' + agentRef.runtime.ptid : '')];
302
303
  if (hr) qps.push(param('hr', '1', qs));
@@ -92,7 +92,23 @@ export class MicroAgent extends MicroAgentBase {
92
92
  so as to avoid the race condition of things like session and sharedAggregator not being ready by features that uses them right away. */
93
93
  nonAutoFeatures.forEach(f => {
94
94
  if (enabledFeatures[f] && featureNames.includes(f)) {
95
- import("../features/".concat(f, "/aggregate")).then(({
95
+ let lazyImport;
96
+ /** Define these imports with static strings to not break tools like roll-up */
97
+ switch (f) {
98
+ case 'jserrors':
99
+ lazyImport = import('../features/jserrors/aggregate');
100
+ break;
101
+ case 'generic_events':
102
+ lazyImport = import('../features/generic_events/aggregate');
103
+ break;
104
+ case 'metrics':
105
+ lazyImport = import('../features/metrics/aggregate');
106
+ break;
107
+ case 'logging':
108
+ lazyImport = import('../features/logging/aggregate');
109
+ break;
110
+ }
111
+ lazyImport.then(({
96
112
  Aggregate
97
113
  }) => {
98
114
  this.features[f] = new Aggregate(this);
@@ -1 +1 @@
1
- {"version":3,"file":"micro-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/micro-agent.js"],"names":[],"mappings":"AAmCA;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,SAAS,EAAE,YAAY,EAsExC;IAjEC,aAAkB;IAwBlB;;;;OAIG;IACH,uBAFW,MAAM,GAAC,MAAM,EAAE,aAmCzB;IAKH;;;;;MAOC;IAED,gBAEC;CACF;+BArH8B,oBAAoB"}
1
+ {"version":3,"file":"micro-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/micro-agent.js"],"names":[],"mappings":"AAmCA;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,SAAS,EAAE,YAAY,EAsFxC;IAjFC,aAAkB;IAwBlB;;;;OAIG;IACH,uBAFW,MAAM,GAAC,MAAM,EAAE,aAmDzB;IAKH;;;;;MAOC;IAED,gBAEC;CACF;+BArI8B,oBAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.299.0-rc.1",
3
+ "version": "1.299.0-rc.3",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -266,8 +266,9 @@ function cleanPayload (payload = {}) {
266
266
  // The stuff that gets sent every time.
267
267
  function baseQueryString (agentRef, qs, endpoint, applicationID) {
268
268
  const ref = agentRef.runtime.obfuscator.obfuscateString(cleanURL('' + globalScope.location))
269
- const hr = agentRef.runtime.session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS
270
- const ht = agentRef.runtime.session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint)
269
+ const session = agentRef.runtime.session
270
+ const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS
271
+ const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint)
271
272
 
272
273
  const qps = [
273
274
  'a=' + applicationID,
@@ -277,7 +278,7 @@ function baseQueryString (agentRef, qs, endpoint, applicationID) {
277
278
  param('ct', agentRef.runtime.customTransaction),
278
279
  '&rst=' + now(),
279
280
  '&ck=0', // ck param DEPRECATED - still expected by backend
280
- '&s=' + (agentRef.runtime.session?.state.value || '0'), // the 0 id encaps all untrackable and default traffic
281
+ '&s=' + (session?.state.value || '0'), // the 0 id encaps all untrackable and default traffic
281
282
  param('ref', ref),
282
283
  param('ptid', (agentRef.runtime.ptid ? '' + agentRef.runtime.ptid : ''))
283
284
  ]
@@ -99,7 +99,23 @@ export class MicroAgent extends MicroAgentBase {
99
99
  so as to avoid the race condition of things like session and sharedAggregator not being ready by features that uses them right away. */
100
100
  nonAutoFeatures.forEach(f => {
101
101
  if (enabledFeatures[f] && featureNames.includes(f)) {
102
- import(`../features/${f}/aggregate`).then(({ Aggregate }) => {
102
+ let lazyImport
103
+ /** Define these imports with static strings to not break tools like roll-up */
104
+ switch (f) {
105
+ case 'jserrors':
106
+ lazyImport = import('../features/jserrors/aggregate')
107
+ break
108
+ case 'generic_events':
109
+ lazyImport = import('../features/generic_events/aggregate')
110
+ break
111
+ case 'metrics':
112
+ lazyImport = import('../features/metrics/aggregate')
113
+ break
114
+ case 'logging':
115
+ lazyImport = import('../features/logging/aggregate')
116
+ break
117
+ }
118
+ lazyImport.then(({ Aggregate }) => {
103
119
  this.features[f] = new Aggregate(this)
104
120
  this.runtime.harvester.initializedAggregates.push(this.features[f]) // so that harvester will poll this feature agg on interval
105
121
  }).catch(err => warn(25, err))