@newrelic/browser-agent 0.1.231 → 1.232.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/README.md +2 -2
- package/dist/cjs/common/config/state/configurable.js +27 -21
- package/dist/cjs/common/config/state/init.js +8 -0
- package/dist/cjs/common/config/state/runtime.js +24 -26
- 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 +2 -1
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +2 -2
- package/dist/cjs/common/event-emitter/register-handler.test.js +1 -1
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +14 -11
- package/dist/cjs/common/harvest/harvest.js +3 -1
- package/dist/cjs/common/session/constants.js +12 -0
- package/dist/cjs/common/session/session-entity.js +278 -0
- package/dist/cjs/common/session/session-entity.test.js +436 -0
- package/dist/cjs/common/storage/first-party-cookies.js +35 -0
- package/dist/cjs/common/storage/local-memory.js +35 -0
- package/dist/cjs/common/storage/local-memory.test.js +20 -0
- package/dist/cjs/common/storage/local-storage.js +33 -0
- package/dist/cjs/common/storage/local-storage.test.js +14 -0
- package/dist/cjs/common/timer/interaction-timer.js +78 -0
- package/dist/cjs/common/timer/interaction-timer.test.js +216 -0
- package/dist/cjs/common/timer/timer.js +32 -0
- package/dist/cjs/common/timer/timer.test.js +105 -0
- package/dist/cjs/common/unload/eol.js +2 -2
- package/dist/cjs/common/url/canonicalize-url.js +32 -0
- package/dist/cjs/common/url/canonicalize-url.test.js +42 -0
- package/dist/cjs/common/url/clean-url.js +10 -3
- package/dist/cjs/common/util/data-size.js +6 -0
- package/dist/cjs/common/util/data-size.test.js +47 -0
- package/dist/cjs/common/util/global-scope.js +4 -2
- package/dist/cjs/common/util/invoke.js +73 -0
- package/dist/cjs/common/util/invoke.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +0 -4
- package/dist/cjs/common/window/page-visibility.js +3 -1
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
- package/dist/cjs/common/wrap/wrap-function.js +1 -3
- package/dist/cjs/common/wrap/wrap-timer.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +2 -2
- package/dist/cjs/features/ajax/instrument/index.js +1 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +164 -38
- package/dist/cjs/features/jserrors/aggregate/index.js +25 -46
- package/dist/cjs/features/jserrors/instrument/index.js +0 -2
- package/dist/cjs/features/metrics/aggregate/index.js +13 -2
- package/dist/cjs/features/page_action/aggregate/index.js +2 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -6
- package/dist/cjs/features/session_trace/aggregate/index.js +3 -5
- package/dist/cjs/features/spa/aggregate/index.js +6 -5
- package/dist/cjs/features/utils/agent-session.js +73 -0
- package/dist/cjs/features/utils/feature-base.js +1 -1
- package/dist/cjs/features/utils/instrument-base.js +7 -2
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/loaders/agent.js +1 -1
- package/dist/cjs/loaders/api/api.js +1 -4
- package/dist/cjs/loaders/api/apiAsync.js +3 -2
- package/dist/cjs/loaders/configure/configure.js +0 -6
- package/dist/esm/common/config/state/configurable.js +26 -20
- package/dist/esm/common/config/state/init.js +8 -0
- package/dist/esm/common/config/state/runtime.js +24 -26
- 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 +2 -1
- package/dist/esm/common/event-emitter/contextual-ee.test.js +2 -2
- package/dist/esm/common/event-emitter/register-handler.test.js +1 -1
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +14 -11
- package/dist/esm/common/harvest/harvest.js +3 -1
- package/dist/esm/common/session/constants.js +3 -0
- package/dist/esm/common/session/session-entity.js +271 -0
- package/dist/esm/common/session/session-entity.test.js +434 -0
- package/dist/esm/common/storage/first-party-cookies.js +28 -0
- package/dist/esm/common/storage/local-memory.js +28 -0
- package/dist/esm/common/storage/local-memory.test.js +18 -0
- package/dist/esm/common/storage/local-storage.js +26 -0
- package/dist/esm/common/storage/local-storage.test.js +12 -0
- package/dist/esm/common/timer/interaction-timer.js +71 -0
- package/dist/esm/common/timer/interaction-timer.test.js +214 -0
- package/dist/esm/common/timer/timer.js +25 -0
- package/dist/esm/common/timer/timer.test.js +103 -0
- package/dist/esm/common/unload/eol.js +1 -1
- package/dist/esm/common/url/canonicalize-url.js +27 -0
- package/dist/esm/common/url/canonicalize-url.test.js +38 -0
- package/dist/esm/common/url/clean-url.js +10 -3
- package/dist/esm/common/util/data-size.js +7 -0
- package/dist/esm/common/util/data-size.test.js +45 -0
- package/dist/esm/common/util/global-scope.js +1 -0
- package/dist/esm/common/util/invoke.js +66 -0
- package/dist/esm/common/util/invoke.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +0 -4
- package/dist/esm/common/window/page-visibility.js +3 -1
- package/dist/esm/common/wrap/wrap-fetch.js +1 -2
- package/dist/esm/common/wrap/wrap-function.js +1 -2
- package/dist/esm/common/wrap/wrap-timer.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +2 -2
- package/dist/esm/features/ajax/instrument/index.js +1 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +149 -25
- package/dist/esm/features/jserrors/aggregate/index.js +26 -46
- package/dist/esm/features/jserrors/instrument/index.js +0 -1
- package/dist/esm/features/metrics/aggregate/index.js +14 -3
- package/dist/esm/features/page_action/aggregate/index.js +2 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +6 -6
- package/dist/esm/features/session_trace/aggregate/index.js +3 -4
- package/dist/esm/features/spa/aggregate/index.js +6 -5
- package/dist/esm/features/utils/agent-session.js +67 -0
- package/dist/esm/features/utils/feature-base.js +1 -1
- package/dist/esm/features/utils/instrument-base.js +7 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/loaders/agent.js +1 -1
- package/dist/esm/loaders/api/api.js +2 -5
- package/dist/esm/loaders/api/apiAsync.js +2 -1
- package/dist/esm/loaders/configure/configure.js +2 -8
- package/dist/types/common/config/state/configurable.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/context/shared-context.d.ts.map +1 -1
- package/dist/types/common/event-listener/event-listener-opts.d.ts +2 -2
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/constants.d.ts +4 -0
- package/dist/types/common/session/constants.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +72 -0
- package/dist/types/common/session/session-entity.d.ts.map +1 -0
- package/dist/types/common/storage/first-party-cookies.d.ts +8 -0
- package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -0
- package/dist/types/common/storage/local-memory.d.ts +8 -0
- package/dist/types/common/storage/local-memory.d.ts.map +1 -0
- package/dist/types/common/storage/local-storage.d.ts +6 -0
- package/dist/types/common/storage/local-storage.d.ts.map +1 -0
- package/dist/types/common/timer/interaction-timer.d.ts +11 -0
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -0
- package/dist/types/common/timer/timer.d.ts +12 -0
- package/dist/types/common/timer/timer.d.ts.map +1 -0
- package/dist/types/common/url/canonicalize-url.d.ts +9 -0
- package/dist/types/common/url/canonicalize-url.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +7 -1
- package/dist/types/common/url/clean-url.d.ts.map +1 -1
- package/dist/types/common/util/data-size.d.ts +7 -1
- package/dist/types/common/util/data-size.d.ts.map +1 -1
- package/dist/types/common/util/global-scope.d.ts +1 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -1
- package/dist/types/common/util/invoke.d.ts +35 -0
- package/dist/types/common/util/invoke.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/window/page-visibility.d.ts +1 -1
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +8 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +48 -19
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +14 -5
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts +3 -3
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
- 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 +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.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/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts +2 -0
- package/dist/types/features/utils/agent-session.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/features/utils/lazy-loader.d.ts +2 -2
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/common/config/state/configurable.js +26 -19
- package/src/common/config/state/init.js +7 -0
- package/src/common/config/state/runtime.js +22 -27
- package/src/common/context/shared-context.js +2 -1
- package/src/common/event-emitter/contextual-ee.test.js +2 -2
- package/src/common/event-emitter/register-handler.test.js +1 -1
- package/src/common/event-listener/event-listener-opts.js +4 -4
- package/src/common/harvest/harvest-scheduler.js +12 -8
- package/src/common/harvest/harvest.js +3 -1
- package/src/common/session/constants.js +3 -0
- package/src/common/session/session-entity.js +271 -0
- package/src/common/session/session-entity.test.js +317 -0
- package/src/common/storage/first-party-cookies.js +31 -0
- package/src/common/storage/local-memory.js +30 -0
- package/src/common/storage/local-memory.test.js +19 -0
- package/src/common/storage/local-storage.js +28 -0
- package/src/common/storage/local-storage.test.js +17 -0
- package/src/common/timer/interaction-timer.js +75 -0
- package/src/common/timer/interaction-timer.test.js +167 -0
- package/src/common/timer/timer.js +31 -0
- package/src/common/timer/timer.test.js +100 -0
- package/src/common/unload/eol.js +1 -1
- package/src/common/url/canonicalize-url.js +28 -0
- package/src/common/url/canonicalize-url.test.js +34 -0
- package/src/common/url/clean-url.js +10 -3
- package/src/common/util/data-size.js +6 -0
- package/src/common/util/data-size.test.js +50 -0
- package/src/common/util/global-scope.js +2 -0
- package/src/common/util/invoke.js +55 -0
- package/src/common/util/invoke.test.js +65 -0
- package/src/common/util/obfuscate.js +0 -4
- package/src/common/window/page-visibility.js +2 -2
- package/src/common/wrap/wrap-fetch.js +1 -2
- package/src/common/wrap/wrap-function.js +1 -2
- package/src/common/wrap/wrap-timer.js +1 -1
- package/src/features/ajax/aggregate/index.js +2 -2
- package/src/features/ajax/instrument/index.js +1 -1
- package/src/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.js +85 -11
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +141 -24
- package/src/features/jserrors/aggregate/index.js +24 -50
- package/src/features/jserrors/instrument/index.js +0 -1
- package/src/features/metrics/aggregate/index.js +18 -3
- package/src/features/page_action/aggregate/index.js +2 -2
- package/src/features/page_view_event/aggregate/index.js +6 -3
- package/src/features/page_view_timing/aggregate/index.js +6 -6
- package/src/features/session_trace/aggregate/index.js +3 -4
- package/src/features/spa/aggregate/index.js +5 -5
- package/src/features/utils/agent-session.js +68 -0
- package/src/features/utils/feature-base.js +1 -1
- package/src/features/utils/instrument-base.js +5 -2
- package/src/features/utils/lazy-loader.js +1 -1
- package/src/loaders/agent.js +1 -1
- package/src/loaders/api/api.js +2 -5
- package/src/loaders/api/apiAsync.js +2 -1
- package/src/loaders/configure/configure.js +2 -7
- package/dist/cjs/common/util/single.js +0 -23
- package/dist/cjs/common/window/session-storage.js +0 -87
- package/dist/cjs/features/utils/aggregate-base.js +0 -13
- package/dist/esm/common/util/single.js +0 -16
- package/dist/esm/common/window/session-storage.js +0 -77
- package/dist/esm/features/utils/aggregate-base.js +0 -6
- package/dist/types/common/util/single.d.ts +0 -2
- package/dist/types/common/util/single.d.ts.map +0 -1
- package/dist/types/common/window/session-storage.d.ts +0 -18
- package/dist/types/common/window/session-storage.d.ts.map +0 -1
- package/dist/types/features/utils/aggregate-base.d.ts +0 -4
- package/dist/types/features/utils/aggregate-base.d.ts.map +0 -1
- package/src/common/util/single.js +0 -18
- package/src/common/window/session-storage.js +0 -75
- package/src/features/utils/aggregate-base.js +0 -7
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {string} key
|
|
3
|
-
* @param {string} value
|
|
4
|
-
* @returns true, if item was set successfully. false, if storage is full or setItem threw an exception.
|
|
5
|
-
*/
|
|
6
|
-
export function putInBrowserStorage(key: string, value: string, subgroup?: string): boolean;
|
|
7
|
-
export function removeFromBrowserStorage(key: any, subgroup?: string): void;
|
|
8
|
-
/**
|
|
9
|
-
* @returns {string} This tab|window's session identifier, or a new ID if not found in storage
|
|
10
|
-
*/
|
|
11
|
-
export function getCurrentSessionIdOrMakeNew(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Look through the page's sessionStorage items and gather the ones that was set under some grouping label, if applicable.
|
|
14
|
-
* @param {string} [subgroup] - empty string by default, which will return all items set by browser agent
|
|
15
|
-
* @returns An object of the key-value items from putInBrowserStorage calls from agents with access to the same storage space.
|
|
16
|
-
*/
|
|
17
|
-
export function getAllStorageItemsOfGroup(subgroup?: string | undefined): {};
|
|
18
|
-
//# sourceMappingURL=session-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/window/session-storage.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,yCAJW,MAAM,SACN,MAAM,8BAWhB;AAQD,4EAIC;AAED;;GAEG;AACH,gDAFa,MAAM,CAelB;AAED;;;;GAIG;AACH,6EAaC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAEA;CAIC;4BAN2B,gBAAgB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import slice from 'lodash._slice'
|
|
7
|
-
|
|
8
|
-
export function single (fn) {
|
|
9
|
-
var called = false
|
|
10
|
-
var res
|
|
11
|
-
|
|
12
|
-
return function () {
|
|
13
|
-
if (called) return res
|
|
14
|
-
called = true
|
|
15
|
-
res = fn.apply(this, slice(arguments))
|
|
16
|
-
return res
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface for Agents' usage of the Window.sessionStorage as a replacement to third-party cookies.
|
|
3
|
-
* (All agents on a tab|window will share the same sessionStorage.)
|
|
4
|
-
*
|
|
5
|
-
* @design https://newrelic.atlassian.net/wiki/spaces/INST/pages/2522513791/JSESSIONID+Cookie+Change+Design+Document
|
|
6
|
-
* @environment Browser script
|
|
7
|
-
*/
|
|
8
|
-
import { generateRandomHexString } from '../ids/unique-id'
|
|
9
|
-
|
|
10
|
-
const AGENT_PREFIX = 'NRBA/'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} key
|
|
14
|
-
* @param {string} value
|
|
15
|
-
* @returns true, if item was set successfully. false, if storage is full or setItem threw an exception.
|
|
16
|
-
*/
|
|
17
|
-
export function putInBrowserStorage (key, value, subgroup = '') {
|
|
18
|
-
try {
|
|
19
|
-
window.sessionStorage.setItem(AGENT_PREFIX + subgroup + key, value)
|
|
20
|
-
return true
|
|
21
|
-
} catch (ex) {
|
|
22
|
-
// Session storage may be full.
|
|
23
|
-
return false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem}
|
|
28
|
-
* @param {string} key
|
|
29
|
-
*/
|
|
30
|
-
function getFromBrowserStorage (key, subgroup = '') {
|
|
31
|
-
return window.sessionStorage.getItem(AGENT_PREFIX + subgroup + key)
|
|
32
|
-
}
|
|
33
|
-
export function removeFromBrowserStorage (key, subgroup = '') {
|
|
34
|
-
try {
|
|
35
|
-
window.sessionStorage.removeItem(AGENT_PREFIX + subgroup + key)
|
|
36
|
-
} catch (e) {}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @returns {string} This tab|window's session identifier, or a new ID if not found in storage
|
|
41
|
-
*/
|
|
42
|
-
export function getCurrentSessionIdOrMakeNew () {
|
|
43
|
-
try {
|
|
44
|
-
let sessionId
|
|
45
|
-
if ((sessionId = getFromBrowserStorage('SESSION_ID')) === null) {
|
|
46
|
-
// Generate a new one if storage is empty (no previous ID was created or currently exists)
|
|
47
|
-
sessionId = generateRandomHexString(16)
|
|
48
|
-
putInBrowserStorage('SESSION_ID', sessionId)
|
|
49
|
-
}
|
|
50
|
-
return sessionId
|
|
51
|
-
} catch (ex) {
|
|
52
|
-
// The agent is running in a security context that does not allow access to the sessionStorage or is not in browser window context.
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Look through the page's sessionStorage items and gather the ones that was set under some grouping label, if applicable.
|
|
59
|
-
* @param {string} [subgroup] - empty string by default, which will return all items set by browser agent
|
|
60
|
-
* @returns An object of the key-value items from putInBrowserStorage calls from agents with access to the same storage space.
|
|
61
|
-
*/
|
|
62
|
-
export function getAllStorageItemsOfGroup (subgroup = '') {
|
|
63
|
-
const prefixFilter = AGENT_PREFIX + subgroup
|
|
64
|
-
const groupItems = {}
|
|
65
|
-
try {
|
|
66
|
-
for (let i = 0; i < window.sessionStorage.length; i++) {
|
|
67
|
-
let key = window.sessionStorage.key(i)
|
|
68
|
-
if (!key.startsWith(prefixFilter)) continue
|
|
69
|
-
else key = key.slice(prefixFilter.length) // this removes the "NRBA/<subgroup>" prefix so we get back the original key putInBrowserStorage
|
|
70
|
-
|
|
71
|
-
groupItems[key] = getFromBrowserStorage(key, subgroup)
|
|
72
|
-
}
|
|
73
|
-
} catch (ex) { }
|
|
74
|
-
return groupItems
|
|
75
|
-
}
|