@newrelic/browser-agent 0.0.9 → 0.1.230
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.
- package/README.md +113 -197
- package/dist/cjs/cdn/lite.js +14 -0
- package/dist/cjs/cdn/polyfills/lite.js +4 -0
- package/dist/cjs/cdn/polyfills/pro.js +4 -0
- package/dist/cjs/cdn/polyfills/spa.js +4 -0
- package/dist/cjs/cdn/polyfills.js +14 -0
- package/dist/cjs/cdn/pro.js +19 -0
- package/dist/cjs/cdn/spa.js +19 -0
- package/dist/cjs/cdn/worker.js +16 -0
- package/dist/cjs/common/aggregate/aggregator.js +168 -0
- package/dist/cjs/common/browser-version/firefox-version.js +17 -0
- package/dist/cjs/common/browser-version/ios-version.js +18 -0
- package/dist/cjs/common/config/config.js +76 -0
- package/dist/cjs/common/config/state/configurable.js +33 -0
- package/dist/cjs/common/config/state/info.js +50 -0
- package/dist/cjs/common/config/state/init.js +86 -0
- package/dist/cjs/common/config/state/loader-config.js +28 -0
- package/dist/cjs/common/config/state/originals.js +9 -0
- package/dist/cjs/common/config/state/runtime.js +51 -0
- package/dist/cjs/common/constants/environment-variables.js +20 -0
- package/dist/cjs/common/context/shared-context.js +26 -0
- package/dist/cjs/common/deny-list/deny-list.js +108 -0
- package/dist/cjs/common/drain/drain.js +132 -0
- package/dist/cjs/common/event-emitter/contextual-ee.js +149 -0
- package/dist/cjs/common/event-emitter/handle.js +24 -0
- package/dist/cjs/common/event-emitter/register-handler.js +24 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +48 -0
- package/dist/cjs/common/harvest/harvest-scheduler.js +112 -0
- package/dist/cjs/common/harvest/harvest.js +247 -0
- package/dist/cjs/common/ids/id.js +30 -0
- package/dist/cjs/common/ids/unique-id.js +84 -0
- package/dist/cjs/common/metrics/framework-detection.js +72 -0
- package/dist/cjs/common/metrics/paint-metrics.js +13 -0
- package/dist/cjs/common/serialize/bel-serializer.js +89 -0
- package/dist/cjs/common/timing/nav-timing.js +77 -0
- package/dist/cjs/common/timing/now.js +15 -0
- package/dist/cjs/common/unload/eol.js +69 -0
- package/dist/cjs/common/url/clean-url.js +16 -0
- package/dist/cjs/common/url/encode.js +79 -0
- package/dist/cjs/common/url/location.js +14 -0
- package/dist/cjs/common/url/parse-url.js +66 -0
- package/dist/cjs/common/url/protocol.js +25 -0
- package/dist/cjs/common/util/console.js +17 -0
- package/dist/cjs/common/util/data-size.js +25 -0
- package/dist/cjs/common/util/feature-flags.js +42 -0
- package/dist/cjs/common/util/get-or-set.js +39 -0
- package/dist/cjs/common/util/global-scope.js +56 -0
- package/dist/cjs/common/util/map-own.js +31 -0
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +76 -0
- package/dist/cjs/common/util/s-hash.js +19 -0
- package/dist/cjs/common/util/single.js +23 -0
- package/dist/cjs/common/util/stringify.js +47 -0
- package/dist/cjs/common/util/submit-data.js +107 -0
- package/dist/cjs/common/util/traverse.js +41 -0
- package/dist/cjs/common/util/user-agent.js +57 -0
- package/dist/cjs/common/window/load.js +19 -0
- package/dist/cjs/common/window/nreum.js +107 -0
- package/dist/cjs/common/window/page-visibility.js +29 -0
- package/dist/cjs/common/window/session-storage.js +87 -0
- package/dist/cjs/common/window/supports-performance-observer.js +15 -0
- package/dist/cjs/common/wrap/index.js +75 -0
- package/dist/cjs/common/wrap/wrap-console.js +54 -0
- package/dist/cjs/common/wrap/wrap-events.js +108 -0
- package/dist/cjs/common/wrap/wrap-fetch.js +112 -0
- package/dist/cjs/common/wrap/wrap-function.js +255 -0
- package/dist/cjs/common/wrap/wrap-history.js +56 -0
- package/dist/cjs/common/wrap/wrap-jsonp.js +129 -0
- package/dist/cjs/common/wrap/wrap-mutation.js +61 -0
- package/dist/cjs/common/wrap/wrap-promise.js +163 -0
- package/dist/cjs/common/wrap/wrap-raf.js +55 -0
- package/dist/cjs/common/wrap/wrap-timer.js +70 -0
- package/dist/cjs/common/wrap/wrap-xhr.js +206 -0
- package/dist/cjs/features/ajax/aggregate/index.js +226 -0
- package/dist/cjs/features/ajax/constants.js +9 -0
- package/dist/cjs/features/ajax/index.js +12 -0
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +145 -0
- package/dist/cjs/features/ajax/instrument/index.js +339 -0
- package/dist/cjs/features/ajax/instrument/response-size.js +26 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +18 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +31 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +215 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +257 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.js +36 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +40 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +288 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.js +23 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +27 -0
- package/dist/cjs/features/jserrors/constants.js +11 -0
- package/dist/cjs/features/jserrors/index.js +12 -0
- package/dist/cjs/features/jserrors/instrument/debug.js +40 -0
- package/dist/cjs/features/jserrors/instrument/index.js +155 -0
- package/dist/cjs/features/metrics/aggregate/index.js +147 -0
- package/dist/cjs/features/metrics/constants.js +17 -0
- package/dist/cjs/features/metrics/index.js +12 -0
- package/dist/cjs/features/metrics/instrument/index.js +46 -0
- package/dist/cjs/features/metrics/instrument/workers-helper.js +124 -0
- package/dist/cjs/features/page_action/aggregate/index.js +120 -0
- package/dist/cjs/features/page_action/constants.js +9 -0
- package/dist/cjs/features/page_action/index.js +12 -0
- package/dist/cjs/features/page_action/instrument/index.js +22 -0
- package/dist/cjs/features/page_view_event/aggregate/index.js +137 -0
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +39 -0
- package/dist/cjs/features/page_view_event/constants.js +15 -0
- package/dist/cjs/features/page_view_event/index.js +12 -0
- package/dist/cjs/features/page_view_event/instrument/index.js +39 -0
- package/dist/cjs/features/page_view_timing/aggregate/index.js +284 -0
- package/dist/cjs/features/page_view_timing/constants.js +9 -0
- package/dist/cjs/features/page_view_timing/first-paint.js +50 -0
- package/dist/cjs/features/page_view_timing/index.js +12 -0
- package/dist/cjs/features/page_view_timing/instrument/index.js +37 -0
- package/dist/cjs/features/page_view_timing/long-tasks.js +75 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +415 -0
- package/dist/cjs/features/session_trace/constants.js +32 -0
- package/dist/cjs/features/session_trace/index.js +12 -0
- package/dist/cjs/features/session_trace/instrument/index.js +134 -0
- package/dist/cjs/features/spa/aggregate/index.js +684 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.js +84 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.test.js +16 -0
- package/dist/cjs/features/spa/aggregate/interaction.js +98 -0
- package/dist/cjs/features/spa/aggregate/serializer.js +147 -0
- package/dist/cjs/features/spa/constants.js +53 -0
- package/dist/cjs/features/spa/index.js +12 -0
- package/dist/cjs/features/spa/instrument/index.js +115 -0
- package/dist/cjs/features/utils/aggregate-base.js +13 -0
- package/dist/cjs/features/utils/feature-base.js +58 -0
- package/dist/cjs/features/utils/handler-cache.js +64 -0
- package/dist/cjs/features/utils/instrument-base.js +72 -0
- package/dist/cjs/features/utils/lazy-loader.js +44 -0
- package/dist/cjs/index.js +81 -58
- package/dist/cjs/loaders/agent.js +87 -0
- package/dist/cjs/loaders/api/api.js +174 -0
- package/dist/cjs/loaders/api/apiAsync.js +94 -0
- package/dist/cjs/loaders/browser-agent.js +29 -0
- package/dist/cjs/loaders/configure/configure.js +53 -0
- package/dist/cjs/loaders/features/enabled-features.js +19 -0
- package/dist/cjs/loaders/features/featureDependencies.js +32 -0
- package/dist/cjs/loaders/features/features.js +33 -0
- package/dist/cjs/loaders/micro-agent.js +98 -0
- package/dist/cjs/loaders/worker-agent.js +24 -0
- package/dist/esm/cdn/lite.js +12 -0
- package/dist/esm/cdn/polyfills/lite.js +7 -0
- package/dist/esm/cdn/polyfills/pro.js +7 -0
- package/dist/esm/cdn/polyfills/spa.js +7 -0
- package/dist/esm/cdn/polyfills.js +17 -0
- package/dist/esm/cdn/pro.js +17 -0
- package/dist/esm/cdn/spa.js +17 -0
- package/dist/esm/cdn/worker.js +14 -0
- package/dist/esm/common/aggregate/aggregator.js +161 -0
- package/dist/esm/common/browser-version/firefox-version.js +10 -0
- package/dist/esm/common/browser-version/ios-version.js +10 -0
- package/dist/esm/common/config/config.js +11 -0
- package/dist/esm/common/config/state/configurable.js +26 -0
- package/dist/esm/common/config/state/info.js +42 -0
- package/dist/esm/common/config/state/init.js +78 -0
- package/dist/esm/common/config/state/loader-config.js +21 -0
- package/dist/esm/common/config/state/originals.js +2 -0
- package/dist/esm/common/config/state/runtime.js +42 -0
- package/dist/esm/common/constants/environment-variables.js +11 -0
- package/dist/esm/common/context/shared-context.js +19 -0
- package/dist/esm/common/deny-list/deny-list.js +101 -0
- package/dist/esm/common/drain/drain.js +125 -0
- package/dist/esm/common/event-emitter/contextual-ee.js +142 -0
- package/dist/esm/common/event-emitter/handle.js +16 -0
- package/dist/esm/common/event-emitter/register-handler.js +19 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +41 -0
- package/dist/esm/common/harvest/harvest-scheduler.js +106 -0
- package/dist/esm/common/harvest/harvest.js +239 -0
- package/dist/esm/common/ids/id.js +23 -0
- package/dist/esm/common/ids/unique-id.js +75 -0
- package/dist/esm/common/metrics/framework-detection.js +66 -0
- package/dist/esm/common/metrics/paint-metrics.js +6 -0
- package/dist/esm/common/serialize/bel-serializer.js +80 -0
- package/dist/esm/common/timing/nav-timing.js +67 -0
- package/dist/esm/common/timing/now.js +9 -0
- package/dist/esm/common/unload/eol.js +62 -0
- package/dist/esm/common/url/clean-url.js +10 -0
- package/dist/esm/common/url/encode.js +71 -0
- package/dist/esm/common/url/location.js +8 -0
- package/dist/esm/common/url/parse-url.js +60 -0
- package/dist/esm/common/url/protocol.js +17 -0
- package/dist/esm/common/util/console.js +11 -0
- package/dist/esm/common/util/data-size.js +19 -0
- package/dist/esm/common/util/feature-flags.js +33 -0
- package/dist/esm/common/util/get-or-set.js +33 -0
- package/dist/esm/common/util/global-scope.js +44 -0
- package/dist/esm/common/util/map-own.js +24 -0
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +67 -0
- package/dist/esm/common/util/s-hash.js +13 -0
- package/dist/esm/common/util/single.js +16 -0
- package/dist/esm/common/util/stringify.js +42 -0
- package/dist/esm/common/util/submit-data.js +99 -0
- package/dist/esm/common/util/traverse.js +35 -0
- package/dist/esm/common/util/user-agent.js +48 -0
- package/dist/esm/common/window/load.js +12 -0
- package/dist/esm/common/window/nreum.js +91 -0
- package/dist/esm/common/window/page-visibility.js +24 -0
- package/dist/esm/common/window/session-storage.js +77 -0
- package/dist/esm/common/window/supports-performance-observer.js +9 -0
- package/dist/esm/common/wrap/index.js +15 -0
- package/dist/esm/common/wrap/wrap-console.js +46 -0
- package/dist/esm/common/wrap/wrap-events.js +100 -0
- package/dist/esm/common/wrap/wrap-fetch.js +103 -0
- package/dist/esm/common/wrap/wrap-function.js +244 -0
- package/dist/esm/common/wrap/wrap-history.js +48 -0
- package/dist/esm/common/wrap/wrap-jsonp.js +122 -0
- package/dist/esm/common/wrap/wrap-mutation.js +54 -0
- package/dist/esm/common/wrap/wrap-promise.js +156 -0
- package/dist/esm/common/wrap/wrap-raf.js +48 -0
- package/dist/esm/common/wrap/wrap-timer.js +63 -0
- package/dist/esm/common/wrap/wrap-xhr.js +199 -0
- package/dist/esm/features/ajax/aggregate/index.js +218 -0
- package/dist/esm/features/ajax/constants.js +2 -0
- package/dist/esm/features/ajax/index.js +1 -0
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +137 -0
- package/dist/esm/features/ajax/instrument/index.js +331 -0
- package/dist/esm/features/ajax/instrument/response-size.js +19 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +29 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +208 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +255 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.js +29 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +38 -0
- package/dist/esm/features/jserrors/aggregate/index.js +281 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +25 -0
- package/dist/esm/features/jserrors/constants.js +3 -0
- package/dist/esm/features/jserrors/index.js +1 -0
- package/dist/esm/features/jserrors/instrument/debug.js +38 -0
- package/dist/esm/features/jserrors/instrument/index.js +147 -0
- package/dist/esm/features/metrics/aggregate/index.js +140 -0
- package/dist/esm/features/metrics/constants.js +6 -0
- package/dist/esm/features/metrics/index.js +1 -0
- package/dist/esm/features/metrics/instrument/index.js +39 -0
- package/dist/esm/features/metrics/instrument/workers-helper.js +119 -0
- package/dist/esm/features/page_action/aggregate/index.js +113 -0
- package/dist/esm/features/page_action/constants.js +2 -0
- package/dist/esm/features/page_action/index.js +1 -0
- package/dist/esm/features/page_action/instrument/index.js +15 -0
- package/dist/esm/features/page_view_event/aggregate/index.js +128 -0
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +34 -0
- package/dist/esm/features/page_view_event/constants.js +5 -0
- package/dist/esm/features/page_view_event/index.js +1 -0
- package/dist/esm/features/page_view_event/instrument/index.js +30 -0
- package/dist/esm/features/page_view_timing/aggregate/index.js +277 -0
- package/dist/esm/features/page_view_timing/constants.js +2 -0
- package/dist/esm/features/page_view_timing/first-paint.js +43 -0
- package/dist/esm/features/page_view_timing/index.js +1 -0
- package/dist/esm/features/page_view_timing/instrument/index.js +29 -0
- package/dist/esm/features/page_view_timing/long-tasks.js +69 -0
- package/dist/esm/features/session_trace/aggregate/index.js +406 -0
- package/dist/esm/features/session_trace/constants.js +14 -0
- package/dist/esm/features/session_trace/index.js +1 -0
- package/dist/esm/features/session_trace/instrument/index.js +124 -0
- package/dist/esm/features/spa/aggregate/index.js +674 -0
- package/dist/esm/features/spa/aggregate/interaction-node.js +78 -0
- package/dist/esm/features/spa/aggregate/interaction-node.test.js +14 -0
- package/dist/esm/features/spa/aggregate/interaction.js +92 -0
- package/dist/esm/features/spa/aggregate/serializer.js +139 -0
- package/dist/esm/features/spa/constants.js +25 -0
- package/dist/esm/features/spa/index.js +1 -0
- package/dist/esm/features/spa/instrument/index.js +105 -0
- package/dist/esm/features/utils/aggregate-base.js +6 -0
- package/dist/esm/features/utils/feature-base.js +51 -0
- package/dist/esm/features/utils/handler-cache.js +57 -0
- package/dist/esm/features/utils/instrument-base.js +70 -0
- package/dist/esm/features/utils/lazy-loader.js +37 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/loaders/agent.js +78 -0
- package/dist/esm/loaders/api/api.js +168 -0
- package/dist/esm/loaders/api/apiAsync.js +88 -0
- package/dist/esm/loaders/browser-agent.js +23 -0
- package/dist/esm/loaders/configure/configure.js +47 -0
- package/dist/esm/loaders/features/enabled-features.js +13 -0
- package/dist/esm/loaders/features/featureDependencies.js +25 -0
- package/dist/esm/loaders/features/features.js +25 -0
- package/dist/esm/loaders/micro-agent.js +91 -0
- package/dist/esm/loaders/worker-agent.js +18 -0
- package/dist/types/cdn/lite.d.ts +2 -0
- package/dist/types/cdn/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/lite.d.ts +2 -0
- package/dist/types/cdn/polyfills/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/pro.d.ts +2 -0
- package/dist/types/cdn/polyfills/pro.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/spa.d.ts +2 -0
- package/dist/types/cdn/polyfills/spa.d.ts.map +1 -0
- package/dist/types/cdn/polyfills.d.ts +2 -0
- package/dist/types/cdn/polyfills.d.ts.map +1 -0
- package/dist/types/cdn/pro.d.ts +2 -0
- package/dist/types/cdn/pro.d.ts.map +1 -0
- package/dist/types/cdn/spa.d.ts +2 -0
- package/dist/types/cdn/spa.d.ts.map +1 -0
- package/dist/types/cdn/worker.d.ts +2 -0
- package/dist/types/cdn/worker.d.ts.map +1 -0
- package/dist/types/common/aggregate/aggregator.d.ts +11 -0
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -0
- package/dist/types/common/browser-version/firefox-version.d.ts +2 -0
- package/dist/types/common/browser-version/firefox-version.d.ts.map +1 -0
- package/dist/types/common/browser-version/ios-version.d.ts +3 -0
- package/dist/types/common/browser-version/ios-version.d.ts.map +1 -0
- package/dist/types/common/config/config.d.ts +13 -0
- package/dist/types/common/config/config.d.ts.map +1 -0
- package/dist/types/common/config/state/configurable.d.ts +4 -0
- package/dist/types/common/config/state/configurable.d.ts.map +1 -0
- package/dist/types/common/config/state/info.d.ts +4 -0
- package/dist/types/common/config/state/info.d.ts.map +1 -0
- package/dist/types/common/config/state/init.d.ts +4 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -0
- package/dist/types/common/config/state/loader-config.d.ts +3 -0
- package/dist/types/common/config/state/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/state/originals.d.ts +2 -0
- package/dist/types/common/config/state/originals.d.ts.map +1 -0
- package/dist/types/common/config/state/runtime.d.ts +3 -0
- package/dist/types/common/config/state/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/environment-variables.d.ts +4 -0
- package/dist/types/common/constants/environment-variables.d.ts.map +1 -0
- package/dist/types/common/context/shared-context.d.ts +5 -0
- package/dist/types/common/context/shared-context.d.ts.map +1 -0
- package/dist/types/common/deny-list/deny-list.d.ts +12 -0
- package/dist/types/common/deny-list/deny-list.d.ts.map +1 -0
- package/dist/types/common/drain/drain.d.ts +17 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts +4 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -0
- package/dist/types/common/event-emitter/handle.d.ts +3 -0
- package/dist/types/common/event-emitter/handle.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +8 -0
- package/dist/types/common/event-emitter/register-handler.d.ts.map +1 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts +10 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts +21 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest.d.ts +58 -0
- package/dist/types/common/harvest/harvest.d.ts.map +1 -0
- package/dist/types/common/ids/id.d.ts +2 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +5 -0
- package/dist/types/common/ids/unique-id.d.ts.map +1 -0
- package/dist/types/common/metrics/framework-detection.d.ts +2 -0
- package/dist/types/common/metrics/framework-detection.d.ts.map +1 -0
- package/dist/types/common/metrics/paint-metrics.d.ts +2 -0
- package/dist/types/common/metrics/paint-metrics.d.ts.map +1 -0
- package/dist/types/common/serialize/bel-serializer.d.ts +5 -0
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -0
- package/dist/types/common/timing/nav-timing.d.ts +5 -0
- package/dist/types/common/timing/nav-timing.d.ts.map +1 -0
- package/dist/types/common/timing/now.d.ts +2 -0
- package/dist/types/common/timing/now.d.ts.map +1 -0
- package/dist/types/common/unload/eol.d.ts +8 -0
- package/dist/types/common/unload/eol.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +2 -0
- package/dist/types/common/url/clean-url.d.ts.map +1 -0
- package/dist/types/common/url/encode.d.ts +5 -0
- package/dist/types/common/url/encode.d.ts.map +1 -0
- package/dist/types/common/url/location.d.ts +2 -0
- package/dist/types/common/url/location.d.ts.map +1 -0
- package/dist/types/common/url/parse-url.d.ts +2 -0
- package/dist/types/common/url/parse-url.d.ts.map +1 -0
- package/dist/types/common/url/protocol.d.ts +7 -0
- package/dist/types/common/url/protocol.d.ts.map +1 -0
- package/dist/types/common/util/console.d.ts +8 -0
- package/dist/types/common/util/console.d.ts.map +1 -0
- package/dist/types/common/util/data-size.d.ts +2 -0
- package/dist/types/common/util/data-size.d.ts.map +1 -0
- package/dist/types/common/util/feature-flags.d.ts +3 -0
- package/dist/types/common/util/feature-flags.d.ts.map +1 -0
- package/dist/types/common/util/get-or-set.d.ts +2 -0
- package/dist/types/common/util/get-or-set.d.ts.map +1 -0
- package/dist/types/common/util/global-scope.d.ts +13 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -0
- package/dist/types/common/util/map-own.d.ts +3 -0
- package/dist/types/common/util/map-own.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts +8 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -0
- package/dist/types/common/util/s-hash.d.ts +2 -0
- package/dist/types/common/util/s-hash.d.ts.map +1 -0
- package/dist/types/common/util/single.d.ts +2 -0
- package/dist/types/common/util/single.d.ts.map +1 -0
- package/dist/types/common/util/stringify.d.ts +8 -0
- package/dist/types/common/util/stringify.d.ts.map +1 -0
- package/dist/types/common/util/submit-data.d.ts +35 -0
- package/dist/types/common/util/submit-data.d.ts.map +1 -0
- package/dist/types/common/util/traverse.d.ts +2 -0
- package/dist/types/common/util/traverse.d.ts.map +1 -0
- package/dist/types/common/util/user-agent.d.ts +5 -0
- package/dist/types/common/util/user-agent.d.ts.map +1 -0
- package/dist/types/common/window/load.d.ts +3 -0
- package/dist/types/common/window/load.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts +14 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -0
- package/dist/types/common/window/page-visibility.d.ts +7 -0
- package/dist/types/common/window/page-visibility.d.ts.map +1 -0
- package/dist/types/common/window/session-storage.d.ts +18 -0
- package/dist/types/common/window/session-storage.d.ts.map +1 -0
- package/dist/types/common/window/supports-performance-observer.d.ts +2 -0
- package/dist/types/common/window/supports-performance-observer.d.ts.map +1 -0
- package/dist/types/common/wrap/index.d.ts +12 -0
- package/dist/types/common/wrap/index.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-console.d.ts +16 -0
- package/dist/types/common/wrap/wrap-console.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-events.d.ts +17 -0
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts +18 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-function.d.ts +28 -0
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-history.d.ts +16 -0
- package/dist/types/common/wrap/wrap-history.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts +16 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts +16 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-promise.d.ts +17 -0
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-raf.d.ts +16 -0
- package/dist/types/common/wrap/wrap-raf.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-timer.d.ts +17 -0
- package/dist/types/common/wrap/wrap-timer.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts +16 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts +16 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/ajax/constants.d.ts +2 -0
- package/dist/types/features/ajax/constants.d.ts.map +1 -0
- package/dist/types/features/ajax/index.d.ts +2 -0
- package/dist/types/features/ajax/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +19 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts +9 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts +2 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +22 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts +3 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts +24 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts.map +1 -0
- package/dist/types/features/jserrors/constants.d.ts +3 -0
- package/dist/types/features/jserrors/constants.d.ts.map +1 -0
- package/dist/types/features/jserrors/index.d.ts +2 -0
- package/dist/types/features/jserrors/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts +2 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts +22 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts +6 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -0
- package/dist/types/features/metrics/index.d.ts +2 -0
- package/dist/types/features/metrics/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts +7 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts +7 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +1 -0
- package/dist/types/features/page_action/aggregate/index.d.ts +24 -0
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_action/constants.d.ts +2 -0
- package/dist/types/features/page_action/constants.d.ts.map +1 -0
- package/dist/types/features/page_action/index.d.ts +2 -0
- package/dist/types/features/page_action/index.d.ts.map +1 -0
- package/dist/types/features/page_action/instrument/index.d.ts +6 -0
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts +9 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts +8 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -0
- package/dist/types/features/page_view_event/constants.d.ts +5 -0
- package/dist/types/features/page_view_event/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_event/index.d.ts +2 -0
- package/dist/types/features/page_view_event/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +33 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/constants.d.ts +2 -0
- package/dist/types/features/page_view_timing/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts +2 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts +2 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +77 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/constants.d.ts +13 -0
- package/dist/types/features/session_trace/constants.d.ts.map +1 -0
- package/dist/types/features/session_trace/index.d.ts +2 -0
- package/dist/types/features/session_trace/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts +11 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/index.d.ts +25 -0
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts +15 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts +20 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts +15 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -0
- package/dist/types/features/spa/constants.d.ts +23 -0
- package/dist/types/features/spa/constants.d.ts.map +1 -0
- package/dist/types/features/spa/index.d.ts +2 -0
- package/dist/types/features/spa/index.d.ts.map +1 -0
- package/dist/types/features/spa/instrument/index.d.ts +8 -0
- package/dist/types/features/spa/instrument/index.d.ts.map +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts +4 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +23 -0
- package/dist/types/features/utils/feature-base.d.ts.map +1 -0
- package/dist/types/features/utils/handler-cache.d.ts +22 -0
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +27 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -0
- package/dist/types/features/utils/lazy-loader.d.ts +13 -0
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/loaders/agent.d.ts +20 -0
- package/dist/types/loaders/agent.d.ts.map +1 -0
- package/dist/types/loaders/api/api.d.ts +17 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -0
- package/dist/types/loaders/api/apiAsync.d.ts +2 -0
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -0
- package/dist/types/loaders/browser-agent.d.ts +9 -0
- package/dist/types/loaders/browser-agent.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts +10 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -0
- package/dist/types/loaders/features/enabled-features.d.ts +2 -0
- package/dist/types/loaders/features/enabled-features.d.ts.map +1 -0
- package/dist/types/loaders/features/featureDependencies.d.ts +3 -0
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -0
- package/dist/types/loaders/features/features.d.ts +18 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -0
- package/dist/types/loaders/micro-agent.d.ts +25 -0
- package/dist/types/loaders/micro-agent.d.ts.map +1 -0
- package/dist/types/loaders/worker-agent.d.ts +8 -0
- package/dist/types/loaders/worker-agent.d.ts.map +1 -0
- package/package.json +231 -69
- package/src/cdn/lite.js +18 -0
- package/src/cdn/polyfills/lite.js +7 -0
- package/src/cdn/polyfills/pro.js +7 -0
- package/src/cdn/polyfills/spa.js +7 -0
- package/src/cdn/polyfills.js +17 -0
- package/src/cdn/pro.js +27 -0
- package/src/cdn/spa.js +28 -0
- package/src/cdn/worker.js +21 -0
- package/src/common/aggregate/aggregator.js +171 -0
- package/src/common/browser-version/firefox-version.js +10 -0
- package/src/common/browser-version/ios-version.js +10 -0
- package/src/common/config/config.js +12 -0
- package/src/common/config/state/configurable.js +26 -0
- package/src/common/config/state/info.js +49 -0
- package/src/common/config/state/init.js +56 -0
- package/src/common/config/state/loader-config.js +25 -0
- package/src/common/config/state/originals.js +3 -0
- package/src/common/config/state/runtime.js +45 -0
- package/src/common/constants/environment-variables.js +11 -0
- package/src/common/context/shared-context.js +21 -0
- package/src/common/deny-list/deny-list.js +116 -0
- package/src/common/drain/drain.js +119 -0
- package/src/common/event-emitter/contextual-ee.js +159 -0
- package/src/common/event-emitter/handle.js +17 -0
- package/src/common/event-emitter/register-handler.js +25 -0
- package/src/common/event-listener/event-listener-opts.js +41 -0
- package/src/common/harvest/harvest-scheduler.js +112 -0
- package/src/common/harvest/harvest.js +248 -0
- package/src/common/ids/id.js +23 -0
- package/src/common/ids/unique-id.js +81 -0
- package/src/common/metrics/framework-detection.js +71 -0
- package/src/common/metrics/paint-metrics.js +6 -0
- package/src/common/serialize/bel-serializer.js +93 -0
- package/src/common/timing/nav-timing.js +70 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +63 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/location.js +8 -0
- package/src/common/url/parse-url.js +71 -0
- package/src/common/url/protocol.js +19 -0
- package/src/common/util/console.js +11 -0
- package/src/common/util/data-size.js +21 -0
- package/src/common/util/feature-flags.js +38 -0
- package/src/common/util/get-or-set.js +34 -0
- package/src/common/util/global-scope.js +48 -0
- package/src/common/util/map-own.js +22 -0
- package/src/common/util/map-own.test.js +52 -0
- package/src/common/util/obfuscate.js +73 -0
- package/src/common/util/s-hash.js +14 -0
- package/src/common/util/single.js +18 -0
- package/src/common/util/stringify.js +42 -0
- package/src/common/util/submit-data.js +101 -0
- package/src/common/util/traverse.js +36 -0
- package/src/common/util/user-agent.js +56 -0
- package/src/common/window/load.js +15 -0
- package/src/common/window/nreum.js +110 -0
- package/src/common/window/page-visibility.js +24 -0
- package/src/common/window/session-storage.js +75 -0
- package/src/common/window/supports-performance-observer.js +10 -0
- package/src/common/wrap/index.js +18 -0
- package/src/common/wrap/wrap-console.js +47 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +109 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +48 -0
- package/src/common/wrap/wrap-jsonp.js +134 -0
- package/src/common/wrap/wrap-mutation.js +55 -0
- package/src/common/wrap/wrap-promise.js +165 -0
- package/src/common/wrap/wrap-raf.js +50 -0
- package/src/common/wrap/wrap-timer.js +67 -0
- package/src/common/wrap/wrap-xhr.js +213 -0
- package/src/features/ajax/aggregate/index.js +248 -0
- package/src/features/ajax/constants.js +3 -0
- package/src/features/ajax/index.js +1 -0
- package/src/features/ajax/instrument/distributed-tracing.js +166 -0
- package/src/features/ajax/instrument/index.js +380 -0
- package/src/features/ajax/instrument/response-size.js +18 -0
- package/src/features/jserrors/aggregate/canonical-function-name.js +14 -0
- package/src/features/jserrors/aggregate/canonical-function-name.test.js +13 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.js +231 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +297 -0
- package/src/features/jserrors/aggregate/format-stack-trace.js +30 -0
- package/src/features/jserrors/aggregate/format-stack-trace.test.js +39 -0
- package/src/features/jserrors/aggregate/index.js +310 -0
- package/src/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/src/features/jserrors/aggregate/string-hash-code.test.js +12 -0
- package/src/features/jserrors/constants.js +4 -0
- package/src/features/jserrors/index.js +1 -0
- package/src/features/jserrors/instrument/debug.js +36 -0
- package/src/features/jserrors/instrument/index.js +149 -0
- package/src/features/metrics/aggregate/index.js +134 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +44 -0
- package/src/features/metrics/instrument/workers-helper.js +110 -0
- package/src/features/page_action/aggregate/index.js +113 -0
- package/src/features/page_action/constants.js +3 -0
- package/src/features/page_action/index.js +1 -0
- package/src/features/page_action/instrument/index.js +15 -0
- package/src/features/page_view_event/aggregate/index.js +134 -0
- package/src/features/page_view_event/aggregate/initialized-features.js +31 -0
- package/src/features/page_view_event/constants.js +6 -0
- package/src/features/page_view_event/index.js +1 -0
- package/src/features/page_view_event/instrument/index.js +33 -0
- package/src/features/page_view_timing/aggregate/index.js +246 -0
- package/src/features/page_view_timing/constants.js +3 -0
- package/src/features/page_view_timing/first-paint.js +41 -0
- package/src/features/page_view_timing/index.js +1 -0
- package/src/features/page_view_timing/instrument/index.js +30 -0
- package/src/features/page_view_timing/long-tasks.js +60 -0
- package/src/features/session_trace/aggregate/index.js +410 -0
- package/src/features/session_trace/constants.js +15 -0
- package/src/features/session_trace/index.js +1 -0
- package/src/features/session_trace/instrument/index.js +126 -0
- package/src/features/spa/aggregate/index.js +738 -0
- package/src/features/spa/aggregate/interaction-node.js +85 -0
- package/src/features/spa/aggregate/interaction-node.test.js +17 -0
- package/src/features/spa/aggregate/interaction.js +112 -0
- package/src/features/spa/aggregate/serializer.js +198 -0
- package/src/features/spa/constants.js +36 -0
- package/src/features/spa/index.js +1 -0
- package/src/features/spa/instrument/index.js +112 -0
- package/src/features/utils/aggregate-base.js +7 -0
- package/src/features/utils/feature-base.js +51 -0
- package/src/features/utils/handler-cache.js +60 -0
- package/src/features/utils/instrument-base.js +68 -0
- package/src/features/utils/lazy-loader.js +37 -0
- package/src/index.js +15 -0
- package/src/loaders/agent.js +80 -0
- package/src/loaders/api/api.js +175 -0
- package/src/loaders/api/apiAsync.js +92 -0
- package/src/loaders/browser-agent.js +33 -0
- package/src/loaders/configure/configure.js +39 -0
- package/src/loaders/features/enabled-features.js +16 -0
- package/src/loaders/features/featureDependencies.js +26 -0
- package/src/loaders/features/features.js +25 -0
- package/src/loaders/micro-agent.js +84 -0
- package/src/loaders/worker-agent.js +24 -0
- package/dist/bundled/es5/index.js +0 -2
- package/dist/bundled/es5/index.js.map +0 -1
- package/dist/bundled/es6/index.js +0 -2
- package/dist/bundled/es6/index.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -19
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -94
- package/dist/cjs/types.js +0 -28
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/api/api.d.ts +0 -10
- package/dist/cjs/utils/api/api.js +0 -40
- package/dist/cjs/utils/api/api.js.map +0 -1
- package/dist/cjs/utils/config/build-configs.d.ts +0 -6
- package/dist/cjs/utils/config/build-configs.js +0 -68
- package/dist/cjs/utils/config/build-configs.js.map +0 -1
- package/dist/cjs/utils/features/features.d.ts +0 -5
- package/dist/cjs/utils/features/features.js +0 -14
- package/dist/cjs/utils/features/features.js.map +0 -1
- package/dist/cjs/utils/features/initialize.d.ts +0 -5
- package/dist/cjs/utils/features/initialize.js +0 -51
- package/dist/cjs/utils/features/initialize.js.map +0 -1
- package/dist/es/index.d.ts +0 -19
- package/dist/es/index.js +0 -55
- package/dist/es/index.js.map +0 -1
- package/dist/es/types.d.ts +0 -94
- package/dist/es/types.js +0 -24
- package/dist/es/types.js.map +0 -1
- package/dist/es/utils/api/api.d.ts +0 -10
- package/dist/es/utils/api/api.js +0 -36
- package/dist/es/utils/api/api.js.map +0 -1
- package/dist/es/utils/config/build-configs.d.ts +0 -6
- package/dist/es/utils/config/build-configs.js +0 -64
- package/dist/es/utils/config/build-configs.js.map +0 -1
- package/dist/es/utils/features/features.d.ts +0 -5
- package/dist/es/utils/features/features.js +0 -10
- package/dist/es/utils/features/features.js.map +0 -1
- package/dist/es/utils/features/initialize.d.ts +0 -5
- package/dist/es/utils/features/initialize.js +0 -24
- package/dist/es/utils/features/initialize.js.map +0 -1
- package/dist/umd/index.d.ts +0 -19
- package/dist/umd/index.js +0 -69
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/types.d.ts +0 -94
- package/dist/umd/types.js +0 -38
- package/dist/umd/types.js.map +0 -1
- package/dist/umd/utils/api/api.d.ts +0 -10
- package/dist/umd/utils/api/api.js +0 -50
- package/dist/umd/utils/api/api.js.map +0 -1
- package/dist/umd/utils/config/build-configs.d.ts +0 -6
- package/dist/umd/utils/config/build-configs.js +0 -78
- package/dist/umd/utils/config/build-configs.js.map +0 -1
- package/dist/umd/utils/features/features.d.ts +0 -5
- package/dist/umd/utils/features/features.js +0 -24
- package/dist/umd/utils/features/features.js.map +0 -1
- package/dist/umd/utils/features/initialize.d.ts +0 -5
- package/dist/umd/utils/features/initialize.js +0 -63
- package/dist/umd/utils/features/initialize.js.map +0 -1
- package/dist/webpack-analysis.html +0 -38
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { isWorkerScope } from './global-scope';
|
|
6
|
+
export const submitData = {};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Send via JSONP. Do NOT call this function outside of a guaranteed web window environment.
|
|
10
|
+
* @param {string} url
|
|
11
|
+
* @param {string} jsonp
|
|
12
|
+
* @returns {Element}
|
|
13
|
+
*/
|
|
14
|
+
submitData.jsonp = function jsonp(url, jsonp) {
|
|
15
|
+
try {
|
|
16
|
+
if (isWorkerScope) {
|
|
17
|
+
try {
|
|
18
|
+
return importScripts(url + '&jsonp=' + jsonp);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// for now theres no other way to execute the callback from ingest without jsonp, or unsafe eval / new Function calls
|
|
21
|
+
// future work needs to be conducted to allow ingest to return a more traditional JSON API-like experience for the entitlement flags
|
|
22
|
+
submitData.xhrGet(url + '&jsonp=' + jsonp);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
var element = document.createElement('script');
|
|
27
|
+
element.type = 'text/javascript';
|
|
28
|
+
element.src = url + '&jsonp=' + jsonp;
|
|
29
|
+
var firstScript = document.getElementsByTagName('script')[0];
|
|
30
|
+
firstScript.parentNode.insertBefore(element, firstScript);
|
|
31
|
+
return element;
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
// do nothing
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
submitData.xhrGet = function xhrGet(url) {
|
|
38
|
+
return submitData.xhr(url, undefined, false, 'GET');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Send via XHR
|
|
43
|
+
* @param {string} url
|
|
44
|
+
* @param {string} body
|
|
45
|
+
* @param {boolean} sync
|
|
46
|
+
* @returns {XMLHttpRequest}
|
|
47
|
+
*/
|
|
48
|
+
submitData.xhr = function xhr(url, body, sync) {
|
|
49
|
+
let method = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'POST';
|
|
50
|
+
var request = new XMLHttpRequest();
|
|
51
|
+
request.open(method, url, !sync);
|
|
52
|
+
try {
|
|
53
|
+
// Set cookie
|
|
54
|
+
if ('withCredentials' in request) request.withCredentials = true;
|
|
55
|
+
} catch (e) {
|
|
56
|
+
// do nothing
|
|
57
|
+
}
|
|
58
|
+
request.setRequestHeader('content-type', 'text/plain');
|
|
59
|
+
request.send(body);
|
|
60
|
+
return request;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Unused at the moment -- DEPRECATED
|
|
65
|
+
*/
|
|
66
|
+
// submitData.xhrSync = function xhrSync (url, body) {
|
|
67
|
+
// return submitData.xhr(url, body, true)
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Send by appending an <img> element to the page. Do NOT call this function outside of a guaranteed web window environment.
|
|
72
|
+
* @param {string} url
|
|
73
|
+
* @returns {Element}
|
|
74
|
+
*/
|
|
75
|
+
submitData.img = function img(url) {
|
|
76
|
+
var element = new Image();
|
|
77
|
+
element.src = url;
|
|
78
|
+
return element;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Send via sendBeacon. Do NOT call this function outside of a guaranteed web window environment.
|
|
83
|
+
* @param {string} url
|
|
84
|
+
* @param {string} body
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
submitData.beacon = function (url, body) {
|
|
88
|
+
// Navigator has to be bound to ensure it does not error in some browsers
|
|
89
|
+
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
90
|
+
const send = window.navigator.sendBeacon.bind(window.navigator);
|
|
91
|
+
try {
|
|
92
|
+
return send(url, body);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
// if sendBeacon still trys to throw an illegal invocation error,
|
|
95
|
+
// we can catch here and return. The harvest module will fallback to use
|
|
96
|
+
// .img to try to send
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// traverses an object and applies a fn to property values of a certain type
|
|
7
|
+
export function applyFnToProps(obj, fn, type, ignoreKeys) {
|
|
8
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
9
|
+
type = type || 'string';
|
|
10
|
+
ignoreKeys = ignoreKeys || [];
|
|
11
|
+
return traverse(obj);
|
|
12
|
+
function traverse(obj) {
|
|
13
|
+
for (var property in obj) {
|
|
14
|
+
// eslint-disable-next-line
|
|
15
|
+
if (obj.hasOwnProperty(property)) {
|
|
16
|
+
if (typeof obj[property] === 'object') {
|
|
17
|
+
traverse(obj[property]);
|
|
18
|
+
} else {
|
|
19
|
+
if (typeof obj[property] === type && !shouldIgnore(property)) obj[property] = fn(obj[property]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
function shouldIgnore(key) {
|
|
26
|
+
var ignore = false;
|
|
27
|
+
for (var i = 0; i < ignoreKeys.length; i++) {
|
|
28
|
+
if (ignoreKeys[i] === key) {
|
|
29
|
+
ignore = true;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return ignore;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Feature-detection is much preferred over using User Agent to detect browser.
|
|
7
|
+
// However, there are cases where feature detection is not possible, for example
|
|
8
|
+
// when a specific version of a browser has a bug that requires a workaround in just
|
|
9
|
+
// that version.
|
|
10
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Browser_Name
|
|
11
|
+
var agentName = null;
|
|
12
|
+
var agentVersion = null;
|
|
13
|
+
const safari = /Version\/(\S+)\s+Safari/;
|
|
14
|
+
if (navigator.userAgent) {
|
|
15
|
+
var userAgent = navigator.userAgent;
|
|
16
|
+
var parts = userAgent.match(safari);
|
|
17
|
+
if (parts && userAgent.indexOf('Chrome') === -1 && userAgent.indexOf('Chromium') === -1) {
|
|
18
|
+
agentName = 'Safari';
|
|
19
|
+
agentVersion = parts[1];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export { agentName as agent, agentVersion as version };
|
|
23
|
+
export function match(name, version) {
|
|
24
|
+
if (!agentName) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (name !== agentName) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// version not provided, only match by name
|
|
32
|
+
if (!version) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// version provided, but not detected - not reliable match
|
|
37
|
+
if (!agentVersion) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
var detectedParts = agentVersion.split('.');
|
|
41
|
+
var requestedParts = version.split('.');
|
|
42
|
+
for (var i = 0; i < requestedParts.length; i++) {
|
|
43
|
+
if (requestedParts[i] !== detectedParts[i]) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { windowAddEventListener, documentAddEventListener } from '../event-listener/event-listener-opts';
|
|
2
|
+
function checkState() {
|
|
3
|
+
return typeof document === 'undefined' || document.readyState === 'complete';
|
|
4
|
+
}
|
|
5
|
+
export function onWindowLoad(cb, useCapture) {
|
|
6
|
+
if (checkState()) return cb();
|
|
7
|
+
windowAddEventListener('load', cb, useCapture);
|
|
8
|
+
}
|
|
9
|
+
export function onDOMContentLoaded(cb) {
|
|
10
|
+
if (checkState()) return cb();
|
|
11
|
+
documentAddEventListener('DOMContentLoaded', cb);
|
|
12
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { now } from '../timing/now';
|
|
2
|
+
import { globalScope } from '../util/global-scope';
|
|
3
|
+
export const defaults = {
|
|
4
|
+
beacon: 'bam.nr-data.net',
|
|
5
|
+
errorBeacon: 'bam.nr-data.net'
|
|
6
|
+
};
|
|
7
|
+
export function gosNREUM() {
|
|
8
|
+
if (!globalScope.NREUM) {
|
|
9
|
+
globalScope.NREUM = {};
|
|
10
|
+
}
|
|
11
|
+
if (typeof globalScope.newrelic === 'undefined') globalScope.newrelic = globalScope.NREUM;
|
|
12
|
+
return globalScope.NREUM;
|
|
13
|
+
}
|
|
14
|
+
export function gosNREUMInfo() {
|
|
15
|
+
let nr = gosNREUM();
|
|
16
|
+
const externallySupplied = nr.info || {};
|
|
17
|
+
nr.info = {
|
|
18
|
+
beacon: defaults.beacon,
|
|
19
|
+
errorBeacon: defaults.errorBeacon,
|
|
20
|
+
...externallySupplied
|
|
21
|
+
};
|
|
22
|
+
return nr;
|
|
23
|
+
}
|
|
24
|
+
export function gosNREUMLoaderConfig() {
|
|
25
|
+
let nr = gosNREUM();
|
|
26
|
+
const externallySupplied = nr.loader_config || {};
|
|
27
|
+
nr.loader_config = {
|
|
28
|
+
...externallySupplied
|
|
29
|
+
};
|
|
30
|
+
return nr;
|
|
31
|
+
}
|
|
32
|
+
export function gosNREUMInit() {
|
|
33
|
+
let nr = gosNREUM();
|
|
34
|
+
const externallySupplied = nr.init || {};
|
|
35
|
+
nr.init = {
|
|
36
|
+
...externallySupplied
|
|
37
|
+
};
|
|
38
|
+
return nr;
|
|
39
|
+
}
|
|
40
|
+
export function gosNREUMOriginals() {
|
|
41
|
+
let nr = gosNREUM();
|
|
42
|
+
if (!nr.o) {
|
|
43
|
+
nr.o = {
|
|
44
|
+
ST: globalScope.setTimeout,
|
|
45
|
+
SI: globalScope.setImmediate,
|
|
46
|
+
CT: globalScope.clearTimeout,
|
|
47
|
+
XHR: globalScope.XMLHttpRequest,
|
|
48
|
+
REQ: globalScope.Request,
|
|
49
|
+
EV: globalScope.Event,
|
|
50
|
+
PR: globalScope.Promise,
|
|
51
|
+
MO: globalScope.MutationObserver,
|
|
52
|
+
// this'll be undefined if not in a web window
|
|
53
|
+
FETCH: globalScope.fetch
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return nr;
|
|
57
|
+
}
|
|
58
|
+
export function gosNREUMInitializedAgents(id, obj, target) {
|
|
59
|
+
let nr = gosNREUM();
|
|
60
|
+
const externallySupplied = nr.initializedAgents || {};
|
|
61
|
+
const curr = externallySupplied[id] || {};
|
|
62
|
+
if (!Object.keys(curr).length) {
|
|
63
|
+
curr.initializedAt = {
|
|
64
|
+
ms: now(),
|
|
65
|
+
date: new Date()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
nr.initializedAgents = {
|
|
69
|
+
...externallySupplied,
|
|
70
|
+
[id]: {
|
|
71
|
+
...curr,
|
|
72
|
+
[target]: obj
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return nr;
|
|
76
|
+
}
|
|
77
|
+
export function addToNREUM(fnName, fn) {
|
|
78
|
+
let nr = gosNREUM();
|
|
79
|
+
nr[fnName] = fn;
|
|
80
|
+
}
|
|
81
|
+
export function NREUMinitialized() {
|
|
82
|
+
const nr = gosNREUM();
|
|
83
|
+
nr.initialized = true;
|
|
84
|
+
}
|
|
85
|
+
export function gosCDN() {
|
|
86
|
+
gosNREUMInfo();
|
|
87
|
+
gosNREUMInit();
|
|
88
|
+
gosNREUMOriginals();
|
|
89
|
+
gosNREUMLoaderConfig();
|
|
90
|
+
return gosNREUM();
|
|
91
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { documentAddEventListener } from '../event-listener/event-listener-opts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {function} cb - called when a visibility change occurs with the vis state at that time
|
|
10
|
+
* @param {boolean} [toHiddenOnly=false] - only execute the 'cb' when the vis is changing to the hidden state; no arg is passed to 'cb' if used
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
export function subscribeToVisibilityChange(cb) {
|
|
14
|
+
let toHiddenOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
15
|
+
documentAddEventListener('visibilitychange', handleVisibilityChange);
|
|
16
|
+
return;
|
|
17
|
+
function handleVisibilityChange() {
|
|
18
|
+
if (toHiddenOnly) {
|
|
19
|
+
// trigger cb on change to hidden state only
|
|
20
|
+
if (document.visibilityState == 'hidden') cb();else return;
|
|
21
|
+
}
|
|
22
|
+
cb(document.visibilityState);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for Agents' usage of the Window.sessionStorage as a replacement to third-party cookies.
|
|
3
|
+
* (All agents on a tab|window will share the same sessionStorage.)
|
|
4
|
+
*
|
|
5
|
+
* @design https://newrelic.atlassian.net/wiki/spaces/INST/pages/2522513791/JSESSIONID+Cookie+Change+Design+Document
|
|
6
|
+
* @environment Browser script
|
|
7
|
+
*/
|
|
8
|
+
import { generateRandomHexString } from '../ids/unique-id';
|
|
9
|
+
const AGENT_PREFIX = 'NRBA/';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} key
|
|
13
|
+
* @param {string} value
|
|
14
|
+
* @returns true, if item was set successfully. false, if storage is full or setItem threw an exception.
|
|
15
|
+
*/
|
|
16
|
+
export function putInBrowserStorage(key, value) {
|
|
17
|
+
let subgroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
18
|
+
try {
|
|
19
|
+
window.sessionStorage.setItem(AGENT_PREFIX + subgroup + key, value);
|
|
20
|
+
return true;
|
|
21
|
+
} catch (ex) {
|
|
22
|
+
// Session storage may be full.
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem}
|
|
28
|
+
* @param {string} key
|
|
29
|
+
*/
|
|
30
|
+
function getFromBrowserStorage(key) {
|
|
31
|
+
let subgroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
32
|
+
return window.sessionStorage.getItem(AGENT_PREFIX + subgroup + key);
|
|
33
|
+
}
|
|
34
|
+
export function removeFromBrowserStorage(key) {
|
|
35
|
+
let subgroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
36
|
+
try {
|
|
37
|
+
window.sessionStorage.removeItem(AGENT_PREFIX + subgroup + key);
|
|
38
|
+
} catch (e) {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @returns {string} This tab|window's session identifier, or a new ID if not found in storage
|
|
43
|
+
*/
|
|
44
|
+
export function getCurrentSessionIdOrMakeNew() {
|
|
45
|
+
try {
|
|
46
|
+
let sessionId;
|
|
47
|
+
if ((sessionId = getFromBrowserStorage('SESSION_ID')) === null) {
|
|
48
|
+
// Generate a new one if storage is empty (no previous ID was created or currently exists)
|
|
49
|
+
sessionId = generateRandomHexString(16);
|
|
50
|
+
putInBrowserStorage('SESSION_ID', sessionId);
|
|
51
|
+
}
|
|
52
|
+
return sessionId;
|
|
53
|
+
} catch (ex) {
|
|
54
|
+
// The agent is running in a security context that does not allow access to the sessionStorage or is not in browser window context.
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Look through the page's sessionStorage items and gather the ones that was set under some grouping label, if applicable.
|
|
61
|
+
* @param {string} [subgroup] - empty string by default, which will return all items set by browser agent
|
|
62
|
+
* @returns An object of the key-value items from putInBrowserStorage calls from agents with access to the same storage space.
|
|
63
|
+
*/
|
|
64
|
+
export function getAllStorageItemsOfGroup() {
|
|
65
|
+
let subgroup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
66
|
+
const prefixFilter = AGENT_PREFIX + subgroup;
|
|
67
|
+
const groupItems = {};
|
|
68
|
+
try {
|
|
69
|
+
for (let i = 0; i < window.sessionStorage.length; i++) {
|
|
70
|
+
let key = window.sessionStorage.key(i);
|
|
71
|
+
if (!key.startsWith(prefixFilter)) continue;else key = key.slice(prefixFilter.length); // this removes the "NRBA/<subgroup>" prefix so we get back the original key putInBrowserStorage
|
|
72
|
+
|
|
73
|
+
groupItems[key] = getFromBrowserStorage(key, subgroup);
|
|
74
|
+
}
|
|
75
|
+
} catch (ex) {}
|
|
76
|
+
return groupItems;
|
|
77
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { globalScope } from '../util/global-scope';
|
|
7
|
+
export function supportsPerformanceObserver() {
|
|
8
|
+
return typeof globalScope?.PerformanceObserver === 'function';
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Wraps assorted native objects and functions for instrumentation.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { wrapConsole } from './wrap-console';
|
|
6
|
+
import { wrapEvents } from './wrap-events';
|
|
7
|
+
import { wrapFetch } from './wrap-fetch';
|
|
8
|
+
import { wrapHistory } from './wrap-history';
|
|
9
|
+
import { wrapJsonP } from './wrap-jsonp';
|
|
10
|
+
import { wrapMutation } from './wrap-mutation';
|
|
11
|
+
import { wrapPromise } from './wrap-promise';
|
|
12
|
+
import { wrapRaf } from './wrap-raf';
|
|
13
|
+
import { wrapTimer } from './wrap-timer';
|
|
14
|
+
import { wrapXhr } from './wrap-xhr';
|
|
15
|
+
export { wrapConsole, wrapEvents, wrapFetch, wrapHistory, wrapJsonP, wrapMutation, wrapPromise, wrapRaf, wrapTimer, wrapXhr };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @file Wraps `debug`, `error`, `info`, `log`, `trace, and `warn` methods of the global `console` object for instrumentation.
|
|
7
|
+
* This module is used by: metrics.
|
|
8
|
+
*/
|
|
9
|
+
import { ee as globalEE } from '../event-emitter/contextual-ee';
|
|
10
|
+
import { createWrapperWithEmitter } from './wrap-function';
|
|
11
|
+
import { globalScope } from '../util/global-scope';
|
|
12
|
+
const wrapped = {};
|
|
13
|
+
const CONSOLE_METHODS = ['debug', 'error', 'info', 'log', 'trace', 'warn'];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Wraps the `debug`, `error`, `info`, `log`, `trace, and `warn` methods of global `console` object and returns a
|
|
17
|
+
* corresponding event emitter scoped to the console object.
|
|
18
|
+
* @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
|
|
19
|
+
* @returns {Object} Scoped event emitter with a debug ID of `console`.
|
|
20
|
+
*/
|
|
21
|
+
export function wrapConsole(sharedEE) {
|
|
22
|
+
const ee = scopedEE(sharedEE);
|
|
23
|
+
|
|
24
|
+
// We want to wrap console once and only once for each agent instance (`ee.debugId`).
|
|
25
|
+
if (wrapped[ee.debugId]) {
|
|
26
|
+
return ee;
|
|
27
|
+
}
|
|
28
|
+
wrapped[ee.debugId] = true;
|
|
29
|
+
var functionWrapper = createWrapperWithEmitter(ee);
|
|
30
|
+
// Because the console object exists once on the global scope, we don't need to wrap the prototype's methods.
|
|
31
|
+
// We use the global scope instead of window to accomodate service workers.
|
|
32
|
+
// The leading hyphen on '-console-' tells `inPlace` to prefix emitted event names with the method name too.
|
|
33
|
+
functionWrapper.inPlace(globalScope.console, CONSOLE_METHODS, '-console-');
|
|
34
|
+
return ee;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns an event emitter scoped specifically for the `console` context. This scoping is a remnant from when all the
|
|
39
|
+
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
40
|
+
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
41
|
+
* Uses `ee` on the global scope if undefined).
|
|
42
|
+
* @returns {Object} Scoped event emitter with a debug ID of 'console'.
|
|
43
|
+
*/
|
|
44
|
+
export function scopedEE(sharedEE) {
|
|
45
|
+
return (sharedEE || globalEE).get('console');
|
|
46
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @file Wraps `addEventListener` and `removeEventListener` for instrumentation.
|
|
7
|
+
* This module is used directly by: session_trace.
|
|
8
|
+
* It is also called by -> wrapXhr <-, so see "wrap-xhr.js" for features that use this indirectly.
|
|
9
|
+
*/
|
|
10
|
+
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
11
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
12
|
+
import { getOrSet } from '../util/get-or-set';
|
|
13
|
+
import { globalScope, isBrowserScope } from '../util/global-scope';
|
|
14
|
+
const wrapped = {};
|
|
15
|
+
const XHR = XMLHttpRequest;
|
|
16
|
+
const ADD_EVENT_LISTENER = 'addEventListener';
|
|
17
|
+
const REMOVE_EVENT_LISTENER = 'removeEventListener';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Wraps `addEventListener` and `removeEventListener` on: global scope; the prototype of `XMLHttpRequest`, and
|
|
21
|
+
* `document` (if in a browser scope). Adds custom events in context of a new emitter scoped only to these methods.
|
|
22
|
+
* @param {Object} sharedEE - The shared event emitter on which a new scoped
|
|
23
|
+
* event emitter will be based.
|
|
24
|
+
* @returns {Object} Scoped event emitter with a debug ID of `events`.
|
|
25
|
+
*/
|
|
26
|
+
export function wrapEvents(sharedEE) {
|
|
27
|
+
var ee = scopedEE(sharedEE);
|
|
28
|
+
if (wrapped[ee.debugId]++)
|
|
29
|
+
// Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
|
|
30
|
+
{
|
|
31
|
+
return ee;
|
|
32
|
+
} // then we increment the count to track # of feats using this at runtime.
|
|
33
|
+
wrapped[ee.debugId] = 1;
|
|
34
|
+
var wrapFn = wfn(ee, true);
|
|
35
|
+
|
|
36
|
+
// Guard against instrumenting environments w/o necessary features
|
|
37
|
+
if ('getPrototypeOf' in Object) {
|
|
38
|
+
if (isBrowserScope) {
|
|
39
|
+
findEventListenerProtoAndCb(document, wrapNode);
|
|
40
|
+
}
|
|
41
|
+
findEventListenerProtoAndCb(globalScope, wrapNode);
|
|
42
|
+
findEventListenerProtoAndCb(XHR.prototype, wrapNode);
|
|
43
|
+
}
|
|
44
|
+
ee.on(ADD_EVENT_LISTENER + '-start', function (args, target) {
|
|
45
|
+
var originalListener = args[1];
|
|
46
|
+
if (originalListener === null || typeof originalListener !== 'function' && typeof originalListener !== 'object') {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var wrapped = getOrSet(originalListener, 'nr@wrapped', function () {
|
|
50
|
+
var listener = {
|
|
51
|
+
object: wrapHandleEvent,
|
|
52
|
+
function: originalListener
|
|
53
|
+
}[typeof originalListener];
|
|
54
|
+
return listener ? wrapFn(listener, 'fn-', null, listener.name || 'anonymous') : originalListener;
|
|
55
|
+
function wrapHandleEvent() {
|
|
56
|
+
if (typeof originalListener.handleEvent !== 'function') return;
|
|
57
|
+
return originalListener.handleEvent.apply(originalListener, arguments);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.wrapped = args[1] = wrapped;
|
|
61
|
+
});
|
|
62
|
+
ee.on(REMOVE_EVENT_LISTENER + '-start', function (args) {
|
|
63
|
+
args[1] = this.wrapped || args[1];
|
|
64
|
+
});
|
|
65
|
+
function wrapNode(node) {
|
|
66
|
+
wrapFn.inPlace(node, [ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER], '-', uniqueListener);
|
|
67
|
+
}
|
|
68
|
+
function uniqueListener(args, obj) {
|
|
69
|
+
// Context for the listener is stored on itself.
|
|
70
|
+
return args[1];
|
|
71
|
+
}
|
|
72
|
+
return ee;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Find the base prototype of 'object' that has its own "addEventListener" property, and run some function on it.
|
|
76
|
+
* @param {Object} object - the initial object to traverse prototype chain on
|
|
77
|
+
* @param {Function} cb - the function to run on the ancestral object once found, accepts an object as a arg
|
|
78
|
+
* @param {Array} rest - [optional] any additional arguments to pass to the cb
|
|
79
|
+
*/
|
|
80
|
+
function findEventListenerProtoAndCb(object, cb) {
|
|
81
|
+
let step = object;
|
|
82
|
+
while (typeof step === 'object' && !Object.prototype.hasOwnProperty.call(step, ADD_EVENT_LISTENER)) {
|
|
83
|
+
step = Object.getPrototypeOf(step);
|
|
84
|
+
}
|
|
85
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
86
|
+
rest[_key - 2] = arguments[_key];
|
|
87
|
+
}
|
|
88
|
+
if (step) cb(step, ...rest);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns an event emitter scoped specifically for the `events` context. This scoping is a remnant from when all the
|
|
93
|
+
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
94
|
+
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
95
|
+
* Uses `ee` on the global scope if undefined).
|
|
96
|
+
* @returns {Object} Scoped event emitter with a debug ID of 'events'.
|
|
97
|
+
*/
|
|
98
|
+
export function scopedEE(sharedEE) {
|
|
99
|
+
return (sharedEE || baseEE).get('events');
|
|
100
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @file Wraps `fetch` and related methods for instrumentation.
|
|
7
|
+
* This module is used by: ajax, spa.
|
|
8
|
+
*/
|
|
9
|
+
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
10
|
+
import slice from 'lodash._slice';
|
|
11
|
+
import { globalScope } from '../util/global-scope';
|
|
12
|
+
import { flag } from './wrap-function';
|
|
13
|
+
var prefix = 'fetch-';
|
|
14
|
+
var bodyPrefix = prefix + 'body-';
|
|
15
|
+
var bodyMethods = ['arrayBuffer', 'blob', 'json', 'text', 'formData'];
|
|
16
|
+
var Req = globalScope.Request;
|
|
17
|
+
var Res = globalScope.Response;
|
|
18
|
+
var proto = 'prototype';
|
|
19
|
+
var ctxId = 'nr@context';
|
|
20
|
+
const wrapped = {};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the `fetch` method of the global scope for instrumentation. Also wraps the prototypes of the async methods
|
|
24
|
+
* that parse Request and Response bodies to generate start and end events for each, in context of a new event
|
|
25
|
+
* emitter scoped only to fetch and related methods.
|
|
26
|
+
* @param {Object} sharedEE - The shared event emitter on which a new scoped
|
|
27
|
+
* event emitter will be based.
|
|
28
|
+
* @returns {Object} Scoped event emitter with a debug ID of `fetch`.
|
|
29
|
+
*/
|
|
30
|
+
export function wrapFetch(sharedEE) {
|
|
31
|
+
const ee = scopedEE(sharedEE);
|
|
32
|
+
if (!(Req && Res && globalScope.fetch)) {
|
|
33
|
+
return ee;
|
|
34
|
+
}
|
|
35
|
+
if (wrapped[ee.debugId]++)
|
|
36
|
+
// Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
|
|
37
|
+
{
|
|
38
|
+
return ee;
|
|
39
|
+
} // then we increment the count to track # of feats using this at runtime.
|
|
40
|
+
wrapped[ee.debugId] = 1;
|
|
41
|
+
bodyMethods.forEach(method => {
|
|
42
|
+
wrapPromiseMethod(Req[proto], method, bodyPrefix);
|
|
43
|
+
wrapPromiseMethod(Res[proto], method, bodyPrefix);
|
|
44
|
+
});
|
|
45
|
+
wrapPromiseMethod(globalScope, 'fetch', prefix);
|
|
46
|
+
ee.on(prefix + 'end', function (err, res) {
|
|
47
|
+
var ctx = this;
|
|
48
|
+
if (res) {
|
|
49
|
+
var size = res.headers.get('content-length');
|
|
50
|
+
if (size !== null) {
|
|
51
|
+
ctx.rxSize = size;
|
|
52
|
+
}
|
|
53
|
+
ee.emit(prefix + 'done', [null, res], ctx);
|
|
54
|
+
} else {
|
|
55
|
+
ee.emit(prefix + 'done', [err], ctx);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Wraps a Promise-returning function (referenced by `target[name]`) to emit custom events before and after
|
|
61
|
+
* execution, each decorated with metadata (arguments, payloads, errors). Used to wrap the async body
|
|
62
|
+
* parsing methods of Request and Response (e.g. `json`, `text`, `formData`).
|
|
63
|
+
* @param {Object} target - The object having the method to be wrapped.
|
|
64
|
+
* @param {string} name - The name of the method to wrap.
|
|
65
|
+
* @param {string} prefix - Used to decorate event names with context.
|
|
66
|
+
*/
|
|
67
|
+
function wrapPromiseMethod(target, name, prefix) {
|
|
68
|
+
var fn = target[name];
|
|
69
|
+
if (typeof fn === 'function') {
|
|
70
|
+
target[name] = function () {
|
|
71
|
+
var args = slice(arguments);
|
|
72
|
+
var ctx = {};
|
|
73
|
+
// we are wrapping args in an array so we can preserve the reference
|
|
74
|
+
ee.emit(prefix + 'before-start', [args], ctx);
|
|
75
|
+
var dtPayload;
|
|
76
|
+
if (ctx[ctxId] && ctx[ctxId].dt) dtPayload = ctx[ctxId].dt;
|
|
77
|
+
var origPromiseFromFetch = fn.apply(this, args);
|
|
78
|
+
ee.emit(prefix + 'start', [args, dtPayload], origPromiseFromFetch);
|
|
79
|
+
|
|
80
|
+
// Note we need to cast the returned (orig) Promise from native APIs into the current global Promise, which may or may not be our WrappedPromise.
|
|
81
|
+
return origPromiseFromFetch.then(function (val) {
|
|
82
|
+
ee.emit(prefix + 'end', [null, val], origPromiseFromFetch);
|
|
83
|
+
return val;
|
|
84
|
+
}, function (err) {
|
|
85
|
+
ee.emit(prefix + 'end', [err], origPromiseFromFetch);
|
|
86
|
+
throw err;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return ee;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Returns an event emitter scoped specifically for the `fetch` context. This scoping is a remnant from when all the
|
|
96
|
+
* features shared the same group in the event, to isolate events between features. It will likely be revisited.
|
|
97
|
+
* @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.
|
|
98
|
+
* Uses `ee` on the global scope if undefined).
|
|
99
|
+
* @returns {Object} Scoped event emitter with a debug ID of 'fetch'.
|
|
100
|
+
*/
|
|
101
|
+
export function scopedEE(sharedEE) {
|
|
102
|
+
return (sharedEE || baseEE).get('fetch');
|
|
103
|
+
}
|