@microsoft/applicationinsights-core-js 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28

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 (261) hide show
  1. package/browser/es5/applicationinsights-core-js.cjs.js +5477 -0
  2. package/browser/es5/applicationinsights-core-js.cjs.js.map +1 -0
  3. package/browser/es5/applicationinsights-core-js.cjs.min.js +6 -0
  4. package/browser/es5/applicationinsights-core-js.cjs.min.js.map +1 -0
  5. package/browser/es5/applicationinsights-core-js.gbl.js +5481 -0
  6. package/browser/es5/applicationinsights-core-js.gbl.js.map +1 -0
  7. package/browser/es5/applicationinsights-core-js.gbl.min.js +6 -0
  8. package/browser/es5/applicationinsights-core-js.gbl.min.js.map +1 -0
  9. package/browser/es5/applicationinsights-core-js.integrity.json +66 -0
  10. package/browser/{applicationinsights-core-js.js → es5/applicationinsights-core-js.js} +259 -223
  11. package/browser/es5/applicationinsights-core-js.js.map +1 -0
  12. package/browser/es5/applicationinsights-core-js.min.js +6 -0
  13. package/browser/es5/applicationinsights-core-js.min.js.map +1 -0
  14. package/dist/{applicationinsights-core-js.js → es5/applicationinsights-core-js.js} +259 -223
  15. package/dist/es5/applicationinsights-core-js.js.map +1 -0
  16. package/dist/es5/applicationinsights-core-js.min.js +6 -0
  17. package/dist/es5/applicationinsights-core-js.min.js.map +1 -0
  18. package/{dist-esm → dist-es5}/Config/ConfigDefaultHelpers.js +1 -1
  19. package/{dist-esm → dist-es5}/Config/ConfigDefaults.js +1 -1
  20. package/{dist-esm → dist-es5}/Config/DynamicConfig.js +1 -1
  21. package/{dist-esm → dist-es5}/Config/DynamicProperty.js +1 -1
  22. package/{dist-esm → dist-es5}/Config/DynamicState.js +1 -1
  23. package/{dist-esm → dist-es5}/Config/DynamicSupport.js +1 -1
  24. package/dist-es5/Config/IConfigDefaults.js +8 -0
  25. package/dist-es5/Config/IDynamicConfigHandler.js +8 -0
  26. package/dist-es5/Config/IDynamicPropertyHandler.js +8 -0
  27. package/dist-es5/Config/IDynamicWatcher.js +8 -0
  28. package/dist-es5/Config/_IDynamicConfigHandlerState.js +6 -0
  29. package/{dist-esm → dist-es5}/JavaScriptSDK/AggregationError.js +2 -2
  30. package/{dist-esm → dist-es5}/JavaScriptSDK/AggregationError.js.map +1 -1
  31. package/{dist-esm → dist-es5}/JavaScriptSDK/AppInsightsCore.js +1 -1
  32. package/{dist-esm → dist-es5}/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  33. package/{dist-esm → dist-es5}/JavaScriptSDK/Constants.js +1 -1
  34. package/{dist-esm → dist-es5}/JavaScriptSDK/CookieMgr.js +14 -8
  35. package/dist-es5/JavaScriptSDK/CookieMgr.js.map +1 -0
  36. package/{dist-esm → dist-es5}/JavaScriptSDK/CoreUtils.js +1 -1
  37. package/{dist-esm → dist-es5}/JavaScriptSDK/DataCacheHelper.js +2 -2
  38. package/dist-es5/JavaScriptSDK/DataCacheHelper.js.map +1 -0
  39. package/{dist-esm → dist-es5}/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  40. package/{dist-esm → dist-es5}/JavaScriptSDK/DiagnosticLogger.js +1 -1
  41. package/{dist-esm → dist-es5}/JavaScriptSDK/EnvUtils.js +1 -1
  42. package/{dist-esm → dist-es5}/JavaScriptSDK/EventHelpers.js +1 -1
  43. package/{dist-esm → dist-es5}/JavaScriptSDK/HelperFuncs.js +1 -1
  44. package/{dist-esm → dist-es5}/JavaScriptSDK/InstrumentHooks.js +1 -1
  45. package/{dist-esm → dist-es5}/JavaScriptSDK/InternalConstants.js +1 -1
  46. package/{dist-esm → dist-es5}/JavaScriptSDK/NotificationManager.js +1 -1
  47. package/{dist-esm → dist-es5}/JavaScriptSDK/PerfManager.js +1 -1
  48. package/{dist-esm → dist-es5}/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  49. package/{dist-esm → dist-es5}/JavaScriptSDK/RandomHelper.js +7 -5
  50. package/dist-es5/JavaScriptSDK/RandomHelper.js.map +1 -0
  51. package/{dist-esm → dist-es5}/JavaScriptSDK/TelemetryHelpers.js +1 -1
  52. package/{dist-esm → dist-es5}/JavaScriptSDK/TelemetryInitializerPlugin.js +44 -38
  53. package/dist-es5/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
  54. package/{dist-esm → dist-es5}/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  55. package/{dist-esm → dist-es5}/JavaScriptSDK/UnloadHookContainer.js +1 -1
  56. package/{dist-esm → dist-es5}/JavaScriptSDK/W3cTraceParent.js +1 -1
  57. package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  58. package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  59. package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  60. package/dist-es5/JavaScriptSDK.Enums/SendRequestReason.js +6 -0
  61. package/dist-es5/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
  62. package/dist-es5/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
  63. package/dist-es5/JavaScriptSDK.Interfaces/IAppInsightsCore.js +6 -0
  64. package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  65. package/dist-es5/JavaScriptSDK.Interfaces/IChannelControlsHost.js +8 -0
  66. package/dist-es5/JavaScriptSDK.Interfaces/IConfiguration.js +7 -0
  67. package/dist-es5/JavaScriptSDK.Interfaces/ICookieMgr.js +8 -0
  68. package/dist-es5/JavaScriptSDK.Interfaces/IDbgExtension.js +8 -0
  69. package/dist-es5/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +6 -0
  70. package/dist-es5/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +8 -0
  71. package/dist-es5/JavaScriptSDK.Interfaces/IInstrumentHooks.js +8 -0
  72. package/dist-es5/JavaScriptSDK.Interfaces/INotificationListener.js +9 -0
  73. package/dist-es5/JavaScriptSDK.Interfaces/INotificationManager.js +6 -0
  74. package/dist-es5/JavaScriptSDK.Interfaces/IPerfEvent.js +8 -0
  75. package/dist-es5/JavaScriptSDK.Interfaces/IPerfManager.js +6 -0
  76. package/dist-es5/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +9 -0
  77. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
  78. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryItem.js +9 -0
  79. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +9 -0
  80. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +8 -0
  81. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
  82. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
  83. package/dist-es5/JavaScriptSDK.Interfaces/ITraceParent.js +8 -0
  84. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadHook.js +8 -0
  85. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadableComponent.js +8 -0
  86. package/{dist-esm → dist-es5}/__DynamicConstants.js +2 -2
  87. package/{dist-esm → dist-es5}/__DynamicConstants.js.map +1 -1
  88. package/{dist-esm → dist-es5}/applicationinsights-core-js.js +2 -2
  89. package/dist-es5/applicationinsights-core-js.js.map +1 -0
  90. package/package.json +16 -15
  91. package/tsconfig.json +5 -4
  92. package/types/applicationinsights-core-js.d.ts +3074 -58
  93. package/{dist/applicationinsights-core-js.d.ts → types/applicationinsights-core-js.namespaced.d.ts} +1 -4
  94. package/browser/applicationinsights-core-js.integrity.json +0 -26
  95. package/browser/applicationinsights-core-js.js.map +0 -1
  96. package/browser/applicationinsights-core-js.min.js +0 -6
  97. package/browser/applicationinsights-core-js.min.js.map +0 -1
  98. package/dist/applicationinsights-core-js.api.json +0 -25423
  99. package/dist/applicationinsights-core-js.api.md +0 -1374
  100. package/dist/applicationinsights-core-js.js.map +0 -1
  101. package/dist/applicationinsights-core-js.min.js +0 -6
  102. package/dist/applicationinsights-core-js.min.js.map +0 -1
  103. package/dist/applicationinsights-core-js.rollup.d.ts +0 -3078
  104. package/dist-esm/Config/IConfigDefaults.js +0 -8
  105. package/dist-esm/Config/IDynamicConfigHandler.js +0 -8
  106. package/dist-esm/Config/IDynamicPropertyHandler.js +0 -8
  107. package/dist-esm/Config/IDynamicWatcher.js +0 -8
  108. package/dist-esm/Config/_IDynamicConfigHandlerState.js +0 -6
  109. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +0 -1
  110. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +0 -1
  111. package/dist-esm/JavaScriptSDK/RandomHelper.js.map +0 -1
  112. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +0 -1
  113. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +0 -6
  114. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +0 -8
  115. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +0 -8
  116. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +0 -6
  117. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControlsHost.js +0 -8
  118. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +0 -7
  119. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +0 -8
  120. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +0 -8
  121. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +0 -6
  122. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +0 -8
  123. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +0 -8
  124. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +0 -9
  125. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +0 -6
  126. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +0 -8
  127. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +0 -6
  128. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +0 -9
  129. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +0 -6
  130. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +0 -9
  131. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +0 -9
  132. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +0 -8
  133. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +0 -8
  134. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +0 -8
  135. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +0 -8
  136. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +0 -8
  137. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +0 -8
  138. package/dist-esm/applicationinsights-core-js.js.map +0 -1
  139. package/types/Config/ConfigDefaultHelpers.d.ts +0 -47
  140. package/types/Config/ConfigDefaults.d.ts +0 -9
  141. package/types/Config/DynamicConfig.d.ts +0 -23
  142. package/types/Config/DynamicProperty.d.ts +0 -3
  143. package/types/Config/DynamicState.d.ts +0 -3
  144. package/types/Config/DynamicSupport.d.ts +0 -82
  145. package/types/Config/IConfigDefaults.d.ts +0 -63
  146. package/types/Config/IDynamicConfigHandler.d.ts +0 -69
  147. package/types/Config/IDynamicPropertyHandler.d.ts +0 -11
  148. package/types/Config/IDynamicWatcher.d.ts +0 -61
  149. package/types/Config/_IDynamicConfigHandlerState.d.ts +0 -52
  150. package/types/JavaScriptSDK/AggregationError.d.ts +0 -6
  151. package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -158
  152. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +0 -110
  153. package/types/JavaScriptSDK/Constants.d.ts +0 -1
  154. package/types/JavaScriptSDK/CookieMgr.d.ts +0 -15
  155. package/types/JavaScriptSDK/CoreUtils.d.ts +0 -13
  156. package/types/JavaScriptSDK/DataCacheHelper.d.ts +0 -13
  157. package/types/JavaScriptSDK/DbgExtensionUtils.d.ts +0 -5
  158. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +0 -76
  159. package/types/JavaScriptSDK/EnvUtils.d.ts +0 -81
  160. package/types/JavaScriptSDK/EventHelpers.d.ts +0 -154
  161. package/types/JavaScriptSDK/HelperFuncs.d.ts +0 -106
  162. package/types/JavaScriptSDK/InstrumentHooks.d.ts +0 -43
  163. package/types/JavaScriptSDK/InternalConstants.d.ts +0 -20
  164. package/types/JavaScriptSDK/NotificationManager.d.ts +0 -46
  165. package/types/JavaScriptSDK/PerfManager.d.ts +0 -93
  166. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +0 -119
  167. package/types/JavaScriptSDK/RandomHelper.d.ts +0 -29
  168. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +0 -38
  169. package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -16
  170. package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +0 -8
  171. package/types/JavaScriptSDK/UnloadHookContainer.d.ts +0 -16
  172. package/types/JavaScriptSDK/W3cTraceParent.d.ts +0 -59
  173. package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +0 -22
  174. package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +0 -34
  175. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +0 -104
  176. package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +0 -45
  177. package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +0 -21
  178. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +0 -21
  179. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +0 -171
  180. package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +0 -36
  181. package/types/JavaScriptSDK.Interfaces/IChannelControlsHost.d.ts +0 -9
  182. package/types/JavaScriptSDK.Interfaces/IConfiguration.d.ts +0 -150
  183. package/types/JavaScriptSDK.Interfaces/ICookieMgr.d.ts +0 -97
  184. package/types/JavaScriptSDK.Interfaces/IDbgExtension.d.ts +0 -10
  185. package/types/JavaScriptSDK.Interfaces/IDiagnosticLogger.d.ts +0 -48
  186. package/types/JavaScriptSDK.Interfaces/IDistributedTraceContext.d.ts +0 -43
  187. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +0 -81
  188. package/types/JavaScriptSDK.Interfaces/INotificationListener.d.ts +0 -32
  189. package/types/JavaScriptSDK.Interfaces/INotificationManager.d.ts +0 -43
  190. package/types/JavaScriptSDK.Interfaces/IPerfEvent.d.ts +0 -56
  191. package/types/JavaScriptSDK.Interfaces/IPerfManager.d.ts +0 -45
  192. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +0 -129
  193. package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +0 -14
  194. package/types/JavaScriptSDK.Interfaces/ITelemetryItem.d.ts +0 -51
  195. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +0 -80
  196. package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +0 -23
  197. package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +0 -6
  198. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +0 -33
  199. package/types/JavaScriptSDK.Interfaces/ITraceParent.d.ts +0 -32
  200. package/types/JavaScriptSDK.Interfaces/IUnloadHook.d.ts +0 -18
  201. package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +0 -13
  202. package/types/__DynamicConstants.d.ts +0 -53
  203. package/types/tsdoc-metadata.json +0 -11
  204. /package/{dist-esm → dist-es5}/Config/ConfigDefaultHelpers.js.map +0 -0
  205. /package/{dist-esm → dist-es5}/Config/ConfigDefaults.js.map +0 -0
  206. /package/{dist-esm → dist-es5}/Config/DynamicConfig.js.map +0 -0
  207. /package/{dist-esm → dist-es5}/Config/DynamicProperty.js.map +0 -0
  208. /package/{dist-esm → dist-es5}/Config/DynamicState.js.map +0 -0
  209. /package/{dist-esm → dist-es5}/Config/DynamicSupport.js.map +0 -0
  210. /package/{dist-esm → dist-es5}/Config/IConfigDefaults.js.map +0 -0
  211. /package/{dist-esm → dist-es5}/Config/IDynamicConfigHandler.js.map +0 -0
  212. /package/{dist-esm → dist-es5}/Config/IDynamicPropertyHandler.js.map +0 -0
  213. /package/{dist-esm → dist-es5}/Config/IDynamicWatcher.js.map +0 -0
  214. /package/{dist-esm → dist-es5}/Config/_IDynamicConfigHandlerState.js.map +0 -0
  215. /package/{dist-esm → dist-es5}/JavaScriptSDK/AppInsightsCore.js.map +0 -0
  216. /package/{dist-esm → dist-es5}/JavaScriptSDK/BaseTelemetryPlugin.js.map +0 -0
  217. /package/{dist-esm → dist-es5}/JavaScriptSDK/Constants.js.map +0 -0
  218. /package/{dist-esm → dist-es5}/JavaScriptSDK/CoreUtils.js.map +0 -0
  219. /package/{dist-esm → dist-es5}/JavaScriptSDK/DbgExtensionUtils.js.map +0 -0
  220. /package/{dist-esm → dist-es5}/JavaScriptSDK/DiagnosticLogger.js.map +0 -0
  221. /package/{dist-esm → dist-es5}/JavaScriptSDK/EnvUtils.js.map +0 -0
  222. /package/{dist-esm → dist-es5}/JavaScriptSDK/EventHelpers.js.map +0 -0
  223. /package/{dist-esm → dist-es5}/JavaScriptSDK/HelperFuncs.js.map +0 -0
  224. /package/{dist-esm → dist-es5}/JavaScriptSDK/InstrumentHooks.js.map +0 -0
  225. /package/{dist-esm → dist-es5}/JavaScriptSDK/InternalConstants.js.map +0 -0
  226. /package/{dist-esm → dist-es5}/JavaScriptSDK/NotificationManager.js.map +0 -0
  227. /package/{dist-esm → dist-es5}/JavaScriptSDK/PerfManager.js.map +0 -0
  228. /package/{dist-esm → dist-es5}/JavaScriptSDK/ProcessTelemetryContext.js.map +0 -0
  229. /package/{dist-esm → dist-es5}/JavaScriptSDK/TelemetryHelpers.js.map +0 -0
  230. /package/{dist-esm → dist-es5}/JavaScriptSDK/UnloadHandlerContainer.js.map +0 -0
  231. /package/{dist-esm → dist-es5}/JavaScriptSDK/UnloadHookContainer.js.map +0 -0
  232. /package/{dist-esm → dist-es5}/JavaScriptSDK/W3cTraceParent.js.map +0 -0
  233. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +0 -0
  234. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +0 -0
  235. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/LoggingEnums.js.map +0 -0
  236. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/SendRequestReason.js.map +0 -0
  237. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +0 -0
  238. /package/{dist-esm → dist-es5}/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +0 -0
  239. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +0 -0
  240. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IChannelControls.js.map +0 -0
  241. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IChannelControlsHost.js.map +0 -0
  242. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IConfiguration.js.map +0 -0
  243. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ICookieMgr.js.map +0 -0
  244. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IDbgExtension.js.map +0 -0
  245. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IDiagnosticLogger.js.map +0 -0
  246. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IDistributedTraceContext.js.map +0 -0
  247. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IInstrumentHooks.js.map +0 -0
  248. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/INotificationListener.js.map +0 -0
  249. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/INotificationManager.js.map +0 -0
  250. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IPerfEvent.js.map +0 -0
  251. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IPerfManager.js.map +0 -0
  252. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js.map +0 -0
  253. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +0 -0
  254. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryItem.js.map +0 -0
  255. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryPlugin.js.map +0 -0
  256. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +0 -0
  257. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +0 -0
  258. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +0 -0
  259. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/ITraceParent.js.map +0 -0
  260. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IUnloadHook.js.map +0 -0
  261. /package/{dist-esm → dist-es5}/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +0 -0
@@ -1,58 +1,3074 @@
1
- export { IConfiguration } from "./JavaScriptSDK.Interfaces/IConfiguration";
2
- export { IChannelControls, MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
3
- export { IChannelControlsHost } from "./JavaScriptSDK.Interfaces/IChannelControlsHost";
4
- export { ITelemetryPlugin, IPlugin } from "./JavaScriptSDK.Interfaces/ITelemetryPlugin";
5
- export { IAppInsightsCore, ILoadedPlugin } from "./JavaScriptSDK.Interfaces/IAppInsightsCore";
6
- export { ITelemetryItem, ICustomProperties, Tags } from "./JavaScriptSDK.Interfaces/ITelemetryItem";
7
- export { IBaseProcessingContext, IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "./JavaScriptSDK.Interfaces/IProcessTelemetryContext";
8
- export { INotificationListener } from "./JavaScriptSDK.Interfaces/INotificationListener";
9
- export { ITelemetryPluginChain } from "./JavaScriptSDK.Interfaces/ITelemetryPluginChain";
10
- export { IDiagnosticLogger } from "./JavaScriptSDK.Interfaces/IDiagnosticLogger";
11
- export { InstrumentorHooksCallback, IInstrumentHooksCallbacks, IInstrumentHooks, IInstrumentHook, IInstrumentCallDetails } from "./JavaScriptSDK.Interfaces/IInstrumentHooks";
12
- export { IUnloadableComponent } from "./JavaScriptSDK.Interfaces/IUnloadableComponent";
13
- export { IUnloadHook, ILegacyUnloadHook } from "./JavaScriptSDK.Interfaces/IUnloadHook";
14
- export { eEventsDiscardedReason, EventsDiscardedReason } from "./JavaScriptSDK.Enums/EventsDiscardedReason";
15
- export { SendRequestReason } from "./JavaScriptSDK.Enums/SendRequestReason";
16
- export { TelemetryUpdateReason } from "./JavaScriptSDK.Enums/TelemetryUpdateReason";
17
- export { TelemetryUnloadReason } from "./JavaScriptSDK.Enums/TelemetryUnloadReason";
18
- export { throwAggregationError } from "./JavaScriptSDK/AggregationError";
19
- export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
20
- export { BaseTelemetryPlugin } from "./JavaScriptSDK/BaseTelemetryPlugin";
21
- export { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from "./JavaScriptSDK/RandomHelper";
22
- export { Undefined, newGuid, generateW3CId } from "./JavaScriptSDK/CoreUtils";
23
- export { normalizeJsName, toISOString, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend } from "./JavaScriptSDK/HelperFuncs";
24
- export { isArray, isTypeof, isUndefined, isNullOrUndefined, objHasOwnProperty as hasOwnProperty, isObject, isFunction, strEndsWith, strStartsWith, isDate, isError, isString, isNumber, isBoolean, arrForEach, arrIndexOf, arrReduce, arrMap, strTrim, objKeys, objDefineAccessors, throwError, isSymbol, isNotTruthy, isTruthy, objFreeze, objSeal, objToString, objDeepFreeze as deepFreeze, getInst as getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, hasNavigator, getNavigator, hasHistory, getHistory, dumpObj, asString, objForEachKey, getPerformance, utcNow as dateNow, perfNow } from "@nevware21/ts-utils";
25
- export { EnumValue, createEnumStyle, createValueMap } from "./JavaScriptSDK.Enums/EnumHelperFuncs";
26
- export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
27
- export { getCrypto, getMsCrypto, getLocation, hasJSON, getJSON, isReactNative, getConsole, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, findMetaTag, findNamedServerTiming } from "./JavaScriptSDK/EnvUtils";
28
- export { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from "@microsoft/applicationinsights-shims";
29
- export { NotificationManager } from "./JavaScriptSDK/NotificationManager";
30
- export { INotificationManager } from "./JavaScriptSDK.Interfaces/INotificationManager";
31
- export { IPerfEvent } from "./JavaScriptSDK.Interfaces/IPerfEvent";
32
- export { IPerfManager, IPerfManagerProvider } from "./JavaScriptSDK.Interfaces/IPerfManager";
33
- export { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from "./JavaScriptSDK/PerfManager";
34
- export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from "./JavaScriptSDK/DiagnosticLogger";
35
- export { ProcessTelemetryContext, createProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
36
- export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
37
- export { _eInternalMessageId, _InternalMessageId, LoggingSeverity, eLoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
38
- export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from "./JavaScriptSDK/InstrumentHooks";
39
- export { ICookieMgr, ICookieMgrConfig } from "./JavaScriptSDK.Interfaces/ICookieMgr";
40
- export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
41
- export { IDbgExtension } from "./JavaScriptSDK.Interfaces/IDbgExtension";
42
- export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils";
43
- export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./JavaScriptSDK.Interfaces/ITelemetryInitializers";
44
- export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
45
- export { UnloadHandler, IUnloadHandlerContainer, createUnloadHandlerContainer } from "./JavaScriptSDK/UnloadHandlerContainer";
46
- export { IUnloadHookContainer, createUnloadHookContainer } from "./JavaScriptSDK/UnloadHookContainer";
47
- export { ITelemetryUpdateState } from "./JavaScriptSDK.Interfaces/ITelemetryUpdateState";
48
- export { ITelemetryUnloadState } from "./JavaScriptSDK.Interfaces/ITelemetryUnloadState";
49
- export { IDistributedTraceContext } from "./JavaScriptSDK.Interfaces/IDistributedTraceContext";
50
- export { ITraceParent } from "./JavaScriptSDK.Interfaces/ITraceParent";
51
- export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "./JavaScriptSDK/W3cTraceParent";
52
- export { IConfigCheckFn, IConfigDefaultCheck, IConfigDefaults, IConfigSetFn } from "./Config/IConfigDefaults";
53
- export { IDynamicConfigHandler } from "./Config/IDynamicConfigHandler";
54
- export { IDynamicPropertyHandler } from "./Config/IDynamicPropertyHandler";
55
- export { IWatchDetails, IWatcherHandler, WatcherFunction } from "./Config/IDynamicWatcher";
56
- export { createDynamicConfig, onConfigChange } from "./Config/DynamicConfig";
57
- export { getDynamicConfigHandler, blockDynamicConversion, forceDynamicConversion } from "./Config/DynamicSupport";
58
- export { cfgDfValidate, cfgDfMerge, cfgDfBoolean, cfgDfFunc, cfgDfString, cfgDfSet } from "./Config/ConfigDefaultHelpers";
1
+ /*
2
+ * Microsoft Application Insights Core Javascript SDK, 3.0.0-nightly3.2304-28
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ *
5
+ * Microsoft Application Insights Team
6
+ * https://github.com/microsoft/ApplicationInsights-JS#readme
7
+ *
8
+ * ---------------------------------------------------------------------------
9
+ * This is a single combined (rollup) declaration file for the package,
10
+ * if you require a namespace wrapped version it is also available.
11
+ * - Namespaced version: types/applicationinsights-core-js.namespaced.d.ts
12
+ * ---------------------------------------------------------------------------
13
+ */
14
+
15
+ import { arrForEach } from '@nevware21/ts-utils';
16
+ import { arrIndexOf } from '@nevware21/ts-utils';
17
+ import { arrMap } from '@nevware21/ts-utils';
18
+ import { arrReduce } from '@nevware21/ts-utils';
19
+ import { asString } from '@nevware21/ts-utils';
20
+ import { utcNow as dateNow } from '@nevware21/ts-utils';
21
+ import { objDeepFreeze as deepFreeze } from '@nevware21/ts-utils';
22
+ import { dumpObj } from '@nevware21/ts-utils';
23
+ import { EnumCls } from '@nevware21/ts-utils';
24
+ import { getDocument } from '@nevware21/ts-utils';
25
+ import { getGlobal } from '@microsoft/applicationinsights-shims';
26
+ import { getInst as getGlobalInst } from '@nevware21/ts-utils';
27
+ import { getHistory } from '@nevware21/ts-utils';
28
+ import { getNavigator } from '@nevware21/ts-utils';
29
+ import { getPerformance } from '@nevware21/ts-utils';
30
+ import { getWindow } from '@nevware21/ts-utils';
31
+ import { hasDocument } from '@nevware21/ts-utils';
32
+ import { hasHistory } from '@nevware21/ts-utils';
33
+ import { hasNavigator } from '@nevware21/ts-utils';
34
+ import { objHasOwnProperty as hasOwnProperty } from '@nevware21/ts-utils';
35
+ import { hasWindow } from '@nevware21/ts-utils';
36
+ import { isArray } from '@nevware21/ts-utils';
37
+ import { isBoolean } from '@nevware21/ts-utils';
38
+ import { isDate } from '@nevware21/ts-utils';
39
+ import { isError } from '@nevware21/ts-utils';
40
+ import { isFunction } from '@nevware21/ts-utils';
41
+ import { isNotTruthy } from '@nevware21/ts-utils';
42
+ import { isNullOrUndefined } from '@nevware21/ts-utils';
43
+ import { isNumber } from '@nevware21/ts-utils';
44
+ import { isObject } from '@nevware21/ts-utils';
45
+ import { isString } from '@nevware21/ts-utils';
46
+ import { isSymbol } from '@nevware21/ts-utils';
47
+ import { isTruthy } from '@nevware21/ts-utils';
48
+ import { isTypeof } from '@nevware21/ts-utils';
49
+ import { isUndefined } from '@nevware21/ts-utils';
50
+ import { ITimerHandler } from '@nevware21/ts-utils';
51
+ import { objDefineAccessors } from '@nevware21/ts-utils';
52
+ import { objForEachKey } from '@nevware21/ts-utils';
53
+ import { objFreeze } from '@nevware21/ts-utils';
54
+ import { objKeys } from '@nevware21/ts-utils';
55
+ import { objSeal } from '@nevware21/ts-utils';
56
+ import { objToString } from '@nevware21/ts-utils';
57
+ import { perfNow } from '@nevware21/ts-utils';
58
+ import { strEndsWith } from '@nevware21/ts-utils';
59
+ import { strShimFunction as strFunction } from '@microsoft/applicationinsights-shims';
60
+ import { strShimObject as strObject } from '@microsoft/applicationinsights-shims';
61
+ import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights-shims';
62
+ import { strStartsWith } from '@nevware21/ts-utils';
63
+ import { strTrim } from '@nevware21/ts-utils';
64
+ import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
65
+ import { throwError } from '@nevware21/ts-utils';
66
+
67
+ /**
68
+ * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
69
+ * applications to remove their own events
70
+ * @param target - The EventTarget that has registered events
71
+ * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
72
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
73
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
74
+ */
75
+ export declare function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
76
+
77
+ /**
78
+ * Trys to add an event handler for the specified event to the window, body and document
79
+ * @param eventName - {string} - The name of the event
80
+ * @param callback - {any} - The callback function that needs to be executed for the given event
81
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
82
+ * @return {boolean} - true if the handler was successfully added
83
+ */
84
+ export declare function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
85
+
86
+ /**
87
+ * Bind the listener to the array of events
88
+ * @param events - An string array of event names to bind the listener to
89
+ * @param listener - The event callback to call when the event is triggered
90
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
91
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
92
+ * @returns true - when at least one of the events was registered otherwise false
93
+ */
94
+ export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
95
+
96
+ /**
97
+ * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
98
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
99
+ * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
100
+ * @param listener - The event callback to call when a page hide event is triggered
101
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
102
+ * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
103
+ * based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
104
+ * so that only the matching "removePageHideEventListener" can remove these events.
105
+ * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
106
+ * @returns true - when at least one of the events was registered otherwise false
107
+ */
108
+ export declare function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
109
+
110
+ /**
111
+ * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
112
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
113
+ * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
114
+ * @param listener - The event callback to call when a page is show event is triggered
115
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
116
+ * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
117
+ * identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
118
+ * so that only the matching "removePageShowEventListener" can remove these events.
119
+ * @returns true - when at least one of the events was registered otherwise false
120
+ */
121
+ export declare function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
122
+
123
+ /**
124
+ * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
125
+ * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
126
+ * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
127
+ * just navigating to a different Tab and may come back (without unloading the page). As such you may also
128
+ * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
129
+ * @param listener - The event callback to call when a page unload event is triggered
130
+ * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
131
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
132
+ * @returns true - when at least one of the events was registered otherwise false
133
+ */
134
+ export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
135
+
136
+ export declare class AppInsightsCore<CfgType extends IConfiguration = IConfiguration> implements IAppInsightsCore<CfgType> {
137
+ config: CfgType;
138
+ logger: IDiagnosticLogger;
139
+ /**
140
+ * An array of the installed plugins that provide a version
141
+ */
142
+ readonly pluginVersionStringArr: string[];
143
+ /**
144
+ * The formatted string of the installed plugins that contain a version number
145
+ */
146
+ readonly pluginVersionString: string;
147
+ /**
148
+ * Returns a value that indicates whether the instance has already been previously initialized.
149
+ */
150
+ isInitialized: () => boolean;
151
+ /**
152
+ * Function used to identify the get w parameter used to identify status bit to some channels
153
+ */
154
+ getWParam: () => number;
155
+ constructor();
156
+ initialize(config: CfgType, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
157
+ getChannels(): IChannelControls[];
158
+ track(telemetryItem: ITelemetryItem): void;
159
+ getProcessTelContext(): IProcessTelemetryContext;
160
+ getNotifyMgr(): INotificationManager;
161
+ /**
162
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
163
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
164
+ * called.
165
+ * @param listener - An INotificationListener object.
166
+ */
167
+ addNotificationListener(listener: INotificationListener): void;
168
+ /**
169
+ * Removes all instances of the listener.
170
+ * @param listener - INotificationListener to remove.
171
+ */
172
+ removeNotificationListener(listener: INotificationListener): void;
173
+ /**
174
+ * Get the current cookie manager for this instance
175
+ */
176
+ getCookieMgr(): ICookieMgr;
177
+ /**
178
+ * Set the current cookie manager for this instance
179
+ * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created
180
+ */
181
+ setCookieMgr(cookieMgr: ICookieMgr): void;
182
+ getPerfMgr(): IPerfManager;
183
+ setPerfMgr(perfMgr: IPerfManager): void;
184
+ eventCnt(): number;
185
+ /**
186
+ * Periodically check logger.queue for
187
+ */
188
+ pollInternalLogs(eventName?: string): ITimerHandler;
189
+ /**
190
+ * Periodically check logger.queue for
191
+ */
192
+ stopPollingInternalLogs(): void;
193
+ /**
194
+ * Add a telemetry processor to decorate or drop telemetry events.
195
+ * @param telemetryInitializer - The Telemetry Initializer function
196
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
197
+ */
198
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
199
+ /**
200
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
201
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
202
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
203
+ * approach is to create a new instance and initialize that instance.
204
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
205
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
206
+ * @param isAsync - Can the unload be performed asynchronously (default)
207
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
208
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
209
+ */
210
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
211
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
212
+ /**
213
+ * Add a new plugin to the installation
214
+ * @param plugin - The new plugin to add
215
+ * @param replaceExisting - should any existing plugin be replaced, default is false
216
+ * @param doAsync - Should the add be performed asynchronously
217
+ * @param addCb - [Optional] callback to call after the plugin has been added
218
+ */
219
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
220
+ /**
221
+ * Update the configuration used and broadcast the changes to all loaded plugins
222
+ * @param newConfig - The new configuration is apply
223
+ * @param mergeExisting - Should the new configuration merge with the existing or just replace it. Default is to true.
224
+ */
225
+ updateCfg(newConfig: CfgType, mergeExisting?: boolean): void;
226
+ /**
227
+ * Returns the unique event namespace that should be used
228
+ */
229
+ evtNamespace(): string;
230
+ /**
231
+ * Add an unload handler that will be called when the SDK is being unloaded
232
+ * @param handler - the handler
233
+ */
234
+ addUnloadCb(handler: UnloadHandler): void;
235
+ /**
236
+ * Flush and send any batched / cached data immediately
237
+ * @param async - send data asynchronously when true (defaults to true)
238
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
239
+ * If the caller doesn't return true the caller should assume that it may never be called.
240
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
241
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
242
+ */
243
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
244
+ /**
245
+ * Gets the current distributed trace context for this instance if available
246
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
247
+ */
248
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
249
+ /**
250
+ * Sets the current distributed trace context for this instance if available
251
+ */
252
+ setTraceCtx(newTracectx: IDistributedTraceContext): void;
253
+ /**
254
+ * Add this hook so that it is automatically removed during unloading
255
+ * @param hooks - The single hook or an array of IInstrumentHook objects
256
+ */
257
+ addUnloadHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
258
+ /**
259
+ * Watches and tracks changes for accesses to the current config, and if the accessed config changes the
260
+ * handler will be recalled.
261
+ * @param handler
262
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
263
+ */
264
+ onCfgChange(handler: WatcherFunction<CfgType>): IUnloadHook;
265
+ protected releaseQueue(): void;
266
+ /**
267
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
268
+ * @param updateCtx - The plugin update context
269
+ * @param updateState - The Update State
270
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
271
+ */
272
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
273
+ }
274
+
275
+ export declare function areCookiesSupported(logger?: IDiagnosticLogger): any;
276
+
277
+ export { arrForEach }
278
+
279
+ export { arrIndexOf }
280
+
281
+ export { arrMap }
282
+
283
+ export { arrReduce }
284
+
285
+ export { asString }
286
+
287
+ /**
288
+ * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
289
+ * @param obj - Object to add the event too.
290
+ * @param eventNameWithoutOn - String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
291
+ * @param handlerRef - Pointer that specifies the function to call when event fires
292
+ * @param useCapture - [Optional] Defaults to false
293
+ * @returns True if the function was bound successfully to the event, otherwise false
294
+ */
295
+ export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
296
+
297
+ /**
298
+ * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
299
+ * can avoid implementation the same set of boiler plate code as well as provide a base
300
+ * implementation so that new default implementations can be added without breaking all plugins.
301
+ */
302
+ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
303
+ identifier: string;
304
+ version?: string;
305
+ /**
306
+ * Holds the core instance that was used during initialization
307
+ */
308
+ core: IAppInsightsCore;
309
+ priority: number;
310
+ /**
311
+ * Call back for telemetry processing before it it is sent
312
+ * @param env - This is the current event being reported
313
+ * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
314
+ * can optionally use this to access the current core instance or define / pass additional information
315
+ * to later plugins (vs appending items to the telemetry item)
316
+ */
317
+ processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
318
+ /**
319
+ * Set next extension for telemetry processing
320
+ */
321
+ setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
322
+ /**
323
+ * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
324
+ * assigned a new default one will be created and returned.
325
+ */
326
+ diagLog: (itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger;
327
+ /**
328
+ * Returns whether the plugin has been initialized
329
+ */
330
+ isInitialized: () => boolean;
331
+ /**
332
+ * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
333
+ * returns that value (helps with minification for callers), otherwise it will return the configured
334
+ * context or a temporary one.
335
+ * @param currentCtx - [Optional] The current execution context
336
+ */
337
+ protected _getTelCtx: (currentCtx?: IProcessTelemetryContext) => IProcessTelemetryContext;
338
+ /**
339
+ * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
340
+ */
341
+ protected setInitialized: (isInitialized: boolean) => void;
342
+ /**
343
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
344
+ * finishes it's removal.
345
+ * @param unloadCtx - This is the context that should be used during unloading.
346
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
347
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
348
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
349
+ */
350
+ protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
351
+ /**
352
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
353
+ * @param updateCtx - This is the context that should be used during updating.
354
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
355
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
356
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
357
+ */
358
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
359
+ /**
360
+ * Exposes the underlying unload hook container instance for this extension to allow it to be passed down to any sub components of the class.
361
+ * This should NEVER be exposed or called publically as it's scope is for internal use by BaseTelemetryPlugin and any derived class (which is why
362
+ * it's scoped as protected)
363
+ */
364
+ protected readonly _unloadHooks: IUnloadHookContainer;
365
+ constructor();
366
+ initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
367
+ /**
368
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
369
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
370
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
371
+ * @param unloadCtx - This is the context that should be used during unloading.
372
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
373
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
374
+ */
375
+ teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
376
+ abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
377
+ /**
378
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
379
+ * @param updateCtx - This is the context that should be used during updating.
380
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
381
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
382
+ */
383
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
384
+ /**
385
+ * Add an unload handler that will be called when the SDK is being unloaded
386
+ * @param handler - the handler
387
+ */
388
+ protected _addUnloadCb(handler: UnloadHandler): void;
389
+ /**
390
+ * Add this hook so that it is automatically removed during unloading
391
+ * @param hooks - The single hook or an array of IInstrumentHook objects
392
+ */
393
+ protected _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
394
+ }
395
+
396
+ /**
397
+ * Mark the provided value so that if it's included into the configuration it will NOT have
398
+ * its properties converted into a dynamic (reactive) object. If the object is not a plain object
399
+ * or an array (ie. a class) this function has not affect as only Objects and Arrays are converted
400
+ * into dynamic objects in the dynamic configuration.
401
+ *
402
+ * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.
403
+ *
404
+ * You should only need to use this function, if you are creating dynamic "classes" from objects
405
+ * which confirm to the require interface. A common case for this is during unit testing where it's
406
+ * easier to create mock extensions.
407
+ *
408
+ * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and
409
+ * if there is an exception adding the property to the value (because its frozen etc) the
410
+ * exception will be swallowed
411
+ *
412
+ * @example
413
+ * ```ts
414
+ * // This is a valid "extension", but it is technically an object
415
+ * // So when included in the config.extensions it WILL be cloned and then
416
+ * // converted into a dynamic object, where all of its properties will become
417
+ * // get/set object properties and will be tracked. While this WILL still
418
+ * // function, when attempt to use a mocking framework on top of this the
419
+ * // functions are now technically get accessors which return a function
420
+ * // and this can cause some mocking frameworks to fail.
421
+ * let mockChannel = {
422
+ * pause: () => { },
423
+ * resume: () => { },
424
+ * teardown: () => { },
425
+ * flush: (async: any, callBack: any) => { },
426
+ * processTelemetry: (env: any) => { },
427
+ * setNextPlugin: (next: any) => { },
428
+ * initialize: (config: any, core: any, extensions: any) => { },
429
+ * identifier: "testChannel",
430
+ * priority: 1003
431
+ * };
432
+ * ```
433
+ * @param value - The object that you want to block from being converted into a
434
+ * trackable dynamic object
435
+ * @returns The original value
436
+ */
437
+ export declare function blockDynamicConversion<T>(value: T): T;
438
+
439
+ /**
440
+ * Helper which returns an IConfigDefaultCheck instance that will validate and convert the user
441
+ * provided value to a boolean from a string or boolean value
442
+ * @param validator - The IConfigCheckFn function to validate the user provided value
443
+ * @param defaultValue - The default value to apply it not provided or it's not valid
444
+ * @param fallBackName - The fallback configuration name if the current value is not available
445
+ * @returns a new IConfigDefaultCheck structure
446
+ */
447
+ export declare function cfgDfBoolean<T, C = IConfiguration>(defaultValue?: boolean, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, boolean, C>;
448
+
449
+ /**
450
+ * Helper which returns an IConfigDefaultCheck instance that will validate that the user
451
+ * provided value is a function.
452
+ * @param defaultValue - The default value to apply it not provided or it's not valid
453
+ * @returns a new IConfigDefaultCheck structure
454
+ */
455
+ export declare function cfgDfFunc<V, T, C = IConfiguration>(defaultValue?: V): IConfigDefaultCheck<T, V, C>;
456
+
457
+ /**
458
+ * Helper which returns an IConfigDefaultCheck instance with the provided field validator
459
+ * @param validator - The IConfigCheckFn function to validate the user provided value
460
+ * @param defaultValue - The default value to apply it not provided or it's not valid
461
+ * @returns a new IConfigDefaultCheck structure
462
+ */
463
+ export declare function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: V | IConfigDefaults<V, T>): IConfigDefaultCheck<T, V, C>;
464
+
465
+ /**
466
+ * Helper which returns an IConfigDefaultCheck instance with the provided field set function
467
+ * @param setter - The IConfigCheckFn function to validate the user provided value
468
+ * @param defaultValue - The default value to apply it not provided or it's not valid
469
+ * @returns a new IConfigDefaultCheck structure
470
+ */
471
+ export declare function cfgDfSet<V, T, C = IConfiguration>(setter: IConfigSetFn<T, V>, defaultValue: V): IConfigDefaultCheck<T, V, C>;
472
+
473
+ /**
474
+ * Helper which returns an IConfigDefaultCheck instance that will validate that the user
475
+ * provided value is a function.
476
+ * @param defaultValue - The default string value to apply it not provided or it's not valid, defaults to an empty string
477
+ * @returns a new IConfigDefaultCheck structure
478
+ */
479
+ export declare function cfgDfString<T, C = IConfiguration>(defaultValue?: string): IConfigDefaultCheck<T, string, C>;
480
+
481
+ /**
482
+ * Helper which returns an IConfigDefaultCheck instance with the provided field validator
483
+ * @param validator - The IConfigCheckFn function to validate the user provided value
484
+ * @param defaultValue - The default value to apply it not provided or it's not valid
485
+ * @param fallBackName - The fallback configuration name if the current value is not available
486
+ * @returns a new IConfigDefaultCheck structure
487
+ */
488
+ export declare function cfgDfValidate<V, T, C = IConfiguration>(validator: IConfigCheckFn<V>, defaultValue: V, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, V, C>;
489
+
490
+ /**
491
+ * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
492
+ * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
493
+ * @param defaults - Simple helper
494
+ */
495
+ export declare function createClassFromInterface<T>(defaults?: T): new () => T;
496
+
497
+ export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
498
+
499
+ /**
500
+ * Create or return a dynamic version of the passed config, if it is not already dynamic
501
+ * @param config - The config to be converted into a dynamic config
502
+ * @param defaultConfig - The default values to apply on the config if the properties don't already exist
503
+ * @param inPlace - Should the config be converted in-place into a dynamic config or a new instance returned, defaults to true
504
+ * @returns The dynamic config handler for the config (whether new or existing)
505
+ */
506
+ export declare function createDynamicConfig<T extends IConfiguration>(config: T, defaultConfig?: IConfigDefaults<T>, logger?: IDiagnosticLogger, inPlace?: boolean): IDynamicConfigHandler<T>;
507
+
508
+ /**
509
+ * Create an enum style object which has both the key => value and value => key mappings
510
+ * @param values - The values to populate on the new object
511
+ * @returns
512
+ */
513
+ export declare const createEnumStyle: <E>(values: {
514
+ [key in keyof E]: E[keyof E];
515
+ }) => EnumValue<E>;
516
+
517
+ /**
518
+ * Creates a new Telemetry Item context with the current config, core and plugin execution chain
519
+ * @param plugins - The plugin instances that will be executed
520
+ * @param config - The current config
521
+ * @param core - The current core instance
522
+ * @param startAt - Identifies the next plugin to execute, if null there is no "next" plugin and if undefined it should assume the start of the chain
523
+ */
524
+ export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, cfg: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
525
+
526
+ /**
527
+ * Create a new ITraceParent instance using the provided values.
528
+ * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.
529
+ * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.
530
+ * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid
531
+ * @param version - The version to used, defaults to version "01" if not supplied or invalid.
532
+ * @returns
533
+ */
534
+ export declare function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent;
535
+
536
+ export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
537
+
538
+ export declare function createUnloadHandlerContainer(): IUnloadHandlerContainer;
539
+
540
+ /**
541
+ * Create a IUnloadHookContainer which can be used to remember unload hook functions to be executed during the component unloading
542
+ * process.
543
+ * @returns A new IUnloadHookContainer instance
544
+ */
545
+ export declare function createUnloadHookContainer(): IUnloadHookContainer;
546
+
547
+ /**
548
+ * Create a 2 index map that maps an enum's key and value to the defined map value, X["key"] => mapValue and X[0] => mapValue.
549
+ * Generic values
550
+ * - E = the const enum type (typeof eRequestHeaders);
551
+ * - V = Identifies the valid values for the keys, this should include both the enum numeric and string key of the type. The
552
+ * resulting "Value" of each entry identifies the valid values withing the assignments.
553
+ * @param values - The values to populate on the new object
554
+ * @returns
555
+ */
556
+ export declare const createValueMap: <E, V = E>(values: {
557
+ [key in keyof E]: [E[keyof E], V[keyof V]];
558
+ }) => V;
559
+
560
+ export { dateNow }
561
+
562
+ export { deepFreeze }
563
+
564
+ /**
565
+ * Removes an event handler for the specified event
566
+ * @param Object - to remove the event from
567
+ * @param eventNameWithoutOn - {string} - The name of the event, with optional namespaces or just the namespaces,
568
+ * such as "click", "click.mynamespace" or ".mynamespace"
569
+ * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a
570
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
571
+ * otherwise this will only remove events with this specific handler.
572
+ * @param useCapture - [Optional] Defaults to false
573
+ */
574
+ export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
575
+
576
+ export declare class DiagnosticLogger implements IDiagnosticLogger {
577
+ identifier: string;
578
+ /**
579
+ * The internal logging queue
580
+ */
581
+ queue: _InternalLogMessage[];
582
+ constructor(config?: IConfiguration);
583
+ /**
584
+ * 0: OFF (default)
585
+ * 1: CRITICAL
586
+ * 2: >= WARNING
587
+ */
588
+ consoleLoggingLevel(): number;
589
+ /**
590
+ * This method will throw exceptions in debug mode or attempt to log the error as a console warning.
591
+ * @param severity - {LoggingSeverity} - The severity of the log message
592
+ * @param message - {_InternalLogMessage} - The log message.
593
+ */
594
+ throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
595
+ /**
596
+ * This will write a warning to the console if possible
597
+ * @param message - {string} - The warning message
598
+ */
599
+ warnToConsole(message: string): void;
600
+ /**
601
+ * This will write an error to the console if possible
602
+ * @param message - {string} - The warning message
603
+ */
604
+ errorToConsole(message: string): void;
605
+ /**
606
+ * Resets the internal message count
607
+ */
608
+ resetInternalMessageCount(): void;
609
+ /**
610
+ * Logs a message to the internal queue.
611
+ * @param severity - {LoggingSeverity} - The severity of the log message
612
+ * @param message - {_InternalLogMessage} - The message to log.
613
+ */
614
+ logInternalMessage(severity: LoggingSeverity, message: _InternalLogMessage): void;
615
+ update(updateState: ITelemetryUpdateState): void;
616
+ }
617
+
618
+ /**
619
+ * Helper function to wrap a function with a perf event
620
+ * @param mgrSource - The Performance Manager or a Performance provider source (may be null)
621
+ * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)
622
+ * @param func - The function to call and measure
623
+ * @param details - A function to return the payload details
624
+ * @param isAsync - Is the event / function being call asynchronously or synchronously
625
+ */
626
+ export declare function doPerf<T>(mgrSource: IPerfManagerProvider | IPerfManager, getSource: () => string, func: (perfEvt?: IPerfEvent) => T, details?: () => any, isAsync?: boolean): T;
627
+
628
+ export { dumpObj }
629
+
630
+ /**
631
+ * The eEventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
632
+ */
633
+ export declare const enum eEventsDiscardedReason {
634
+ /**
635
+ * Unknown.
636
+ */
637
+ Unknown = 0,
638
+ /**
639
+ * Status set to non-retryable.
640
+ */
641
+ NonRetryableStatus = 1,
642
+ /**
643
+ * The event is invalid.
644
+ */
645
+ InvalidEvent = 2,
646
+ /**
647
+ * The size of the event is too large.
648
+ */
649
+ SizeLimitExceeded = 3,
650
+ /**
651
+ * The server is not accepting events from this instrumentation key.
652
+ */
653
+ KillSwitch = 4,
654
+ /**
655
+ * The event queue is full.
656
+ */
657
+ QueueFull = 5
658
+ }
659
+
660
+ export declare const enum _eInternalMessageId {
661
+ BrowserDoesNotSupportLocalStorage = 0,
662
+ BrowserCannotReadLocalStorage = 1,
663
+ BrowserCannotReadSessionStorage = 2,
664
+ BrowserCannotWriteLocalStorage = 3,
665
+ BrowserCannotWriteSessionStorage = 4,
666
+ BrowserFailedRemovalFromLocalStorage = 5,
667
+ BrowserFailedRemovalFromSessionStorage = 6,
668
+ CannotSendEmptyTelemetry = 7,
669
+ ClientPerformanceMathError = 8,
670
+ ErrorParsingAISessionCookie = 9,
671
+ ErrorPVCalc = 10,
672
+ ExceptionWhileLoggingError = 11,
673
+ FailedAddingTelemetryToBuffer = 12,
674
+ FailedMonitorAjaxAbort = 13,
675
+ FailedMonitorAjaxDur = 14,
676
+ FailedMonitorAjaxOpen = 15,
677
+ FailedMonitorAjaxRSC = 16,
678
+ FailedMonitorAjaxSend = 17,
679
+ FailedMonitorAjaxGetCorrelationHeader = 18,
680
+ FailedToAddHandlerForOnBeforeUnload = 19,
681
+ FailedToSendQueuedTelemetry = 20,
682
+ FailedToReportDataLoss = 21,
683
+ FlushFailed = 22,
684
+ MessageLimitPerPVExceeded = 23,
685
+ MissingRequiredFieldSpecification = 24,
686
+ NavigationTimingNotSupported = 25,
687
+ OnError = 26,
688
+ SessionRenewalDateIsZero = 27,
689
+ SenderNotInitialized = 28,
690
+ StartTrackEventFailed = 29,
691
+ StopTrackEventFailed = 30,
692
+ StartTrackFailed = 31,
693
+ StopTrackFailed = 32,
694
+ TelemetrySampledAndNotSent = 33,
695
+ TrackEventFailed = 34,
696
+ TrackExceptionFailed = 35,
697
+ TrackMetricFailed = 36,
698
+ TrackPVFailed = 37,
699
+ TrackPVFailedCalc = 38,
700
+ TrackTraceFailed = 39,
701
+ TransmissionFailed = 40,
702
+ FailedToSetStorageBuffer = 41,
703
+ FailedToRestoreStorageBuffer = 42,
704
+ InvalidBackendResponse = 43,
705
+ FailedToFixDepricatedValues = 44,
706
+ InvalidDurationValue = 45,
707
+ TelemetryEnvelopeInvalid = 46,
708
+ CreateEnvelopeError = 47,
709
+ CannotSerializeObject = 48,
710
+ CannotSerializeObjectNonSerializable = 49,
711
+ CircularReferenceDetected = 50,
712
+ ClearAuthContextFailed = 51,
713
+ ExceptionTruncated = 52,
714
+ IllegalCharsInName = 53,
715
+ ItemNotInArray = 54,
716
+ MaxAjaxPerPVExceeded = 55,
717
+ MessageTruncated = 56,
718
+ NameTooLong = 57,
719
+ SampleRateOutOfRange = 58,
720
+ SetAuthContextFailed = 59,
721
+ SetAuthContextFailedAccountName = 60,
722
+ StringValueTooLong = 61,
723
+ StartCalledMoreThanOnce = 62,
724
+ StopCalledWithoutStart = 63,
725
+ TelemetryInitializerFailed = 64,
726
+ TrackArgumentsNotSpecified = 65,
727
+ UrlTooLong = 66,
728
+ SessionStorageBufferFull = 67,
729
+ CannotAccessCookie = 68,
730
+ IdTooLong = 69,
731
+ InvalidEvent = 70,
732
+ FailedMonitorAjaxSetRequestHeader = 71,
733
+ SendBrowserInfoOnUserInit = 72,
734
+ PluginException = 73,
735
+ NotificationException = 74,
736
+ SnippetScriptLoadFailure = 99,
737
+ InvalidInstrumentationKey = 100,
738
+ CannotParseAiBlobValue = 101,
739
+ InvalidContentBlob = 102,
740
+ TrackPageActionEventFailed = 103,
741
+ FailedAddingCustomDefinedRequestContext = 104,
742
+ InMemoryStorageBufferFull = 105,
743
+ InstrumentationKeyDeprecation = 106,
744
+ ConfigWatcherException = 107,
745
+ DynamicConfigException = 108
746
+ }
747
+
748
+ export declare const enum eLoggingSeverity {
749
+ /**
750
+ * No Logging will be enabled
751
+ */
752
+ DISABLED = 0,
753
+ /**
754
+ * Error will be sent as internal telemetry
755
+ */
756
+ CRITICAL = 1,
757
+ /**
758
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
759
+ */
760
+ WARNING = 2
761
+ }
762
+
763
+ export declare type EnumValue<E = any> = EnumCls<E>;
764
+
765
+ /**
766
+ * Removes an event handler for the specified event
767
+ * @param Object - to remove the event from
768
+ * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,
769
+ * such as "click", "click.mynamespace" or ".mynamespace"
770
+ * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a
771
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
772
+ * otherwise this will only remove events with this specific handler.
773
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
774
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
775
+ * @param useCapture - [Optional] Defaults to false
776
+ */
777
+ export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
778
+
779
+ /**
780
+ * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
781
+ * @param obj - Object to add the event too.
782
+ * @param eventName - String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
783
+ * namespaces "click" "click.mynamespace" in addition to specific namespaces.
784
+ * @param handlerRef - Pointer that specifies the function to call when event fires
785
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
786
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
787
+ * @param useCapture - [Optional] Defaults to false
788
+ * @returns True if the function was bound successfully to the event, otherwise false
789
+ */
790
+ export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
791
+
792
+ /**
793
+ * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
794
+ */
795
+ export declare const EventsDiscardedReason: EnumValue<typeof eEventsDiscardedReason>;
796
+
797
+ export declare type EventsDiscardedReason = number | eEventsDiscardedReason;
798
+
799
+ /**
800
+ * Helper function to fetch the named meta-tag from the page.
801
+ * @param name
802
+ */
803
+ export declare function findMetaTag(name: string): any;
804
+
805
+ /**
806
+ * Helper function to fetch the named server timing value from the page response (first navigation event).
807
+ * @param name
808
+ */
809
+ export declare function findNamedServerTiming(name: string): any;
810
+
811
+ /**
812
+ * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
813
+ * @returns
814
+ */
815
+ export declare function findW3cTraceParent(): ITraceParent;
816
+
817
+ /**
818
+ * This is the reverse case of {@link blockDynamicConversion} in that this will tag an
819
+ * object to indicate that it should always be converted into a dynamic trackable object
820
+ * even when not an object or array. So all properties of this object will become
821
+ * get / set accessor functions.
822
+ *
823
+ * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.
824
+ *
825
+ * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and
826
+ * if there is an exception adding the property to the value (because its frozen etc) the
827
+ * exception will be swallowed.
828
+ * @param value - The object that should be tagged and converted if included into a dynamic
829
+ * configuration.
830
+ * @returns The original value
831
+ */
832
+ export declare function forceDynamicConversion<T>(value: T): T;
833
+
834
+ /**
835
+ * Format the ITraceParent value as a string using the supported and know version formats.
836
+ * So even if the passed traceParent is a later version the string value returned from this
837
+ * function will convert it to only the known version formats.
838
+ * This currently only supports version "00" and invalid "ff"
839
+ * @param value - The parsed traceParent value
840
+ * @returns
841
+ */
842
+ export declare function formatTraceParent(value: ITraceParent): string;
843
+
844
+ /**
845
+ * generate W3C trace id
846
+ */
847
+ export declare function generateW3CId(): string;
848
+
849
+ /**
850
+ * Returns the global console object
851
+ */
852
+ export declare function getConsole(): Console | null;
853
+
854
+ /**
855
+ * Returns the crypto object if it is present otherwise null.
856
+ * This helper is used to access the crypto object from the current
857
+ * global instance which could be window or globalThis for a web worker
858
+ */
859
+ export declare function getCrypto(): Crypto | null;
860
+
861
+ export declare function getDebugExt(config: IConfiguration): IDbgExtension;
862
+
863
+ export declare function getDebugListener(config: IConfiguration): INotificationListener;
864
+
865
+ export { getDocument }
866
+
867
+ /**
868
+ * @internal
869
+ * Get the dynamic config handler if the value is already dynamic
870
+ * @param value
871
+ * @returns
872
+ */
873
+ export declare function getDynamicConfigHandler<T>(value: T | IDynamicConfigHandler<T>): IDynamicConfigHandler<T> | null;
874
+
875
+ /**
876
+ * Returns the name of object if it's an Error. Otherwise, returns empty string.
877
+ */
878
+ export declare function getExceptionName(object: any): string;
879
+
880
+ /**
881
+ * Get the current global performance manager that will be used with no performance manager is supplied.
882
+ * @returns - The current default manager
883
+ */
884
+ export declare function getGblPerfMgr(): IPerfManager;
885
+
886
+ export { getGlobal }
887
+
888
+ export { getGlobalInst }
889
+
890
+ export { getHistory }
891
+
892
+ /**
893
+ * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise
894
+ */
895
+ export declare function getIEVersion(userAgentStr?: string): number;
896
+
897
+ /**
898
+ * Returns the global JSON object if it is present otherwise null.
899
+ * This helper is used to access the JSON object without causing an exception
900
+ * "Uncaught ReferenceError: JSON is not defined"
901
+ */
902
+ export declare function getJSON(): JSON | null;
903
+
904
+ /**
905
+ * Returns the global location object if it is present otherwise null.
906
+ * This helper is used to access the location object without causing an exception
907
+ * "Uncaught ReferenceError: location is not defined"
908
+ */
909
+ export declare function getLocation(checkForMock?: boolean): Location | null;
910
+
911
+ /**
912
+ * Returns the crypto object if it is present otherwise null.
913
+ * This helper is used to access the crypto object from the current
914
+ * global instance which could be window or globalThis for a web worker
915
+ */
916
+ export declare function getMsCrypto(): Crypto | null;
917
+
918
+ export { getNavigator }
919
+
920
+ export { getPerformance }
921
+
922
+ /**
923
+ * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it
924
+ * @param target - The target object to return or set the default value
925
+ * @param field - The key for the field to set on the target
926
+ * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added
927
+ */
928
+ export declare function getSetValue<T, K extends keyof T>(target: T, field: K, defValue?: T[K]): T[K];
929
+
930
+ export { getWindow }
931
+
932
+ export { hasDocument }
933
+
934
+ export { hasHistory }
935
+
936
+ /**
937
+ * Checks if JSON object is available, this is required as we support the API running without a
938
+ * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history
939
+ * object to a local variable or pass as an argument an "Uncaught ReferenceError: JSON is not defined"
940
+ * exception will be thrown.
941
+ * Defined as a function to support lazy / late binding environments.
942
+ */
943
+ export declare function hasJSON(): boolean;
944
+
945
+ export { hasNavigator }
946
+
947
+ export { hasOwnProperty }
948
+
949
+ export { hasWindow }
950
+
951
+ export declare interface IAppInsightsCore<CfgType extends IConfiguration = IConfiguration> extends IPerfManagerProvider {
952
+ readonly config: CfgType;
953
+ /**
954
+ * The current logger instance for this instance.
955
+ */
956
+ readonly logger: IDiagnosticLogger;
957
+ /**
958
+ * An array of the installed plugins that provide a version
959
+ */
960
+ readonly pluginVersionStringArr: string[];
961
+ /**
962
+ * The formatted string of the installed plugins that contain a version number
963
+ */
964
+ readonly pluginVersionString: string;
965
+ /**
966
+ * Returns a value that indicates whether the instance has already been previously initialized.
967
+ */
968
+ isInitialized?: () => boolean;
969
+ initialize(config: CfgType, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
970
+ getChannels(): IChannelControls[];
971
+ track(telemetryItem: ITelemetryItem): void;
972
+ /**
973
+ * Get the current notification manager
974
+ */
975
+ getNotifyMgr(): INotificationManager;
976
+ /**
977
+ * Get the current cookie manager for this instance
978
+ */
979
+ getCookieMgr(): ICookieMgr;
980
+ /**
981
+ * Set the current cookie manager for this instance
982
+ * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created
983
+ */
984
+ setCookieMgr(cookieMgr: ICookieMgr): void;
985
+ /**
986
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
987
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
988
+ * called.
989
+ * @param listener - An INotificationListener object.
990
+ */
991
+ addNotificationListener?(listener: INotificationListener): void;
992
+ /**
993
+ * Removes all instances of the listener.
994
+ * @param listener - INotificationListener to remove.
995
+ */
996
+ removeNotificationListener?(listener: INotificationListener): void;
997
+ /**
998
+ * Add a telemetry processor to decorate or drop telemetry events.
999
+ * @param telemetryInitializer - The Telemetry Initializer function
1000
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
1001
+ */
1002
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
1003
+ pollInternalLogs?(eventName?: string): ITimerHandler;
1004
+ stopPollingInternalLogs?(): void;
1005
+ /**
1006
+ * Return a new instance of the IProcessTelemetryContext for processing events
1007
+ */
1008
+ getProcessTelContext(): IProcessTelemetryContext;
1009
+ /**
1010
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
1011
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
1012
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
1013
+ * approach is to create a new instance and initialize that instance.
1014
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
1015
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
1016
+ * @param isAsync - Can the unload be performed asynchronously (default)
1017
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
1018
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
1019
+ */
1020
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
1021
+ /**
1022
+ * Find and return the (first) plugin with the specified identifier if present
1023
+ * @param pluginIdentifier
1024
+ */
1025
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
1026
+ /**
1027
+ * Add a new plugin to the installation
1028
+ * @param plugin - The new plugin to add
1029
+ * @param replaceExisting - should any existing plugin be replaced, default is false
1030
+ * @param doAsync - Should the add be performed asynchronously
1031
+ * @param addCb - [Optional] callback to call after the plugin has been added
1032
+ */
1033
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
1034
+ /**
1035
+ * Update the configuration used and broadcast the changes to all loaded plugins, this does NOT support updating, adding or removing
1036
+ * any the plugins (extensions or channels). It will notify each plugin (if supported) that the configuration has changed but it will
1037
+ * not remove or add any new plugins, you need to call addPlugin or getPlugin(identifier).remove();
1038
+ * @param newConfig - The new configuration is apply
1039
+ * @param mergeExisting - Should the new configuration merge with the existing or just replace it. Default is to merge.
1040
+ */
1041
+ updateCfg(newConfig: CfgType, mergeExisting?: boolean): void;
1042
+ /**
1043
+ * Returns the unique event namespace that should be used when registering events
1044
+ */
1045
+ evtNamespace(): string;
1046
+ /**
1047
+ * Add a handler that will be called when the SDK is being unloaded
1048
+ * @param handler - the handler
1049
+ */
1050
+ addUnloadCb(handler: UnloadHandler): void;
1051
+ /**
1052
+ * Add this hook so that it is automatically removed during unloading
1053
+ * @param hooks - The single hook or an array of IInstrumentHook objects
1054
+ */
1055
+ addUnloadHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
1056
+ /**
1057
+ * Flush and send any batched / cached data immediately
1058
+ * @param async - send data asynchronously when true (defaults to true)
1059
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
1060
+ * If the caller doesn't return true the caller should assume that it may never be called.
1061
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
1062
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
1063
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
1064
+ */
1065
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
1066
+ /**
1067
+ * Gets the current distributed trace context for this instance if available
1068
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
1069
+ */
1070
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
1071
+ /**
1072
+ * Sets the current distributed trace context for this instance if available
1073
+ */
1074
+ setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
1075
+ /**
1076
+ * Watches and tracks changes for accesses to the current config, and if the accessed config changes the
1077
+ * handler will be recalled.
1078
+ * @param handler
1079
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
1080
+ */
1081
+ onCfgChange(handler: WatcherFunction<CfgType>): IUnloadHook;
1082
+ /**
1083
+ * Function used to identify the get w parameter used to identify status bit to some channels
1084
+ */
1085
+ getWParam: () => number;
1086
+ }
1087
+
1088
+ export declare interface IBaseProcessingContext {
1089
+ /**
1090
+ * The current core instance for the request
1091
+ */
1092
+ core: () => IAppInsightsCore;
1093
+ /**
1094
+ * THe current diagnostic logger for the request
1095
+ */
1096
+ diagLog: () => IDiagnosticLogger;
1097
+ /**
1098
+ * Gets the current core config instance
1099
+ */
1100
+ getCfg: () => IConfiguration;
1101
+ /**
1102
+ * Gets the named extension config
1103
+ */
1104
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
1105
+ /**
1106
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
1107
+ * default value is returned
1108
+ * @param identifier - The named extension identifier
1109
+ * @param field - The config field name
1110
+ * @param defaultValue - The default value to return if no defined config exists
1111
+ */
1112
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1113
+ /**
1114
+ * Helper to allow plugins to check and possibly shortcut executing code only
1115
+ * required if there is a nextPlugin
1116
+ */
1117
+ hasNext: () => boolean;
1118
+ /**
1119
+ * Returns the next configured plugin proxy
1120
+ */
1121
+ getNext: () => ITelemetryPluginChain;
1122
+ /**
1123
+ * Helper to set the next plugin proxy
1124
+ */
1125
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
1126
+ /**
1127
+ * Synchronously iterate over the context chain running the callback for each plugin, once
1128
+ * every plugin has been executed via the callback, any associated onComplete will be called.
1129
+ * @param callback - The function call for each plugin in the context chain
1130
+ */
1131
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
1132
+ /**
1133
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
1134
+ * @param onComplete - The onComplete to call
1135
+ * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
1136
+ * @param args - Any additional arguments to pass to the onComplete function
1137
+ */
1138
+ onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
1139
+ /**
1140
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1141
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1142
+ * then the current execution order will be copied.
1143
+ * @param startAt - The plugin to start processing from, if missing from the execution
1144
+ * order then the next plugin will be NOT set.
1145
+ */
1146
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
1147
+ }
1148
+
1149
+ /**
1150
+ * Provides data transmission capabilities
1151
+ */
1152
+ export declare interface IChannelControls extends ITelemetryPlugin {
1153
+ /**
1154
+ * Pause sending data
1155
+ */
1156
+ pause?(): void;
1157
+ /**
1158
+ * Resume sending data
1159
+ */
1160
+ resume?(): void;
1161
+ /**
1162
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
1163
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
1164
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
1165
+ * @param unloadCtx - This is the context that should be used during unloading.
1166
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
1167
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1168
+ */
1169
+ teardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1170
+ /**
1171
+ * Flush to send data immediately; channel should default to sending data asynchronously
1172
+ * @param async - send data asynchronously when true
1173
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
1174
+ * If the caller doesn't return true the caller should assume that it may never be called.
1175
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
1176
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
1177
+ */
1178
+ flush?(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
1179
+ }
1180
+
1181
+ export declare interface IChannelControlsHost extends IChannelControls {
1182
+ /**
1183
+ * Get and return the named channel instance (if present) from the queues
1184
+ * @param pluginIdentifier - The identifier name of the plugin
1185
+ */
1186
+ getChannel<T extends IPlugin = IPlugin>(pluginIdentifier: string): T;
1187
+ }
1188
+
1189
+ /**
1190
+ * The type to identify whether the default value should be applied in preference to the provided value.
1191
+ */
1192
+ export declare type IConfigCheckFn<V> = (value: V) => boolean;
1193
+
1194
+ /**
1195
+ * The default values with a check function
1196
+ */
1197
+ export declare interface IConfigDefaultCheck<T, V, C = IConfiguration> {
1198
+ /**
1199
+ * Callback function to check if the user-supplied value is valid, if not the default will be applied
1200
+ */
1201
+ isVal?: IConfigCheckFn<V>;
1202
+ /**
1203
+ * Optional function to allow converting and setting of the default value
1204
+ */
1205
+ set?: IConfigSetFn<T, V>;
1206
+ /**
1207
+ * The default value to apply if the user-supplied value is not valid
1208
+ */
1209
+ v?: V | IConfigDefaults<V, T>;
1210
+ /**
1211
+ * The default fallback key if the main key is not present, this is the key value from the config
1212
+ */
1213
+ fb?: keyof T | keyof C | Array<keyof T | keyof C>;
1214
+ /**
1215
+ * Use this check to determine the default fallback, default only checked whether the property isDefined,
1216
+ * therefore `null`; `""` are considered to be valid values.
1217
+ */
1218
+ dfVal?: (value: any) => boolean;
1219
+ /**
1220
+ * Specify that any provided value should have the default value(s) merged into the value rather than
1221
+ * just using either the default of user provided values. Mergeed objects will automatically be marked
1222
+ * as referenced.
1223
+ */
1224
+ mrg?: boolean;
1225
+ /**
1226
+ * Set this field of the target as referenced, which will cause any object or array instance
1227
+ * to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
1228
+ * This is required for nested default objects to avoid multiple repetitive updates to listeners
1229
+ * @returns The referenced properties current value
1230
+ */
1231
+ ref?: boolean;
1232
+ /**
1233
+ * Set this field of the target as read-only, which will block this single named property from
1234
+ * ever being changed for the target instance.
1235
+ * This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
1236
+ * if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
1237
+ * @returns The referenced properties current value
1238
+ */
1239
+ rdOnly?: boolean;
1240
+ }
1241
+
1242
+ /**
1243
+ * The Type definition to define default values to be applied to the config
1244
+ * The value may be either the direct value or a ConfigDefaultCheck definition
1245
+ */
1246
+ export declare type IConfigDefaults<T, C = IConfiguration> = {
1247
+ [key in keyof T]: T[key] | IConfigDefaultCheck<T, T[key], C>;
1248
+ };
1249
+
1250
+ /**
1251
+ * The type which identifies the function use to validate the user supplied value
1252
+ */
1253
+ export declare type IConfigSetFn<T, V> = (value: any, defValue: V, theConfig: T) => V;
1254
+
1255
+ /**
1256
+ * Configuration provided to SDK core
1257
+ */
1258
+ export declare interface IConfiguration {
1259
+ /**
1260
+ * Instrumentation key of resource. Either this or connectionString must be specified.
1261
+ */
1262
+ instrumentationKey?: string;
1263
+ /**
1264
+ * Connection string of resource. Either this or instrumentationKey must be specified.
1265
+ */
1266
+ connectionString?: string;
1267
+ /**
1268
+ * Polling interval (in ms) for internal logging queue
1269
+ */
1270
+ diagnosticLogInterval?: number;
1271
+ /**
1272
+ * Maximum number of iKey transmitted logging telemetry per page view
1273
+ */
1274
+ maxMessageLimit?: number;
1275
+ /**
1276
+ * Console logging level. All logs with a severity level higher
1277
+ * than the configured level will be printed to console. Otherwise
1278
+ * they are suppressed. ie Level 2 will print both CRITICAL and
1279
+ * WARNING logs to console, level 1 prints only CRITICAL.
1280
+ *
1281
+ * Note: Logs sent as telemetry to instrumentation key will also
1282
+ * be logged to console if their severity meets the configured loggingConsoleLevel
1283
+ *
1284
+ * 0: ALL console logging off
1285
+ * 1: logs to console: severity >= CRITICAL
1286
+ * 2: logs to console: severity >= WARNING
1287
+ */
1288
+ loggingLevelConsole?: number;
1289
+ /**
1290
+ * Telemtry logging level to instrumentation key. All logs with a severity
1291
+ * level higher than the configured level will sent as telemetry data to
1292
+ * the configured instrumentation key.
1293
+ *
1294
+ * 0: ALL iKey logging off
1295
+ * 1: logs to iKey: severity >= CRITICAL
1296
+ * 2: logs to iKey: severity >= WARNING
1297
+ */
1298
+ loggingLevelTelemetry?: number;
1299
+ /**
1300
+ * If enabled, uncaught exceptions will be thrown to help with debugging
1301
+ */
1302
+ enableDebug?: boolean;
1303
+ /**
1304
+ * Endpoint where telemetry data is sent
1305
+ */
1306
+ endpointUrl?: string;
1307
+ /**
1308
+ * Extension configs loaded in SDK
1309
+ */
1310
+ extensionConfig?: {
1311
+ [key: string]: any;
1312
+ };
1313
+ /**
1314
+ * Additional plugins that should be loaded by core at runtime
1315
+ */
1316
+ readonly extensions?: ITelemetryPlugin[];
1317
+ /**
1318
+ * Channel queues that is setup by caller in desired order.
1319
+ * If channels are provided here, core will ignore any channels that are already setup, example if there is a SKU with an initialized channel
1320
+ */
1321
+ readonly channels?: IChannelControls[][];
1322
+ /**
1323
+ * @type {boolean}
1324
+ * Flag that disables the Instrumentation Key validation.
1325
+ */
1326
+ disableInstrumentationKeyValidation?: boolean;
1327
+ /**
1328
+ * [Optional] When enabled this will create local perfEvents based on sections of the code that have been instrumented
1329
+ * to emit perfEvents (via the doPerf()) when this is enabled. This can be used to identify performance issues within
1330
+ * the SDK, the way you are using it or optionally your own instrumented code.
1331
+ * The provided IPerfManager implementation does NOT send any additional telemetry events to the server it will only fire
1332
+ * the new perfEvent() on the INotificationManager which you can listen to.
1333
+ * This also does not use the window.performance API, so it will work in environments where this API is not supported.
1334
+ */
1335
+ enablePerfMgr?: boolean;
1336
+ /**
1337
+ * [Optional] Callback function that will be called to create a the IPerfManager instance when required and ```enablePerfMgr```
1338
+ * is enabled, this enables you to override the default creation of a PerfManager() without needing to ```setPerfMgr()```
1339
+ * after initialization.
1340
+ */
1341
+ createPerfMgr?: (core: IAppInsightsCore, notificationManager: INotificationManager) => IPerfManager;
1342
+ /**
1343
+ * [Optional] Fire every single performance event not just the top level root performance event. Defaults to false.
1344
+ */
1345
+ perfEvtsSendAll?: boolean;
1346
+ /**
1347
+ * [Optional] Identifies the default length used to generate random session and user id's if non currently exists for the user / session.
1348
+ * Defaults to 22, previous default value was 5, if you need to keep the previous maximum length you should set this value to 5.
1349
+ */
1350
+ idLength?: number;
1351
+ /**
1352
+ * @description Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains. It
1353
+ * can be set here or as part of the cookieCfg.domain, the cookieCfg takes precedence if both are specified.
1354
+ * @type {string}
1355
+ * @defaultValue ""
1356
+ */
1357
+ cookieDomain?: string;
1358
+ /**
1359
+ * @description Custom cookie path. This is helpful if you want to share Application Insights cookies behind an application
1360
+ * gateway. It can be set here or as part of the cookieCfg.domain, the cookieCfg takes precedence if both are specified.
1361
+ * @type {string}
1362
+ * @defaultValue ""
1363
+ */
1364
+ cookiePath?: string;
1365
+ /**
1366
+ * [Optional] A boolean that indicated whether to disable the use of cookies by the SDK. If true, the SDK will not store or
1367
+ * read any data from cookies. Cookie usage can be re-enabled after initialization via the core.getCookieMgr().enable().
1368
+ */
1369
+ disableCookiesUsage?: boolean;
1370
+ /**
1371
+ * [Optional] A Cookie Manager configuration which includes hooks to allow interception of the get, set and delete cookie
1372
+ * operations. If this configuration is specified any specified enabled and domain properties will take precedence over the
1373
+ * cookieDomain and disableCookiesUsage values.
1374
+ */
1375
+ cookieCfg?: ICookieMgrConfig;
1376
+ /**
1377
+ * [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
1378
+ * event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
1379
+ * Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
1380
+ */
1381
+ disablePageUnloadEvents?: string[];
1382
+ /**
1383
+ * [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
1384
+ * hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
1385
+ * Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
1386
+ */
1387
+ disablePageShowEvents?: string[];
1388
+ /**
1389
+ * [Optional] A flag for performance optimization to disable attempting to use the Chrome Debug Extension, if disabled and the extension is installed
1390
+ * this will not send any notifications.
1391
+ */
1392
+ disableDbgExt?: boolean;
1393
+ /**
1394
+ * Add "&w=0" parameter to support UA Parsing when web-workers don't have access to Document.
1395
+ * Default is false
1396
+ */
1397
+ enableWParam?: boolean;
1398
+ }
1399
+
1400
+ export declare interface ICookieMgr {
1401
+ /**
1402
+ * Enable or Disable the usage of cookies
1403
+ */
1404
+ setEnabled(value: boolean): void;
1405
+ /**
1406
+ * Can the system use cookies, if this returns false then all cookie setting and access functions will return nothing
1407
+ */
1408
+ isEnabled(): boolean;
1409
+ /**
1410
+ * Set the named cookie with the value and optional domain and optional
1411
+ * @param name - The name of the cookie
1412
+ * @param value - The value of the cookie (Must already be encoded)
1413
+ * @param maxAgeSec - [optional] The maximum number of SECONDS that this cookie should survive
1414
+ * @param domain - [optional] The domain to set for the cookie
1415
+ * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1416
+ * @returns - True if the cookie was set otherwise false (Because cookie usage is not enabled or available)
1417
+ */
1418
+ set(name: string, value: string, maxAgeSec?: number, domain?: string, path?: string): boolean;
1419
+ /**
1420
+ * Get the value of the named cookie
1421
+ * @param name - The name of the cookie
1422
+ */
1423
+ get(name: string): string;
1424
+ /**
1425
+ * Delete/Remove the named cookie if cookie support is available and enabled.
1426
+ * Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers
1427
+ * @param name - The name of the cookie
1428
+ * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1429
+ * @returns - True if the cookie was marked for deletion otherwise false (Because cookie usage is not enabled or available)
1430
+ */
1431
+ del(name: string, path?: string): boolean;
1432
+ /**
1433
+ * Purge the cookie from the system if cookie support is available, this function ignores the enabled setting of the manager
1434
+ * so any cookie will be removed.
1435
+ * Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers
1436
+ * @param name - The name of the cookie
1437
+ * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1438
+ * @returns - True if the cookie was marked for deletion otherwise false (Because cookie usage is not available)
1439
+ */
1440
+ purge(name: string, path?: string): boolean;
1441
+ /**
1442
+ * Optional Callback hook to allow the diagnostic logger to update it's configuration
1443
+ * @param updateState
1444
+ */
1445
+ update?(updateState: ITelemetryUpdateState): void;
1446
+ }
1447
+
1448
+ /**
1449
+ * Configuration definition for instance based cookie management configuration
1450
+ */
1451
+ export declare interface ICookieMgrConfig {
1452
+ /**
1453
+ * Defaults to true, A boolean that indicates whether the use of cookies by the SDK is enabled by the current instance.
1454
+ * If false, the instance of the SDK initialized by this configuration will not store or read any data from cookies
1455
+ */
1456
+ enabled?: boolean;
1457
+ /**
1458
+ * Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.
1459
+ */
1460
+ domain?: string;
1461
+ /**
1462
+ * Specifies the path to use for the cookie, defaults to '/'
1463
+ */
1464
+ path?: string;
1465
+ /**
1466
+ * Specify the cookie name(s) to be ignored, this will cause any matching cookie name to never be read or written.
1467
+ * They may still be explicitly purged or deleted. You do not need to repeat the name in the `blockedCookies`
1468
+ * configuration.(Since v2.8.8)
1469
+ */
1470
+ ignoreCookies?: string[];
1471
+ /**
1472
+ * Specify the cookie name(s) to never be written, this will cause any cookie name to never be created or updated,
1473
+ * they will still be read unless also included in the ignoreCookies and may still be explicitly purged or deleted.
1474
+ * If not provided defaults to the same list provided in ignoreCookies. (Since v2.8.8)
1475
+ */
1476
+ blockedCookies?: string[];
1477
+ /**
1478
+ * Hook function to fetch the named cookie value.
1479
+ * @param name - The name of the cookie
1480
+ */
1481
+ getCookie?: (name: string) => string;
1482
+ /**
1483
+ * Hook function to set the named cookie with the specified value.
1484
+ * @param name - The name of the cookie
1485
+ * @param value - The value to set for the cookie
1486
+ */
1487
+ setCookie?: (name: string, value: string) => void;
1488
+ /**
1489
+ * Hook function to delete the named cookie with the specified value, separated from
1490
+ * setCookie to avoid the need to parse the value to determine whether the cookie is being
1491
+ * added or removed.
1492
+ * @param name - The name of the cookie
1493
+ * @param cookieValue - The value to set to expire the cookie
1494
+ */
1495
+ delCookie?: (name: string, cookieValue: string) => void;
1496
+ }
1497
+
1498
+ export declare interface ICustomProperties {
1499
+ [key: string]: any;
1500
+ }
1501
+
1502
+ export declare interface IDbgExtension {
1503
+ isEnabled: () => boolean;
1504
+ enable: () => void;
1505
+ disable: () => void;
1506
+ listener: INotificationListener;
1507
+ sendEvt?: (name: string, data: any) => void;
1508
+ debugMsg?: (name: string, data: any) => void;
1509
+ diagLog?: (name: string, data: any) => void;
1510
+ }
1511
+
1512
+ export declare interface IDiagnosticLogger {
1513
+ /**
1514
+ * 0: OFF
1515
+ * 1: only critical (default)
1516
+ * 2: critical + info
1517
+ */
1518
+ consoleLoggingLevel: () => number;
1519
+ /**
1520
+ * The internal logging queue
1521
+ */
1522
+ queue: _InternalLogMessage[];
1523
+ /**
1524
+ * This method will throw exceptions in debug mode or attempt to log the error as a console warning.
1525
+ * @param severity - The severity of the log message
1526
+ * @param message - The log message.
1527
+ */
1528
+ throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
1529
+ /**
1530
+ * This will write a warning to the console if possible
1531
+ * @param message - The warning message
1532
+ */
1533
+ warnToConsole(message: string): void;
1534
+ /**
1535
+ * This will write an error to the console if possible.
1536
+ * Provided by the default DiagnosticLogger instance, and internally the SDK will fall back to warnToConsole, however,
1537
+ * direct callers MUST check for its existence on the logger as you can provide your own IDiagnosticLogger instance.
1538
+ * @param message - The error message
1539
+ */
1540
+ errorToConsole?(message: string): void;
1541
+ /**
1542
+ * Resets the internal message count
1543
+ */
1544
+ resetInternalMessageCount(): void;
1545
+ /**
1546
+ * Logs a message to the internal queue.
1547
+ * @param severity - The severity of the log message
1548
+ * @param message - The message to log.
1549
+ */
1550
+ logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
1551
+ /**
1552
+ * Optional Callback hook to allow the diagnostic logger to update it's configuration
1553
+ * @param updateState
1554
+ */
1555
+ update?(updateState: ITelemetryUpdateState): void;
1556
+ }
1557
+
1558
+ export declare interface IDistributedTraceContext {
1559
+ /**
1560
+ * Returns the current name of the page
1561
+ */
1562
+ getName(): string;
1563
+ /**
1564
+ * Sets the current name of the page
1565
+ * @param pageName
1566
+ */
1567
+ setName(pageName: string): void;
1568
+ /**
1569
+ * Returns the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1570
+ * Must be read from incoming headers or generated according to the W3C TraceContext specification,
1571
+ * in a hex representation of 16-byte array. A.k.a. trace-id, TraceID or Distributed TraceID
1572
+ */
1573
+ getTraceId(): string;
1574
+ /**
1575
+ * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1576
+ * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1577
+ * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1578
+ */
1579
+ setTraceId(newValue: string): void;
1580
+ /**
1581
+ * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1582
+ * Also know as the parentId, used to link requests together
1583
+ */
1584
+ getSpanId(): string;
1585
+ /**
1586
+ * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1587
+ * Also know as the parentId, used to link requests together
1588
+ * https://www.w3.org/TR/trace-context/#parent-id
1589
+ */
1590
+ setSpanId(newValue: string): void;
1591
+ /**
1592
+ * An integer representation of the W3C TraceContext trace-flags.
1593
+ */
1594
+ getTraceFlags(): number | undefined;
1595
+ /**
1596
+ * https://www.w3.org/TR/trace-context/#trace-flags
1597
+ * @param newValue
1598
+ */
1599
+ setTraceFlags(newValue?: number): void;
1600
+ }
1601
+
1602
+ /**
1603
+ * This interface identifies the config which can track changes
1604
+ */
1605
+ export declare interface IDynamicConfigHandler<T extends IConfiguration> {
1606
+ /**
1607
+ * Unique Id for this config handler
1608
+ */
1609
+ readonly uid: string;
1610
+ /**
1611
+ * Link back to the configuration object that should be used to get/set values
1612
+ */
1613
+ cfg: T;
1614
+ /**
1615
+ * The logger instance to use to loger any issues
1616
+ */
1617
+ logger: IDiagnosticLogger;
1618
+ /**
1619
+ * Helper to call any listeners that are waiting to be notified
1620
+ */
1621
+ notify: () => void;
1622
+ /**
1623
+ * Watch and track changes for accesses to the current config anb
1624
+ */
1625
+ watch: (configHandler: WatcherFunction<T>) => IWatcherHandler<T>;
1626
+ /**
1627
+ * Set the value against the provided config/name with the value, the property
1628
+ * will be converted to be dynamic (if not already) as long as the provided config
1629
+ * is already a tracked dynamic object.
1630
+ * @throws TypeError if the provided config is not a monitored dynamic config
1631
+ */
1632
+ set: <C, V>(theConfig: C, name: string, value: V) => V;
1633
+ /**
1634
+ * Set default values for the config if not present.
1635
+ * @param theConfig - The configuration object to set default on (if missing)
1636
+ * @param defaultValues - The default values to apply to the config
1637
+ */
1638
+ setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C, T>) => C;
1639
+ /**
1640
+ * Set this named property of the target as referenced, which will cause any object or array instances
1641
+ * to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
1642
+ * @returns The referenced properties current value
1643
+ */
1644
+ ref: <C, V = any>(target: C, name: string) => V;
1645
+ /**
1646
+ * Set this named property of the target as read-only, which will block this single named property from
1647
+ * ever being changed for the target instance.
1648
+ * This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
1649
+ * if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
1650
+ * @returns The referenced properties current value
1651
+ */
1652
+ rdOnly: <C, V = any>(target: C, name: string) => V;
1653
+ }
1654
+
1655
+ export declare interface IDynamicPropertyHandler<T> {
1656
+ /**
1657
+ * Identifies the name of the field that is handled by this handler
1658
+ */
1659
+ n: string;
1660
+ /**
1661
+ * The current collection is watcher handlers which should be called if the value changes
1662
+ */
1663
+ h: IWatcherHandler<T>[];
1664
+ }
1665
+
1666
+ export declare interface IInstrumentCallDetails {
1667
+ name: string;
1668
+ inst: any;
1669
+ /**
1670
+ * This returns an object that the hook function can use to store hook specific
1671
+ * context, it it not shared with any other hook instances and is unique for the
1672
+ * current call.
1673
+ * A hook implementation can use this to pass / share context between different
1674
+ * hook callbacks eg. request/response requst/hookErrors etc.
1675
+ */
1676
+ ctx: () => any;
1677
+ /**
1678
+ * Allows the hook functions to replace the original arguments
1679
+ * @param idx - The argument index (0 based)
1680
+ * @param value - The new value for the argument
1681
+ */
1682
+ set: (idx: number, value: any) => void;
1683
+ /**
1684
+ * The result of the original method, only populated after the original method has returned
1685
+ */
1686
+ rslt?: any;
1687
+ /**
1688
+ * The error (exception) which occurred while executing the original method
1689
+ */
1690
+ err?: Error;
1691
+ /**
1692
+ * The Event object from (window.event) at the start of the original call
1693
+ */
1694
+ evt?: Event;
1695
+ }
1696
+
1697
+ /**
1698
+ * The holder of the specific instance callback
1699
+ */
1700
+ export declare interface IInstrumentHook extends IUnloadHook {
1701
+ /** Unique Id for this callback on the hooked method */
1702
+ id: number;
1703
+ /** Holds the callbacks */
1704
+ cbks: IInstrumentHooksCallbacks;
1705
+ /** Remove this hook from the function */
1706
+ rm: () => void;
1707
+ }
1708
+
1709
+ export declare interface IInstrumentHooks {
1710
+ i: number;
1711
+ n: string;
1712
+ f: any;
1713
+ h: IInstrumentHook[];
1714
+ }
1715
+
1716
+ /**
1717
+ * The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
1718
+ * You must always supply the error callback
1719
+ */
1720
+ export declare interface IInstrumentHooksCallbacks {
1721
+ /**
1722
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1723
+ * identify the source of the instrumented hooks
1724
+ */
1725
+ ns?: string | string[];
1726
+ /**
1727
+ * The hook callback to call before the original function is called
1728
+ */
1729
+ req?: InstrumentorHooksCallback;
1730
+ /**
1731
+ * The hook callback to call after the original function was called
1732
+ */
1733
+ rsp?: InstrumentorHooksCallback;
1734
+ /**
1735
+ * The callback to call if the hook function causes an exception
1736
+ */
1737
+ hkErr?: InstrumentorHooksCallback;
1738
+ /**
1739
+ * The callback to call if the original function causes an exception, even if you
1740
+ * supply a callback the original exception will still be thrown
1741
+ */
1742
+ fnErr?: InstrumentorHooksCallback;
1743
+ }
1744
+
1745
+ /**
1746
+ * An alternate interface which provides automatic removal during unloading of the component
1747
+ */
1748
+ export declare interface ILegacyUnloadHook {
1749
+ /**
1750
+ * Legacy Self remove the referenced component
1751
+ */
1752
+ remove: () => void;
1753
+ }
1754
+
1755
+ export declare interface ILoadedPlugin<T extends IPlugin> {
1756
+ plugin: T;
1757
+ /**
1758
+ * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1759
+ * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1760
+ * @returns boolean = true if the plugin is in a state where it is operational.
1761
+ */
1762
+ isEnabled: () => boolean;
1763
+ /**
1764
+ * You can optionally enable / disable a plugin from processing events.
1765
+ * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1766
+ * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1767
+ * (unless it's also been re-initialized)
1768
+ */
1769
+ setEnabled: (isEnabled: boolean) => void;
1770
+ remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1771
+ }
1772
+
1773
+ /**
1774
+ * Initialize the queue of plugins
1775
+ * @param plugins - The array of plugins to initialize and setting of the next plugin
1776
+ * @param config - The current config for the instance
1777
+ * @param core - THe current core instance
1778
+ * @param extensions - The extensions
1779
+ */
1780
+ export declare function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
1781
+
1782
+ /**
1783
+ * An interface used for the notification listener.
1784
+ * @interface
1785
+ */
1786
+ export declare interface INotificationListener {
1787
+ /**
1788
+ * [Optional] A function called when events are sent.
1789
+ * @param events - The array of events that have been sent.
1790
+ */
1791
+ eventsSent?: (events: ITelemetryItem[]) => void;
1792
+ /**
1793
+ * [Optional] A function called when events are discarded.
1794
+ * @param events - The array of events that have been discarded.
1795
+ * @param reason - The reason for discarding the events. The EventsDiscardedReason
1796
+ * constant should be used to check the different values.
1797
+ */
1798
+ eventsDiscarded?: (events: ITelemetryItem[], reason: number) => void;
1799
+ /**
1800
+ * [Optional] A function called when the events have been requested to be sent to the sever.
1801
+ * @param sendReason - The reason why the event batch is being sent.
1802
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1803
+ */
1804
+ eventsSendRequest?: (sendReason: number, isAsync?: boolean) => void;
1805
+ /**
1806
+ * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
1807
+ * the event can be displayed via the debug plugin extension.
1808
+ * @param perfEvent
1809
+ */
1810
+ perfEvent?: (perfEvent: IPerfEvent) => void;
1811
+ }
1812
+
1813
+ /**
1814
+ * Class to manage sending notifications to all the listeners.
1815
+ */
1816
+ export declare interface INotificationManager {
1817
+ listeners: INotificationListener[];
1818
+ /**
1819
+ * Adds a notification listener.
1820
+ * @param listener - The notification listener to be added.
1821
+ */
1822
+ addNotificationListener(listener: INotificationListener): void;
1823
+ /**
1824
+ * Removes all instances of the listener.
1825
+ * @param listener - AWTNotificationListener to remove.
1826
+ */
1827
+ removeNotificationListener(listener: INotificationListener): void;
1828
+ /**
1829
+ * Notification for events sent.
1830
+ * @param events - The array of events that have been sent.
1831
+ */
1832
+ eventsSent(events: ITelemetryItem[]): void;
1833
+ /**
1834
+ * Notification for events being discarded.
1835
+ * @param events - The array of events that have been discarded by the SDK.
1836
+ * @param reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
1837
+ * constant should be used to check the different values.
1838
+ */
1839
+ eventsDiscarded(events: ITelemetryItem[], reason: number): void;
1840
+ /**
1841
+ * [Optional] A function called when the events have been requested to be sent to the sever.
1842
+ * @param sendReason - The reason why the event batch is being sent.
1843
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1844
+ */
1845
+ eventsSendRequest?(sendReason: number, isAsync: boolean): void;
1846
+ /**
1847
+ * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
1848
+ * the event can be displayed via the debug plugin extension.
1849
+ * @param perfEvent - The perf event details
1850
+ */
1851
+ perfEvent?(perfEvent: IPerfEvent): void;
1852
+ }
1853
+
1854
+ /**
1855
+ * Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
1856
+ * named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
1857
+ * @param target - The target object
1858
+ * @param evtName - The name of the event
1859
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1860
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1861
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1862
+ */
1863
+ export declare function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
1864
+
1865
+ /**
1866
+ * Intercept the named prototype functions for the target class / object
1867
+ * @param target - The target object
1868
+ * @param funcName - The function name
1869
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1870
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1871
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1872
+ */
1873
+ export declare function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
1874
+
1875
+ /**
1876
+ * Intercept the named functions for the target class / object
1877
+ * @param target - The target object
1878
+ * @param funcNames - The function names to intercept and call
1879
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1880
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1881
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1882
+ */
1883
+ export declare function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook[];
1884
+
1885
+ /**
1886
+ * A callback function that will be called for the wrapped instrumentation function
1887
+ * before the original function is executed.
1888
+ */
1889
+ export declare type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
1890
+
1891
+ /**
1892
+ * Intercept the named prototype functions for the target class / object
1893
+ * @param target - The target object
1894
+ * @param funcName - The function name
1895
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1896
+ */
1897
+ export declare function InstrumentProto(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks): IInstrumentHook;
1898
+
1899
+ /**
1900
+ * Intercept the named prototype functions for the target class / object
1901
+ * @param target - The target object
1902
+ * @param funcNames - The function names to intercept and call
1903
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1904
+ */
1905
+ export declare function InstrumentProtos(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks): IInstrumentHook[];
1906
+
1907
+ export declare class _InternalLogMessage {
1908
+ static dataType: string;
1909
+ message: string;
1910
+ messageId: _InternalMessageId;
1911
+ constructor(msgId: _InternalMessageId, msg: string, isUserAct?: boolean, properties?: Object);
1912
+ }
1913
+
1914
+ export declare type _InternalMessageId = number | _eInternalMessageId;
1915
+
1916
+ /**
1917
+ * This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
1918
+ */
1919
+ export declare interface IPerfEvent {
1920
+ /**
1921
+ * The name of the performance event
1922
+ */
1923
+ name: string;
1924
+ /**
1925
+ * The start time of the performance event
1926
+ */
1927
+ start: number;
1928
+ /**
1929
+ * The payload (contents) of the perfEvent, may be null or only set after the event has completed depending on
1930
+ * the runtime environment.
1931
+ */
1932
+ payload: any;
1933
+ /**
1934
+ * Is this occurring from an asynchronous event
1935
+ */
1936
+ isAsync: boolean;
1937
+ /**
1938
+ * Identifies the total inclusive time spent for this event, including the time spent for child events,
1939
+ * this will be undefined until the event is completed
1940
+ */
1941
+ time?: number;
1942
+ /**
1943
+ * Identifies the exclusive time spent in for this event (not including child events),
1944
+ * this will be undefined until the event is completed.
1945
+ */
1946
+ exTime?: number;
1947
+ /**
1948
+ * The Parent event that was started before this event was created
1949
+ */
1950
+ parent?: IPerfEvent;
1951
+ /**
1952
+ * The child perf events that are contained within the total time of this event.
1953
+ */
1954
+ childEvts?: IPerfEvent[];
1955
+ /**
1956
+ * Identifies whether this event is a child event of a parent
1957
+ */
1958
+ isChildEvt: () => boolean;
1959
+ /**
1960
+ * Get the names additional context associated with this perf event
1961
+ */
1962
+ getCtx?: (key: string) => any;
1963
+ /**
1964
+ * Set the named additional context to be associated with this perf event, this will replace any existing value
1965
+ */
1966
+ setCtx?: (key: string, value: any) => void;
1967
+ /**
1968
+ * Mark this event as completed, calculating the total execution time.
1969
+ */
1970
+ complete: () => void;
1971
+ }
1972
+
1973
+ /**
1974
+ * This defines an internal performance manager for tracking and reporting the internal performance of the SDK -- It does
1975
+ * not represent or report any event to the server.
1976
+ */
1977
+ export declare interface IPerfManager {
1978
+ /**
1979
+ * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
1980
+ * want to monitor this source event.
1981
+ * @param src - The source name of the event
1982
+ * @param payloadDetails - An optional callback function to fetch the payload details for the event.
1983
+ * @param isAsync - Is the event occurring from a async event
1984
+ */
1985
+ create(src: string, payloadDetails?: () => any, isAsync?: boolean): IPerfEvent | null | undefined;
1986
+ /**
1987
+ * Complete the perfEvent and fire any notifications.
1988
+ * @param perfEvent - Fire the event which will also complete the passed event
1989
+ */
1990
+ fire(perfEvent: IPerfEvent): void;
1991
+ /**
1992
+ * Set an execution context value
1993
+ * @param key - The context key name
1994
+ * @param value - The value
1995
+ */
1996
+ setCtx(key: string, value: any): void;
1997
+ /**
1998
+ * Get the execution context value
1999
+ * @param key - The context key
2000
+ */
2001
+ getCtx(key: string): any;
2002
+ }
2003
+
2004
+ /**
2005
+ * Identifies an interface to a host that can provide an IPerfManager implementation
2006
+ */
2007
+ export declare interface IPerfManagerProvider {
2008
+ /**
2009
+ * Get the current performance manager
2010
+ */
2011
+ getPerfMgr(): IPerfManager;
2012
+ /**
2013
+ * Set the current performance manager
2014
+ * @param perfMgr - The performance manager
2015
+ */
2016
+ setPerfMgr(perfMgr: IPerfManager): void;
2017
+ }
2018
+
2019
+ export declare interface IPlugin {
2020
+ /**
2021
+ * Initialize plugin loaded by SDK
2022
+ * @param config - The config for the plugin to use
2023
+ * @param core - The current App Insights core to use for initializing this plugin instance
2024
+ * @param extensions - The complete set of extensions to be used for initializing the plugin
2025
+ * @param pluginChain - [Optional] specifies the current plugin chain which identifies the
2026
+ * set of plugins and the order they should be executed for the current request.
2027
+ */
2028
+ initialize: (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void;
2029
+ /**
2030
+ * Returns a value that indicates whether the plugin has already been previously initialized.
2031
+ * New plugins should implement this method to avoid being initialized more than once.
2032
+ */
2033
+ isInitialized?: () => boolean;
2034
+ /**
2035
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
2036
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
2037
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
2038
+ * @param unloadCtx - This is the context that should be used during unloading.
2039
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
2040
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
2041
+ */
2042
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
2043
+ /**
2044
+ * Extension name
2045
+ */
2046
+ readonly identifier: string;
2047
+ /**
2048
+ * Plugin version (available in data.properties.version in common schema)
2049
+ */
2050
+ readonly version?: string;
2051
+ /**
2052
+ * The App Insights core to use for backward compatibility.
2053
+ * Therefore the interface will be able to access the core without needing to cast to "any".
2054
+ * [optional] any 3rd party plugins which are already implementing this interface don't fail to compile.
2055
+ */
2056
+ core?: IAppInsightsCore;
2057
+ }
2058
+
2059
+ /**
2060
+ * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
2061
+ * between multiple AppInsights instances
2062
+ */
2063
+ export declare interface IProcessTelemetryContext extends IBaseProcessingContext {
2064
+ /**
2065
+ * Call back for telemetry processing before it it is sent
2066
+ * @param env - This is the current event being reported
2067
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2068
+ */
2069
+ processNext: (env: ITelemetryItem) => boolean | void;
2070
+ /**
2071
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2072
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2073
+ * then the current execution order will be copied.
2074
+ * @param startAt - The plugin to start processing from, if missing from the execution
2075
+ * order then the next plugin will be NOT set.
2076
+ */
2077
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2078
+ }
2079
+
2080
+ /**
2081
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
2082
+ * or the SDK is being unloaded.
2083
+ */
2084
+ export declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
2085
+ /**
2086
+ * This Plugin has finished unloading, so unload the next one
2087
+ * @param uploadState - The state of the unload process
2088
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2089
+ */
2090
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
2091
+ /**
2092
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2093
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2094
+ * then the current execution order will be copied.
2095
+ * @param startAt - The plugin to start processing from, if missing from the execution
2096
+ * order then the next plugin will be NOT set.
2097
+ */
2098
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
2099
+ }
2100
+
2101
+ /**
2102
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
2103
+ * for when plugins are added, removed or the configuration was changed.
2104
+ */
2105
+ export declare interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
2106
+ /**
2107
+ * This Plugin has finished unloading, so unload the next one
2108
+ * @param updateState - The update State
2109
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2110
+ */
2111
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
2112
+ /**
2113
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2114
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2115
+ * then the current execution order will be copied.
2116
+ * @param startAt - The plugin to start processing from, if missing from the execution
2117
+ * order then the next plugin will be NOT set.
2118
+ */
2119
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
2120
+ }
2121
+
2122
+ export declare interface _IRegisteredEvents {
2123
+ name: string;
2124
+ handler: any;
2125
+ }
2126
+
2127
+ export { isArray }
2128
+
2129
+ /**
2130
+ * Checks if HTML5 Beacons are supported in the current environment.
2131
+ * @returns True if supported, false otherwise.
2132
+ */
2133
+ export declare function isBeaconsSupported(): boolean;
2134
+
2135
+ export { isBoolean }
2136
+
2137
+ export { isDate }
2138
+
2139
+ export { isError }
2140
+
2141
+ /**
2142
+ * Checks if the Fetch API is supported in the current environment.
2143
+ * @param withKeepAlive - [Optional] If True, check if fetch is available and it supports the keepalive feature, otherwise only check if fetch is supported
2144
+ * @returns True if supported, otherwise false
2145
+ */
2146
+ export declare function isFetchSupported(withKeepAlive?: boolean): boolean;
2147
+
2148
+ export { isFunction }
2149
+
2150
+ /**
2151
+ * Identifies whether the current environment appears to be IE
2152
+ */
2153
+ export declare function isIE(): boolean;
2154
+
2155
+ export declare function isNotNullOrUndefined<T>(value: T): value is T;
2156
+
2157
+ export { isNotTruthy }
2158
+
2159
+ export declare function isNotUndefined<T>(value: T): value is T;
2160
+
2161
+ export { isNullOrUndefined }
2162
+
2163
+ export { isNumber }
2164
+
2165
+ export { isObject }
2166
+
2167
+ /**
2168
+ * Returns whether the environment is reporting that we are running in a React Native Environment
2169
+ */
2170
+ export declare function isReactNative(): boolean;
2171
+
2172
+ export declare function isSafari(userAgentStr?: string): boolean;
2173
+
2174
+ /**
2175
+ * Is the parsed traceParent indicating that the trace is currently sampled.
2176
+ * @param value - The parsed traceParent value
2177
+ * @returns
2178
+ */
2179
+ export declare function isSampledFlag(value: ITraceParent): boolean;
2180
+
2181
+ export { isString }
2182
+
2183
+ export { isSymbol }
2184
+
2185
+ export { isTruthy }
2186
+
2187
+ export { isTypeof }
2188
+
2189
+ export { isUndefined }
2190
+
2191
+ /**
2192
+ * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character
2193
+ * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
2194
+ * If all characters are zero (0000000000000000) this is considered an invalid value.
2195
+ * @param value - The W3c span id to be validated
2196
+ * @returns true if valid otherwise false
2197
+ */
2198
+ export declare function isValidSpanId(value: string): boolean;
2199
+
2200
+ /**
2201
+ * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string
2202
+ * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.
2203
+ * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.
2204
+ * @param value - The W3c trace Id to be validated
2205
+ * @returns true if valid otherwise false
2206
+ */
2207
+ export declare function isValidTraceId(value: string): boolean;
2208
+
2209
+ /**
2210
+ * Validates that the provided ITraceParent instance conforms to the currently supported specifications
2211
+ * @param value
2212
+ * @returns
2213
+ */
2214
+ export declare function isValidTraceParent(value: ITraceParent): boolean;
2215
+
2216
+ /**
2217
+ * Checks if XMLHttpRequest is supported
2218
+ * @returns True if supported, otherwise false
2219
+ */
2220
+ export declare function isXhrSupported(): boolean;
2221
+
2222
+ export declare interface ITelemetryInitializerContainer {
2223
+ /**
2224
+ * Add a telemetry processor to decorate or drop telemetry events.
2225
+ * @param telemetryInitializer - The Telemetry Initializer function
2226
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
2227
+ */
2228
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
2229
+ }
2230
+
2231
+ export declare interface ITelemetryInitializerHandler extends ILegacyUnloadHook {
2232
+ remove(): void;
2233
+ }
2234
+
2235
+ /**
2236
+ * Telemety item supported in Core
2237
+ */
2238
+ export declare interface ITelemetryItem {
2239
+ /**
2240
+ * CommonSchema Version of this SDK
2241
+ */
2242
+ ver?: string;
2243
+ /**
2244
+ * Unique name of the telemetry item
2245
+ */
2246
+ name: string;
2247
+ /**
2248
+ * Timestamp when item was sent
2249
+ */
2250
+ time?: string;
2251
+ /**
2252
+ * Identifier of the resource that uniquely identifies which resource data is sent to
2253
+ */
2254
+ iKey?: string;
2255
+ /**
2256
+ * System context properties of the telemetry item, example: ip address, city etc
2257
+ */
2258
+ ext?: {
2259
+ [key: string]: any;
2260
+ };
2261
+ /**
2262
+ * System context property extensions that are not global (not in ctx)
2263
+ */
2264
+ tags?: Tags & Tags[];
2265
+ /**
2266
+ * Custom data
2267
+ */
2268
+ data?: ICustomProperties;
2269
+ /**
2270
+ * Telemetry type used for part B
2271
+ */
2272
+ baseType?: string;
2273
+ /**
2274
+ * Based on schema for part B
2275
+ */
2276
+ baseData?: {
2277
+ [key: string]: any;
2278
+ };
2279
+ }
2280
+
2281
+ /**
2282
+ * Configuration provided to SDK core
2283
+ */
2284
+ export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2285
+ /**
2286
+ * Set next extension for telemetry processing, this is not optional as plugins should use the
2287
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2288
+ * now for backward compatibility only.
2289
+ */
2290
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2291
+ /**
2292
+ * Priority of the extension
2293
+ */
2294
+ readonly priority: number;
2295
+ }
2296
+
2297
+ /**
2298
+ * Configuration provided to SDK core
2299
+ */
2300
+ export declare interface ITelemetryPluginChain extends ITelemetryProcessor {
2301
+ /**
2302
+ * Returns the underlying plugin that is being proxied for the processTelemetry call
2303
+ */
2304
+ getPlugin: () => ITelemetryPlugin;
2305
+ /**
2306
+ * Returns the next plugin
2307
+ */
2308
+ getNext: () => ITelemetryPluginChain;
2309
+ /**
2310
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2311
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2312
+ * @param unloadCtx - The unload context to use for this call.
2313
+ * @param unloadState - The details of the unload operation
2314
+ */
2315
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2316
+ }
2317
+
2318
+ declare interface ITelemetryProcessor {
2319
+ /**
2320
+ * Call back for telemetry processing before it it is sent
2321
+ * @param env - This is the current event being reported
2322
+ * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
2323
+ * can optionally use this to access the current core instance or define / pass additional information
2324
+ * to later plugins (vs appending items to the telemetry item)
2325
+ */
2326
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2327
+ /**
2328
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
2329
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2330
+ * the configuration has bee updated.
2331
+ * @param updateCtx - This is the context that should be used during updating.
2332
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2333
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2334
+ */
2335
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2336
+ }
2337
+
2338
+ export declare interface ITelemetryUnloadState {
2339
+ reason: TelemetryUnloadReason;
2340
+ isAsync: boolean;
2341
+ flushComplete?: boolean;
2342
+ }
2343
+
2344
+ export declare interface ITelemetryUpdateState {
2345
+ /**
2346
+ * Identifies the reason for the update notification, this is a bitwise numeric value
2347
+ */
2348
+ reason: TelemetryUpdateReason;
2349
+ /**
2350
+ * This is a new active configuration that should be used
2351
+ */
2352
+ cfg?: IConfiguration;
2353
+ /**
2354
+ * The detected changes
2355
+ */
2356
+ oldCfg?: IConfiguration;
2357
+ /**
2358
+ * If this is a configuration update this was the previous configuration that was used
2359
+ */
2360
+ newConfig?: IConfiguration;
2361
+ /**
2362
+ * Was the new config requested to be merged with the existing config
2363
+ */
2364
+ merge?: boolean;
2365
+ /**
2366
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2367
+ */
2368
+ added?: IPlugin[];
2369
+ /**
2370
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2371
+ */
2372
+ removed?: IPlugin[];
2373
+ }
2374
+
2375
+ /**
2376
+ * This interface represents the components of a W3C traceparent header
2377
+ */
2378
+ export declare interface ITraceParent {
2379
+ /**
2380
+ * The version of the definition, this MUST be a string with a length of 2 and only contain lowercase
2381
+ * hexadecimal characters. A value of 'ff' is considered to be an invalid version.
2382
+ */
2383
+ version: string;
2384
+ /**
2385
+ * This is the ID of the whole trace forest and is used to uniquely identify a distributed trace
2386
+ * through a system. It is represented as a 32-character string of lowercase hexadecimal characters,
2387
+ * for example, 4bf92f3577b34da6a3ce929d0e0e4736.
2388
+ * All characters as zero (00000000000000000000000000000000) is considered an invalid value.
2389
+ */
2390
+ traceId: string;
2391
+ /**
2392
+ * This is the ID of the current request as known by the caller (in some tracing systems, this is also
2393
+ * known as the parent-id, where a span is the execution of a client request). It is represented as an
2394
+ * 16-character string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
2395
+ * All bytes as zero (0000000000000000) is considered an invalid value.
2396
+ */
2397
+ spanId: string;
2398
+ /**
2399
+ * An 8-bit value of flags that controls tracing such as sampling, trace level, etc. These flags are
2400
+ * recommendations given by the caller rather than strict rules to follow.
2401
+ * As this is a bit field, you cannot interpret flags by decoding the hex value and looking at the resulting
2402
+ * number. For example, a flag 00000001 could be encoded as 01 in hex, or 09 in hex if present with the flag
2403
+ * 00001000. A common mistake in bit fields is forgetting to mask when interpreting flags.
2404
+ */
2405
+ traceFlags: number;
2406
+ }
2407
+
2408
+ export declare interface IUnloadableComponent {
2409
+ /**
2410
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
2411
+ * finishes it's removal.
2412
+ * @param unloadCtx - This is the context that should be used during unloading.
2413
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
2414
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
2415
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
2416
+ */
2417
+ _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
2418
+ }
2419
+
2420
+ export declare interface IUnloadHandlerContainer {
2421
+ add: (handler: UnloadHandler) => void;
2422
+ run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2423
+ }
2424
+
2425
+ /**
2426
+ * An interface which provides automatic removal during unloading of the component
2427
+ */
2428
+ export declare interface IUnloadHook {
2429
+ /**
2430
+ * Self remove the referenced component
2431
+ */
2432
+ rm: () => void;
2433
+ }
2434
+
2435
+ /**
2436
+ * Interface which identifiesAdd this hook so that it is automatically removed during unloading
2437
+ * @param hooks - The single hook or an array of IInstrumentHook objects
2438
+ */
2439
+ export declare interface IUnloadHookContainer {
2440
+ add: (hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>) => void;
2441
+ run: (logger?: IDiagnosticLogger) => void;
2442
+ }
2443
+
2444
+ export declare interface IWatchDetails<T extends IConfiguration> {
2445
+ /**
2446
+ * The current config object
2447
+ */
2448
+ cfg: T;
2449
+ /**
2450
+ * Set the value against the provided config/name with the value, the property
2451
+ * will be converted to be dynamic (if not already) as long as the provided config
2452
+ * is already a tracked dynamic object.
2453
+ * @throws TypeError if the provided config is not a monitored dynamic config
2454
+ */
2455
+ set: <C, V>(theConfig: C, name: string, value: V) => V;
2456
+ /**
2457
+ * Set default values for the config if not present.
2458
+ * @param theConfig - The configuration object to set default on (if missing)
2459
+ * @param defaultValues - The default values to apply to the config
2460
+ */
2461
+ setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C>) => C;
2462
+ /**
2463
+ * Set this named property of the target as referenced, which will cause any object or array instance
2464
+ * to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
2465
+ * @returns The referenced properties current value
2466
+ */
2467
+ ref: <C, V = any>(target: C, name: string) => V;
2468
+ /**
2469
+ * Set this named property of the target as read-only, which will block this single named property from
2470
+ * ever being changed for the target instance.
2471
+ * This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
2472
+ * if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
2473
+ * @returns The referenced properties current value
2474
+ */
2475
+ rdOnly: <C, V = any>(target: C, name: string) => V;
2476
+ }
2477
+
2478
+ export declare interface IWatcherHandler<T extends IConfiguration> extends IUnloadHook {
2479
+ fn: WatcherFunction<T>;
2480
+ rm: () => void;
2481
+ }
2482
+
2483
+ export declare const LoggingSeverity: EnumValue<typeof eLoggingSeverity>;
2484
+
2485
+ export declare type LoggingSeverity = number | eLoggingSeverity;
2486
+
2487
+ /**
2488
+ * Logs a message to the internal queue.
2489
+ * @param logger - The Diagnostic Logger instance to use.
2490
+ * @param severity - {LoggingSeverity} - The severity of the log message
2491
+ * @param message - {_InternalLogMessage} - The message to log.
2492
+ */
2493
+ export declare function _logInternalMessage(logger: IDiagnosticLogger, severity: LoggingSeverity, message: _InternalLogMessage): void;
2494
+
2495
+ export declare function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
2496
+
2497
+ export declare const MinChannelPriorty: number;
2498
+
2499
+ /**
2500
+ * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)
2501
+ * instead of Math.random() defaults to un-signed.
2502
+ * Used as a replacement random generator for IE to avoid issues with older IE instances.
2503
+ * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
2504
+ */
2505
+ export declare function mwcRandom32(signed?: boolean): number;
2506
+
2507
+ /**
2508
+ * Seed the MWC random number generator with the specified seed or a random value
2509
+ * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen
2510
+ */
2511
+ export declare function mwcRandomSeed(value?: number): void;
2512
+
2513
+ export declare function newGuid(): string;
2514
+
2515
+ /**
2516
+ * Generate random base64 id string.
2517
+ * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
2518
+ * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
2519
+ */
2520
+ export declare function newId(maxLength?: number): string;
2521
+
2522
+ /**
2523
+ * Validates that the string name conforms to the JS IdentifierName specification and if not
2524
+ * normalizes the name so that it would. This method does not identify or change any keywords
2525
+ * meaning that if you pass in a known keyword the same value will be returned.
2526
+ * This is a simplified version
2527
+ * @param name - The name to validate
2528
+ */
2529
+ export declare function normalizeJsName(name: string): string;
2530
+
2531
+ /**
2532
+ * Class to manage sending notifications to all the listeners.
2533
+ */
2534
+ export declare class NotificationManager implements INotificationManager {
2535
+ listeners: INotificationListener[];
2536
+ constructor(config?: IConfiguration);
2537
+ /**
2538
+ * Adds a notification listener.
2539
+ * @param listener - The notification listener to be added.
2540
+ */
2541
+ addNotificationListener(listener: INotificationListener): void;
2542
+ /**
2543
+ * Removes all instances of the listener.
2544
+ * @param listener - AWTNotificationListener to remove.
2545
+ */
2546
+ removeNotificationListener(listener: INotificationListener): void;
2547
+ /**
2548
+ * Notification for events sent.
2549
+ * @param events - The array of events that have been sent.
2550
+ */
2551
+ eventsSent(events: ITelemetryItem[]): void;
2552
+ /**
2553
+ * Notification for events being discarded.
2554
+ * @param events - The array of events that have been discarded by the SDK.
2555
+ * @param reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
2556
+ * constant should be used to check the different values.
2557
+ */
2558
+ eventsDiscarded(events: ITelemetryItem[], reason: number): void;
2559
+ /**
2560
+ * [Optional] A function called when the events have been requested to be sent to the sever.
2561
+ * @param sendReason - The reason why the event batch is being sent.
2562
+ * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
2563
+ */
2564
+ eventsSendRequest?(sendReason: number, isAsync: boolean): void;
2565
+ /**
2566
+ * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
2567
+ * the event can be displayed via the debug plugin extension.
2568
+ * @param perfEvent
2569
+ */
2570
+ perfEvent?(perfEvent: IPerfEvent): void;
2571
+ }
2572
+
2573
+ export { objDefineAccessors }
2574
+
2575
+ /**
2576
+ * Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
2577
+ * It will NOT merge inherited or non-enumerable properties.
2578
+ * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
2579
+ * @param obj2 - object to merge.
2580
+ * @param obj3 - object to merge.
2581
+ * @param obj4 - object to merge.
2582
+ * @param obj5 - object to merge.
2583
+ * @returns The extended first object.
2584
+ */
2585
+ export declare function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
2586
+
2587
+ export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
2588
+
2589
+ export { objForEachKey }
2590
+
2591
+ export { objFreeze }
2592
+
2593
+ export { objKeys }
2594
+
2595
+ export { objSeal }
2596
+
2597
+ export { objToString }
2598
+
2599
+ /**
2600
+ * Watch and track changes for accesses to the current config, the provided config MUST already be
2601
+ * a dynamic config or a child accessed via the dynamic config
2602
+ * @param config
2603
+ * @param configHandler
2604
+ * @param logger - The logger instance to use if there is no existing handler
2605
+ * @returns A watcher handler instance that can be used to remove itself when being unloaded
2606
+ * @throws TypeError if the provided config is not a dynamic config instance
2607
+ */
2608
+ export declare function onConfigChange<T>(config: T, configHandler: WatcherFunction<T>, logger?: IDiagnosticLogger): IWatcherHandler<T>;
2609
+
2610
+ /**
2611
+ * A helper function to assist with JIT performance for objects that have properties added / removed dynamically
2612
+ * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
2613
+ * function after you have finished "updating" the object, calling this within loops reduces or defeats the benefits.
2614
+ * This helps when iterating using for..in, objKeys() and objForEach()
2615
+ * @param theObject - The object to be optimized if possible
2616
+ */
2617
+ export declare function optimizeObject<T>(theObject: T): T;
2618
+
2619
+ /**
2620
+ * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)
2621
+ *
2622
+ * @param value
2623
+ * @returns
2624
+ */
2625
+ export declare function parseTraceParent(value: string): ITraceParent;
2626
+
2627
+ export declare class PerfEvent implements IPerfEvent {
2628
+ static ParentContextKey: string;
2629
+ static ChildrenContextKey: string;
2630
+ /**
2631
+ * The name of the event
2632
+ */
2633
+ name: string;
2634
+ /**
2635
+ * The start time of the event in ms
2636
+ */
2637
+ start: number;
2638
+ /**
2639
+ * The payload (contents) of the perfEvent, may be null or only set after the event has completed depending on
2640
+ * the runtime environment.
2641
+ */
2642
+ payload: any;
2643
+ /**
2644
+ * Is this occurring from an asynchronous event
2645
+ */
2646
+ isAsync: boolean;
2647
+ /**
2648
+ * Identifies the total inclusive time spent for this event, including the time spent for child events,
2649
+ * this will be undefined until the event is completed
2650
+ */
2651
+ time?: number;
2652
+ /**
2653
+ * Identifies the exclusive time spent in for this event (not including child events),
2654
+ * this will be undefined until the event is completed.
2655
+ */
2656
+ exTime?: number;
2657
+ /**
2658
+ * Identifies whether this event is a child event of a parent
2659
+ */
2660
+ isChildEvt: () => boolean;
2661
+ getCtx?: (key: string) => any | null | undefined;
2662
+ setCtx?: (key: string, value: any) => void;
2663
+ complete: () => void;
2664
+ constructor(name: string, payloadDetails: () => any, isAsync: boolean);
2665
+ }
2666
+
2667
+ export declare class PerfManager implements IPerfManager {
2668
+ /**
2669
+ * General bucket used for execution context set and retrieved via setCtx() and getCtx.
2670
+ * Defined as private so it can be visualized via the DebugPlugin
2671
+ */
2672
+ private ctx;
2673
+ constructor(manager?: INotificationManager);
2674
+ /**
2675
+ * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
2676
+ * want to monitor this source event.
2677
+ * @param src - The source name of the event
2678
+ * @param payloadDetails - An optional callback function to fetch the payload details for the event.
2679
+ * @param isAsync - Is the event occurring from a async event
2680
+ */
2681
+ create(src: string, payload?: any, isAsync?: boolean): IPerfEvent | null | undefined;
2682
+ /**
2683
+ * Complete the perfEvent and fire any notifications.
2684
+ * @param perfEvent - Fire the event which will also complete the passed event
2685
+ */
2686
+ fire(perfEvent: IPerfEvent): void;
2687
+ /**
2688
+ * Set an execution context value
2689
+ * @param key - The context key name
2690
+ * @param value - The value
2691
+ */
2692
+ setCtx(key: string, value: any): void;
2693
+ /**
2694
+ * Get the execution context value
2695
+ * @param key - The context key
2696
+ */
2697
+ getCtx(key: string): any;
2698
+ }
2699
+
2700
+ export { perfNow }
2701
+
2702
+ /**
2703
+ * This class will be removed!
2704
+ * @deprecated use createProcessTelemetryContext() instead
2705
+ */
2706
+ export declare class ProcessTelemetryContext implements IProcessTelemetryContext {
2707
+ /**
2708
+ * Gets the current core config instance
2709
+ */
2710
+ getCfg: () => IConfiguration;
2711
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
2712
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
2713
+ /**
2714
+ * Returns the IAppInsightsCore instance for the current request
2715
+ */
2716
+ core: () => IAppInsightsCore;
2717
+ /**
2718
+ * Returns the current IDiagnosticsLogger for the current request
2719
+ */
2720
+ diagLog: () => IDiagnosticLogger;
2721
+ /**
2722
+ * Helper to allow inherited classes to check and possibly shortcut executing code only
2723
+ * required if there is a nextPlugin
2724
+ */
2725
+ hasNext: () => boolean;
2726
+ /**
2727
+ * Returns the next configured plugin proxy
2728
+ */
2729
+ getNext: () => ITelemetryPluginChain;
2730
+ /**
2731
+ * Helper to set the next plugin proxy
2732
+ */
2733
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
2734
+ /**
2735
+ * Call back for telemetry processing before it it is sent
2736
+ * @param env - This is the current event being reported
2737
+ * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
2738
+ * can optionally use this to access the current core instance or define / pass additional information
2739
+ * to later plugins (vs appending items to the telemetry item)
2740
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2741
+ */
2742
+ processNext: (env: ITelemetryItem) => boolean | void;
2743
+ /**
2744
+ * Synchronously iterate over the context chain running the callback for each plugin, once
2745
+ * every plugin has been executed via the callback, any associated onComplete will be called.
2746
+ * @param callback - The function call for each plugin in the context chain
2747
+ */
2748
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
2749
+ /**
2750
+ * Create a new context using the core and config from the current instance
2751
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2752
+ * then the current execution order will be copied.
2753
+ * @param startAt - The plugin to start processing from, if missing from the execution
2754
+ * order then the next plugin will be NOT set.
2755
+ */
2756
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2757
+ /**
2758
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
2759
+ */
2760
+ onComplete: (onComplete: () => void) => void;
2761
+ /**
2762
+ * Creates a new Telemetry Item context with the current config, core and plugin execution chain
2763
+ * @param plugins - The plugin instances that will be executed
2764
+ * @param config - The current config
2765
+ * @param core - The current core instance
2766
+ */
2767
+ constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
2768
+ }
2769
+
2770
+ /**
2771
+ * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from
2772
+ * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential
2773
+ * implementation issues by assigning prototype functions as instance ones
2774
+ *
2775
+ * This method is the primary method used to "update" the snippet proxy with the ultimate implementations.
2776
+ *
2777
+ * Special ES3 Notes:
2778
+ * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the
2779
+ * properties of "referenced" object will work (target.context.newValue = 10 => will be reflected in the source.context as it's the
2780
+ * same object). ES3 Failures: assigning target.myProp = 3 -> Won't change source.myProp = 3, likewise the reverse would also fail.
2781
+ * @param target - The target object to be assigned with the source properties and functions
2782
+ * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2783
+ * @param chkSet - An optional callback to determine whether a specific property/function should be proxied
2784
+ */
2785
+ export declare function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
2786
+
2787
+ /**
2788
+ * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.
2789
+ *
2790
+ * @param target - The target object to be assigned with the source properties and functions
2791
+ * @param name - The function name that will be added on the target
2792
+ * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2793
+ * @param theFunc - The function name on the source that will be proxied on the target
2794
+ * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
2795
+ */
2796
+ export declare function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
2797
+
2798
+ /**
2799
+ * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
2800
+ *
2801
+ * @param target - The target object to be assigned with the source properties and functions
2802
+ * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2803
+ * @param functionsToProxy - An array of function names that will be proxied on the target
2804
+ * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
2805
+ */
2806
+ export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
2807
+
2808
+ /**
2809
+ * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
2810
+ * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
2811
+ */
2812
+ export declare function random32(signed?: boolean): number;
2813
+
2814
+ /**
2815
+ * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.
2816
+ * So maxValue(16) will produce a number from 0..16 (range of 17)
2817
+ * @param maxValue
2818
+ */
2819
+ export declare function randomValue(maxValue: number): number;
2820
+
2821
+ /**
2822
+ * Trys to remove event handler(s) for the specified event/namespace to the window, body and document
2823
+ * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,
2824
+ * such as "click", "click.mynamespace" or ".mynamespace"
2825
+ * @param callback - {any} - - The callback function that needs to be removed from the given event, when using a
2826
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
2827
+ * otherwise this will only remove events with this specific handler.
2828
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2829
+ */
2830
+ export declare function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
2831
+
2832
+ /**
2833
+ * Remove the listener from the array of events
2834
+ * @param events - An string array of event names to bind the listener to
2835
+ * @param listener - The event callback to call when the event is triggered
2836
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2837
+ */
2838
+ export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
2839
+
2840
+ /**
2841
+ * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
2842
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
2843
+ * as the remove ignores the listener argument for the 'visibilitychange' event.
2844
+ * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2845
+ * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2846
+ */
2847
+ export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2848
+
2849
+ /**
2850
+ * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
2851
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
2852
+ * as the remove ignores the listener argument for the 'visibilitychange' event.
2853
+ * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2854
+ * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2855
+ */
2856
+ export declare function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2857
+
2858
+ /**
2859
+ * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
2860
+ * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
2861
+ * @param listener - The specific event callback to to be removed
2862
+ * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
2863
+ * @returns true - when at least one of the events was registered otherwise false
2864
+ */
2865
+ export declare function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
2866
+
2867
+ /**
2868
+ * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
2869
+ * associated with the configuration or a legacy default.
2870
+ * @param core
2871
+ * @param config
2872
+ * @returns
2873
+ */
2874
+ export declare function safeGetCookieMgr(core: IAppInsightsCore, config?: IConfiguration): ICookieMgr;
2875
+
2876
+ export declare function safeGetLogger(core: IAppInsightsCore, config?: IConfiguration): IDiagnosticLogger;
2877
+
2878
+ /**
2879
+ * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
2880
+ */
2881
+ export declare const enum SendRequestReason {
2882
+ /**
2883
+ * No specific reason was specified
2884
+ */
2885
+ Undefined = 0,
2886
+ /**
2887
+ * Events are being sent based on the normal event schedule / timer.
2888
+ */
2889
+ NormalSchedule = 1,
2890
+ /**
2891
+ * A manual flush request was received
2892
+ */
2893
+ ManualFlush = 1,
2894
+ /**
2895
+ * Unload event is being processed
2896
+ */
2897
+ Unload = 2,
2898
+ /**
2899
+ * The event(s) being sent are sync events
2900
+ */
2901
+ SyncEvent = 3,
2902
+ /**
2903
+ * The Channel was resumed
2904
+ */
2905
+ Resumed = 4,
2906
+ /**
2907
+ * The event(s) being sent as a retry
2908
+ */
2909
+ Retry = 5,
2910
+ /**
2911
+ * The SDK is unloading
2912
+ */
2913
+ SdkUnload = 6,
2914
+ /**
2915
+ * Maximum batch size would be exceeded
2916
+ */
2917
+ MaxBatchSize = 10,
2918
+ /**
2919
+ * The Maximum number of events have already been queued
2920
+ */
2921
+ MaxQueuedEvents = 20
2922
+ }
2923
+
2924
+ /**
2925
+ * Enable the lookup of test mock objects if requested
2926
+ * @param enabled
2927
+ */
2928
+ export declare function setEnableEnvMocks(enabled: boolean): void;
2929
+
2930
+ /**
2931
+ * Set the global performance manager to use when there is no core instance or it has not been initialized yet.
2932
+ * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.
2933
+ */
2934
+ export declare function setGblPerfMgr(perfManager: IPerfManager): void;
2935
+
2936
+ /**
2937
+ * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk
2938
+ * function will only be called if the new value is no equal to the original value.
2939
+ * @param target - The target object
2940
+ * @param field - The key of the target
2941
+ * @param value - The value to set
2942
+ * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set
2943
+ * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
2944
+ * @returns The existing or new value, depending what was set
2945
+ */
2946
+ export declare function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
2947
+
2948
+ export declare function sortPlugins<T = IPlugin>(plugins: T[]): T[];
2949
+
2950
+ /**
2951
+ * A simple wrapper (for minification support) to check if the value contains the search string.
2952
+ * @param value - The string value to check for the existence of the search value
2953
+ * @param search - The value search within the value
2954
+ */
2955
+ export declare function strContains(value: string, search: string): boolean;
2956
+
2957
+ export { strEndsWith }
2958
+
2959
+ export { strFunction }
2960
+
2961
+ export { strObject }
2962
+
2963
+ export { strPrototype }
2964
+
2965
+ export { strStartsWith }
2966
+
2967
+ export { strTrim }
2968
+
2969
+ export { strUndefined }
2970
+
2971
+ export declare interface Tags {
2972
+ [key: string]: any;
2973
+ }
2974
+
2975
+ export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2976
+
2977
+ /**
2978
+ * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2979
+ */
2980
+ export declare const enum TelemetryUnloadReason {
2981
+ /**
2982
+ * Teardown has been called without any context.
2983
+ */
2984
+ ManualTeardown = 0,
2985
+ /**
2986
+ * Just this plugin is being removed
2987
+ */
2988
+ PluginUnload = 1,
2989
+ /**
2990
+ * This instance of the plugin is being removed and replaced
2991
+ */
2992
+ PluginReplace = 2,
2993
+ /**
2994
+ * The entire SDK is being unloaded
2995
+ */
2996
+ SdkUnload = 50
2997
+ }
2998
+
2999
+ /**
3000
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
3001
+ */
3002
+ export declare const enum TelemetryUpdateReason {
3003
+ /**
3004
+ * Unknown.
3005
+ */
3006
+ Unknown = 0,
3007
+ /**
3008
+ * The configuration has ben updated or changed
3009
+ */
3010
+ ConfigurationChanged = 1,
3011
+ /**
3012
+ * One or more plugins have been added
3013
+ */
3014
+ PluginAdded = 16,
3015
+ /**
3016
+ * One or more plugins have been removed
3017
+ */
3018
+ PluginRemoved = 32
3019
+ }
3020
+
3021
+ /**
3022
+ * Throws an Aggregation Error which includes all of the errors that led to this error occurring
3023
+ * @param message - The message describing the aggregation error (the sourceError details are added to this)
3024
+ * @param sourceErrors - An array of the errors that caused this situation
3025
+ */
3026
+ export declare function throwAggregationError(message: string, sourceErrors: any[]): never;
3027
+
3028
+ export { throwError }
3029
+
3030
+ /**
3031
+ * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
3032
+ * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
3033
+ * support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
3034
+ * the code.
3035
+ * @param logger - The Diagnostic Logger instance to use.
3036
+ * @param severity - {LoggingSeverity} - The severity of the log message
3037
+ * @param message - {_InternalLogMessage} - The log message.
3038
+ */
3039
+ export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
3040
+
3041
+ /**
3042
+ * Convert a date to I.S.O. format in IE8
3043
+ */
3044
+ export declare function toISOString(date: Date): string;
3045
+
3046
+ export declare function uaDisallowsSameSiteNone(userAgent: string): boolean;
3047
+
3048
+ export declare const Undefined = "undefined";
3049
+
3050
+ /**
3051
+ * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any
3052
+ * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.
3053
+ * @param components - The components you want to unload
3054
+ * @param unloadCtx - This is the context that should be used during unloading.
3055
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
3056
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
3057
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
3058
+ */
3059
+ export declare function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
3060
+
3061
+ export declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
3062
+
3063
+ export declare function useXDomainRequest(): boolean | undefined;
3064
+
3065
+ /**
3066
+ * This is a helper method which will call warnToConsole on the passed logger with the provided message.
3067
+ * @param logger - The Diagnostic Logger instance to use.
3068
+ * @param message - {_InternalLogMessage} - The log message.
3069
+ */
3070
+ export declare function _warnToConsole(logger: IDiagnosticLogger, message: string): void;
3071
+
3072
+ export declare type WatcherFunction<T extends IConfiguration> = (details: IWatchDetails<T>) => void;
3073
+
3074
+ export { }