@newrelic/browser-agent 0.1.230 → 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 (365) hide show
  1. package/README.md +27 -3
  2. package/dist/cjs/common/browser-version/ios-version.js +4 -3
  3. package/dist/cjs/common/config/state/configurable.js +27 -21
  4. package/dist/cjs/common/config/state/info.js +1 -1
  5. package/dist/cjs/common/config/state/init.js +9 -1
  6. package/dist/cjs/common/config/state/loader-config.js +1 -1
  7. package/dist/cjs/common/config/state/runtime.js +26 -28
  8. package/dist/cjs/common/constants/env.cdn.js +29 -0
  9. package/dist/cjs/common/constants/env.js +32 -0
  10. package/dist/cjs/common/constants/env.npm.js +30 -0
  11. package/dist/cjs/common/context/shared-context.js +2 -1
  12. package/dist/cjs/common/event-emitter/contextual-ee.test.js +282 -0
  13. package/dist/cjs/common/event-emitter/handle.test.js +58 -0
  14. package/dist/cjs/common/event-emitter/register-handler.test.js +55 -0
  15. package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
  16. package/dist/cjs/common/harvest/harvest-scheduler.js +14 -11
  17. package/dist/cjs/common/harvest/harvest.js +5 -3
  18. package/dist/cjs/common/ids/id.js +14 -6
  19. package/dist/cjs/common/ids/id.test.js +85 -0
  20. package/dist/cjs/common/ids/unique-id.js +75 -51
  21. package/dist/cjs/common/ids/unique-id.test.js +49 -0
  22. package/dist/cjs/common/session/constants.js +12 -0
  23. package/dist/cjs/common/session/session-entity.js +278 -0
  24. package/dist/cjs/common/session/session-entity.test.js +436 -0
  25. package/dist/cjs/common/storage/first-party-cookies.js +35 -0
  26. package/dist/cjs/common/storage/local-memory.js +35 -0
  27. package/dist/cjs/common/storage/local-memory.test.js +20 -0
  28. package/dist/cjs/common/storage/local-storage.js +33 -0
  29. package/dist/cjs/common/storage/local-storage.test.js +14 -0
  30. package/dist/cjs/common/timer/interaction-timer.js +78 -0
  31. package/dist/cjs/common/timer/interaction-timer.test.js +216 -0
  32. package/dist/cjs/common/timer/timer.js +32 -0
  33. package/dist/cjs/common/timer/timer.test.js +105 -0
  34. package/dist/cjs/common/timing/nav-timing.js +51 -30
  35. package/dist/cjs/common/timing/nav-timing.test.js +192 -0
  36. package/dist/cjs/common/unload/eol.js +2 -2
  37. package/dist/cjs/common/url/clean-url.test.js +9 -0
  38. package/dist/cjs/common/url/encode.test.js +74 -0
  39. package/dist/cjs/common/url/location.js +4 -0
  40. package/dist/cjs/common/url/location.test.js +13 -0
  41. package/dist/cjs/common/url/parse-url.test.js +111 -0
  42. package/dist/cjs/common/url/protocol.js +2 -12
  43. package/dist/cjs/common/url/protocol.test.js +16 -0
  44. package/dist/cjs/common/util/console.js +1 -1
  45. package/dist/cjs/common/util/data-size.js +6 -0
  46. package/dist/cjs/common/util/data-size.test.js +47 -0
  47. package/dist/cjs/common/util/invoke.js +73 -0
  48. package/dist/cjs/common/util/invoke.test.js +49 -0
  49. package/dist/cjs/common/util/map-own.test.js +3 -3
  50. package/dist/cjs/common/util/obfuscate.js +1 -5
  51. package/dist/cjs/common/window/page-visibility.js +5 -2
  52. package/dist/cjs/common/wrap/index.js +0 -7
  53. package/dist/cjs/common/wrap/wrap-events.js +6 -9
  54. package/dist/cjs/common/wrap/wrap-fetch.js +6 -6
  55. package/dist/cjs/common/wrap/wrap-history.js +7 -6
  56. package/dist/cjs/common/wrap/wrap-jsonp.js +7 -6
  57. package/dist/cjs/common/wrap/wrap-mutation.js +7 -6
  58. package/dist/cjs/common/wrap/wrap-promise.js +7 -6
  59. package/dist/cjs/common/wrap/wrap-promise.test.js +119 -0
  60. package/dist/cjs/common/wrap/wrap-raf.js +6 -6
  61. package/dist/cjs/common/wrap/wrap-timer.js +7 -7
  62. package/dist/cjs/common/wrap/wrap-xhr.js +5 -6
  63. package/dist/cjs/features/ajax/aggregate/index.js +3 -3
  64. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
  65. package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +1 -1
  66. package/dist/cjs/features/jserrors/aggregate/index.js +6 -6
  67. package/dist/cjs/features/jserrors/instrument/index.js +2 -2
  68. package/dist/cjs/features/metrics/aggregate/index.js +19 -9
  69. package/dist/cjs/features/metrics/instrument/index.js +0 -25
  70. package/dist/cjs/features/metrics/instrument/workers-helper.js +5 -5
  71. package/dist/cjs/features/page_action/aggregate/index.js +3 -3
  72. package/dist/cjs/features/page_view_event/aggregate/index.js +23 -9
  73. package/dist/cjs/features/page_view_timing/aggregate/index.js +40 -30
  74. package/dist/cjs/features/session_trace/aggregate/index.js +18 -15
  75. package/dist/cjs/features/spa/aggregate/index.js +6 -5
  76. package/dist/cjs/features/utils/agent-session.js +73 -0
  77. package/dist/cjs/features/utils/feature-base.js +1 -1
  78. package/dist/cjs/features/utils/instrument-base.js +12 -3
  79. package/dist/cjs/features/utils/lazy-loader.js +2 -2
  80. package/dist/cjs/loaders/agent.js +2 -2
  81. package/dist/cjs/loaders/api/api.js +9 -9
  82. package/dist/cjs/loaders/api/apiAsync.js +3 -2
  83. package/dist/cjs/loaders/configure/configure.js +0 -6
  84. package/dist/cjs/loaders/features/enabled-features.js +1 -1
  85. package/dist/cjs/loaders/micro-agent.js +2 -1
  86. package/dist/esm/common/browser-version/ios-version.js +4 -3
  87. package/dist/esm/common/config/state/configurable.js +26 -20
  88. package/dist/esm/common/config/state/info.js +1 -1
  89. package/dist/esm/common/config/state/init.js +9 -1
  90. package/dist/esm/common/config/state/loader-config.js +1 -1
  91. package/dist/esm/common/config/state/runtime.js +26 -28
  92. package/dist/esm/common/constants/env.cdn.js +20 -0
  93. package/dist/esm/common/constants/env.js +23 -0
  94. package/dist/esm/common/constants/env.npm.js +21 -0
  95. package/dist/esm/common/context/shared-context.js +2 -1
  96. package/dist/esm/common/event-emitter/contextual-ee.test.js +278 -0
  97. package/dist/esm/common/event-emitter/handle.test.js +54 -0
  98. package/dist/esm/common/event-emitter/register-handler.test.js +51 -0
  99. package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
  100. package/dist/esm/common/harvest/harvest-scheduler.js +14 -11
  101. package/dist/esm/common/harvest/harvest.js +4 -2
  102. package/dist/esm/common/ids/id.js +16 -6
  103. package/dist/esm/common/ids/id.test.js +81 -0
  104. package/dist/esm/common/ids/unique-id.js +75 -51
  105. package/dist/esm/common/ids/unique-id.test.js +44 -0
  106. package/dist/esm/common/session/constants.js +3 -0
  107. package/dist/esm/common/session/session-entity.js +271 -0
  108. package/dist/esm/common/session/session-entity.test.js +434 -0
  109. package/dist/esm/common/storage/first-party-cookies.js +28 -0
  110. package/dist/esm/common/storage/local-memory.js +28 -0
  111. package/dist/esm/common/storage/local-memory.test.js +18 -0
  112. package/dist/esm/common/storage/local-storage.js +26 -0
  113. package/dist/esm/common/storage/local-storage.test.js +12 -0
  114. package/dist/esm/common/timer/interaction-timer.js +71 -0
  115. package/dist/esm/common/timer/interaction-timer.test.js +214 -0
  116. package/dist/esm/common/timer/timer.js +25 -0
  117. package/dist/esm/common/timer/timer.test.js +103 -0
  118. package/dist/esm/common/timing/nav-timing.js +51 -29
  119. package/dist/esm/common/timing/nav-timing.test.js +190 -0
  120. package/dist/esm/common/unload/eol.js +1 -1
  121. package/dist/esm/common/url/clean-url.test.js +7 -0
  122. package/dist/esm/common/url/encode.test.js +70 -0
  123. package/dist/esm/common/url/location.js +4 -0
  124. package/dist/esm/common/url/location.test.js +11 -0
  125. package/dist/esm/common/url/parse-url.test.js +107 -0
  126. package/dist/esm/common/url/protocol.js +3 -12
  127. package/dist/esm/common/url/protocol.test.js +14 -0
  128. package/dist/esm/common/util/console.js +1 -1
  129. package/dist/esm/common/util/data-size.js +7 -0
  130. package/dist/esm/common/util/data-size.test.js +45 -0
  131. package/dist/esm/common/util/invoke.js +66 -0
  132. package/dist/esm/common/util/invoke.test.js +47 -0
  133. package/dist/esm/common/util/map-own.test.js +3 -3
  134. package/dist/esm/common/util/obfuscate.js +2 -6
  135. package/dist/esm/common/window/page-visibility.js +5 -2
  136. package/dist/esm/common/wrap/index.js +1 -2
  137. package/dist/esm/common/wrap/wrap-events.js +6 -9
  138. package/dist/esm/common/wrap/wrap-fetch.js +6 -6
  139. package/dist/esm/common/wrap/wrap-history.js +7 -6
  140. package/dist/esm/common/wrap/wrap-jsonp.js +7 -6
  141. package/dist/esm/common/wrap/wrap-mutation.js +7 -6
  142. package/dist/esm/common/wrap/wrap-promise.js +7 -6
  143. package/dist/esm/common/wrap/wrap-promise.test.js +115 -0
  144. package/dist/esm/common/wrap/wrap-raf.js +6 -6
  145. package/dist/esm/common/wrap/wrap-timer.js +7 -7
  146. package/dist/esm/common/wrap/wrap-xhr.js +5 -6
  147. package/dist/esm/features/ajax/aggregate/index.js +3 -3
  148. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
  149. package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +1 -1
  150. package/dist/esm/features/jserrors/aggregate/index.js +6 -6
  151. package/dist/esm/features/jserrors/instrument/index.js +2 -2
  152. package/dist/esm/features/metrics/aggregate/index.js +21 -11
  153. package/dist/esm/features/metrics/instrument/index.js +0 -25
  154. package/dist/esm/features/metrics/instrument/workers-helper.js +5 -5
  155. package/dist/esm/features/page_action/aggregate/index.js +3 -3
  156. package/dist/esm/features/page_view_event/aggregate/index.js +23 -9
  157. package/dist/esm/features/page_view_timing/aggregate/index.js +40 -30
  158. package/dist/esm/features/session_trace/aggregate/index.js +18 -15
  159. package/dist/esm/features/spa/aggregate/index.js +6 -5
  160. package/dist/esm/features/utils/agent-session.js +67 -0
  161. package/dist/esm/features/utils/feature-base.js +1 -1
  162. package/dist/esm/features/utils/instrument-base.js +7 -2
  163. package/dist/esm/features/utils/lazy-loader.js +2 -2
  164. package/dist/esm/loaders/agent.js +2 -2
  165. package/dist/esm/loaders/api/api.js +6 -9
  166. package/dist/esm/loaders/api/apiAsync.js +2 -1
  167. package/dist/esm/loaders/configure/configure.js +2 -8
  168. package/dist/esm/loaders/features/enabled-features.js +1 -1
  169. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  170. package/dist/types/common/config/state/init.d.ts.map +1 -1
  171. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  172. package/dist/types/common/constants/env.cdn.d.ts +18 -0
  173. package/dist/types/common/constants/env.cdn.d.ts.map +1 -0
  174. package/dist/types/common/constants/env.d.ts +13 -0
  175. package/dist/types/common/constants/env.d.ts.map +1 -0
  176. package/dist/types/common/constants/env.npm.d.ts +19 -0
  177. package/dist/types/common/constants/env.npm.d.ts.map +1 -0
  178. package/dist/types/common/context/shared-context.d.ts.map +1 -1
  179. package/dist/types/common/event-listener/event-listener-opts.d.ts +2 -2
  180. package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -1
  181. package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -0
  182. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  183. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  184. package/dist/types/common/ids/id.d.ts +11 -1
  185. package/dist/types/common/ids/id.d.ts.map +1 -1
  186. package/dist/types/common/ids/unique-id.d.ts +24 -1
  187. package/dist/types/common/ids/unique-id.d.ts.map +1 -1
  188. package/dist/types/common/session/constants.d.ts +4 -0
  189. package/dist/types/common/session/constants.d.ts.map +1 -0
  190. package/dist/types/common/session/session-entity.d.ts +72 -0
  191. package/dist/types/common/session/session-entity.d.ts.map +1 -0
  192. package/dist/types/common/storage/first-party-cookies.d.ts +8 -0
  193. package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -0
  194. package/dist/types/common/storage/local-memory.d.ts +8 -0
  195. package/dist/types/common/storage/local-memory.d.ts.map +1 -0
  196. package/dist/types/common/storage/local-storage.d.ts +6 -0
  197. package/dist/types/common/storage/local-storage.d.ts.map +1 -0
  198. package/dist/types/common/timer/interaction-timer.d.ts +11 -0
  199. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -0
  200. package/dist/types/common/timer/timer.d.ts +12 -0
  201. package/dist/types/common/timer/timer.d.ts.map +1 -0
  202. package/dist/types/common/timing/nav-timing.d.ts +1 -2
  203. package/dist/types/common/timing/nav-timing.d.ts.map +1 -1
  204. package/dist/types/common/unload/eol.d.ts.map +1 -1
  205. package/dist/types/common/url/location.d.ts +4 -0
  206. package/dist/types/common/url/location.d.ts.map +1 -1
  207. package/dist/types/common/url/parse-url.d.ts.map +1 -1
  208. package/dist/types/common/url/protocol.d.ts +1 -6
  209. package/dist/types/common/url/protocol.d.ts.map +1 -1
  210. package/dist/types/common/util/data-size.d.ts +7 -1
  211. package/dist/types/common/util/data-size.d.ts.map +1 -1
  212. package/dist/types/common/util/global-scope.d.ts.map +1 -1
  213. package/dist/types/common/util/invoke.d.ts +35 -0
  214. package/dist/types/common/util/invoke.d.ts.map +1 -0
  215. package/dist/types/common/util/obfuscate.d.ts.map +1 -1
  216. package/dist/types/common/window/page-visibility.d.ts +1 -1
  217. package/dist/types/common/window/page-visibility.d.ts.map +1 -1
  218. package/dist/types/common/wrap/index.d.ts +1 -2
  219. package/dist/types/common/wrap/index.d.ts.map +1 -1
  220. package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
  221. package/dist/types/common/wrap/wrap-history.d.ts.map +1 -1
  222. package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -1
  223. package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -1
  224. package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -1
  225. package/dist/types/common/wrap/wrap-raf.d.ts.map +1 -1
  226. package/dist/types/common/wrap/wrap-timer.d.ts.map +1 -1
  227. package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -1
  228. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  229. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  230. package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
  231. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  232. package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
  233. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  234. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  235. package/dist/types/features/metrics/instrument/index.d.ts +0 -1
  236. package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
  237. package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +1 -1
  238. package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
  239. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  240. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  241. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  242. package/dist/types/features/page_view_timing/aggregate/index.d.ts +3 -4
  243. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  244. package/dist/types/features/session_trace/aggregate/index.d.ts +3 -3
  245. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  246. package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
  247. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  248. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  249. package/dist/types/features/spa/instrument/index.d.ts.map +1 -1
  250. package/dist/types/features/utils/agent-session.d.ts +2 -0
  251. package/dist/types/features/utils/agent-session.d.ts.map +1 -0
  252. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  253. package/dist/types/features/utils/lazy-loader.d.ts +2 -2
  254. package/dist/types/features/utils/lazy-loader.d.ts.map +1 -1
  255. package/dist/types/loaders/api/api.d.ts.map +1 -1
  256. package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
  257. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  258. package/package.json +12 -32
  259. package/src/common/browser-version/ios-version.js +4 -3
  260. package/src/common/config/state/configurable.js +26 -19
  261. package/src/common/config/state/init.js +7 -0
  262. package/src/common/config/state/runtime.js +7 -10
  263. package/src/common/constants/env.cdn.js +20 -0
  264. package/src/common/constants/env.js +23 -0
  265. package/src/common/constants/env.npm.js +21 -0
  266. package/src/common/context/shared-context.js +2 -1
  267. package/src/common/event-emitter/contextual-ee.test.js +310 -0
  268. package/src/common/event-emitter/handle.test.js +56 -0
  269. package/src/common/event-emitter/register-handler.test.js +61 -0
  270. package/src/common/event-listener/event-listener-opts.js +4 -4
  271. package/src/common/harvest/harvest-scheduler.js +12 -8
  272. package/src/common/harvest/harvest.js +5 -3
  273. package/src/common/ids/id.js +15 -6
  274. package/src/common/ids/id.test.js +92 -0
  275. package/src/common/ids/unique-id.js +77 -54
  276. package/src/common/ids/unique-id.test.js +58 -0
  277. package/src/common/session/constants.js +3 -0
  278. package/src/common/session/session-entity.js +271 -0
  279. package/src/common/session/session-entity.test.js +317 -0
  280. package/src/common/storage/first-party-cookies.js +31 -0
  281. package/src/common/storage/local-memory.js +30 -0
  282. package/src/common/storage/local-memory.test.js +19 -0
  283. package/src/common/storage/local-storage.js +28 -0
  284. package/src/common/storage/local-storage.test.js +17 -0
  285. package/src/common/timer/interaction-timer.js +75 -0
  286. package/src/common/timer/interaction-timer.test.js +167 -0
  287. package/src/common/timer/timer.js +31 -0
  288. package/src/common/timer/timer.test.js +100 -0
  289. package/src/common/timing/nav-timing.js +50 -30
  290. package/src/common/timing/nav-timing.test.js +161 -0
  291. package/src/common/unload/eol.js +2 -3
  292. package/src/common/url/clean-url.test.js +25 -0
  293. package/src/common/url/encode.test.js +80 -0
  294. package/src/common/url/location.js +4 -0
  295. package/src/common/url/location.test.js +15 -0
  296. package/src/common/url/parse-url.js +1 -2
  297. package/src/common/url/parse-url.test.js +110 -0
  298. package/src/common/url/protocol.js +3 -13
  299. package/src/common/url/protocol.test.js +18 -0
  300. package/src/common/util/data-size.js +6 -0
  301. package/src/common/util/data-size.test.js +50 -0
  302. package/src/common/util/global-scope.js +1 -2
  303. package/src/common/util/invoke.js +55 -0
  304. package/src/common/util/invoke.test.js +65 -0
  305. package/src/common/util/obfuscate.js +2 -6
  306. package/src/common/window/page-visibility.js +3 -3
  307. package/src/common/wrap/index.js +1 -2
  308. package/src/common/wrap/wrap-events.js +5 -5
  309. package/src/common/wrap/wrap-fetch.js +4 -3
  310. package/src/common/wrap/wrap-history.js +6 -3
  311. package/src/common/wrap/wrap-jsonp.js +5 -3
  312. package/src/common/wrap/wrap-mutation.js +6 -3
  313. package/src/common/wrap/wrap-promise.js +7 -6
  314. package/src/common/wrap/wrap-promise.test.js +140 -0
  315. package/src/common/wrap/wrap-raf.js +5 -3
  316. package/src/common/wrap/wrap-timer.js +6 -4
  317. package/src/common/wrap/wrap-xhr.js +4 -3
  318. package/src/features/ajax/aggregate/index.js +2 -2
  319. package/src/features/ajax/instrument/index.js +1 -1
  320. package/src/features/jserrors/aggregate/index.js +3 -3
  321. package/src/features/jserrors/instrument/index.js +4 -2
  322. package/src/features/metrics/aggregate/index.js +21 -7
  323. package/src/features/metrics/instrument/index.js +0 -30
  324. package/src/features/metrics/instrument/workers-helper.js +9 -6
  325. package/src/features/page_action/aggregate/index.js +2 -2
  326. package/src/features/page_view_event/aggregate/index.js +21 -9
  327. package/src/features/page_view_timing/aggregate/index.js +40 -29
  328. package/src/features/page_view_timing/long-tasks.js +10 -10
  329. package/src/features/session_trace/aggregate/index.js +17 -14
  330. package/src/features/session_trace/instrument/index.js +3 -2
  331. package/src/features/spa/aggregate/index.js +5 -5
  332. package/src/features/spa/instrument/index.js +4 -2
  333. package/src/features/utils/agent-session.js +68 -0
  334. package/src/features/utils/feature-base.js +1 -1
  335. package/src/features/utils/instrument-base.js +5 -2
  336. package/src/features/utils/lazy-loader.js +1 -1
  337. package/src/loaders/agent.js +1 -1
  338. package/src/loaders/api/api.js +3 -6
  339. package/src/loaders/api/apiAsync.js +2 -1
  340. package/src/loaders/configure/configure.js +2 -7
  341. package/dist/cjs/common/constants/environment-variables.js +0 -20
  342. package/dist/cjs/common/util/single.js +0 -23
  343. package/dist/cjs/common/window/session-storage.js +0 -87
  344. package/dist/cjs/common/wrap/wrap-console.js +0 -54
  345. package/dist/cjs/features/utils/aggregate-base.js +0 -13
  346. package/dist/esm/common/constants/environment-variables.js +0 -11
  347. package/dist/esm/common/util/single.js +0 -16
  348. package/dist/esm/common/window/session-storage.js +0 -77
  349. package/dist/esm/common/wrap/wrap-console.js +0 -46
  350. package/dist/esm/features/utils/aggregate-base.js +0 -6
  351. package/dist/types/common/constants/environment-variables.d.ts +0 -4
  352. package/dist/types/common/constants/environment-variables.d.ts.map +0 -1
  353. package/dist/types/common/util/single.d.ts +0 -2
  354. package/dist/types/common/util/single.d.ts.map +0 -1
  355. package/dist/types/common/window/session-storage.d.ts +0 -18
  356. package/dist/types/common/window/session-storage.d.ts.map +0 -1
  357. package/dist/types/common/wrap/wrap-console.d.ts +0 -16
  358. package/dist/types/common/wrap/wrap-console.d.ts.map +0 -1
  359. package/dist/types/features/utils/aggregate-base.d.ts +0 -4
  360. package/dist/types/features/utils/aggregate-base.d.ts.map +0 -1
  361. package/src/common/constants/environment-variables.js +0 -11
  362. package/src/common/util/single.js +0 -18
  363. package/src/common/window/session-storage.js +0 -75
  364. package/src/common/wrap/wrap-console.js +0 -47
  365. package/src/features/utils/aggregate-base.js +0 -7
@@ -10,7 +10,7 @@ test('enumerates the object properties', () => {
10
10
  expect(callback).toHaveBeenCalledWith('foo', 'bar');
11
11
  });
12
12
  test('return array of results from callback invocation', () => {
13
- const callback = jest.fn((key, value) => `${key}:${value}`);
13
+ const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
14
14
  const input = {
15
15
  foo: 'bar',
16
16
  biz: 'baz'
@@ -21,7 +21,7 @@ test('return array of results from callback invocation', () => {
21
21
  expect(result).toContain('biz:baz');
22
22
  });
23
23
  test('does not iterate symbol properties', () => {
24
- const callback = jest.fn((key, value) => `${key}:${value}`);
24
+ const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
25
25
  const input = {
26
26
  foo: 'bar',
27
27
  [Symbol.for('biz')]: 'baz'
@@ -34,7 +34,7 @@ test('does not iterate inherited properties', () => {
34
34
  F.prototype = {
35
35
  biz: 'baz'
36
36
  };
37
- const callback = jest.fn((key, value) => `${key}:${value}`);
37
+ const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
38
38
  const input = new F();
39
39
  input.foo = 'bar';
40
40
  const result = (0, _mapOwn.mapOwn)(input, callback);
@@ -15,10 +15,6 @@ var fileProtocolRule = {
15
15
  replacement: 'file://OBFUSCATED'
16
16
  };
17
17
  class Obfuscator extends _sharedContext.SharedContext {
18
- constructor(parent) {
19
- super(parent); // gets any allowed properties from the parent and stores them in `sharedContext`
20
- }
21
-
22
18
  shouldObfuscate() {
23
19
  return getRules(this.sharedContext.agentIdentifier).length > 0;
24
20
  }
@@ -46,7 +42,7 @@ function getRules(agentIdentifier) {
46
42
  var rules = [];
47
43
  var configRules = (0, _config.getConfigurationValue)(agentIdentifier, 'obfuscate') || [];
48
44
  rules = rules.concat(configRules);
49
- if (_protocol.protocol.isFileProtocol()) rules.push(fileProtocolRule);
45
+ if ((0, _protocol.isFileProtocol)()) rules.push(fileProtocolRule);
50
46
  // could add additional runtime/environment-specific rules here
51
47
 
52
48
  return rules;
@@ -17,12 +17,15 @@ var _eventListenerOpts = require("../event-listener/event-listener-opts");
17
17
  */
18
18
  function subscribeToVisibilityChange(cb) {
19
19
  let toHiddenOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20
- (0, _eventListenerOpts.documentAddEventListener)('visibilitychange', handleVisibilityChange);
20
+ let capture = arguments.length > 2 ? arguments[2] : undefined;
21
+ let abortSignal = arguments.length > 3 ? arguments[3] : undefined;
22
+ (0, _eventListenerOpts.documentAddEventListener)('visibilitychange', handleVisibilityChange, capture, abortSignal);
21
23
  return;
22
24
  function handleVisibilityChange() {
23
25
  if (toHiddenOnly) {
24
26
  // trigger cb on change to hidden state only
25
- if (document.visibilityState == 'hidden') cb();else return;
27
+ if (document.visibilityState == 'hidden') cb();
28
+ return;
26
29
  }
27
30
  cb(document.visibilityState);
28
31
  }
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "wrapConsole", {
7
- enumerable: true,
8
- get: function () {
9
- return _wrapConsole.wrapConsole;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "wrapEvents", {
13
7
  enumerable: true,
14
8
  get: function () {
@@ -63,7 +57,6 @@ Object.defineProperty(exports, "wrapXhr", {
63
57
  return _wrapXhr.wrapXhr;
64
58
  }
65
59
  });
66
- var _wrapConsole = require("./wrap-console");
67
60
  var _wrapEvents = require("./wrap-events");
68
61
  var _wrapFetch = require("./wrap-fetch");
69
62
  var _wrapHistory = require("./wrap-history");
@@ -33,19 +33,16 @@ const REMOVE_EVENT_LISTENER = 'removeEventListener';
33
33
  */
34
34
  function wrapEvents(sharedEE) {
35
35
  var ee = scopedEE(sharedEE);
36
- if (wrapped[ee.debugId]++)
37
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
38
- {
39
- return ee;
40
- } // then we increment the count to track # of feats using this at runtime.
41
- wrapped[ee.debugId] = 1;
36
+
37
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
38
+ // then we increment the count to track # of feats using this at runtime.
39
+ if (wrapped[ee.debugId]++) return ee;
40
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap events
42
41
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee, true);
43
42
 
44
43
  // Guard against instrumenting environments w/o necessary features
45
44
  if ('getPrototypeOf' in Object) {
46
- if (_globalScope.isBrowserScope) {
47
- findEventListenerProtoAndCb(document, wrapNode);
48
- }
45
+ if (_globalScope.isBrowserScope) findEventListenerProtoAndCb(document, wrapNode);
49
46
  findEventListenerProtoAndCb(_globalScope.globalScope, wrapNode);
50
47
  findEventListenerProtoAndCb(XHR.prototype, wrapNode);
51
48
  }
@@ -41,12 +41,12 @@ function wrapFetch(sharedEE) {
41
41
  if (!(Req && Res && _globalScope.globalScope.fetch)) {
42
42
  return ee;
43
43
  }
44
- if (wrapped[ee.debugId]++)
45
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
46
- {
47
- return ee;
48
- } // then we increment the count to track # of feats using this at runtime.
49
- wrapped[ee.debugId] = 1;
44
+
45
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
46
+ // then we increment the count to track # of feats using this at runtime.
47
+ if (wrapped[ee.debugId]++) return ee;
48
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap fetch
49
+
50
50
  bodyMethods.forEach(method => {
51
51
  wrapPromiseMethod(Req[proto], method, bodyPrefix);
52
52
  wrapPromiseMethod(Res[proto], method, bodyPrefix);
@@ -28,12 +28,13 @@ const HISTORY_FNS = ['pushState', 'replaceState'];
28
28
  */
29
29
  function wrapHistory(sharedEE) {
30
30
  const ee = scopedEE(sharedEE);
31
- if (!_globalScope.isBrowserScope || wrapped[ee.debugId]++)
32
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
33
- {
34
- return ee;
35
- } // then we increment the count to track # of feats using this at runtime. (History API is only avail in browser DOM context.)
36
- wrapped[ee.debugId] = 1;
31
+
32
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
33
+ // then we increment the count to track # of feats using this at runtime. History API is only
34
+ // available in browser DOM context.
35
+ if (!_globalScope.isBrowserScope || wrapped[ee.debugId]++) return ee;
36
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap history
37
+
37
38
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
38
39
  /*
39
40
  * For objects that will be instantiated more than once, we wrap the object's prototype methods. The history object
@@ -29,12 +29,13 @@ const domInsertMethods = ['appendChild', 'insertBefore', 'replaceChild'];
29
29
  */
30
30
  function wrapJsonP(sharedEE) {
31
31
  const ee = scopedEE(sharedEE);
32
- if (!_globalScope.isBrowserScope || wrapped[ee.debugId])
33
- // JSONP deals with DOM tags so browser window env is req'd
34
- {
35
- return ee;
36
- }
37
- wrapped[ee.debugId] = true;
32
+
33
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
34
+ // then we increment the count to track # of feats using this at runtime. JSONP deals with DOM
35
+ // tags so browser window env is required.
36
+ if (!_globalScope.isBrowserScope || wrapped[ee.debugId]) return ee;
37
+ wrapped[ee.debugId] = true; // otherwise, first feature to wrap JSONP
38
+
38
39
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
39
40
  var CALLBACK_REGEX = /[?&](?:callback|cb)=([^&#]+)/;
40
41
  var PARENT_REGEX = /(.*)\.([^.]+)/;
@@ -28,12 +28,13 @@ const wrapped = {};
28
28
  */
29
29
  function wrapMutation(sharedEE) {
30
30
  const ee = scopedEE(sharedEE);
31
- if (!_globalScope.isBrowserScope || wrapped[ee.debugId])
32
- // relates to the DOM tree (web env only)
33
- {
34
- return ee;
35
- }
36
- wrapped[ee.debugId] = true;
31
+
32
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
33
+ // then we increment the count to track # of feats using this at runtime. Mutations API is only
34
+ // available in browser DOM context.
35
+ if (!_globalScope.isBrowserScope || wrapped[ee.debugId]) return ee;
36
+ wrapped[ee.debugId] = true; // otherwise, first feature to wrap mutations
37
+
37
38
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
38
39
  var OriginalObserver = _config.originals.MO;
39
40
  if (OriginalObserver) {
@@ -29,10 +29,12 @@ const wrapped = {};
29
29
  */
30
30
  function wrapPromise(sharedEE) {
31
31
  const promiseEE = scopedEE(sharedEE);
32
- if (wrapped[promiseEE.debugId]) {
33
- return promiseEE;
34
- }
35
- wrapped[promiseEE.debugId] = true;
32
+
33
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
34
+ // then we increment the count to track # of feats using this at runtime.
35
+ if (wrapped[promiseEE.debugId]) return promiseEE;
36
+ wrapped[promiseEE.debugId] = true; // otherwise, first feature to wrap promise
37
+
36
38
  var getContext = _contextualEe.getOrSetContext;
37
39
  var promiseWrapper = (0, _wrapFunction.createWrapperWithEmitter)(promiseEE);
38
40
  var prevPromiseObj = _config.originals.PR;
@@ -74,8 +76,7 @@ function wrapPromise(sharedEE) {
74
76
  WrappedPromise[method] = function (subPromises) {
75
77
  // use our own wrapped version of "Promise.all" and ".race" static fns
76
78
  let finalized = false;
77
- subPromises?.forEach(sub => {
78
- // eslint-disable-next-line
79
+ Array.from(subPromises || []).forEach(sub => {
79
80
  this.resolve(sub).then(setNrId(method === 'all'), setNrId(false));
80
81
  });
81
82
  const origFnCallWithThis = prevStaticFn.apply(this, arguments);
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ var _faker = require("@faker-js/faker");
4
+ var _globalScope = require("../util/global-scope");
5
+ var _config = require("../config/config");
6
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
7
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8
+ jest.mock('./wrap-function', () => ({
9
+ __esModule: true,
10
+ createWrapperWithEmitter: jest.fn(() => fn => function () {
11
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
+ args[_key] = arguments[_key];
13
+ }
14
+ return fn.apply(null, args);
15
+ })
16
+ }));
17
+ jest.mock('../event-emitter/contextual-ee', () => ({
18
+ __esModule: true,
19
+ getOrSetContext: jest.fn(() => ({})),
20
+ ee: {
21
+ get: jest.fn(name => ({
22
+ debugId: name,
23
+ on: jest.fn(),
24
+ context: jest.fn(() => ({})),
25
+ emit: jest.fn()
26
+ }))
27
+ }
28
+ }));
29
+ jest.mock('../config/config', () => ({
30
+ __esModule: true,
31
+ originals: {}
32
+ }));
33
+ jest.mock('../util/global-scope', () => ({
34
+ __esModule: true,
35
+ globalScope: {
36
+ NREUM: {}
37
+ }
38
+ }));
39
+ let promiseConstructorCalls;
40
+ beforeEach(async () => {
41
+ promiseConstructorCalls = [];
42
+
43
+ // Proxy the global Promise to prevent the wrapping from
44
+ // messing with Jest internal promises
45
+ _config.originals.PR = new Proxy(class extends Promise {}, {
46
+ construct(target, args) {
47
+ promiseConstructorCalls.push(args);
48
+ return Reflect.construct(target, args);
49
+ }
50
+ });
51
+ (await Promise.resolve().then(() => _interopRequireWildcard(require('./wrap-promise')))).wrapPromise();
52
+ });
53
+ afterEach(() => {
54
+ jest.resetModules();
55
+ });
56
+ test('should wrap promise constructor', async () => {
57
+ const promiseInstance = new _globalScope.globalScope.Promise(jest.fn());
58
+ expect(promiseInstance).toBeInstanceOf(Promise);
59
+ expect(promiseConstructorCalls.length).toEqual(1);
60
+ expect(_globalScope.globalScope.Promise.toString()).toMatch(/\[native code\]/);
61
+ expect(_globalScope.globalScope.Promise.name).toEqual('Promise');
62
+ });
63
+ describe('all', () => {
64
+ test('should work with acceptable iterables', async () => {
65
+ const resolveValue = _faker.faker.datatype.uuid();
66
+ const customIterable = new CustomIterable([new _globalScope.globalScope.Promise(resolve => resolve(resolveValue))]);
67
+ const arrayIterable = [new _globalScope.globalScope.Promise(resolve => resolve(resolveValue))];
68
+ const setIterable = new Set();
69
+ setIterable.add(new _globalScope.globalScope.Promise(resolve => resolve(resolveValue)));
70
+ await expect(_globalScope.globalScope.Promise.all(customIterable)).resolves.toEqual([resolveValue]);
71
+ await expect(_globalScope.globalScope.Promise.all(arrayIterable)).resolves.toEqual([resolveValue]);
72
+ await expect(_globalScope.globalScope.Promise.all(setIterable)).resolves.toEqual([resolveValue]);
73
+ });
74
+ test.each([null, undefined])('should not try to iterate a non-iterable %s', async input => {
75
+ jest.spyOn(_globalScope.globalScope.Promise, 'resolve');
76
+ await expect(_globalScope.globalScope.Promise.all(input)).rejects.toThrow();
77
+ expect(_globalScope.globalScope.Promise.resolve).not.toHaveBeenCalled();
78
+ });
79
+ });
80
+ describe('race', () => {
81
+ test('should work with acceptable iterables', async () => {
82
+ jest.spyOn(_globalScope.globalScope.Promise, 'resolve');
83
+ const resolveValue = _faker.faker.datatype.uuid();
84
+ const customIterable = new CustomIterable([new _globalScope.globalScope.Promise(resolve => resolve(resolveValue))]);
85
+ const arrayIterable = [new _globalScope.globalScope.Promise(resolve => resolve(resolveValue))];
86
+ const setIterable = new Set();
87
+ setIterable.add(new _globalScope.globalScope.Promise(resolve => resolve(resolveValue)));
88
+ await expect(_globalScope.globalScope.Promise.race(customIterable)).resolves.toEqual(resolveValue);
89
+ await expect(_globalScope.globalScope.Promise.race(arrayIterable)).resolves.toEqual(resolveValue);
90
+ await expect(_globalScope.globalScope.Promise.race(setIterable)).resolves.toEqual(resolveValue);
91
+ expect(_globalScope.globalScope.Promise.resolve).toHaveBeenCalled();
92
+ });
93
+ test.each([null, undefined])('should not try to iterate a non-iterable %s', async input => {
94
+ jest.spyOn(_globalScope.globalScope.Promise, 'resolve');
95
+ await expect(_globalScope.globalScope.Promise.race(input)).rejects.toThrow();
96
+ expect(_globalScope.globalScope.Promise.resolve).not.toHaveBeenCalled();
97
+ });
98
+ });
99
+ class CustomIterable {
100
+ #iterables = [];
101
+ constructor(iterables) {
102
+ this.#iterables = iterables;
103
+ }
104
+ [Symbol.iterator]() {
105
+ return {
106
+ index: 0,
107
+ iterables: this.#iterables,
108
+ next() {
109
+ return {
110
+ done: this.index >= this.iterables.length,
111
+ value: this.iterables[this.index++] || undefined
112
+ };
113
+ },
114
+ [Symbol.iterator]() {
115
+ return this;
116
+ }
117
+ };
118
+ }
119
+ }
@@ -28,12 +28,12 @@ const RAF_NAME = 'requestAnimationFrame';
28
28
  */
29
29
  function wrapRaf(sharedEE) {
30
30
  const ee = scopedEE(sharedEE);
31
- if (!_globalScope.isBrowserScope || wrapped[ee.debugId]++)
32
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
33
- {
34
- return ee;
35
- } // then we increment the count to track # of feats using this at runtime. (RAF is only avail in browser DOM context.)
36
- wrapped[ee.debugId] = 1;
31
+
32
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
33
+ // then we increment the count to track # of feats using this at runtime.
34
+ if (!_globalScope.isBrowserScope || wrapped[ee.debugId]++) return ee;
35
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap RAF
36
+
37
37
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
38
38
  wrapFn.inPlace(window, [RAF_NAME], 'raf-');
39
39
  ee.on('raf-start', function (args) {
@@ -32,15 +32,15 @@ const TIMER_FNS = [SET_TIMEOUT, 'setImmediate', SET_INTERVAL, CLEAR_TIMEOUT, 'cl
32
32
  * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.
33
33
  * @returns {Object} Scoped event emitter with a debug ID of `timer`.
34
34
  */
35
- //eslint-disable-next-line
35
+ // eslint-disable-next-line
36
36
  function wrapTimer(sharedEE) {
37
37
  const ee = scopedEE(sharedEE);
38
- if (wrapped[ee.debugId]++)
39
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
40
- {
41
- return ee;
42
- } // then we increment the count to track # of feats using this at runtime.
43
- wrapped[ee.debugId] = 1;
38
+
39
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
40
+ // then we increment the count to track # of feats using this at runtime.
41
+ if (wrapped[ee.debugId]++) return ee;
42
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap timer
43
+
44
44
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
45
45
  wrapFn.inPlace(_globalScope.globalScope, TIMER_FNS.slice(0, 2), SET_TIMEOUT + DASH);
46
46
  wrapFn.inPlace(_globalScope.globalScope, TIMER_FNS.slice(2, 3), SET_INTERVAL + DASH);
@@ -34,12 +34,11 @@ const XHR_PROPS = ['open', 'send']; // these are the specific funcs being wrappe
34
34
  function wrapXhr(sharedEE) {
35
35
  var baseEE = sharedEE || _contextualEe.ee;
36
36
  const ee = scopedEE(baseEE);
37
- if (wrapped[ee.debugId]++)
38
- // Notice if our wrapping never ran yet, the falsey NaN will not early return; but if it has,
39
- {
40
- return ee;
41
- } // then we increment the count to track # of feats using this at runtime.
42
- wrapped[ee.debugId] = 1; // <- otherwise, first feature to wrap XHR
37
+
38
+ // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
39
+ // then we increment the count to track # of feats using this at runtime.
40
+ if (wrapped[ee.debugId]++) return ee;
41
+ wrapped[ee.debugId] = 1; // otherwise, first feature to wrap XHR
43
42
 
44
43
  (0, _wrapEvents.wrapEvents)(baseEE); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us
45
44
  var wrapFn = (0, _wrapFunction.createWrapperWithEmitter)(ee);
@@ -11,17 +11,17 @@ var _handle = require("../../../common/event-emitter/handle");
11
11
  var _config = require("../../../common/config/config");
12
12
  var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
13
13
  var _denyList = require("../../../common/deny-list/deny-list");
14
- var _aggregateBase = require("../../utils/aggregate-base");
15
14
  var _constants = require("../constants");
16
15
  var _drain = require("../../../common/drain/drain");
17
16
  var _features = require("../../../loaders/features/features");
18
17
  var _constants2 = require("../../metrics/constants");
18
+ var _featureBase = require("../../utils/feature-base");
19
19
  /*
20
20
  * Copyright 2020 New Relic Corporation. All rights reserved.
21
21
  * SPDX-License-Identifier: Apache-2.0
22
22
  */
23
23
 
24
- class Aggregate extends _aggregateBase.AggregateBase {
24
+ class Aggregate extends _featureBase.FeatureBase {
25
25
  static featureName = _constants.FEATURE_NAME;
26
26
  constructor(agentIdentifier, aggregator) {
27
27
  super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
@@ -62,7 +62,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
62
62
  onFinished: onEventsHarvestFinished,
63
63
  getPayload: prepareHarvest
64
64
  }, this);
65
- ee.on(`drain-${this.featureName}`, () => {
65
+ ee.on("drain-".concat(this.featureName), () => {
66
66
  scheduler.startTimer(harvestTimeSeconds);
67
67
  });
68
68
  }
@@ -146,7 +146,7 @@ describe('errors without stack property and with line property', () => {
146
146
  mode: 'sourceline',
147
147
  name: mockError.name,
148
148
  message: mockError.message,
149
- stackString: `${mockError.name}: ${mockError.message}\n at ${sourceURL}:${mockError.line}`
149
+ stackString: "".concat(mockError.name, ": ").concat(mockError.message, "\n at ").concat(sourceURL, ":").concat(mockError.line)
150
150
  }));
151
151
  expect(result.frames.length).toEqual(1);
152
152
  expect(result.frames).toContainEqual(expect.objectContaining({
@@ -172,7 +172,7 @@ describe('errors without stack property and with line property', () => {
172
172
  mode: 'sourceline',
173
173
  name: mockError.name,
174
174
  message: mockError.message,
175
- stackString: `${mockError.name}: ${mockError.message}\n at ${sourceURL}:${mockError.line}:${mockError.column}`
175
+ stackString: "".concat(mockError.name, ": ").concat(mockError.message, "\n at ").concat(sourceURL, ":").concat(mockError.line, ":").concat(mockError.column)
176
176
  }));
177
177
  expect(result.frames.length).toEqual(1);
178
178
  expect(result.frames).toContainEqual(expect.objectContaining({
@@ -193,7 +193,7 @@ describe('errors without stack property and with line property', () => {
193
193
  mode: 'sourceline',
194
194
  name: mockError.name,
195
195
  message: mockError.message,
196
- stackString: `RangeError: ${mockError.message}\n in evaluated code`
196
+ stackString: "RangeError: ".concat(mockError.message, "\n in evaluated code")
197
197
  }));
198
198
  expect(result.frames.length).toEqual(1);
199
199
  expect(result.frames).toContainEqual(expect.objectContaining({
@@ -232,7 +232,7 @@ describe('errors that are messages only or primitives', () => {
232
232
  expect(result).toEqual(expect.objectContaining({
233
233
  mode: 'nameonly',
234
234
  name: mockError.name,
235
- stackString: `${mockError.name}: undefined`,
235
+ stackString: "".concat(mockError.name, ": undefined"),
236
236
  frames: []
237
237
  }));
238
238
  });
@@ -248,7 +248,7 @@ describe('errors that are messages only or primitives', () => {
248
248
  mode: 'nameonly',
249
249
  name: mockError.name,
250
250
  message: mockError.message,
251
- stackString: `${mockError.name}: ${mockError.message}`,
251
+ stackString: "".concat(mockError.name, ": ").concat(mockError.message),
252
252
  frames: []
253
253
  }));
254
254
  });
@@ -25,7 +25,7 @@ describe('formatStackTrace', () => {
25
25
  });
26
26
  test('truncates the middle of the stack lines when more than 100', () => {
27
27
  const input = Array.apply(null, Array(200)).map(() => _faker.faker.datatype.uuid());
28
- const expected = input.slice(0, 50).join('\n') + `\n< ...truncated ${input.length - 100} lines... >\n` + input.slice(-50).join('\n');
28
+ const expected = input.slice(0, 50).join('\n') + "\n< ...truncated ".concat(input.length - 100, " lines... >\n") + input.slice(-50).join('\n');
29
29
  const result = (0, _formatStackTrace.formatStackTrace)(input);
30
30
  expect(result).toEqual(expected);
31
31
  });
@@ -17,16 +17,16 @@ var _mapOwn = require("../../../common/util/map-own");
17
17
  var _config = require("../../../common/config/config");
18
18
  var _now = require("../../../common/timing/now");
19
19
  var _globalScope = require("../../../common/util/global-scope");
20
- var _aggregateBase = require("../../utils/aggregate-base");
21
20
  var _constants = require("../constants");
22
21
  var _drain = require("../../../common/drain/drain");
23
22
  var _features = require("../../../loaders/features/features");
23
+ var _featureBase = require("../../utils/feature-base");
24
24
  /*
25
25
  * Copyright 2020 New Relic Corporation. All rights reserved.
26
26
  * SPDX-License-Identifier: Apache-2.0
27
27
  */
28
28
 
29
- class Aggregate extends _aggregateBase.AggregateBase {
29
+ class Aggregate extends _featureBase.FeatureBase {
30
30
  static featureName = _constants.FEATURE_NAME;
31
31
  constructor(agentIdentifier, aggregator) {
32
32
  var _this;
@@ -60,7 +60,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
60
60
  });
61
61
 
62
62
  // Don't start harvesting until "drain" for this feat has been called (which currently requires RUM response).
63
- this.ee.on(`drain-${this.featureName}`, () => {
63
+ this.ee.on("drain-".concat(this.featureName), () => {
64
64
  if (!this.blocked) scheduler.startTimer(harvestTimeSeconds); // and only if ingest will accept jserror payloads
65
65
  });
66
66
 
@@ -104,7 +104,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
104
104
  }
105
105
  }
106
106
  nameHash(params) {
107
- return (0, _stringHashCode.stringHashCode)(`${params.exceptionClass}_${params.message}_${params.stack_trace || params.browser_stack_hash}`);
107
+ return (0, _stringHashCode.stringHashCode)("".concat(params.exceptionClass, "_").concat(params.message, "_").concat(params.stack_trace || params.browser_stack_hash));
108
108
  }
109
109
  getBucketName(params, customParams) {
110
110
  return this.nameHash(params) + ':' + (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(customParams));
@@ -186,7 +186,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
186
186
  * the canonical stack trace excludes items like the column number increasing the hit-rate of different errors potentially
187
187
  * bucketing and ultimately resulting in the loss of data in NR1.
188
188
  */
189
- var bucketHash = (0, _stringHashCode.stringHashCode)(`${stackInfo.name}_${stackInfo.message}_${stackInfo.stackString}`);
189
+ var bucketHash = (0, _stringHashCode.stringHashCode)("".concat(stackInfo.name, "_").concat(stackInfo.message, "_").concat(stackInfo.stackString));
190
190
  if (!this.stackReported[bucketHash]) {
191
191
  this.stackReported[bucketHash] = true;
192
192
  params.stack_trace = (0, _formatStackTrace.truncateSize)(stackInfo.stackString);
@@ -216,6 +216,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
216
216
 
217
217
  // still send EE events for other features such as above, but stop this one from aggregating internal data
218
218
  if (this.blocked) return;
219
+ var att = (0, _config.getInfo)(this.agentIdentifier).jsAttributes;
219
220
  if (params._interactionId != null) {
220
221
  // hold on to the error until the interaction finishes
221
222
  this.errorCache[params._interactionId] = this.errorCache[params._interactionId] || [];
@@ -223,7 +224,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
223
224
  } else {
224
225
  // store custom attributes
225
226
  var customParams = {};
226
- var att = (0, _config.getInfo)(this.agentIdentifier).jsAttributes;
227
227
  (0, _mapOwn.mapOwn)(att, setCustom);
228
228
  if (customAttributes) {
229
229
  (0, _mapOwn.mapOwn)(customAttributes, setCustom);
@@ -32,9 +32,9 @@ class Instrument extends _instrumentBase.InstrumentBase {
32
32
  // errors that will be the same as caught errors.
33
33
  this.skipNext = 0;
34
34
  try {
35
+ // this try-catch can be removed when IE11 is completely unsupported & gone
35
36
  this.removeOnAbort = new AbortController();
36
- } // this try-catch can be removed when IE11 is completely unsupported & gone
37
- catch (e) {}
37
+ } catch (e) {}
38
38
  const thisInstrument = this;
39
39
  thisInstrument.ee.on('fn-start', function (args, obj, methodName) {
40
40
  if (thisInstrument.abortHandler) thisInstrument.skipNext += 1;