@newrelic/browser-agent 0.1.229 → 0.1.231
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 +65 -2
- package/dist/cjs/common/browser-version/ios-version.js +4 -3
- package/dist/cjs/common/config/state/configurable.js +3 -2
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +1 -1
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +6 -5
- package/dist/cjs/common/constants/env.cdn.js +29 -0
- package/dist/cjs/common/constants/env.js +32 -0
- package/dist/cjs/common/constants/env.npm.js +30 -0
- package/dist/cjs/common/context/shared-context.js +2 -1
- package/dist/cjs/common/drain/drain.js +9 -3
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +282 -0
- package/dist/cjs/common/event-emitter/handle.test.js +58 -0
- package/dist/cjs/common/event-emitter/register-handler.test.js +55 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -1
- package/dist/cjs/common/harvest/harvest.js +15 -4
- package/dist/cjs/common/ids/id.js +14 -6
- package/dist/cjs/common/ids/id.test.js +85 -0
- package/dist/cjs/common/ids/unique-id.js +75 -51
- package/dist/cjs/common/ids/unique-id.test.js +49 -0
- package/dist/cjs/common/timing/nav-timing.js +51 -30
- package/dist/cjs/common/timing/nav-timing.test.js +192 -0
- package/dist/cjs/common/url/clean-url.test.js +9 -0
- package/dist/cjs/common/url/encode.test.js +74 -0
- package/dist/cjs/common/url/location.js +4 -0
- package/dist/cjs/common/url/location.test.js +13 -0
- package/dist/cjs/common/url/parse-url.test.js +111 -0
- package/dist/cjs/common/url/protocol.js +2 -12
- package/dist/cjs/common/url/protocol.test.js +16 -0
- package/dist/cjs/common/util/console.js +2 -2
- package/dist/cjs/common/util/map-own.js +21 -14
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +1 -1
- package/dist/cjs/common/util/submit-data.js +11 -3
- package/dist/cjs/common/window/page-visibility.js +4 -2
- package/dist/cjs/common/window/session-storage.js +56 -11
- package/dist/cjs/common/wrap/index.js +4 -4
- package/dist/cjs/common/wrap/wrap-events.js +10 -10
- package/dist/cjs/common/wrap/wrap-fetch.js +6 -8
- package/dist/cjs/common/wrap/wrap-function.js +4 -18
- package/dist/cjs/common/wrap/wrap-history.js +7 -6
- package/dist/cjs/common/wrap/wrap-jsonp.js +7 -6
- package/dist/cjs/common/wrap/wrap-mutation.js +7 -6
- package/dist/cjs/common/wrap/wrap-promise.js +11 -7
- package/dist/cjs/common/wrap/wrap-promise.test.js +119 -0
- package/dist/cjs/common/wrap/wrap-raf.js +6 -6
- package/dist/cjs/common/wrap/wrap-timer.js +6 -6
- package/dist/cjs/common/wrap/wrap-xhr.js +5 -6
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +2 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/cjs/features/jserrors/aggregate/index.js +35 -14
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/cjs/features/jserrors/instrument/index.js +9 -12
- package/dist/cjs/features/metrics/aggregate/index.js +16 -6
- package/dist/cjs/features/metrics/instrument/index.js +2 -1
- package/dist/cjs/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/cjs/features/page_action/aggregate/index.js +12 -4
- package/dist/cjs/features/page_action/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +25 -10
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +69 -26
- package/dist/cjs/features/session_trace/instrument/index.js +2 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -1
- package/dist/cjs/features/utils/instrument-base.js +8 -3
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/loaders/agent.js +3 -2
- package/dist/cjs/loaders/api/api.js +90 -22
- package/dist/cjs/loaders/api/apiAsync.js +3 -3
- package/dist/cjs/loaders/configure/configure.js +13 -7
- package/dist/cjs/loaders/features/enabled-features.js +1 -1
- package/dist/cjs/loaders/micro-agent.js +20 -14
- package/dist/esm/common/browser-version/ios-version.js +4 -3
- package/dist/esm/common/config/state/configurable.js +3 -2
- package/dist/esm/common/config/state/info.js +1 -1
- package/dist/esm/common/config/state/init.js +1 -1
- package/dist/esm/common/config/state/loader-config.js +1 -1
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +20 -0
- package/dist/esm/common/constants/env.js +23 -0
- package/dist/esm/common/constants/env.npm.js +21 -0
- package/dist/esm/common/context/shared-context.js +2 -1
- package/dist/esm/common/drain/drain.js +9 -3
- package/dist/esm/common/event-emitter/contextual-ee.test.js +278 -0
- package/dist/esm/common/event-emitter/handle.test.js +54 -0
- package/dist/esm/common/event-emitter/register-handler.test.js +51 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -1
- package/dist/esm/common/harvest/harvest.js +14 -3
- package/dist/esm/common/ids/id.js +16 -6
- package/dist/esm/common/ids/id.test.js +81 -0
- package/dist/esm/common/ids/unique-id.js +75 -51
- package/dist/esm/common/ids/unique-id.test.js +44 -0
- package/dist/esm/common/timing/nav-timing.js +51 -29
- package/dist/esm/common/timing/nav-timing.test.js +190 -0
- package/dist/esm/common/url/clean-url.test.js +7 -0
- package/dist/esm/common/url/encode.test.js +70 -0
- package/dist/esm/common/url/location.js +4 -0
- package/dist/esm/common/url/location.test.js +11 -0
- package/dist/esm/common/url/parse-url.test.js +107 -0
- package/dist/esm/common/url/protocol.js +3 -12
- package/dist/esm/common/url/protocol.test.js +14 -0
- package/dist/esm/common/util/console.js +2 -2
- package/dist/esm/common/util/map-own.js +19 -13
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +2 -2
- package/dist/esm/common/util/submit-data.js +11 -3
- package/dist/esm/common/window/page-visibility.js +4 -2
- package/dist/esm/common/window/session-storage.js +54 -13
- package/dist/esm/common/wrap/index.js +3 -3
- package/dist/esm/common/wrap/wrap-events.js +11 -11
- package/dist/esm/common/wrap/wrap-fetch.js +7 -9
- package/dist/esm/common/wrap/wrap-function.js +4 -17
- package/dist/esm/common/wrap/wrap-history.js +8 -7
- package/dist/esm/common/wrap/wrap-jsonp.js +8 -7
- package/dist/esm/common/wrap/wrap-mutation.js +7 -6
- package/dist/esm/common/wrap/wrap-promise.js +11 -7
- package/dist/esm/common/wrap/wrap-promise.test.js +115 -0
- package/dist/esm/common/wrap/wrap-raf.js +7 -7
- package/dist/esm/common/wrap/wrap-timer.js +7 -7
- package/dist/esm/common/wrap/wrap-xhr.js +7 -8
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +2 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/esm/features/jserrors/aggregate/index.js +35 -14
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/esm/features/jserrors/instrument/index.js +9 -12
- package/dist/esm/features/metrics/aggregate/index.js +17 -7
- package/dist/esm/features/metrics/instrument/index.js +2 -1
- package/dist/esm/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/esm/features/page_action/aggregate/index.js +12 -4
- package/dist/esm/features/page_action/instrument/index.js +2 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +25 -10
- package/dist/esm/features/page_view_event/instrument/index.js +2 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/esm/features/page_view_timing/instrument/index.js +2 -1
- package/dist/esm/features/session_trace/aggregate/index.js +69 -26
- package/dist/esm/features/session_trace/instrument/index.js +2 -1
- package/dist/esm/features/spa/instrument/index.js +2 -1
- package/dist/esm/features/utils/instrument-base.js +3 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/loaders/agent.js +3 -2
- package/dist/esm/loaders/api/api.js +85 -21
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/configure/configure.js +14 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +18 -13
- 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/env.cdn.d.ts +18 -0
- package/dist/types/common/constants/env.cdn.d.ts.map +1 -0
- package/dist/types/common/constants/env.d.ts +13 -0
- package/dist/types/common/constants/env.d.ts.map +1 -0
- package/dist/types/common/constants/env.npm.d.ts +19 -0
- package/dist/types/common/constants/env.npm.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 +12 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +28 -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 +4 -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 +6 -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 +2 -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 +11 -0
- package/dist/types/common/wrap/index.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 +6 -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 +32 -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 +67 -59
- 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 +11 -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 +47 -0
- package/src/common/constants/env.cdn.js +20 -0
- package/src/common/constants/env.js +23 -0
- package/src/common/constants/env.npm.js +21 -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/contextual-ee.test.js +310 -0
- package/src/common/event-emitter/handle.js +17 -0
- package/src/common/event-emitter/handle.test.js +56 -0
- package/src/common/event-emitter/register-handler.js +25 -0
- package/src/common/event-emitter/register-handler.test.js +61 -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 +32 -0
- package/src/common/ids/id.test.js +92 -0
- package/src/common/ids/unique-id.js +104 -0
- package/src/common/ids/unique-id.test.js +58 -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 +90 -0
- package/src/common/timing/nav-timing.test.js +161 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +62 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/clean-url.test.js +25 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/encode.test.js +80 -0
- package/src/common/url/location.js +12 -0
- package/src/common/url/location.test.js +15 -0
- package/src/common/url/parse-url.js +70 -0
- package/src/common/url/parse-url.test.js +110 -0
- package/src/common/url/protocol.js +9 -0
- package/src/common/url/protocol.test.js +18 -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 +47 -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 +17 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +110 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +51 -0
- package/src/common/wrap/wrap-jsonp.js +136 -0
- package/src/common/wrap/wrap-mutation.js +58 -0
- package/src/common/wrap/wrap-promise.js +166 -0
- package/src/common/wrap/wrap-promise.test.js +140 -0
- package/src/common/wrap/wrap-raf.js +52 -0
- package/src/common/wrap/wrap-timer.js +69 -0
- package/src/common/wrap/wrap-xhr.js +214 -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 +151 -0
- package/src/features/metrics/aggregate/index.js +133 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +14 -0
- package/src/features/metrics/instrument/workers-helper.js +113 -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 +143 -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 +257 -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 +413 -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 +127 -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 +114 -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/cjs/common/constants/environment-variables.js +0 -20
- package/dist/cjs/common/util/reduce.js +0 -22
- package/dist/cjs/common/window/top-level-callers.js +0 -23
- package/dist/esm/common/constants/environment-variables.js +0 -11
- package/dist/esm/common/util/reduce.js +0 -16
- package/dist/esm/common/window/top-level-callers.js +0 -17
- package/types.ts +0 -221
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defaults as nrDefaults, gosNREUMInitializedAgents } from '../../window/nreum'
|
|
2
|
+
import { Configurable } from './configurable'
|
|
3
|
+
|
|
4
|
+
const model = {
|
|
5
|
+
// preset defaults
|
|
6
|
+
beacon: nrDefaults.beacon,
|
|
7
|
+
errorBeacon: nrDefaults.errorBeacon,
|
|
8
|
+
// others must be populated by user
|
|
9
|
+
licenseKey: undefined,
|
|
10
|
+
applicationID: undefined,
|
|
11
|
+
sa: undefined,
|
|
12
|
+
queueTime: undefined,
|
|
13
|
+
applicationTime: undefined,
|
|
14
|
+
ttGuid: undefined,
|
|
15
|
+
user: undefined,
|
|
16
|
+
account: undefined,
|
|
17
|
+
product: undefined,
|
|
18
|
+
extra: undefined,
|
|
19
|
+
jsAttributes: {
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
userAttributes: undefined,
|
|
23
|
+
atts: undefined,
|
|
24
|
+
transactionName: undefined,
|
|
25
|
+
tNamePlain: undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const _cache = {}
|
|
29
|
+
|
|
30
|
+
export function isValid (id) {
|
|
31
|
+
try {
|
|
32
|
+
const info = getInfo(id)
|
|
33
|
+
return (!!info.licenseKey && !!info.errorBeacon && !!info.applicationID)
|
|
34
|
+
} catch (err) {
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getInfo (id) {
|
|
40
|
+
if (!id) throw new Error('All info objects require an agent identifier!')
|
|
41
|
+
if (!_cache[id]) throw new Error(`Info for ${id} was never set`)
|
|
42
|
+
return _cache[id]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function setInfo (id, obj) {
|
|
46
|
+
if (!id) throw new Error('All info objects require an agent identifier!')
|
|
47
|
+
_cache[id] = new Configurable(obj, model)
|
|
48
|
+
gosNREUMInitializedAgents(id, _cache[id], 'info')
|
|
49
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
import { gosNREUMInitializedAgents } from '../../window/nreum'
|
|
3
|
+
import { Configurable } from './configurable'
|
|
4
|
+
|
|
5
|
+
const model = {
|
|
6
|
+
allow_bfcache: true, // *cli - temporary feature flag for BFCache work
|
|
7
|
+
privacy: { cookies_enabled: true }, // *cli - per discussion, default should be true
|
|
8
|
+
ajax: { deny_list: undefined, enabled: true, harvestTimeSeconds: 10 },
|
|
9
|
+
distributed_tracing: {
|
|
10
|
+
enabled: undefined,
|
|
11
|
+
exclude_newrelic_header: undefined,
|
|
12
|
+
cors_use_newrelic_header: undefined,
|
|
13
|
+
cors_use_tracecontext_headers: undefined,
|
|
14
|
+
allowed_origins: undefined
|
|
15
|
+
},
|
|
16
|
+
ssl: undefined,
|
|
17
|
+
obfuscate: undefined,
|
|
18
|
+
jserrors: { enabled: true, harvestTimeSeconds: 10 },
|
|
19
|
+
metrics: { enabled: true },
|
|
20
|
+
page_action: { enabled: true, harvestTimeSeconds: 30 },
|
|
21
|
+
page_view_event: { enabled: true },
|
|
22
|
+
page_view_timing: { enabled: true, harvestTimeSeconds: 30, long_task: false },
|
|
23
|
+
session_trace: { enabled: true, harvestTimeSeconds: 10 },
|
|
24
|
+
spa: { enabled: true, harvestTimeSeconds: 10 }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const _cache = {}
|
|
28
|
+
|
|
29
|
+
export function getConfiguration (id) {
|
|
30
|
+
if (!id) throw new Error('All configuration objects require an agent identifier!')
|
|
31
|
+
if (!_cache[id]) throw new Error(`Configuration for ${id} was never set`)
|
|
32
|
+
return _cache[id]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function setConfiguration (id, obj) {
|
|
36
|
+
if (!id) throw new Error('All configuration objects require an agent identifier!')
|
|
37
|
+
_cache[id] = new Configurable(obj, model)
|
|
38
|
+
gosNREUMInitializedAgents(id, _cache[id], 'config')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getConfigurationValue (id, path) {
|
|
42
|
+
if (!id) throw new Error('All configuration objects require an agent identifier!')
|
|
43
|
+
var val = getConfiguration(id)
|
|
44
|
+
if (val) {
|
|
45
|
+
var parts = path.split('.')
|
|
46
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
47
|
+
val = val[parts[i]]
|
|
48
|
+
if (typeof val !== 'object') return
|
|
49
|
+
}
|
|
50
|
+
val = val[parts[parts.length - 1]]
|
|
51
|
+
}
|
|
52
|
+
return val
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// TO DO: a setConfigurationValue equivalent may be nice so individual
|
|
56
|
+
// properties can be tuned instead of reseting the whole model per call to `setConfiguration(agentIdentifier, {})`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { gosNREUMInitializedAgents } from '../../window/nreum'
|
|
2
|
+
import { Configurable } from './configurable'
|
|
3
|
+
|
|
4
|
+
const model = {
|
|
5
|
+
accountID: undefined,
|
|
6
|
+
trustKey: undefined,
|
|
7
|
+
agentID: undefined,
|
|
8
|
+
licenseKey: undefined,
|
|
9
|
+
applicationID: undefined,
|
|
10
|
+
xpid: undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const _cache = {}
|
|
14
|
+
|
|
15
|
+
export function getLoaderConfig (id) {
|
|
16
|
+
if (!id) throw new Error('All loader-config objects require an agent identifier!')
|
|
17
|
+
if (!_cache[id]) throw new Error(`LoaderConfig for ${id} was never set`)
|
|
18
|
+
return _cache[id]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function setLoaderConfig (id, obj) {
|
|
22
|
+
if (!id) throw new Error('All loader-config objects require an agent identifier!')
|
|
23
|
+
_cache[id] = new Configurable(obj, model)
|
|
24
|
+
gosNREUMInitializedAgents(id, _cache[id], 'loader_config')
|
|
25
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as userAgent from '../../util/user-agent'
|
|
2
|
+
import { Configurable } from './configurable'
|
|
3
|
+
import { gosNREUMInitializedAgents } from '../../window/nreum'
|
|
4
|
+
import { getCurrentSessionIdOrMakeNew } from '../../window/session-storage'
|
|
5
|
+
import { getConfigurationValue } from '../config'
|
|
6
|
+
import { globalScope } from '../../util/global-scope'
|
|
7
|
+
import { BUILD_ENV, DIST_METHOD, VERSION } from '../../constants/env'
|
|
8
|
+
|
|
9
|
+
const model = agentId => {
|
|
10
|
+
return {
|
|
11
|
+
buildEnv: BUILD_ENV,
|
|
12
|
+
bytesSent: {},
|
|
13
|
+
customTransaction: undefined,
|
|
14
|
+
disabled: false,
|
|
15
|
+
distMethod: DIST_METHOD,
|
|
16
|
+
isolatedBacklog: false,
|
|
17
|
+
loaderType: undefined,
|
|
18
|
+
maxBytes: 30000,
|
|
19
|
+
// The "timeOrigin" property is the new standard timestamp property shared across main frame and workers, but is not supported in some early Safari browsers (safari<15) + IE
|
|
20
|
+
// ingest expects an integer value, and timeOrigin can return a float.
|
|
21
|
+
offset: Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now()),
|
|
22
|
+
onerror: undefined,
|
|
23
|
+
origin: '' + globalScope.location,
|
|
24
|
+
ptid: undefined,
|
|
25
|
+
releaseIds: {},
|
|
26
|
+
sessionId: getConfigurationValue(agentId, 'privacy.cookies_enabled') == true
|
|
27
|
+
? getCurrentSessionIdOrMakeNew()
|
|
28
|
+
: null, // if cookies (now session tracking) is turned off or can't get session ID, this is null
|
|
29
|
+
xhrWrappable: typeof globalScope.XMLHttpRequest?.prototype?.addEventListener === 'function',
|
|
30
|
+
userAgent,
|
|
31
|
+
version: VERSION
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const _cache = {}
|
|
36
|
+
|
|
37
|
+
export function getRuntime (id) {
|
|
38
|
+
if (!id) throw new Error('All runtime objects require an agent identifier!')
|
|
39
|
+
if (!_cache[id]) throw new Error(`Runtime for ${id} was never set`)
|
|
40
|
+
return _cache[id]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function setRuntime (id, obj) {
|
|
44
|
+
if (!id) throw new Error('All runtime objects require an agent identifier!')
|
|
45
|
+
_cache[id] = new Configurable(obj, model(id))
|
|
46
|
+
gosNREUMInitializedAgents(id, _cache[id], 'runtime')
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file exposes CDN build environment variables. These variables will
|
|
3
|
+
* be overridden with babel.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exposes the version of the agent
|
|
8
|
+
*/
|
|
9
|
+
export const VERSION = process.env.BUILD_VERSION
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Exposes the build type of the agent
|
|
13
|
+
* Valid values are LOCAL, PROD, DEV
|
|
14
|
+
*/
|
|
15
|
+
export const BUILD_ENV = process.env.BUILD_ENV
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Exposes the distribution method of the agent
|
|
19
|
+
*/
|
|
20
|
+
export const DIST_METHOD = 'CDN'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file exposes build time environment variables that will be included in the
|
|
3
|
+
* build output of the agent. This file specifically contains the normal environment variables
|
|
4
|
+
* for the NPM agent build and will be overridden by webpack/babel during the build based on the
|
|
5
|
+
* type of build being performed.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import pkgJSON from '../../../package.json'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Exposes the version of the agent
|
|
12
|
+
*/
|
|
13
|
+
export const VERSION = pkgJSON.version
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Exposes the build type of the agent
|
|
17
|
+
*/
|
|
18
|
+
export const BUILD_ENV = 'NPM'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Exposes the distribution method of the agent
|
|
22
|
+
*/
|
|
23
|
+
export const DIST_METHOD = 'NPM'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file exposes NPM build environment variables. These variables will
|
|
3
|
+
* be overridden with babel.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exposes the version of the agent
|
|
8
|
+
*/
|
|
9
|
+
export const VERSION = process.env.BUILD_VERSION
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Exposes the build type of the agent
|
|
13
|
+
* Valid values are LOCAL, PROD, DEV
|
|
14
|
+
*/
|
|
15
|
+
export const BUILD_ENV = 'NPM'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Exposes the distribution method of the agent
|
|
19
|
+
* Valid valuse are CDN, NPM
|
|
20
|
+
*/
|
|
21
|
+
export const DIST_METHOD = 'NPM'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { warn } from '../util/console'
|
|
3
|
+
|
|
4
|
+
const model = {
|
|
5
|
+
agentIdentifier: ''
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class SharedContext {
|
|
9
|
+
constructor (context) {
|
|
10
|
+
try {
|
|
11
|
+
if (typeof context !== 'object') return warn('shared context requires an object as input')
|
|
12
|
+
this.sharedContext = {}
|
|
13
|
+
Object.assign(this.sharedContext, model)
|
|
14
|
+
Object.entries(context).forEach(([key, value]) => {
|
|
15
|
+
if (Object.keys(model).includes(key)) this.sharedContext[key] = value
|
|
16
|
+
})
|
|
17
|
+
} catch (err) {
|
|
18
|
+
warn('An error occured while setting SharedContext', err)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** An array of filter objects {hostname, pathname} for identifying XHR events to be excluded from collection.
|
|
2
|
+
* @see {@link https://docs.newrelic.com/docs/browser/new-relic-browser/configuration/filter-ajax-request-events/ Filter AjaxRequest events}
|
|
3
|
+
* @type {Array.<{hostname: string, pathname: string}>}
|
|
4
|
+
*/
|
|
5
|
+
var denyList = []
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates whether an XHR event should be included for collection based on the {@link denyList|AjaxRequest deny list}.
|
|
9
|
+
* @param {Object} params - object with properties of the XHR event
|
|
10
|
+
* @returns {boolean} `true` if request does not match any entries of {@link denyList|deny list}; else `false`
|
|
11
|
+
*/
|
|
12
|
+
export function shouldCollectEvent (params) {
|
|
13
|
+
if (denyList.length === 0) {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// XHR requests with an undefined hostname (e.g., data URLs) should not be collected.
|
|
18
|
+
if (params.hostname === undefined) {
|
|
19
|
+
return false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for (var i = 0; i < denyList.length; i++) {
|
|
23
|
+
var parsed = denyList[i]
|
|
24
|
+
|
|
25
|
+
if (parsed.hostname === '*') {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (domainMatchesPattern(parsed.hostname, params.hostname) &&
|
|
30
|
+
comparePath(parsed.pathname, params.pathname)) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the {@link denyList|XHR deny list} by extracting hostname and pathname from an array of filter strings.
|
|
40
|
+
* @param {string[]} denyListConfig - array of URL filters to identify XHR requests to be excluded from collection
|
|
41
|
+
*/
|
|
42
|
+
export function setDenyList (denyListConfig) {
|
|
43
|
+
denyList = []
|
|
44
|
+
|
|
45
|
+
if (!denyListConfig || !denyListConfig.length) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (var i = 0; i < denyListConfig.length; i++) {
|
|
50
|
+
var url = denyListConfig[i]
|
|
51
|
+
|
|
52
|
+
if (url.indexOf('http://') === 0) {
|
|
53
|
+
url = url.substring(7)
|
|
54
|
+
} else if (url.indexOf('https://') === 0) {
|
|
55
|
+
url = url.substring(8)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var firstSlash = url.indexOf('/')
|
|
59
|
+
|
|
60
|
+
if (firstSlash > 0) {
|
|
61
|
+
denyList.push({
|
|
62
|
+
hostname: url.substring(0, firstSlash),
|
|
63
|
+
pathname: url.substring(firstSlash)
|
|
64
|
+
})
|
|
65
|
+
} else {
|
|
66
|
+
denyList.push({
|
|
67
|
+
hostname: url,
|
|
68
|
+
pathname: ''
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the right side of `domain` (end of string) matches `pattern`.
|
|
75
|
+
* @param {string} pattern - a string to be matched against the end of `domain` string
|
|
76
|
+
* @param {string} domain - a domain string with no protocol or path (e.g., app1.example.com)
|
|
77
|
+
* @returns {boolean} `true` if domain matches pattern; else `false`
|
|
78
|
+
*/
|
|
79
|
+
function domainMatchesPattern (pattern, domain) {
|
|
80
|
+
if (pattern.length > domain.length) {
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (domain.indexOf(pattern) === (domain.length - pattern.length)) {
|
|
85
|
+
return true
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return false
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns true if a URL path matches a pattern string, disregarding leading slashes.
|
|
93
|
+
* @param {string} pattern - a string to compare with path (e.g., api/v1)
|
|
94
|
+
* @param {string} path - a string representing a URL path (e.g., /api/v1)
|
|
95
|
+
* @returns {boolean} `true` if path and pattern are an exact string match (except for leading slashes); else `false`
|
|
96
|
+
*/
|
|
97
|
+
function comparePath (pattern, path) {
|
|
98
|
+
if (pattern.indexOf('/') === 0) {
|
|
99
|
+
pattern = pattern.substring(1)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (path.indexOf('/') === 0) {
|
|
103
|
+
path = path.substring(1)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// No path in pattern means match all paths.
|
|
107
|
+
if (pattern === '') {
|
|
108
|
+
return true
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (pattern === path) {
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return false
|
|
116
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ee } from '../event-emitter/contextual-ee'
|
|
7
|
+
import { mapOwn } from '../util/map-own'
|
|
8
|
+
import { registerHandler as defaultRegister } from '../event-emitter/register-handler'
|
|
9
|
+
import { featurePriority } from '../../loaders/features/features'
|
|
10
|
+
|
|
11
|
+
const registry = {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Adds an entry to the centralized drain registry specifying that a particular agent has events of a particular named
|
|
15
|
+
* event-group "bucket" that should be drained at the time the agent drains all its buffered events. Buffered events
|
|
16
|
+
* accumulate because instrumentation begins as soon as possible, before the agent has finished lazy-loading the code
|
|
17
|
+
* responsible for aggregating and reporting captured data.
|
|
18
|
+
* @param {string} agentIdentifier - A 16 character string uniquely identifying the agent.
|
|
19
|
+
* @param {string} group - The named "bucket" for the events this feature will be bucketing for later collection.
|
|
20
|
+
*/
|
|
21
|
+
export function registerDrain (agentIdentifier, group) {
|
|
22
|
+
// Here `item` captures the registered properties of a feature-group: whether it is ready for its buffered events
|
|
23
|
+
// to be drained (`staged`) and the `priority` order in which it should be drained relative to other feature groups.
|
|
24
|
+
const item = { staged: false, priority: featurePriority[group] || 0 }
|
|
25
|
+
curateRegistry(agentIdentifier)
|
|
26
|
+
if (!registry[agentIdentifier].get(group)) registry[agentIdentifier].set(group, item)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Registers the specified agent with the centralized event buffer registry if it is not already registered.
|
|
31
|
+
* Agents without an identifier (as in the case of some tests) will be excluded from the registry.
|
|
32
|
+
* @param {string} agentIdentifier - A 16 character string uniquely identifying an agent.
|
|
33
|
+
*/
|
|
34
|
+
function curateRegistry (agentIdentifier) {
|
|
35
|
+
if (!agentIdentifier) return
|
|
36
|
+
if (!registry[agentIdentifier]) registry[agentIdentifier] = new Map()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Drain buffered events out of the event emitter. Each feature should have its events bucketed by "group" and drain
|
|
41
|
+
* its own named group explicitly, when ready.
|
|
42
|
+
* @param {string} agentIdentifier - A unique 16 character ID corresponding to an instantiated agent.
|
|
43
|
+
* @param {string} featureName - A named group into which the feature's buffered events are bucketed.
|
|
44
|
+
*/
|
|
45
|
+
export function drain (agentIdentifier = '', featureName = 'feature') {
|
|
46
|
+
curateRegistry(agentIdentifier)
|
|
47
|
+
|
|
48
|
+
// If the feature for the specified agent is not in the registry, that means the instrument file was bypassed.
|
|
49
|
+
// This could happen in tests, or loaders that directly import the aggregator. In these cases it is safe to
|
|
50
|
+
// drain the feature group immediately rather than waiting to drain all at once.
|
|
51
|
+
if (!agentIdentifier || !registry[agentIdentifier].get(featureName)) return drainGroup(featureName)
|
|
52
|
+
|
|
53
|
+
// When `drain` is called, this feature is ready to drain (staged).
|
|
54
|
+
registry[agentIdentifier].get(featureName).staged = true
|
|
55
|
+
|
|
56
|
+
// Only when the event-groups for all features are ready to drain (staged) do we execute the drain. This has the effect
|
|
57
|
+
// that the last feature to call drain triggers drain for all features.
|
|
58
|
+
const items = Array.from(registry[agentIdentifier])
|
|
59
|
+
if (items.every(([key, values]) => values.staged)) {
|
|
60
|
+
items.sort((a, b) => a[1].priority - b[1].priority)
|
|
61
|
+
items.forEach(([group]) => {
|
|
62
|
+
drainGroup(group)
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Drains all the buffered (backlog) events for a particular feature's event-group by emitting each event to each of
|
|
68
|
+
* the subscribed handlers for the group.
|
|
69
|
+
* @param {*} group - The name of a particular feature's event "bucket".
|
|
70
|
+
*/
|
|
71
|
+
function drainGroup (group) {
|
|
72
|
+
const baseEE = agentIdentifier ? ee.get(agentIdentifier) : ee
|
|
73
|
+
const handlers = defaultRegister.handlers
|
|
74
|
+
if (!baseEE.backlog || !handlers) return
|
|
75
|
+
|
|
76
|
+
var bufferedEventsInGroup = baseEE.backlog[group]
|
|
77
|
+
var groupHandlers = handlers[group]
|
|
78
|
+
if (groupHandlers) {
|
|
79
|
+
// We don't cache the length of the buffer while looping because events might still be added while processing.
|
|
80
|
+
for (var i = 0; bufferedEventsInGroup && i < bufferedEventsInGroup.length; ++i) { // eslint-disable-line no-unmodified-loop-condition
|
|
81
|
+
emitEvent(bufferedEventsInGroup[i], groupHandlers)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
mapOwn(groupHandlers, function (eventType, handlerRegistrationList) {
|
|
85
|
+
mapOwn(handlerRegistrationList, function (i, registration) {
|
|
86
|
+
// registration is an array of: [targetEE, eventHandler]
|
|
87
|
+
registration[0].on(eventType, registration[1])
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
delete handlers[group]
|
|
93
|
+
|
|
94
|
+
// Keep the feature's event-group as a property of the event emitter so we know it was already created and drained.
|
|
95
|
+
baseEE.backlog[group] = null
|
|
96
|
+
baseEE.emit('drain-' + group, [])
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Processes the specified event using all relevant handler functions associated with a particular feature, based on
|
|
102
|
+
* whether the the handler is meant to apply to events of this type. (Event type is a descriptive string set at the
|
|
103
|
+
* time an event is originally created by instrumentation, as with calls to the `handle` method.)
|
|
104
|
+
* @param {*} evt - A single event to be emitted to (processed by) eligible handler functions.
|
|
105
|
+
* @param {*} groupHandlers - A set of handler functions associated with a particular feature's event-group.
|
|
106
|
+
*/
|
|
107
|
+
function emitEvent (evt, groupHandlers) {
|
|
108
|
+
var type = evt[1]
|
|
109
|
+
mapOwn(groupHandlers[type], function (i, registration) {
|
|
110
|
+
var sourceEE = evt[0]
|
|
111
|
+
var ee = registration[0]
|
|
112
|
+
if (ee === sourceEE) {
|
|
113
|
+
var handler = registration[1]
|
|
114
|
+
var ctx = evt[3]
|
|
115
|
+
var args = evt[2]
|
|
116
|
+
handler.apply(ctx, args)
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { gosNREUM } from '../window/nreum'
|
|
7
|
+
import { getOrSet } from '../util/get-or-set'
|
|
8
|
+
import { mapOwn } from '../util/map-own'
|
|
9
|
+
import { getRuntime } from '../config/config'
|
|
10
|
+
|
|
11
|
+
var ctxId = 'nr@context'
|
|
12
|
+
|
|
13
|
+
// create global emitter instance that can be shared among bundles
|
|
14
|
+
let nr = gosNREUM()
|
|
15
|
+
var globalInstance
|
|
16
|
+
|
|
17
|
+
if (nr.ee) {
|
|
18
|
+
globalInstance = nr.ee
|
|
19
|
+
} else {
|
|
20
|
+
globalInstance = ee(undefined, 'globalEE')
|
|
21
|
+
nr.ee = globalInstance
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { globalInstance as ee }
|
|
25
|
+
|
|
26
|
+
function EventContext () { }
|
|
27
|
+
|
|
28
|
+
function ee (old, debugId) {
|
|
29
|
+
var handlers = {}
|
|
30
|
+
var bufferGroupMap = {}
|
|
31
|
+
var emitters = {}
|
|
32
|
+
// In cases where multiple agents can run on a page, the event backlogs of feature event emitters must be isolated
|
|
33
|
+
// to prevent event emitter context and buffers from "bubbling up" to other agents operating in the scope.
|
|
34
|
+
// An example of this is our MicroAgent loader package, which sets this property to true to prevent overlap.
|
|
35
|
+
var isolatedBacklog = false
|
|
36
|
+
try {
|
|
37
|
+
// We only want to check the runtime configuration for `isolatedBacklog` if the event emitter belongs to a feature.
|
|
38
|
+
// For feature event emitters, the debugId will be an agentIdentifier with a length of 16. In contrast, some of our
|
|
39
|
+
// tests do not namespace the event emitter with an agentID and just use the parent (which has no ID).
|
|
40
|
+
isolatedBacklog = debugId.length !== 16 ? false : getRuntime(debugId).isolatedBacklog
|
|
41
|
+
} catch (err) {
|
|
42
|
+
// Do nothing for now.
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var emitter = {
|
|
46
|
+
on: addEventListener,
|
|
47
|
+
addEventListener: addEventListener,
|
|
48
|
+
removeEventListener: removeEventListener,
|
|
49
|
+
emit: emit,
|
|
50
|
+
get: getOrCreate,
|
|
51
|
+
listeners: listeners,
|
|
52
|
+
context: context,
|
|
53
|
+
buffer: bufferEventsByGroup,
|
|
54
|
+
abort,
|
|
55
|
+
aborted: false,
|
|
56
|
+
isBuffering: isBuffering,
|
|
57
|
+
debugId,
|
|
58
|
+
backlog: isolatedBacklog ? {} : old && typeof old.backlog === 'object' ? old.backlog : {}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return emitter
|
|
63
|
+
|
|
64
|
+
function context (contextOrStore) {
|
|
65
|
+
if (contextOrStore && contextOrStore instanceof EventContext) {
|
|
66
|
+
return contextOrStore
|
|
67
|
+
} else if (contextOrStore) {
|
|
68
|
+
return getOrSet(contextOrStore, ctxId, getNewContext)
|
|
69
|
+
} else {
|
|
70
|
+
return getNewContext()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function emit (type, args, contextOrStore, force, bubble) {
|
|
75
|
+
if (bubble !== false) bubble = true
|
|
76
|
+
if (globalInstance.aborted && !force) { return }
|
|
77
|
+
if (old && bubble) old.emit(type, args, contextOrStore)
|
|
78
|
+
|
|
79
|
+
var ctx = context(contextOrStore)
|
|
80
|
+
var handlersArray = listeners(type)
|
|
81
|
+
var len = handlersArray.length
|
|
82
|
+
|
|
83
|
+
// Apply each handler function in the order they were added
|
|
84
|
+
// to the context with the arguments
|
|
85
|
+
|
|
86
|
+
for (var i = 0; i < len; i++) handlersArray[i].apply(ctx, args)
|
|
87
|
+
|
|
88
|
+
// Buffer after emitting for consistent ordering
|
|
89
|
+
var bufferGroup = getBuffer()[bufferGroupMap[type]]
|
|
90
|
+
if (bufferGroup) {
|
|
91
|
+
bufferGroup.push([emitter, type, args, ctx])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Return the context so that the module that emitted can see what was done.
|
|
95
|
+
return ctx
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function addEventListener (type, fn) {
|
|
99
|
+
// Retrieve type from handlers, if it doesn't exist assign the default and retrieve it.
|
|
100
|
+
handlers[type] = listeners(type).concat(fn)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function removeEventListener (type, fn) {
|
|
104
|
+
var listeners = handlers[type]
|
|
105
|
+
if (!listeners) return
|
|
106
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
107
|
+
if (listeners[i] === fn) {
|
|
108
|
+
listeners.splice(i, 1)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function listeners (type) {
|
|
114
|
+
return handlers[type] || []
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getOrCreate (name) {
|
|
118
|
+
return (emitters[name] = emitters[name] || ee(emitter, name))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function bufferEventsByGroup (types, group) {
|
|
122
|
+
var eventBuffer = getBuffer()
|
|
123
|
+
|
|
124
|
+
// do not buffer events if agent has been aborted
|
|
125
|
+
if (emitter.aborted) return
|
|
126
|
+
mapOwn(types, function (i, type) {
|
|
127
|
+
group = group || 'feature'
|
|
128
|
+
bufferGroupMap[type] = group
|
|
129
|
+
if (!(group in eventBuffer)) {
|
|
130
|
+
eventBuffer[group] = []
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function isBuffering (type) {
|
|
136
|
+
var bufferGroup = getBuffer()[bufferGroupMap[type]]
|
|
137
|
+
return !!bufferGroup
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// buffer is associated with a base emitter, since there are two
|
|
141
|
+
// (global and scoped to the current bundle), it is now part of the emitter
|
|
142
|
+
function getBuffer () {
|
|
143
|
+
return emitter.backlog
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// get context object from store object, or create if does not exist
|
|
148
|
+
export function getOrSetContext (obj) {
|
|
149
|
+
return getOrSet(obj, ctxId, getNewContext)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getNewContext () {
|
|
153
|
+
return new EventContext()
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function abort () {
|
|
157
|
+
globalInstance.aborted = true
|
|
158
|
+
globalInstance.backlog = {}
|
|
159
|
+
}
|