@newrelic/browser-agent 1.321.0-rc.7 → 1.321.0-rc.9

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 (46) hide show
  1. package/dist/cjs/common/constants/env.cdn.js +1 -1
  2. package/dist/cjs/common/constants/env.npm.js +1 -1
  3. package/dist/cjs/common/util/console.js +1 -0
  4. package/dist/cjs/common/v2/manifest.js +142 -0
  5. package/dist/cjs/common/v2/script-tracker-types.js +27 -0
  6. package/dist/cjs/common/v2/script-tracker.js +223 -25
  7. package/dist/cjs/common/v2/utils.js +47 -1
  8. package/dist/cjs/features/generic_events/aggregate/index.js +28 -1
  9. package/dist/cjs/loaders/api/register-api-types.js +13 -4
  10. package/dist/cjs/loaders/api/register.js +18 -0
  11. package/dist/esm/common/constants/env.cdn.js +1 -1
  12. package/dist/esm/common/constants/env.npm.js +1 -1
  13. package/dist/esm/common/util/console.js +1 -0
  14. package/dist/esm/common/v2/manifest.js +136 -0
  15. package/dist/esm/common/v2/script-tracker-types.js +24 -0
  16. package/dist/esm/common/v2/script-tracker.js +222 -26
  17. package/dist/esm/common/v2/utils.js +46 -1
  18. package/dist/esm/features/generic_events/aggregate/index.js +29 -2
  19. package/dist/esm/loaders/api/register-api-types.js +14 -4
  20. package/dist/esm/loaders/api/register.js +18 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/dist/types/common/config/init-types.d.ts +1 -1
  23. package/dist/types/common/util/console.d.ts +1 -0
  24. package/dist/types/common/util/console.d.ts.map +1 -1
  25. package/dist/types/common/v2/manifest.d.ts +66 -0
  26. package/dist/types/common/v2/manifest.d.ts.map +1 -0
  27. package/dist/types/common/v2/script-tracker-types.d.ts +25 -0
  28. package/dist/types/common/v2/script-tracker-types.d.ts.map +1 -0
  29. package/dist/types/common/v2/script-tracker.d.ts +25 -4
  30. package/dist/types/common/v2/script-tracker.d.ts.map +1 -1
  31. package/dist/types/common/v2/utils.d.ts +12 -0
  32. package/dist/types/common/v2/utils.d.ts.map +1 -1
  33. package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
  34. package/dist/types/loaders/api/register-api-types.d.ts +31 -4
  35. package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
  36. package/dist/types/loaders/api/register.d.ts +1 -0
  37. package/dist/types/loaders/api/register.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/common/util/console.js +1 -0
  40. package/src/common/v2/manifest.js +126 -0
  41. package/src/common/v2/script-tracker-types.js +24 -0
  42. package/src/common/v2/script-tracker.js +218 -26
  43. package/src/common/v2/utils.js +42 -1
  44. package/src/features/generic_events/aggregate/index.js +22 -2
  45. package/src/loaders/api/register-api-types.js +14 -4
  46. package/src/loaders/api/register.js +16 -1
@@ -4,6 +4,8 @@
4
4
  */
5
5
 
6
6
  import { extractUrlsFromStack, getDeepStackTrace } from './script-tracker';
7
+ import { matchManifestAsset } from './manifest';
8
+ import { cleanURL } from '../url/clean-url';
7
9
  import { V2_TYPES } from './constants';
8
10
 
9
11
  /**
@@ -47,6 +49,38 @@ export function getRegisteredTargetsFromId(id, agentRef) {
47
49
  return registeredEntities?.filter(entity => String(entity.metadata.target.id) === String(id)).map(entity => entity.metadata.target) || [];
48
50
  }
49
51
 
52
+ /**
53
+ * Returns the registered target(s) whose resource matches a given resource URL -- used to attribute `BrowserPerformance`
54
+ * (PerformanceResourceTiming) events, which never have a JS call stack to walk (they're fired for declarative
55
+ * `<script src>`/`<link>`/`<img>` tags, not JS execution), so stack-trace attribution (see {@link findTargetsFromStackTrace})
56
+ * doesn't apply. Unlike {@link getRegisteredTargetsFromFilename}, this matches manifest assets of ANY type (scripts,
57
+ * images, fonts, css, etc.) -- non-script assets can't produce a JS stack frame to match against, but they can and do
58
+ * produce their own resource timing entries. Returns an empty array if no target is found.
59
+ * @param {string} url - the resource's URL, as reported by the Performance API
60
+ * @param {*} agentRef
61
+ * @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
62
+ */
63
+ export function getRegisteredTargetsFromResourceUrl(url, agentRef) {
64
+ if (!isValid(url, agentRef)) return [];
65
+ const registeredEntities = agentRef.runtime.registeredEntities;
66
+ const cleanedUrl = cleanURL(url);
67
+ const matches = registeredEntities?.filter(entity => {
68
+ const manifest = entity.metadata.target?.manifest;
69
+ if (manifest) {
70
+ // A manifest was supplied -- it is the sole source of truth for attribution. The caller-script fallback
71
+ // below never applies here, so e.g. a registrar script that calls register() on behalf of many MFEs (each
72
+ // with its own manifest naming only that MFE's own files) never has ITS OWN activity attributed just because
73
+ // it happened to be the one that called register().
74
+ return matchManifestAsset(manifest, url, {
75
+ scriptsOnly: false
76
+ });
77
+ }
78
+ // No manifest -- fall back to matching the resolved URL of whatever script called register().
79
+ return !!entity.metadata.timings?.asset && cleanURL(entity.metadata.timings.asset) === cleanedUrl;
80
+ });
81
+ return dedupeRegisteredEntitiesByAsset(matches).map(entity => entity.metadata.target);
82
+ }
83
+
50
84
  /**
51
85
  * Returns the registered target(s) associated with a given filename if found in the resource timing API during registration. Returns an empty array if no target is found.
52
86
  * Multiple registrations that resolve to the same underlying script asset AND represent the same logical MFE (i.e.
@@ -63,7 +97,18 @@ export function getRegisteredTargetsFromId(id, agentRef) {
63
97
  export function getRegisteredTargetsFromFilename(filename, agentRef) {
64
98
  if (!isValid(filename, agentRef)) return [];
65
99
  const registeredEntities = agentRef.runtime.registeredEntities;
66
- const matches = registeredEntities?.filter(entity => entity.metadata.timings?.asset?.endsWith(filename));
100
+ const matches = registeredEntities?.filter(entity => {
101
+ const manifest = entity.metadata.target?.manifest;
102
+ if (manifest) {
103
+ // See the identical case in getRegisteredTargetsFromResourceUrl above: once a manifest exists, it is the
104
+ // sole source of truth for attribution -- the caller-script fallback below never applies.
105
+ return matchManifestAsset(manifest, filename, {
106
+ scriptsOnly: true
107
+ });
108
+ }
109
+ // No manifest -- fall back to matching the resolved URL of whatever script called register().
110
+ return !!entity.metadata.timings?.asset?.endsWith(filename);
111
+ });
67
112
  return dedupeRegisteredEntitiesByAsset(matches).map(entity => entity.metadata.target);
68
113
  }
69
114
 
@@ -15,7 +15,8 @@ import { UserActionsAggregator } from './user-actions/user-actions-aggregator';
15
15
  import { isIFrameWindow } from '../../../common/dom/iframe';
16
16
  import { isPureObject } from '../../../common/util/type-check';
17
17
  import { EVENT_TYPES } from '../../../common/constants/events';
18
- import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate } from '../../../common/v2/utils';
18
+ import { getVersion2Attributes, getVersion2DuplicationAttributes, shouldDuplicate, getRegisteredTargetsFromResourceUrl } from '../../../common/v2/utils';
19
+ import { findCorrelation } from '../../../common/v2/script-tracker';
19
20
  export class Aggregate extends AggregateBase {
20
21
  static featureName = FEATURE_NAME;
21
22
  #userActionAggregator;
@@ -232,7 +233,33 @@ export class Aggregate extends AggregateBase {
232
233
  entryDuration: duration,
233
234
  firstParty
234
235
  };
235
- this.addEvent(event);
236
+ const targets = getRegisteredTargetsFromResourceUrl(name, this.agentRef);
237
+ if (targets.length) {
238
+ targets.forEach(target => this.addEvent({
239
+ ...event
240
+ }, target));
241
+ return;
242
+ }
243
+ this.addEvent({
244
+ ...event
245
+ }, undefined);
246
+
247
+ // This resource entry can resolve before a self-registering script has actually executed and called
248
+ // register() on itself (responseEnd fires before script parse/execution). If this URL belongs to a
249
+ // <script> we're tracking that hasn't finished loading yet, retry resolution once it has -- reporting
250
+ // a second (deliberately duplicate) copy under the real target if one shows up by then. One-shot,
251
+ // self-cleans via `once: true`, so there's nothing to leak if the script never registers.
252
+ const correlation = findCorrelation(cleanURL(name));
253
+ if (correlation?.dom.value && !correlation.dom.end) {
254
+ const retryAttribution = () => {
255
+ getRegisteredTargetsFromResourceUrl(name, this.agentRef).forEach(target => this.addEvent({
256
+ ...event
257
+ }, target));
258
+ };
259
+ ['load', 'error'].forEach(evtType => correlation.dom.value.addEventListener(evtType, retryAttribution, {
260
+ once: true
261
+ }));
262
+ }
236
263
  } catch (err) {
237
264
  this.ee.emit('internal-error', [err, 'GenericEvents-Resource']);
238
265
  }
@@ -17,6 +17,10 @@
17
17
  * @property {RegisterAPIMetadata} metadata - The metadata object containing the custom attributes and target information for the registered entity.
18
18
  */
19
19
 
20
+ /**
21
+ * @typedef {import('../../common/v2/manifest').AssetFile} AssetFile
22
+ */
23
+
20
24
  /**
21
25
  * @typedef {Object} RegisterAPIConstructor
22
26
  * @property {string} id - The unique id for the registered entity. This will be assigned to any synthesized entities.
@@ -24,6 +28,8 @@
24
28
  * @property {{[key: string]: any}} [tags] - The tags for the registered entity as key-value pairs. This will be assigned to any synthesized entities. Tags are converted to source.* attributes (e.g., {environment: 'production'} becomes source.environment: 'production').
25
29
  * @property {RegisterAPITarget} [parent] - The parent target for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
26
30
  * @property {string} [parentId] - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
31
+ * @property {{assets?: Array<AssetFile>}} [manifest] - An optional manifest describing the MFE's known assets (scripts, stylesheets, images, fonts, etc.) as `AssetFile` entries, used to improve the accuracy of event attribution (errors, logs, ajax, websockets), attribute `BrowserPerformance` resource events (any asset type, not just scripts) and, depending on `timingMethod`, MicroFrontEndTiming values. Each `AssetFile`'s script-capability is inferred from a `.js` suffix on a string `matcher` (a RegExp `matcher` is never inferred as a script), unless overridden via `type: 'script'` or explicitly disabled via `type: 'asset'`. An `AssetFile` with an invalid `matcher` or an unrecognized `type` is discarded/ignored (with a console warning) rather than applied. If omitted, the agent falls back to its existing behavior of only evaluating the script that called `register()` (resource attribution still applies to that script).
32
+ * @property {'entry'|'scripts'|'all'} [timingMethod] - Controls which manifest assets are used to calculate MicroFrontEndTiming values: 'entry' (the default) leaves timing based entirely on the script that called `register()`, unaffected by the manifest; 'scripts' widens the timing window across all script assets; 'all' widens it across every asset.
27
33
  */
28
34
 
29
35
  /**
@@ -39,18 +45,22 @@
39
45
  * @property {string} name - The name returned for the registered entity.
40
46
  * @property {{[key: string]: any}} [tags] - The tags for the registered entity as key-value pairs.
41
47
  * @property {string} [parentId] - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
48
+ * @property {import('../../common/v2/manifest').ParsedManifest} [manifest] - The parsed manifest for the registered entity, if one was supplied.
49
+ * @property {'entry'|'scripts'|'all'} [timingMethod] - The timing method supplied for the registered entity, if any.
42
50
  */
43
51
 
44
52
  /**
45
53
  * @typedef {Object} RegisterAPITimings
46
54
  * @property {number} registeredAt - The timestamp when the registered entity was created.
47
55
  * @property {number} [reportedAt] - The timestamp when the registered entity was deregistered.
48
- * @property {number} fetchStart - The timestamp when the registered entity began fetching (performance.start).
49
- * @property {number} fetchEnd - The timestamp when the registered entity finished fetching (performance.end).
50
- * @property {number} scriptStart - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start).
51
- * @property {number} scriptEnd - The timestamp when script loading completed (dom.end or registeredAt if no dom.end).
56
+ * @property {number} fetchStart - The timestamp when the registered entity began fetching (performance.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest fetchStart across all matched manifest assets.
57
+ * @property {number} fetchEnd - The timestamp when the registered entity finished fetching (performance.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest fetchEnd across all matched manifest assets.
58
+ * @property {number} scriptStart - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest scriptStart across all matched manifest script assets (non-script assets are excluded).
59
+ * @property {number} scriptEnd - The timestamp when script loading completed (dom.end or registeredAt if no dom.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest scriptEnd across all matched manifest script assets (non-script assets are excluded).
52
60
  * @property {Object} [asset] - The asset path (if found) for the registered entity.
53
61
  * @property {string} type - The type of timing associated with the registered entity, 'script' or 'link' if found with the performance resource API, 'fetch' for dynamic imports, 'inline' if found to be associated with the root document URL, or 'unknown' if no associated resource could be found.
62
+ * @property {number} totalWeight - The sum of `transferSize` (bytes) across every asset detected for the registered entity -- the entry script, plus, when a manifest is supplied, every matched manifest asset (script or non-script). Unlike fetchStart/fetchEnd/scriptStart/scriptEnd above, this is never gated behind `timingMethod` -- manifest assets contribute their bytes even at the 'entry' default/unset. Cross-origin assets without a Timing-Allow-Origin header report 0 bytes per the Resource Timing spec.
63
+ * @property {boolean} [renderBlocking] - True if any detected asset (entry script or matched manifest asset) has a `renderBlockingStatus` of 'blocking'; false if none were 'blocking' but at least one reported 'non-blocking'; left `undefined` if no detected asset reported the attribute at all (e.g. unsupported browser). A single 'blocking' asset always wins over any number of 'non-blocking' ones, regardless of resolution order.
54
64
  */
55
65
 
56
66
  /**
@@ -17,10 +17,12 @@ import { single } from '../../common/util/invoke';
17
17
  import { measure } from './measure';
18
18
  import { recordCustomEvent } from './recordCustomEvent';
19
19
  import { subscribeToPageUnload } from '../../common/window/page-visibility';
20
- import { findScriptTimings } from '../../common/v2/script-tracker';
20
+ import { findScriptTimings, applyManifestTimings } from '../../common/v2/script-tracker';
21
21
  import { trackMFEVitals } from '../../common/v2/mfe-vitals';
22
22
  import { generateRandomHexString } from '../../common/ids/unique-id';
23
+ import { parseManifest } from '../../common/v2/manifest';
23
24
  import { cleanURL } from '../../common/url/clean-url';
25
+ const TIMING_METHODS = ['entry', 'scripts', 'all'];
24
26
 
25
27
  /**
26
28
  * @typedef {import('./register-api-types').RegisterAPI} RegisterAPI
@@ -43,6 +45,7 @@ export const warnings = {
43
45
  disabled: single(() => warn(55)),
44
46
  invalidTarget: single(target => warn(48, target)),
45
47
  deregistered: single(() => warn(68)),
48
+ invalidTimingMethod: single(value => warn(80, value)),
46
49
  duplicateName: single(target => warn(81, target)),
47
50
  duplicateId: single(target => warn(82, target))
48
51
  };
@@ -80,9 +83,17 @@ function register(agentRef, target) {
80
83
  // getter because this is asynchronously set
81
84
  type: V2_TYPES.BA
82
85
  };
86
+ target.manifest = parseManifest(target.manifest);
87
+ if (target.timingMethod !== undefined && !TIMING_METHODS.includes(target.timingMethod)) {
88
+ warnings.invalidTimingMethod(target.timingMethod);
89
+ target.timingMethod = undefined;
90
+ }
83
91
 
84
92
  // The script timings for this entity, which will be used to populate part of the MicroFrontEndTiming custom event.
85
93
  const timings = findScriptTimings(target);
94
+ // Always applied when a manifest is present -- totalWeight/renderBlocking accumulate from manifest assets
95
+ // regardless of timingMethod; actual timing widening inside stays gated to 'scripts'/'all' (see applyManifestTimings).
96
+ if (target.manifest) applyManifestTimings(timings, target);
86
97
 
87
98
  // Track MFE vitals for this entity, which will be used to populate part of the MicroFrontEndTiming custom event.
88
99
  const vitals = trackMFEVitals(target, timings);
@@ -256,6 +267,12 @@ function register(agentRef, target) {
256
267
  // fetch time and script time together
257
268
  timeToRegister: timings.registeredAt,
258
269
  // timestamp when register() was called
270
+ totalWeight: timings.totalWeight,
271
+ // sum of transferSize bytes across every detected asset (entry script + matched manifest assets)
272
+ // renderBlocking: true if any detected asset was 'blocking', false if only 'non-blocking' assets were seen, omitted entirely if no detected asset reported the attribute at all
273
+ ...(timings.renderBlocking !== undefined && {
274
+ renderBlocking: timings.renderBlocking
275
+ }),
259
276
  // leave room to extend these with more data keys as needed
260
277
  ...(vitals.fcp.value >= 0 && {
261
278
  'vitals.fcp.value': vitals.fcp.value
@@ -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/events.js","../src/common/constants/iframe-constants.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/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.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/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.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/add-url.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/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.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/short-circuit.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/util/webdriver-detection.js","../src/common/v2/constants.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.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/load-time.js","../src/common/vitals/register-vital.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-logger.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/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/aggregate_v2/index.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/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/interfaces/registered-entity.js","../src/interfaces/registered-iframe-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/consent.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/iframe-message-handler.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/events.js","../src/common/constants/iframe-constants.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/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.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/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.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/add-url.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/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.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/short-circuit.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/util/webdriver-detection.js","../src/common/v2/constants.js","../src/common/v2/manifest.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker-types.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.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/load-time.js","../src/common/vitals/register-vital.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-logger.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/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/aggregate_v2/index.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/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/interfaces/registered-entity.js","../src/interfaces/registered-iframe-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/consent.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/iframe-message-handler.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"}
@@ -21,7 +21,7 @@ export type Init = {
21
21
  /**
22
22
  * - Controls when AJAX request/response payloads are captured. 'none' = never capture, 'failures' = capture only on errors (4xx, 5xx, network errors, GraphQL errors), 'all' = always capture.
23
23
  */
24
- capture_payloads?: "none" | "failures" | "all" | undefined;
24
+ capture_payloads?: "all" | "none" | "failures" | undefined;
25
25
  } | undefined;
26
26
  api?: {
27
27
  register?: {
@@ -85,6 +85,7 @@
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
+ * | 80 | An invalid manifest option was provided to register() and will be ignored. |
88
89
  * | 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
90
  * | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
90
91
  *
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @typedef {Object} ParsedManifestAsset
3
+ * @property {string|RegExp} pattern - the original matcher supplied by the customer
4
+ * @property {(url: string) => boolean} test - precompiled matcher against a resolved URL
5
+ * @property {boolean} isScript
6
+ */
7
+ /**
8
+ * @typedef {Object} ParsedManifest
9
+ * @property {ParsedManifestAsset[]} assets - all supplied assets
10
+ * @property {ParsedManifestAsset[]} scripts - the subset of assets inferred/declared as scripts (`.js`)
11
+ */
12
+ /**
13
+ * Parses a raw manifest supplied to `register()` into precompiled matcher closures. Parsing happens once, at
14
+ * registration time, so downstream event attribution (which runs on every ajax/error/log/websocket event) never has
15
+ * to re-derive matching logic from the raw customer input.
16
+ * @param {{assets?: Array<AssetFile>}} [rawManifest]
17
+ * @returns {ParsedManifest|undefined} undefined if no usable assets were supplied, so callers can cheaply skip all manifest logic
18
+ */
19
+ export function parseManifest(rawManifest?: {
20
+ assets?: Array<AssetFile>;
21
+ }): ParsedManifest | undefined;
22
+ /**
23
+ * Determines whether a resolved URL matches any asset in a parsed manifest.
24
+ * @param {ParsedManifest|undefined} parsed
25
+ * @param {string} url
26
+ * @param {{scriptsOnly?: boolean}} [options]
27
+ * @returns {boolean}
28
+ */
29
+ export function matchManifestAsset(parsed: ParsedManifest | undefined, url: string, { scriptsOnly }?: {
30
+ scriptsOnly?: boolean;
31
+ }): boolean;
32
+ export type ParsedManifestAsset = {
33
+ /**
34
+ * - the original matcher supplied by the customer
35
+ */
36
+ pattern: string | RegExp;
37
+ /**
38
+ * - precompiled matcher against a resolved URL
39
+ */
40
+ test: (url: string) => boolean;
41
+ isScript: boolean;
42
+ };
43
+ export type ParsedManifest = {
44
+ /**
45
+ * - all supplied assets
46
+ */
47
+ assets: ParsedManifestAsset[];
48
+ /**
49
+ * - the subset of assets inferred/declared as scripts (`.js`)
50
+ */
51
+ scripts: ParsedManifestAsset[];
52
+ };
53
+ export type AssetFile = {
54
+ /**
55
+ * - the path/path-fragment string, or RegExp, used to match a resolved URL against this asset
56
+ */
57
+ matcher: string | RegExp;
58
+ /**
59
+ * - optional override for script-capability inference. When omitted, script-capability is inferred from a
60
+ * `.js` suffix on a string `matcher` (a RegExp `matcher` is never inferred as a script). Supply `type: 'script'` to explicitly flag an entry
61
+ * as a script regardless of its matcher shape/suffix (e.g. an extensionless URL, or a RegExp targeting a script path), or `type: 'asset'` to
62
+ * explicitly flag it as non-script. Any other value is invalid, logs a warning, and is ignored (falls back to inference).
63
+ */
64
+ type?: "script" | "asset" | undefined;
65
+ };
66
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/manifest.js"],"names":[],"mappings":"AAsBA;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACH,4CAHW;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;CAAC,GACzB,cAAc,GAAC,SAAS,CASpC;AAiED;;;;;;GAMG;AACH,2CALW,cAAc,GAAC,SAAS,OACxB,MAAM,oBACN;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAC,GACrB,OAAO,CAMnB;;;;;aArGa,MAAM,GAAC,MAAM;;;;UACb,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO;cACxB,OAAO;;;;;;YAKP,mBAAmB,EAAE;;;;aACrB,mBAAmB,EAAE;;;;;;aArBrB,MAAM,GAAC,MAAM"}
@@ -0,0 +1,25 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ /**
4
+ * - Widens the live scriptStart/
5
+ * scriptEnd window with one manifest script asset's DOM correlation timing. `start`/`end` are that asset's
6
+ * `correlation.script.start`/`.end`, or falsy if not yet resolved. See `findScriptTimings`, which registers the
7
+ * concrete implementation, for the exact widening semantics (never shrinks either bound).
8
+ */
9
+ export type RecordManifestScriptWindowFn = (start: number, end: number) => void;
10
+ export type TimingsInternals = {
11
+ /**
12
+ * - Always present (seeded by `getOrCreateInternals`, see
13
+ * `script-tracker.js`). Cleaned URLs already folded into `timings.totalWeight`/`timings.renderBlocking` by
14
+ * `applyResourceWeight`, so the same underlying resource (e.g. a manifest asset that's also the .register calling
15
+ * script itself) is never counted twice.
16
+ */
17
+ weighedAssetUrls: Set<string>;
18
+ /**
19
+ * - Always present (seeded by
20
+ * `getOrCreateInternals`, see `script-tracker.js`). `findScriptTimings` overrides the seeded default with one that
21
+ * folds into the live `scriptStart`/`scriptEnd` getters instead.
22
+ */
23
+ recordManifestScriptWindow: RecordManifestScriptWindowFn;
24
+ };
25
+ //# sourceMappingURL=script-tracker-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-tracker-types.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker-types.js"],"names":[],"mappings":";;;;;;;;2CAMa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI;;;;;;;;sBAQnC,GAAG,CAAC,MAAM,CAAC;;;;;;gCAIX,4BAA4B"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Retrieves a script correlation by URL using exact matching. Exported so other features (e.g. generic_events'
3
+ * resource attribution) can key off the same DOM node/load-timing tracking this module already does for every
4
+ * `<script>` element, rather than setting up a second, redundant observer.
5
+ * @param {string} targetUrl - The URL to find
6
+ * @returns {ScriptCorrelation | undefined} - The correlation object if found
7
+ */
8
+ export function findCorrelation(targetUrl: string): ScriptCorrelation | undefined;
1
9
  /**
2
10
  * Extracts URLs from stack traces using the same logic as compute-stack-trace.js
3
11
  * @param {string} stack The error stack trace
@@ -10,20 +18,33 @@ export function extractUrlsFromStack(stack: string): string[];
10
18
  */
11
19
  export function getDeepStackTrace(): Error.stack | undefined;
12
20
  /**
13
- * Uses the stack of the initiator function, returns script timing information if a script can be found with the resource timing API matching the URL found in the stack.
14
- * @param {RegisterAPITarget} [target] - The MFE target being registered. Its id is used to scope stale-correlation detection per-MFE rather than per-script-URL, so one script registering multiple distinct MFEs doesn't misclassify a later MFE's registration as a stale reuse of an earlier one's.
21
+ * Applies a registered MFE's manifest to a timings object (already populated by `findScriptTimings`). No-op if no
22
+ * manifest is present. Weight/renderBlocking always accumulate from every detected manifest asset; timing widening
23
+ * (fetchStart/fetchEnd/scriptStart/scriptEnd/asset anchor) is opt-in via `timingMethod` -- see `applyManifestEntry`.
24
+ * @param {RegisterAPITimings} timings - the timings object to widen in place
25
+ * @param {RegisterAPITarget} target - the registered MFE target, which may carry a parsed `manifest`
26
+ */
27
+ export function applyManifestTimings(timings: RegisterAPITimings, target: RegisterAPITarget): void;
28
+ /**
29
+ * Uses the initiator function's stack to find script timing information via the resource timing API.
30
+ * @param {RegisterAPITarget} [target] - the MFE target being registered; its id scopes stale-correlation
31
+ * detection per-MFE rather than per-script-URL (see isCorrelationStale below)
15
32
  * @returns {RegisterAPITimings} Object containing script fetch start and end times, and the asset URL if found
16
33
  */
17
34
  export function findScriptTimings(target?: RegisterAPITarget): RegisterAPITimings;
18
35
  /**
19
- * @typedef {import('./register-api-types').RegisterAPITimings} RegisterAPITimings
36
+ * @typedef {import('../../loaders/api/register-api-types').RegisterAPITimings} RegisterAPITimings
20
37
  * @typedef {import('../../loaders/api/register-api-types').RegisterAPITarget} RegisterAPITarget
38
+ * @typedef {import('./script-tracker-types').RecordManifestScriptWindowFn} RecordManifestScriptWindowFn
39
+ * @typedef {import('./script-tracker-types').TimingsInternals} TimingsInternals
21
40
  */
22
41
  /** export for testing purposes */
23
42
  export let thisFile: any;
24
43
  /** @type {Map<string, ScriptCorrelation>} - Central registry for script correlations containing both DOM and Performance data */
25
44
  export const scriptCorrelations: Map<string, ScriptCorrelation>;
26
- export type RegisterAPITimings = any;
45
+ export type RegisterAPITimings = import("../../loaders/api/register-api-types").RegisterAPITimings;
27
46
  export type RegisterAPITarget = import("../../loaders/api/register-api-types").RegisterAPITarget;
47
+ export type RecordManifestScriptWindowFn = import("./script-tracker-types").RecordManifestScriptWindowFn;
48
+ export type TimingsInternals = import("./script-tracker-types").TimingsInternals;
28
49
  import { ScriptCorrelation } from './script-correlation';
29
50
  //# sourceMappingURL=script-tracker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"AAkHA;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED;;;GAGG;AACH,qCAFa,KAAK,CAAC,KAAK,GAAG,SAAS,CAanC;AAiED;;;;GAIG;AACH,2CAHW,iBAAiB,GACf,kBAAkB,CA0E9B;AA7RD;;;GAGG;AAEH,kCAAkC;AAClC,yBAAmB;AAUnB,iIAAiI;AACjI,iCADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACE;;gCAf9B,OAAO,sCAAsC,EAAE,iBAAiB;kCAN3C,sBAAsB"}
1
+ {"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"AAkEA;;;;;;GAMG;AACH,2CAHW,MAAM,GACJ,iBAAiB,GAAG,SAAS,CAIzC;AA6ED;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED;;;GAGG;AACH,qCAFa,KAAK,CAAC,KAAK,GAAG,SAAS,CAanC;AAwKD;;;;;;GAMG;AACH,8CAHW,kBAAkB,UAClB,iBAAiB,QAmB3B;AAED;;;;;GAKG;AACH,2CAJW,iBAAiB,GAEf,kBAAkB,CAkG9B;AA7dD;;;;;GAKG;AAEH,kCAAkC;AAClC,yBAAmB;AAUnB,iIAAiI;AACjI,iCADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACE;iCAlB9B,OAAO,sCAAsC,EAAE,kBAAkB;gCACjE,OAAO,sCAAsC,EAAE,iBAAiB;2CAChE,OAAO,wBAAwB,EAAE,4BAA4B;+BAC7D,OAAO,wBAAwB,EAAE,gBAAgB;kCAR5B,sBAAsB"}
@@ -25,6 +25,18 @@ export function getRegisteredEntityByIframeInterfaceId(iframeInterfaceId: string
25
25
  * @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
26
26
  */
27
27
  export function getRegisteredTargetsFromId(id: string | number, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
28
+ /**
29
+ * Returns the registered target(s) whose resource matches a given resource URL -- used to attribute `BrowserPerformance`
30
+ * (PerformanceResourceTiming) events, which never have a JS call stack to walk (they're fired for declarative
31
+ * `<script src>`/`<link>`/`<img>` tags, not JS execution), so stack-trace attribution (see {@link findTargetsFromStackTrace})
32
+ * doesn't apply. Unlike {@link getRegisteredTargetsFromFilename}, this matches manifest assets of ANY type (scripts,
33
+ * images, fonts, css, etc.) -- non-script assets can't produce a JS stack frame to match against, but they can and do
34
+ * produce their own resource timing entries. Returns an empty array if no target is found.
35
+ * @param {string} url - the resource's URL, as reported by the Performance API
36
+ * @param {*} agentRef
37
+ * @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
38
+ */
39
+ export function getRegisteredTargetsFromResourceUrl(url: string, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
28
40
  /**
29
41
  * Returns the registered target(s) associated with a given filename if found in the resource timing API during registration. Returns an empty array if no target is found.
30
42
  * Multiple registrations that resolve to the same underlying script asset AND represent the same logical MFE (i.e.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AAEH;;;;GAIG;AACH,oCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;GAKG;AACH,0EAJW,MAAM,YACN,GAAC,GACC,OAAO,sCAAsC,EAAE,WAAW,GAAC,SAAS,CAMhF;AAED;;;;;GAKG;AACH,+CAJW,MAAM,GAAC,MAAM,YACb,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAMpF;AAED;;;;;;;;;;;;GAYG;AACH,2DAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAOpF;AAED;;;;;;;;;;;;GAYG;AACH,wEA6BC;AAED;;;;;;;GAOG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,yDAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,wCAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,OAAO,CAInB;AAED;;;;GAIG;AACH,oDAHW,GAAC,SAqBX;AAED;;;;;;;GAOG;AACH,+DAUC;;;;;UA1La,IAAI;;;;cACJ,MAAM;;;;;;;;gBAEN;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AAEH;;;;GAIG;AACH,oCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;GAKG;AACH,0EAJW,MAAM,YACN,GAAC,GACC,OAAO,sCAAsC,EAAE,WAAW,GAAC,SAAS,CAMhF;AAED;;;;;GAKG;AACH,+CAJW,MAAM,GAAC,MAAM,YACb,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAMpF;AAED;;;;;;;;;;GAUG;AACH,yDAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAmBpF;AAED;;;;;;;;;;;;GAYG;AACH,2DAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAgBpF;AAED;;;;;;;;;;;;GAYG;AACH,wEA6BC;AAED;;;;;;;GAOG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,yDAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,wCAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,OAAO,CAInB;AAED;;;;GAIG;AACH,oDAHW,GAAC,SAqBX;AAED;;;;;;;GAOG;AACH,+DAUC;;;;;UAjOa,IAAI;;;;cACJ,MAAM;;;;;;;;gBAEN;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAmBA;IACE,2BAAiC;IAGjC,2BA+QC;IA7QC,gCAAkG;IAIlG,uBAA0C;IA4Q5C;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,WACP,MAAM,YAAC,QAkCjB;IAED,6CAEC;IAED;;;MAEC;;CAsBF;8BA3W6B,4BAA4B;2BAI/B,gCAAgC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IAGjC,2BAkSC;IAhSC,gCAAkG;IAIlG,uBAA0C;IA+R5C;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,WACP,MAAM,YAAC,QAkCjB;IAED,6CAEC;IAED;;;MAEC;;CAsBF;8BA/X6B,4BAA4B;2BAI/B,gCAAgC"}
@@ -54,6 +54,7 @@ export type RegisterAPI = {
54
54
  */
55
55
  metadata: RegisterAPIMetadata;
56
56
  };
57
+ export type AssetFile = import("../../common/v2/manifest").AssetFile;
57
58
  export type RegisterAPIConstructor = {
58
59
  /**
59
60
  * - The unique id for the registered entity. This will be assigned to any synthesized entities.
@@ -77,6 +78,16 @@ export type RegisterAPIConstructor = {
77
78
  * - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
78
79
  */
79
80
  parentId?: string | undefined;
81
+ /**
82
+ * - An optional manifest describing the MFE's known assets (scripts, stylesheets, images, fonts, etc.) as `AssetFile` entries, used to improve the accuracy of event attribution (errors, logs, ajax, websockets), attribute `BrowserPerformance` resource events (any asset type, not just scripts) and, depending on `timingMethod`, MicroFrontEndTiming values. Each `AssetFile`'s script-capability is inferred from a `.js` suffix on a string `matcher` (a RegExp `matcher` is never inferred as a script), unless overridden via `type: 'script'` or explicitly disabled via `type: 'asset'`. An `AssetFile` with an invalid `matcher` or an unrecognized `type` is discarded/ignored (with a console warning) rather than applied. If omitted, the agent falls back to its existing behavior of only evaluating the script that called `register()` (resource attribution still applies to that script).
83
+ */
84
+ manifest?: {
85
+ assets?: Array<AssetFile>;
86
+ } | undefined;
87
+ /**
88
+ * - Controls which manifest assets are used to calculate MicroFrontEndTiming values: 'entry' (the default) leaves timing based entirely on the script that called `register()`, unaffected by the manifest; 'scripts' widens the timing window across all script assets; 'all' widens it across every asset.
89
+ */
90
+ timingMethod?: "scripts" | "entry" | "all" | undefined;
80
91
  };
81
92
  export type RegisterAPIMetadata = {
82
93
  /**
@@ -111,6 +122,14 @@ export type RegisterAPITarget = {
111
122
  * - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
112
123
  */
113
124
  parentId?: string | undefined;
125
+ /**
126
+ * - The parsed manifest for the registered entity, if one was supplied.
127
+ */
128
+ manifest?: import("../../common/v2/manifest").ParsedManifest | undefined;
129
+ /**
130
+ * - The timing method supplied for the registered entity, if any.
131
+ */
132
+ timingMethod?: "scripts" | "entry" | "all" | undefined;
114
133
  };
115
134
  export type RegisterAPITimings = {
116
135
  /**
@@ -122,19 +141,19 @@ export type RegisterAPITimings = {
122
141
  */
123
142
  reportedAt?: number | undefined;
124
143
  /**
125
- * - The timestamp when the registered entity began fetching (performance.start).
144
+ * - The timestamp when the registered entity began fetching (performance.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest fetchStart across all matched manifest assets.
126
145
  */
127
146
  fetchStart: number;
128
147
  /**
129
- * - The timestamp when the registered entity finished fetching (performance.end).
148
+ * - The timestamp when the registered entity finished fetching (performance.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest fetchEnd across all matched manifest assets.
130
149
  */
131
150
  fetchEnd: number;
132
151
  /**
133
- * - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start).
152
+ * - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest scriptStart across all matched manifest script assets (non-script assets are excluded).
134
153
  */
135
154
  scriptStart: number;
136
155
  /**
137
- * - The timestamp when script loading completed (dom.end or registeredAt if no dom.end).
156
+ * - The timestamp when script loading completed (dom.end or registeredAt if no dom.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest scriptEnd across all matched manifest script assets (non-script assets are excluded).
138
157
  */
139
158
  scriptEnd: number;
140
159
  /**
@@ -145,6 +164,14 @@ export type RegisterAPITimings = {
145
164
  * - The type of timing associated with the registered entity, 'script' or 'link' if found with the performance resource API, 'fetch' for dynamic imports, 'inline' if found to be associated with the root document URL, or 'unknown' if no associated resource could be found.
146
165
  */
147
166
  type: string;
167
+ /**
168
+ * - The sum of `transferSize` (bytes) across every asset detected for the registered entity -- the entry script, plus, when a manifest is supplied, every matched manifest asset (script or non-script). Unlike fetchStart/fetchEnd/scriptStart/scriptEnd above, this is never gated behind `timingMethod` -- manifest assets contribute their bytes even at the 'entry' default/unset. Cross-origin assets without a Timing-Allow-Origin header report 0 bytes per the Resource Timing spec.
169
+ */
170
+ totalWeight: number;
171
+ /**
172
+ * - True if any detected asset (entry script or matched manifest asset) has a `renderBlockingStatus` of 'blocking'; false if none were 'blocking' but at least one reported 'non-blocking'; left `undefined` if no detected asset reported the attribute at all (e.g. unsupported browser). A single 'blocking' asset always wins over any number of 'non-blocking' ones, regardless of resolution order.
173
+ */
174
+ renderBlocking?: boolean | undefined;
148
175
  };
149
176
  export type RegisterAPIVitals = {
150
177
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;mBAOc,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;SAC3C,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;KAAC,KAAK,IAAI;;;;iBACxH,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,KAAK,IAAI;;;;gBAC1D,MAAM,IAAI;;;;uBACV,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;aAChD,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAAC;;;;2BACtM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;;;;wBAC9B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI;;;;eAClF,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI;;;;cACtD,mBAAmB;;;;;;QAKnB,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;;;;;;sBAQN,MAAM;;;;aACN,OAAO,CAAC,kBAAkB,CAAC;;;;YAC3B,OAAO,CAAC,iBAAiB,CAAC;;;;;;QAK1B,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;;kBAON,MAAM;;;;;;;;gBAEN,MAAM;;;;cACN,MAAM;;;;iBACN,MAAM;;;;eACN,MAAM;;;;;;;;UAEN,MAAM"}
1
+ {"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;mBAOc,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;SAC3C,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;KAAC,KAAK,IAAI;;;;iBACxH,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,KAAK,IAAI;;;;gBAC1D,MAAM,IAAI;;;;uBACV,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;aAChD,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAAC;;;;2BACtM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;;;;wBAC9B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI;;;;eAClF,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI;;;;cACtD,mBAAmB;;wBAIpB,OAAO,0BAA0B,EAAE,SAAS;;;;;QAK3C,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;;;;;iBAII,KAAK,CAAC,SAAS,CAAC;;;;;;;;;;;sBAM1B,MAAM;;;;aACN,OAAO,CAAC,kBAAkB,CAAC;;;;YAC3B,OAAO,CAAC,iBAAiB,CAAC;;;;;;QAK1B,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;kBASN,MAAM;;;;;;;;gBAEN,MAAM;;;;cACN,MAAM;;;;iBACN,MAAM;;;;eACN,MAAM;;;;;;;;UAEN,MAAM;;;;iBACN,MAAM"}
@@ -9,6 +9,7 @@ export namespace warnings {
9
9
  let disabled: Function;
10
10
  let invalidTarget: Function;
11
11
  let deregistered: Function;
12
+ let invalidTimingMethod: Function;
12
13
  let duplicateName: Function;
13
14
  let duplicateId: Function;
14
15
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AA2DA;;;;GAIG;AACH,mDAIC;;;;;;;;;;0BAxCY,OAAO,sBAAsB,EAAE,WAAW"}