@newrelic/browser-agent 1.234.0 → 1.236.0
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 +42 -2
- package/dist/cjs/common/config/state/init.js +3 -0
- package/dist/cjs/common/config/state/runtime.js +4 -4
- package/dist/cjs/common/constants/env.cdn.js +2 -2
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +52 -0
- package/dist/cjs/common/constants/shared-channel.js +19 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +3 -3
- package/dist/cjs/common/harvest/harvest-scheduler.js +35 -16
- package/dist/cjs/common/harvest/harvest.js +163 -144
- package/dist/cjs/common/harvest/types.js +54 -0
- package/dist/cjs/common/ids/id.js +2 -2
- package/dist/cjs/common/ids/unique-id.js +3 -3
- package/dist/cjs/common/session/session-entity.js +21 -13
- package/dist/cjs/common/timer/interaction-timer.js +3 -3
- package/dist/cjs/common/unload/eol.js +10 -11
- package/dist/cjs/common/url/canonicalize-url.js +2 -2
- package/dist/cjs/common/url/parse-url.js +3 -3
- package/dist/cjs/common/url/protocol.js +2 -2
- package/dist/cjs/common/util/feature-flags.js +23 -12
- package/dist/cjs/common/util/obfuscate.js +2 -2
- package/dist/cjs/common/util/submit-data.js +61 -79
- package/dist/cjs/common/window/nreum.js +14 -14
- package/dist/cjs/common/wrap/wrap-events.js +3 -3
- package/dist/cjs/common/wrap/wrap-fetch.js +5 -5
- package/dist/cjs/common/wrap/wrap-history.js +2 -2
- package/dist/cjs/common/wrap/wrap-jsonp.js +2 -2
- package/dist/cjs/common/wrap/wrap-mutation.js +2 -2
- package/dist/cjs/common/wrap/wrap-promise.js +2 -2
- package/dist/cjs/common/wrap/wrap-raf.js +3 -3
- package/dist/cjs/common/wrap/wrap-timer.js +5 -5
- package/dist/cjs/common/wrap/wrap-xhr.js +3 -3
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +2 -2
- package/dist/cjs/features/ajax/instrument/index.js +6 -7
- package/dist/cjs/features/jserrors/aggregate/index.js +11 -4
- package/dist/cjs/features/jserrors/instrument/index.js +6 -19
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +2 -2
- package/dist/cjs/features/metrics/aggregate/index.js +3 -3
- package/dist/cjs/features/page_action/aggregate/index.js +3 -3
- package/dist/cjs/features/page_view_event/aggregate/index.js +10 -11
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -2
- package/dist/cjs/features/page_view_timing/aggregate/index.js +3 -5
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +99 -82
- package/dist/cjs/features/session_replay/replay-mode.js +28 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +222 -99
- package/dist/cjs/features/session_trace/constants.js +1 -3
- package/dist/cjs/features/session_trace/instrument/index.js +2 -18
- package/dist/cjs/features/spa/aggregate/index.js +1 -1
- package/dist/cjs/features/spa/constants.js +0 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -2
- package/dist/cjs/features/utils/agent-session.js +20 -36
- package/dist/cjs/features/utils/aggregate-base.js +7 -12
- package/dist/cjs/features/utils/handler-cache.js +28 -23
- package/dist/cjs/features/utils/instrument-base.js +58 -40
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/loaders/agent.js +7 -1
- package/dist/cjs/loaders/api/api.js +2 -2
- package/dist/cjs/loaders/api/apiAsync.js +6 -4
- package/dist/cjs/loaders/configure/configure.js +2 -2
- package/dist/cjs/loaders/features/featureDependencies.js +2 -0
- package/dist/cjs/loaders/micro-agent.js +29 -38
- package/dist/esm/common/config/state/init.js +3 -0
- package/dist/esm/common/config/state/runtime.js +1 -1
- package/dist/esm/common/constants/env.cdn.js +2 -2
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +38 -0
- package/dist/esm/common/constants/shared-channel.js +12 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +1 -1
- package/dist/esm/common/harvest/harvest-scheduler.js +34 -17
- package/dist/esm/common/harvest/harvest.js +160 -142
- package/dist/esm/common/harvest/types.js +47 -0
- package/dist/esm/common/ids/id.js +1 -1
- package/dist/esm/common/ids/unique-id.js +1 -1
- package/dist/esm/common/session/session-entity.js +18 -12
- package/dist/esm/common/timer/interaction-timer.js +2 -2
- package/dist/esm/common/unload/eol.js +1 -2
- package/dist/esm/common/url/canonicalize-url.js +1 -1
- package/dist/esm/common/url/parse-url.js +1 -1
- package/dist/esm/common/url/protocol.js +1 -1
- package/dist/esm/common/util/feature-flags.js +23 -12
- package/dist/esm/common/util/obfuscate.js +2 -2
- package/dist/esm/common/util/submit-data.js +58 -76
- package/dist/esm/common/window/nreum.js +1 -1
- package/dist/esm/common/wrap/wrap-events.js +1 -1
- package/dist/esm/common/wrap/wrap-fetch.js +1 -1
- package/dist/esm/common/wrap/wrap-history.js +1 -1
- package/dist/esm/common/wrap/wrap-jsonp.js +1 -1
- package/dist/esm/common/wrap/wrap-mutation.js +1 -1
- package/dist/esm/common/wrap/wrap-promise.js +1 -1
- package/dist/esm/common/wrap/wrap-raf.js +2 -2
- package/dist/esm/common/wrap/wrap-timer.js +2 -2
- package/dist/esm/common/wrap/wrap-xhr.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +1 -2
- package/dist/esm/features/jserrors/aggregate/index.js +10 -3
- package/dist/esm/features/jserrors/instrument/index.js +3 -16
- package/dist/esm/features/metrics/aggregate/framework-detection.js +1 -1
- package/dist/esm/features/metrics/aggregate/index.js +1 -1
- package/dist/esm/features/page_action/aggregate/index.js +1 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +1 -2
- package/dist/esm/features/page_view_event/instrument/index.js +1 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +2 -4
- package/dist/esm/features/page_view_timing/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/aggregate/index.js +92 -78
- package/dist/esm/features/session_replay/replay-mode.js +23 -0
- package/dist/esm/features/session_trace/aggregate/index.js +223 -100
- package/dist/esm/features/session_trace/constants.js +0 -1
- package/dist/esm/features/session_trace/instrument/index.js +2 -18
- package/dist/esm/features/spa/aggregate/index.js +1 -1
- package/dist/esm/features/spa/constants.js +0 -1
- package/dist/esm/features/spa/instrument/index.js +1 -1
- package/dist/esm/features/utils/agent-session.js +21 -37
- package/dist/esm/features/utils/aggregate-base.js +7 -12
- package/dist/esm/features/utils/handler-cache.js +28 -23
- package/dist/esm/features/utils/instrument-base.js +57 -39
- package/dist/esm/index.js +1 -4
- package/dist/esm/loaders/agent.js +7 -1
- package/dist/esm/loaders/api/api.js +2 -2
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/configure/configure.js +1 -1
- package/dist/esm/loaders/features/featureDependencies.js +2 -0
- package/dist/esm/loaders/micro-agent.js +29 -38
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +29 -0
- package/dist/types/common/constants/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/shared-channel.d.ts +5 -0
- package/dist/types/common/constants/shared-channel.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts +5 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +49 -38
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/harvest/types.d.ts +100 -0
- package/dist/types/common/harvest/types.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +9 -5
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/unload/eol.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts +1 -0
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts +62 -64
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +2 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +14 -5
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/replay-mode.d.ts +9 -0
- package/dist/types/features/session_replay/replay-mode.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +21 -3
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/constants.d.ts +0 -1
- package/dist/types/features/session_trace/constants.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts +0 -2
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/features/spa/constants.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +6 -1
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/handler-cache.d.ts +12 -11
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts +17 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/loaders/agent.d.ts +4 -4
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts +3 -4
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +14 -7
- package/src/common/config/__mocks__/config.js +11 -0
- package/src/common/config/state/init.js +1 -0
- package/src/common/config/state/runtime.js +1 -1
- package/src/common/constants/__mocks__/env.js +3 -0
- package/src/common/constants/__mocks__/runtime.js +8 -0
- package/src/common/constants/env.cdn.test.js +7 -0
- package/src/common/constants/env.npm.test.js +7 -0
- package/src/common/constants/env.test.js +7 -0
- package/src/common/constants/runtime.js +71 -0
- package/src/common/constants/runtime.test.js +168 -0
- package/src/common/constants/shared-channel.js +13 -0
- package/src/common/context/__mocks__/shared-context.js +8 -0
- package/src/common/event-listener/__mocks__/event-listener-opts.js +7 -0
- package/src/common/event-listener/event-listener-opts.js +1 -1
- package/src/common/harvest/__mocks__/harvest.js +13 -0
- package/src/common/harvest/harvest-scheduler.js +31 -19
- package/src/common/harvest/harvest-scheduler.test.js +491 -20
- package/src/common/harvest/harvest.js +147 -130
- package/src/common/harvest/harvest.test.js +788 -139
- package/src/common/harvest/types.js +47 -0
- package/src/common/ids/id.js +1 -1
- package/src/common/ids/unique-id.js +1 -1
- package/src/common/session/__mocks__/session-entity.js +25 -0
- package/src/common/session/{session-entity.test.js → session-entity.component-test.js} +71 -48
- package/src/common/session/session-entity.js +16 -13
- package/src/common/timer/interaction-timer.js +2 -2
- package/src/common/timing/__mocks__/now.js +1 -0
- package/src/common/unload/__mocks__/eol.js +1 -0
- package/src/common/unload/eol.js +1 -2
- package/src/common/url/__mocks__/clean-url.js +1 -0
- package/src/common/url/__mocks__/encode.js +7 -0
- package/src/common/url/__mocks__/location.js +1 -0
- package/src/common/url/canonicalize-url.js +1 -1
- package/src/common/url/canonicalize-url.test.js +32 -21
- package/src/common/url/parse-url.js +1 -1
- package/src/common/url/parse-url.test.js +3 -3
- package/src/common/url/protocol.js +1 -1
- package/src/common/util/__mocks__/obfuscate.js +10 -0
- package/src/common/util/__mocks__/stringify.js +1 -0
- package/src/common/util/__mocks__/submit-data.js +6 -0
- package/src/common/util/__mocks__/traverse.js +1 -0
- package/src/common/util/data-size.test.js +27 -20
- package/src/common/util/feature-flags.js +24 -12
- package/src/common/util/feature-flags.test.js +98 -0
- package/src/common/util/obfuscate.component-test.js +173 -0
- package/src/common/util/obfuscate.js +2 -2
- package/src/common/util/submit-data.js +42 -56
- package/src/common/util/submit-data.test.js +158 -137
- package/src/common/window/nreum.js +1 -1
- package/src/common/wrap/wrap-events.js +1 -1
- package/src/common/wrap/wrap-fetch.js +1 -1
- package/src/common/wrap/wrap-history.js +1 -1
- package/src/common/wrap/wrap-jsonp.js +1 -1
- package/src/common/wrap/wrap-mutation.js +1 -1
- package/src/common/wrap/wrap-promise.js +1 -1
- package/src/common/wrap/wrap-promise.test.js +2 -2
- package/src/common/wrap/wrap-raf.js +2 -2
- package/src/common/wrap/wrap-timer.js +2 -2
- package/src/common/wrap/wrap-xhr.js +1 -1
- package/src/features/ajax/aggregate/index.js +1 -1
- package/src/features/ajax/instrument/distributed-tracing.js +1 -1
- package/src/features/ajax/instrument/index.js +1 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +1 -1
- package/src/features/jserrors/aggregate/index.js +12 -3
- package/src/features/jserrors/instrument/index.js +3 -16
- package/src/features/metrics/aggregate/framework-detection.js +1 -1
- package/src/features/metrics/aggregate/framework-detection.test.js +2 -2
- package/src/features/metrics/aggregate/index.js +1 -1
- package/src/features/page_action/aggregate/index.js +1 -1
- package/src/features/page_view_event/aggregate/index.js +1 -2
- package/src/features/page_view_event/instrument/index.js +1 -1
- package/src/features/page_view_timing/aggregate/index.js +2 -4
- package/src/features/page_view_timing/instrument/index.js +1 -1
- package/src/features/session_replay/aggregate/index.component-test.js +368 -0
- package/src/features/session_replay/aggregate/index.js +96 -71
- package/src/features/session_replay/instrument/index.js +0 -1
- package/src/features/session_replay/replay-mode.js +23 -0
- package/src/features/session_trace/aggregate/index.js +198 -79
- package/src/features/session_trace/constants.js +0 -1
- package/src/features/session_trace/instrument/index.js +3 -20
- package/src/features/spa/aggregate/index.js +1 -1
- package/src/features/spa/constants.js +0 -1
- package/src/features/spa/instrument/index.js +1 -1
- package/src/features/utils/agent-session.js +22 -34
- package/src/features/utils/agent-session.test.js +194 -0
- package/src/features/utils/aggregate-base.js +12 -9
- package/src/features/utils/aggregate-base.test.js +122 -0
- package/src/features/utils/feature-base.test.js +45 -0
- package/src/features/utils/handler-cache.js +29 -23
- package/src/features/utils/handler-cache.test.js +72 -0
- package/src/features/utils/instrument-base.js +45 -29
- package/src/features/utils/instrument-base.test.js +209 -0
- package/src/features/utils/lazy-feature-loader.test.js +37 -0
- package/src/index.js +1 -3
- package/src/loaders/agent.js +8 -1
- package/src/loaders/api/api.js +2 -2
- package/src/loaders/api/apiAsync.js +3 -3
- package/src/loaders/configure/configure.js +1 -1
- package/src/loaders/features/featureDependencies.js +2 -0
- package/src/loaders/micro-agent.js +26 -30
- package/dist/cjs/common/browser-version/firefox-version.js +0 -17
- package/dist/cjs/common/browser-version/ios-version.js +0 -19
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +0 -282
- package/dist/cjs/common/event-emitter/handle.test.js +0 -58
- package/dist/cjs/common/event-emitter/register-handler.test.js +0 -55
- package/dist/cjs/common/harvest/harvest-scheduler.test.js +0 -39
- package/dist/cjs/common/harvest/harvest.test.js +0 -224
- package/dist/cjs/common/ids/id.test.js +0 -85
- package/dist/cjs/common/ids/unique-id.test.js +0 -49
- package/dist/cjs/common/session/session-entity.test.js +0 -460
- package/dist/cjs/common/storage/local-memory.js +0 -35
- package/dist/cjs/common/storage/local-memory.test.js +0 -20
- package/dist/cjs/common/storage/local-storage.test.js +0 -14
- package/dist/cjs/common/timer/interaction-timer.test.js +0 -216
- package/dist/cjs/common/timer/timer.test.js +0 -105
- package/dist/cjs/common/timing/nav-timing.test.js +0 -192
- package/dist/cjs/common/url/canonicalize-url.test.js +0 -42
- package/dist/cjs/common/url/clean-url.test.js +0 -9
- package/dist/cjs/common/url/encode.test.js +0 -74
- package/dist/cjs/common/url/location.test.js +0 -13
- package/dist/cjs/common/url/parse-url.test.js +0 -111
- package/dist/cjs/common/url/protocol.test.js +0 -15
- package/dist/cjs/common/util/console.test.js +0 -30
- package/dist/cjs/common/util/data-size.test.js +0 -47
- package/dist/cjs/common/util/get-or-set.test.js +0 -47
- package/dist/cjs/common/util/global-scope.js +0 -58
- package/dist/cjs/common/util/invoke.test.js +0 -49
- package/dist/cjs/common/util/map-own.test.js +0 -49
- package/dist/cjs/common/util/stringify.test.js +0 -48
- package/dist/cjs/common/util/submit-data.test.js +0 -221
- package/dist/cjs/common/util/traverse.test.js +0 -44
- package/dist/cjs/common/wrap/wrap-promise.test.js +0 -119
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +0 -31
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +0 -383
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +0 -40
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +0 -27
- package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +0 -137
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -17
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +0 -165
- package/dist/cjs/features/spa/aggregate/interaction-node.test.js +0 -16
- package/dist/esm/common/browser-version/firefox-version.js +0 -10
- package/dist/esm/common/browser-version/ios-version.js +0 -11
- package/dist/esm/common/event-emitter/contextual-ee.test.js +0 -278
- package/dist/esm/common/event-emitter/handle.test.js +0 -54
- package/dist/esm/common/event-emitter/register-handler.test.js +0 -51
- package/dist/esm/common/harvest/harvest-scheduler.test.js +0 -37
- package/dist/esm/common/harvest/harvest.test.js +0 -222
- package/dist/esm/common/ids/id.test.js +0 -81
- package/dist/esm/common/ids/unique-id.test.js +0 -44
- package/dist/esm/common/session/session-entity.test.js +0 -458
- package/dist/esm/common/storage/local-memory.js +0 -28
- package/dist/esm/common/storage/local-memory.test.js +0 -18
- package/dist/esm/common/storage/local-storage.test.js +0 -12
- package/dist/esm/common/timer/interaction-timer.test.js +0 -214
- package/dist/esm/common/timer/timer.test.js +0 -103
- package/dist/esm/common/timing/nav-timing.test.js +0 -190
- package/dist/esm/common/url/canonicalize-url.test.js +0 -38
- package/dist/esm/common/url/clean-url.test.js +0 -7
- package/dist/esm/common/url/encode.test.js +0 -70
- package/dist/esm/common/url/location.test.js +0 -11
- package/dist/esm/common/url/parse-url.test.js +0 -107
- package/dist/esm/common/url/protocol.test.js +0 -13
- package/dist/esm/common/util/console.test.js +0 -28
- package/dist/esm/common/util/data-size.test.js +0 -45
- package/dist/esm/common/util/get-or-set.test.js +0 -45
- package/dist/esm/common/util/global-scope.js +0 -45
- package/dist/esm/common/util/invoke.test.js +0 -47
- package/dist/esm/common/util/map-own.test.js +0 -47
- package/dist/esm/common/util/stringify.test.js +0 -46
- package/dist/esm/common/util/submit-data.test.js +0 -219
- package/dist/esm/common/util/traverse.test.js +0 -42
- package/dist/esm/common/wrap/wrap-promise.test.js +0 -115
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +0 -29
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +0 -379
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +0 -38
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +0 -25
- package/dist/esm/features/metrics/aggregate/framework-detection.test.js +0 -133
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -15
- package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +0 -163
- package/dist/esm/features/spa/aggregate/interaction-node.test.js +0 -14
- package/dist/types/common/browser-version/firefox-version.d.ts +0 -2
- package/dist/types/common/browser-version/firefox-version.d.ts.map +0 -1
- package/dist/types/common/browser-version/ios-version.d.ts +0 -3
- package/dist/types/common/browser-version/ios-version.d.ts.map +0 -1
- package/dist/types/common/storage/local-memory.d.ts +0 -8
- package/dist/types/common/storage/local-memory.d.ts.map +0 -1
- package/dist/types/common/util/global-scope.d.ts +0 -14
- package/dist/types/common/util/global-scope.d.ts.map +0 -1
- package/src/common/browser-version/firefox-version.js +0 -10
- package/src/common/browser-version/ios-version.js +0 -11
- package/src/common/storage/local-memory.js +0 -30
- package/src/common/storage/local-memory.test.js +0 -19
- package/src/common/util/global-scope.js +0 -49
- /package/src/common/timer/{interaction-timer.test.js → interaction-timer.component-test.js} +0 -0
- /package/src/common/url/{encode.test.js → encode.component-test.js} +0 -0
- /package/src/common/url/{protocol.test.js → protocol.component-test.js} +0 -0
|
@@ -8,49 +8,54 @@ export class HandlerCache {
|
|
|
8
8
|
#cache = [];
|
|
9
9
|
/** @private @type {Timeout} */
|
|
10
10
|
#settleTimer = setTimeout(() => this.#close(), 5000);
|
|
11
|
+
#noMoreChanges = false;
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* tell the handlerCache that its ok to immediately execute the callbacks that are triggered by the ee from this moment on
|
|
15
|
+
* and execute all the storage callbacks saved up in the handlerCache
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
17
18
|
#drain() {
|
|
18
19
|
this.#cache.forEach(h => h());
|
|
19
|
-
this.#
|
|
20
|
-
clearTimeout(this.#settleTimer);
|
|
20
|
+
this.#close();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
* tell the handlerCache not to execute any of the storage callbacks
|
|
25
|
+
* and wipe out all the storage callbacks saved up in the handlerCache
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
28
|
#close() {
|
|
29
|
-
this.#decision = false; // settle() & decide() cannot be used after close
|
|
30
29
|
this.#cache = [];
|
|
30
|
+
clearTimeout(this.#settleTimer);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
* Wrap callback functions with this method to defer their execution until a decision has been reached
|
|
35
|
+
* @param {Function} handler
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
38
|
settle(handler) {
|
|
39
39
|
if (this.#decision === false) return;else if (this.#decision === undefined) this.#cache.push(handler);else handler();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
* Make a decision about what to do with the cache of callbacks.
|
|
44
|
+
* --- if true: tell the handlerCache that its ok to immediately execute the callbacks that are triggered by the ee from this moment on
|
|
45
|
+
* and execute all the storage callbacks saved up in the handlerCache ---
|
|
46
|
+
* --- if false: tell the handlerCache not to execute any of the storage callbacks
|
|
47
|
+
* and wipe out all the storage callbacks saved up in the handlerCache
|
|
48
|
+
* @param {boolean} decision
|
|
49
|
+
*/
|
|
50
50
|
decide(decision) {
|
|
51
|
-
if (this.#
|
|
51
|
+
if (this.#noMoreChanges) return;
|
|
52
52
|
this.#decision = decision;
|
|
53
53
|
if (decision === false) this.#close();
|
|
54
54
|
if (decision === true) this.#drain();
|
|
55
55
|
}
|
|
56
|
+
permanentlyDecide(decision) {
|
|
57
|
+
if (this.#noMoreChanges) return;
|
|
58
|
+
this.decide(decision);
|
|
59
|
+
this.#noMoreChanges = true;
|
|
60
|
+
}
|
|
56
61
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { drain, registerDrain } from '../../common/drain/drain';
|
|
8
8
|
import { FeatureBase } from './feature-base';
|
|
9
9
|
import { onWindowLoad } from '../../common/window/load';
|
|
10
|
-
import {
|
|
10
|
+
import { isBrowserScope } from '../../common/constants/runtime';
|
|
11
11
|
import { warn } from '../../common/util/console';
|
|
12
12
|
import { FEATURE_NAMES } from '../../loaders/features/features';
|
|
13
13
|
import { getConfigurationValue } from '../../common/config/config';
|
|
@@ -29,11 +29,20 @@ export class InstrumentBase extends FeatureBase {
|
|
|
29
29
|
constructor(agentIdentifier, aggregator, featureName) {
|
|
30
30
|
let auto = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
31
31
|
super(agentIdentifier, aggregator, featureName);
|
|
32
|
-
this.hasAggregator = false;
|
|
33
32
|
this.auto = auto;
|
|
34
33
|
|
|
35
34
|
/** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */
|
|
36
35
|
this.abortHandler;
|
|
36
|
+
/**
|
|
37
|
+
* @type {Class} Holds the reference to the feature's aggregate module counterpart, if and after it has been initialized. This may not be assigned until after page loads!
|
|
38
|
+
* The only purpose of this for now is to expose it to the NREUM interface, as the feature's instrument instance is already exposed.
|
|
39
|
+
*/
|
|
40
|
+
this.featAggregate;
|
|
41
|
+
/**
|
|
42
|
+
* @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
|
|
43
|
+
* one another if there are inter-features dependencies.
|
|
44
|
+
*/
|
|
45
|
+
this.onAggregateImported;
|
|
37
46
|
if (auto) registerDrain(agentIdentifier, featureName);
|
|
38
47
|
}
|
|
39
48
|
|
|
@@ -43,65 +52,74 @@ export class InstrumentBase extends FeatureBase {
|
|
|
43
52
|
* @param {Object} [argsObjFromInstrument] - any values or references to pass down to aggregate
|
|
44
53
|
* @returns void
|
|
45
54
|
*/
|
|
46
|
-
importAggregator(
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
+
importAggregator() {
|
|
56
|
+
let argsObjFromInstrument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
if (this.featAggregate || !this.auto) return;
|
|
58
|
+
const enableSessionTracking = isBrowserScope && getConfigurationValue(this.agentIdentifier, 'privacy.cookies_enabled') === true;
|
|
59
|
+
let loadedSuccessfully, loadFailed;
|
|
60
|
+
this.onAggregateImported = new Promise(resolve => {
|
|
61
|
+
loadedSuccessfully = resolve;
|
|
62
|
+
});
|
|
55
63
|
const importLater = async () => {
|
|
56
|
-
|
|
57
|
-
* Note this try-catch differs from the one in Agent.start() in that it's placed later in a page's lifecycle and
|
|
58
|
-
* it's only responsible for aborting its one specific feature, rather than all.
|
|
59
|
-
*/
|
|
64
|
+
let session;
|
|
60
65
|
try {
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
if (enableSessionTracking) {
|
|
67
|
+
// would require some setup before certain features start
|
|
63
68
|
const {
|
|
64
69
|
setupAgentSession
|
|
65
|
-
} = await
|
|
70
|
+
} = await import( /* webpackChunkName: "session-manager" */'./agent-session');
|
|
66
71
|
session = setupAgentSession(this.agentIdentifier);
|
|
67
72
|
}
|
|
68
|
-
|
|
73
|
+
} catch (e) {
|
|
74
|
+
warn('A problem occurred when starting up session manager. This page will not start or extend any session.', e);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Note this try-catch differs from the one in Agent.start() in that it's placed later in a page's lifecycle and
|
|
79
|
+
* it's only responsible for aborting its one specific feature, rather than all.
|
|
80
|
+
*/
|
|
81
|
+
try {
|
|
82
|
+
if (!this.shouldImportAgg(this.featureName, session)) {
|
|
69
83
|
drain(this.agentIdentifier, this.featureName);
|
|
70
84
|
return;
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
// import and instantiate the aggregator chunk
|
|
74
86
|
const {
|
|
75
87
|
lazyFeatureLoader
|
|
76
88
|
} = await import( /* webpackChunkName: "lazy-feature-loader" */'./lazy-feature-loader');
|
|
77
89
|
const {
|
|
78
90
|
Aggregate
|
|
79
91
|
} = await lazyFeatureLoader(this.featureName, 'aggregate');
|
|
80
|
-
new Aggregate(this.agentIdentifier, this.aggregator, argsObjFromInstrument);
|
|
92
|
+
this.featAggregate = new Aggregate(this.agentIdentifier, this.aggregator, argsObjFromInstrument);
|
|
93
|
+
loadedSuccessfully(true);
|
|
81
94
|
} catch (e) {
|
|
82
|
-
warn("Downloading ".concat(this.featureName, " failed..."), e);
|
|
95
|
+
warn("Downloading and initializing ".concat(this.featureName, " failed..."), e);
|
|
83
96
|
this.abortHandler?.(); // undo any important alterations made to the page
|
|
84
97
|
// not supported yet but nice to do: "abort" this agent's EE for this feature specifically
|
|
98
|
+
loadedSuccessfully(false);
|
|
85
99
|
}
|
|
86
100
|
};
|
|
87
101
|
|
|
88
102
|
// For regular web pages, we want to wait and lazy-load the aggregator only after all page resources are loaded.
|
|
89
103
|
// Non-browser scopes (i.e. workers) have no `window.load` event, so the aggregator can be lazy-loaded immediately.
|
|
90
|
-
if (
|
|
104
|
+
if (!isBrowserScope) importLater();else onWindowLoad(() => importLater(), true);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Make a determination if an aggregate class should even be imported
|
|
109
|
+
* @param {string} featureName
|
|
110
|
+
* @param {SessionEntity} session
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
shouldImportAgg(featureName, session) {
|
|
114
|
+
// if this isnt the FIRST load of a session AND
|
|
115
|
+
// we are not actively recording SR... DO NOT run the aggregator
|
|
116
|
+
// session replay samples can only be decided on the first load of a session
|
|
117
|
+
// session replays can continue if in progress
|
|
118
|
+
if (featureName === FEATURE_NAMES.sessionReplay) {
|
|
119
|
+
if (getConfigurationValue(this.agentIdentifier, 'session_trace.enabled') === false) return false;
|
|
120
|
+
return !!session?.isNew || !!session?.state.sessionReplay;
|
|
121
|
+
}
|
|
122
|
+
// todo -- add case like above for session trace
|
|
123
|
+
return true;
|
|
91
124
|
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Make a determination if an aggregate class should even be imported
|
|
95
|
-
* @param {string} featureName
|
|
96
|
-
* @param {SessionEntity} session
|
|
97
|
-
* @returns
|
|
98
|
-
*/
|
|
99
|
-
function shouldImportAgg(featureName, session) {
|
|
100
|
-
// if this isnt the FIRST load of a session AND
|
|
101
|
-
// we are not actively recording SR... DO NOT run the aggregator
|
|
102
|
-
// session replay samples can only be decided on the first load of a session
|
|
103
|
-
// session replays can continue if in progress
|
|
104
|
-
if (featureName === FEATURE_NAMES.sessionReplay) return !!session?.isNew || !!session?.state.sessionReplayActive;
|
|
105
|
-
// todo -- add case like above for session trace
|
|
106
|
-
return true;
|
|
107
125
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export { Agent } from './loaders/agent';
|
|
2
2
|
export { BrowserAgent } from './loaders/browser-agent';
|
|
3
3
|
export { WorkerAgent } from './loaders/worker-agent';
|
|
4
|
-
|
|
5
|
-
/** IN-PROGRESS -- DOES NOT CURRENTLY WORK CORRECTLY */
|
|
6
|
-
// export { MicroAgent } from './loaders/micro-agent'
|
|
7
|
-
|
|
4
|
+
export { MicroAgent } from './loaders/micro-agent';
|
|
8
5
|
export { Ajax } from './features/ajax';
|
|
9
6
|
export { JSErrors } from './features/jserrors';
|
|
10
7
|
export { Metrics } from './features/metrics';
|
|
@@ -12,6 +12,7 @@ import { generateRandomHexString } from '../common/ids/unique-id';
|
|
|
12
12
|
import { getConfiguration, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
13
13
|
import { warn } from '../common/util/console';
|
|
14
14
|
import { stringify } from '../common/util/stringify';
|
|
15
|
+
import { globalScope } from '../common/constants/runtime';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A flexible class that may be used to compose an agent from a select subset of feature modules. In applications
|
|
@@ -20,13 +21,18 @@ import { stringify } from '../common/util/stringify';
|
|
|
20
21
|
export class Agent {
|
|
21
22
|
constructor(options) {
|
|
22
23
|
let agentIdentifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : generateRandomHexString(16);
|
|
24
|
+
if (!globalScope) {
|
|
25
|
+
// We could not determine the runtime environment. Short-circuite the agent here
|
|
26
|
+
// to avoid possible exceptions later that may cause issues with customer's application.
|
|
27
|
+
warn('Failed to initial the agent. Could not determine the runtime environment.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
23
30
|
this.agentIdentifier = agentIdentifier;
|
|
24
31
|
this.sharedAggregator = new Aggregator({
|
|
25
32
|
agentIdentifier: this.agentIdentifier
|
|
26
33
|
});
|
|
27
34
|
this.features = {};
|
|
28
35
|
this.desiredFeatures = new Set(options.features || []); // expected to be a list of static Instrument/InstrumentBase classes, see "spa.js" for example
|
|
29
|
-
|
|
30
36
|
// For Now... ALL agents must make the rum call whether the page_view_event feature was enabled or not.
|
|
31
37
|
// NR1 creates an index on the rum call, and if not seen for a few days, will remove the browser app!
|
|
32
38
|
// Future work is being planned to evaluate removing this behavior from the backend, but for now we must ensure this call is made
|
|
@@ -9,7 +9,7 @@ import { ee } from '../../common/event-emitter/contextual-ee';
|
|
|
9
9
|
import { now } from '../../common/timing/now';
|
|
10
10
|
import { drain, registerDrain } from '../../common/drain/drain';
|
|
11
11
|
import { onWindowLoad } from '../../common/window/load';
|
|
12
|
-
import {
|
|
12
|
+
import { isBrowserScope } from '../../common/constants/runtime';
|
|
13
13
|
import { warn } from '../../common/util/console';
|
|
14
14
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';
|
|
15
15
|
import { gosCDN } from '../../common/window/nreum';
|
|
@@ -149,7 +149,7 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
// theres no window.load event on non-browser scopes, lazy load immediately
|
|
152
|
-
if (
|
|
152
|
+
if (!isBrowserScope) lazyLoad();
|
|
153
153
|
// try to stay out of the way of the window.load event, lazy load once that has finished.
|
|
154
154
|
else onWindowLoad(() => lazyLoad(), true);
|
|
155
155
|
function lazyLoad() {
|
|
@@ -4,8 +4,8 @@ import { ee } from '../../common/event-emitter/contextual-ee';
|
|
|
4
4
|
import { handle } from '../../common/event-emitter/handle';
|
|
5
5
|
import { registerHandler } from '../../common/event-emitter/register-handler';
|
|
6
6
|
import { single } from '../../common/util/invoke';
|
|
7
|
-
import
|
|
8
|
-
import { isBrowserScope } from '../../common/
|
|
7
|
+
import * as submitData from '../../common/util/submit-data';
|
|
8
|
+
import { isBrowserScope } from '../../common/constants/runtime';
|
|
9
9
|
import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';
|
|
10
10
|
export function setAPI(agentIdentifier) {
|
|
11
11
|
var instanceEE = ee.get(agentIdentifier);
|
|
@@ -76,7 +76,7 @@ export function setAPI(agentIdentifier) {
|
|
|
76
76
|
url += 'dc=' + ~~dom_time + '&';
|
|
77
77
|
url += 'fe=' + ~~fe_time + '&';
|
|
78
78
|
url += 'c=' + cycle;
|
|
79
|
-
submitData.
|
|
79
|
+
submitData.xhr({
|
|
80
80
|
url
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -2,7 +2,7 @@ import { setAPI, setTopLevelCallers } from '../api/api';
|
|
|
2
2
|
import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum';
|
|
3
3
|
import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config';
|
|
4
4
|
import { activateFeatures, activatedFeatures } from '../../common/util/feature-flags';
|
|
5
|
-
import { isWorkerScope } from '../../common/
|
|
5
|
+
import { isWorkerScope } from '../../common/constants/runtime';
|
|
6
6
|
export function configure(agentIdentifier) {
|
|
7
7
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
8
|
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -5,6 +5,8 @@ export function getFeatureDependencyNames(feature) {
|
|
|
5
5
|
return [FEATURE_NAMES.jserrors];
|
|
6
6
|
case FEATURE_NAMES.sessionTrace:
|
|
7
7
|
return [FEATURE_NAMES.ajax, FEATURE_NAMES.pageViewEvent];
|
|
8
|
+
case FEATURE_NAMES.sessionReplay:
|
|
9
|
+
return [FEATURE_NAMES.sessionTrace];
|
|
8
10
|
case FEATURE_NAMES.pageViewTiming:
|
|
9
11
|
return [FEATURE_NAMES.pageViewEvent];
|
|
10
12
|
// this could change if we disconnect window load timings
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// loader files
|
|
2
|
+
import { Instrument as PVE } from '../features/page_view_event/instrument';
|
|
2
3
|
import { getEnabledFeatures } from './features/enabled-features';
|
|
3
4
|
import { configure } from './configure/configure';
|
|
4
5
|
// core files
|
|
@@ -8,14 +9,13 @@ import { generateRandomHexString } from '../common/ids/unique-id';
|
|
|
8
9
|
import { getConfiguration, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
9
10
|
import { FEATURE_NAMES } from './features/features';
|
|
10
11
|
import { warn } from '../common/util/console';
|
|
11
|
-
|
|
12
|
-
const
|
|
12
|
+
import { onWindowLoad } from '../common/window/load';
|
|
13
|
+
const nonAutoFeatures = [FEATURE_NAMES.jserrors, FEATURE_NAMES.pageAction, FEATURE_NAMES.metrics];
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* A minimal agent class designed to
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* instrumentations at runtime, and to report desired data, events, and errors programatically.
|
|
16
|
+
* A minimal agent class designed to only respond to manual user input. As such, this class does not
|
|
17
|
+
* automatically instrument. Instead, each MicroAgent instance will lazy load the required features and can support loading multiple instances on one page.
|
|
18
|
+
* Out of the box, it can manually handle and report Page View, Page Action, and Error events.
|
|
19
19
|
*/
|
|
20
20
|
export class MicroAgent {
|
|
21
21
|
/**
|
|
@@ -48,38 +48,29 @@ export class MicroAgent {
|
|
|
48
48
|
start() {
|
|
49
49
|
try {
|
|
50
50
|
const enabledFeatures = getEnabledFeatures(this.agentIdentifier);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref3;
|
|
75
|
-
return lazyFeatureLoader(f, 'aggregate');
|
|
76
|
-
}).then(_ref4 => {
|
|
77
|
-
let {
|
|
78
|
-
Aggregate
|
|
79
|
-
} = _ref4;
|
|
80
|
-
this.features[f] = new Aggregate(this.agentIdentifier, this.sharedAggregator);
|
|
81
|
-
}).catch(err => warn('Something prevented the agent from being downloaded.'));
|
|
82
|
-
}
|
|
51
|
+
try {
|
|
52
|
+
// a biproduct of doing this is that the "session manager" is automatically handled through importing this feature
|
|
53
|
+
this.features.page_view_event = new PVE(this.agentIdentifier, this.sharedAggregator);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
warn('Something prevented the agent from instrumenting.', err);
|
|
56
|
+
}
|
|
57
|
+
onWindowLoad(() => {
|
|
58
|
+
// these features do not import an "instrument" file, meaning they are only hooked up to the API.
|
|
59
|
+
nonAutoFeatures.forEach(f => {
|
|
60
|
+
if (enabledFeatures[f]) {
|
|
61
|
+
import( /* webpackChunkName: "lazy-feature-loader" */'../features/utils/lazy-feature-loader').then(_ref => {
|
|
62
|
+
let {
|
|
63
|
+
lazyFeatureLoader
|
|
64
|
+
} = _ref;
|
|
65
|
+
return lazyFeatureLoader(f, 'aggregate');
|
|
66
|
+
}).then(_ref2 => {
|
|
67
|
+
let {
|
|
68
|
+
Aggregate
|
|
69
|
+
} = _ref2;
|
|
70
|
+
this.features[f] = new Aggregate(this.agentIdentifier, this.sharedAggregator);
|
|
71
|
+
}).catch(err => warn('Something prevented the agent from being downloaded.', err));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
83
74
|
});
|
|
84
75
|
gosNREUMInitializedAgents(this.agentIdentifier, this.features, 'features');
|
|
85
76
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAqEA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Contains constants about the environment the agent is running
|
|
3
|
+
* within. These values are derived at the time the agent is first loaded.
|
|
4
|
+
* @copyright 2023 New Relic Corporation. All rights reserved.
|
|
5
|
+
* @license Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Indicates if the agent is running within a normal browser window context.
|
|
9
|
+
*/
|
|
10
|
+
export const isBrowserScope: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates if the agent is running within a worker context.
|
|
13
|
+
*/
|
|
14
|
+
export const isWorkerScope: boolean;
|
|
15
|
+
export const globalScope: false | typeof globalThis;
|
|
16
|
+
export const initialLocation: string;
|
|
17
|
+
export const isiOS: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Shared Web Workers introduced in iOS 16.0+ and n/a in 15.6-
|
|
20
|
+
*
|
|
21
|
+
* It was discovered in Safari 14 (https://bugs.webkit.org/show_bug.cgi?id=225305) that the buffered flag in PerformanceObserver
|
|
22
|
+
* did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.
|
|
23
|
+
* This was fixed in v16+.
|
|
24
|
+
*/
|
|
25
|
+
export const iOS_below16: boolean;
|
|
26
|
+
export const ffVersion: number;
|
|
27
|
+
export const isIE: boolean;
|
|
28
|
+
export const supportsSendBeacon: true;
|
|
29
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,kCAAyE;AAEzE,+BAOI;AAEJ,2BAA2E;AAE3E,sCAAwD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-channel.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/shared-channel.js"],"names":[],"mappings":"AASA;;;GAGE"}
|
|
@@ -29,9 +29,13 @@ export class HarvestScheduler extends SharedContext {
|
|
|
29
29
|
customUrl: string;
|
|
30
30
|
};
|
|
31
31
|
started: boolean;
|
|
32
|
-
timeoutHandle:
|
|
32
|
+
timeoutHandle: any;
|
|
33
33
|
aborted: boolean;
|
|
34
34
|
harvest: Harvest;
|
|
35
|
+
/**
|
|
36
|
+
* This function is only meant for the last outgoing harvest cycle of a page. It trickles down to using sendBeacon, which should not be used
|
|
37
|
+
* to send payloads while the page is still active, due to limitations on how much data can be buffered in the API at any one time.
|
|
38
|
+
*/
|
|
35
39
|
unload(): void;
|
|
36
40
|
startTimer(interval: any, initialDelay: any): void;
|
|
37
41
|
interval: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAYA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM;QAES,UAAU;QACV,UAAU;QACZ,UAAU,EAAvB,MAAM;QACQ,GAAG,EAAjB,OAAO;QACM,SAAS,EAAtB,MAAM;oBAoBlB;IAfC,iBAAwB;IACxB;;;oBARW,MAAM;aACN,OAAO;mBACP,MAAM;MAMK;IACtB,iBAAoB;IACpB,mBAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAWhD;;;OAGG;IACH,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAUC;IAED,yCAgEC;IAED,gDAiBC;CACF;8BAjK6B,2BAA2B;wBACjC,WAAW"}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
key: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}[] | undefined;
|
|
11
|
-
}) => XMLHttpRequest) | (({ url }: {
|
|
12
|
-
url: string;
|
|
13
|
-
}) => HTMLImageElement) | (({ url, body }: {
|
|
14
|
-
url: string;
|
|
15
|
-
body?: string | undefined;
|
|
16
|
-
}) => boolean);
|
|
17
|
-
useBody: boolean;
|
|
18
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.js').NetworkSendSpec} NetworkSendSpec
|
|
3
|
+
* @typedef {import('./types.js').HarvestEndpointIdentifier} HarvestEndpointIdentifier
|
|
4
|
+
* @typedef {import('./types.js').HarvestPayload} HarvestPayload
|
|
5
|
+
* @typedef {import('./types.js').FeatureHarvestCallback} FeatureHarvestCallback
|
|
6
|
+
* @typedef {import('./types.js').FeatureHarvestCallbackOptions} FeatureHarvestCallbackOptions
|
|
7
|
+
*/
|
|
19
8
|
export class Harvest extends SharedContext {
|
|
20
9
|
tooManyRequestsDelay: any;
|
|
21
10
|
obfuscator: Obfuscator;
|
|
@@ -24,38 +13,60 @@ export class Harvest extends SharedContext {
|
|
|
24
13
|
/**
|
|
25
14
|
* Initiate a harvest from multiple sources. An event that corresponds to the endpoint
|
|
26
15
|
* name is emitted, which gives any listeners the opportunity to provide payload data.
|
|
16
|
+
* Note: Used by page_action
|
|
27
17
|
* @param {NetworkSendSpec} spec Specification for sending data
|
|
28
18
|
*/
|
|
29
|
-
sendX(spec
|
|
19
|
+
sendX(spec?: NetworkSendSpec): boolean;
|
|
30
20
|
/**
|
|
31
21
|
* Initiate a harvest call.
|
|
32
22
|
* @param {NetworkSendSpec} spec Specification for sending data
|
|
33
23
|
*/
|
|
34
|
-
send(spec
|
|
24
|
+
send(spec?: NetworkSendSpec): boolean;
|
|
35
25
|
/**
|
|
36
26
|
* Apply obfuscation rules to the payload and then initial the harvest network call.
|
|
37
27
|
* @param {NetworkSendSpec} spec Specification for sending data
|
|
38
28
|
*/
|
|
39
|
-
obfuscateAndSend(spec
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
includeBaseParams?: boolean | undefined;
|
|
49
|
-
}): any;
|
|
29
|
+
obfuscateAndSend(spec?: NetworkSendSpec): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Initiate a harvest call. Typically used by `sendX` and `send` methods or called directly
|
|
32
|
+
* for raw network calls.
|
|
33
|
+
* @param {NetworkSendSpec} param0 Specification for sending data
|
|
34
|
+
* @returns {boolean} True if the network call succeeded. For final harvest calls, the return
|
|
35
|
+
* value should not be relied upon because network calls will be made asynchronously.
|
|
36
|
+
*/
|
|
37
|
+
_send({ endpoint, payload, opts, submitMethod, cbFinished, customUrl, raw, includeBaseParams }: NetworkSendSpec): boolean;
|
|
50
38
|
baseQueryString(): string;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Calls and accumulates data from registered harvesting functions based on
|
|
41
|
+
* the endpoint being harvested.
|
|
42
|
+
* @param {HarvestEndpointIdentifier} endpoint BAM endpoint identifier.
|
|
43
|
+
* @param {FeatureHarvestCallbackOptions} options Options to be passed to the
|
|
44
|
+
* feature harvest listener callback.
|
|
45
|
+
* @returns {HarvestPayload} Payload object to transmit to the bam endpoint.
|
|
46
|
+
*/
|
|
47
|
+
createPayload(endpoint: HarvestEndpointIdentifier, options: FeatureHarvestCallbackOptions): HarvestPayload;
|
|
48
|
+
/**
|
|
49
|
+
* Cleans and returns a payload object containing a body and qs
|
|
50
|
+
* object with key/value pairs. KV pairs where the value is null,
|
|
51
|
+
* undefined, or an empty string are removed to save on transmission
|
|
52
|
+
* size.
|
|
53
|
+
* @param {HarvestPayload} payload Payload to be sent to the endpoint.
|
|
54
|
+
* @returns {HarvestPayload} Cleaned payload payload to be sent to the endpoint.
|
|
55
|
+
*/
|
|
56
|
+
cleanPayload(payload?: HarvestPayload): HarvestPayload;
|
|
57
|
+
/**
|
|
58
|
+
* Registers a function to be called when harvesting is triggered for a specific
|
|
59
|
+
* endpoint.
|
|
60
|
+
* @param {HarvestEndpointIdentifier} endpoint
|
|
61
|
+
* @param {FeatureHarvestCallback} listener
|
|
62
|
+
*/
|
|
63
|
+
on(endpoint: HarvestEndpointIdentifier, listener: FeatureHarvestCallback): void;
|
|
57
64
|
}
|
|
58
|
-
export type NetworkSendSpec =
|
|
65
|
+
export type NetworkSendSpec = import('./types.js').NetworkSendSpec;
|
|
66
|
+
export type HarvestEndpointIdentifier = import('./types.js').HarvestEndpointIdentifier;
|
|
67
|
+
export type HarvestPayload = import('./types.js').HarvestPayload;
|
|
68
|
+
export type FeatureHarvestCallback = import('./types.js').FeatureHarvestCallback;
|
|
69
|
+
export type FeatureHarvestCallbackOptions = import('./types.js').FeatureHarvestCallbackOptions;
|
|
59
70
|
import { SharedContext } from '../context/shared-context';
|
|
60
71
|
import { Obfuscator } from '../util/obfuscate';
|
|
61
72
|
//# sourceMappingURL=harvest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AAEH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAUzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CA8FnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAwB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAhQY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BATjC,2BAA2B;2BAF9B,mBAAmB"}
|