@newrelic/browser-agent 1.264.0 → 1.265.1
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/CHANGELOG.md +31 -0
- package/dist/cjs/common/aggregate/aggregator.js +1 -2
- package/dist/cjs/common/config/{state/configurable.js → configurable.js} +1 -1
- package/dist/cjs/common/config/{state/info.js → info.js} +1 -1
- package/dist/cjs/common/config/{state/init.js → init.js} +5 -5
- package/dist/cjs/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/dist/cjs/common/config/{state/runtime.js → runtime.js} +16 -5
- package/dist/cjs/common/constants/agent-constants.js +8 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/context/shared-context.js +1 -2
- package/dist/cjs/common/dispatch/global-event.js +1 -2
- package/dist/cjs/common/drain/drain.js +10 -16
- package/dist/cjs/common/event-emitter/contextual-ee.js +3 -4
- package/dist/cjs/common/event-listener/event-listener-opts.js +2 -6
- package/dist/cjs/common/harvest/harvest-scheduler.js +1 -2
- package/dist/cjs/common/harvest/harvest.js +29 -56
- package/dist/cjs/common/serialize/bel-serializer.js +6 -11
- package/dist/cjs/common/session/session-entity.js +9 -12
- package/dist/cjs/common/timing/nav-timing.js +1 -3
- package/dist/cjs/common/timing/time-keeper.js +16 -6
- package/dist/cjs/common/url/encode.js +2 -4
- package/dist/cjs/common/util/console.js +2 -0
- package/dist/cjs/common/util/invoke.js +6 -16
- package/dist/cjs/common/util/obfuscate.js +97 -53
- package/dist/cjs/common/util/submit-data.js +17 -20
- package/dist/cjs/common/util/text.js +9 -0
- package/dist/cjs/common/util/traverse.js +1 -3
- package/dist/cjs/common/vitals/cumulative-layout-shift.js +5 -6
- package/dist/cjs/common/vitals/first-contentful-paint.js +4 -5
- package/dist/cjs/common/vitals/first-input-delay.js +4 -5
- package/dist/cjs/common/vitals/interaction-to-next-paint.js +5 -6
- package/dist/cjs/common/vitals/largest-contentful-paint.js +4 -5
- package/dist/cjs/common/vitals/time-to-first-byte.js +4 -5
- package/dist/cjs/common/vitals/vital-metric.js +6 -8
- package/dist/cjs/common/window/nreum.js +2 -1
- package/dist/cjs/common/window/page-visibility.js +1 -4
- package/dist/cjs/common/wrap/wrap-events.js +1 -4
- package/dist/cjs/common/wrap/wrap-promise.js +1 -4
- package/dist/cjs/common/wrap/wrap-websocket.js +74 -0
- package/dist/cjs/features/ajax/aggregate/chunk.js +4 -3
- package/dist/cjs/features/ajax/aggregate/gql.js +4 -5
- package/dist/cjs/features/ajax/aggregate/index.js +20 -23
- package/dist/cjs/features/ajax/constants.js +2 -3
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +9 -8
- package/dist/cjs/features/ajax/instrument/index.js +15 -13
- package/dist/cjs/features/generic_events/aggregate/index.js +49 -58
- package/dist/cjs/features/generic_events/constants.js +4 -2
- package/dist/cjs/features/generic_events/instrument/index.js +7 -7
- package/dist/cjs/features/jserrors/aggregate/index.js +24 -44
- package/dist/cjs/features/jserrors/instrument/index.js +5 -5
- package/dist/cjs/features/logging/aggregate/index.js +34 -37
- package/dist/cjs/features/logging/constants.js +2 -3
- package/dist/cjs/features/logging/instrument/index.js +6 -7
- package/dist/cjs/features/logging/shared/log.js +1 -3
- package/dist/cjs/features/logging/shared/utils.js +2 -4
- package/dist/cjs/features/metrics/aggregate/index.js +37 -18
- package/dist/cjs/features/metrics/aggregate/websocket-detection.js +34 -0
- package/dist/cjs/features/metrics/constants.js +5 -1
- package/dist/cjs/features/metrics/instrument/index.js +16 -5
- package/dist/cjs/features/page_action/instrument/index.js +8 -4
- package/dist/cjs/features/page_view_event/aggregate/index.js +20 -40
- package/dist/cjs/features/page_view_event/instrument/index.js +5 -5
- package/dist/cjs/features/page_view_timing/aggregate/index.js +24 -40
- package/dist/cjs/features/page_view_timing/instrument/index.js +5 -5
- package/dist/cjs/features/session_replay/aggregate/index.js +37 -44
- package/dist/cjs/features/session_replay/constants.js +1 -5
- package/dist/cjs/features/session_replay/instrument/index.js +6 -10
- package/dist/cjs/features/session_replay/shared/recorder-events.js +25 -20
- package/dist/cjs/features/session_replay/shared/recorder.js +17 -13
- package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +3 -3
- package/dist/cjs/features/session_replay/shared/utils.js +5 -4
- package/dist/cjs/features/session_trace/aggregate/index.js +26 -43
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +7 -5
- package/dist/cjs/features/session_trace/instrument/index.js +9 -8
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +23 -31
- package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +2 -2
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +9 -10
- package/dist/cjs/features/soft_navigations/instrument/index.js +15 -14
- package/dist/cjs/features/spa/aggregate/index.js +17 -27
- package/dist/cjs/features/spa/aggregate/interaction.js +7 -6
- package/dist/cjs/features/spa/aggregate/serializer.js +3 -3
- package/dist/cjs/features/spa/constants.js +2 -2
- package/dist/cjs/features/spa/instrument/index.js +21 -20
- package/dist/cjs/features/utils/agent-session.js +6 -4
- package/dist/cjs/features/utils/aggregate-base.js +15 -10
- package/dist/cjs/features/utils/event-buffer.js +132 -0
- package/dist/cjs/features/utils/feature-gates.js +2 -2
- package/dist/cjs/features/utils/instrument-base.js +7 -8
- package/dist/cjs/features/utils/lazy-feature-loader.js +11 -11
- package/dist/cjs/features/utils/nr1-debugger.js +1 -3
- package/dist/cjs/loaders/agent-base.js +4 -8
- package/dist/cjs/loaders/agent.js +7 -2
- package/dist/cjs/loaders/api/api.js +22 -34
- package/dist/cjs/loaders/api/apiAsync.js +9 -12
- package/dist/cjs/loaders/configure/configure.js +12 -12
- package/dist/cjs/loaders/features/enabled-features.js +2 -2
- package/dist/cjs/loaders/micro-agent.js +15 -14
- package/dist/esm/common/aggregate/aggregator.js +1 -2
- package/dist/esm/common/config/{state/configurable.js → configurable.js} +1 -1
- package/dist/esm/common/config/{state/info.js → info.js} +1 -1
- package/dist/esm/common/config/{state/init.js → init.js} +5 -5
- package/dist/esm/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/dist/esm/common/config/{state/runtime.js → runtime.js} +17 -5
- package/dist/esm/common/constants/agent-constants.js +2 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/context/shared-context.js +1 -2
- package/dist/esm/common/dispatch/global-event.js +1 -2
- package/dist/esm/common/drain/drain.js +10 -16
- package/dist/esm/common/event-emitter/contextual-ee.js +2 -3
- package/dist/esm/common/event-listener/event-listener-opts.js +2 -6
- package/dist/esm/common/harvest/harvest-scheduler.js +1 -2
- package/dist/esm/common/harvest/harvest.js +21 -48
- package/dist/esm/common/serialize/bel-serializer.js +6 -11
- package/dist/esm/common/session/session-entity.js +8 -11
- package/dist/esm/common/timing/nav-timing.js +1 -3
- package/dist/esm/common/timing/time-keeper.js +15 -5
- package/dist/esm/common/url/encode.js +2 -4
- package/dist/esm/common/util/console.js +2 -0
- package/dist/esm/common/util/invoke.js +6 -16
- package/dist/esm/common/util/obfuscate.js +96 -49
- package/dist/esm/common/util/submit-data.js +17 -20
- package/dist/esm/common/util/text.js +3 -0
- package/dist/esm/common/util/traverse.js +1 -3
- package/dist/esm/common/vitals/cumulative-layout-shift.js +5 -6
- package/dist/esm/common/vitals/first-contentful-paint.js +4 -5
- package/dist/esm/common/vitals/first-input-delay.js +4 -5
- package/dist/esm/common/vitals/interaction-to-next-paint.js +5 -6
- package/dist/esm/common/vitals/largest-contentful-paint.js +4 -5
- package/dist/esm/common/vitals/time-to-first-byte.js +4 -5
- package/dist/esm/common/vitals/vital-metric.js +6 -8
- package/dist/esm/common/window/nreum.js +2 -1
- package/dist/esm/common/window/page-visibility.js +1 -4
- package/dist/esm/common/wrap/wrap-events.js +1 -4
- package/dist/esm/common/wrap/wrap-promise.js +1 -4
- package/dist/esm/common/wrap/wrap-websocket.js +67 -0
- package/dist/esm/features/ajax/aggregate/chunk.js +3 -2
- package/dist/esm/features/ajax/aggregate/gql.js +4 -5
- package/dist/esm/features/ajax/aggregate/index.js +17 -20
- package/dist/esm/features/ajax/constants.js +1 -2
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +2 -1
- package/dist/esm/features/ajax/instrument/index.js +11 -9
- package/dist/esm/features/generic_events/aggregate/index.js +41 -50
- package/dist/esm/features/generic_events/constants.js +3 -1
- package/dist/esm/features/generic_events/instrument/index.js +5 -5
- package/dist/esm/features/jserrors/aggregate/index.js +19 -39
- package/dist/esm/features/jserrors/instrument/index.js +4 -4
- package/dist/esm/features/logging/aggregate/index.js +32 -35
- package/dist/esm/features/logging/constants.js +1 -2
- package/dist/esm/features/logging/instrument/index.js +5 -6
- package/dist/esm/features/logging/shared/log.js +1 -3
- package/dist/esm/features/logging/shared/utils.js +2 -4
- package/dist/esm/features/metrics/aggregate/index.js +31 -12
- package/dist/esm/features/metrics/aggregate/websocket-detection.js +29 -0
- package/dist/esm/features/metrics/constants.js +4 -1
- package/dist/esm/features/metrics/instrument/index.js +15 -5
- package/dist/esm/features/page_action/instrument/index.js +7 -3
- package/dist/esm/features/page_view_event/aggregate/index.js +18 -38
- package/dist/esm/features/page_view_event/instrument/index.js +4 -4
- package/dist/esm/features/page_view_timing/aggregate/index.js +21 -37
- package/dist/esm/features/page_view_timing/instrument/index.js +4 -4
- package/dist/esm/features/session_replay/aggregate/index.js +27 -34
- package/dist/esm/features/session_replay/constants.js +0 -4
- package/dist/esm/features/session_replay/index.js +1 -7
- package/dist/esm/features/session_replay/instrument/index.js +6 -9
- package/dist/esm/features/session_replay/shared/recorder-events.js +25 -20
- package/dist/esm/features/session_replay/shared/recorder.js +14 -10
- package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +3 -3
- package/dist/esm/features/session_replay/shared/utils.js +3 -2
- package/dist/esm/features/session_trace/aggregate/index.js +21 -38
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +7 -5
- package/dist/esm/features/session_trace/instrument/index.js +6 -5
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +22 -30
- package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +7 -8
- package/dist/esm/features/soft_navigations/instrument/index.js +12 -11
- package/dist/esm/features/spa/aggregate/index.js +11 -21
- package/dist/esm/features/spa/aggregate/interaction.js +6 -5
- package/dist/esm/features/spa/aggregate/serializer.js +1 -1
- package/dist/esm/features/spa/constants.js +2 -2
- package/dist/esm/features/spa/instrument/index.js +13 -12
- package/dist/esm/features/utils/agent-session.js +3 -1
- package/dist/esm/features/utils/aggregate-base.js +13 -8
- package/dist/esm/features/utils/event-buffer.js +126 -0
- package/dist/esm/features/utils/feature-gates.js +1 -1
- package/dist/esm/features/utils/instrument-base.js +6 -7
- package/dist/esm/features/utils/lazy-feature-loader.js +11 -11
- package/dist/esm/features/utils/nr1-debugger.js +1 -3
- package/dist/esm/loaders/agent-base.js +4 -8
- package/dist/esm/loaders/agent.js +7 -2
- package/dist/esm/loaders/api/api.js +17 -29
- package/dist/esm/loaders/api/apiAsync.js +2 -5
- package/dist/esm/loaders/configure/configure.js +5 -5
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +10 -9
- package/dist/types/common/config/configurable.d.ts.map +1 -0
- package/dist/types/common/config/info.d.ts.map +1 -0
- package/dist/types/common/config/init.d.ts.map +1 -0
- package/dist/types/common/config/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/agent-constants.d.ts +3 -0
- package/dist/types/common/constants/agent-constants.d.ts.map +1 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +1 -7
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +9 -2
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts +78 -6
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/util/text.d.ts +2 -0
- package/dist/types/common/util/text.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-websocket.d.ts +4 -0
- package/dist/types/common/wrap/wrap-websocket.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/chunk.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -3
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/constants.d.ts +0 -1
- package/dist/types/features/ajax/constants.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts +6 -8
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/constants.d.ts +2 -0
- package/dist/types/features/generic_events/constants.d.ts.map +1 -1
- package/dist/types/features/generic_events/instrument/index.d.ts +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +4 -7
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/constants.d.ts +0 -1
- package/dist/types/features/logging/constants.d.ts.map +1 -1
- package/dist/types/features/logging/instrument/index.d.ts +1 -0
- package/dist/types/features/logging/instrument/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/websocket-detection.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/websocket-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_action/instrument/index.d.ts +4 -0
- package/dist/types/features/page_action/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_event/instrument/index.d.ts +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/instrument/index.d.ts +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/constants.d.ts +0 -4
- package/dist/types/features/session_replay/constants.d.ts.map +1 -1
- package/dist/types/features/session_replay/instrument/index.d.ts +1 -0
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder-events.d.ts +6 -6
- package/dist/types/features/session_replay/shared/recorder-events.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts +2 -2
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/utils.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/trace/storage.d.ts +1 -1
- package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/index.d.ts +3 -3
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/instrument/index.d.ts +1 -0
- package/dist/types/features/soft_navigations/instrument/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/spa/constants.d.ts.map +1 -1
- package/dist/types/features/spa/instrument/index.d.ts +1 -0
- package/dist/types/features/spa/instrument/index.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 +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/event-buffer.d.ts +72 -0
- package/dist/types/features/utils/event-buffer.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +1 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +55 -59
- package/src/common/config/__mocks__/info.js +3 -0
- package/src/common/config/__mocks__/init.js +3 -0
- package/src/common/config/__mocks__/loader-config.js +2 -0
- package/src/common/config/__mocks__/runtime.js +2 -0
- package/src/common/config/{state/configurable.js → configurable.js} +1 -1
- package/src/common/config/{state/info.js → info.js} +1 -1
- package/src/common/config/{state/init.js → init.js} +5 -5
- package/src/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/src/common/config/{state/runtime.js → runtime.js} +19 -5
- package/src/common/constants/agent-constants.js +2 -0
- package/src/common/drain/drain.js +5 -2
- package/src/common/event-emitter/contextual-ee.js +1 -1
- package/src/common/harvest/harvest.js +7 -21
- package/src/common/serialize/bel-serializer.js +5 -7
- package/src/common/session/session-entity.js +2 -2
- package/src/common/timing/__mocks__/time-keeper.js +6 -2
- package/src/common/timing/time-keeper.js +15 -5
- package/src/common/util/__mocks__/console.js +1 -0
- package/src/common/util/__mocks__/obfuscate.js +5 -8
- package/src/common/util/console.js +2 -0
- package/src/common/util/obfuscate.js +94 -50
- package/src/common/util/text.js +6 -0
- package/src/common/window/__mocks__/nreum.js +1 -1
- package/src/common/window/nreum.js +2 -1
- package/src/common/wrap/wrap-websocket.js +73 -0
- package/src/features/ajax/aggregate/chunk.js +3 -2
- package/src/features/ajax/aggregate/index.js +20 -19
- package/src/features/ajax/constants.js +0 -2
- package/src/features/ajax/instrument/distributed-tracing.js +2 -1
- package/src/features/ajax/instrument/index.js +9 -5
- package/src/features/generic_events/aggregate/index.js +43 -37
- package/src/features/generic_events/constants.js +2 -0
- package/src/features/generic_events/instrument/index.js +3 -1
- package/src/features/jserrors/aggregate/index.js +14 -4
- package/src/features/jserrors/instrument/index.js +2 -0
- package/src/features/logging/aggregate/index.js +39 -31
- package/src/features/logging/constants.js +0 -2
- package/src/features/logging/instrument/index.js +2 -0
- package/src/features/logging/shared/utils.js +1 -1
- package/src/features/metrics/aggregate/index.js +24 -9
- package/src/features/metrics/aggregate/websocket-detection.js +31 -0
- package/src/features/metrics/constants.js +3 -0
- package/src/features/metrics/instrument/index.js +13 -1
- package/src/features/page_action/instrument/index.js +5 -0
- package/src/features/page_view_event/aggregate/index.js +8 -23
- package/src/features/page_view_event/instrument/index.js +2 -0
- package/src/features/page_view_timing/aggregate/index.js +14 -16
- package/src/features/page_view_timing/instrument/index.js +2 -0
- package/src/features/session_replay/aggregate/index.js +13 -9
- package/src/features/session_replay/constants.js +0 -4
- package/src/features/session_replay/index.js +1 -7
- package/src/features/session_replay/instrument/index.js +3 -4
- package/src/features/session_replay/shared/recorder-events.js +27 -20
- package/src/features/session_replay/shared/recorder.js +13 -6
- package/src/features/session_replay/shared/stylesheet-evaluator.js +2 -2
- package/src/features/session_replay/shared/utils.js +3 -2
- package/src/features/session_trace/aggregate/index.js +16 -7
- package/src/features/session_trace/aggregate/trace/storage.js +6 -1
- package/src/features/session_trace/instrument/index.js +4 -1
- package/src/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/src/features/soft_navigations/aggregate/index.js +13 -15
- package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/src/features/soft_navigations/aggregate/interaction.js +1 -1
- package/src/features/soft_navigations/instrument/index.js +9 -5
- package/src/features/spa/aggregate/index.js +11 -18
- package/src/features/spa/aggregate/interaction.js +5 -3
- package/src/features/spa/aggregate/serializer.js +1 -1
- package/src/features/spa/constants.js +2 -2
- package/src/features/spa/instrument/index.js +9 -3
- package/src/features/utils/agent-session.js +3 -1
- package/src/features/utils/aggregate-base.js +10 -2
- package/src/features/utils/event-buffer.js +126 -0
- package/src/features/utils/feature-gates.js +1 -1
- package/src/features/utils/instrument-base.js +2 -1
- package/src/loaders/agent-base.js +2 -2
- package/src/loaders/agent.js +7 -2
- package/src/loaders/api/api.js +2 -1
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/configure/configure.js +4 -1
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/micro-agent.js +4 -1
- package/dist/cjs/common/config/config.js +0 -76
- package/dist/cjs/common/config/state/originals.js +0 -8
- package/dist/cjs/common/wrap/index.js +0 -61
- package/dist/esm/common/config/config.js +0 -11
- package/dist/esm/common/config/state/originals.js +0 -2
- package/dist/esm/common/wrap/index.js +0 -13
- package/dist/types/common/config/config.d.ts +0 -13
- package/dist/types/common/config/config.d.ts.map +0 -1
- package/dist/types/common/config/state/configurable.d.ts.map +0 -1
- package/dist/types/common/config/state/info.d.ts.map +0 -1
- package/dist/types/common/config/state/init.d.ts.map +0 -1
- package/dist/types/common/config/state/loader-config.d.ts.map +0 -1
- package/dist/types/common/config/state/originals.d.ts +0 -2
- package/dist/types/common/config/state/originals.d.ts.map +0 -1
- package/dist/types/common/config/state/runtime.d.ts.map +0 -1
- package/dist/types/common/wrap/index.d.ts +0 -10
- package/dist/types/common/wrap/index.d.ts.map +0 -1
- package/src/common/config/__mocks__/config.js +0 -11
- package/src/common/config/config.js +0 -12
- package/src/common/config/state/originals.js +0 -3
- package/src/common/wrap/index.js +0 -16
- /package/dist/types/common/config/{state/configurable.d.ts → configurable.d.ts} +0 -0
- /package/dist/types/common/config/{state/info.d.ts → info.d.ts} +0 -0
- /package/dist/types/common/config/{state/init.d.ts → init.d.ts} +0 -0
- /package/dist/types/common/config/{state/loader-config.d.ts → loader-config.d.ts} +0 -0
- /package/dist/types/common/config/{state/runtime.d.ts → runtime.d.ts} +0 -0
|
@@ -45,8 +45,7 @@ function fromArray(qs, maxBytes) {
|
|
|
45
45
|
function obj(payload, maxBytes) {
|
|
46
46
|
var total = 0;
|
|
47
47
|
var result = '';
|
|
48
|
-
Object.entries(payload || {}).forEach(
|
|
49
|
-
let [feature, dataArray] = _ref;
|
|
48
|
+
Object.entries(payload || {}).forEach(([feature, dataArray]) => {
|
|
50
49
|
var intermediate = [];
|
|
51
50
|
var next;
|
|
52
51
|
var i;
|
|
@@ -69,8 +68,7 @@ function obj(payload, maxBytes) {
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// Constructs an HTTP parameter to add to the BAM router URL
|
|
72
|
-
function param(name, value) {
|
|
73
|
-
let base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
71
|
+
function param(name, value, base = {}) {
|
|
74
72
|
if (Object.keys(base).includes(name)) return ''; // we assume if feature supplied a matching qp to the base, we should honor what the feature sent over the default
|
|
75
73
|
if (value && typeof value === 'string') {
|
|
76
74
|
return '&' + name + '=' + qs(value);
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.warn = warn;
|
|
7
|
+
/* eslint no-console: ["error", { allow: ["debug"] }] */
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* A helper method to warn to the console with New Relic: decoration
|
|
9
11
|
* @param {string} message The primary message to warn
|
|
@@ -27,18 +27,12 @@ exports.single = single;
|
|
|
27
27
|
* @returns {function} A wrapping function that will ensure the provided function
|
|
28
28
|
* is invoked only once within the given timeout.
|
|
29
29
|
*/
|
|
30
|
-
function debounce(func) {
|
|
31
|
-
var _this = this;
|
|
32
|
-
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
33
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
|
+
function debounce(func, timeout = 500, options = {}) {
|
|
34
31
|
const leading = options?.leading || false;
|
|
35
32
|
let timer;
|
|
36
|
-
return
|
|
37
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
-
args[_key] = arguments[_key];
|
|
39
|
-
}
|
|
33
|
+
return (...args) => {
|
|
40
34
|
if (leading && timer === undefined) {
|
|
41
|
-
func.apply(
|
|
35
|
+
func.apply(this, args);
|
|
42
36
|
timer = setTimeout(() => {
|
|
43
37
|
timer = clearTimeout(timer);
|
|
44
38
|
}, timeout);
|
|
@@ -46,7 +40,7 @@ function debounce(func) {
|
|
|
46
40
|
if (!leading) {
|
|
47
41
|
clearTimeout(timer);
|
|
48
42
|
timer = setTimeout(() => {
|
|
49
|
-
func.apply(
|
|
43
|
+
func.apply(this, args);
|
|
50
44
|
}, timeout);
|
|
51
45
|
}
|
|
52
46
|
};
|
|
@@ -61,15 +55,11 @@ function debounce(func) {
|
|
|
61
55
|
* is invoked only once.
|
|
62
56
|
*/
|
|
63
57
|
function single(func) {
|
|
64
|
-
var _this2 = this;
|
|
65
58
|
let called = false;
|
|
66
|
-
return
|
|
59
|
+
return (...args) => {
|
|
67
60
|
if (!called) {
|
|
68
61
|
called = true;
|
|
69
|
-
|
|
70
|
-
args[_key2] = arguments[_key2];
|
|
71
|
-
}
|
|
72
|
-
func.apply(_this2, args);
|
|
62
|
+
func.apply(this, args);
|
|
73
63
|
}
|
|
74
64
|
};
|
|
75
65
|
}
|
|
@@ -4,67 +4,111 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Obfuscator = void 0;
|
|
7
|
-
|
|
8
|
-
exports.validateRules = validateRules;
|
|
9
|
-
var _config = require("../config/config");
|
|
10
|
-
var _sharedContext = require("../context/shared-context");
|
|
7
|
+
var _init = require("../config/init");
|
|
11
8
|
var _protocol = require("../url/protocol");
|
|
12
9
|
var _console = require("./console");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Represents an obfuscation rule that can be applied to harvested payloads
|
|
12
|
+
* @typedef {object} ObfuscationRule
|
|
13
|
+
* @property {string|RegExp} regex The regular expression to match against in the payload
|
|
14
|
+
* @property {string} [replacement] The string to replace the matched regex with
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents an obfuscation rule validation state
|
|
19
|
+
* @typedef {object} ObfuscationRuleValidation
|
|
20
|
+
* @property {ObfuscationRule} rule The original rule validated
|
|
21
|
+
* @property {boolean} isValid Whether the rule is valid
|
|
22
|
+
* @property {object} errors Validation errors
|
|
23
|
+
* @property {boolean} errors.regexMissingDetected Whether the regex is missing
|
|
24
|
+
* @property {boolean} errors.invalidRegexDetected Whether the regex is invalid
|
|
25
|
+
* @property {boolean} errors.invalidReplacementDetected Whether the replacement is invalid
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
class Obfuscator {
|
|
29
|
+
/**
|
|
30
|
+
* @type {ObfuscationRuleValidation[]}
|
|
31
|
+
*/
|
|
32
|
+
#ruleValidationCache;
|
|
33
|
+
constructor(agentIdentifier) {
|
|
34
|
+
this.#ruleValidationCache = Obfuscator.getRuleValidationCache(agentIdentifier);
|
|
35
|
+
Obfuscator.logObfuscationRuleErrors(this.#ruleValidationCache);
|
|
36
|
+
}
|
|
37
|
+
get ruleValidationCache() {
|
|
38
|
+
return this.#ruleValidationCache;
|
|
20
39
|
}
|
|
21
40
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Applies all valid obfuscation rules to the provided input string
|
|
43
|
+
* @param {string} input String to obfuscate
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
obfuscateString(input) {
|
|
47
|
+
// if input is not of type string or is an empty string, short-circuit
|
|
48
|
+
if (typeof input !== 'string' || input.trim().length === 0) return input;
|
|
49
|
+
return this.#ruleValidationCache.filter(ruleValidation => ruleValidation.isValid).reduce((input, ruleValidation) => {
|
|
50
|
+
const {
|
|
51
|
+
rule
|
|
52
|
+
} = ruleValidation;
|
|
53
|
+
return input.replace(rule.regex, rule.replacement || '*');
|
|
54
|
+
}, input);
|
|
55
|
+
}
|
|
28
56
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Returns an array of obfuscation rules to be applied to harvested payloads
|
|
59
|
+
* @param {string} agentIdentifier The agent identifier to get rules for
|
|
60
|
+
* @returns {ObfuscationRuleValidation[]} The array of rules or validation states
|
|
61
|
+
*/
|
|
62
|
+
static getRuleValidationCache(agentIdentifier) {
|
|
63
|
+
/**
|
|
64
|
+
* @type {ObfuscationRule[]}
|
|
65
|
+
*/
|
|
66
|
+
let rules = (0, _init.getConfigurationValue)(agentIdentifier, 'obfuscate') || [];
|
|
67
|
+
if ((0, _protocol.isFileProtocol)()) {
|
|
68
|
+
rules.push({
|
|
69
|
+
regex: /^file:\/\/(.*)/,
|
|
70
|
+
replacement: atob('ZmlsZTovL09CRlVTQ0FURUQ=')
|
|
71
|
+
});
|
|
34
72
|
}
|
|
35
|
-
return
|
|
73
|
+
return rules.map(rule => Obfuscator.validateObfuscationRule(rule));
|
|
36
74
|
}
|
|
37
|
-
}
|
|
38
75
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Validates an obfuscation rule and provides errors if any are found.
|
|
78
|
+
* @param {ObfuscationRule} rule The rule to validate
|
|
79
|
+
* @returns {ObfuscationRuleValidation} The validation state of the rule
|
|
80
|
+
*/
|
|
81
|
+
static validateObfuscationRule(rule) {
|
|
82
|
+
const regexMissingDetected = Boolean(rule.regex === undefined);
|
|
83
|
+
const invalidRegexDetected = Boolean(rule.regex !== undefined && typeof rule.regex !== 'string' && !(rule.regex instanceof RegExp));
|
|
84
|
+
const invalidReplacementDetected = Boolean(rule.replacement && typeof rule.replacement !== 'string');
|
|
85
|
+
return {
|
|
86
|
+
rule,
|
|
87
|
+
isValid: !regexMissingDetected && !invalidRegexDetected && !invalidReplacementDetected,
|
|
88
|
+
errors: {
|
|
89
|
+
regexMissingDetected,
|
|
90
|
+
invalidRegexDetected,
|
|
91
|
+
invalidReplacementDetected
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
50
95
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
(0, _console.warn)(14);
|
|
66
|
-
invalidReplacementDetected = true;
|
|
96
|
+
/**
|
|
97
|
+
* Logs any obfuscation rule errors to the console. This is called when an obfuscator
|
|
98
|
+
* instance is created.
|
|
99
|
+
* @param {ObfuscationRuleValidation[]} ruleValidationCache The cache of rule validation states
|
|
100
|
+
*/
|
|
101
|
+
static logObfuscationRuleErrors(ruleValidationCache) {
|
|
102
|
+
for (const ruleValidation of ruleValidationCache) {
|
|
103
|
+
const {
|
|
104
|
+
rule,
|
|
105
|
+
isValid,
|
|
106
|
+
errors
|
|
107
|
+
} = ruleValidation;
|
|
108
|
+
if (isValid) continue;
|
|
109
|
+
if (errors.regexMissingDetected) (0, _console.warn)(12, rule);else if (errors.invalidRegexDetected) (0, _console.warn)(13, rule);
|
|
110
|
+
if (errors.invalidReplacementDetected) (0, _console.warn)(14, rule);
|
|
67
111
|
}
|
|
68
112
|
}
|
|
69
|
-
|
|
70
|
-
|
|
113
|
+
}
|
|
114
|
+
exports.Obfuscator = Obfuscator;
|
|
@@ -23,10 +23,9 @@ var _runtime = require("../constants/runtime");
|
|
|
23
23
|
* @param {boolean} opts.isFinalHarvest Indicates if the data submission is due to
|
|
24
24
|
* a final harvest within the agent.
|
|
25
25
|
*/
|
|
26
|
-
function getSubmitMethod(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
+
function getSubmitMethod({
|
|
27
|
+
isFinalHarvest = false
|
|
28
|
+
} = {}) {
|
|
30
29
|
return isFinalHarvest && _runtime.isBrowserScope && _runtime.supportsSendBeacon
|
|
31
30
|
// Use sendBeacon for final harvest
|
|
32
31
|
? beacon
|
|
@@ -44,17 +43,16 @@ function getSubmitMethod() {
|
|
|
44
43
|
* @param {{key: string, value: string}[]} [args.headers] - The headers to attach.
|
|
45
44
|
* @returns {XMLHttpRequest}
|
|
46
45
|
*/
|
|
47
|
-
function xhr(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref;
|
|
46
|
+
function xhr({
|
|
47
|
+
url,
|
|
48
|
+
body = null,
|
|
49
|
+
sync,
|
|
50
|
+
method = 'POST',
|
|
51
|
+
headers = [{
|
|
52
|
+
key: 'content-type',
|
|
53
|
+
value: 'text/plain'
|
|
54
|
+
}]
|
|
55
|
+
}) {
|
|
58
56
|
const request = new XMLHttpRequest();
|
|
59
57
|
request.open(method, url, !sync);
|
|
60
58
|
try {
|
|
@@ -77,11 +75,10 @@ function xhr(_ref) {
|
|
|
77
75
|
* @param {string=} args.body - The Stringified body
|
|
78
76
|
* @returns {boolean}
|
|
79
77
|
*/
|
|
80
|
-
function beacon(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = _ref2;
|
|
78
|
+
function beacon({
|
|
79
|
+
url,
|
|
80
|
+
body
|
|
81
|
+
}) {
|
|
85
82
|
try {
|
|
86
83
|
// Navigator has to be bound to ensure it does not error in some browsers
|
|
87
84
|
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toTitleCase = toTitleCase;
|
|
7
|
+
function toTitleCase(str, regex = /\w*/g) {
|
|
8
|
+
return str.replace(regex, text => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase());
|
|
9
|
+
}
|
|
@@ -18,9 +18,7 @@ exports.applyFnToProps = applyFnToProps;
|
|
|
18
18
|
* @param {Array<string>} [ignoreKeys=[]] - The keys of properties to ignore and not modify.
|
|
19
19
|
* @returns {Object} - The object with function recursively applied.
|
|
20
20
|
*/
|
|
21
|
-
function applyFnToProps(obj, fn) {
|
|
22
|
-
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'string';
|
|
23
|
-
let ignoreKeys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
21
|
+
function applyFnToProps(obj, fn, type = 'string', ignoreKeys = []) {
|
|
24
22
|
if (!obj || typeof obj !== 'object') return obj;
|
|
25
23
|
Object.keys(obj).forEach(property => {
|
|
26
24
|
if (typeof obj[property] === 'object') {
|
|
@@ -10,12 +10,11 @@ var _vitalMetric = require("./vital-metric");
|
|
|
10
10
|
var _runtime = require("../constants/runtime");
|
|
11
11
|
const cumulativeLayoutShift = exports.cumulativeLayoutShift = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.CUMULATIVE_LAYOUT_SHIFT, x => x);
|
|
12
12
|
if (_runtime.isBrowserScope) {
|
|
13
|
-
(0, _attribution.onCLS)(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
13
|
+
(0, _attribution.onCLS)(({
|
|
14
|
+
value,
|
|
15
|
+
attribution,
|
|
16
|
+
id
|
|
17
|
+
}) => {
|
|
19
18
|
const attrs = {
|
|
20
19
|
metricId: id,
|
|
21
20
|
largestShiftTarget: attribution.largestShiftTarget,
|
|
@@ -32,11 +32,10 @@ if (_runtime.isBrowserScope) {
|
|
|
32
32
|
// ignore
|
|
33
33
|
}
|
|
34
34
|
} else {
|
|
35
|
-
(0, _attribution.onFCP)(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _ref;
|
|
35
|
+
(0, _attribution.onFCP)(({
|
|
36
|
+
value,
|
|
37
|
+
attribution
|
|
38
|
+
}) => {
|
|
40
39
|
if (_runtime.initiallyHidden || firstContentfulPaint.isValid) return;
|
|
41
40
|
const attrs = {
|
|
42
41
|
timeToFirstByte: attribution.timeToFirstByte,
|
|
@@ -10,11 +10,10 @@ var _constants = require("./constants");
|
|
|
10
10
|
var _runtime = require("../constants/runtime");
|
|
11
11
|
const firstInputDelay = exports.firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
|
|
12
12
|
if (_runtime.isBrowserScope) {
|
|
13
|
-
(0, _attribution.onFID)(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
13
|
+
(0, _attribution.onFID)(({
|
|
14
|
+
value,
|
|
15
|
+
attribution
|
|
16
|
+
}) => {
|
|
18
17
|
if (_runtime.initiallyHidden || firstInputDelay.isValid) return;
|
|
19
18
|
const attrs = {
|
|
20
19
|
type: attribution.eventType,
|
|
@@ -11,12 +11,11 @@ var _runtime = require("../constants/runtime");
|
|
|
11
11
|
const interactionToNextPaint = exports.interactionToNextPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.INTERACTION_TO_NEXT_PAINT);
|
|
12
12
|
if (_runtime.isBrowserScope) {
|
|
13
13
|
/* Interaction-to-Next-Paint */
|
|
14
|
-
(0, _attribution.onINP)(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
14
|
+
(0, _attribution.onINP)(({
|
|
15
|
+
value,
|
|
16
|
+
attribution,
|
|
17
|
+
id
|
|
18
|
+
}) => {
|
|
20
19
|
const attrs = {
|
|
21
20
|
metricId: id,
|
|
22
21
|
eventTarget: attribution.eventTarget,
|
|
@@ -11,11 +11,10 @@ var _runtime = require("../constants/runtime");
|
|
|
11
11
|
var _cleanUrl = require("../url/clean-url");
|
|
12
12
|
const largestContentfulPaint = exports.largestContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LARGEST_CONTENTFUL_PAINT);
|
|
13
13
|
if (_runtime.isBrowserScope) {
|
|
14
|
-
(0, _attribution.onLCP)(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
14
|
+
(0, _attribution.onLCP)(({
|
|
15
|
+
value,
|
|
16
|
+
attribution
|
|
17
|
+
}) => {
|
|
19
18
|
/* Largest Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
20
19
|
if (_runtime.initiallyHidden || largestContentfulPaint.isValid) return;
|
|
21
20
|
let attrs;
|
|
@@ -18,11 +18,10 @@ const timeToFirstByte = exports.timeToFirstByte = new _vitalMetric.VitalMetric(_
|
|
|
18
18
|
* - cross-origin iframes specifically in firefox and safari
|
|
19
19
|
*/
|
|
20
20
|
if (_runtime.isBrowserScope && typeof PerformanceNavigationTiming !== 'undefined' && !_runtime.isiOS && window === window.parent) {
|
|
21
|
-
(0, _attribution.onTTFB)(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
21
|
+
(0, _attribution.onTTFB)(({
|
|
22
|
+
value,
|
|
23
|
+
attribution
|
|
24
|
+
}) => {
|
|
26
25
|
if (timeToFirstByte.isValid) return;
|
|
27
26
|
timeToFirstByte.update({
|
|
28
27
|
value,
|
|
@@ -5,18 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.VitalMetric = void 0;
|
|
7
7
|
class VitalMetric {
|
|
8
|
-
#subscribers =
|
|
8
|
+
#subscribers = new Set();
|
|
9
9
|
history = [];
|
|
10
10
|
constructor(name, roundingMethod) {
|
|
11
11
|
this.name = name;
|
|
12
12
|
this.attrs = {};
|
|
13
13
|
this.roundingMethod = typeof roundingMethod === 'function' ? roundingMethod : Math.floor;
|
|
14
14
|
}
|
|
15
|
-
update(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
15
|
+
update({
|
|
16
|
+
value,
|
|
17
|
+
attrs = {}
|
|
18
|
+
}) {
|
|
20
19
|
if (value === undefined || value === null || value < 0) return;
|
|
21
20
|
const state = {
|
|
22
21
|
value: this.roundingMethod(value),
|
|
@@ -42,8 +41,7 @@ class VitalMetric {
|
|
|
42
41
|
get isValid() {
|
|
43
42
|
return this.current.value >= 0;
|
|
44
43
|
}
|
|
45
|
-
subscribe(callback) {
|
|
46
|
-
let buffered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
44
|
+
subscribe(callback, buffered = true) {
|
|
47
45
|
if (typeof callback !== 'function') return;
|
|
48
46
|
this.#subscribers.add(callback);
|
|
49
47
|
// emit full history on subscription ("buffered" behavior)
|
|
@@ -66,7 +66,8 @@ function gosNREUMOriginals() {
|
|
|
66
66
|
PR: _runtime.globalScope.Promise,
|
|
67
67
|
MO: _runtime.globalScope.MutationObserver,
|
|
68
68
|
// this'll be undefined if not in a web window
|
|
69
|
-
FETCH: _runtime.globalScope.fetch
|
|
69
|
+
FETCH: _runtime.globalScope.fetch,
|
|
70
|
+
WS: _runtime.globalScope.WebSocket
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
return nr;
|
|
@@ -15,10 +15,7 @@ var _eventListenerOpts = require("../event-listener/event-listener-opts");
|
|
|
15
15
|
* @param {boolean} [toHiddenOnly=false] - only execute the 'cb' when the vis is changing to the hidden state; no arg is passed to 'cb' if used
|
|
16
16
|
* @returns void
|
|
17
17
|
*/
|
|
18
|
-
function subscribeToVisibilityChange(cb) {
|
|
19
|
-
let toHiddenOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20
|
-
let capture = arguments.length > 2 ? arguments[2] : undefined;
|
|
21
|
-
let abortSignal = arguments.length > 3 ? arguments[3] : undefined;
|
|
18
|
+
function subscribeToVisibilityChange(cb, toHiddenOnly = false, capture, abortSignal) {
|
|
22
19
|
(0, _eventListenerOpts.documentAddEventListener)('visibilitychange', handleVisibilityChange, capture, abortSignal);
|
|
23
20
|
function handleVisibilityChange() {
|
|
24
21
|
if (toHiddenOnly) {
|
|
@@ -83,14 +83,11 @@ function wrapEvents(sharedEE) {
|
|
|
83
83
|
* @param {Function} cb - the function to run on the ancestral object once found, accepts an object as a arg
|
|
84
84
|
* @param {Array} rest - [optional] any additional arguments to pass to the cb
|
|
85
85
|
*/
|
|
86
|
-
function findEventListenerProtoAndCb(object, cb) {
|
|
86
|
+
function findEventListenerProtoAndCb(object, cb, ...rest) {
|
|
87
87
|
let step = object;
|
|
88
88
|
while (typeof step === 'object' && !Object.prototype.hasOwnProperty.call(step, ADD_EVENT_LISTENER)) {
|
|
89
89
|
step = Object.getPrototypeOf(step);
|
|
90
90
|
}
|
|
91
|
-
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
92
|
-
rest[_key - 2] = arguments[_key];
|
|
93
|
-
}
|
|
94
91
|
if (step) cb(step, ...rest);
|
|
95
92
|
}
|
|
96
93
|
|
|
@@ -111,13 +111,10 @@ function wrapPromise(sharedEE) {
|
|
|
111
111
|
|
|
112
112
|
// Note that this wrapping affects the same originals.PR (prototype) object.
|
|
113
113
|
const prevPromiseOrigThen = prevPromiseObj.prototype.then;
|
|
114
|
-
prevPromiseObj.prototype.then = function wrappedThen() {
|
|
114
|
+
prevPromiseObj.prototype.then = function wrappedThen(...args) {
|
|
115
115
|
var originalThis = this;
|
|
116
116
|
var ctx = getContext(originalThis);
|
|
117
117
|
ctx.promise = originalThis;
|
|
118
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
119
|
-
args[_key] = arguments[_key];
|
|
120
|
-
}
|
|
121
118
|
args[0] = promiseWrapper(args[0], 'cb-', ctx, null, false);
|
|
122
119
|
args[1] = promiseWrapper(args[1], 'cb-', ctx, null, false);
|
|
123
120
|
const origFnCallWithThis = prevPromiseOrigThen.apply(this, args);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WEBSOCKET_TAG = exports.ADD_EVENT_LISTENER_TAG = void 0;
|
|
7
|
+
exports.wrapWebSocket = wrapWebSocket;
|
|
8
|
+
var _runtime = require("../constants/runtime");
|
|
9
|
+
var _now = require("../timing/now");
|
|
10
|
+
var _load = require("../window/load");
|
|
11
|
+
var _uniqueId = require("../ids/unique-id");
|
|
12
|
+
var _nreum = require("../window/nreum");
|
|
13
|
+
const WEBSOCKET_TAG = exports.WEBSOCKET_TAG = 'websocket-';
|
|
14
|
+
const ADD_EVENT_LISTENER_TAG = exports.ADD_EVENT_LISTENER_TAG = 'addEventListener';
|
|
15
|
+
const wrapped = {};
|
|
16
|
+
function wrapWebSocket(sharedEE) {
|
|
17
|
+
if (wrapped[sharedEE.debugId]++) return sharedEE;
|
|
18
|
+
const originals = (0, _nreum.gosNREUMOriginals)().o;
|
|
19
|
+
if (!originals.WS) return sharedEE;
|
|
20
|
+
function reporter(socketId) {
|
|
21
|
+
const createdAt = (0, _now.now)();
|
|
22
|
+
return function (message, ...data) {
|
|
23
|
+
const timestamp = data[0]?.timeStamp || (0, _now.now)();
|
|
24
|
+
const isLoaded = (0, _load.checkState)();
|
|
25
|
+
sharedEE.emit(WEBSOCKET_TAG + message, [timestamp, timestamp - createdAt, isLoaded, socketId, ...data]);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(WrappedWebSocket, 'name', {
|
|
29
|
+
value: 'WebSocket'
|
|
30
|
+
});
|
|
31
|
+
function WrappedWebSocket() {
|
|
32
|
+
const ws = new originals.WS(...arguments);
|
|
33
|
+
const socketId = (0, _uniqueId.generateRandomHexString)(6);
|
|
34
|
+
const report = reporter(socketId);
|
|
35
|
+
report('new');
|
|
36
|
+
const events = ['message', 'error', 'open', 'close'];
|
|
37
|
+
/** add event listeners */
|
|
38
|
+
events.forEach(evt => {
|
|
39
|
+
ws.addEventListener(evt, function (e) {
|
|
40
|
+
report(ADD_EVENT_LISTENER_TAG, {
|
|
41
|
+
eventType: evt,
|
|
42
|
+
event: e
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/** could also observe the on-events for runtime processing, but not implemented yet */
|
|
48
|
+
|
|
49
|
+
/** observe the static method send, but noteably not close, as that is currently observed with the event listener */;
|
|
50
|
+
['send'].forEach(wrapStaticProperty);
|
|
51
|
+
function wrapStaticProperty(prop) {
|
|
52
|
+
const originalProp = ws[prop];
|
|
53
|
+
if (originalProp) {
|
|
54
|
+
Object.defineProperty(proxiedProp, 'name', {
|
|
55
|
+
value: prop
|
|
56
|
+
});
|
|
57
|
+
function proxiedProp() {
|
|
58
|
+
report(prop, ...arguments);
|
|
59
|
+
try {
|
|
60
|
+
return originalProp.apply(this, arguments);
|
|
61
|
+
} catch (err) {
|
|
62
|
+
report(prop + '-err', ...arguments);
|
|
63
|
+
// rethrow error so we don't effect execution by observing.
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ws[prop] = proxiedProp;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return ws;
|
|
71
|
+
}
|
|
72
|
+
_runtime.globalScope.WebSocket = WrappedWebSocket;
|
|
73
|
+
return sharedEE;
|
|
74
|
+
}
|
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
8
|
-
var
|
|
8
|
+
var _info = require("../../../common/config/info");
|
|
9
|
+
var _agentConstants = require("../../../common/constants/agent-constants");
|
|
9
10
|
class Chunk {
|
|
10
11
|
constructor(events, aggregateInstance) {
|
|
11
12
|
this.addString = (0, _belSerializer.getAddStringContext)(aggregateInstance.agentIdentifier); // pass agentIdentifier here
|
|
@@ -28,7 +29,7 @@ class Chunk {
|
|
|
28
29
|
let insert = '2,';
|
|
29
30
|
|
|
30
31
|
// Since configuration objects (like info) are created new each time they are set, we have to grab the current pointer to the attr object here.
|
|
31
|
-
const jsAttributes = (0,
|
|
32
|
+
const jsAttributes = (0, _info.getInfo)(aggregateInstance.agentIdentifier).jsAttributes;
|
|
32
33
|
|
|
33
34
|
// add custom attributes
|
|
34
35
|
// gql decorators are added as custom attributes to alleviate need for new BEL schema
|
|
@@ -44,7 +45,7 @@ class Chunk {
|
|
|
44
45
|
if (i + 1 < events.length) insert += ';';
|
|
45
46
|
this.payload += insert;
|
|
46
47
|
}
|
|
47
|
-
this.tooBig = this.payload.length * 2 >
|
|
48
|
+
this.tooBig = this.payload.length * 2 > _agentConstants.MAX_PAYLOAD_SIZE;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
exports.default = Chunk;
|
|
@@ -19,11 +19,10 @@ var _typeCheck = require("../../../common/util/type-check");
|
|
|
19
19
|
* @param {string} query Ajax request query param string
|
|
20
20
|
* @returns {GQLMetadata | undefined}
|
|
21
21
|
*/
|
|
22
|
-
function parseGQL(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
|
+
function parseGQL({
|
|
23
|
+
body,
|
|
24
|
+
query
|
|
25
|
+
} = {}) {
|
|
27
26
|
if (!body && !query) return;
|
|
28
27
|
try {
|
|
29
28
|
const gqlBody = parseBatchGQL(parseGQLContents(body));
|