@newrelic/browser-agent 1.301.0 → 1.302.0-rc.1

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.
Files changed (142) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/common/config/init-types.js +1 -1
  3. package/dist/cjs/common/config/init.js +7 -1
  4. package/dist/cjs/common/config/runtime.js +1 -1
  5. package/dist/cjs/common/constants/agent-constants.js +11 -2
  6. package/dist/cjs/common/constants/env.cdn.js +1 -1
  7. package/dist/cjs/common/constants/env.npm.js +1 -1
  8. package/dist/cjs/common/drain/drain.js +1 -1
  9. package/dist/cjs/common/harvest/harvester.js +30 -39
  10. package/dist/cjs/common/util/mfe.js +45 -0
  11. package/dist/cjs/features/ajax/aggregate/index.js +5 -1
  12. package/dist/cjs/features/generic_events/aggregate/index.js +9 -8
  13. package/dist/cjs/features/generic_events/constants.js +3 -1
  14. package/dist/cjs/features/generic_events/instrument/index.js +38 -32
  15. package/dist/cjs/features/jserrors/aggregate/index.js +18 -17
  16. package/dist/cjs/features/logging/aggregate/index.js +19 -15
  17. package/dist/cjs/features/logging/shared/utils.js +3 -3
  18. package/dist/cjs/features/page_view_event/aggregate/index.js +3 -33
  19. package/dist/cjs/features/session_replay/aggregate/index.js +13 -13
  20. package/dist/cjs/features/session_replay/shared/recorder.js +3 -2
  21. package/dist/cjs/features/session_trace/aggregate/index.js +0 -2
  22. package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -2
  23. package/dist/cjs/features/utils/aggregate-base.js +45 -47
  24. package/dist/cjs/loaders/api/addPageAction.js +2 -2
  25. package/dist/cjs/loaders/api/log.js +2 -2
  26. package/dist/cjs/loaders/api/noticeError.js +2 -2
  27. package/dist/cjs/loaders/api/register-api-types.js +5 -5
  28. package/dist/cjs/loaders/api/register.js +80 -97
  29. package/dist/esm/common/config/init-types.js +1 -1
  30. package/dist/esm/common/config/init.js +7 -1
  31. package/dist/esm/common/config/runtime.js +1 -1
  32. package/dist/esm/common/constants/agent-constants.js +9 -1
  33. package/dist/esm/common/constants/env.cdn.js +1 -1
  34. package/dist/esm/common/constants/env.npm.js +1 -1
  35. package/dist/esm/common/drain/drain.js +1 -1
  36. package/dist/esm/common/harvest/harvester.js +30 -39
  37. package/dist/esm/common/util/mfe.js +38 -0
  38. package/dist/esm/features/ajax/aggregate/index.js +5 -1
  39. package/dist/esm/features/generic_events/aggregate/index.js +9 -8
  40. package/dist/esm/features/generic_events/constants.js +3 -1
  41. package/dist/esm/features/generic_events/instrument/index.js +38 -32
  42. package/dist/esm/features/jserrors/aggregate/index.js +18 -17
  43. package/dist/esm/features/logging/aggregate/index.js +19 -15
  44. package/dist/esm/features/logging/shared/utils.js +3 -3
  45. package/dist/esm/features/page_view_event/aggregate/index.js +3 -33
  46. package/dist/esm/features/session_replay/aggregate/index.js +13 -13
  47. package/dist/esm/features/session_replay/shared/recorder.js +3 -2
  48. package/dist/esm/features/session_trace/aggregate/index.js +0 -2
  49. package/dist/esm/features/soft_navigations/aggregate/index.js +1 -2
  50. package/dist/esm/features/utils/aggregate-base.js +46 -48
  51. package/dist/esm/loaders/api/addPageAction.js +2 -2
  52. package/dist/esm/loaders/api/log.js +2 -2
  53. package/dist/esm/loaders/api/noticeError.js +2 -2
  54. package/dist/esm/loaders/api/register-api-types.js +5 -5
  55. package/dist/esm/loaders/api/register.js +80 -97
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/dist/types/common/config/init-types.d.ts +4 -1
  58. package/dist/types/common/config/init-types.d.ts.map +1 -1
  59. package/dist/types/common/config/init.d.ts.map +1 -1
  60. package/dist/types/common/constants/agent-constants.d.ts +7 -4
  61. package/dist/types/common/constants/agent-constants.d.ts.map +1 -1
  62. package/dist/types/common/harvest/harvester.d.ts +2 -2
  63. package/dist/types/common/harvest/harvester.d.ts.map +1 -1
  64. package/dist/types/common/util/mfe.d.ts +20 -0
  65. package/dist/types/common/util/mfe.d.ts.map +1 -0
  66. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  67. package/dist/types/features/generic_events/aggregate/index.d.ts +2 -2
  68. package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
  69. package/dist/types/features/generic_events/constants.d.ts +1 -0
  70. package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -1
  71. package/dist/types/features/jserrors/aggregate/index.d.ts +3 -3
  72. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  73. package/dist/types/features/logging/aggregate/index.d.ts +3 -3
  74. package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
  75. package/dist/types/features/logging/shared/utils.d.ts +2 -2
  76. package/dist/types/features/logging/shared/utils.d.ts.map +1 -1
  77. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -4
  78. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  79. package/dist/types/features/session_replay/aggregate/index.d.ts +13 -4
  80. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  81. package/dist/types/features/session_replay/shared/recorder.d.ts +1 -0
  82. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
  83. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  84. package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
  85. package/dist/types/features/utils/aggregate-base.d.ts +13 -5
  86. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
  87. package/dist/types/loaders/api/addPageAction.d.ts +1 -1
  88. package/dist/types/loaders/api/addPageAction.d.ts.map +1 -1
  89. package/dist/types/loaders/api/log.d.ts +1 -1
  90. package/dist/types/loaders/api/log.d.ts.map +1 -1
  91. package/dist/types/loaders/api/noticeError.d.ts +1 -1
  92. package/dist/types/loaders/api/noticeError.d.ts.map +1 -1
  93. package/dist/types/loaders/api/register-api-types.d.ts +4 -4
  94. package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
  95. package/dist/types/loaders/api/register.d.ts +8 -1
  96. package/dist/types/loaders/api/register.d.ts.map +1 -1
  97. package/package.json +2 -2
  98. package/src/common/config/init-types.js +1 -1
  99. package/src/common/config/init.js +3 -1
  100. package/src/common/config/runtime.js +1 -1
  101. package/src/common/constants/agent-constants.js +10 -0
  102. package/src/common/drain/drain.js +1 -1
  103. package/src/common/harvest/harvester.js +27 -32
  104. package/src/common/util/mfe.js +35 -0
  105. package/src/features/ajax/aggregate/index.js +7 -1
  106. package/src/features/generic_events/aggregate/index.js +9 -8
  107. package/src/features/generic_events/constants.js +3 -1
  108. package/src/features/generic_events/instrument/index.js +44 -35
  109. package/src/features/jserrors/aggregate/index.js +17 -17
  110. package/src/features/logging/aggregate/index.js +20 -13
  111. package/src/features/logging/shared/utils.js +3 -3
  112. package/src/features/page_view_event/aggregate/index.js +3 -28
  113. package/src/features/session_replay/aggregate/index.js +12 -10
  114. package/src/features/session_replay/shared/recorder.js +3 -2
  115. package/src/features/session_trace/aggregate/index.js +0 -2
  116. package/src/features/soft_navigations/aggregate/index.js +1 -2
  117. package/src/features/utils/aggregate-base.js +47 -42
  118. package/src/loaders/api/addPageAction.js +2 -2
  119. package/src/loaders/api/log.js +2 -2
  120. package/src/loaders/api/noticeError.js +2 -2
  121. package/src/loaders/api/register-api-types.js +5 -5
  122. package/src/loaders/api/register.js +62 -89
  123. package/dist/cjs/common/util/target.js +0 -34
  124. package/dist/cjs/features/utils/entity-manager.js +0 -46
  125. package/dist/cjs/features/utils/event-store-manager.js +0 -174
  126. package/dist/cjs/loaders/api/register-api.js +0 -165
  127. package/dist/esm/common/util/target.js +0 -27
  128. package/dist/esm/features/utils/entity-manager.js +0 -39
  129. package/dist/esm/features/utils/event-store-manager.js +0 -166
  130. package/dist/esm/loaders/api/register-api.js +0 -159
  131. package/dist/types/common/util/target.d.ts +0 -18
  132. package/dist/types/common/util/target.d.ts.map +0 -1
  133. package/dist/types/features/utils/entity-manager.d.ts +0 -11
  134. package/dist/types/features/utils/entity-manager.d.ts.map +0 -1
  135. package/dist/types/features/utils/event-store-manager.d.ts +0 -85
  136. package/dist/types/features/utils/event-store-manager.d.ts.map +0 -1
  137. package/dist/types/loaders/api/register-api.d.ts +0 -14
  138. package/dist/types/loaders/api/register-api.d.ts.map +0 -1
  139. package/src/common/util/target.js +0 -27
  140. package/src/features/utils/entity-manager.js +0 -45
  141. package/src/features/utils/event-store-manager.js +0 -165
  142. package/src/loaders/api/register-api.js +0 -152
@@ -10,15 +10,12 @@ import { drain } from '../../common/drain/drain';
10
10
  import { activatedFeatures } from '../../common/util/feature-flags';
11
11
  import { Obfuscator } from '../../common/util/obfuscate';
12
12
  import { FEATURE_NAMES } from '../../loaders/features/features';
13
- import { EventStoreManager } from './event-store-manager';
14
13
  import { Harvester } from '../../common/harvest/harvester';
15
- import { warn } from '../../common/util/console';
16
- import { EntityManager } from './entity-manager';
17
14
  import { EventBuffer } from './event-buffer';
18
15
  import { handle } from '../../common/event-emitter/handle';
19
16
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../metrics/constants';
20
17
  import { EventAggregator } from '../../common/aggregate/event-aggregator';
21
- import { IDEAL_PAYLOAD_SIZE } from '../../common/constants/agent-constants';
18
+ import { MAX_PAYLOAD_SIZE, IDEAL_PAYLOAD_SIZE, SUPPORTS_REGISTERED_ENTITIES } from '../../common/constants/agent-constants';
22
19
  export class AggregateBase extends FeatureBase {
23
20
  /**
24
21
  * Create an AggregateBase instance.
@@ -39,16 +36,8 @@ export class AggregateBase extends FeatureBase {
39
36
  this.isRetrying = false;
40
37
  this.harvestOpts = {}; // features aggregate classes can define custom opts for when their harvest is called
41
38
 
42
- const agentEntityGuid = this.agentRef?.runtime?.appMetadata?.agents?.[0]?.entityGuid;
43
- this.#setupEventStore(agentEntityGuid);
44
- if (!agentEntityGuid) {
45
- /** wait for the entity guid from the rum response and use to it to further configure things to set the default entity to share an indexed entity with entityGuid */
46
- this.ee.on('entity-added', entity => {
47
- // not all event managers have this fn, like ST and SR
48
- // this allows the lookup to work for the default and an entityGuid without creating two separate buffers
49
- this.events?.setEventStore?.(entity.entityGuid);
50
- });
51
- }
39
+ this.#setupEventStore();
40
+ this.waitForDrain();
52
41
  }
53
42
 
54
43
  /**
@@ -56,7 +45,7 @@ export class AggregateBase extends FeatureBase {
56
45
  * @param {string} entityGuid
57
46
  * @returns {void}
58
47
  */
59
- #setupEventStore(entityGuid) {
48
+ #setupEventStore() {
60
49
  if (this.events) return;
61
50
  switch (this.featureName) {
62
51
  // SessionReplay has its own storage mechanisms.
@@ -65,19 +54,39 @@ export class AggregateBase extends FeatureBase {
65
54
  // Jserror and Metric features uses a singleton EventAggregator instead of a regular EventBuffer.
66
55
  case FEATURE_NAMES.jserrors:
67
56
  case FEATURE_NAMES.metrics:
68
- this.events = this.agentRef.sharedAggregator ??= new EventStoreManager(this.agentRef, EventAggregator, entityGuid, {
69
- featureName: 'shared_aggregator'
70
- });
57
+ this.events = this.agentRef.sharedAggregator ??= new EventAggregator();
71
58
  break;
72
- /** All other features get EventBuffer in the ESM by default. Note: PVE is included here, but event buffer will always be empty so future harvests will still not happen by interval or EOL.
59
+ /** All other features get EventBuffer by default. Note: PVE is included here, but event buffer will always be empty so future harvests will still not happen by interval or EOL.
73
60
  This was necessary to prevent race cond. issues where the event buffer was checked before the feature could "block" itself.
74
61
  Its easier to just keep an empty event buffer in place. */
75
62
  default:
76
- this.events = new EventStoreManager(this.agentRef, EventBuffer, entityGuid, this);
63
+ this.events = new EventBuffer(MAX_PAYLOAD_SIZE, this);
77
64
  break;
78
65
  }
79
66
  }
80
67
 
68
+ /** @type {Boolean} indicates if the feature supports registered entities and the harvest requirements therein. Also read by getter "harvestEndpointVersion". Controlled by feature flag in pre-release phase. */
69
+ get supportsRegisteredEntities() {
70
+ return this.featureName in SUPPORTS_REGISTERED_ENTITIES && (SUPPORTS_REGISTERED_ENTITIES[this.featureName] || this.agentRef.init.feature_flags.includes('register.' + this.featureName));
71
+ }
72
+
73
+ /**
74
+ * the endpoint version the feature uses during harvests
75
+ * @type {number}
76
+ * @returns {boolean}
77
+ */
78
+ get harvestEndpointVersion() {
79
+ return this.supportsRegisteredEntities && !!this.agentRef.runtime.registeredEntities.length ? 2 : 1;
80
+ }
81
+ waitForDrain() {
82
+ /** emitted when the feature successfully drains */
83
+ this.ee.on('drain-' + this.featureName, () => {
84
+ /** make an immediate harvest for all the features to help with harvestability for pre-load dervied data on short lived pages */
85
+ if (!this.drained) setTimeout(() => this.agentRef.runtime.harvester.triggerHarvestFor(this), 1);
86
+ this.drained = true;
87
+ });
88
+ }
89
+
81
90
  /**
82
91
  * Evaluates whether a harvest should be made early by estimating the size of the current payload. Currently, this only happens if the event storage is EventBuffer, since that triggers this method directly.
83
92
  * If conditions are met, a new harvest will be triggered immediately.
@@ -125,7 +134,6 @@ export class AggregateBase extends FeatureBase {
125
134
  */
126
135
  drain() {
127
136
  drain(this.agentIdentifier, this.featureName);
128
- this.drained = true;
129
137
  }
130
138
  preHarvestChecks(opts) {
131
139
  return !this.blocked;
@@ -135,47 +143,38 @@ export class AggregateBase extends FeatureBase {
135
143
  * Return harvest payload. A "serializer" function can be defined on a derived class to format the payload.
136
144
  * @param {Boolean} shouldRetryOnFail - harvester flag to backup payload for retry later if harvest request fails; this should be moved to harvester logic
137
145
  * @param {object|undefined} opts - opts passed from the harvester to help form the payload
138
- * @param {string} opts.targetEntityGuid - the entity guid of the target app
146
+ * @param {string} opts.target - the target app metadata
139
147
  * @returns {Array} Final payload tagged with their targeting browser app. The value of `payload` can be undefined if there are no pending events for an app. This should be a minimum length of 1.
140
148
  */
141
149
  makeHarvestPayload(shouldRetryOnFail = false, opts = {}) {
142
- if (!this.events || this.events.isEmpty(this.harvestOpts, opts.targetEntityGuid)) return;
150
+ if (!this.events || this.events.isEmpty(this.harvestOpts)) return;
143
151
  // Other conditions and things to do when preparing harvest that is required.
144
152
  if (this.preHarvestChecks && !this.preHarvestChecks(opts)) return;
145
- if (shouldRetryOnFail) this.events.save(this.harvestOpts, opts.targetEntityGuid);
146
- const returnedDataArr = this.events.get(this.harvestOpts, opts.targetEntityGuid);
147
- if (!returnedDataArr.length) return warn(52);
148
- this.events.clear(this.harvestOpts, opts.targetEntityGuid);
149
- return returnedDataArr.map(({
150
- targetApp,
151
- data
152
- }) => {
153
- // A serializer or formatter assists in creating the payload `body` from stored events on harvest when defined by derived feature class.
154
- const body = this.serializer ? this.serializer(data, targetApp?.entityGuid) : data;
155
- const payload = {
156
- body
157
- };
158
- // Constructs the payload `qs` for relevant features on harvest.
159
- if (this.queryStringsBuilder) payload.qs = this.queryStringsBuilder(data, targetApp?.entityGuid);
160
- return {
161
- targetApp,
162
- payload
163
- };
164
- });
153
+ if (shouldRetryOnFail) this.events.save(this.harvestOpts);
154
+ const data = this.events.get(this.harvestOpts);
155
+ if (!data) return;
156
+ this.events.clear(this.harvestOpts);
157
+
158
+ // A serializer or formatter assists in creating the payload `body` from stored events on harvest when defined by derived feature class.
159
+ const body = this.serializer ? this.serializer(data) : data;
160
+ const payload = {
161
+ body
162
+ };
163
+ // Constructs the payload `qs` for relevant features on harvest.
164
+ if (this.queryStringsBuilder) payload.qs = this.queryStringsBuilder(data);
165
+ return payload;
165
166
  }
166
167
 
167
168
  /**
168
169
  * Cleanup task after a harvest.
169
170
  * @param {object} result - the cbResult object from the harvester's send method
170
- * @param {object=} result.targetApp - the target app object that was used to point the harvest to the correct app
171
- * @param {string=} result.targetApp.entityGuid - the entity guid of the target app
172
171
  * @param {boolean=} result.sent - whether the harvest was sent successfully
173
172
  * @param {boolean=} result.retry - whether the harvest should be retried
174
173
  */
175
174
  postHarvestCleanup(result = {}) {
176
175
  this.isRetrying = result.sent && result.retry;
177
- if (this.isRetrying) this.events.reloadSave(this.harvestOpts, result.targetApp?.entityGuid);
178
- this.events.clearSave(this.harvestOpts, result.targetApp?.entityGuid);
176
+ if (this.isRetrying) this.events.reloadSave(this.harvestOpts);
177
+ this.events.clearSave(this.harvestOpts);
179
178
  }
180
179
 
181
180
  /**
@@ -215,7 +214,6 @@ export class AggregateBase extends FeatureBase {
215
214
  doOnceForAllAggregate(agentRef) {
216
215
  if (!agentRef.runtime.obfuscator) agentRef.runtime.obfuscator = new Obfuscator(agentRef);
217
216
  this.obfuscator = agentRef.runtime.obfuscator;
218
- if (!agentRef.runtime.entityManager) agentRef.runtime.entityManager = new EntityManager(this.agentRef);
219
217
  if (!agentRef.runtime.harvester) agentRef.runtime.harvester = new Harvester(agentRef);
220
218
  }
221
219
 
@@ -10,6 +10,6 @@ import { setupAPI } from './sharedHandlers';
10
10
  export function setupAddPageActionAPI(agent) {
11
11
  setupAPI(ADD_PAGE_ACTION, (name, attributes) => addPageAction(name, attributes, agent), agent);
12
12
  }
13
- export function addPageAction(name, attributes, agentRef, targetEntityGuid, timestamp = now()) {
14
- handle(prefix + ADD_PAGE_ACTION, [timestamp, name, attributes, targetEntityGuid], undefined, FEATURE_NAMES.genericEvents, agentRef.ee);
13
+ export function addPageAction(name, attributes, agentRef, target, timestamp = now()) {
14
+ handle(prefix + ADD_PAGE_ACTION, [timestamp, name, attributes, target], undefined, FEATURE_NAMES.genericEvents, agentRef.ee);
15
15
  }
@@ -14,6 +14,6 @@ export function setupLogAPI(agent) {
14
14
  export function log(message, {
15
15
  customAttributes = {},
16
16
  level = LOG_LEVELS.INFO
17
- } = {}, agentRef, targetEntityGuid, timestamp = now()) {
18
- bufferLog(agentRef.ee, message, customAttributes, level, targetEntityGuid, timestamp);
17
+ } = {}, agentRef, target, timestamp = now()) {
18
+ bufferLog(agentRef.ee, message, customAttributes, level, target, timestamp);
19
19
  }
@@ -10,8 +10,8 @@ import { setupAPI } from './sharedHandlers';
10
10
  export function setupNoticeErrorAPI(agent) {
11
11
  setupAPI(NOTICE_ERROR, (err, customAttributes) => noticeError(err, customAttributes, agent), agent);
12
12
  }
13
- export function noticeError(err, customAttributes, agentRef, targetEntityGuid, timestamp = now()) {
13
+ export function noticeError(err, customAttributes, agentRef, target, timestamp = now()) {
14
14
  if (typeof err === 'string') err = new Error(err);
15
- handle('err', [err, timestamp, false, customAttributes, agentRef.runtime.isRecording, undefined, targetEntityGuid], undefined, FEATURE_NAMES.jserrors, agentRef.ee);
15
+ handle('err', [err, timestamp, false, customAttributes, agentRef.runtime.isRecording, undefined, target], undefined, FEATURE_NAMES.jserrors, agentRef.ee);
16
16
  handle('uaErr', [], undefined, FEATURE_NAMES.genericEvents, agentRef.ee);
17
17
  }
@@ -17,17 +17,17 @@
17
17
  /**
18
18
  * @typedef {Object} RegisterAPIConstructor
19
19
  * @property {Object} opts - The options for the registered entity.
20
- * @property {string} opts.licenseKey - The license key for the registered entity.
21
- * @property {string} opts.applicationID - The application ID for the registered entity.
20
+ * @property {string} opts.id - The unique id for the registered entity. This will be assigned to any synthesized entities.
21
+ * @property {string} opts.name - The readable name for the registered entity. This will be assigned to any synthesized entities.
22
22
  */
23
23
 
24
24
  /**
25
25
  * @typedef {Object} RegisterAPIMetadata
26
26
  * @property {Object} customAttributes - The custom attributes for the registered entity.
27
27
  * @property {Object} target - The options for the registered entity.
28
- * @property {string} target.licenseKey - The license key for the registered entity.
29
- * @property {string} target.applicationID - The application ID for the registered entity.
30
- * @property {string} target.entityGuid - The entity guid returned for the registered entity.
28
+ * @property {string} target.licenseKey - The license key for the registered entity. If none was supplied, it will assume the license key from the main agent.
29
+ * @property {string} target.id - The ID for the registered entity.
30
+ * @property {string} target.name - The name returned for the registered entity.
31
31
  */
32
32
 
33
33
  export default {};
@@ -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 { isContainerAgentTarget, isValidTarget } from '../../common/util/target';
7
+ import { isValidMFETarget } from '../../common/util/mfe';
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';
@@ -13,6 +13,7 @@ import { REGISTER } from './constants';
13
13
  import { log } from './log';
14
14
  import { addPageAction } from './addPageAction';
15
15
  import { noticeError } from './noticeError';
16
+ import { single } from '../../common/util/invoke';
16
17
 
17
18
  /**
18
19
  * @typedef {import('./register-api-types').RegisterAPI} RegisterAPI
@@ -35,138 +36,120 @@ export function setupRegisterAPI(agent) {
35
36
  * @param {Object} agentRef the reference to the base agent instance
36
37
  * @param {Object} handlers the shared handlers to be used by both the base agent's API and the external target's API
37
38
  * @param {Object} target the target information to be used by the external target's API to send data to the correct location
39
+ * @param {string} [target.licenseKey] the license key of the target to report data to
40
+ * @param {string} target.id the entity ID of the target to report data to
41
+ * @param {string} target.name the entity name of the target to report data to
38
42
  * @returns {RegisterAPI} the api object to be returned from the register api method
39
43
  */
40
44
  export function buildRegisterApi(agentRef, target) {
41
45
  const attrs = {};
42
46
  warn(54, 'newrelic.register');
47
+ target ||= {};
48
+ target.licenseKey ||= agentRef.info.licenseKey; // will inherit the license key from the container agent if not provided for brevity. A future state may dictate that we need different license keys to do different things.
49
+ target.blocked = false;
43
50
 
44
- /** @type {Function|undefined} a function that is set and reports when APIs are triggered -- warns the customer of the invalid state */
45
- let invalidApiResponse;
51
+ /** @type {Function} a function that is set and reports when APIs are triggered -- warns the customer of the invalid state */
52
+ let invalidApiResponse = () => {};
53
+ /** @type {Array} the array of registered target APIs */
54
+ const registeredEntities = agentRef.runtime.registeredEntities;
55
+
56
+ /** if we have already registered this target, go ahead and re-use it */
57
+ const preregisteredEntity = registeredEntities.find(({
58
+ metadata: {
59
+ target: {
60
+ id,
61
+ name
62
+ }
63
+ }
64
+ }) => id === target.id);
65
+ if (preregisteredEntity) {
66
+ if (preregisteredEntity.metadata.target.name !== target.name) preregisteredEntity.metadata.target.name = target.name;
67
+ return preregisteredEntity;
68
+ }
46
69
 
47
70
  /**
48
- * A promise that indicates when all needed connections for the registered child to be ready to report data
49
- * 1. The main agent to be ready (made a RUM call and got its entity guid)
50
- * 2. The child to be registered with the main agent (made its own RUM call and got its entity guid)
51
- * @type {Promise<RegisterAPI>}
52
- */
53
- let _connected;
54
- if (!agentRef.init.api.allow_registered_children) invalidApiResponse = () => warn(55);
55
- if (!target || !isValidTarget(target)) invalidApiResponse = () => warn(48, target);
71
+ * Block the API, and supply a warning function to display a message to end users
72
+ * @param {Function} warning
73
+ */
74
+ const block = warning => {
75
+ target.blocked = true;
76
+ invalidApiResponse = warning;
77
+ };
78
+
79
+ /** primary cases that can block the register API from working at init time */
80
+ if (!agentRef.init.api.allow_registered_children) block(single(() => warn(55)));
81
+ if (!isValidMFETarget(target)) block(single(() => warn(48, target)));
56
82
 
57
83
  /** @type {RegisterAPI} */
58
84
  const api = {
59
- addPageAction: (name, attributes = {}) => {
60
- report(addPageAction, [name, {
85
+ addPageAction: (name, attributes = {}) => report(addPageAction, [name, {
86
+ ...attrs,
87
+ ...attributes
88
+ }, agentRef], target),
89
+ log: (message, options = {}) => report(log, [message, {
90
+ ...options,
91
+ customAttributes: {
61
92
  ...attrs,
62
- ...attributes
63
- }, agentRef], target);
64
- },
65
- log: (message, options = {}) => {
66
- report(log, [message, {
67
- ...options,
68
- customAttributes: {
69
- ...attrs,
70
- ...(options.customAttributes || {})
71
- }
72
- }, agentRef], target);
73
- },
74
- noticeError: (error, attributes = {}) => {
75
- report(noticeError, [error, {
76
- ...attrs,
77
- ...attributes
78
- }, agentRef], target);
79
- },
80
- setApplicationVersion: value => {
81
- attrs['application.version'] = value;
82
- },
83
- setCustomAttribute: (key, value) => {
84
- attrs[key] = value;
85
- },
86
- setUserId: value => {
87
- attrs['enduser.id'] = value;
88
- },
93
+ ...(options.customAttributes || {})
94
+ }
95
+ }, agentRef], target),
96
+ noticeError: (error, attributes = {}) => report(noticeError, [error, {
97
+ ...attrs,
98
+ ...attributes
99
+ }, agentRef], target),
100
+ setApplicationVersion: value => setLocalValue('application.version', value),
101
+ setCustomAttribute: (key, value) => setLocalValue(key, value),
102
+ setUserId: value => setLocalValue('enduser.id', value),
89
103
  /** metadata */
90
104
  metadata: {
91
105
  customAttributes: attrs,
92
- target,
93
- /** set in a getter so that later access of the Promise is not polluted before customer is allowed to set a catch block */
94
- get connected() {
95
- return _connected || Promise.reject(new Error('Failed to connect'));
96
- }
106
+ target
97
107
  }
98
108
  };
99
- if (invalidApiResponse) {
100
- invalidApiResponse();
101
- } else {
102
- _connected = new Promise((resolve, reject) => {
103
- try {
104
- const entityManager = agentRef.runtime?.entityManager;
105
- /** check if main agent already has main agent entity guid */
106
- let mainAgentReady = !!entityManager?.get().entityGuid;
107
- /** check if registered target already has entity guid */
108
- let registeredEntityGuid = entityManager?.getEntityGuidFor(target.licenseKey, target.applicationID);
109
- let registrationReady = !!registeredEntityGuid;
110
-
111
- /** check if we can just resolve immediately without making another connect call */
112
- if (mainAgentReady && registrationReady) {
113
- target.entityGuid = registeredEntityGuid;
114
- resolve(api);
115
- } else {
116
- /** we need to make a new connection call since we dont already have a registered entity for this call */
117
109
 
118
- /** if the connect callback doesnt resolve in 15 seconds... reject */
119
- const timeout = setTimeout(() => reject(new Error('Failed to connect - Timeout')), 15000);
110
+ /**
111
+ * Check if the API is blocked and emit a warning message describing the blockage
112
+ * @returns {boolean}
113
+ */
114
+ const isBlocked = () => {
115
+ if (target.blocked) invalidApiResponse();
116
+ return target.blocked;
117
+ };
120
118
 
121
- // tell the main agent to send a rum call for this target
122
- // when the rum call resolves, it will emit an "entity-added" event, see below
123
- agentRef.ee.emit('api-send-rum', [attrs, target]);
119
+ /** only allow registered APIs to be tracked in the agent runtime */
120
+ if (!isBlocked()) registeredEntities.push(api);
124
121
 
125
- // wait for entity events to emit to see when main agent and/or API registration is ready
126
- agentRef.ee.on('entity-added', entityEventHandler);
127
- function entityEventHandler(entity) {
128
- if (isContainerAgentTarget(entity, agentRef)) mainAgentReady ||= true;else {
129
- if (target.licenseKey === entity.licenseKey && target.applicationID === entity.applicationID) {
130
- registrationReady = true;
131
- target.entityGuid = entity.entityGuid;
132
- }
133
- }
134
- if (mainAgentReady && registrationReady) {
135
- clearTimeout(timeout);
136
- // unsubscribe from the event emitter
137
- agentRef.ee.removeEventListener('entity-added', entityEventHandler);
138
- resolve(api);
139
- }
140
- }
141
- }
142
- } catch (err) {
143
- reject(err);
144
- }
145
- });
146
- }
122
+ /**
123
+ * Sets a value local to the registered API attrs. Will do nothing if APIs are deregistered.
124
+ * @param {string} key The attribute key
125
+ * @param {*} value the attribute value
126
+ * @returns {void}
127
+ */
128
+ const setLocalValue = (key, value) => {
129
+ if (isBlocked()) return;
130
+ attrs[key] = value;
131
+ };
147
132
 
148
133
  /**
149
134
  * The reporter method that will be used to report the data to the container agent's API method. If invalid, will log a warning and not execute.
150
135
  * If the api.duplicate_registered_data configuration value is set to true, the data will be reported to BOTH the container and the external target
151
136
  * @param {*} methodToCall the container agent's API method to call
152
137
  * @param {*} args the arguments to supply to the container agent's API method
153
- * @param {string} targetEntityGuid the target entity guid, which looks up the target to report the data to from the entity manager. If undefined, will report to the container agent's target.
138
+ * @param {string} target the target to report the data to. If undefined, will report to the container agent's target.
154
139
  * @returns
155
140
  */
156
- const report = async (methodToCall, args, target) => {
157
- if (invalidApiResponse) return invalidApiResponse();
141
+ const report = (methodToCall, args, target) => {
142
+ if (isBlocked()) return;
158
143
  /** set the timestamp before the async part of waiting for the rum response for better accuracy */
159
144
  const timestamp = now();
160
145
  handle(SUPPORTABILITY_METRIC_CHANNEL, ["API/register/".concat(methodToCall.name, "/called")], undefined, FEATURE_NAMES.metrics, agentRef.ee);
161
146
  try {
162
- await _connected;
163
- // target should be decorated with entityGuid by the rum resp at this point
164
147
  const shouldDuplicate = agentRef.init.api.duplicate_registered_data;
165
- if (shouldDuplicate === true || Array.isArray(shouldDuplicate) && shouldDuplicate.includes(target.entityGuid)) {
148
+ if (shouldDuplicate === true || Array.isArray(shouldDuplicate)) {
166
149
  // also report to container by providing undefined target
167
150
  methodToCall(...args, undefined, timestamp);
168
151
  }
169
- methodToCall(...args, target.entityGuid, timestamp); // always report to target
152
+ return methodToCall(...args, target, timestamp); // always report to target
170
153
  } catch (err) {
171
154
  warn(50, err);
172
155
  }
@@ -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/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/harvester.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/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.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/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/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/stringify.js","../src/common/util/submit-data.js","../src/common/util/target.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.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/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-jsonp.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-mutation.js","../src/common/wrap/wrap-promise.js","../src/common/wrap/wrap-timer.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/aggregate/websocket-detection.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/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/spa/constants.js","../src/features/spa/index.js","../src/features/spa/aggregate/index.js","../src/features/spa/aggregate/interaction-node.js","../src/features/spa/aggregate/interaction.js","../src/features/spa/aggregate/serializer.js","../src/features/spa/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/entity-manager.js","../src/features/utils/event-buffer.js","../src/features/utils/event-store-manager.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/features/utils/nr1-debugger.js","../src/interfaces/registered-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/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-api.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/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/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/harvester.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/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.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/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/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/mfe.js","../src/common/util/monkey-patched.js","../src/common/util/obfuscate.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/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/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-jsonp.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-mutation.js","../src/common/wrap/wrap-promise.js","../src/common/wrap/wrap-timer.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/aggregate/websocket-detection.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/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/spa/constants.js","../src/features/spa/index.js","../src/features/spa/aggregate/index.js","../src/features/spa/aggregate/interaction-node.js","../src/features/spa/aggregate/interaction.js","../src/features/spa/aggregate/serializer.js","../src/features/spa/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/features/utils/nr1-debugger.js","../src/interfaces/registered-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/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/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"}
@@ -92,7 +92,10 @@ export type Init = {
92
92
  /**
93
93
  * - Array of regexp and corresponding replacement patterns for obfuscating data.
94
94
  */
95
- obfuscate?: Object[] | undefined;
95
+ obfuscate?: {
96
+ regex: RegExp | string;
97
+ replacement: string;
98
+ }[] | undefined;
96
99
  page_action?: {
97
100
  /**
98
101
  * - Must be true to allow PageAction events to be captured.
@@ -1 +1 @@
1
- {"version":3,"file":"init-types.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init-types.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"init-types.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init-types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAqCsB,MAAM,GAAG,MAAM;qBAAe,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AA4IO,0CAEN;mBAnIY,OAAO,cAAc,EAAE,IAAI"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AA8IO,0CAEN;mBArIY,OAAO,cAAc,EAAE,IAAI"}
@@ -1,9 +1,12 @@
1
- /**
2
- * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
1
  export const IDEAL_PAYLOAD_SIZE: 16000;
6
2
  export const MAX_PAYLOAD_SIZE: 1000000;
7
3
  export const DEFAULT_KEY: "NR_CONTAINER_AGENT";
8
4
  export const SESSION_ERROR: "SESSION_ERROR";
5
+ export const SUPPORTS_REGISTERED_ENTITIES: {
6
+ [FEATURE_NAMES.logging]: boolean;
7
+ [FEATURE_NAMES.genericEvents]: boolean;
8
+ [FEATURE_NAMES.jserrors]: boolean;
9
+ [FEATURE_NAMES.ajax]: boolean;
10
+ };
11
+ import { FEATURE_NAMES } from '../../loaders/features/features';
9
12
  //# sourceMappingURL=agent-constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-constants.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/agent-constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,iCAAkC,KAAK,CAAA;AACvC,+BAAgC,OAAO,CAAA;AACvC,0BAA2B,oBAAoB,CAAA;AAC/C,4BAA6B,eAAe,CAAA"}
1
+ {"version":3,"file":"agent-constants.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/agent-constants.js"],"names":[],"mappings":"AAMA,iCAAkC,KAAK,CAAA;AACvC,+BAAgC,OAAO,CAAA;AACvC,0BAA2B,oBAAoB,CAAA;AAC/C,4BAA6B,eAAe,CAAA;AAE5C;IACE,CAAC,aAAa,CAAC,OAAO,CAAC,UAAM;IAE7B,CAAC,aAAa,CAAC,aAAa,CAAC,UAAO;IACpC,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAO;IAC/B,CAAC,aAAa,CAAC,IAAI,CAAC,UAAO;EAC5B;8BAb6B,iCAAiC"}
@@ -3,15 +3,15 @@
3
3
  * @param {NetworkSendSpec} param0 Specification for sending data
4
4
  * @returns {boolean} True if a network call was made. Note that this does not mean or guarantee that it was successful.
5
5
  */
6
- export function send(agentRef: any, { endpoint, targetApp, payload, localOpts, submitMethod, cbFinished, raw, featureName }: {
6
+ export function send(agentRef: any, { endpoint, payload, localOpts, submitMethod, cbFinished, raw, featureName, endpointVersion }: {
7
7
  endpoint: any;
8
- targetApp: any;
9
8
  payload: any;
10
9
  localOpts?: {} | undefined;
11
10
  submitMethod: any;
12
11
  cbFinished: any;
13
12
  raw: any;
14
13
  featureName: any;
14
+ endpointVersion?: number | undefined;
15
15
  }): boolean;
16
16
  export class Harvester {
17
17
  constructor(agentRef: any);
@@ -1 +1 @@
1
- {"version":3,"file":"harvester.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvester.js"],"names":[],"mappings":"AA6GA;;;;IAII;AACJ;;;;;;;;;IAFc,OAAO,CA0HpB;AAnND;IAIE,2BAUC;IAZD,6BAA0B;IAGxB,cAAwB;IAW1B,wCASC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,cACN,MAAM,GACJ,OAAO,CA+CnB;;CACF;8BAGY,OAAO,YAAY,EAAE,eAAe"}
1
+ {"version":3,"file":"harvester.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvester.js"],"names":[],"mappings":"AAyGA;;;;IAII;AACJ;;;;;;;;;IAFc,OAAO,CAyHpB;AA9MD;IAIE,2BAUC;IAZD,6BAA0B;IAGxB,cAAwB;IAW1B,wCASC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,cACN,MAAM,GACJ,OAAO,CA2CnB;;CACF;8BAGY,OAAO,YAAY,EAAE,eAAe"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * @param {Object} [target] - the target to be validated
7
+ * @returns {boolean}
8
+ */
9
+ export function isValidMFETarget(target?: Object): boolean;
10
+ /**
11
+ * When given a valid target, returns an object with the MFE payload attributes. Returns an empty object otherwise.
12
+ * @param {Object} [target] the registered target
13
+ * @param {AggregateInstance} [aggregateInstance] the aggregate instance calling the method
14
+ * @returns {{'mfe.id': *, 'mfe.name': String}|{}} returns an empty object if args are not supplied or the aggregate instance is not supporting version 2
15
+ */
16
+ export function getVersion2Attributes(target?: Object, aggregateInstance?: AggregateInstance): {
17
+ "mfe.id": any;
18
+ "mfe.name": string;
19
+ } | {};
20
+ //# sourceMappingURL=mfe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfe.d.ts","sourceRoot":"","sources":["../../../../src/common/util/mfe.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,0CAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;;GAKG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf;IAAC,QAAQ,EAAE,GAAC,CAAC;IAAC,UAAU,SAAQ;CAAC,GAAC,EAAE,CAiBhD"}