@newrelic/browser-agent 1.318.0-rc.1 → 1.318.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.RRWEB_PACKAGE_NAME = exports.D
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.318.0-rc.1";
20
+ const VERSION = exports.VERSION = "1.318.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.RRWEB_PACKAGE_NAME = exports.D
17
17
  /**
18
18
  * Exposes the version of the agent
19
19
  */
20
- const VERSION = exports.VERSION = "1.318.0-rc.1";
20
+ const VERSION = exports.VERSION = "1.318.0-rc.3";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -28,9 +28,9 @@ function getAddStringContext(obfuscator, truncator) {
28
28
  let stringTableIdx = 0;
29
29
  const stringTable = Object.prototype.hasOwnProperty.call(Object, 'create') ? Object.create(null) : {};
30
30
  return addString;
31
- function addString(str) {
31
+ function addString(str, obfuscate = true) {
32
32
  if (typeof str === 'undefined' || str === '') return '';
33
- str = obfuscator?.obfuscateString(String(str)) ?? String(str);
33
+ str = obfuscate ? obfuscator?.obfuscateString(String(str)) ?? String(str) : String(str);
34
34
  str = truncator?.(str) ?? str;
35
35
  if (hasOwnProp.call(stringTable, str)) {
36
36
  return numeric(stringTable[str], true);
@@ -47,7 +47,7 @@ function addCustomAttributes(attrs, addString) {
47
47
  var type = 5;
48
48
  var serializedValue;
49
49
  // add key to string table first
50
- key = addString(key);
50
+ key = addString(key, false);
51
51
  switch (typeof val) {
52
52
  case 'object':
53
53
  if (val) {
@@ -97,20 +97,20 @@ class Aggregate extends _aggregateBase.AggregateBase {
97
97
  callbackDuration: metrics.cbTime,
98
98
  [_constants.AJAX_ID]: (0, _uniqueId.generateUuid)() // all AjaxRequest events should have a unique identifier to allow for easier grouping and analysis in the UI
99
99
  };
100
- event.gql = params.gql = (0, _gql.parseGQL)({
100
+ event.gql = (0, _gql.parseGQL)({
101
101
  body: ctx.requestBody,
102
102
  query: ctx.parsedOrigin?.search
103
103
  });
104
- if (event.gql) event.gql.operationHasErrors = params.gql.operationHasErrors = (0, _gql.hasGQLErrors)(ctx.responseBody);
104
+ if (event.gql) event.gql.operationHasErrors = (0, _gql.hasGQLErrors)(ctx.responseBody);
105
105
  const capturePayloadSetting = this.agentRef.init.ajax.capture_payloads;
106
106
  const shouldCapturePayload = (0, _payloads.canCapturePayload)(capturePayloadSetting, params.status, event.gql?.operationHasErrors);
107
107
  if (shouldCapturePayload) {
108
108
  // Store raw data; obfuscation and truncation will happen in the serializer
109
- params.requestQuery = event.requestQuery = (0, _payloads.parseQueryString)(ctx.parsedOrigin?.search);
110
- params.requestHeaders = event.requestHeaders = ctx.requestHeaders;
111
- params.responseHeaders = event.responseHeaders = ctx.responseHeaders;
112
- if ((0, _payloads.isLikelyHumanReadable)(ctx.requestHeaders, ctx.requestBody)) params.requestBody = event.requestBody = ctx.requestBody;
113
- if ((0, _payloads.isLikelyHumanReadable)(ctx.responseHeaders, ctx.responseBody)) params.responseBody = event.responseBody = ctx.responseBody;
109
+ event.requestQuery = (0, _payloads.parseQueryString)(ctx.parsedOrigin?.search);
110
+ event.requestHeaders = ctx.requestHeaders;
111
+ event.responseHeaders = ctx.responseHeaders;
112
+ if ((0, _payloads.isLikelyHumanReadable)(ctx.requestHeaders, ctx.requestBody)) event.requestBody = ctx.requestBody;
113
+ if ((0, _payloads.isLikelyHumanReadable)(ctx.responseHeaders, ctx.responseBody)) event.responseBody = ctx.responseBody;
114
114
  }
115
115
  if (ctx.dt) {
116
116
  event.spanId = ctx.dt.spanId;
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.318.0-rc.1";
14
+ export const VERSION = "1.318.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.318.0-rc.1";
14
+ export const VERSION = "1.318.0-rc.3";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -19,9 +19,9 @@ export function getAddStringContext(obfuscator, truncator) {
19
19
  let stringTableIdx = 0;
20
20
  const stringTable = Object.prototype.hasOwnProperty.call(Object, 'create') ? Object.create(null) : {};
21
21
  return addString;
22
- function addString(str) {
22
+ function addString(str, obfuscate = true) {
23
23
  if (typeof str === 'undefined' || str === '') return '';
24
- str = obfuscator?.obfuscateString(String(str)) ?? String(str);
24
+ str = obfuscate ? obfuscator?.obfuscateString(String(str)) ?? String(str) : String(str);
25
25
  str = truncator?.(str) ?? str;
26
26
  if (hasOwnProp.call(stringTable, str)) {
27
27
  return numeric(stringTable[str], true);
@@ -38,7 +38,7 @@ export function addCustomAttributes(attrs, addString) {
38
38
  var type = 5;
39
39
  var serializedValue;
40
40
  // add key to string table first
41
- key = addString(key);
41
+ key = addString(key, false);
42
42
  switch (typeof val) {
43
43
  case 'object':
44
44
  if (val) {
@@ -90,20 +90,20 @@ export class Aggregate extends AggregateBase {
90
90
  callbackDuration: metrics.cbTime,
91
91
  [AJAX_ID]: generateUuid() // all AjaxRequest events should have a unique identifier to allow for easier grouping and analysis in the UI
92
92
  };
93
- event.gql = params.gql = parseGQL({
93
+ event.gql = parseGQL({
94
94
  body: ctx.requestBody,
95
95
  query: ctx.parsedOrigin?.search
96
96
  });
97
- if (event.gql) event.gql.operationHasErrors = params.gql.operationHasErrors = hasGQLErrors(ctx.responseBody);
97
+ if (event.gql) event.gql.operationHasErrors = hasGQLErrors(ctx.responseBody);
98
98
  const capturePayloadSetting = this.agentRef.init.ajax.capture_payloads;
99
99
  const shouldCapturePayload = canCapturePayload(capturePayloadSetting, params.status, event.gql?.operationHasErrors);
100
100
  if (shouldCapturePayload) {
101
101
  // Store raw data; obfuscation and truncation will happen in the serializer
102
- params.requestQuery = event.requestQuery = parseQueryString(ctx.parsedOrigin?.search);
103
- params.requestHeaders = event.requestHeaders = ctx.requestHeaders;
104
- params.responseHeaders = event.responseHeaders = ctx.responseHeaders;
105
- if (isLikelyHumanReadable(ctx.requestHeaders, ctx.requestBody)) params.requestBody = event.requestBody = ctx.requestBody;
106
- if (isLikelyHumanReadable(ctx.responseHeaders, ctx.responseBody)) params.responseBody = event.responseBody = ctx.responseBody;
102
+ event.requestQuery = parseQueryString(ctx.parsedOrigin?.search);
103
+ event.requestHeaders = ctx.requestHeaders;
104
+ event.responseHeaders = ctx.responseHeaders;
105
+ if (isLikelyHumanReadable(ctx.requestHeaders, ctx.requestBody)) event.requestBody = ctx.requestBody;
106
+ if (isLikelyHumanReadable(ctx.responseHeaders, ctx.responseBody)) event.responseBody = ctx.responseBody;
107
107
  }
108
108
  if (ctx.dt) {
109
109
  event.spanId = ctx.dt.spanId;
@@ -1,5 +1,5 @@
1
1
  export function nullable(val: any, fn: any, comma: any): string;
2
2
  export function numeric(n: any, noDefault: any): string;
3
- export function getAddStringContext(obfuscator: any, truncator: any): (str: any) => string;
3
+ export function getAddStringContext(obfuscator: any, truncator: any): (str: any, obfuscate?: boolean) => string;
4
4
  export function addCustomAttributes(attrs: any, addString: any): any[];
5
5
  //# sourceMappingURL=bel-serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bel-serializer.d.ts","sourceRoot":"","sources":["../../../../src/common/serialize/bel-serializer.js"],"names":[],"mappings":"AAUA,gEAIC;AAED,wDAKC;AAED,2FAiBC;AAED,uEAwCC"}
1
+ {"version":3,"file":"bel-serializer.d.ts","sourceRoot":"","sources":["../../../../src/common/serialize/bel-serializer.js"],"names":[],"mappings":"AAUA,gEAIC;AAED,wDAKC;AAED,gHAiBC;AAED,uEAwCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.318.0-rc.1",
3
+ "version": "1.318.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",
@@ -27,9 +27,9 @@ export function getAddStringContext (obfuscator, truncator) {
27
27
 
28
28
  return addString
29
29
 
30
- function addString (str) {
30
+ function addString (str, obfuscate = true) {
31
31
  if (typeof str === 'undefined' || str === '') return ''
32
- str = obfuscator?.obfuscateString(String(str)) ?? String(str)
32
+ str = obfuscate ? (obfuscator?.obfuscateString(String(str)) ?? String(str)) : String(str)
33
33
  str = truncator?.(str) ?? str
34
34
  if (hasOwnProp.call(stringTable, str)) {
35
35
  return numeric(stringTable[str], true)
@@ -48,7 +48,7 @@ export function addCustomAttributes (attrs, addString) {
48
48
  var type = 5
49
49
  var serializedValue
50
50
  // add key to string table first
51
- key = addString(key)
51
+ key = addString(key, false)
52
52
 
53
53
  switch (typeof val) {
54
54
  case 'object':
@@ -102,22 +102,22 @@ export class Aggregate extends AggregateBase {
102
102
  [AJAX_ID]: generateUuid() // all AjaxRequest events should have a unique identifier to allow for easier grouping and analysis in the UI
103
103
  }
104
104
 
105
- event.gql = params.gql = parseGQL({
105
+ event.gql = parseGQL({
106
106
  body: ctx.requestBody,
107
107
  query: ctx.parsedOrigin?.search
108
108
  })
109
- if (event.gql) event.gql.operationHasErrors = params.gql.operationHasErrors = hasGQLErrors(ctx.responseBody)
109
+ if (event.gql) event.gql.operationHasErrors = hasGQLErrors(ctx.responseBody)
110
110
 
111
111
  const capturePayloadSetting = this.agentRef.init.ajax.capture_payloads
112
112
  const shouldCapturePayload = canCapturePayload(capturePayloadSetting, params.status, event.gql?.operationHasErrors)
113
113
 
114
114
  if (shouldCapturePayload) {
115
115
  // Store raw data; obfuscation and truncation will happen in the serializer
116
- params.requestQuery = event.requestQuery = parseQueryString(ctx.parsedOrigin?.search)
117
- params.requestHeaders = event.requestHeaders = ctx.requestHeaders
118
- params.responseHeaders = event.responseHeaders = ctx.responseHeaders
119
- if (isLikelyHumanReadable(ctx.requestHeaders, ctx.requestBody)) params.requestBody = event.requestBody = ctx.requestBody
120
- if (isLikelyHumanReadable(ctx.responseHeaders, ctx.responseBody)) params.responseBody = event.responseBody = ctx.responseBody
116
+ event.requestQuery = parseQueryString(ctx.parsedOrigin?.search)
117
+ event.requestHeaders = ctx.requestHeaders
118
+ event.responseHeaders = ctx.responseHeaders
119
+ if (isLikelyHumanReadable(ctx.requestHeaders, ctx.requestBody)) event.requestBody = ctx.requestBody
120
+ if (isLikelyHumanReadable(ctx.responseHeaders, ctx.responseBody)) event.responseBody = ctx.responseBody
121
121
  }
122
122
 
123
123
  if (ctx.dt) {