@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,248 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { mapOwn } from '../util/map-own'
|
|
7
|
+
import { obj as encodeObj, param as encodeParam } from '../url/encode'
|
|
8
|
+
import { stringify } from '../util/stringify'
|
|
9
|
+
import { submitData } from '../util/submit-data'
|
|
10
|
+
import { getLocation } from '../url/location'
|
|
11
|
+
import { getInfo, getConfigurationValue, getRuntime, getConfiguration } from '../config/config'
|
|
12
|
+
import { cleanURL } from '../url/clean-url'
|
|
13
|
+
import { now } from '../timing/now'
|
|
14
|
+
import { eventListenerOpts } from '../event-listener/event-listener-opts'
|
|
15
|
+
import { Obfuscator } from '../util/obfuscate'
|
|
16
|
+
import { applyFnToProps } from '../util/traverse'
|
|
17
|
+
import { SharedContext } from '../context/shared-context'
|
|
18
|
+
import { VERSION } from '../constants/environment-variables'
|
|
19
|
+
import { isBrowserScope, isWorkerScope } from '../util/global-scope'
|
|
20
|
+
|
|
21
|
+
const haveSendBeacon = !!navigator.sendBeacon // only the web window obj has sendBeacon at this time, so 'false' for other envs
|
|
22
|
+
|
|
23
|
+
export class Harvest extends SharedContext {
|
|
24
|
+
constructor (parent) {
|
|
25
|
+
super(parent) // gets any allowed properties from the parent and stores them in `sharedContext`
|
|
26
|
+
|
|
27
|
+
this.tooManyRequestsDelay = getConfigurationValue(this.sharedContext.agentIdentifier, 'harvest.tooManyRequestsDelay') || 60
|
|
28
|
+
this.obfuscator = new Obfuscator(this.sharedContext)
|
|
29
|
+
this.getScheme = () => (getConfigurationValue(this.sharedContext.agentIdentifier, 'ssl') === false) ? 'http' : 'https'
|
|
30
|
+
|
|
31
|
+
this._events = {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Initiate a harvest from multiple sources. An event that corresponds to the endpoint
|
|
36
|
+
* name is emitted, which gives any listeners the opportunity to provide payload data.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} endpoint - The endpoint of the harvest (jserrors, events, resources etc.)
|
|
39
|
+
*
|
|
40
|
+
* @param {object} opts
|
|
41
|
+
* @param {bool} opts.needResponse - Specify whether the caller expects a response data.
|
|
42
|
+
* @param {bool} opts.unload - Specify whether the call is a final harvest during page unload.
|
|
43
|
+
*/
|
|
44
|
+
sendX (endpoint, opts, cbFinished) {
|
|
45
|
+
var submitMethod = getSubmitMethod(endpoint, opts)
|
|
46
|
+
if (!submitMethod) return false
|
|
47
|
+
var options = {
|
|
48
|
+
retry: submitMethod.method === submitData.xhr
|
|
49
|
+
}
|
|
50
|
+
return this.obfuscator.shouldObfuscate() ? this.obfuscateAndSend(endpoint, this.createPayload(endpoint, options), opts, submitMethod, cbFinished) : this._send(endpoint, this.createPayload(endpoint, options), opts, submitMethod, cbFinished)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Initiate a harvest call.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} endpoint - The endpoint of the harvest (jserrors, events, resources etc.)
|
|
57
|
+
* @param {object} nr - The loader singleton.
|
|
58
|
+
*
|
|
59
|
+
* @param {object} singlePayload - Object representing payload.
|
|
60
|
+
* @param {object} singlePayload.qs - Map of values that should be sent as part of the request query string.
|
|
61
|
+
* @param {string} singlePayload.body - String that should be sent as the body of the request.
|
|
62
|
+
* @param {string} singlePayload.body.e - Special case of body used for browser interactions.
|
|
63
|
+
*
|
|
64
|
+
* @param {object} opts
|
|
65
|
+
* @param {bool} opts.needResponse - Specify whether the caller expects a response data.
|
|
66
|
+
* @param {bool} opts.unload - Specify whether the call is a final harvest during page unload.
|
|
67
|
+
*/
|
|
68
|
+
send (endpoint, singlePayload, opts, submitMethod, cbFinished) {
|
|
69
|
+
var makeBody = createAccumulator()
|
|
70
|
+
var makeQueryString = createAccumulator()
|
|
71
|
+
if (singlePayload.body) mapOwn(singlePayload.body, makeBody)
|
|
72
|
+
if (singlePayload.qs) mapOwn(singlePayload.qs, makeQueryString)
|
|
73
|
+
|
|
74
|
+
var payload = { body: makeBody(), qs: makeQueryString() }
|
|
75
|
+
var caller = this.obfuscator.shouldObfuscate() ? (...args) => this.obfuscateAndSend(...args) : (...args) => this._send(...args)
|
|
76
|
+
|
|
77
|
+
return caller(endpoint, payload, opts, submitMethod, cbFinished)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
obfuscateAndSend (endpoint, payload, opts, submitMethod, cbFinished) {
|
|
81
|
+
applyFnToProps(payload, (...args) => this.obfuscator.obfuscateString(...args), 'string', ['e'])
|
|
82
|
+
return this._send(endpoint, payload, opts, submitMethod, cbFinished)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_send (endpoint, payload, opts, submitMethod, cbFinished) {
|
|
86
|
+
var info = getInfo(this.sharedContext.agentIdentifier)
|
|
87
|
+
if (!info.errorBeacon) return false
|
|
88
|
+
|
|
89
|
+
var agentRuntime = getRuntime(this.sharedContext.agentIdentifier)
|
|
90
|
+
|
|
91
|
+
if (!payload.body) { // no payload body? nothing to send, just run onfinish stuff and return
|
|
92
|
+
if (cbFinished) {
|
|
93
|
+
cbFinished({ sent: false })
|
|
94
|
+
}
|
|
95
|
+
return false
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!opts) opts = {}
|
|
99
|
+
|
|
100
|
+
var url = this.getScheme() + '://' + info.errorBeacon + '/' + endpoint + '/1/' + info.licenseKey + this.baseQueryString()
|
|
101
|
+
if (payload.qs) url += encodeObj(payload.qs, agentRuntime.maxBytes)
|
|
102
|
+
|
|
103
|
+
if (!submitMethod) {
|
|
104
|
+
submitMethod = getSubmitMethod(endpoint, opts)
|
|
105
|
+
}
|
|
106
|
+
var method = submitMethod.method
|
|
107
|
+
var useBody = submitMethod.useBody
|
|
108
|
+
|
|
109
|
+
var body
|
|
110
|
+
var fullUrl = url
|
|
111
|
+
if (useBody && endpoint === 'events') {
|
|
112
|
+
body = payload.body.e
|
|
113
|
+
} else if (useBody) {
|
|
114
|
+
body = stringify(payload.body)
|
|
115
|
+
} else {
|
|
116
|
+
fullUrl = url + encodeObj(payload.body, agentRuntime.maxBytes)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Get bytes harvested per endpoint as a supportability metric. See metrics aggregator (on unload).
|
|
120
|
+
agentRuntime.bytesSent[endpoint] = (agentRuntime.bytesSent[endpoint] || 0) + body?.length || 0
|
|
121
|
+
|
|
122
|
+
/* Since workers don't support sendBeacon right now, or Image(), they can only use XHR method.
|
|
123
|
+
Because they still do permit synch XHR, the idea is that at final harvest time (worker is closing),
|
|
124
|
+
we just make a BLOCKING request--trivial impact--with the remaining data as a temp fill-in for sendBeacon. */
|
|
125
|
+
var result = method(fullUrl, body, opts.unload && isWorkerScope)
|
|
126
|
+
|
|
127
|
+
if (cbFinished && method === submitData.xhr) {
|
|
128
|
+
var xhr = result
|
|
129
|
+
xhr.addEventListener('load', function () {
|
|
130
|
+
var result = { sent: true }
|
|
131
|
+
if (this.status === 429) {
|
|
132
|
+
result.retry = true
|
|
133
|
+
result.delay = this.tooManyRequestsDelay
|
|
134
|
+
} else if (this.status === 408 || this.status === 500 || this.status === 503) {
|
|
135
|
+
result.retry = true
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (opts.needResponse) {
|
|
139
|
+
result.responseText = this.responseText
|
|
140
|
+
}
|
|
141
|
+
cbFinished(result)
|
|
142
|
+
}, eventListenerOpts(false))
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// if beacon request failed, retry with an alternative method -- will not happen for workers
|
|
146
|
+
if (!result && method === submitData.beacon) {
|
|
147
|
+
method = submitData.img
|
|
148
|
+
result = method(url + encodeObj(payload.body, agentRuntime.maxBytes))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return result
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// The stuff that gets sent every time.
|
|
155
|
+
baseQueryString () {
|
|
156
|
+
var runtime = getRuntime(this.sharedContext.agentIdentifier)
|
|
157
|
+
var info = getInfo(this.sharedContext.agentIdentifier)
|
|
158
|
+
|
|
159
|
+
var location = cleanURL(getLocation())
|
|
160
|
+
var ref = this.obfuscator.shouldObfuscate() ? this.obfuscator.obfuscateString(location) : location
|
|
161
|
+
|
|
162
|
+
return ([
|
|
163
|
+
'?a=' + info.applicationID,
|
|
164
|
+
encodeParam('sa', (info.sa ? '' + info.sa : '')),
|
|
165
|
+
encodeParam('v', VERSION),
|
|
166
|
+
transactionNameParam(info),
|
|
167
|
+
encodeParam('ct', runtime.customTransaction),
|
|
168
|
+
'&rst=' + now(),
|
|
169
|
+
'&ck=0', // ck param DEPRECATED - still expected by backend
|
|
170
|
+
'&s=' + (runtime.sessionId || '0'), // the 0 id encaps all untrackable and default traffic
|
|
171
|
+
encodeParam('ref', ref),
|
|
172
|
+
encodeParam('ptid', (runtime.ptid ? '' + runtime.ptid : ''))
|
|
173
|
+
].join(''))
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
createPayload (type, options) {
|
|
177
|
+
var makeBody = createAccumulator()
|
|
178
|
+
var makeQueryString = createAccumulator()
|
|
179
|
+
var listeners = (this._events[type] && this._events[type] || [])
|
|
180
|
+
|
|
181
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
182
|
+
var singlePayload = listeners[i](options)
|
|
183
|
+
if (!singlePayload) continue
|
|
184
|
+
if (singlePayload.body) mapOwn(singlePayload.body, makeBody)
|
|
185
|
+
if (singlePayload.qs) mapOwn(singlePayload.qs, makeQueryString)
|
|
186
|
+
}
|
|
187
|
+
return { body: makeBody(), qs: makeQueryString() }
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
on (type, listener) {
|
|
191
|
+
var listeners = (this._events[type] || (this._events[type] = []))
|
|
192
|
+
listeners.push(listener)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
resetListeners () {
|
|
196
|
+
mapOwn(this._events, (key) => {
|
|
197
|
+
this._events[key] = []
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function or (a, b) { return a || b }
|
|
203
|
+
|
|
204
|
+
export function getSubmitMethod (endpoint, opts) {
|
|
205
|
+
opts = opts || {}
|
|
206
|
+
var method
|
|
207
|
+
var useBody
|
|
208
|
+
|
|
209
|
+
if (opts.needResponse) { // currently: only STN needs a response
|
|
210
|
+
useBody = true
|
|
211
|
+
method = submitData.xhr
|
|
212
|
+
} else if (opts.unload && isBrowserScope) { // all the features' final harvest; neither methods work outside window context
|
|
213
|
+
useBody = haveSendBeacon
|
|
214
|
+
method = haveSendBeacon ? submitData.beacon : submitData.img // really only IE doesn't have Beacon API for web browsers
|
|
215
|
+
} else {
|
|
216
|
+
// `submitData.beacon` was removed, there is an upper limit to the
|
|
217
|
+
// number of data allowed before it starts failing, so we save it only for page unloading
|
|
218
|
+
useBody = true
|
|
219
|
+
method = submitData.xhr
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
method: method,
|
|
224
|
+
useBody: useBody
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Constructs the transaction name param for the beacon URL.
|
|
229
|
+
// Prefers the obfuscated transaction name over the plain text.
|
|
230
|
+
// Falls back to making up a name.
|
|
231
|
+
function transactionNameParam (info) {
|
|
232
|
+
if (info.transactionName) return encodeParam('to', info.transactionName)
|
|
233
|
+
return encodeParam('t', info.tNamePlain || 'Unnamed Transaction')
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// returns a function that can be called to accumulate values to a single object
|
|
237
|
+
// when the function is called without parameters, then the accumulator is returned
|
|
238
|
+
function createAccumulator () {
|
|
239
|
+
var accumulator = {}
|
|
240
|
+
var hasData = false
|
|
241
|
+
return function (key, val) {
|
|
242
|
+
if (val && val.length) {
|
|
243
|
+
accumulator[key] = val
|
|
244
|
+
hasData = true
|
|
245
|
+
}
|
|
246
|
+
if (hasData) return accumulator
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Start assigning ids at 1 so 0 can always be used for WindowOrWorkerGlobalScope, without
|
|
7
|
+
// actually setting it (which would create a global variable).
|
|
8
|
+
import { getOrSet } from '../util/get-or-set'
|
|
9
|
+
import { globalScope } from '../util/global-scope'
|
|
10
|
+
|
|
11
|
+
var index = 1
|
|
12
|
+
var prop = 'nr@id'
|
|
13
|
+
|
|
14
|
+
// Always returns id of obj, may tag obj with an id in the process.
|
|
15
|
+
export function id (obj) {
|
|
16
|
+
var type = typeof obj
|
|
17
|
+
// We can only tag objects, functions, and arrays with ids.
|
|
18
|
+
// For all primitive values we instead return -1.
|
|
19
|
+
if (!obj || !(type === 'object' || type === 'function')) return -1
|
|
20
|
+
if (obj === globalScope) return 0
|
|
21
|
+
|
|
22
|
+
return getOrSet(obj, prop, function () { return index++ })
|
|
23
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
|
|
8
|
+
export function generateUuid () {
|
|
9
|
+
var randomVals = null
|
|
10
|
+
var rvIndex = 0
|
|
11
|
+
var crypto = globalScope?.crypto || globalScope?.msCrypto
|
|
12
|
+
if (crypto && crypto.getRandomValues) {
|
|
13
|
+
// eslint-disable-next-line
|
|
14
|
+
randomVals = crypto.getRandomValues(new Uint8Array(31))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getRandomValue () {
|
|
18
|
+
if (randomVals) {
|
|
19
|
+
// same as % 16
|
|
20
|
+
return randomVals[rvIndex++] & 15
|
|
21
|
+
} else {
|
|
22
|
+
return Math.random() * 16 | 0
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// v4 UUID
|
|
27
|
+
var template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
28
|
+
var id = ''
|
|
29
|
+
var c
|
|
30
|
+
for (var i = 0; i < template.length; i++) {
|
|
31
|
+
c = template[i]
|
|
32
|
+
if (c === 'x') {
|
|
33
|
+
id += getRandomValue().toString(16)
|
|
34
|
+
} else if (c === 'y') {
|
|
35
|
+
// this is the uuid variant per spec (8, 9, a, b)
|
|
36
|
+
// % 4, then shift to get values 8-11
|
|
37
|
+
c = getRandomValue() & 0x3 | 0x8
|
|
38
|
+
id += c.toString(16)
|
|
39
|
+
} else {
|
|
40
|
+
id += c
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return id
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 16-character hex string (per DT spec)
|
|
48
|
+
export function generateSpanId () {
|
|
49
|
+
return generateRandomHexString(16)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 32-character hex string (per DT spec)
|
|
53
|
+
export function generateTraceId () {
|
|
54
|
+
return generateRandomHexString(32)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function generateRandomHexString (length) {
|
|
58
|
+
var randomVals = null
|
|
59
|
+
var rvIndex = 0
|
|
60
|
+
var crypto = self.crypto || self.msCrypto
|
|
61
|
+
// eslint-disable-next-line
|
|
62
|
+
if (crypto && crypto.getRandomValues && Uint8Array) {
|
|
63
|
+
// eslint-disable-next-line
|
|
64
|
+
randomVals = crypto.getRandomValues(new Uint8Array(31))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var chars = []
|
|
68
|
+
for (var i = 0; i < length; i++) {
|
|
69
|
+
chars.push(getRandomValue().toString(16))
|
|
70
|
+
}
|
|
71
|
+
return chars.join('')
|
|
72
|
+
|
|
73
|
+
function getRandomValue () {
|
|
74
|
+
if (randomVals) {
|
|
75
|
+
// same as % 16
|
|
76
|
+
return randomVals[rvIndex++] & 15
|
|
77
|
+
} else {
|
|
78
|
+
return Math.random() * 16 | 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isBrowserScope } from '../util/global-scope'
|
|
2
|
+
|
|
3
|
+
var FRAMEWORKS = {
|
|
4
|
+
REACT: 'React',
|
|
5
|
+
ANGULAR: 'Angular',
|
|
6
|
+
ANGULARJS: 'AngularJS',
|
|
7
|
+
BACKBONE: 'Backbone',
|
|
8
|
+
EMBER: 'Ember',
|
|
9
|
+
VUE: 'Vue',
|
|
10
|
+
METEOR: 'Meteor',
|
|
11
|
+
ZEPTO: 'Zepto',
|
|
12
|
+
JQUERY: 'Jquery'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getFrameworks () {
|
|
16
|
+
if (!isBrowserScope) return [] // don't bother detecting frameworks if not in the main window context
|
|
17
|
+
|
|
18
|
+
var frameworks = []
|
|
19
|
+
try {
|
|
20
|
+
if (detectReact()) frameworks.push(FRAMEWORKS.REACT)
|
|
21
|
+
if (detectAngularJs()) frameworks.push(FRAMEWORKS.ANGULARJS)
|
|
22
|
+
if (detectAngular()) frameworks.push(FRAMEWORKS.ANGULAR)
|
|
23
|
+
if (window.Backbone) frameworks.push(FRAMEWORKS.BACKBONE)
|
|
24
|
+
if (window.Ember) frameworks.push(FRAMEWORKS.EMBER)
|
|
25
|
+
if (window.Vue) frameworks.push(FRAMEWORKS.VUE)
|
|
26
|
+
if (window.Meteor) frameworks.push(FRAMEWORKS.METEOR)
|
|
27
|
+
if (window.Zepto) frameworks.push(FRAMEWORKS.ZEPTO)
|
|
28
|
+
if (window.jQuery) frameworks.push(FRAMEWORKS.JQUERY)
|
|
29
|
+
} catch (err) {
|
|
30
|
+
// not supported?
|
|
31
|
+
}
|
|
32
|
+
return frameworks
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function detectReact () {
|
|
36
|
+
try {
|
|
37
|
+
if (!!window.React || !!window.ReactDOM || !!window.ReactRedux) return true
|
|
38
|
+
if (document.querySelector('[data-reactroot], [data-reactid]')) return true
|
|
39
|
+
var divs = document.querySelectorAll('body > div')
|
|
40
|
+
for (var i = 0; i < divs.length; i++) {
|
|
41
|
+
if (Object.keys(divs[i]).indexOf('_reactRootContainer') >= 0) return true
|
|
42
|
+
}
|
|
43
|
+
return false
|
|
44
|
+
} catch (err) {
|
|
45
|
+
// not supported?
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function detectAngularJs () {
|
|
51
|
+
try {
|
|
52
|
+
if (window.angular) return true
|
|
53
|
+
if (document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]')) return true
|
|
54
|
+
if (document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')) return true
|
|
55
|
+
return false
|
|
56
|
+
} catch (err) {
|
|
57
|
+
// not supported?
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function detectAngular () {
|
|
63
|
+
try {
|
|
64
|
+
// eslint-disable-next-line
|
|
65
|
+
if (window.hasOwnProperty('ng') && window.ng.hasOwnProperty('coreTokens') && window.ng.coreTokens.hasOwnProperty('NgZone')) return true
|
|
66
|
+
return !!document.querySelectorAll('[ng-version]').length
|
|
67
|
+
} catch (err) {
|
|
68
|
+
// not supported?
|
|
69
|
+
return false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { mapOwn } from '../util/map-own'
|
|
7
|
+
import { stringify } from '../util/stringify'
|
|
8
|
+
import { Obfuscator } from '../util/obfuscate'
|
|
9
|
+
|
|
10
|
+
var hasOwnProp = Object.prototype.hasOwnProperty
|
|
11
|
+
var MAX_ATTRIBUTES = 64
|
|
12
|
+
|
|
13
|
+
export function nullable (val, fn, comma) {
|
|
14
|
+
return val || val === 0 || val === ''
|
|
15
|
+
? fn(val) + (comma ? ',' : '')
|
|
16
|
+
: '!'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function numeric (n, noDefault) {
|
|
20
|
+
if (noDefault) {
|
|
21
|
+
return Math.floor(n).toString(36)
|
|
22
|
+
}
|
|
23
|
+
return (n === undefined || n === 0) ? '' : Math.floor(n).toString(36)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getAddStringContext (agentIdentifier) {
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
var stringTable = Object.hasOwnProperty('create') ? Object.create(null) : {}
|
|
29
|
+
var stringTableIdx = 0
|
|
30
|
+
|
|
31
|
+
return addString
|
|
32
|
+
|
|
33
|
+
function addString (str) {
|
|
34
|
+
if (typeof str === 'undefined' || str === '') return ''
|
|
35
|
+
var obfuscator = new Obfuscator({ agentIdentifier: agentIdentifier })
|
|
36
|
+
str = String(str)
|
|
37
|
+
if (obfuscator.shouldObfuscate()) str = obfuscator.obfuscateString(str)
|
|
38
|
+
if (hasOwnProp.call(stringTable, str)) {
|
|
39
|
+
return numeric(stringTable[str], true)
|
|
40
|
+
} else {
|
|
41
|
+
stringTable[str] = stringTableIdx++
|
|
42
|
+
return quoteString(str)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function addCustomAttributes (attrs, addString) {
|
|
48
|
+
var attrParts = []
|
|
49
|
+
|
|
50
|
+
mapOwn(attrs, function (key, val) {
|
|
51
|
+
if (attrParts.length >= MAX_ATTRIBUTES) return
|
|
52
|
+
var type = 5
|
|
53
|
+
var serializedValue
|
|
54
|
+
// add key to string table first
|
|
55
|
+
key = addString(key)
|
|
56
|
+
|
|
57
|
+
switch (typeof val) {
|
|
58
|
+
case 'object':
|
|
59
|
+
if (val) {
|
|
60
|
+
// serialize objects to strings
|
|
61
|
+
serializedValue = addString(stringify(val))
|
|
62
|
+
} else {
|
|
63
|
+
// null attribute type
|
|
64
|
+
type = 9
|
|
65
|
+
}
|
|
66
|
+
break
|
|
67
|
+
case 'number':
|
|
68
|
+
type = 6
|
|
69
|
+
// make sure numbers contain a `.` so they are parsed as doubles
|
|
70
|
+
serializedValue = val % 1 ? val : val + '.'
|
|
71
|
+
break
|
|
72
|
+
case 'boolean':
|
|
73
|
+
type = val ? 7 : 8
|
|
74
|
+
break
|
|
75
|
+
case 'undefined':
|
|
76
|
+
// we treat undefined as a null attribute (since dirac does not have a concept of undefined)
|
|
77
|
+
type = 9
|
|
78
|
+
break
|
|
79
|
+
default:
|
|
80
|
+
serializedValue = addString(val)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
attrParts.push([type, key + (serializedValue ? ',' + serializedValue : '')])
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
return attrParts
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var escapable = /([,\\;])/g
|
|
90
|
+
|
|
91
|
+
function quoteString (str) {
|
|
92
|
+
return "'" + str.replace(escapable, '\\$1')
|
|
93
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// We don't use JSON.stringify directly on the performance timing data for these reasons:
|
|
7
|
+
// * Chrome has extra data in the performance object that we don't want to send all the time (wasteful)
|
|
8
|
+
// * Firefox fails to stringify the native object due to - http://code.google.com/p/v8/issues/detail?id=1223
|
|
9
|
+
// * The variable names are long and wasteful to transmit
|
|
10
|
+
|
|
11
|
+
// Add Performance Timing values to the given object.
|
|
12
|
+
// * Values are written relative to an offset to reduce their length (i.e. number of characters).
|
|
13
|
+
// * The offset is sent with the data
|
|
14
|
+
// * 0's are not included unless the value is a 'relative zero'
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
var START = 'Start'
|
|
18
|
+
var END = 'End'
|
|
19
|
+
var UNLOAD_EVENT = 'unloadEvent'
|
|
20
|
+
var REDIRECT = 'redirect'
|
|
21
|
+
var DOMAIN_LOOKUP = 'domainLookup'
|
|
22
|
+
var ONNECT = 'onnect'
|
|
23
|
+
var REQUEST = 'request'
|
|
24
|
+
var RESPONSE = 'response'
|
|
25
|
+
var LOAD_EVENT = 'loadEvent'
|
|
26
|
+
var DOM_CONTENT_LOAD_EVENT = 'domContentLoadedEvent'
|
|
27
|
+
|
|
28
|
+
export var navTimingValues = []
|
|
29
|
+
|
|
30
|
+
export function addPT (offset, pt, v) {
|
|
31
|
+
v.of = offset
|
|
32
|
+
addRel(offset, offset, v, 'n')
|
|
33
|
+
addRel(pt[UNLOAD_EVENT + START], offset, v, 'u')
|
|
34
|
+
addRel(pt[REDIRECT + START], offset, v, 'r')
|
|
35
|
+
addRel(pt[UNLOAD_EVENT + END], offset, v, 'ue')
|
|
36
|
+
addRel(pt[REDIRECT + END], offset, v, 're')
|
|
37
|
+
addRel(pt['fetch' + START], offset, v, 'f')
|
|
38
|
+
addRel(pt[DOMAIN_LOOKUP + START], offset, v, 'dn')
|
|
39
|
+
addRel(pt[DOMAIN_LOOKUP + END], offset, v, 'dne')
|
|
40
|
+
addRel(pt['c' + ONNECT + START], offset, v, 'c')
|
|
41
|
+
addRel(pt['secureC' + ONNECT + 'ion' + START], offset, v, 's')
|
|
42
|
+
addRel(pt['c' + ONNECT + END], offset, v, 'ce')
|
|
43
|
+
addRel(pt[REQUEST + START], offset, v, 'rq')
|
|
44
|
+
addRel(pt[RESPONSE + START], offset, v, 'rp')
|
|
45
|
+
addRel(pt[RESPONSE + END], offset, v, 'rpe')
|
|
46
|
+
addRel(pt.domLoading, offset, v, 'dl')
|
|
47
|
+
addRel(pt.domInteractive, offset, v, 'di')
|
|
48
|
+
addRel(pt[DOM_CONTENT_LOAD_EVENT + START], offset, v, 'ds')
|
|
49
|
+
addRel(pt[DOM_CONTENT_LOAD_EVENT + END], offset, v, 'de')
|
|
50
|
+
addRel(pt.domComplete, offset, v, 'dc')
|
|
51
|
+
addRel(pt[LOAD_EVENT + START], offset, v, 'l')
|
|
52
|
+
addRel(pt[LOAD_EVENT + END], offset, v, 'le')
|
|
53
|
+
return v
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Add Performance Navigation values to the given object
|
|
57
|
+
export function addPN (pn, v) {
|
|
58
|
+
addRel(pn.type, 0, v, 'ty')
|
|
59
|
+
addRel(pn.redirectCount, 0, v, 'rc')
|
|
60
|
+
return v
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function addRel (value, offset, obj, prop) {
|
|
64
|
+
var relativeValue
|
|
65
|
+
if (typeof (value) === 'number' && (value > 0)) {
|
|
66
|
+
relativeValue = Math.max(Math.round(value - offset), 0)
|
|
67
|
+
obj[prop] = relativeValue
|
|
68
|
+
}
|
|
69
|
+
navTimingValues.push(relativeValue)
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// This is our own layer around performance.now. It's not strictly necessary, but we keep it in case of future mod-ing of the value for refactor purpose.
|
|
7
|
+
export function now () {
|
|
8
|
+
return Math.round(performance.now())
|
|
9
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ffVersion } from '../browser-version/firefox-version'
|
|
6
|
+
import { windowAddEventListener } from '../event-listener/event-listener-opts'
|
|
7
|
+
import { single } from '../util/single'
|
|
8
|
+
import { globalScope, isWorkerScope, isBrowserScope } from '../util/global-scope'
|
|
9
|
+
import { subscribeToVisibilityChange } from '../window/page-visibility'
|
|
10
|
+
|
|
11
|
+
if (isWorkerScope) {
|
|
12
|
+
globalScope.cleanupTasks = [] // create new list on WorkerGlobalScope to track funcs to run before exiting thread
|
|
13
|
+
|
|
14
|
+
const origClose = globalScope.close
|
|
15
|
+
globalScope.close = () => { // on worker's EoL signal, execute all "listeners", e.g. final harvests
|
|
16
|
+
for (let task of globalScope.cleanupTasks) {
|
|
17
|
+
task()
|
|
18
|
+
}
|
|
19
|
+
origClose()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes a provided callback to the time/event when the agent should treat it as end-of-life.
|
|
25
|
+
* This is used, for example, to submit a final harvest and send all remaining data on best-effort.
|
|
26
|
+
* @param {function} cb - func to run before or during the last reliable event or time of an env's life span
|
|
27
|
+
* @param {boolean} allowBFCache - (temp) feature flag to gate new v1222 BFC support
|
|
28
|
+
*/
|
|
29
|
+
export function subscribeToEOL (cb, allowBFCache) {
|
|
30
|
+
if (isBrowserScope) {
|
|
31
|
+
if (allowBFCache) {
|
|
32
|
+
subscribeToVisibilityChange(cb, true) // when user switches tab or hides window, esp. mobile scenario
|
|
33
|
+
windowAddEventListener('pagehide', cb) // when user navigates away, and because safari iOS v14.4- doesn't fully support vis change
|
|
34
|
+
// --this ought to be removed once support for version below 14.5 phases out
|
|
35
|
+
} else {
|
|
36
|
+
var oneCall = single(cb)
|
|
37
|
+
|
|
38
|
+
// Firefox has a bug wherein a slow-loading resource loaded from the 'pagehide'
|
|
39
|
+
// or 'unload' event will delay the 'load' event firing on the next page load.
|
|
40
|
+
// In Firefox versions that support sendBeacon, this doesn't matter, because
|
|
41
|
+
// we'll use it instead of an image load for our final harvest.
|
|
42
|
+
//
|
|
43
|
+
// Some Safari versions never fire the 'unload' event for pages that are being
|
|
44
|
+
// put into the WebKit page cache, so we *need* to use the pagehide event for
|
|
45
|
+
// the final submission from Safari.
|
|
46
|
+
//
|
|
47
|
+
// Generally speaking, we will try to submit our final harvest from either
|
|
48
|
+
// pagehide or unload, whichever comes first, but in Firefox, we need to avoid
|
|
49
|
+
// attempting to submit from pagehide to ensure that we don't slow down loading
|
|
50
|
+
// of the next page.
|
|
51
|
+
if (!ffVersion || navigator.sendBeacon) {
|
|
52
|
+
windowAddEventListener('pagehide', oneCall)
|
|
53
|
+
} else {
|
|
54
|
+
windowAddEventListener('beforeunload', oneCall)
|
|
55
|
+
}
|
|
56
|
+
windowAddEventListener('unload', oneCall)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (isWorkerScope) {
|
|
60
|
+
globalScope.cleanupTasks.push(cb) // close() should run these tasks before quitting thread
|
|
61
|
+
}
|
|
62
|
+
// By default (for other env), this fn has no effect.
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
var withHash = /([^?#]*)[^#]*(#[^?]*|$).*/
|
|
7
|
+
var withoutHash = /([^?#]*)().*/
|
|
8
|
+
export function cleanURL (url, keepHash) {
|
|
9
|
+
return url.replace(keepHash ? withHash : withoutHash, '$1$2')
|
|
10
|
+
}
|