@newrelic/browser-agent 1.321.0-rc.0 → 1.321.0-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.
@@ -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.321.0-rc.0";
20
+ const VERSION = exports.VERSION = "1.321.0-rc.2";
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.321.0-rc.0";
20
+ const VERSION = exports.VERSION = "1.321.0-rc.2";
21
21
 
22
22
  /**
23
23
  * Exposes the build type of the agent
@@ -100,6 +100,8 @@ var _globalEvent = require("../dispatch/global-event");
100
100
  * | 77 | Agent rejected post message, could not validate origin. |
101
101
  * | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
102
102
  * | 79 | Unable to initialize Connector and/or Harvester. |
103
+ * | 81 | Entities were detected that share a name with different IDs - This can cause multiple entities to have the same name in New Relic. |
104
+ * | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
103
105
  *
104
106
  * @param {number} code The warning code to emit, which will be used to link to the warning code documentation
105
107
  * @param {*} [secondary] Secondary data to include, usually an extra message, error or object
@@ -49,7 +49,9 @@ const warnings = exports.warnings = {
49
49
  experimental: (0, _invoke.single)(() => (0, _console.warn)(54, 'newrelic.register')),
50
50
  disabled: (0, _invoke.single)(() => (0, _console.warn)(55)),
51
51
  invalidTarget: (0, _invoke.single)(target => (0, _console.warn)(48, target)),
52
- deregistered: (0, _invoke.single)(() => (0, _console.warn)(68))
52
+ deregistered: (0, _invoke.single)(() => (0, _console.warn)(68)),
53
+ duplicateName: (0, _invoke.single)(target => (0, _console.warn)(81, target)),
54
+ duplicateId: (0, _invoke.single)(target => (0, _console.warn)(82, target))
53
55
  };
54
56
 
55
57
  /**
@@ -139,6 +141,19 @@ function register(agentRef, target) {
139
141
  /** primary cases that can block the register API from working at init time */
140
142
  if (!agentRef.init.api.register.enabled) block(warnings.disabled);
141
143
  if (!hasValidValue(target.id) || !hasValidValue(target.name)) block(() => warnings.invalidTarget(target));
144
+ /** warn if we see obviously unstable things with MFE targets */
145
+ registeredEntities.forEach(entity => {
146
+ try {
147
+ const {
148
+ name,
149
+ id
150
+ } = entity.metadata.target;
151
+ if (name === target.name && id !== target.id) warnings.duplicateName(target);
152
+ if (id === target.id && name !== target.name) warnings.duplicateId(target);
153
+ } catch (e) {
154
+ // something unexpected went wrong...
155
+ }
156
+ });
142
157
 
143
158
  /** @type {RegisterAPI} */
144
159
  const api = {
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.321.0-rc.0";
14
+ export const VERSION = "1.321.0-rc.2";
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.321.0-rc.0";
14
+ export const VERSION = "1.321.0-rc.2";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -95,6 +95,8 @@ import { dispatchGlobalEvent } from '../dispatch/global-event';
95
95
  * | 77 | Agent rejected post message, could not validate origin. |
96
96
  * | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
97
97
  * | 79 | Unable to initialize Connector and/or Harvester. |
98
+ * | 81 | Entities were detected that share a name with different IDs - This can cause multiple entities to have the same name in New Relic. |
99
+ * | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
98
100
  *
99
101
  * @param {number} code The warning code to emit, which will be used to link to the warning code documentation
100
102
  * @param {*} [secondary] Secondary data to include, usually an extra message, error or object
@@ -42,7 +42,9 @@ export const warnings = {
42
42
  experimental: single(() => warn(54, 'newrelic.register')),
43
43
  disabled: single(() => warn(55)),
44
44
  invalidTarget: single(target => warn(48, target)),
45
- deregistered: single(() => warn(68))
45
+ deregistered: single(() => warn(68)),
46
+ duplicateName: single(target => warn(81, target)),
47
+ duplicateId: single(target => warn(82, target))
46
48
  };
47
49
 
48
50
  /**
@@ -132,6 +134,19 @@ function register(agentRef, target) {
132
134
  /** primary cases that can block the register API from working at init time */
133
135
  if (!agentRef.init.api.register.enabled) block(warnings.disabled);
134
136
  if (!hasValidValue(target.id) || !hasValidValue(target.name)) block(() => warnings.invalidTarget(target));
137
+ /** warn if we see obviously unstable things with MFE targets */
138
+ registeredEntities.forEach(entity => {
139
+ try {
140
+ const {
141
+ name,
142
+ id
143
+ } = entity.metadata.target;
144
+ if (name === target.name && id !== target.id) warnings.duplicateName(target);
145
+ if (id === target.id && name !== target.name) warnings.duplicateId(target);
146
+ } catch (e) {
147
+ // something unexpected went wrong...
148
+ }
149
+ });
135
150
 
136
151
  /** @type {RegisterAPI} */
137
152
  const api = {
@@ -85,6 +85,8 @@
85
85
  * | 77 | Agent rejected post message, could not validate origin. |
86
86
  * | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
87
87
  * | 79 | Unable to initialize Connector and/or Harvester. |
88
+ * | 81 | Entities were detected that share a name with different IDs - This can cause multiple entities to have the same name in New Relic. |
89
+ * | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
88
90
  *
89
91
  * @param {number} code The warning code to emit, which will be used to link to the warning code documentation
90
92
  * @param {*} [secondary] Secondary data to include, usually an extra message, error or object
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
@@ -9,6 +9,8 @@ export namespace warnings {
9
9
  let disabled: Function;
10
10
  let invalidTarget: Function;
11
11
  let deregistered: Function;
12
+ let duplicateName: Function;
13
+ let duplicateId: Function;
12
14
  }
13
15
  export type RegisterAPI = import("./register-api-types").RegisterAPI;
14
16
  //# sourceMappingURL=register.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AAqDA;;;;GAIG;AACH,mDAIC;;;;;;;0BArCY,OAAO,sBAAsB,EAAE,WAAW"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AAuDA;;;;GAIG;AACH,mDAIC;;;;;;;;;0BAvCY,OAAO,sBAAsB,EAAE,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.321.0-rc.0",
3
+ "version": "1.321.0-rc.2",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -95,6 +95,8 @@ import { dispatchGlobalEvent } from '../dispatch/global-event'
95
95
  * | 77 | Agent rejected post message, could not validate origin. |
96
96
  * | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
97
97
  * | 79 | Unable to initialize Connector and/or Harvester. |
98
+ * | 81 | Entities were detected that share a name with different IDs - This can cause multiple entities to have the same name in New Relic. |
99
+ * | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
98
100
  *
99
101
  * @param {number} code The warning code to emit, which will be used to link to the warning code documentation
100
102
  * @param {*} [secondary] Secondary data to include, usually an extra message, error or object
@@ -48,7 +48,9 @@ export const warnings = {
48
48
  experimental: single(() => warn(54, 'newrelic.register')),
49
49
  disabled: single(() => warn(55)),
50
50
  invalidTarget: single((target) => warn(48, target)),
51
- deregistered: single(() => warn(68))
51
+ deregistered: single(() => warn(68)),
52
+ duplicateName: single((target) => warn(81, target)),
53
+ duplicateId: single((target) => warn(82, target))
52
54
  }
53
55
 
54
56
  /**
@@ -138,6 +140,16 @@ function register (agentRef, target) {
138
140
  /** primary cases that can block the register API from working at init time */
139
141
  if (!agentRef.init.api.register.enabled) block(warnings.disabled)
140
142
  if (!hasValidValue(target.id) || !hasValidValue(target.name)) block(() => warnings.invalidTarget(target))
143
+ /** warn if we see obviously unstable things with MFE targets */
144
+ registeredEntities.forEach((entity) => {
145
+ try {
146
+ const { name, id } = entity.metadata.target
147
+ if (name === target.name && id !== target.id) warnings.duplicateName(target)
148
+ if (id === target.id && name !== target.name) warnings.duplicateId(target)
149
+ } catch (e) {
150
+ // something unexpected went wrong...
151
+ }
152
+ })
141
153
 
142
154
  /** @type {RegisterAPI} */
143
155
  const api = {