@newrelic/browser-agent 0.1.231 → 1.232.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.
Files changed (210) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/common/config/state/configurable.js +27 -21
  3. package/dist/cjs/common/config/state/init.js +8 -0
  4. package/dist/cjs/common/config/state/runtime.js +24 -26
  5. package/dist/cjs/common/constants/env.cdn.js +1 -1
  6. package/dist/cjs/common/constants/env.npm.js +1 -1
  7. package/dist/cjs/common/context/shared-context.js +2 -1
  8. package/dist/cjs/common/event-emitter/contextual-ee.test.js +2 -2
  9. package/dist/cjs/common/event-emitter/register-handler.test.js +1 -1
  10. package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
  11. package/dist/cjs/common/harvest/harvest-scheduler.js +14 -11
  12. package/dist/cjs/common/harvest/harvest.js +3 -1
  13. package/dist/cjs/common/session/constants.js +12 -0
  14. package/dist/cjs/common/session/session-entity.js +278 -0
  15. package/dist/cjs/common/session/session-entity.test.js +436 -0
  16. package/dist/cjs/common/storage/first-party-cookies.js +35 -0
  17. package/dist/cjs/common/storage/local-memory.js +35 -0
  18. package/dist/cjs/common/storage/local-memory.test.js +20 -0
  19. package/dist/cjs/common/storage/local-storage.js +33 -0
  20. package/dist/cjs/common/storage/local-storage.test.js +14 -0
  21. package/dist/cjs/common/timer/interaction-timer.js +78 -0
  22. package/dist/cjs/common/timer/interaction-timer.test.js +216 -0
  23. package/dist/cjs/common/timer/timer.js +32 -0
  24. package/dist/cjs/common/timer/timer.test.js +105 -0
  25. package/dist/cjs/common/unload/eol.js +2 -2
  26. package/dist/cjs/common/util/data-size.js +6 -0
  27. package/dist/cjs/common/util/data-size.test.js +47 -0
  28. package/dist/cjs/common/util/invoke.js +73 -0
  29. package/dist/cjs/common/util/invoke.test.js +49 -0
  30. package/dist/cjs/common/util/obfuscate.js +0 -4
  31. package/dist/cjs/common/window/page-visibility.js +3 -1
  32. package/dist/cjs/common/wrap/wrap-timer.js +1 -1
  33. package/dist/cjs/features/ajax/aggregate/index.js +2 -2
  34. package/dist/cjs/features/jserrors/aggregate/index.js +3 -3
  35. package/dist/cjs/features/metrics/aggregate/index.js +13 -2
  36. package/dist/cjs/features/page_action/aggregate/index.js +2 -2
  37. package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
  38. package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -6
  39. package/dist/cjs/features/session_trace/aggregate/index.js +2 -2
  40. package/dist/cjs/features/spa/aggregate/index.js +6 -5
  41. package/dist/cjs/features/utils/agent-session.js +73 -0
  42. package/dist/cjs/features/utils/feature-base.js +1 -1
  43. package/dist/cjs/features/utils/instrument-base.js +7 -2
  44. package/dist/cjs/features/utils/lazy-loader.js +1 -1
  45. package/dist/cjs/loaders/agent.js +1 -1
  46. package/dist/cjs/loaders/api/api.js +1 -4
  47. package/dist/cjs/loaders/api/apiAsync.js +3 -2
  48. package/dist/cjs/loaders/configure/configure.js +0 -6
  49. package/dist/esm/common/config/state/configurable.js +26 -20
  50. package/dist/esm/common/config/state/init.js +8 -0
  51. package/dist/esm/common/config/state/runtime.js +24 -26
  52. package/dist/esm/common/constants/env.cdn.js +1 -1
  53. package/dist/esm/common/constants/env.npm.js +1 -1
  54. package/dist/esm/common/context/shared-context.js +2 -1
  55. package/dist/esm/common/event-emitter/contextual-ee.test.js +2 -2
  56. package/dist/esm/common/event-emitter/register-handler.test.js +1 -1
  57. package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
  58. package/dist/esm/common/harvest/harvest-scheduler.js +14 -11
  59. package/dist/esm/common/harvest/harvest.js +3 -1
  60. package/dist/esm/common/session/constants.js +3 -0
  61. package/dist/esm/common/session/session-entity.js +271 -0
  62. package/dist/esm/common/session/session-entity.test.js +434 -0
  63. package/dist/esm/common/storage/first-party-cookies.js +28 -0
  64. package/dist/esm/common/storage/local-memory.js +28 -0
  65. package/dist/esm/common/storage/local-memory.test.js +18 -0
  66. package/dist/esm/common/storage/local-storage.js +26 -0
  67. package/dist/esm/common/storage/local-storage.test.js +12 -0
  68. package/dist/esm/common/timer/interaction-timer.js +71 -0
  69. package/dist/esm/common/timer/interaction-timer.test.js +214 -0
  70. package/dist/esm/common/timer/timer.js +25 -0
  71. package/dist/esm/common/timer/timer.test.js +103 -0
  72. package/dist/esm/common/unload/eol.js +1 -1
  73. package/dist/esm/common/util/data-size.js +7 -0
  74. package/dist/esm/common/util/data-size.test.js +45 -0
  75. package/dist/esm/common/util/invoke.js +66 -0
  76. package/dist/esm/common/util/invoke.test.js +47 -0
  77. package/dist/esm/common/util/obfuscate.js +0 -4
  78. package/dist/esm/common/window/page-visibility.js +3 -1
  79. package/dist/esm/common/wrap/wrap-timer.js +1 -1
  80. package/dist/esm/features/ajax/aggregate/index.js +2 -2
  81. package/dist/esm/features/jserrors/aggregate/index.js +3 -3
  82. package/dist/esm/features/metrics/aggregate/index.js +14 -3
  83. package/dist/esm/features/page_action/aggregate/index.js +2 -2
  84. package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
  85. package/dist/esm/features/page_view_timing/aggregate/index.js +6 -6
  86. package/dist/esm/features/session_trace/aggregate/index.js +2 -2
  87. package/dist/esm/features/spa/aggregate/index.js +6 -5
  88. package/dist/esm/features/utils/agent-session.js +67 -0
  89. package/dist/esm/features/utils/feature-base.js +1 -1
  90. package/dist/esm/features/utils/instrument-base.js +7 -2
  91. package/dist/esm/features/utils/lazy-loader.js +1 -1
  92. package/dist/esm/loaders/agent.js +1 -1
  93. package/dist/esm/loaders/api/api.js +2 -5
  94. package/dist/esm/loaders/api/apiAsync.js +2 -1
  95. package/dist/esm/loaders/configure/configure.js +2 -8
  96. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  97. package/dist/types/common/config/state/init.d.ts.map +1 -1
  98. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  99. package/dist/types/common/context/shared-context.d.ts.map +1 -1
  100. package/dist/types/common/event-listener/event-listener-opts.d.ts +2 -2
  101. package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -1
  102. package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -0
  103. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  104. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  105. package/dist/types/common/session/constants.d.ts +4 -0
  106. package/dist/types/common/session/constants.d.ts.map +1 -0
  107. package/dist/types/common/session/session-entity.d.ts +72 -0
  108. package/dist/types/common/session/session-entity.d.ts.map +1 -0
  109. package/dist/types/common/storage/first-party-cookies.d.ts +8 -0
  110. package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -0
  111. package/dist/types/common/storage/local-memory.d.ts +8 -0
  112. package/dist/types/common/storage/local-memory.d.ts.map +1 -0
  113. package/dist/types/common/storage/local-storage.d.ts +6 -0
  114. package/dist/types/common/storage/local-storage.d.ts.map +1 -0
  115. package/dist/types/common/timer/interaction-timer.d.ts +11 -0
  116. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -0
  117. package/dist/types/common/timer/timer.d.ts +12 -0
  118. package/dist/types/common/timer/timer.d.ts.map +1 -0
  119. package/dist/types/common/util/data-size.d.ts +7 -1
  120. package/dist/types/common/util/data-size.d.ts.map +1 -1
  121. package/dist/types/common/util/invoke.d.ts +35 -0
  122. package/dist/types/common/util/invoke.d.ts.map +1 -0
  123. package/dist/types/common/util/obfuscate.d.ts.map +1 -1
  124. package/dist/types/common/window/page-visibility.d.ts +1 -1
  125. package/dist/types/common/window/page-visibility.d.ts.map +1 -1
  126. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  127. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  128. package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
  129. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  130. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  131. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  132. package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
  133. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  134. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  135. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  136. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  137. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  138. package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
  139. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  140. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  141. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  142. package/dist/types/features/utils/agent-session.d.ts +2 -0
  143. package/dist/types/features/utils/agent-session.d.ts.map +1 -0
  144. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  145. package/dist/types/features/utils/lazy-loader.d.ts +2 -2
  146. package/dist/types/features/utils/lazy-loader.d.ts.map +1 -1
  147. package/dist/types/loaders/api/api.d.ts.map +1 -1
  148. package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
  149. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  150. package/package.json +6 -5
  151. package/src/common/config/state/configurable.js +26 -19
  152. package/src/common/config/state/init.js +7 -0
  153. package/src/common/config/state/runtime.js +22 -27
  154. package/src/common/context/shared-context.js +2 -1
  155. package/src/common/event-emitter/contextual-ee.test.js +2 -2
  156. package/src/common/event-emitter/register-handler.test.js +1 -1
  157. package/src/common/event-listener/event-listener-opts.js +4 -4
  158. package/src/common/harvest/harvest-scheduler.js +12 -8
  159. package/src/common/harvest/harvest.js +3 -1
  160. package/src/common/session/constants.js +3 -0
  161. package/src/common/session/session-entity.js +271 -0
  162. package/src/common/session/session-entity.test.js +317 -0
  163. package/src/common/storage/first-party-cookies.js +31 -0
  164. package/src/common/storage/local-memory.js +30 -0
  165. package/src/common/storage/local-memory.test.js +19 -0
  166. package/src/common/storage/local-storage.js +28 -0
  167. package/src/common/storage/local-storage.test.js +17 -0
  168. package/src/common/timer/interaction-timer.js +75 -0
  169. package/src/common/timer/interaction-timer.test.js +167 -0
  170. package/src/common/timer/timer.js +31 -0
  171. package/src/common/timer/timer.test.js +100 -0
  172. package/src/common/unload/eol.js +1 -1
  173. package/src/common/util/data-size.js +6 -0
  174. package/src/common/util/data-size.test.js +50 -0
  175. package/src/common/util/invoke.js +55 -0
  176. package/src/common/util/invoke.test.js +65 -0
  177. package/src/common/util/obfuscate.js +0 -4
  178. package/src/common/window/page-visibility.js +2 -2
  179. package/src/common/wrap/wrap-timer.js +1 -1
  180. package/src/features/ajax/aggregate/index.js +2 -2
  181. package/src/features/jserrors/aggregate/index.js +3 -3
  182. package/src/features/metrics/aggregate/index.js +18 -3
  183. package/src/features/page_action/aggregate/index.js +2 -2
  184. package/src/features/page_view_event/aggregate/index.js +6 -3
  185. package/src/features/page_view_timing/aggregate/index.js +6 -6
  186. package/src/features/session_trace/aggregate/index.js +2 -2
  187. package/src/features/spa/aggregate/index.js +5 -5
  188. package/src/features/utils/agent-session.js +68 -0
  189. package/src/features/utils/feature-base.js +1 -1
  190. package/src/features/utils/instrument-base.js +5 -2
  191. package/src/features/utils/lazy-loader.js +1 -1
  192. package/src/loaders/agent.js +1 -1
  193. package/src/loaders/api/api.js +2 -5
  194. package/src/loaders/api/apiAsync.js +2 -1
  195. package/src/loaders/configure/configure.js +2 -7
  196. package/dist/cjs/common/util/single.js +0 -23
  197. package/dist/cjs/common/window/session-storage.js +0 -87
  198. package/dist/cjs/features/utils/aggregate-base.js +0 -13
  199. package/dist/esm/common/util/single.js +0 -16
  200. package/dist/esm/common/window/session-storage.js +0 -77
  201. package/dist/esm/features/utils/aggregate-base.js +0 -6
  202. package/dist/types/common/util/single.d.ts +0 -2
  203. package/dist/types/common/util/single.d.ts.map +0 -1
  204. package/dist/types/common/window/session-storage.d.ts +0 -18
  205. package/dist/types/common/window/session-storage.d.ts.map +0 -1
  206. package/dist/types/features/utils/aggregate-base.d.ts +0 -4
  207. package/dist/types/features/utils/aggregate-base.d.ts.map +0 -1
  208. package/src/common/util/single.js +0 -18
  209. package/src/common/window/session-storage.js +0 -75
  210. package/src/features/utils/aggregate-base.js +0 -7
@@ -10,13 +10,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
10
10
  import { submitData } from '../../../common/util/submit-data';
11
11
  import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
12
12
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
13
- import { AggregateBase } from '../../utils/aggregate-base';
14
13
  import * as CONSTANTS from '../constants';
15
14
  import { getActivatedFeaturesFlags } from './initialized-features';
16
15
  import { globalScope, isBrowserScope } from '../../../common/util/global-scope';
17
16
  import { drain } from '../../../common/drain/drain';
17
+ import { FeatureBase } from '../../utils/feature-base';
18
18
  const jsonp = 'NREUM.setToken';
19
- export class Aggregate extends AggregateBase {
19
+ export class Aggregate extends FeatureBase {
20
20
  static featureName = CONSTANTS.FEATURE_NAME;
21
21
  constructor(agentIdentifier, aggregator) {
22
22
  super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
@@ -130,7 +130,10 @@ export class Aggregate extends AggregateBase {
130
130
  var queryString = fromArray(chunksForQueryString, agentRuntime.maxBytes);
131
131
 
132
132
  // Capture bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
133
- agentRuntime.bytesSent[protocol] = (agentRuntime.bytesSent[protocol] || 0) + queryString?.length || 0;
133
+ agentRuntime.bytesSent[protocol] = 0; // Set to zero for now until RUM is moved to POST
134
+
135
+ // Capture query bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
136
+ agentRuntime.queryBytesSent[protocol] = (agentRuntime.queryBytesSent[protocol] || 0) + queryString?.length || 0;
134
137
  const isValidJsonp = submitData.jsonp(this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + queryString, jsonp);
135
138
  // Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
136
139
  // ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
@@ -14,11 +14,11 @@ import { registerHandler } from '../../../common/event-emitter/register-handler'
14
14
  import { cleanURL } from '../../../common/url/clean-url';
15
15
  import { handle } from '../../../common/event-emitter/handle';
16
16
  import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config';
17
- import { AggregateBase } from '../../utils/aggregate-base';
18
17
  import { FEATURE_NAME } from '../constants';
19
18
  import { drain } from '../../../common/drain/drain';
20
19
  import { FEATURE_NAMES } from '../../../loaders/features/features';
21
- export class Aggregate extends AggregateBase {
20
+ import { FeatureBase } from '../../utils/feature-base';
21
+ export class Aggregate extends FeatureBase {
22
22
  static featureName = FEATURE_NAME;
23
23
  constructor(agentIdentifier, aggregator) {
24
24
  var _this;
@@ -29,7 +29,7 @@ export class Aggregate extends AggregateBase {
29
29
  this.curSessEndRecorded = false;
30
30
  this.cls = null; // this should be null unless set to a numeric value by web-vitals so that we differentiate if CLS is supported
31
31
 
32
- /*! This is the section that used to be in the loader portion: !*/
32
+ /* ! This is the section that used to be in the loader portion: ! */
33
33
  /* ------------------------------------------------------------ */
34
34
  const pageStartedHidden = getRuntime(agentIdentifier).initHidden; // our attempt at recapturing initial vis state since this code runs post-load time
35
35
  this.alreadySent = new Set(); // since we don't support timings on BFCache restores, this tracks and helps cap metrics that web-vitals report more than once
@@ -105,10 +105,10 @@ export class Aggregate extends AggregateBase {
105
105
  attributes.size = lcpEntry.size;
106
106
  attributes.eid = lcpEntry.id;
107
107
  if (lcpEntry.url) {
108
- attributes['elUrl'] = cleanURL(lcpEntry.url);
108
+ attributes.elUrl = cleanURL(lcpEntry.url);
109
109
  }
110
110
  if (lcpEntry.element?.tagName) {
111
- attributes['elTag'] = lcpEntry.element.tagName;
111
+ attributes.elTag = lcpEntry.element.tagName;
112
112
  }
113
113
  }
114
114
  this.addConnectionAttributes(attributes);
@@ -221,7 +221,7 @@ export class Aggregate extends AggregateBase {
221
221
  Future: onCLS value changes should be reported directly & CLS separated into its own timing node so it's not beholden to 'pageHide' firing. It'd also be possible to report the real final CLS.
222
222
  */
223
223
  if (this.cls !== null) {
224
- attrs['cls'] = this.cls;
224
+ attrs.cls = this.cls;
225
225
  }
226
226
  this.timings.push({
227
227
  name: name,
@@ -11,11 +11,11 @@ import { supportsPerformanceObserver } from '../../../common/window/supports-per
11
11
  import slice from 'lodash._slice';
12
12
  import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
13
13
  import { now } from '../../../common/timing/now';
14
- import { AggregateBase } from '../../utils/aggregate-base';
15
14
  import { FEATURE_NAME } from '../constants';
16
15
  import { drain } from '../../../common/drain/drain';
17
16
  import { HandlerCache } from '../../utils/handler-cache';
18
- export class Aggregate extends AggregateBase {
17
+ import { FeatureBase } from '../../utils/feature-base';
18
+ export class Aggregate extends FeatureBase {
19
19
  static featureName = FEATURE_NAME;
20
20
  constructor(agentIdentifier, aggregator) {
21
21
  var _this;
@@ -2,7 +2,7 @@
2
2
  * Copyright 2020 New Relic Corporation. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- /*eslint no-undef: "error"*/
5
+ /* eslint no-undef: "error" */
6
6
  import { registerHandler as register } from '../../../common/event-emitter/register-handler';
7
7
  import { parseUrl } from '../../../common/url/parse-url';
8
8
  import { shouldCollectEvent } from '../../../common/deny-list/deny-list';
@@ -13,13 +13,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
13
13
  import { Interaction } from './interaction';
14
14
  import { getConfigurationValue, getRuntime } from '../../../common/config/config';
15
15
  import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
16
- import { AggregateBase } from '../../utils/aggregate-base';
17
16
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
18
17
  import { Serializer } from './serializer';
19
18
  import { ee } from '../../../common/event-emitter/contextual-ee';
20
19
  import * as CONSTANTS from '../constants';
21
20
  import { drain } from '../../../common/drain/drain';
22
21
  import { FEATURE_NAMES } from '../../../loaders/features/features';
22
+ import { FeatureBase } from '../../utils/feature-base';
23
23
  const {
24
24
  FEATURE_NAME,
25
25
  INTERACTION_EVENTS,
@@ -38,7 +38,7 @@ const {
38
38
  JSONP_END,
39
39
  originalSetTimeout
40
40
  } = CONSTANTS;
41
- export class Aggregate extends AggregateBase {
41
+ export class Aggregate extends FeatureBase {
42
42
  static featureName = FEATURE_NAME;
43
43
  constructor(agentIdentifier, aggregator) {
44
44
  super(agentIdentifier, aggregator, FEATURE_NAME);
@@ -81,7 +81,8 @@ export class Aggregate extends AggregateBase {
81
81
  onFinished: onHarvestFinished,
82
82
  retryDelay: state.harvestTimeSeconds
83
83
  }, {
84
- agentIdentifier
84
+ agentIdentifier,
85
+ ee: baseEE
85
86
  });
86
87
  scheduler.harvest.on('events', onHarvestStarted);
87
88
 
@@ -213,7 +214,7 @@ export class Aggregate extends AggregateBase {
213
214
  if (evName === 'click') {
214
215
  var value = getActionText(ev.target);
215
216
  if (value) {
216
- state.currentNode.attrs.custom['actionText'] = value;
217
+ state.currentNode.attrs.custom.actionText = value;
217
218
  }
218
219
  }
219
220
  }
@@ -0,0 +1,67 @@
1
+ import { getConfigurationValue, getInfo, getRuntime, setInfo } from '../../common/config/config';
2
+ import { drain } from '../../common/drain/drain';
3
+ import { ee } from '../../common/event-emitter/contextual-ee';
4
+ import { registerHandler } from '../../common/event-emitter/register-handler';
5
+ import { isBrowserScope } from '../../common/util/global-scope';
6
+ import { SessionEntity } from '../../common/session/session-entity';
7
+ import { LocalStorage } from '../../common/storage/local-storage.js';
8
+ import { FirstPartyCookies } from '../../common/storage/first-party-cookies';
9
+ import { LocalMemory } from '../../common/storage/local-memory';
10
+ let ranOnce = 0;
11
+ export function setupAgentSession(agentIdentifier) {
12
+ const agentRuntime = getRuntime(agentIdentifier);
13
+ if (ranOnce++) return agentRuntime.session;
14
+ const sharedEE = ee.get(agentIdentifier);
15
+
16
+ // domain is a string that can be specified by customer.
17
+ // only way to keep the session object across subdomains is using first party cookies
18
+ // This determines which storage wrapper the session manager will use to keep state
19
+ let storageAPI;
20
+ const cookiesEnabled = getConfigurationValue(agentIdentifier, 'privacy.cookies_enabled') === true;
21
+ if (cookiesEnabled && isBrowserScope) {
22
+ storageAPI = getConfigurationValue(agentIdentifier, 'session.domain') ? new FirstPartyCookies(getConfigurationValue(agentIdentifier, 'session.domain')) : new LocalStorage();
23
+ }
24
+ if (cookiesEnabled) {
25
+ // defaults to "LocalMemory" if storageAPI is undefined, such as in Worker build
26
+ agentRuntime.session = new SessionEntity({
27
+ agentIdentifier,
28
+ key: 'SESSION',
29
+ storageAPI,
30
+ expiresMs: getConfigurationValue(agentIdentifier, 'session.expiresMs'),
31
+ inactiveMs: getConfigurationValue(agentIdentifier, 'session.inactiveMs')
32
+ });
33
+ }
34
+
35
+ // The first time the agent runs on a page, it should put everything
36
+ // that's currently stored in the storage API into the local info.jsAttributes object
37
+ if (isBrowserScope) {
38
+ // retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
39
+ const customSessionData = agentRuntime.session?.read?.()?.custom;
40
+ const agentInfo = getInfo(agentIdentifier);
41
+ if (customSessionData) {
42
+ setInfo(agentIdentifier, {
43
+ ...agentInfo,
44
+ jsAttributes: {
45
+ ...agentInfo.jsAttributes,
46
+ ...customSessionData
47
+ }
48
+ });
49
+ }
50
+ }
51
+
52
+ // any calls to newrelic.setCustomAttribute(<persisted>) will need to be added to:
53
+ // local info.jsAttributes {}
54
+ // the session's storage API
55
+ registerHandler('api-setCustomAttribute', (time, key, value) => {
56
+ agentRuntime.session.syncCustomAttribute(key, value);
57
+ }, 'session', sharedEE);
58
+
59
+ // any calls to newrelic.setUserId(...) will need to be added to:
60
+ // local info.jsAttributes {}
61
+ // the session's storage API
62
+ registerHandler('api-setUserId', (time, key, value) => {
63
+ agentRuntime.session.syncCustomAttribute(key, value);
64
+ }, 'session', sharedEE);
65
+ drain(agentIdentifier, 'session');
66
+ return agentRuntime.session;
67
+ }
@@ -26,7 +26,7 @@ export class FeatureBase {
26
26
  * loader configurations may appear after the loader code is executed.
27
27
  */
28
28
  checkConfiguration() {
29
- // NOTE: This check has to happen at aggregator load time, but could be moved to `AggregateBase`.
29
+ // NOTE: This check has to happen at aggregator load time
30
30
  if (!isConfigured(this.agentIdentifier)) {
31
31
  let jsAttributes = {
32
32
  ...gosCDN().info?.jsAttributes
@@ -48,6 +48,12 @@ export class InstrumentBase extends FeatureBase {
48
48
  * it's only responsible for aborting its one specific feature, rather than all.
49
49
  */
50
50
  try {
51
+ // The session entity needs to be attached to the config internals before the aggregator chunk runs
52
+ const {
53
+ setupAgentSession
54
+ } = await import( /* webpackChunkName: "session-manager" */'./agent-session');
55
+ setupAgentSession(this.agentIdentifier);
56
+ // import and instantiate the aggregator chunk
51
57
  const {
52
58
  lazyLoader
53
59
  } = await import( /* webpackChunkName: "lazy-loader" */'./lazy-loader');
@@ -56,9 +62,8 @@ export class InstrumentBase extends FeatureBase {
56
62
  } = await lazyLoader(this.featureName, 'aggregate');
57
63
  new Aggregate(this.agentIdentifier, this.aggregator);
58
64
  } catch (e) {
59
- warn("Downloading ".concat(this.featureName, " failed..."));
65
+ warn("Downloading ".concat(this.featureName, " failed..."), e);
60
66
  this.abortHandler?.(); // undo any important alterations made to the page
61
-
62
67
  // not supported yet but nice to do: "abort" this agent's EE for this feature specifically
63
68
  }
64
69
  };
@@ -9,7 +9,7 @@ import { FEATURE_NAMES } from '../../loaders/features/features';
9
9
  * should be.
10
10
  * @param featureName Name of the feature to import such as ajax or session_trace
11
11
  * @param featurePart Name of the feature part to load; should be either instrument or aggregate
12
- * @returns {Promise<InstrumentBase|AggregateBase|null>}
12
+ * @returns {Promise<InstrumentBase|FeatureBase|null>}
13
13
  */
14
14
  export function lazyLoader(featureName, featurePart) {
15
15
  if (featurePart === 'aggregate') {
@@ -66,7 +66,7 @@ export class Agent {
66
66
  this.features[featName].abortHandler?.();
67
67
  }
68
68
  const newrelic = gosNREUM();
69
- delete newrelic.initializedAgents[this.agentIdentifier]?.['api']; // prevent further calls to agent-specific APIs (see "configure.js")
69
+ delete newrelic.initializedAgents[this.agentIdentifier]?.api; // prevent further calls to agent-specific APIs (see "configure.js")
70
70
  delete newrelic.initializedAgents[this.agentIdentifier]?.[NR_FEATURES_REF_NAME]; // GC mem used internally by features
71
71
  delete this.sharedAggregator;
72
72
  // Keep the initialized agent object with its configs for troubleshooting purposes.
@@ -9,11 +9,10 @@ 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 { isBrowserScope, isWorkerScope } from '../../common/util/global-scope';
12
+ import { isWorkerScope } from '../../common/util/global-scope';
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';
16
- import { putInBrowserStorage, removeFromBrowserStorage } from '../../common/window/session-storage';
17
16
  export const CUSTOM_ATTR_GROUP = 'CUSTOM/'; // the subgroup items should be stored under in storage API
18
17
 
19
18
  export function setTopLevelCallers() {
@@ -72,7 +71,6 @@ export function setAPI(agentIdentifier, forceDrain) {
72
71
  const currentInfo = getInfo(agentIdentifier);
73
72
  if (value === null) {
74
73
  delete currentInfo.jsAttributes[key];
75
- if (isBrowserScope) removeFromBrowserStorage(key, CUSTOM_ATTR_GROUP); // addToBrowserStorage flag isn't needed to unset keys from storage
76
74
  } else {
77
75
  setInfo(agentIdentifier, {
78
76
  ...currentInfo,
@@ -81,9 +79,8 @@ export function setAPI(agentIdentifier, forceDrain) {
81
79
  [key]: value
82
80
  }
83
81
  });
84
- if (isBrowserScope && addToBrowserStorage) putInBrowserStorage(key, value, CUSTOM_ATTR_GROUP);
85
82
  }
86
- return apiCall(prefix, apiName, true)();
83
+ return apiCall(prefix, apiName, true, !!addToBrowserStorage || value === null ? 'session' : undefined)(key, value);
87
84
  }
88
85
  apiInterface.setCustomAttribute = function (name, value) {
89
86
  let persistAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -3,7 +3,7 @@ import { getConfigurationValue, getInfo, getRuntime } from '../../common/config/
3
3
  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
- import { single } from '../../common/util/single';
6
+ import { single } from '../../common/util/invoke';
7
7
  import { submitData } from '../../common/util/submit-data';
8
8
  import { isBrowserScope } from '../../common/util/global-scope';
9
9
  import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';
@@ -65,6 +65,7 @@ export function setAPI(agentIdentifier) {
65
65
  request_name = window.encodeURIComponent(request_name);
66
66
  cycle += 1;
67
67
  const agentInfo = getInfo(agentIdentifier);
68
+ const agentRuntime = getRuntime(agentIdentifier);
68
69
  if (!agentInfo.beacon) return;
69
70
  var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey;
70
71
  url += '?a=' + agentInfo.applicationID + '&';
@@ -1,9 +1,8 @@
1
- import { setAPI, setTopLevelCallers, CUSTOM_ATTR_GROUP } from '../api/api';
1
+ 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 { isBrowserScope, isWorkerScope } from '../../common/util/global-scope';
6
- import { getAllStorageItemsOfGroup } from '../../common/window/session-storage';
5
+ import { isWorkerScope } from '../../common/util/global-scope';
7
6
  export function configure(agentIdentifier) {
8
7
  let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9
8
  let loaderType = arguments.length > 2 ? arguments[2] : undefined;
@@ -28,11 +27,6 @@ export function configure(agentIdentifier) {
28
27
  // add a default attr to all worker payloads
29
28
  info.jsAttributes.isWorker = true;
30
29
  }
31
- if (isBrowserScope) {
32
- // retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
33
- let prevPageSessionJsAttrs = getAllStorageItemsOfGroup(CUSTOM_ATTR_GROUP);
34
- Object.assign(info.jsAttributes, prevPageSessionJsAttrs);
35
- }
36
30
  setInfo(agentIdentifier, info);
37
31
  setConfiguration(agentIdentifier, init || {});
38
32
  setLoaderConfig(agentIdentifier, loader_config || {});
@@ -1 +1 @@
1
- {"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,kCAoBC;CACF"}
1
+ {"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,kCAEC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AA4BA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAmCA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AAoCA,yCAIC;AAED,oDAIC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AA+BA,yCAIC;AAED,oDAIC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAOA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
1
+ {"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAQA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
@@ -4,7 +4,7 @@ export function eventListenerOpts(useCapture: any, abortSignal: any): boolean |
4
4
  signal: any;
5
5
  };
6
6
  /** Do not use this within the worker context. */
7
- export function windowAddEventListener(event: any, listener: any, capture?: boolean): void;
7
+ export function windowAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
8
8
  /** Do not use this within the worker context. */
9
- export function documentAddEventListener(event: any, listener: any, capture?: boolean): void;
9
+ export function documentAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
10
10
  //# sourceMappingURL=event-listener-opts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,2FAEC;AACD,iDAAiD;AACjD,6FAEC"}
1
+ {"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,wHAEC;AACD,iDAAiD;AACjD,0HAEC"}
@@ -9,6 +9,7 @@ export class HarvestScheduler extends SharedContext {
9
9
  timeoutHandle: NodeJS.Timeout | null;
10
10
  aborted: boolean;
11
11
  harvest: Harvest;
12
+ unload(): void;
12
13
  startTimer(interval: any, initialDelay: any): void;
13
14
  interval: any;
14
15
  stopTimer(permanently?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,mDAiBC;IAfC,cAAwB;IACxB,UAAsB;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAWhD,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA8BC;IAED,gDAiBC;CACF;8BAzG6B,2BAA2B;wBAChB,WAAW"}
1
+ {"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,mDAeC;IAbC,cAAwB;IACxB,UAAsB;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAShD,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA6BC;IAED,gDAiBC;CACF;8BA7G6B,2BAA2B;wBAChB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AA2MA;;;EAsBC;AA3MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;;;;;OASG;IACH,gBANW,MAAM;QAGK,YAAY;QACZ,MAAM;6BAS3B;IAED;;;;;;;;;;;;;;KAcC;IACD,eAZS,MAAM;QAIgB,EAAE,EAAxB,MAAM;QACgB,IAAI,EAA1B,MAAM;;QAIK,YAAY;QACZ,MAAM;gDAYzB;IAED,kGAGC;IAED,uFAmEC;IAGD,0BAmBC;IAED;;;MAYC;IAED,mCAGC;IAED,uBAIC;CACF;8BAvL6B,2BAA2B;2BAF9B,mBAAmB"}
1
+ {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AA6MA;;;EAsBC;AA7MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;;;;;OASG;IACH,gBANW,MAAM;QAGK,YAAY;QACZ,MAAM;6BAS3B;IAED;;;;;;;;;;;;;;KAcC;IACD,eAZS,MAAM;QAIgB,EAAE,EAAxB,MAAM;QACgB,IAAI,EAA1B,MAAM;;QAIK,YAAY;QACZ,MAAM;gDAYzB;IAED,kGAGC;IAED,uFAqEC;IAGD,0BAmBC;IAED;;;MAYC;IAED,mCAGC;IAED,uBAIC;CACF;8BAzL6B,2BAA2B;2BAF9B,mBAAmB"}
@@ -0,0 +1,4 @@
1
+ export const PREFIX: "NRBA";
2
+ export const DEFAULT_EXPIRES_MS: 14400000;
3
+ export const DEFAULT_INACTIVE_MS: 1800000;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/common/session/constants.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,0CAA0C;AAC1C,0CAA0C"}
@@ -0,0 +1,72 @@
1
+ export class SessionEntity {
2
+ /**
3
+ * Create a self-managing Session Entity. This entity is scoped to the agent identifier which triggered it, allowing for multiple simultaneous session objects to exist.
4
+ * There is one "namespace" an agent can store data in LS -- NRBA_{key}. If there are two agents on one page, and they both use the same key, they could overwrite each other since they would both use the same namespace in LS by default.
5
+ * The value can be overridden in the constructor, but will default to a unique 16 character hex string
6
+ * expiresMs and inactiveMs are used to "expire" the session, but can be overridden in the constructor. Pass 0 to disable expiration timers.
7
+ */
8
+ constructor(opts: any);
9
+ setup({ agentIdentifier, key, value, expiresMs, inactiveMs, storageAPI }: {
10
+ agentIdentifier: any;
11
+ key: any;
12
+ value?: string | undefined;
13
+ expiresMs?: number | undefined;
14
+ inactiveMs?: number | undefined;
15
+ storageAPI?: LocalMemory | undefined;
16
+ }): void;
17
+ storage: LocalMemory | undefined;
18
+ agentIdentifier: any;
19
+ key: any;
20
+ value: string | undefined;
21
+ expiresMs: number | undefined;
22
+ inactiveMs: number | undefined;
23
+ ee: any;
24
+ expiresAt: any;
25
+ expiresTimer: Timer | undefined;
26
+ inactiveAt: any;
27
+ inactiveTimer: InteractionTimer | undefined;
28
+ isNew: boolean | undefined;
29
+ initialized: boolean | undefined;
30
+ get lookupKey(): string;
31
+ sync(data: any): void;
32
+ /**
33
+ * Fetch the stored values from the storage API tied to this entity
34
+ * @returns {Object}
35
+ */
36
+ read(): Object;
37
+ /**
38
+ * Store data to the storage API tied to this entity
39
+ * To preseve existing attributes, the output of ...session.read()
40
+ * should be appended to the data argument
41
+ * @param {Object} data
42
+ * @returns {Object}
43
+ */
44
+ write(data: Object): Object;
45
+ reset(): Object;
46
+ /**
47
+ * Refresh the inactivity timer data
48
+ */
49
+ refresh(): void;
50
+ /**
51
+ * @param {number} timestamp
52
+ * @returns {boolean}
53
+ */
54
+ isExpired(timestamp: number): boolean;
55
+ /**
56
+ * @param {Object} data
57
+ * @returns {boolean}
58
+ */
59
+ isInvalid(data: Object): boolean;
60
+ collectSM(type: any, data: any, useUpdatedAt: any): void;
61
+ /**
62
+ * @param {number} futureMs - The number of ms to use to generate a future timestamp
63
+ * @returns {number}
64
+ */
65
+ getFutureTimestamp(futureMs: number): number;
66
+ syncCustomAttribute(key: any, value: any): void;
67
+ custom: any;
68
+ }
69
+ import { LocalMemory } from '../storage/local-memory';
70
+ import { Timer } from '../timer/timer';
71
+ import { InteractionTimer } from '../timer/interaction-timer';
72
+ //# sourceMappingURL=session-entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AAyBA;IACE;;;;;OAKG;IACH,uBAEC;IAED;;;;;;;aA6EC;IA3EsB,iCAAgC;IAKrD,qBAAsC;IAGtC,SAAc;IAEd,0BAAkB;IAElB,8BAA0B;IAC1B,+BAA4B;IAE5B,QAAiC;IAe/B,eAA6E;IAC7E,gCAO+B;IAS/B,gBAAgF;IAChF,4CAagC;IAOlC,2BAA6C;IAM7C,iCAAuB;IAIzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAgBlB;IAED,gBAyBC;IAED;;OAEG;IACH,gBAKC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAYC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;4BAvQ2B,yBAAyB;sBAH/B,gBAAgB;iCAIL,4BAA4B"}
@@ -0,0 +1,8 @@
1
+ export class FirstPartyCookies {
2
+ constructor(domain: any);
3
+ domain: any;
4
+ get(name: any): string | undefined;
5
+ set(key: any, value: any): void;
6
+ remove(key: any): string | undefined;
7
+ }
8
+ //# sourceMappingURL=first-party-cookies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-party-cookies.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/first-party-cookies.js"],"names":[],"mappings":"AAAA;IACE,yBAEC;IADC,YAAoB;IAGtB,mCAOC;IAED,gCAOC;IAED,qCAMC;CACF"}
@@ -0,0 +1,8 @@
1
+ export class LocalMemory {
2
+ constructor(initialState?: {});
3
+ state: {};
4
+ get(key: any): any;
5
+ set(key: any, value: any): void;
6
+ remove(key: any): void;
7
+ }
8
+ //# sourceMappingURL=local-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-memory.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-memory.js"],"names":[],"mappings":"AAAA;IACE,+BAEC;IADC,UAAyB;IAG3B,mBAMC;IAED,gCAOC;IAED,uBAMC;CACF"}
@@ -0,0 +1,6 @@
1
+ export class LocalStorage {
2
+ get(key: any): string | undefined;
3
+ set(key: any, value: any): void;
4
+ remove(key: any): void;
5
+ }
6
+ //# sourceMappingURL=local-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-storage.js"],"names":[],"mappings":"AAAA;IACE,kCAQC;IAED,gCAOC;IAED,uBAMC;CACF"}
@@ -0,0 +1,11 @@
1
+ export class InteractionTimer extends Timer {
2
+ onRefresh: any;
3
+ onPause: any;
4
+ remainingMs: number | undefined;
5
+ abortController: AbortController | undefined;
6
+ abort(): void;
7
+ pause(): void;
8
+ refresh(cb: any, ms: any): void;
9
+ }
10
+ import { Timer } from './timer';
11
+ //# sourceMappingURL=interaction-timer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-timer.d.ts","sourceRoot":"","sources":["../../../../src/common/timer/interaction-timer.js"],"names":[],"mappings":"AAKA;IAGI,eAA+B;IAC/B,aAA2B;IAG3B,gCAA4B;IAM1B,6CAA4C;IA+BhD,cAGC;IAED,cAIC;IAED,gCAMC;CAQF;sBA1EqB,SAAS"}
@@ -0,0 +1,12 @@
1
+ export class Timer {
2
+ constructor(opts: any, ms: any);
3
+ onEnd: any;
4
+ initialMs: any;
5
+ startTimestamp: number;
6
+ timer: NodeJS.Timeout;
7
+ create(cb: any, ms: any): NodeJS.Timeout;
8
+ clear(): void;
9
+ end(): void;
10
+ isValid(): boolean;
11
+ }
12
+ //# sourceMappingURL=timer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../../../src/common/timer/timer.js"],"names":[],"mappings":"AACA;IACE,gCAQC;IALC,WAAuB;IACvB,eAAmB;IACnB,uBAAgC;IAEhC,sBAAwC;IAG1C,yCAGC;IAED,cAGC;IAED,YAGC;IAED,mBAEC;CACF"}
@@ -1,2 +1,8 @@
1
- export function dataSize(data: any): number | undefined;
1
+ /**
2
+ * Returns the size of the provided data. Designed for measuring XHR responses.
3
+ *
4
+ * @param {*} data - The data to be measured.
5
+ * @returns {(number|undefined)} - The size of the data or undefined if size cannot be determined.
6
+ */
7
+ export function dataSize(data: any): (number | undefined);
2
8
  //# sourceMappingURL=data-size.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-size.d.ts","sourceRoot":"","sources":["../../../../src/common/util/data-size.js"],"names":[],"mappings":"AAOA,wDAaC"}
1
+ {"version":3,"file":"data-size.d.ts","sourceRoot":"","sources":["../../../../src/common/util/data-size.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,qCAFa,CAAC,MAAM,GAAC,SAAS,CAAC,CAe9B"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Reduce the invocation of the supplied function so that it is only invoked
3
+ * once within a given timeout.
4
+ *
5
+ * If `wait` is `0`, the function will be invoked during the next tick.
6
+ * If `options.leading` is false or not provided, the function will be invoked
7
+ * N milliseconds after the last invocation of the returned function where
8
+ * N is the `timeout` value.
9
+ * If `options.leading` is true, the function will be invoked immediately upon
10
+ * the first invocation of the returned function and not again for N milliseconds
11
+ * where N is the `timeout` value.
12
+ * @param {function} func Function whose invocation should be limited so it is only invoked
13
+ * once within a given timeout period.
14
+ * @param {number} timeout Time in milliseconds that the function should only be invoked
15
+ * once within.
16
+ * @param {object} options Debounce options
17
+ * @param {boolean} options.leading Forces the function to be invoked on the first
18
+ * invocation of the returned function instead of N milliseconds after the last
19
+ * invocation.
20
+ * @returns {function} A wrapping function that will ensure the provided function
21
+ * is invoked only once within the given timeout.
22
+ */
23
+ export function debounce(func: Function, timeout?: number, options?: {
24
+ leading: boolean;
25
+ }): Function;
26
+ /**
27
+ * Reduce the invocation of the supplied function so that it is only invoked
28
+ * once.
29
+ * @param {function} func Function whose invocation should be limited so it is only invoked
30
+ * once.
31
+ * @returns {function} A wrapping function that will ensure the provided function
32
+ * is invoked only once.
33
+ */
34
+ export function single(func: Function): Function;
35
+ //# sourceMappingURL=invoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../../../src/common/util/invoke.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mDATW,MAAM;IAGW,OAAO,EAAxB,OAAO;aAoBjB;AAED;;;;;;;GAOG;AACH,iDAQC"}
@@ -1 +1 @@
1
- {"version":3,"file":"obfuscate.d.ts","sourceRoot":"","sources":["../../../../src/common/util/obfuscate.js"],"names":[],"mappings":"AAqCA,sDAUC;AAGD,mDAsBC;AA/DD;IAKE,2BAEC;IAGD,kCAcC;CACF;8BAjC6B,2BAA2B"}
1
+ {"version":3,"file":"obfuscate.d.ts","sourceRoot":"","sources":["../../../../src/common/util/obfuscate.js"],"names":[],"mappings":"AAiCA,sDAUC;AAGD,mDAsBC;AA3DD;IACE,2BAEC;IAGD,kCAcC;CACF;8BA7B6B,2BAA2B"}