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